:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #2b2620;
  --ink-soft: #6b6157;
  --ink-faint: #9a8f83;
  --rule: #e7dfd4;
  --accent: #735a3c;
  --accent-soft: #efe5d6;
  --read: #4a433b;
  --unread: #2b2620;
  --active-bg: #f3e3c3;
  --mine: #3f6f5a;
  --found-bg: #e3ead6;
  --shadow: 0 -8px 30px rgba(43, 38, 32, 0.12);
  --serif: "Literata", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1916;
    --surface: #24211d;
    --ink: #ebe4d8;
    --ink-soft: #b3a897;
    --ink-faint: #7f7568;
    --rule: #38332c;
    --accent: #d2b48a;
    --accent-soft: #3a3127;
    --read: #c9c0b2;
    --unread: #ebe4d8;
    --active-bg: #4a3b26;
    --mine: #8cc4a8;
    --found-bg: #33402c;
    --shadow: 0 -8px 30px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.7;
}
a { color: var(--accent); }
.wrap { max-width: 42rem; margin: 0 auto; padding: 0 16px; }

/* index */
.masthead { max-width: 42rem; margin: 0 auto; padding: 56px 16px 8px; }
.kicker { font-family: var(--sans); font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 8px; }
.masthead h1 { font-size: 2.4rem; line-height: 1.15; margin: 0 0 12px; font-weight: 600; }
.lede { color: var(--ink-soft); margin: 0; }
.note { font-family: var(--sans); font-size: 14.5px; line-height: 1.6; color: var(--ink-soft);
  background: var(--accent-soft); border-radius: 10px; padding: 14px 16px; margin: 28px 0 8px; }
.note p { margin: 0; }
.series h2 { font-size: 1.35rem; margin: 40px 0 4px; }
.blurb { color: var(--ink-soft); margin: 0 0 12px; font-style: italic; }
.talks { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); }
.talks a { display: grid; grid-template-columns: 2.2rem 1fr; gap: 0 4px; padding: 12px 4px;
  border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--ink); }
@media (hover: hover) { .talks a:hover { background: var(--accent-soft); } }
.part { grid-row: span 2; font-family: var(--sans); color: var(--ink-faint); font-size: 14px; padding-top: 4px; }
.ttl { font-size: 1.05rem; line-height: 1.4; }
.meta { font-family: var(--sans); font-size: 13px; color: var(--ink-faint); }
.foot { max-width: 42rem; margin: 48px auto; padding: 0 16px; font-family: var(--sans);
  font-size: 13px; color: var(--ink-faint); }

/* talk page */
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--rule); font-family: var(--sans); }
.back { text-decoration: none; font-size: 20px; color: var(--ink-soft); padding: 2px 6px; }
.bar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.series-name { font-size: 12px; color: var(--ink-faint); }
.talk-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.follow { font: 500 13px var(--sans); border: 1px solid var(--rule); background: transparent;
  color: var(--ink-faint); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.follow.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.player { position: sticky; top: 57px; z-index: 4; background: var(--bg); padding: 8px 16px 10px;
  border-bottom: 1px solid var(--rule); }
.player iframe { display: block; width: 100%; max-width: 42rem; margin: 0 auto; height: 120px; border: 0; }
.status { font-family: var(--sans); font-size: 13px; color: var(--ink-faint); margin: 20px 0 8px; }

.transcript p { margin: 0 0 1.1em; }
.transcript [data-m] { cursor: pointer; border-radius: 3px; transition: background-color .25s;
  -webkit-tap-highlight-color: transparent; }
@media (hover: hover) { .transcript [data-m]:hover { background: var(--accent-soft); } }
.transcript [data-m]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.transcript .read { color: var(--read); }
.transcript .unread { color: var(--unread); }
.transcript .active { background: var(--active-bg); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.transcript p.active { background: none; }
.transcript .selected { outline: 2px solid var(--accent); outline-offset: 1px; }
.transcript .mine { text-decoration: underline wavy var(--mine); text-decoration-thickness: 1px;
  text-underline-offset: 4px; }

/* bottom sheet */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center;
  pointer-events: none; }
.sheet[hidden] { display: none; }
.sheet-inner { pointer-events: auto; width: 100%; max-width: 42rem; background: var(--surface);
  border: 1px solid var(--rule); border-bottom: 0; border-radius: 14px 14px 0 0; box-shadow: var(--shadow);
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); font-family: var(--sans); font-size: 15px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-time { font-size: 12px; color: var(--ink-faint); letter-spacing: .04em; }
.sheet button.x { border: 0; background: none; color: var(--ink-faint); font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.sheet-line { margin: 6px 0 12px; font-family: var(--serif); font-size: 16px; line-height: 1.5; color: var(--ink-soft);
  border-left: 3px solid var(--rule); padding-left: 10px; max-height: 6em; overflow: auto; }
.sheet-actions, .row { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet button { font: 500 14px var(--sans); border-radius: 8px; padding: 10px 14px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--bg); }
.sheet button.quiet { background: transparent; color: var(--ink-soft); border-color: var(--rule); }
.sheet-form { display: flex; flex-direction: column; gap: 6px; }
.sheet-form label { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.opt { color: var(--ink-faint); }
.sheet-form textarea, .sheet-form input { font: 16px var(--serif); color: var(--ink); background: var(--bg);
  border: 1px solid var(--rule); border-radius: 8px; padding: 8px 10px; width: 100%; }
.sheet-form textarea:focus, .sheet-form input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.sheet-form .row { margin-top: 8px; }
.sheet-done { margin: 4px 0 0; color: var(--ink-soft); }

/* search */
.search { margin: 32px 0 8px; }
.search-label { display: block; font-size: 1.35rem; font-weight: 600; margin: 0 0 10px; }
.search-field { position: relative; }
.search-icon, .search-open svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-faint);
  pointer-events: none; }
.search input[type="search"] { width: 100%; font: 18px var(--serif); color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule); border-radius: 10px; padding: 11px 12px 11px 42px; -webkit-appearance: none;
  appearance: none; }
.search input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; cursor: pointer; background-color: var(--ink-faint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / contain no-repeat; }
.search input[type="search"]::placeholder { color: var(--ink-faint); }
.search input[type="search"]:focus { outline: 2px solid var(--accent); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.chip { font: 500 13.5px var(--sans); border: 1px solid var(--rule); background: transparent; color: var(--ink-soft);
  border-radius: 999px; padding: 6px 13px; cursor: pointer; }
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip:focus-visible, .search button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.search-status { font-family: var(--sans); font-size: 13px; color: var(--ink-faint); margin: 14px 0 4px; min-height: 1em; }
.search-status:empty { margin: 0; }
.results { margin: 0; }
.hit { border-top: 1px solid var(--rule); padding: 14px 0 6px; }
.hit:last-of-type { border-bottom: 1px solid var(--rule); }
.hit-title { font-size: 1.05rem; line-height: 1.4; color: var(--ink); text-decoration: none; font-weight: 600; }
@media (hover: hover) { .hit-title:hover { text-decoration: underline; text-decoration-color: var(--rule); } }
.hit-meta { font-family: var(--sans); font-size: 13px; color: var(--ink-faint); margin: 2px 0 6px; }
.moments { list-style: none; padding: 0; margin: 0; }
.moments a { display: grid; grid-template-columns: 3.1rem 1fr; gap: 0 6px; padding: 7px 6px; margin: 0 -6px;
  border-radius: 8px; text-decoration: none; color: var(--ink-soft); }
@media (hover: hover) { .moments a:hover { background: var(--accent-soft); } }
.moments .at { font: 500 12.5px var(--sans); font-variant-numeric: tabular-nums; color: var(--accent); padding-top: 4px; }
.moments .ex { font-size: 16px; line-height: 1.55; }
.moments mark { background: var(--active-bg); color: var(--ink); border-radius: 2px; padding: 0 1px; }
.more-moments, .more-talks { font: 500 13.5px var(--sans); color: var(--accent); background: none; border: 0;
  padding: 6px 0 10px; cursor: pointer; }
.more-talks { display: block; margin: 12px auto 0; padding: 10px 16px; border: 1px solid var(--rule); border-radius: 999px; }

/* search on a talk page: a button in the bar opens a full-screen panel */
.search-open { border: 0; background: none; color: var(--ink-soft); padding: 6px; margin: -4px 0; cursor: pointer;
  border-radius: 8px; display: flex; }
.search-open:focus-visible { outline: 2px solid var(--accent); }
.search-panel { position: fixed; inset: 0; z-index: 20; background: var(--bg); overflow-y: auto;
  -webkit-overflow-scrolling: touch; }
.searching body { overflow: hidden; }
.search-panel-inner { padding-bottom: 48px; }
.search-panel-head { display: flex; justify-content: flex-end; padding-top: 10px; }
.search-panel-head .x { border: 0; background: none; color: var(--ink-faint); font-size: 18px; cursor: pointer;
  padding: 6px 10px; border-radius: 8px; }
.search-panel .search { margin-top: 0; }

/* a line reached from a search result */
.transcript .found { background: var(--found-bg); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.transcript .found.active { background: var(--active-bg); }
.cue { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 9; font: 500 15px var(--sans); color: var(--bg); background: var(--accent); border: 0; border-radius: 999px;
  padding: 11px 20px; box-shadow: var(--shadow); cursor: pointer; white-space: nowrap; }
.cue:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

@media (max-width: 520px) {
  body { font-size: 18px; }
  .masthead h1 { font-size: 2rem; }
  .follow { padding: 5px 10px; }
}

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
