/* ============================================================
   brief.css — qwyntus.com, The Praesidium Brief's public paper.

   A broadsheet that hangs from a rod. Every colour is a token from
   css/tokens.css (copied to site/css/tokens.css by build-site.js), so
   the contrast audit's measurements hold here. Dark Berries follows the
   reader's device; the site has no toggle and ships no script.

   Type: Playfair for the paper's voice (nameplate, heads, decks), a
   Georgia-led serif for long reading, Jost for the apparatus (dateline,
   kickers, shelf), Fredoka caps for an inline QWYNTUS, and the Bungee
   Hairline wordmark once, large, in the footer. Bungee disappears below
   about 24px, which is why inline mentions take Fredoka (Ebi-San's
   pre-clearance rule).
   ============================================================ */

@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 400 900; font-display: swap; src: url("/fonts/playfair-display-var.woff2") format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 400 900; font-display: swap; src: url("/fonts/playfair-display-italic-var.woff2") format("woff2"); }
@font-face { font-family: "Jost"; font-weight: 400 700; font-display: swap; src: url("/fonts/jost-var.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 400 700; font-display: swap; src: url("/fonts/fredoka-var.woff2") format("woff2"); }
@font-face { font-family: "Bungee Hairline"; font-weight: 400; font-display: swap; src: url("/fonts/bungee-hairline-400.woff2") format("woff2"); }

:root {
  --rod-h: 48px;
  --reading: Georgia, "Times New Roman", serif;
  /* The Roll's motion, from the Reading Surface spec: overshoot and settle,
     so it reads as paper rather than a panel. */
  --unroll: cubic-bezier(0.34, 1.56, 0.64, 1);
  --sheet: 1120px;
  --gutter: clamp(16px, 4vw, 48px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding-top: var(--rod-h);
  background: var(--ground);
  color: var(--ink);
  font-family: var(--reading);
  font-size: 1.0625rem;
  line-height: 1.6;
}

a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img, svg { display: block; max-width: 100%; height: auto; }
h1, h2, h3, [id] { scroll-margin-top: calc(var(--rod-h) + 16px); }

.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 16px; top: calc(var(--rod-h) + 8px); z-index: 40; background: var(--surface); padding: 6px 10px; }

/* ---------- the rod ----------
   Fixed above everything, as the spec has it: a dowel with end-caps, the
   crest, the paper's name and its headline. On a page with a paper it is
   the <summary> that rolls the paper up and down. */

.roll > summary { list-style: none; }
.roll > summary::-webkit-details-marker { display: none; }

.rod {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  height: var(--rod-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
  background: var(--band-deep);
  color: var(--band-ink);
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  text-decoration: none;
  cursor: pointer;
}
a.rod:hover { color: var(--band-ink); }

.rod-cap { flex: none; width: 8px; height: 22px; border-radius: 3px; background: linear-gradient(180deg, var(--rule), var(--accent-deep)); }
.rod-mark { flex: none; width: 24px; line-height: 0; }
.rod-name { flex: none; font-family: var(--brief); font-weight: 700; font-size: 1rem; white-space: nowrap; }
.rod-line { flex: 1; min-width: 0; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--band-ink); }
.rod-state { flex: none; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--band-ink-soft); }
.rod-pull { flex: none; width: 18px; color: var(--accent); line-height: 0; }
.rod-pull svg { transition: transform 240ms ease; }
.roll[open] .rod-pull svg { transform: rotate(180deg); }

.roll[open] .when-closed,
.roll:not([open]) .when-open { display: none; }

@media (max-width: 680px) {
  .rod-name { display: none; }
  /* Off screen but still read aloud: the rod's state is its label. */
  .rod-state { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---------- the unroll ----------
   On arrival the paper unrolls from the rod. A ground-coloured veil covers
   the first screen and travels down off it, with the curl shadow at its
   leading edge. It moves over the screen rather than scaling the page, so a
   long article never stretches. */

.veil {
  position: fixed;
  left: 0; right: 0;
  top: var(--rod-h);
  height: 100vh;
  z-index: 20;
  background: var(--ground);
  pointer-events: none;
  animation: unroll 500ms var(--unroll) both;
}
.veil::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: -18px;
  height: 18px;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.16));
}
@keyframes unroll {
  from { transform: translateY(0); }
  to { transform: translateY(100vh); visibility: hidden; }
}

/* Rolling up. Where the browser can animate a <details> closing, the paper
   rolls up on ease-in at 360ms, the console's re-roll; opening stays
   instant, because the veil already plays the unroll. Elsewhere it closes at
   once. */
@supports (interpolate-size: allow-keywords) {
  .roll { interpolate-size: allow-keywords; }
  .roll::details-content {
    height: 0;
    overflow: clip;
    transition: height 360ms ease-in, content-visibility 360ms ease-in allow-discrete;
  }
  .roll[open]::details-content { height: auto; transition-duration: 0s; }
}

@media (prefers-reduced-motion: reduce) {
  .veil { display: none; }
  .rod-pull svg { transition: none; }
  .roll::details-content { transition: none !important; }
}

/* ---------- the paper ---------- */

.paper {
  position: relative;
  max-width: var(--sheet);
  margin: 24px auto 0;
  padding: clamp(18px, 3.5vw, 36px) var(--gutter) 36px;
  background: var(--surface);
  border: 1px solid var(--rule);
}
.paper-short { min-height: 40vh; }
@media (max-width: 640px) {
  .paper { margin-top: 0; border-left: 0; border-right: 0; }
}

/* ---------- the nameplate ---------- */

.nameplate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px 24px;
  padding-bottom: 14px;
  border-bottom: 3px double var(--ink);
}
.ear {
  margin: 0;
  max-width: 13rem;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.72rem;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.ear-left { justify-self: start; }
.ear-right { justify-self: end; text-align: right; }
.ear-k { display: block; font-weight: 600; color: var(--accent-text); }
.ear-v { display: block; }

.flag { text-align: center; }
.flag-crest { display: block; width: 46px; margin: 0 auto 10px; }
.flag-title {
  margin: 0;
  font-family: var(--brief);
  font-weight: 900;
  font-size: clamp(2.1rem, 7vw, 4.4rem);
  line-height: 1;
  letter-spacing: -0.015em;
}
.flag-the { display: block; font-style: italic; font-weight: 400; font-size: 0.4em; letter-spacing: 0.04em; }
.flag-tagline {
  margin: 10px 0 0;
  font-family: var(--brief);
  font-style: italic;
  font-size: clamp(1rem, 2.4vw, 1.25rem);
  color: var(--ink-soft);
}

@media (max-width: 760px) {
  .nameplate { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "flag flag" "left right"; }
  .flag { grid-area: flag; }
  .ear-left { grid-area: left; }
  .ear-right { grid-area: right; }
}

.dateline {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0 0 24px;
  padding: 8px 0;
  border-bottom: 1px solid var(--ink);
  font-family: var(--sans);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.qwyntus { font-family: var(--display); font-weight: 600; letter-spacing: 0.08em; color: var(--ink); }

/* ---------- the front page ---------- */

.front { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
@media (min-width: 900px) {
  .front { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 0; }
  .lead { padding-right: 28px; border-right: 1px solid var(--rule); }
  .rail { padding-left: 28px; }
}

.kicker {
  margin: 0 0 8px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.lead-title {
  margin: 0 0 12px;
  font-family: var(--brief);
  font-weight: 900;
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
}
.lead-title a { color: inherit; text-decoration: none; }
.lead-title a:hover { color: var(--accent-text); }
.deck {
  margin: 0 0 18px;
  font-family: var(--brief);
  font-style: italic;
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  line-height: 1.4;
  color: var(--ink-soft);
}
.lead-body p { max-width: 62ch; margin: 0 0 1em; font-size: 1.125rem; }

.drop::first-letter {
  float: left;
  padding: 0.06em 0.08em 0 0;
  font-family: var(--brief);
  font-weight: 900;
  font-size: 3.4em;
  line-height: 0.8;
  color: var(--accent-text);
}

.more {
  margin: 0;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.box { padding: 10px 0 18px; margin-bottom: 18px; border-top: 3px solid var(--ink); }
.box-h, .section-h {
  margin: 0 0 8px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.box h3 { margin: 4px 0 6px; font-family: var(--brief); font-weight: 700; font-size: 1.35rem; line-height: 1.2; }
.box p { margin: 0; }
.when { font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.06em; color: var(--ink-soft); }

.facts table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.facts tbody, .facts tr, .facts td { display: block; }
.facts tr { padding: 8px 0; border-bottom: 1px solid var(--rule); }
.facts td { padding: 0; border: 0; }
.facts td:first-child {
  margin-bottom: 2px;
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.about { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--ink); }
.about p { max-width: 62ch; margin: 0 0 1em; }

/* ---------- an article ---------- */

.masthead-small { margin-bottom: 26px; padding-bottom: 10px; border-bottom: 3px double var(--ink); text-align: center; }
.masthead-small a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-family: var(--brief);
  font-weight: 900;
  font-size: clamp(1.4rem, 4vw, 2rem);
}
.masthead-crest { width: 30px; line-height: 0; }

.story { max-width: 68ch; margin: 0 auto; }
.story-head { margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--rule); }
.story-title {
  margin: 0 0 14px;
  font-family: var(--brief);
  font-weight: 900;
  font-size: clamp(1.9rem, 4.6vw, 2.75rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
}
.story-body { font-size: 1.125rem; line-height: 1.65; }
.story-body p { margin: 0 0 1.05em; }
.story-body h2 { margin: 1.6em 0 0.6em; font-family: var(--brief); font-weight: 700; font-size: 1.6rem; line-height: 1.2; }
.story-body hr { margin: 1.6em 0; border: 0; border-top: 1px solid var(--rule); }
.story-body ul { margin: 0 0 1.2em; padding-left: 1.2em; }
.story-body li { margin-bottom: 0.4em; }
.story-body table { width: 100%; margin: 0.2em 0 1.5em; border-collapse: collapse; border: 1px solid var(--ink); font-size: 1rem; }
.story-body td { padding: 10px 12px; border-top: 1px solid var(--rule); vertical-align: top; }
.story-body td:first-child {
  width: 38%;
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
@media (max-width: 520px) {
  .story-body tbody, .story-body tr, .story-body td { display: block; width: auto; }
  .story-body td:first-child { width: auto; padding-bottom: 0; border-top: 1px solid var(--rule); }
  .story-body td + td { border-top: 0; padding-top: 4px; }
}

/* ---------- the shelf ----------
   What the rod rolls the paper up onto: back issues, eight to a page,
   newest first, with the next issue waiting at the top. */

.shelf { max-width: var(--sheet); margin: 32px auto 0; padding: 0 var(--gutter); }
.shelf-page { margin-top: 32px; }
.shelf-h {
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 3px double var(--ink);
  font-family: var(--brief);
  font-weight: 900;
  font-size: 1.6rem;
}
.shelf-list { list-style: none; margin: 0; padding: 0; }
.shelf-list li { border-bottom: 1px solid var(--rule); }
.shelf-item {
  display: grid;
  grid-template-columns: 7rem 12rem minmax(0, 1fr);
  align-items: baseline;
  gap: 4px 16px;
  padding: 12px 0;
  color: inherit;
  text-decoration: none;
}
a.shelf-item:hover { color: inherit; }
a.shelf-item:hover .shelf-title { color: var(--accent-text); text-decoration: underline; text-decoration-thickness: 1px; }
.shelf-date, .shelf-kind { font-family: var(--sans); font-size: 0.76rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.shelf-kind { color: var(--accent-text); }
.shelf-title { font-family: var(--brief); font-weight: 700; font-size: 1.15rem; line-height: 1.25; }
.shelf-next .shelf-title { font-style: italic; font-weight: 400; }
@media (max-width: 640px) {
  .shelf-item { grid-template-columns: auto minmax(0, 1fr); }
  .shelf-title { grid-column: 1 / -1; }
}
.pager {
  display: flex;
  justify-content: space-between;
  margin: 14px 0 0;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.foot {
  max-width: var(--sheet);
  margin: 32px auto 0;
  padding: 20px var(--gutter) 44px;
  border-top: 1px solid var(--rule);
  text-align: center;
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--ink-soft);
}
.foot p { margin: 0 0 6px; }
.foot-wordmark {
  margin: 18px 0 6px !important;
  font-family: var(--wordmark);
  font-size: clamp(2rem, 8vw, 2.75rem);
  line-height: 1;
  letter-spacing: 0.06em;
  color: var(--ink);
}

/* ---------- print ----------
   The paper prints; the rod, the shelf and the veil do not. */

@media print {
  body { padding-top: 0; background: #fff; color: #000; }
  .rod, .veil, .shelf, .skip { display: none !important; }
  .paper { margin: 0; max-width: none; border: 0; background: #fff; }
}
