/* ==========================================================================
   writing.kayadshead.org — design system
   Two designed rooms: theme-light (ink on paper) and theme-dark (stage dark).
   Type: Libre Caslon Display (monument headings), Libre Caslon Text (body),
   Archivo Narrow (billing lines: dates, kinds, credits).
   Accent: curtain red. Spend boldness on the timeline spine and titles;
   keep everything else quiet.
   ========================================================================== */

/* ---- Fonts (self-hosted for longevity) ---- */
@font-face {
  font-family: "Libre Caslon Display";
  src: url("../fonts/libre-caslon-display-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Libre Caslon Text";
  src: url("../fonts/libre-caslon-text-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Libre Caslon Text";
  src: url("../fonts/libre-caslon-text-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Libre Caslon Text";
  src: url("../fonts/libre-caslon-text-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Archivo Narrow";
  src: url("../fonts/archivo-narrow-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Archivo Narrow";
  src: url("../fonts/archivo-narrow-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---- Tokens ---- */
:root {
  --font-display: "Libre Caslon Display", "Libre Caslon Text", Georgia, serif;
  --font-body: "Libre Caslon Text", Georgia, serif;
  --font-billing: "Archivo Narrow", "Arial Narrow", sans-serif;

  --measure: 42rem;
  --wide: 68rem;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 2rem;
  --space-4: 3.5rem;
  --space-5: 6rem;
}

/* The light room: ink on unbleached paper. */
.theme-light {
  --ground: #faf8f3;
  --ink: #211d1a;
  --muted: #756c62;
  --accent: #8e1b26;      /* curtain red */
  --rule: #d9d3c8;
  --surface: #f1eee6;
}

/* The dark room: house dark, photographs glowing out of it. */
.theme-dark {
  --ground: #191313;
  --ink: #ece6dd;
  --muted: #9a8f88;
  --accent: #c8323e;      /* curtain red, lifted for dark ground */
  --rule: #372e2c;
  --surface: #211a1a;
}

/* ---- Base ---- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

img { max-width: 100%; height: auto; display: block; }

/* Billing lines: the playbill voice. Dates, kinds, credits, eyebrows. */
.billing {
  font-family: var(--font-billing);
  font-weight: 500;
  font-size: 0.8125rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.billing--accent { color: var(--accent); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.12; margin: 0 0 var(--space-2); }
h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); }
h3 { font-size: 1.25rem; }

/* ---- Shell ---- */
.shell { max-width: var(--wide); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem); }
.prose { max-width: var(--measure); }

.site-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2);
  padding: var(--space-3) 0 var(--space-2);
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}
.site-head .wordmark { font-family: var(--font-display); font-size: 1.35rem; text-decoration: none; }
.site-nav { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.site-nav a { font-family: var(--font-billing); font-size: 0.8125rem; letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none; color: var(--muted); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--accent); }

main { padding-bottom: var(--space-5); }

.site-foot {
  border-top: 1px solid var(--rule);
  padding: var(--space-3) 0 var(--space-4);
  color: var(--muted);
  font-size: 0.9375rem;
}
.site-foot .agent-line { margin: 0 0 var(--space-1); }

/* ---- Masthead (landing) ---- */
.masthead { padding: var(--space-5) 0 var(--space-4); }
.masthead h1 { margin-bottom: var(--space-1); }
.masthead .roles { margin: 0 0 var(--space-2); }
.masthead .standfirst { max-width: var(--measure); font-size: 1.15rem; font-style: italic; color: var(--muted); }

/* ---- Landing page hero photograph ---- */
.hero { margin: 0 0 var(--space-4); }
.hero img { width: 100%; }
.hero figcaption { padding-top: 0.5rem; }

/* ---- The timeline: the monument. Signature element.
   A single chronological stream hung on a thin spine; images keep their
   natural aspect; each entry carries a playbill billing line. ---- */
.timeline { position: relative; margin-top: var(--space-3); }
.timeline::before {
  content: "";
  position: absolute; top: 0; bottom: 0; left: 0.4rem;
  width: 1px; background: var(--rule);
}
.tl-year { position: relative; padding: var(--space-3) 0 var(--space-1) var(--space-3); }
.tl-year .billing { color: var(--accent); font-size: 0.9375rem; }
.tl-year::before {
  content: "";
  position: absolute; left: 0; top: calc(var(--space-3) + 0.45em);
  width: 0.85rem; height: 0.85rem; border-radius: 50%;
  background: var(--accent);
}
.tl-entry {
  position: relative;
  padding: var(--space-2) 0 var(--space-3) var(--space-3);
  max-width: 54rem;
}
.tl-entry .kind { margin-bottom: 0.4rem; }
.tl-entry figure { margin: 0 0 var(--space-2); }
.tl-entry img { border: 1px solid var(--rule); }
.tl-entry h2 { margin-bottom: 0.35rem; }
.tl-entry h2 a { text-decoration: none; }
.tl-entry h2 a:hover { color: var(--accent); }
.tl-entry .credit { font-style: italic; color: var(--muted); margin: 0 0 0.5rem; }
.tl-entry .logline { margin: 0; max-width: var(--measure); }

/* Poem-on-page entries in the timeline show an opening line instead of an image */
.tl-entry .opening {
  font-family: var(--font-display);
  font-size: 1.4rem;
  line-height: 1.4;
  border-left: 2px solid var(--accent);
  padding-left: var(--space-2);
  margin: var(--space-2) 0;
}

/* ---- Work pages ---- */
.work-head { padding: var(--space-4) 0 var(--space-3); }
.work-head .kind { margin-bottom: var(--space-1); }
.work-head h1 { margin-bottom: 0.4rem; }
.work-head .credit { font-style: italic; color: var(--muted); font-size: 1.1rem; margin: 0; }
.work-head .yearline { margin-top: var(--space-1); }

.gallery { display: grid; gap: var(--space-2); margin: var(--space-3) 0; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; border: 1px solid var(--rule); cursor: zoom-in; }
.gallery figcaption { font-family: var(--font-billing); font-size: 0.8125rem; letter-spacing: 0.06em; color: var(--muted); padding-top: 0.4rem; }
@media (min-width: 46rem) {
  .gallery { grid-template-columns: 1fr 1fr; }
  .gallery figure:first-child { grid-column: 1 / -1; }
}

dialog.lightbox { border: none; padding: 0; background: rgba(10, 8, 8, 0.92); max-width: 100vw; max-height: 100vh; }
dialog.lightbox img { max-width: 92vw; max-height: 88vh; width: auto; height: auto; margin: auto; }
dialog.lightbox::backdrop { background: rgba(10, 8, 8, 0.92); }
dialog.lightbox button { position: fixed; top: 1rem; right: 1rem; font-family: var(--font-billing); letter-spacing: 0.1em; background: none; border: 1px solid #9a8f88; color: #ece6dd; padding: 0.4rem 0.9rem; cursor: pointer; }

.section { margin: var(--space-4) 0; }
.section > .billing { display: block; margin-bottom: var(--space-2); padding-bottom: 0.5rem; border-bottom: 1px solid var(--rule); }

.meta-list { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem var(--space-3); margin: 0; max-width: var(--measure); }
.meta-list dt { font-family: var(--font-billing); font-size: 0.8125rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); padding-top: 0.2rem; }
.meta-list dd { margin: 0; }

/* Evidence: press quotes pulled large, pinned to their sources */
.quote { margin: 0 0 var(--space-3); max-width: var(--measure); }
.quote blockquote {
  margin: 0 0 var(--space-1);
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.4;
}
.quote cite { font-style: normal; }

.extract {
  background: var(--surface);
  border-left: 2px solid var(--accent);
  padding: var(--space-2) var(--space-3);
  max-width: var(--measure);
}

/* Poems on the page: the poem is the designed object */
.poem-body {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  line-height: 1.55;
  white-space: pre-wrap;
  max-width: var(--measure);
  margin: var(--space-4) 0;
}

.artwork { margin: var(--space-3) 0; max-width: var(--measure); }
.artwork img { border: 1px solid var(--rule); }
.artwork figcaption { font-family: var(--font-billing); font-size: 0.8125rem; letter-spacing: 0.06em; color: var(--muted); padding-top: 0.4rem; }

/* Download / CTA buttons: quiet, playbill voice */
.button {
  display: inline-block;
  font-family: var(--font-billing);
  font-size: 0.875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.65rem 1.25rem;
}
.button:hover { background: var(--accent); color: var(--ground); }

.agent-cta {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: var(--space-3) 0;
  margin: var(--space-4) 0;
  max-width: var(--measure);
}
.agent-cta p { margin: 0 0 var(--space-2); }

/* Ground toggle on the landing page — temporary, for choosing the timeline's
   ground by looking. Remove once the decision is made. */
.ground-toggle {
  font-family: var(--font-billing); font-size: 0.8125rem; letter-spacing: 0.14em;
  text-transform: uppercase; background: none; border: 1px solid var(--rule);
  color: var(--muted); padding: 0.4rem 0.9rem; cursor: pointer;
}
.ground-toggle:hover { border-color: var(--accent); color: var(--accent); }
