/* Morning Signal Brief. Palette drawn from the cover: cream, navy, warm orange. */

:root {
  --bg: #faf5ea;
  --surface: #fffdf8;
  --text: #14203a;
  --muted: #535d78;
  --rule: #e4dac6;
  --accent: #b9490c;        /* orange for text and outlines on cream */
  --accent-fill: #bf4d0d;   /* orange for filled controls */
  --on-accent: #ffffff;
  --apple-podcasts: #7d2ca3;
  --spotify: #168342;
  --focus: #14203a;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --player-height: 0px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f182c;
    --surface: #16213a;
    --text: #f4ecdd;
    --muted: #a8b0c4;
    --rule: #28344f;
    --accent: #f59a52;
    --accent-fill: #f08a3c;
    --on-accent: #0f182c;
    --apple-podcasts: #c27aff;
    --spotify: #1ed760;
    --focus: #f4ecdd;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1rem;
  scroll-padding-bottom: calc(var(--player-height) + 1rem);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 1rem; top: -4rem;
  padding: 0.5rem 0.9rem;
  background: var(--text);
  color: var(--bg);
  border-radius: 6px;
  text-decoration: none;
  z-index: 20;
}
.skip:focus { top: 1rem; }

/* main is only focusable as the skip-link target; it needs no ring. */
main:focus { outline: none; }

.page {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2rem 1.25rem calc(var(--player-height) + 2.5rem);
}

/* Show header */

.show {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}

.cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--rule);
}

h1 {
  margin: 0 0 0.4rem;
  font: 700 1.7rem/1.15 var(--serif);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.lede { margin: 0; color: var(--text); max-width: 34rem; }

.credit { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.9rem; }

.subscribe {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0 0.95rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: 600 0.9rem/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--surface); border-color: var(--muted); }
.btn .icon { width: 1rem; height: 1rem; fill: currentColor; }
.btn-apple-podcasts .icon { color: var(--apple-podcasts); }
.btn-spotify .icon { color: var(--spotify); }
.btn-rss .icon { color: var(--accent); }

/* On narrow screens the text wraps under the artwork to keep the measure readable. */
@media (max-width: 30rem) {
  .show { grid-template-columns: 72px minmax(0, 1fr); gap: 0.9rem; }
  h1 { font-size: 1.4rem; }
  .lede, .credit, .subscribe { grid-column: 1 / -1; }
  .show-body { display: contents; }
  .show-body h1 { align-self: center; margin: 0; }
  .lede { margin-top: 0.2rem; }
  .credit { margin-top: 0; }
  .subscribe { margin-top: 0.2rem; }
}

@media (min-width: 40rem) {
  .page { padding-top: 3.5rem; }
  .show { grid-template-columns: 148px minmax(0, 1fr); gap: 1.75rem; }
  h1 { font-size: 2.1rem; }
}

/* Episodes */

h2 {
  margin: 2rem 0 0;
  color: var(--muted);
  font: 600 0.78rem/1 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.episodes { list-style: none; margin: 0; padding: 0; }

.episode {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.9rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
}
.js .episode { grid-template-columns: 2.75rem minmax(0, 1fr); }

.episode:target .episode-title a,
.episode.is-current .episode-title a { color: var(--accent); }

.episode-title {
  margin: 0;
  font: 700 1.2rem/1.3 var(--serif);
  text-wrap: balance;
}
.episode-title a { color: inherit; text-decoration: none; }
.episode-title a:hover { text-decoration: underline; text-decoration-thickness: 1px; }

.meta { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.summary { margin: 0.6rem 0 0; }

.play {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-top: 0.1rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent-fill);
  color: var(--on-accent);
  cursor: pointer;
}
.play:hover { background: var(--text); color: var(--bg); }

.icon { width: 1.5rem; height: 1.5rem; fill: currentColor; }
.icon-line { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-pause { display: none; }
.is-playing > .icon-play, .is-playing .ctl-main .icon-play { display: none; }
.is-playing > .icon-pause, .is-playing .ctl-main .icon-pause { display: block; }

.chapters { margin-top: 0.8rem; }
.chapters summary {
  display: inline-block;
  padding: 0.3rem 0;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.chapters summary::-webkit-details-marker { display: none; }
.chapters summary::before {
  content: "";
  display: inline-block;
  width: 0.4em; height: 0.4em;
  margin-right: 0.55em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.2em) rotate(-45deg);
}
.chapters[open] summary::before { transform: translateY(-0.3em) rotate(45deg); }
.chapters summary:hover { color: var(--text); }
.chapters .count { font-weight: 400; }

.chapters ol { list-style: none; margin: 0.2rem 0 0; padding: 0; }

.chapter {
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr);
  align-items: baseline;
  min-height: 2.25rem;
  padding: 0.35rem 0.6rem;
  margin: 0 -0.6rem;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9375rem;
  text-decoration: none;
}
.chapter:hover { background: var(--surface); }
.chapter-time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.875rem; }
.chapter[aria-current="true"] { background: var(--surface); font-weight: 600; }
.chapter[aria-current="true"] .chapter-time { color: var(--accent); }

.show-notes { margin-top: 0.55rem; }
.show-notes > summary {
  display: inline-block;
  padding: 0.3rem 0;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.show-notes > summary::-webkit-details-marker { display: none; }
.show-notes > summary::before {
  content: "";
  display: inline-block;
  width: 0.4em; height: 0.4em;
  margin-right: 0.55em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.2em) rotate(-45deg);
}
.show-notes[open] > summary::before { transform: translateY(-0.3em) rotate(45deg); }
.show-notes > summary:hover { color: var(--text); }
.show-notes .count { font-weight: 400; }
.show-notes-content {
  margin-top: 0.45rem;
  padding: 0.2rem 0 0.15rem 0.9rem;
  border-left: 2px solid var(--rule);
}
.show-notes-section + .show-notes-section { margin-top: 1rem; }
.show-notes-section h4 {
  margin: 0 0 0.35rem;
  color: var(--text);
  font: 700 0.98rem/1.35 var(--serif);
}
.show-notes-section ul { margin: 0; padding-left: 1.15rem; }
.show-notes-section li { margin: 0.25rem 0; }
.show-notes-section li span { color: var(--muted); }

.fallback { display: block; width: 100%; margin-top: 0.9rem; }
.js .fallback { display: none; }

.links { margin: 0.7rem 0 0; font-size: 0.875rem; color: var(--muted); }

.empty { margin: 1.5rem 0; padding: 1.5rem 0; border-bottom: 1px solid var(--rule); color: var(--muted); }

.site-footer { margin-top: 2rem; color: var(--muted); font-size: 0.875rem; }
.site-footer p { margin: 0; }

/* Player */

.player {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  background: var(--surface);
  border-top: 1px solid var(--rule);
  padding: 0.7rem max(1.25rem, env(safe-area-inset-right)) calc(0.7rem + env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
}

.player-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "info rate"
    "seek seek"
    "controls controls";
  gap: 0.35rem 0.75rem;
  align-items: center;
  max-width: 44rem;
  margin: 0 auto;
}

.player-info { grid-area: info; min-width: 0; }
.player-title, .player-sub { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-title { font-weight: 600; font-size: 0.9375rem; line-height: 1.3; }
.player-sub { color: var(--muted); font-size: 0.8125rem; line-height: 1.3; min-height: 1.3em; }

.player-controls { grid-area: controls; display: flex; justify-content: center; align-items: center; gap: 1.25rem; }

.ctl {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.75rem; height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text);
  cursor: pointer;
}
.ctl:hover { background: var(--bg); }
.ctl .icon { width: 1.75rem; height: 1.75rem; }
.ctl-num { position: absolute; font-size: 0.56rem; font-weight: 700; letter-spacing: -0.02em; transform: translateY(0.06rem); }
.ctl-main { width: 3rem; height: 3rem; background: var(--accent-fill); color: var(--on-accent); }
.ctl-main:hover { background: var(--text); color: var(--bg); }
.ctl-main .icon { width: 1.6rem; height: 1.6rem; }

.player-seek {
  grid-area: seek;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
}
.time { min-width: 2.6rem; color: var(--muted); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.time[data-duration] { text-align: right; }

input[type="range"] {
  width: 100%;
  height: 1.75rem;
  margin: 0;
  background: none;
  accent-color: var(--accent-fill);
  cursor: pointer;
}

.player-rate { grid-area: rate; }
.player-rate select {
  min-height: 2.25rem;
  padding: 0 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: 600 0.875rem/1 var(--sans);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.player-rate select:hover { border-color: var(--text); }

.player-status {
  max-width: 44rem;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.8125rem;
}
.player-status:empty { display: none; }
.player-status.is-error { color: var(--accent); margin-top: 0.3rem; }

@media (min-width: 46rem) {
  .player-inner {
    grid-template-columns: minmax(0, 13rem) auto minmax(0, 1fr) auto;
    grid-template-areas: "info controls seek rate";
    gap: 1rem;
  }
  .player-controls { gap: 0.25rem; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@media print {
  .player, .play, .subscribe, .skip, .fallback { display: none !important; }
}
