/* style.css: the showcase site. Warm paper and Clawd terracotta, to match the watercolor video. */
:root {
  --paper: #f6efe3;
  --card: #fffaf1;
  --ink: #2a2420;
  --muted: #6e6358;
  --line: #e3d6c3;
  --accent: #c4552f;
  --accent-ink: #fff;
  --accent-soft: #f6dccb;
  --now: #fbe7a8;
  --shadow: 0 1px 2px rgb(60 40 20 / 8%), 0 4px 14px rgb(60 40 20 / 6%);
  --lv-exact: #c4552f;
  --lv-focused: #2f6fb0;
  --lv-broad: #4d7a4a;
  --lv-visual: #8a4fa8;
  --lv-interpretation: #a8741a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --stage-h: 0px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1c1815;
    --card: #26211d;
    --ink: #efe6da;
    --muted: #a99c8e;
    --line: #3b332c;
    --accent: #e58a62;
    --accent-ink: #1c1815;
    --accent-soft: #4a2e22;
    --now: #4d4020;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 14px rgb(0 0 0 / 25%);
    --lv-exact: #ee8a64;
    --lv-focused: #7fb2e8;
    --lv-broad: #93c08e;
    --lv-visual: #c79be0;
    --lv-interpretation: #e0b35a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
}
a { color: var(--accent); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code { font: 0.88em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--accent-soft); padding: 0 .25em; border-radius: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---------- masthead ---------- */
.masthead {
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 8px 24px;
  padding: 20px 24px 14px;
  max-width: 1600px; margin: 0 auto;
}
.brand h1 { font: 700 clamp(26px, 3.4vw, 40px)/1.05 var(--serif); margin: 0; letter-spacing: -0.01em; }
.brand .pdoom { color: var(--accent); }
.brand p { margin: 6px 0 0; color: var(--muted); max-width: 60ch; }
.outlinks { display: flex; gap: 16px; font-size: 15px; }
.outlinks a { color: var(--muted); text-decoration: none; }
.outlinks a:hover { color: var(--accent); }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(380px, 1fr);
  gap: 28px;
  max-width: 1600px; margin: 0 auto; padding: 0 24px 40px;
  align-items: start;
}
.stage {
  position: sticky; top: 0;
  padding-top: 12px;
  display: flex; flex-direction: column; gap: 10px;
  max-height: 100vh; min-width: 0;
}
.player-wrap {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  background: #000; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow);
}
.player-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.seg-control { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--card); }
.seg-control button {
  border: 0; background: none; padding: 4px 14px; border-radius: 999px; cursor: pointer; font-size: 14px; color: var(--muted);
}
.seg-control button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.clock { font: 14px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); margin-left: auto; }
.follow {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 12px 4px 10px;
  font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.follow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); opacity: .5; }
.follow[aria-pressed="true"]::before { background: var(--accent); opacity: 1; }

.now { margin: 0; min-height: 1.6em; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-ch { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; margin-right: 6px; }
.now-ly { font: italic 17px var(--serif); }

/* chapter track with a playhead */
.track { position: relative; display: flex; gap: 2px; height: 22px; }
.seg {
  flex: 1 1 0; min-width: 6px; border: 0; padding: 0; cursor: pointer; border-radius: 4px;
  background: var(--accent-soft); color: var(--muted); font-size: 11px; overflow: hidden;
}
.seg:hover, .seg.active { background: var(--accent); color: var(--accent-ink); }
.seg span { pointer-events: none; }
.playhead { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); left: 0; pointer-events: none; border-radius: 1px; }

/* shots, one frame each */
.filmstrip {
  position: relative; display: flex; gap: 4px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 6px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.shot {
  flex: 0 0 auto; width: 104px; aspect-ratio: 16 / 9; padding: 0; border: 2px solid transparent; border-radius: 6px;
  overflow: hidden; cursor: pointer; background: var(--line); scroll-snap-align: start; opacity: .8;
}
.shot img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.shot:hover { opacity: 1; }
.shot.active { border-color: var(--accent); opacity: 1; }

/* ---------- panel ---------- */
.panel { min-width: 0; padding-top: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button {
  border: 0; background: none; padding: 8px 14px; cursor: pointer; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.toolbar { padding: 12px 0 4px; display: flex; flex-direction: column; gap: 8px; }
.toolbar[hidden] { display: none; }
.search input {
  width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 2px 10px 2px 8px; font-size: 13px; cursor: pointer;
  text-transform: capitalize;
}
.chip[aria-pressed="true"] { border-color: currentColor; background: var(--accent-soft); }
.chip.lv-exact[aria-pressed="true"] { color: var(--lv-exact); }
.chip.lv-focused[aria-pressed="true"] { color: var(--lv-focused); }
.chip.lv-broad[aria-pressed="true"] { color: var(--lv-broad); }
.chip.lv-visual[aria-pressed="true"] { color: var(--lv-visual); }
.chip.lv-interpretation[aria-pressed="true"] { color: var(--lv-interpretation); }
.count { margin: 0; font-size: 13px; color: var(--muted); }
.count:empty { display: none; }

.chapter h2, .topic-group h2, .prose h2 {
  font: 700 22px/1.2 var(--serif); margin: 26px 0 10px; display: flex; align-items: baseline; gap: 10px;
}
.ch-n {
  display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font: 700 15px var(--sans);
}
.ch-range { font: 14px var(--sans); color: var(--muted); }

.entry {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 10px 0;
  scroll-margin-top: calc(var(--stage-h) + 16px);
  transition: border-color .2s, box-shadow .2s;
}
.entry.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.entry.target { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: var(--now); } }
.entry header { display: flex; align-items: flex-start; gap: 10px; }
.entry h3 { margin: 1px 0 0; font-size: 17px; line-height: 1.35; font-weight: 600; flex: 1; min-width: 0; }
.entry .lyric { font: italic 600 19px/1.3 var(--serif); }
.tag {
  display: inline-block; font: 600 11px var(--sans); text-transform: uppercase; letter-spacing: .06em;
  color: var(--lv-visual); border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; vertical-align: 2px;
}
.perma { color: var(--muted); text-decoration: none; opacity: 0; padding: 0 2px; }
.entry:hover .perma, .perma:focus { opacity: 1; }
a.ts.play {
  flex: none; display: inline-flex; align-items: center; gap: 5px; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 2px 10px 2px 8px;
  font: 600 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}
a.ts.play::before { content: ""; border-left: 7px solid currentColor; border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent; }
a.ts.play:hover { filter: brightness(1.08); }
.entry.active a.ts.play { background: var(--ink); color: var(--paper); }
.onscreen { margin: 8px 0 0; font-size: 15px; }
.label {
  font: 600 11px var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-right: 4px;
}
.strips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.strip { padding: 0; border: 0; background: var(--line); border-radius: 6px; overflow: hidden; cursor: pointer; height: 60px; aspect-ratio: 16 / 3; }
.strip img { height: 100%; width: 100%; display: block; }
.strip:hover { outline: 2px solid var(--accent); }
.refs { margin: 10px 0 0; padding: 0; list-style: none; font-size: 15px; }
.refs li { padding: 5px 0 5px 1.75em; text-indent: -1.75em; border-top: 1px dashed var(--line); }
.refs li:first-child { border-top: 0; }
.refs li[hidden] { display: none; }
.lv { display: inline-block; width: 1.4em; text-indent: 0; text-align: center; }
a.ts:not(.play) {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em;
}

/* topics */
.lede { color: var(--muted); margin: 14px 0 0; }
.topics { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.topic { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.topic-name { font-weight: 600; }
.topic-times { margin: 4px 0; font-size: 14px; line-height: 2; color: var(--muted); }
.topic-times a.ts {
  display: inline-block; line-height: 1.5; text-decoration: none; background: var(--accent-soft); border-radius: 999px; padding: 0 8px; color: var(--ink);
}
.topic-times a.ts:hover { background: var(--accent); color: var(--accent-ink); }
.topic-start { font-size: 14px; }
.topic-group ul:not(.topics) { padding-left: 1.2em; }

/* about */
.prose { max-width: 70ch; }
.prose h3 { font: 700 17px var(--serif); margin: 22px 0 6px; }
.prose li { margin: 4px 0; }
.legend { display: grid; gap: 6px; margin: 10px 0; }
.legend div { display: grid; grid-template-columns: 9.5em 1fr; gap: 10px; }
.legend dt { font-weight: 600; }
.legend dd { margin: 0; }
.table { overflow-x: auto; }
table { border-collapse: collapse; font-size: 14px; width: 100%; }
th, td { border-bottom: 1px solid var(--line); text-align: left; padding: 6px 8px; vertical-align: top; }

.lv-exact { color: var(--lv-exact); }
.lv-focused { color: var(--lv-focused); }
.lv-broad { color: var(--lv-broad); }
.lv-visual { color: var(--lv-visual); }
.lv-interpretation { color: var(--lv-interpretation); }

.foot { margin: 36px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- narrow screens: the video pins to the top and the references scroll under it ---------- */
@media (max-width: 960px) {
  .masthead { padding: 14px 16px 10px; }
  .brand p { font-size: 14px; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 16px 32px; }
  .stage {
    z-index: 5; background: var(--paper); gap: 6px; max-height: none;
    margin: 0 -16px; padding: 0 16px 8px; border-bottom: 1px solid var(--line);
  }
  .player-wrap { border-radius: 0; margin: 0 -16px; width: auto; box-shadow: none; }
  .bar { gap: 8px; }
  .seg-control button { padding: 3px 10px; font-size: 13px; }
  .follow { font-size: 13px; padding: 3px 10px 3px 8px; }
  .now { font-size: 14px; }
  .now-ly { font-size: 15px; }
  .track { height: 14px; }
  .seg span { display: none; }
  .shot { width: 72px; }
  .filmstrip { padding-bottom: 2px; }
  .legend div { grid-template-columns: 1fr; gap: 0; }
}
/* phones: keep the pinned area short; the chapter track and each entry's frames still navigate */
@media (max-width: 600px), (max-width: 960px) and (max-height: 700px) {
  .filmstrip { display: none; }
  .total { display: none; }
  .bar { flex-wrap: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
