/* ============================================================
   editorial.css — primitives for /writing/ posts.
   ----------------------------------------------------------------
   A small, reusable kit. Classes only; no layout chrome. The
   surrounding article controls width and rhythm.

     .article        — outermost wrapper, sets reading width
     .byline         — author · date · reading time, single line
     .standfirst     — drop-cap'd lede with a wider column
     .pull-quote     — italic Fraunces, accent rule on the left
     .figure         — caption underneath, "Fig. N" italic prefix,
                       source line, accessible <table> mirror
     .callout        — paper-tone aside box, never coloured
     .footnote       — superscript numeral + on-hover card
     .endnotes       — full footnote text at the foot of the post
     .topic-tag      — small monospace tag, used in archives + posts

   Motion tokens (--ease-primary etc.) live in site.css and apply
   automatically.
   ============================================================ */

.article {
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.article-wide { max-width: 64rem; margin: 0 auto; padding: 0 1.5rem; }

/* ── Byline ── */
.byline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: baseline;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding-top: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2rem;
}
.byline .author { color: var(--ink); }
.byline .author a { color: inherit; text-decoration: none; }
.byline .sep { color: var(--rule); }
.byline .topic { color: var(--accent); }

/* ── Standfirst ── */
.standfirst {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 300;
  font-size: 1.32rem;
  line-height: 1.4;
  letter-spacing: -0.005em;
  color: var(--ink-soft);
  max-width: 22ch;
  margin: 0 0 2rem;
  font-variation-settings: "opsz" 144;
  text-wrap: pretty;
}
.standfirst::first-letter {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 300;
  font-size: 4.4em;
  float: left;
  line-height: 0.9;
  margin: 0.05em 0.08em -0.05em 0;
  color: var(--accent);
  font-variation-settings: "opsz" 144;
}
@supports (initial-letter: 3) {
  .standfirst::first-letter {
    -webkit-initial-letter: 3 2;
    initial-letter: 3 2;
    float: none;
    font-size: 1em;
    margin: 0 0.08em 0 0;
  }
}

/* Article body type — handed to plain p, h2, h3, ul, ol */
.article > p,
.article > ul,
.article > ol {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.085rem;
  line-height: 1.68;
  color: var(--ink-soft);
  margin: 0 0 1.25rem;
  text-wrap: pretty;
  font-variation-settings: "opsz" 144;
}
.article > p strong { color: var(--ink); font-weight: 500; }
.article > p em { color: var(--accent); font-style: italic; }
.article > ul,
.article > ol { padding-left: 1.5rem; }
.article > ul li,
.article > ol li { margin-bottom: 0.5rem; }
.article > ul li::marker { color: var(--accent); }
.article > ol li::marker { color: var(--accent); font-family: "JetBrains Mono", monospace; font-size: 0.85em; }

.article h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 400;
  font-size: 1.7rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 3rem 0 1.25rem;
  text-wrap: pretty;
  font-variation-settings: "opsz" 144;
}
.article h2 em { font-weight: 400; font-style: italic; color: var(--accent); }
.article h2 .h-num {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-style: normal;
  font-size: 0.6em;
  letter-spacing: 0.12em;
  color: var(--muted);
  vertical-align: 0.4em;
  margin-right: 0.7rem;
}

.article h3 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: 1.18rem;
  line-height: 1.3;
  margin: 2rem 0 0.85rem;
  color: var(--ink);
  font-variation-settings: "opsz" 144;
}

.article a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(184, 64, 11, 0.4);
  transition: border-color var(--dur-hover) var(--ease-primary);
}
.article a:hover { border-bottom-color: var(--accent); }
.article a.cite, .article sup a { border-bottom: 0; }

/* ── Pull quote ── */
.pull-quote {
  font-family: "Fraunces", Georgia, serif;
  font-style: italic;
  font-weight: 300;
  font-size: 1.55rem;
  line-height: 1.35;
  color: var(--ink);
  border-left: 2px solid var(--accent);
  padding: 0.4rem 0 0.4rem 1.5rem;
  margin: 2.5rem 0;
  font-variation-settings: "opsz" 144;
  text-wrap: balance;
}
.pull-quote cite {
  display: block;
  font-style: normal;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-top: 0.85rem;
}

/* ── Figure ── */
.figure {
  margin: 2.25rem 0;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1.25rem;
}
.figure .fig-body {
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  min-height: 220px;
}
.figure .fig-body svg,
.figure .fig-body canvas { display: block; width: 100%; }
.figure figcaption {
  margin-top: 0.85rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  line-height: 1.55;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: none;
}
.figure figcaption .fig-num {
  font-family: "Fraunces", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  text-transform: none;
  font-size: 0.95rem;
  margin-right: 0.45rem;
  font-variation-settings: "opsz" 144;
}
.figure figcaption .fig-source {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.figure-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.85rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  color: var(--ink-soft);
}
.figure-table caption {
  text-align: left;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.figure-table th,
.figure-table td {
  border-top: 1px solid var(--rule);
  padding: 0.35rem 0.55rem;
  text-align: left;
}
.figure-table th {
  font-weight: 500;
  color: var(--ink);
  background: rgba(184, 64, 11, 0.04);
}
.figure-table tbody tr:last-child td { border-bottom: 1px solid var(--rule); }

/* ── Callout (asides — never coloured) ── */
.callout {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
}
.callout .callout-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.55rem;
}
.callout p {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 0.6rem;
}
.callout p:last-child { margin-bottom: 0; }
.callout p strong { color: var(--ink); font-weight: 500; }

/* ── Footnotes (P6-style on-hover card) ── */
.fn {
  position: relative;
  display: inline;
  cursor: help;
}
.fn-ref {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.62rem;
  vertical-align: super;
  color: var(--accent);
  text-decoration: none;
  padding: 0 0.05rem;
  border-bottom: 0;
}
.fn-ref:hover, .fn-ref:focus-visible { color: var(--accent-deep); }
.fn-card {
  position: absolute;
  bottom: 130%;
  left: 0;
  transform: translateY(2px);
  width: min(20rem, 80vw);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: var(--shadow-md);
  padding: 0.85rem 1rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--ink-soft);
  letter-spacing: 0.005em;
  text-transform: none;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
  transition: opacity var(--dur-settle) var(--ease-primary), transform var(--dur-settle) var(--ease-primary);
}
.fn:hover .fn-card,
.fn:focus-within .fn-card {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.fn-card a { font-family: "Fraunces", serif; }
@media (max-width: 600px) {
  .fn-card {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    width: auto;
    transform: none;
  }
}

/* ── Endnotes block (full text at foot of post) ── */
.endnotes {
  margin: 4rem 0 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
.endnotes h2 {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.endnotes ol {
  list-style: none;
  padding: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink-soft);
  counter-reset: en;
}
.endnotes li {
  counter-increment: en;
  padding: 0.55rem 0 0.55rem 2.25rem;
  position: relative;
  border-top: 1px solid var(--rule);
}
.endnotes li:last-child { border-bottom: 1px solid var(--rule); }
.endnotes li::before {
  content: counter(en);
  position: absolute;
  left: 0;
  top: 0.55rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  color: var(--accent);
  width: 1.6rem;
}
.endnotes a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(184,64,11,0.35); }

/* ── Topic tag (small monospace pill) ── */
.topic-tag {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  padding: 0.2rem 0.55rem;
  border: 1px solid rgba(184, 64, 11, 0.35);
  border-radius: 999px;
  margin-right: 0.35rem;
  text-decoration: none;
  background: var(--bg);
}

/* ── Post head + foot ── */
.post-head {
  padding: 7rem 0 1.5rem;
  border-bottom: 1px solid var(--rule);
}
.post-head .crumbs { color: var(--muted); margin-bottom: 1.5rem; }
.post-head h1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 300;
  font-size: clamp(2.2rem, 4.8vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 1rem;
  font-variation-settings: "opsz" 144;
  max-width: 22ch;
  text-wrap: pretty;
}
.post-head h1 em { font-weight: 300; font-style: italic; color: var(--accent); }
.post-head .subtitle {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin-bottom: 1rem;
  max-width: 38rem;
  text-wrap: pretty;
}
.post-foot {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
.post-foot .nav-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}
.post-foot .nav-row a {
  display: block;
  padding: 1rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  color: inherit;
  text-decoration: none;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: border-color var(--dur-hover) var(--ease-primary), background var(--dur-hover) var(--ease-primary);
}
.post-foot .nav-row a:hover { border-color: var(--ink); background: var(--bg); }
.post-foot .nav-row .label { color: var(--muted); display: block; margin-bottom: 0.25rem; font-size: 0.6rem; }
.post-foot .nav-row .title { color: var(--ink); font-family: "Fraunces", serif; font-size: 0.95rem; text-transform: none; letter-spacing: 0; }
@media (max-width: 600px) { .post-foot .nav-row { grid-template-columns: 1fr; } }

/* ── Reduced-motion: footnote cards become click-to-toggle. The
   :focus-within rule above already keeps them keyboard-accessible. */
@media (prefers-reduced-motion: reduce) {
  .fn-card { transition: none; }
}
