/* DickFrancisBooks.com
   Design: "the racecard", a printed racing-programme aesthetic.
   Warm paper stock, hairline rules, red numerals, generous margins.
   Palette anchored on the red the site has used since 1997. */

:root {
  --red:       #C2181F;   /* racing red: headings, rules, one accent per view */
  --red-deep:  #8E1016;   /* pressed/visited states */
  --ink:       #14110F;   /* warm near-black, never #000 */
  --ink-60:    #4A443F;
  --ink-35:    #857D76;
  --paper:     #FAF7F2;   /* paperback stock */
  --paper-2:   #F2EDE4;   /* recessed panels */
  --turf:      #2F4F3A;   /* secondary accent */
  --brass:     #9A7B12;   /* awards, sparingly (darkened for AA contrast) */
  --rule:      rgba(20, 17, 15, 0.14);
  --rule-firm: rgba(20, 17, 15, 0.30);

  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --text:    "Newsreader", Georgia, "Times New Roman", serif;

  --measure: 66ch;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --shell: 1180px;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.65;
  font-variant-numeric: oldstyle-num;
  /* paper grain: subtle, and it must never wash out text */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--red); text-decoration-thickness: 1px; text-underline-offset: 0.16em; }
a:hover { color: var(--red-deep); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

/* ---------- type scale ---------- */
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.08; margin: 0; letter-spacing: -0.012em; }
h1 { font-size: clamp(2.6rem, 1.7rem + 4.2vw, 5.25rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 1.25rem + 1.5vw, 2.35rem); }
h3 { font-size: clamp(1.15rem, 1.05rem + 0.5vw, 1.4rem); }
p { margin: 0 0 1.1em; max-width: var(--measure); }

.eyebrow {
  font-family: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-variant-numeric: lining-nums;
  color: var(--ink-35);
  margin: 0 0 0.9rem;
}
.eyebrow--red { color: var(--red); }

/* ---------- shell ---------- */
.shell { max-width: var(--shell); margin-inline: auto; padding-inline: var(--gutter); }
.shell--narrow { max-width: 780px; }

/* ---------- diamonds (carried over from the 1997 site) ---------- */
.diamonds { display: flex; gap: 0.55rem; justify-content: center; align-items: center; }
.diamonds svg { width: 9px; height: 9px; fill: var(--red); }
.diamonds--left { justify-content: flex-start; }

/* ---------- masthead ---------- */
.masthead { padding: clamp(1.5rem, 4vw, 2.75rem) 0 0; text-align: center; }
.masthead__rule { border: 0; border-top: 3px solid var(--ink); border-bottom: 1px solid var(--ink); height: 4px; margin: 0 0 1.4rem; }
.masthead__rule--under { border-top: 1px solid var(--ink); border-bottom: 3px solid var(--ink); margin: 1.4rem 0 0; }
.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.75rem, 1rem + 3.4vw, 3.4rem);
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0;
  color: var(--ink);
}
.wordmark a { color: inherit; text-decoration: none; }
.wordmark .dot { color: var(--red); }
/* Flex rather than a text run: letter-spacing leaves a trailing space on the
   last glyph, which throws centred text off, and a plain run wrapped mid-date. */
.masthead__sub {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 0.35rem 0.9rem;
  font-size: 0.72rem; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--ink-35); margin: 0.85rem auto 0; font-variant-numeric: lining-nums;
  max-width: 100%;
}
.masthead__sub > span { text-indent: 0.24em; white-space: nowrap; }
.masthead__sep { display: inline-flex; text-indent: 0; }
.masthead__sep svg { width: 6px; height: 6px; fill: var(--red); }
@media (max-width: 460px) { .masthead__sep { display: none; } }

/* ---------- nav ---------- */
.nav { display: flex; flex-wrap: wrap; gap: clamp(1rem, 3vw, 2.25rem); justify-content: center; padding: 1.1rem 0; }
.nav a {
  font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink); text-decoration: none; padding-bottom: 3px;
  border-bottom: 2px solid transparent; transition: border-color 0.18s, color 0.18s;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--red); border-bottom-color: var(--red); }

/* ---------- hero ---------- */
.hero { padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(2rem, 5vw, 3.5rem); }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.hero h1 { margin-bottom: 1.2rem; }
.hero h1 em { font-style: italic; color: var(--red); }
.hero__lede { font-size: clamp(1.08rem, 1rem + 0.45vw, 1.3rem); color: var(--ink-60); line-height: 1.55; }

/* ---------- declared runner (next release) ---------- */
.declared {
  border: 1px solid var(--rule-firm);
  background: var(--paper-2);
  padding: clamp(1.25rem, 3vw, 1.9rem);
  position: relative;
}
.declared::before {
  content: ""; position: absolute; inset: 5px; border: 1px solid var(--rule); pointer-events: none;
}
.declared__title { font-family: var(--display); font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem); font-weight: 700; line-height: 1.05; margin: 0.35rem 0 0.5rem; }
.declared__meta { font-size: 0.88rem; color: var(--ink-60); margin: 0; }
.declared__date { display: block; font-variant-numeric: lining-nums; letter-spacing: 0.04em; color: var(--red); font-weight: 600; margin-top: 0.9rem; font-size: 0.95rem; }

/* ---------- section headings ---------- */
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.section__head { display: flex; align-items: baseline; gap: 1.25rem; margin-bottom: 2rem; }
.section__head h2 { flex: none; }
.section__head::after { content: ""; flex: 1; height: 1px; background: var(--rule-firm); }

/* ---------- the racecard (book list) ---------- */
.racecard { border-top: 1px solid var(--rule-firm); }
.entry {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) auto;
  gap: 0 clamp(0.9rem, 2.5vw, 2rem);
  align-items: baseline;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--rule);
}
.entry:hover { background: rgba(194, 24, 31, 0.035); }
.entry__year {
  font-family: var(--display); font-variant-numeric: lining-nums;
  font-size: 1.15rem; font-weight: 600; color: var(--red); letter-spacing: 0.01em;
}
.entry__title { font-family: var(--display); font-size: clamp(1.1rem, 1rem + 0.4vw, 1.35rem); font-weight: 600; margin: 0; }
.entry__note { display: block; font-family: var(--text); font-size: 0.84rem; font-weight: 400; color: var(--ink-35); margin-top: 0.2rem; letter-spacing: 0; }
.entry__award { color: var(--brass); font-style: italic; }
.entry__by { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-35); white-space: nowrap; }
.entry--forthcoming .entry__year::after { content: " ◆"; color: var(--red); font-size: 0.6em; vertical-align: 0.35em; }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem 0.6rem; align-items: center; margin-bottom: 1.75rem; }
.chip {
  font-family: var(--text); font-size: 0.76rem; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.45rem 0.95rem; border: 1px solid var(--rule-firm); background: transparent;
  color: var(--ink-60); cursor: pointer; transition: all 0.16s;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.search {
  font-family: var(--text); font-size: 0.95rem; padding: 0.45rem 0.7rem; margin-left: auto;
  border: 1px solid var(--rule-firm); background: var(--paper); color: var(--ink); min-width: 13rem;
}
.search::placeholder { color: var(--ink-35); }
.count { font-size: 0.8rem; color: var(--ink-35); letter-spacing: 0.06em; font-variant-numeric: lining-nums; }

/* An author `display` always beats the UA's [hidden] rule, so .entry { display:
   grid } kept filtered-out rows on screen. Make hidden actually mean hidden. */
[hidden] { display: none !important; }

/* ---------- pull quote ---------- */
.pullquote { border-top: 1px solid var(--rule-firm); border-bottom: 1px solid var(--rule-firm); padding: clamp(2rem, 5vw, 3.25rem) 0; text-align: center; }
.pullquote blockquote {
  font-family: var(--display); font-size: clamp(1.3rem, 1.05rem + 1.3vw, 2rem);
  line-height: 1.32; font-style: italic; margin: 0 auto; max-width: 30ch; color: var(--ink);
}
.pullquote cite { display: block; margin-top: 1.4rem; font-family: var(--text); font-style: normal; font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-35); }
.pullquote cite a { color: inherit; text-decoration-color: var(--rule-firm); }
.pullquote cite a:hover { color: var(--red); }

/* rotating voices: reserve height so the section doesn't jump between quotes */
.voices { margin-top: 1.5rem; min-height: 9.5rem; display: flex; flex-direction: column; justify-content: center; transition: opacity 0.45s ease; }
.voices.is-fading { opacity: 0; }
.voices__all { margin: 1.75rem 0 0; }
.voices__all .more { color: var(--ink-35); }
.voices__all .more:hover { color: var(--red); }
@media (max-width: 640px) { .voices { min-height: 13rem; } }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: clamp(1.25rem, 3vw, 2.25rem); }
.card { border-top: 3px solid var(--ink); padding-top: 1.1rem; }
.card h3 { margin-bottom: 0.55rem; }
.card p { font-size: 0.94rem; color: var(--ink-60); margin-bottom: 0.9rem; }
.card__stat { font-family: var(--display); font-variant-numeric: lining-nums; font-size: 2.4rem; font-weight: 700; color: var(--red); line-height: 1; display: block; margin-bottom: 0.4rem; }
.more { font-size: 0.76rem; letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 2px; }

/* ---------- nostalgic view stub ---------- */
.stub {
  display: inline-flex; flex-direction: column; gap: 0.3rem; text-align: left;
  padding: 1rem 1.5rem; text-decoration: none; color: var(--ink);
  background: var(--paper-2);
  border: 1px dashed var(--rule-firm);
  transition: transform 0.18s, border-color 0.18s;
}
.stub:hover { transform: translateY(-2px); border-color: var(--red); color: var(--ink); }
.stub__label { font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--red); }
.stub__main { font-family: var(--display); font-size: 1.2rem; font-weight: 600; }
.stub__sub { font-size: 0.82rem; color: var(--ink-35); }

/* ---------- memorial note ---------- */
/* Set apart from the biography, but quietly. No heavier than the page needs. */
.memorial {
  margin: 2.25rem 0;
  padding: 0.15rem 0 0.15rem 1.35rem;
  border-left: 2px solid var(--red);
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--ink);
  max-width: 60ch;
}
.memorial em { font-style: italic; }

/* ---------- gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: clamp(1.25rem, 3vw, 2rem); }
.shot { margin: 0; }
.shot a { display: block; border: 1px solid var(--rule-firm); padding: 6px; background: var(--paper-2); transition: border-color 0.18s, transform 0.18s; }
.shot a:hover { border-color: var(--red); transform: translateY(-2px); }
.shot img { width: 100%; }
.shot figcaption { font-size: 0.86rem; color: var(--ink-60); margin-top: 0.65rem; line-height: 1.45; }

/* ---------- a11y ---------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- footer ---------- */
.footer { border-top: 3px solid var(--ink); margin-top: clamp(3rem, 8vw, 6rem); padding: 2.5rem 0 3.5rem; }
.footer__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 2rem; align-items: start; }
.footer h4 { font-family: var(--text); font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-35); margin: 0 0 0.8rem; font-weight: 600; }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: 0.4rem; font-size: 0.92rem; }
.footer a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule); }
.footer a:hover { color: var(--red); border-bottom-color: var(--red); }
.colophon { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); font-size: 0.82rem; color: var(--ink-35); }

/* ---------- motion: one orchestrated load, then stillness ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(12px); animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
  .reveal:nth-child(1) { animation-delay: 0.05s; }
  .reveal:nth-child(2) { animation-delay: 0.15s; }
  .reveal:nth-child(3) { animation-delay: 0.25s; }
  @keyframes rise { to { opacity: 1; transform: none; } }
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; gap: 2.25rem; }
}
@media (max-width: 640px) {
  .entry { grid-template-columns: 4rem minmax(0, 1fr); }
  .entry__by { grid-column: 2; margin-top: 0.25rem; }
  .search { margin-left: 0; width: 100%; }
  .nav { gap: 0.9rem 1.1rem; }
}

/* ---------- print ---------- */
@media print {
  body { background: #fff; }
  .nav, .stub, .filters { display: none; }
}

/* ---------- cast list (per-book pages) ---------- */
.cast { margin: 0; border-top: 1px solid var(--rule-firm); }
.cast__row {
  display: grid; grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr);
  gap: 0 clamp(0.9rem, 2.5vw, 2rem);
  padding: 0.7rem 0; border-bottom: 1px solid var(--rule);
}
.cast dt { font-family: var(--display); font-weight: 600; color: var(--ink); margin: 0; }
.cast dd { margin: 0; color: var(--ink-60); font-size: 0.96rem; }
@media (max-width: 600px) {
  .cast__row { grid-template-columns: 1fr; gap: 0.15rem; }
}

/* ---------- favorite passages (per-book pages) ---------- */
.passage__intro { color: var(--ink-60); max-width: 60ch; margin-bottom: 1.25rem; }
.passage {
  margin: 0 0 1.25rem;
  padding: 0.2rem 0 0.2rem 1.35rem;
  border-left: 2px solid var(--red);
  font-family: var(--display);
  font-size: 1.08rem;
  font-style: italic;
  line-height: 1.55;
  color: var(--ink);
  max-width: 58ch;
}
.passage__note { font-size: 0.84rem; color: var(--ink-35); max-width: 58ch; }
.passage__note em { font-style: italic; }

/* ---------- spoiler reveal (per-book pages) ---------- */
.spoiler {
  border: 1px solid var(--rule-firm);
  background: var(--paper-2);
  padding: 1rem 1.25rem;
  max-width: 60ch;
}
.spoiler > summary {
  cursor: pointer;
  color: var(--ink-60);
  font-size: 0.95rem;
  line-height: 1.5;
  list-style: none;
}
.spoiler > summary::-webkit-details-marker { display: none; }
.spoiler > summary::before {
  content: "▸";
  color: var(--red);
  margin-right: 0.5rem;
  display: inline-block;
}
.spoiler[open] > summary::before { content: "▾"; }
.spoiler > summary strong { color: var(--red); }
.spoiler > summary:hover { color: var(--ink); }
.spoiler__body { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.spoiler__body .passage { max-width: none; }
