/* Mr Stephen Alderney — "The Red Reflex"
   Monograph grammar. See demo-src/lindrick-eye/brand.md
   Gambetta + Switzer (Fontshare). Four tokens. No cards, no icons, no motion. */

:root {
  --ivory: #F1F0EC;
  --ink: #14171A;
  --reflex: #96201C;
  --mute: #5C6166;

  --measure: 40rem;          /* ~660px print measure */
  --rail: 15rem;
  --gutter: 3.5rem;
  --rule: rgba(92, 97, 102, 0.25);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 5rem;   /* sticky running head must not cover anchor targets */
}

body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: 'Switzer', ui-sans-serif, system-ui, sans-serif;
  font-size: 1.125rem;       /* 18px floor — older audience */
  line-height: 1.72;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, .display, .folio-title {
  font-family: 'Gambetta', ui-serif, Georgia, serif;
  font-weight: 400;
  line-height: 1.16;
  letter-spacing: -0.008em;
  margin: 0;
}

p { margin: 0 0 1.35em; }
p:last-child { margin-bottom: 0; }

a { color: var(--reflex); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

em { font-family: 'Gambetta', ui-serif, Georgia, serif; font-style: italic; font-size: 1.06em; }
strong { font-weight: 500; }

::selection { background: var(--reflex); color: var(--ivory); }

:focus-visible { outline: 2px solid var(--reflex); outline-offset: 3px; }

/* ---------- skip link (WCAG) ---------- */
.skip {
  position: absolute; left: -9999px;
  background: var(--ink); color: var(--ivory);
  padding: 12px 18px; z-index: 100;
}
.skip:focus { left: 12px; top: 12px; }

/* ---------- page frame: off-centre column + right rail ---------- */
.sheet {
  max-width: calc(var(--measure) + var(--rail) + var(--gutter));
  margin: 0 auto 0 max(6vw, 3rem);
  padding: 0 1.5rem;
}

.leaf {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) var(--rail);
  column-gap: var(--gutter);
  align-items: start;
}
.leaf > .rail { grid-column: 2; }
.leaf > *:not(.rail) { grid-column: 1; }

/* ---------- running head ---------- */
.runhead {
  position: sticky; top: 0; z-index: 20;
  background: var(--ivory);
  border-bottom: 1px solid var(--rule);
}
.runhead .sheet {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1.5rem; min-height: 3.4rem; padding-top: 0.9rem; padding-bottom: 0.9rem;
}
.runhead a { color: var(--ink); text-decoration: none; }
.runhead .name {
  font-family: 'Gambetta', ui-serif, Georgia, serif;
  font-size: 1.0625rem; letter-spacing: 0.005em;
}
.runhead .where {
  font-size: 0.875rem; color: var(--mute);
  letter-spacing: 0.02em;
  /* no uppercase: minor chapter numerals are lowercase roman (II.i, not II.I) */
}
@media (max-width: 640px) { .runhead .where { display: none; } }

/* ---------- contents (the opening page's spine) ---------- */
.contents { list-style: none; margin: 0; padding: 0; }
.contents li { border-top: 1px solid var(--rule); }
.contents li:last-child { border-bottom: 1px solid var(--rule); }
.contents a {
  display: grid; grid-template-columns: 3.25rem 1fr auto;
  align-items: baseline; gap: 1rem;
  padding: 1.05rem 0; text-decoration: none; color: var(--ink);
}
.contents .num {
  font-size: 0.8125rem; color: var(--mute); letter-spacing: 0.1em;
}
.contents .ttl { font-family: 'Gambetta', ui-serif, Georgia, serif; font-size: 1.375rem; }
.contents .gloss { font-size: 0.9375rem; color: var(--mute); text-align: right; }
.contents a:hover .ttl { color: var(--reflex); }
@media (max-width: 700px) {
  .contents a { grid-template-columns: 2.5rem 1fr; }
  .contents .gloss { display: none; }
}

/* ---------- chapter ---------- */
.chapter { margin: 5.5rem 0 0; }
.chapter:first-of-type { margin-top: 3.25rem; }
.chapter > .num {
  display: block; font-size: 0.8125rem; color: var(--mute);
  letter-spacing: 0.13em; text-transform: uppercase;
  padding-bottom: 0.85rem; margin-bottom: 1.6rem;
  border-bottom: 1px solid var(--rule);
}
.chapter h1 { font-size: clamp(2.15rem, 5vw, 3.05rem); }
.chapter h2 { font-size: clamp(1.5rem, 3vw, 1.85rem); margin: 2.85rem 0 0.85rem; }
.chapter h3 { font-size: 1.1875rem; margin: 2rem 0 0.6rem; font-weight: 500; }
.lede {
  font-family: 'Gambetta', ui-serif, Georgia, serif;
  font-size: clamp(1.25rem, 2.4vw, 1.4375rem);
  line-height: 1.5; margin: 1.4rem 0 0;
  color: var(--ink);
}

.opening { margin-top: 2.1rem; }

/* initial capital — the one place --reflex appears in prose */
.opening > p:first-of-type::first-letter {
  font-family: 'Gambetta', ui-serif, Georgia, serif;
  float: left; font-size: 3.7em; line-height: 0.82;
  padding: 0.06em 0.09em 0 0; color: var(--reflex);
}

/* ---------- frontispiece portrait ---------- */
.portrait {
  margin: 0 0 1.6rem;
  max-width: 13.5rem;
}
.portrait img {
  display: block; width: 100%; height: auto;
  /* cut-out with alpha — sits directly on the ground, no frame */
}
.portrait figcaption {
  border-top: 1px solid var(--rule);
  margin-top: 0.5rem; padding-top: 0.6rem;
  font-family: 'Gambetta', ui-serif, Georgia, serif;
  font-style: italic; font-size: 0.875rem; color: var(--mute);
  line-height: 1.45;
}
@media (max-width: 1180px) {
  .portrait { max-width: 11rem; float: right; margin: 0 0 1rem 1.5rem; }
}
@media (max-width: 560px) {
  .portrait { float: none; margin: 0 0 1.4rem; max-width: 9.5rem; }
}

/* ---------- marginalia ---------- */
.rail {
  font-size: 0.875rem; line-height: 1.6; color: var(--mute);
  padding-top: 0.35rem;
}
.rail dl { margin: 0; }
.rail dt {
  font-family: 'Gambetta', ui-serif, Georgia, serif;
  font-style: italic; color: var(--ink); font-size: 0.9375rem;
  margin-top: 1.15rem;
}
.rail dt:first-child { margin-top: 0; }
.rail dd { margin: 0.1rem 0 0; }
.rail .note {
  border-top: 1px solid var(--rule);
  margin-top: 1.5rem; padding-top: 1rem;
  font-family: 'Gambetta', ui-serif, Georgia, serif; font-style: italic;
}

@media (max-width: 1180px) {
  .leaf { grid-template-columns: minmax(0, 1fr); }
  .leaf > .rail, .leaf > *:not(.rail) { grid-column: 1; }
  .rail {
    border-left: 2px solid var(--rule);
    padding: 0.2rem 0 0.2rem 1.15rem;
    margin: 2rem 0 2.5rem;
    max-width: var(--measure);
  }
  .sheet { margin-left: auto; margin-right: auto; }
}

/* ---------- urgent notice ---------- */
.notice {
  border-left: 3px solid var(--reflex);
  padding: 0.15rem 0 0.15rem 1.4rem;
  margin: 2.75rem 0;
  max-width: var(--measure);
}
.notice p:first-child {
  font-family: 'Gambetta', ui-serif, Georgia, serif;
  font-size: 1.1875rem; color: var(--ink);
}
.notice p { margin-bottom: 0.55em; }
.notice p:last-child { margin-bottom: 0; font-size: 1rem; }

/* ---------- index of treatments (typographic, never tiles) ---------- */
.index { list-style: none; margin: 2.5rem 0 0; padding: 0; }
.index li { border-top: 1px solid var(--rule); }
.index li:last-child { border-bottom: 1px solid var(--rule); }
.index a {
  display: block; padding: 1.4rem 0; text-decoration: none; color: var(--ink);
}
.index .hd {
  display: flex; align-items: baseline; gap: 0.85rem; margin-bottom: 0.3rem;
}
.index .folio { font-size: 0.8125rem; color: var(--mute); letter-spacing: 0.1em; }
.index .nm { font-family: 'Gambetta', ui-serif, Georgia, serif; font-size: 1.4375rem; }
.index p { margin: 0; color: var(--mute); font-size: 1rem; max-width: 34rem; }
.index a:hover .nm { color: var(--reflex); }

/* ---------- key facts + ledger ---------- */
.facts, .ledger { width: 100%; border-collapse: collapse; margin: 1.6rem 0 0; }
.facts th, .facts td, .ledger th, .ledger td {
  text-align: left; padding: 0.72rem 0; vertical-align: baseline;
  border-bottom: 1px solid var(--rule);
}
.facts th, .ledger th {
  font-weight: 400; color: var(--mute); font-size: 0.9375rem; width: 42%;
}
.ledger td { text-align: right; font-family: 'Gambetta', ui-serif, Georgia, serif; font-size: 1.3125rem; }
.ledger th { width: auto; color: var(--ink); font-size: 1rem; }

/* ---------- questions ---------- */
.qa { margin: 2.25rem 0 0; }
.qa > div { border-top: 1px solid var(--rule); padding: 1.4rem 0; }
.qa > div:last-child { border-bottom: 1px solid var(--rule); }
.qa h3 {
  font-family: 'Gambetta', ui-serif, Georgia, serif;
  font-size: 1.1875rem; font-weight: 400; margin: 0 0 0.5rem;
}
.qa p { font-size: 1.0625rem; }

/* ---------- written enquiry ---------- */
.field {
  width: 100%; font: inherit; padding: 0.55rem 0.6rem;
  border: 1px solid var(--rule); background: transparent; color: inherit;
  border-radius: 0;
}
.field:focus { border-color: var(--reflex); }
.send {
  font: inherit; font-size: 1.0625rem; padding: 0.75rem 1.7rem;
  background: var(--ink); color: var(--ivory); border: 0; cursor: pointer;
}
.send:hover { background: var(--reflex); }
.after { margin-top: 1.4rem; }

/* ---------- inverted plate ---------- */
.plate {
  background: var(--ink); color: var(--ivory);
  margin: 5.5rem 0 0; padding: 4.5rem 0;
}
.plate h2 { color: var(--ivory); font-size: clamp(1.6rem, 3.4vw, 2.15rem); }
.plate p { color: rgba(241, 240, 236, 0.86); }
.plate a { color: var(--ivory); }
.plate .rail, .plate .lede { color: rgba(241, 240, 236, 0.7); }
.plate .tel {
  font-family: 'Gambetta', ui-serif, Georgia, serif;
  font-size: clamp(1.9rem, 4.5vw, 2.6rem); display: inline-block;
  margin-top: 0.7rem; text-decoration: none; color: var(--ivory);
}
.plate .tel:hover { text-decoration: underline; }

/* ---------- colophon ---------- */
.colophon {
  margin-top: 5rem; border-top: 1px solid var(--rule);
  padding: 2.5rem 0 4rem; font-size: 0.9375rem; color: var(--mute);
}
.colophon a { color: var(--mute); }
.colophon .cols { display: flex; flex-wrap: wrap; gap: 2.5rem 4rem; }
.colophon ul { list-style: none; margin: 0; padding: 0; }
.colophon li { margin-bottom: 0.4rem; }
.colophon .legal { margin-top: 2.25rem; max-width: var(--measure); }

/* ---------- draft ribbon ---------- */
.ribbon {
  background: var(--ink); color: rgba(241, 240, 236, 0.82);
  font-size: 0.875rem; line-height: 1.55; padding: 0.7rem 1.5rem; text-align: center;
}
.ribbon b { color: var(--ivory); font-weight: 500; }

/* ---------- motion: stillness is the signature ---------- */
a, .index .nm, .contents .ttl { transition: color 200ms linear; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
