/* Barry Harris archive: clean, calm reading style. One system font, soft borders, one blue accent. */

/* ---------- tokens ---------- */
:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f1f2f0;
  --text: #1d2125;
  --muted: #565e67;
  --faint: #67707a;
  --border: #e3e5e2;
  --border-strong: #c9cdd1;
  --accent: #2457c5;
  --accent-soft: #e8effc;
  --on-accent: #ffffff;
  --mark: #fff1a8;
  --mark-strong: #ffd84d;
  --ok: #1a7f37;
  --warn: #9a3412;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 8px;
  --gutter: clamp(16px, 3vw, 32px);
  --controls-h: 120px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141619; --surface: #1b1e22; --surface-2: #23272c; --text: #e7e9ec; --muted: #aab1b9; --faint: #9aa1a9;
    --border: #2c3137; --border-strong: #3b4148; --accent: #8db3ff; --accent-soft: #22304a; --on-accent: #0d1526;
    --mark: rgba(255, 214, 0, .22); --mark-strong: rgba(255, 214, 0, .45); --ok: #6fcf8e; --warn: #f0a37a;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141619; --surface: #1b1e22; --surface-2: #23272c; --text: #e7e9ec; --muted: #aab1b9; --faint: #9aa1a9;
  --border: #2c3137; --border-strong: #3b4148; --accent: #8db3ff; --accent-soft: #22304a; --on-accent: #0d1526;
  --mark: rgba(255, 214, 0, .22); --mark-strong: rgba(255, 214, 0, .45); --ok: #6fcf8e; --warn: #f0a37a;
  --shadow: none; color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
mark.current { background: var(--mark-strong); }
.kicker { margin: 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.vinyl { display: none; }

/* ---------- header ---------- */
.mast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 24px;
  align-items: center;
  padding: 18px var(--gutter) 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.mast-main { min-width: 0; }
.mast h1 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -.01em; line-height: 1.2; }
.mast h1 .accent { color: inherit; }
.lede { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.mast-nav { align-self: center; }
.navlink {
  display: inline-block;
  padding: 7px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.navlink:hover { background: var(--accent); color: var(--on-accent); }
.credits {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 18px;
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.credits div { display: flex; gap: 5px; }
.credits dt { order: 2; }
.credits dd { margin: 0; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- controls ---------- */
.controls {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 12px var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-label { font-size: 14px; font-weight: 600; color: var(--muted); }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 17px;
  padding: 10px 0;
}
.search input::placeholder { color: var(--faint); }
.search kbd, kbd {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 0 6px;
}
.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px 18px; flex-wrap: wrap; }
.tabs {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 3px;
  margin: -3px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tab .count { margin-left: 6px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--faint); }
.tab[aria-pressed="true"] .count { color: inherit; }
.tab.has-hits { color: var(--text); }
.tab.has-hits .count { color: var(--accent); font-weight: 600; }
.opts { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.sort select {
  margin-left: 6px;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 4px 6px;
}
.theme {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: 6px;
  width: 32px;
  height: 28px;
  font-size: 14px;
  line-height: 1;
}

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(340px, 460px) minmax(0, 1fr);
  min-height: calc(100vh - var(--controls-h));
}
.list { border-right: 1px solid var(--border); min-width: 0; background: var(--surface); }
.list:focus { outline: none; }
.reader {
  position: sticky;
  top: var(--controls-h);
  height: calc(100vh - var(--controls-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  min-width: 0;
}

/* ---------- list ---------- */
.section-head { padding: 14px 18px 12px; border-bottom: 1px solid var(--border); }
.blurb { margin: 0; font-size: 14px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.chip {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 13px;
  color: var(--text);
}
.chip span { margin-left: 5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip[aria-pressed="true"] span { color: inherit; }
.list-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.list-head strong { color: var(--text); font-weight: 600; }
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.row:hover { background: var(--surface-2); }
.row[aria-current="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.num { display: none; }
.row-title {
  display: block;
  width: 100%;
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.row-meta { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 13px; color: var(--muted); }
.row-meta .none { color: var(--faint); font-style: italic; }
.row-meta .tag { color: var(--accent); }
.hits {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 1px 8px;
}
.snip {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.snip:hover { color: var(--text); }
.snip .t { font-family: var(--mono); font-size: 12px; color: var(--accent); margin-right: 6px; }
.more {
  display: block;
  width: calc(100% - 36px);
  margin: 16px 18px;
  padding: 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
}
.more:hover { border-color: var(--accent); color: var(--accent); }
.empty { padding: 28px 18px; color: var(--muted); }
.empty p { margin: 0 0 8px; }

/* ---------- reader ---------- */
.liner, .intro { max-width: 740px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 44px) 80px; animation: fade .2s ease backwards; }
.liner h2, .intro h2 { margin: 6px 0 8px; font-size: clamp(22px, 2.4vw, 28px); font-weight: 650; line-height: 1.25; letter-spacing: -.01em; overflow-wrap: anywhere; }
.meta { margin: 0; display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 13.5px; color: var(--muted); }
.player {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 18px 0 10px;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}
.player img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .95);
  color: #1d2125;
  font-size: 15px;
  font-weight: 600;
  padding: 10px 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
}
.play:hover { background: #fff; }
.actions { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; color: var(--muted); }
.desc { margin: 14px 0 0; border-top: 1px solid var(--border); padding: 10px 0 0; }
.desc summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); }
.desc div { white-space: pre-wrap; font-size: 14.5px; line-height: 1.55; color: var(--muted); margin-top: 8px; overflow-wrap: anywhere; }
.find {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 0;
  padding: 8px 0;
  background: var(--bg);
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.find[hidden] { display: none; }
.find button {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: 6px;
  width: 30px;
  height: 26px;
}
.transcript { margin-top: 22px; }
.transcript p {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  margin: 0 0 1em;
  font-size: 17.5px;
  line-height: 1.7;
  scroll-margin-top: 70px;
  border-radius: 6px;
}
.transcript.untimed p { grid-template-columns: minmax(0, 1fr); }
.transcript p.flash { animation: flash 1.6s ease; }
.transcript .txt { overflow-wrap: anywhere; }
.cue {
  align-self: start;
  border: 0;
  background: none;
  padding: 5px 0 0;
  text-align: left;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.cue:hover { color: var(--accent); text-decoration: underline; }
.nocaps {
  margin-top: 22px;
  padding: 16px 18px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--muted);
}
.intro p { font-size: 16px; line-height: 1.65; }
.intro h3 { margin: 26px 0 8px; font-size: 15px; font-weight: 650; }
.picks { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.picks li + li { border-top: 1px solid var(--border); }
.picks button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  width: 100%;
  border: 0;
  background: none;
  padding: 10px 14px;
  text-align: left;
}
.picks button:hover { background: var(--surface-2); }
.picks .num { display: none; }
.picks .t1 { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.picks .t2 { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.picks-kicker { margin-top: 24px; }
.fine { font-size: 13.5px !important; color: var(--muted); }
.intro code { font-family: var(--mono); font-size: .85em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* ---------- motion ---------- */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes flash { 0%, 40% { background: var(--mark); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .mast { grid-template-columns: minmax(0, 1fr) auto; padding: 12px var(--gutter); }
  .mast .lede, .mast .credits { display: none; }
  .mast h1 { font-size: 19px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .list { border-right: 0; }
  .reader {
    position: fixed;
    inset: 0;
    height: 100dvh;
    z-index: 60;
    background: var(--bg);
    transform: translateX(100%);
    transition: transform .25s ease;
    visibility: hidden;
  }
  .reader.open { transform: none; visibility: visible; }
  .intro { display: none; }
  body.reading { overflow: hidden; }
  .transcript p { grid-template-columns: 48px minmax(0, 1fr); gap: 8px; font-size: 17px; }
  .search kbd { display: none; }
}
