/* Shared styles of the show pages (index.html, stories/index.html). */
/* Palette: the four core colors only. Gray (#6B7280) is 4.4:1 on black, so it is used
   for lines and borders only; secondary text is white at reduced opacity (about 10:1
   on black). Green is a highlight: text, lines, borders, focus rings. Never a fill. */
:root {
  --black: #000000;
  --white: #FFFFFF;
  --gray: #6B7280;
  --green: #22C55E;
  /* The page's highlight: green for Build Wiz AI Show, a soft gold for the story show. */
  --accent: var(--green);
  --accent-glow: rgba(34, 197, 94, .7);
  --text-2: rgba(255, 255, 255, 0.72);
  --text-3: rgba(255, 255, 255, 0.62);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.24);
  --hover: rgba(255, 255, 255, 0.04);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 24px 48px -28px rgba(0, 0, 0, 0.9);
  --radius: 12px;
  --r-ctl: 8px;
  --display: "Bricolage Grotesque", Georgia, serif;
  --body: "Hanken Grotesk", "Helvetica Neue", sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
  --player-h: 0px;
  --toolbar-h: 112px;
  color-scheme: dark;
}
/* Once Upon a Time Show (stories/): the same page, a soft gold highlight. */
.story-show { --accent: #F2C46D; --accent-glow: rgba(242, 196, 109, .6); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--toolbar-h) + 8px); scroll-padding-bottom: calc(var(--player-h) + 16px); }
body {
  margin: 0;
  background: var(--black);
  color: var(--white);
  font: 400 15px/1.55 var(--body);
  font-feature-settings: "tnum" 1;
  padding-bottom: calc(var(--player-h) + 16px);
  min-height: 100vh;
}
/* Film grain over everything, very faint: gives the black depth without a new color. */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 100;
  opacity: 0.05;
  background-image: url("grain.svg");
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header: one slim band instead of a masthead ---------- */
.mast-inner { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 24px; padding-top: 20px; padding-bottom: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand svg { width: 34px; height: 34px; flex: none; }
h1 { font: 800 clamp(24px, 3.4vw, 30px)/1 var(--display); letter-spacing: -0.03em; margin: 0; }
h1 .ai, h1 .hl { color: var(--accent); }
.stats { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 0; margin: 0; font-size: 14px; color: var(--text-2); }
.stats div { display: flex; align-items: baseline; gap: 6px; padding: 0 14px; border-left: 1px solid var(--line-strong); }
.stats div:first-child { border-left: 0; padding-left: 0; }
.stats div:last-child { padding-right: 0; }
.stats dt { order: 2; } .stats .lead dt { order: 0; } .stats dd { order: 1; margin: 0; font: 700 17px/1 var(--display); color: var(--white); }
.tagline { grid-column: 1 / -1; margin: 6px 0 0; max-width: 760px; color: var(--text-2); }
.tagline strong { color: var(--white); font-weight: 600; }
/* The link from one show's page to the other's. */
.show-link { grid-column: 1 / -1; margin: 6px 0 0; font-size: 14px; color: var(--text-2); }
.show-link a { color: var(--white); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }
.show-link a:hover { color: var(--accent); }

/* ---------- Toolbar: sticky so tabs, search and sort are always in reach ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(0, 0, 0, 0.9); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
/* Category tabs: one row of underlined labels on top of the sticky bar. The selected
   tab gets white text and a green underline; counts stay quiet. Scrolls sideways on
   narrow screens instead of wrapping. */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex: none; display: inline-flex; align-items: baseline; gap: 7px;
  height: 44px; padding: 0 12px; border: 0; background: transparent; cursor: pointer;
  font: 700 15px/44px var(--display); letter-spacing: -0.01em; color: var(--text-2); white-space: nowrap;
  transition: color .15s ease;
}
.tab:first-child { padding-left: 0; }
.tab:hover { color: var(--white); }
.tab .n { font: 400 13px/1 var(--body); color: var(--text-3); }
.tab::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: transparent; }
.tab:first-child::after { left: 0; }
.tab[aria-selected="true"] { color: var(--white); }
.tab[aria-selected="true"]::after { background: var(--accent); }
.tab[aria-selected="true"] .n { color: var(--accent); }
.tab:focus-visible { outline-offset: -2px; }
.tab .l-short { display: none; }
.tb-row { display: flex; align-items: center; gap: 8px; padding: 12px 0; }
.ctl { height: 40px; border: 1px solid var(--line-strong); border-radius: var(--r-ctl); background: transparent; transition: border-color .15s ease, color .15s ease; }
.ctl:hover { border-color: var(--white); }
.search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 12px; cursor: text; }
.search:focus-within { border-color: var(--accent); }
.search > svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--text-2); stroke-width: 2; stroke-linecap: round; }
.search input:disabled, .ctl:disabled { opacity: .38; cursor: not-allowed; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none; font-size: 15px; }
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.key { flex: none; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 5px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.search:focus-within .key, .search.has-q .key { display: none; }
.clear-q { flex: none; width: 28px; height: 28px; display: none; place-items: center; border: 0; border-radius: 6px; background: transparent; cursor: pointer; color: var(--text-2); }
.clear-q:hover { color: var(--white); background: var(--hover); }
.clear-q svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.search.has-q .clear-q { display: grid; }
.sort-label { flex: none; margin-left: 4px; font-size: 13px; color: var(--text-2); }
.select { position: relative; flex: none; }
.select select { -webkit-appearance: none; appearance: none; height: 40px; padding: 0 34px 0 12px; font-size: 14px; font-weight: 600; cursor: pointer; }
.select option { background: var(--black); color: var(--white); }
.select::after { content: ""; position: absolute; right: 13px; top: 50%; width: 7px; height: 7px; border: solid var(--text-2); border-width: 0 2px 2px 0; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.order { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.order svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.order[data-dir="asc"] svg { transform: rotate(180deg); }

/* The toolbar's bottom edge doubles as the now-playing progress line. */
.tb-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; pointer-events: none; }
.tb-progress i { display: block; height: 100%; width: 0; background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); transition: width .25s linear; }

/* ---------- Episode index ---------- */
main.wrap { padding-top: 16px; padding-bottom: 32px; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; margin-bottom: 10px; }
.count { margin: 0; font-size: 14px; color: var(--text-2); }
.count b { color: var(--white); font-weight: 600; }
.linkish { border: 0; background: transparent; padding: 6px 2px; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }
.linkish:hover { color: var(--accent); }

/* One bordered panel; 1px gaps over a line-colored background draw the row dividers,
   so hidden rows never leave a doubled border behind. */
.episodes {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.ep { position: relative; background: var(--black); scroll-margin-top: 4px; }
.ep.enter, .ep-group.enter { animation: rise .5s cubic-bezier(.2,.7,.2,1) both; }
/* One story in several languages: one row holding a block per version, one shown. */
.ep-group { position: relative; background: var(--black); scroll-margin-top: 4px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.ep-row { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) 20px; align-items: center; gap: 16px; padding: 12px 16px; transition: background-color .15s ease; }
.ep-row:hover { background: var(--hover); }
.ep.is-current .ep-row { box-shadow: inset 2px 0 0 var(--accent); }
.ep.is-target .ep-row { animation: flash 1.8s ease-out .15s; }
@keyframes flash { 0%, 100% { box-shadow: inset 0 0 0 0 transparent; } 25% { box-shadow: inset 0 0 0 2px var(--accent); } }

.play {
  position: relative; z-index: 1; width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  border: 1px solid var(--line-strong); background: var(--black); cursor: pointer;
  transition: border-color .15s ease, transform .15s ease, color .15s ease;
}
.play:hover { border-color: var(--white); }
.play:active { transform: scale(.95); }
.play svg { width: 18px; height: 18px; fill: currentColor; }
.ep.is-current .play { border-color: var(--accent); color: var(--accent); }
/* Equalizer replaces the pause glyph on the playing row: three green bars. */
.eq { display: none; gap: 3px; align-items: flex-end; height: 16px; }
.eq b { width: 3px; background: var(--accent); border-radius: 1px; animation: eq .9s ease-in-out infinite alternate; }
.eq b:nth-child(2) { animation-delay: -.3s; } .eq b:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { from { height: 4px; } to { height: 16px; } }
.ep.is-playing .play:not(:hover):not(:focus-visible) .eq { display: flex; }
.ep.is-playing .play:not(:hover):not(:focus-visible) svg { display: none; }

.ep-head { min-width: 0; }
.ep h3 { font: 700 17px/1.3 var(--display); letter-spacing: -0.01em; margin: 0 0 3px; overflow-wrap: anywhere; }
/* The title button stretches over the whole row, so any click on the row expands it;
   the play button sits above that layer. */
.ep-toggle { padding: 0; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; letter-spacing: inherit; color: inherit; text-decoration: none; }
.ep-toggle::after { content: ""; position: absolute; inset: 0; }
.ep-toggle:focus-visible { outline: none; }
.ep-toggle:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; }
.ep-row:hover .ep-toggle { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; }
mark { background: none; color: var(--accent); text-decoration-line: underline; text-decoration-thickness: 2px; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.meta { display: flex; flex-wrap: wrap; gap: 2px 0; font-size: 13px; color: var(--text-2); }
.meta > span { white-space: nowrap; }
.meta > span + span::before { content: "·"; margin: 0 8px; color: var(--text-3); }
.meta .dur { color: var(--accent); font-weight: 600; }
.meta .st { color: var(--white); }
/* The language switch (EN / FR / VI) of a story in several languages, labelled in each
   language. It sits above the title button's row-wide click layer. */
.langs { position: relative; z-index: 1; display: inline-flex; margin-top: 8px; border: 1px solid var(--line-strong); border-radius: var(--r-ctl); overflow: hidden; }
.lang { min-height: 34px; padding: 0 12px; border: 0; border-left: 1px solid var(--line-strong); background: transparent; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: color .15s ease, background-color .15s ease; }
.lang:first-child { border-left: 0; }
.lang:hover { color: var(--white); background: var(--hover); }
.lang[aria-pressed="true"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.lang:focus-visible { outline-offset: -2px; }
.lang .l-short { display: none; }
.chev { width: 20px; height: 20px; fill: none; stroke: var(--text-2); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease, stroke .15s ease; }
.ep-row:hover .chev { stroke: var(--white); }
.ep.is-open .chev { transform: rotate(180deg); }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; pointer-events: none; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); }

/* Details sit under the title column so the eye does not jump back to the edge. */
.ep-detail { padding: 0 16px 16px 76px; }
.summary { margin: 0; padding: 0; list-style: none; color: var(--text-2); display: grid; gap: 3px; max-width: 760px; }
.summary li { position: relative; padding-left: 16px; }
.summary li::before { content: ""; position: absolute; left: 0; top: .78em; width: 7px; height: 1px; background: var(--gray); }
.credit { margin: 10px 0 0; font-size: 14px; color: var(--text-2); overflow-wrap: anywhere; }
.credit a { color: var(--white); text-decoration-color: var(--accent); text-underline-offset: 3px; }
.credit a:hover { color: var(--accent); }
.sources { margin: 10px 0 0; font-size: 14px; color: var(--text-2); max-width: 760px; }
.sources h4 { margin: 0 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.sources ol { margin: 0; padding: 0 0 0 20px; display: grid; gap: 3px; overflow-wrap: anywhere; }
.sources a { color: var(--white); text-decoration-color: var(--accent); text-underline-offset: 3px; }
.sources a:hover { color: var(--accent); }
.guests { margin: 8px 0 0; font-size: 14px; color: var(--text-2); overflow-wrap: anywhere; }
.guests strong { color: var(--white); font-weight: 600; }
.music { margin: 8px 0 0; font-size: 13px; color: var(--text-2); max-width: 760px; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 6px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-ctl); background: transparent;
  font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.btn:hover { border-color: var(--white); }
.btn[aria-expanded="true"], .btn.is-done { border-color: var(--accent); color: var(--accent); }
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Transcript ---------- */
.transcript { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.transcript ol { list-style: none; margin: 0; padding: 0 4px 0 0; max-height: 380px; overflow-y: auto; scrollbar-color: var(--gray) transparent; }
.cue {
  display: grid; grid-template-columns: 56px 1fr; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border: 0; border-left: 2px solid transparent; background: transparent;
  cursor: pointer; border-radius: 0 6px 6px 0; color: var(--text-2);
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.cue:hover { color: var(--white); background: var(--hover); }
.cue.is-now { color: var(--white); border-left-color: var(--accent); background: rgba(255,255,255,.05); }
.cue time { font-size: 12px; color: var(--text-2); padding-top: 2px; }
.cue.is-now time { color: var(--accent); }
.cue .who { font-weight: 600; color: var(--white); margin-right: 6px; }
.t-state { margin: 0; font-size: 14px; color: var(--text-2); }

/* ---------- States ---------- */
.state { background: var(--black); padding: 36px 20px; text-align: center; color: var(--text-2); }
.state strong { display: block; color: var(--white); font: 700 18px/1.3 var(--display); margin-bottom: 4px; }
.state .btn { margin-top: 14px; }
.skeleton { height: 69px; background: linear-gradient(90deg, rgba(255,255,255,.015), rgba(255,255,255,.06), rgba(255,255,255,.015)) var(--black); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Player bar ---------- */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: rgba(0,0,0,.9); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line-strong);
  transform: translateY(110%); transition: transform .35s cubic-bezier(.2,.7,.2,1);
}
.player.is-on { transform: none; }
.player .wrap { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px 18px; padding-top: 10px; padding-bottom: 10px; }
.p-controls { display: flex; align-items: center; gap: 4px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 10px; background: transparent; cursor: pointer; transition: border-color .15s ease, color .15s ease; position: relative; }
.icon-btn:hover { border-color: var(--line-strong); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.icon-btn small { position: absolute; font-size: 9px; font-weight: 600; top: 50%; left: 50%; transform: translate(-50%, -38%); }
.p-main { width: 48px; height: 48px; border: 1px solid var(--accent); color: var(--accent); }
.p-main:hover { border-color: var(--white); color: var(--white); }
.p-info { min-width: 0; }
.p-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.p-track { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; font-size: 12px; color: var(--text-2); }
/* Scrubber: gray rail, green fill (a line, not a fill area), white thumb. */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; cursor: pointer; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(to right, var(--accent) var(--pct, 0%), var(--gray) var(--pct, 0%)); }
input[type=range]::-moz-range-track { height: 3px; border-radius: 3px; background: var(--gray); }
input[type=range]::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5.5px; border-radius: 50%; background: var(--white); border: 0; }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--white); border: 0; }
.speed { min-width: 52px; height: 36px; border: 1px solid var(--line-strong); border-radius: var(--r-ctl); background: transparent; font-weight: 600; font-size: 13px; cursor: pointer; }
.speed:hover { border-color: var(--white); }

footer { border-top: 1px solid var(--line); padding: 20px 0 28px; font-size: 13px; color: var(--text-2); }
footer p { margin: 0 0 4px; max-width: 720px; }
footer .keys { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
footer .keys span { display: inline-flex; align-items: center; gap: 6px; }

@media (max-width: 640px) {
  body { font-size: 15px; }
  .mast-inner { grid-template-columns: 1fr; padding-top: 16px; padding-bottom: 12px; }
  .stats { justify-content: flex-start; font-size: 13px; }
  .stats div { padding: 0 10px; }
  .stats dd { font-size: 16px; }
  .tagline { margin-top: 2px; }
  .key { display: none; }
  /* The tabs fit a 360 px screen without scrolling. */
  .tabs { gap: 0; }
  .tab { height: 40px; line-height: 40px; padding: 0 8px; font-size: 13.5px; gap: 4px; letter-spacing: -0.02em; }
  .tab::after { left: 8px; right: 8px; }
  .tab .n { font-size: 12px; }
  .tab .l-long { display: none; }
  .tab .l-short { display: inline; }
  .order span { display: none; }
  .order { width: 40px; justify-content: center; padding: 0; }
  .sort-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ep-row { gap: 12px; padding: 12px; }
  .lang { min-width: 48px; min-height: 40px; }
  .lang .l-long { display: none; }
  .lang .l-short { display: inline; }
  .ep-detail { padding: 0 12px 14px 12px; }
  .player .wrap { grid-template-columns: auto minmax(0, 1fr); }
  .speed { grid-column: 2; justify-self: end; margin-top: -4px; }
  .p-back, .p-fwd { display: none; }
  .cue { grid-template-columns: 48px 1fr; padding: 8px 6px; }
  footer .keys { display: none; }
}
@media (max-height: 500px) {
  /* Short viewports (landscape phones, high zoom): stop pinning the toolbar so the list keeps room.
     It stays positioned for the progress line; the top scroll offset drops since nothing overlays content. */
  .toolbar { position: relative; }
  html { scroll-padding-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
