/* College Park Sermon Archive.
 *
 * Register: parchment and pine. A bookish, collegiate look -- old-style serif
 * headings, a warm paper ground, deep green rules and a single green rubric that
 * the timeline heat map mixes against. Nothing here is shared with any other
 * archive; the palette, the type stack and the wordmark are this site's own.
 *
 * Both themes come out of one token block, so a colour is only ever named once.
 * No web fonts: system stacks render instantly and cannot fail offline.
 */

:root {
  color-scheme: light;

  --paper: #f6f2e9;          /* page ground, warm and slightly rag */
  --card: #fffdf7;           /* raised surfaces */
  --sunk: #efe9db;           /* recessed: table heads, chips, gutters */
  --ink: #1b2621;            /* body text, near-black with green in it */
  --ink-soft: #3c4a43;
  /* 5.0:1 on paper, 4.6:1 on the footer's sunk ground. Everything wearing this
     colour is small (0.7rem uppercase labels, timestamps), so it has to clear
     4.5:1 rather than the 3:1 large text gets away with. */
  --muted: #5d6b62;          /* labels, metadata */
  --rule: #ddd4c2;
  --rule-hard: #c9bda6;
  --rubric: #1f6a4b;         /* the one accent; timeline mixes against it */
  --rubric-lift: #175539;
  --gold: #9b6f18;           /* used sparingly, for marks and hover */
  --mark: #ffe9a8;
  --mark-on: #ffc94d;
  --shadow: 0 1px 2px rgba(27, 38, 33, .06), 0 8px 24px -18px rgba(27, 38, 33, .5);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
           ui-serif, Georgia, serif;
  --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --mast: 3.5rem;
  --pad: clamp(1rem, 3vw, 2rem);
}

html[data-theme="dark"] {
  color-scheme: dark;

  --paper: #121816;
  --card: #1a2220;
  --sunk: #202b27;
  --ink: #e9e5d9;
  --ink-soft: #cbd3cd;
  --muted: #8d9c93;
  --rule: #2a3733;
  --rule-hard: #3b4a45;
  --rubric: #4fb98a;
  --rubric-lift: #7ad3aa;
  --gold: #d9b263;
  --mark: #55482a;
  --mark-on: #a37c1e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -20px #000;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  /* A faint rule at the very top reads as the edge of a printed page. */
  border-top: 3px solid var(--rubric);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

a { color: var(--rubric); text-decoration-color: var(--rule-hard); text-underline-offset: .15em; }
a:hover { color: var(--rubric-lift); text-decoration-color: currentColor; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -.015em; text-wrap: balance; }
h2 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--rubric); outline-offset: 2px; border-radius: 3px; }

.skip {
  position: absolute; left: -9999px; top: .4rem; z-index: 60;
  background: var(--card); color: var(--ink);
  padding: .5rem .8rem; border: 1px solid var(--rubric); border-radius: 4px;
}
.skip:focus { left: .5rem; }

/* ------------------------------------------------------------------ masthead */

.masthead {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.masthead-in {
  max-width: 1200px; margin: 0 auto;
  min-height: var(--mast);
  padding: 0 var(--pad);
  display: flex; align-items: center; gap: 1.25rem;
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.15rem; font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink); text-decoration: none;
  white-space: nowrap;
}
.wordmark span {
  color: var(--rubric);
  margin: 0 .3em;
  font-weight: 400;
}
.wordmark:hover span { color: var(--gold); }

.masthead nav {
  display: flex; gap: .1rem; flex: 1; flex-wrap: wrap;
  margin-left: auto;
  justify-content: flex-end;
}
.masthead nav a {
  color: var(--ink-soft); text-decoration: none;
  font-size: .875rem;
  padding: .4rem .55rem; border-radius: 4px;
}
.masthead nav a:hover { color: var(--rubric); background: var(--sunk); }

.icon-btn {
  font: inherit; font-size: .8rem;
  color: var(--muted); background: transparent;
  border: 1px solid var(--rule-hard); border-radius: 4px;
  padding: .25rem .5rem; cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: var(--rubric); }
.icon-btn[aria-pressed="true"] { color: var(--rubric); border-color: var(--rubric); }

/* --------------------------------------------------------------------- layout */

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 var(--pad); }
main.wrap { padding-top: 2.5rem; padding-bottom: 5rem; }

.page-head { max-width: 62ch; margin-bottom: 2rem; }
.page-head h1 { margin-bottom: .5rem; }

.label, .kicker {
  font-family: var(--sans);
  font-size: .7rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
}
.kicker { display: block; margin-bottom: .6rem; }

.dek { color: var(--ink-soft); font-size: 1.05rem; }
.hint { color: var(--muted); font-size: .85rem; }
.mono { font-family: var(--mono); font-size: .8rem; font-variant-numeric: tabular-nums; }

.mt { margin-top: 2.25rem; }
.mb { margin-bottom: .75rem; }
.pair { display: flex; align-items: baseline; gap: 1rem; }
.grow { flex: 1; font-family: var(--serif); }

/* ---------------------------------------------------------------------- stats */

.stats {
  display: flex; flex-wrap: wrap; gap: 0;
  border: 1px solid var(--rule); border-radius: 6px;
  background: var(--card); box-shadow: var(--shadow);
  overflow: hidden;
}
.stat {
  flex: 1 1 7rem; padding: .9rem 1.1rem;
  border-left: 1px solid var(--rule);
  display: grid; gap: .15rem;
}
.stat:first-child { border-left: 0; }
.stat .v {
  font-family: var(--serif); font-size: 1.6rem; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat .k { font-size: .68rem; }

/* --------------------------------------------------------------------- tables */

.tbl {
  width: 100%; border-collapse: collapse;
  font-size: .925rem;
  border-block: 1px solid var(--rule-hard);
}
.tbl th {
  text-align: left; padding: .5rem .6rem;
  font: 600 .7rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule-hard);
  background: var(--sunk);
  position: sticky; top: var(--mast); z-index: 5;
}
.tbl td { padding: .5rem .6rem; border-top: 1px solid var(--rule); vertical-align: baseline; }
.tbl tbody tr:hover { background: var(--card); }
.tbl a { text-decoration: none; }
.tbl a:hover { text-decoration: underline; }
.t-date, .t-num { font-family: var(--mono); font-size: .8rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.t-num { text-align: right; }
.t-title { font-weight: 500; }
.t-title a { color: var(--ink); }
.t-title a:hover { color: var(--rubric); }
.t-series { color: var(--ink-soft); font-size: .875rem; }

.meta-tbl { width: 100%; border-collapse: collapse; font-size: .875rem; }
.meta-tbl th {
  text-align: left; width: 5.5rem; padding: .3rem .5rem .3rem 0;
  font: 600 .68rem/1.5 var(--sans); letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); vertical-align: baseline;
}
.meta-tbl td { padding: .3rem 0; border-top: 1px solid var(--rule); }
.meta-tbl tr:first-child td, .meta-tbl tr:first-child th { border-top: 0; }

/* ---------------------------------------------------------------------- cards */

.grid-cards {
  display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}
.card {
  display: grid; gap: .3rem; align-content: space-between;
  min-height: 5.25rem; padding: .85rem .95rem;
  background: var(--card); border: 1px solid var(--rule); border-radius: 6px;
  text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--rubric); transform: translateY(-1px); }
.card .t { font-family: var(--serif); font-size: 1.02rem; line-height: 1.25; }
.card .m { font-size: .68rem; }

/* ------------------------------------------------------------- chips and refs */

.cloud, .rail-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip, .ref {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .22rem .55rem;
  font-size: .82rem; line-height: 1.4;
  background: var(--sunk); border: 1px solid transparent; border-radius: 999px;
  color: var(--ink-soft); text-decoration: none;
}
a.chip:hover, a.ref:hover { border-color: var(--rubric); color: var(--rubric); background: var(--card); }
.chip .n { font-family: var(--mono); font-size: .7rem; color: var(--muted); }
.ref { font-family: var(--mono); font-size: .76rem; border-radius: 4px; }

/* ------------------------------------------------------------- sermon: layout */

.cols { display: grid; gap: 2rem; grid-template-columns: minmax(0, 21rem) minmax(0, 1fr); }

.rail {
  position: sticky; top: calc(var(--mast) + 1rem);
  align-self: start;
  max-height: calc(100vh - var(--mast) - 2rem);
  display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 1rem;
}
.rail-scroll {
  overflow-y: auto; overscroll-behavior: contain;
  padding-right: .4rem;
  display: grid; gap: 1.25rem; align-content: start;
  /* Fade the cut edge so a clipped rail reads as scrollable. */
  mask-image: linear-gradient(to bottom, #000 calc(100% - 2rem), transparent);
}
.rail-block { display: grid; gap: .5rem; }
.rail-block h2 {
  font: 600 .68rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
}
.rail-block p, .rail-block ul { margin: 0; font-size: .9rem; color: var(--ink-soft); }
.rail-block ul { padding-left: 1.1rem; display: grid; gap: .3rem; }
.big-idea {
  font-family: var(--serif); font-size: 1.05rem !important; line-height: 1.4;
  color: var(--ink) !important;
  border-left: 3px solid var(--rubric); padding-left: .75rem;
}

.player-frame {
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--rule-hard); border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
#player, #player iframe { width: 100%; height: 100%; border: 0; display: block; }
/* Before the API loads, the frame is a poster-less black box; a hint stops it
   looking broken. */
#player:empty::after {
  content: "loading player";
  display: grid; place-items: center; height: 100%;
  color: #6f7c76; font: 600 .7rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase;
}

/* --------------------------------------------------------- sermon: transcript */

.transcript-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem;
  padding-bottom: .6rem; margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule-hard);
}
.transcript-head .label { flex: 1; white-space: nowrap; }
.finder { display: flex; align-items: center; gap: .4rem; }
.finder .label { flex: 0; }
#find {
  font: inherit; font-size: .875rem;
  padding: .3rem .55rem; width: 12rem;
  color: var(--ink); background: var(--card);
  border: 1px solid var(--rule-hard); border-radius: 4px;
}
#find:focus { border-color: var(--rubric); }
#find-count { min-width: 4.5rem; color: var(--muted); }

#cite-meta { display: flex; justify-content: flex-end; margin: -.5rem 0 .75rem; }

.transcript { max-width: 68ch; }
.cue {
  display: grid; grid-template-columns: 4.75rem minmax(0, 1fr);
  gap: 0 .75rem;
  padding: .2rem 0;
  scroll-margin-top: calc(var(--mast) + 1.5rem);
}
.seek {
  font-family: var(--mono); font-size: .74rem;
  color: var(--muted); text-decoration: none;
  padding-top: .45rem;
  font-variant-numeric: tabular-nums;
  position: relative;
}
.seek:hover { color: var(--rubric); }
/* A dot marks a paragraph containing a find hit, so the gutter doubles as a
   map of where the term appears. */
.cue[data-hits] .seek::before {
  content: ""; position: absolute; left: -.55rem; top: .8rem;
  width: .35rem; height: .35rem; border-radius: 50%;
  background: var(--gold);
}
.said { margin: 0; font-size: 1.02rem; line-height: 1.75; }
.cue:target .said, .cue.playing .said {
  background: color-mix(in srgb, var(--rubric) 10%, transparent);
  box-shadow: -.4rem 0 0 color-mix(in srgb, var(--rubric) 10%, transparent),
              .4rem 0 0 color-mix(in srgb, var(--rubric) 10%, transparent);
  border-radius: 2px;
}
.cue.playing .seek { color: var(--rubric); font-weight: 600; }

mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 .05em; }
mark.on { background: var(--mark-on); box-shadow: 0 0 0 2px var(--mark-on); }

/* ------------------------------------------------------------------- timeline */

.tl { margin-bottom: 3rem; }
.tl-row { display: grid; grid-template-columns: 3rem minmax(0, 1fr); align-items: center; gap: .5rem; }
.yr { font-family: var(--mono); font-size: .78rem; color: var(--muted); }
/* Fixed-width columns, not fractions: a heat map of twelve months wants to read
   as a small calendar block, and it keeps the month letters over their cells. */
.tl-cells, .tl-months {
  display: grid; grid-template-columns: repeat(12, 1.65rem); gap: 3px;
  padding: 1.5px 0;
}
.tl-months span {
  font: 600 .62rem/1 var(--sans); color: var(--muted); text-align: center;
  letter-spacing: .05em;
}
.tl-cell {
  display: block; aspect-ratio: 1; width: 1.65rem;
  border-radius: 2px;
  background: var(--sunk);
  border: 1px solid color-mix(in srgb, var(--rule-hard) 60%, transparent);
}
a.tl-cell:hover { outline: 2px solid var(--gold); outline-offset: 1px; }
.tl-legend { display: flex; align-items: center; gap: .3rem; margin-top: .6rem; padding-left: 3.5rem; }
.tl-legend i { width: .9rem; height: .9rem; border-radius: 2px; border: 1px solid var(--rule); }
.tl-legend .label:first-child { margin-right: .2rem; }
.tl-legend .label:last-child { margin-left: .2rem; }

/* --------------------------------------------------------------------- search */

#search {
  --pagefind-ui-scale: .85;
  --pagefind-ui-primary: var(--ink);
  --pagefind-ui-text: var(--ink);
  --pagefind-ui-background: var(--card);
  --pagefind-ui-border: var(--rule-hard);
  --pagefind-ui-tag: var(--sunk);
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 5px;
  --pagefind-ui-font: var(--sans);
}
#search mark { background: var(--mark); }

/* --------------------------------------------------------------------- footer */

footer.site {
  border-top: 1px solid var(--rule);
  background: var(--sunk);
  padding: 2rem 0 3rem;
  font-size: .85rem; color: var(--muted);
}
footer.site p { max-width: 68ch; }
footer.site .hint { color: var(--muted); }
kbd {
  font-family: var(--mono); font-size: .75rem;
  padding: .1rem .35rem;
  background: var(--card); border: 1px solid var(--rule-hard);
  border-bottom-width: 2px; border-radius: 3px;
}

/* ------------------------------------------------------------------ narrow */

@media (max-width: 62rem) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; max-height: none; }
  .rail-scroll { overflow: visible; max-height: none; mask-image: none; }
  .transcript { max-width: none; }
}

@media (max-width: 44rem) {
  .masthead-in { flex-wrap: wrap; padding-top: .5rem; padding-bottom: .5rem; }
  .masthead nav { order: 3; width: 100%; justify-content: flex-start; margin-left: -.55rem; }
  .tbl th { position: static; }
  .t-series { display: none; }
  .tbl thead th:nth-child(3) { display: none; }
  .cue { grid-template-columns: 3.75rem minmax(0, 1fr); }
  #find { width: 7rem; }
  .rail { top: 0; }
}

@media print {
  .masthead, .rail, .transcript-head, footer.site, #cite-meta { display: none; }
  body { background: #fff; }
  .cue { break-inside: avoid; }
}

/* Wrappers that exist only to carry a Pagefind attribute: the rail's own grid
   gap has to keep applying to the blocks inside them, not to the wrappers. */
.passthru { display: contents; }

/* The passage a sermon is on, in every list. Monospaced and quiet: it is a
   locator, not a headline, and it has to stay readable beside 67 titles that
   say nothing but a date. */
.t-ref { font-family: var(--mono); font-size: .78rem; color: var(--ink-soft); white-space: nowrap; }
@media (max-width: 44rem) { .t-ref { display: none; } .tbl thead th:nth-child(3) { display: none; } }

/* A hole in the transcript. It has to read as an absence, not as a paragraph:
   the whole point is that a reader must not mistake the splice for continuous
   speech. Dashed, quiet, and it says how long. */
.gap {
  display: grid; place-items: center;
  margin: 1.25rem 0; padding: .5rem;
  border-top: 1px dashed var(--rule-hard); border-bottom: 1px dashed var(--rule-hard);
  background: color-mix(in srgb, var(--sunk) 60%, transparent);
}
.gap .label { color: var(--muted); }

/* Something the reader needs told before they read on. */
.notice {
  margin: .75rem 0 0; padding: .6rem .8rem;
  font-size: .9rem; color: var(--ink-soft);
  border-left: 3px solid var(--gold);
  background: color-mix(in srgb, var(--gold) 8%, transparent);
  border-radius: 0 3px 3px 0;
}
