/* ============================================================
   AFFECTION RESEARCH LAB — CSS System
   - Layout: shell + measure
   - Type: Instrument Sans (structure) + Source Serif 4 (reading)
   - Motion: reveal.js (class toggled by JS)
   - Themes: data-theme="light|dark" + system fallback
   ============================================================ */

/* ============================================================
   0) Design Tokens
   ============================================================ */

:root {
  /* color-scheme hint (allows UA form controls to match) */
  color-scheme: light dark;

  /* Palette */
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f1f0ec;
  --border: #e6e2da;

  --text: #101214;
  --muted: #5a616a;

  --accent: #7a1f1f;
  --accent-2: #5e1717;
  --warn: #b45309;

  /* Focus (you referenced var(--focus) but it wasn’t defined) */
  --focus: color-mix(in oklab, var(--accent) 55%, transparent);

  /* Typography */
  --font-sans:
    "Instrument Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial,
    sans-serif;
  --font-serif: "Source Serif 4", Georgia, serif;
  --font-mono:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;

  /* Type scale */
  --text-xs: 0.85rem;
  --text-sm: 0.925rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: clamp(1.75rem, 2.6vw, 2.4rem);
  --text-3xl: clamp(2.1rem, 3.6vw, 3.25rem);

  /* Layout */
  --shell: 1180px;
  --measure: 72ch;
  --radius: 14px;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  /* Motion */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-soft: cubic-bezier(0.25, 0.1, 0.25, 1);
  --dur-fast: 120ms;
  --dur-med: 240ms;
  --dur-slow: 520ms;

  /* Shadows */
  --shadow-1:
    0 1px 0 rgba(16, 18, 20, 0.04), 0 10px 30px rgba(16, 18, 20, 0.06);
  --shadow-2: 0 1px 0 rgba(16, 18, 20, 0.06), 0 18px 50px rgba(16, 18, 20, 0.1);
}

/* System preference fallback (only when no explicit data-theme set) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0b0d10;
    --surface: #0f1318;
    --surface-2: #121823;
    --border: #1e2632;

    --text: #eef1f6;
    --muted: #a5aebb;

    --accent: #7aa2ff;
    --accent-2: #38bdf8;

    --shadow-1: 0 1px 0 rgba(0, 0, 0, 0.35), 0 18px 50px rgba(0, 0, 0, 0.55);
    --shadow-2: 0 1px 0 rgba(0, 0, 0, 0.5), 0 24px 80px rgba(0, 0, 0, 0.65);
  }
}

:root {
  --header-offset: 6rem;
}
@media (max-width: 720px) {
  :root {
    --header-offset: 7rem;
  }
}

.archive-issue {
  scroll-margin-top: var(--header-offset);
}

/* Explicit themes */
:root[data-theme="light"] {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f1f0ec;
  --border: #e6e2da;
  --text: #101214;
  --muted: #5a616a;
  --accent: #2f6bff;
  --accent-2: #0ea5e9;
}

:root[data-theme="dark"] {
  --bg: #0b0d10;
  --surface: #0f1318;
  --surface-2: #121823;

  /* softer text */
  --text: color-mix(in oklab, white 86%, #9aa3b2);
  --muted: color-mix(in oklab, white 62%, #8792a6);

  --border: #1e2632;
  --accent: #7aa2ff;
  --accent-2: #38bdf8;

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   1) Base / Reset-ish
   ============================================================ */

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

html {
  font-size: clamp(16px, 1.1vw + 14px, 18px);
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

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

::selection {
  background: color-mix(in oklab, var(--accent) 35%, transparent);
}

/* Global links (good default). In prose we’ll keep underline too. */
a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in oklab, var(--text) 40%, transparent);
  transition:
    border-color var(--dur-fast) linear,
    color var(--dur-fast) linear,
    opacity var(--dur-fast) linear;
}

a:hover {
  color: color-mix(in oklab, var(--accent) 100%, var(--text));
  border-bottom-color: color-mix(in oklab, var(--accent) 75%, transparent);
}

a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-bottom-color: transparent;
}

/* ============================================================
   2) Layout Primitives
   ============================================================ */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding-inline: clamp(1rem, 4vw, var(--space-6));
}

.main {
  padding: var(--space-7) 0 var(--space-8);
}

/* Reading measure container */
.measure {
  max-width: var(--measure);
}

/* Legacy alias (safe to remove later if unused) */
.wrap {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
}

/* Simple utilities */
.stack > * + * {
  margin-top: var(--space-5);
}
.grid {
  display: grid;
  gap: var(--space-6);
}

/* ============================================================
   3) Header / Nav
   ============================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

/* Top row: brand + controls */
.header-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-4);
  align-items: start;
  padding: var(--space-6) 0 var(--space-3);
}

.header-controls {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  justify-self: end;
  margin-top: 0.15rem;
}

/* Brand */
.site-title {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 800;
}
.site-title a {
  color: var(--text);
  text-decoration: none;
  border-bottom: none;
}
.site-title a:hover {
  border-bottom: 1px solid color-mix(in oklab, var(--text) 40%, transparent);
}

.site-tagline {
  margin: 0;
  max-width: 48ch;
  font-size: var(--text-base);
  line-height: 1.4;
  color: var(--muted);
}

@media (max-width: 640px) {
  .site-tagline {
    display: none;
  }
}

/* Nav */
.site-nav {
  display: flex;
  align-items: baseline;
  padding: var(--space-2) 0 var(--space-6);
}

.site-nav ul {
  list-style: none;
  display: flex;
  gap: var(--space-5);
  margin: 0;
  padding: 0;
}

/* Nav links: typographic rule (your requested style) */
.site-nav a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in oklab, var(--text) 40%, transparent);
  transition:
    border-color var(--dur-fast) linear,
    color var(--dur-fast) linear;
}

.site-nav a:hover {
  color: color-mix(in oklab, var(--accent) 100%, var(--text));
  border-bottom-color: color-mix(in oklab, var(--accent) 75%, transparent);
}

.site-nav a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.site-nav a[aria-current="page"] {
  color: color-mix(in oklab, var(--accent) 72%, var(--text));
  border-bottom-color: var(--text);
}

/* Mobile: stack header rows */
@media (max-width: 720px) {
  .header-top {
    grid-template-columns: 1fr;
  }
  .header-controls {
    justify-self: start;
  }
  .site-nav ul {
    flex-wrap: wrap;
    gap: var(--space-4);
  }
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  position: fixed;
  left: var(--space-5);
  top: var(--space-5);
  width: auto;
  height: auto;
  padding: 0.6rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  z-index: 100;
}

/* ============================================================
   4) Typography (global)
   ============================================================ */

h1,
h2,
h3,
h4 {
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
}

h1 {
  font-size: var(--text-3xl);
}
h2 {
  font-size: var(--text-2xl);
  margin-top: var(--space-7);
  margin-bottom: var(--space-4);
}
h3 {
  font-size: var(--text-xl);
  margin-top: var(--space-6);
}
h4 {
  font-size: var(--text-lg);
  margin-top: var(--space-5);
}

p {
  margin: 1.5rem 0;
}

.lede {
  font-size: var(--text-xl);
  color: color-mix(in oklab, var(--text) 86%, var(--muted));
}

.kicker {
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 var(--space-2);
}

.meta {
  padding-top: var(--space-7);
  font-size: var(--text-xs);
  color: var(--muted);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-7) 0;
}

code,
pre {
  font-family: var(--font-mono);
  font-size: 0.95em;
}

pre {
  padding: var(--space-4);
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow-x: auto;
}

blockquote {
  margin: var(--space-6) 0;
  padding: var(--space-4) var(--space-5);
  border-left: 3px solid color-mix(in oklab, var(--accent) 60%, var(--border));
  background: color-mix(in oklab, var(--surface) 92%, var(--accent) 8%);
  border-radius: 12px;
}

/* ============================================================
   5) Prose (longform reading)
   ============================================================ */

.prose {
  font-family: var(--font-serif);
  font-size: 1.06rem;
  line-height: 1.75;
  hyphens: none;
  text-wrap: pretty;
  overflow-wrap: anywhere; /* prevents layout breaks from long tokens */
  word-break: normal;
}

.prose p {
  margin: 1.2rem 0;
}

/* Structural headings inside prose */
.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.prose a {
  text-decoration-thickness: from-font;
  text-underline-offset: 0.14em;
}

/* ============================================================
   6) Essay Layout (measure + rail)
   ============================================================ */

.essay-head {
  margin-bottom: var(--space-7);
}

.essay-grid {
  display: grid;
  gap: var(--space-7);
}

@media (min-width: 980px) {
  .essay-grid {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
    align-items: start;
  }
}

.rail {
  border-left: 1px solid var(--border);
  padding-left: var(--space-5);
  color: var(--muted);
  font-size: var(--text-sm);
  margin-top: 1.57rem;
}

.rail-title {
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 var(--space-3);
}

.rail-notes p {
  display: inline;
  margin: 0;
}

.rail-references,
.rail-notes,
.rail-related {
  list-style: none;
  padding-inline-start: 0px;
  align-items: baseline;
  gap: 0.35em;
  margin-bottom: var(--space-7);
}

.rail-notes li,
.rail-references li,
.rail-related li {
  margin-bottom: 1rem;
}

.fn-num {
  font-variant-numeric: tabular-nums;
}

.fn-back {
  text-decoration: none;
  opacity: 0.6;
}

.fn-back:hover {
  opacity: 1;
}

/* ============================================================
   7) Issue Archive / TOC (Swiss list)
   ============================================================ */

.issue-block {
  margin-top: var(--space-7);
  border-top: 1px solid var(--border);
  padding-top: var(--space-6);
}

.issue-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.issue-title {
  font-size: var(--text-lg);
  margin: 0;
  letter-spacing: -0.01em;
}

.issue-meta {
  font-size: var(--text-xs);
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.issue-toc {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.issue-item {
  border-bottom: 1px solid var(--border);
}

.issue-link {
  display: grid;
  grid-template-columns: 3.5ch 1fr auto;
  gap: var(--space-5);
  padding: var(--space-5) 0;
  text-decoration: none;
  color: inherit;
  align-items: start;
}

.issue-link:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.issue-num {
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xs);
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.issue-main {
  max-width: var(--measure);
}

.issue-titleline {
  display: block;
  font-size: var(--text-lg);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.issue-desc {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: var(--text-base);
  line-height: 1.5;
}

.issue-link time {
  font-size: var(--text-xs);
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-top: 0.2rem;
}

@media (prefers-reduced-motion: no-preference) {
  .issue-link {
    transition: transform 150ms ease;
  }
  .issue-link:hover {
    transform: translateX(3px);
  }
}

@media (max-width: 780px) {
  .issue-link {
    grid-template-columns: 3.5ch 1fr;
  }
  .issue-link time {
    display: block;
    margin-top: var(--space-2);
  }
}

.frontispiece {
  margin: 0 0 var(--space-6);
  border-top: 1px solid var(--border);
  padding-top: var(--space-5);
}

.frontispiece img {
  width: 100%;
  height: auto;
  border: none;
  border-radius: 0;
  background: var(--surface-2);
}

.frontispiece-cap {
  margin-top: var(--space-3);
  display: flex;
  gap: var(--space-4);
  align-items: baseline;
  color: var(--muted);
  font-size: var(--text-xs);
  gap: 0.35rem;
  font-style: italic;
}

.frontispiece-label {
  letter-spacing: 0.02em; /* slightly calmer than kicker */
  text-transform: none; /* optional: feels more bookish */
}

.frontispiece-caption {
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--muted);
  max-width: 56ch;
}

/* ============================================================
   8) Citations / Footnotes / References
   ============================================================ */

.cite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4em;
  height: 1.4em;
  padding: 0 0.35em;
  margin: 0 0.08em;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface) 92%, var(--accent) 8%);
  color: color-mix(in oklab, var(--text) 85%, var(--accent));
  font-size: 0.78em;
  line-height: 1;
  vertical-align: super;
  border-bottom: none;
  transition:
    transform var(--dur-fast) var(--ease-standard),
    background var(--dur-fast) linear,
    border-color var(--dur-fast) linear;
}

.cite:hover {
  transform: translateY(-1px);
  border-color: color-mix(in oklab, var(--accent) 35%, var(--border));
}

.cite:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.footnotes {
  margin-top: var(--space-7);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
}

.footnotes h2 {
  font-size: var(--text-lg);
  margin-top: 0;
}

.footnotes ol {
  margin: var(--space-4) 0 0;
  padding-left: 1.25rem;
}

.footnotes li {
  margin: 0 0 var(--space-3);
  color: color-mix(in oklab, var(--text) 90%, var(--muted));
}

.footnotes li p {
  display: inline;
}

.footnote-backref {
  margin-left: 0.5em;
  font-size: var(--text-xs);
  color: var(--muted);
  border-bottom-color: transparent;
}

.footnote-backref:hover {
  color: var(--accent);
}

.refs {
  margin-top: var(--space-7);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
}

.refs h2 {
  font-size: var(--text-lg);
  margin-top: 0;
}

.refs ul {
  list-style: none;
  margin: var(--space-4) 0 0;
  padding: 0;
}

.refs li {
  padding-left: 1.25rem;
  text-indent: -1.25rem;
  margin-bottom: var(--space-3);
  color: color-mix(in oklab, var(--text) 92%, var(--muted));
}

:target {
  scroll-margin-top: var(--header-offset);
  background: color-mix(in oklab, var(--accent) 10%, transparent);
  border-radius: 10px;
  padding: 0.1rem 0.25rem;
}

/* ============================================================
   9) Toggles
   ============================================================ */

.theme-toggle__icon::before {
  content: "◐";
}
:root[data-theme="dark"] .theme-toggle__icon::before {
  content: "◑";
}

.theme-toggle {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition:
    background var(--dur-fast) linear,
    border-color var(--dur-fast) linear,
    transform var(--dur-fast) var(--ease-standard);
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: color-mix(in oklab, var(--accent) 35%, var(--border));
}

.theme-toggle:active {
  transform: translateY(0);
}

.theme-toggle:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.theme-toggle__icon {
  font-size: 0.9rem;
  line-height: 1;
  opacity: 0.85;
}

@media (max-width: 480px) {
  .theme-toggle {
    width: 2.5rem;
    height: 2.5rem;
  }
}

/* ============================================================
   10) Motion Layer (Scroll Reveals)
   ============================================================ */

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  filter: blur(2px);
  transition:
    opacity var(--dur-slow) var(--ease-soft),
    transform var(--dur-slow) var(--ease-soft),
    filter var(--dur-slow) var(--ease-soft);
  will-change: opacity, transform, filter;
}

.js .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* No-JS: normal content */
.reveal {
  opacity: 1;
  transform: none;
  filter: none;
  transition-delay: var(--d, 0ms);
}

.reveal--fade {
  transform: none;
}
.reveal--rise {
  transform: translateY(18px);
}
.reveal--pop {
  transform: translateY(14px) scale(0.985);
}
.reveal--pop.is-visible {
  transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal.is-visible {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    transition: none !important;
  }

  * {
    scroll-behavior: auto !important;
  }
}

:root {
  --measure: 72ch; /* (already set above, repeated here only if you want to bump it) */
}

/* Essays/prose keep the bookish refinement without a mode toggle */
.prose {
  /* You already set these above; this block is a safe "anchor" */
  font-family: var(--font-serif);
  font-size: 1.06rem;
  line-height: 1.75;
}

/* Optional: slightly calmer global rhythm (this used to be in reading mode) */
body {
  line-height: 1.65; /* keep as-is; if you want closer to reading mode use 1.72–1.78 */
}

/* Optional: keep your lede sizing improvement without needing data-mode */
.lede {
  font-size: clamp(1.1rem, 1.4vw, 1.25rem);
}

/* ============================================================
   12) Footer
   ============================================================ */

.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-6) 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

/* ===== Archive A: Index + Issue Blocks ===== */

.archive-index {
  margin-top: var(--space-6);
  border-top: 1px solid var(--border);
  padding-top: var(--space-5);
}

.archive-index__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  border-top: 1px solid var(--border);
}

.archive-index__item {
  border-bottom: 1px solid var(--border);
}

.archive-index__link {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-5);
  padding: var(--space-4) 0;
  border-bottom: none;
  align-items: baseline;
}

.archive-index__num {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: var(--text-xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.archive-index__label {
  font-size: var(--text-sm);
}

.archive-index__count {
  font-size: var(--text-xs);
  color: var(--muted);
  white-space: nowrap;
}

@media (prefers-reduced-motion: no-preference) {
  .archive-index__link {
    transition: transform 140ms ease;
  }
  .archive-index__link:hover {
    transform: translateX(3px);
  }
}

.archive-issue {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
  scroll-margin-top: 6rem; /* for anchored jumps with sticky header */
  position: relative;
}

.archive-issue__head {
  display: grid;
  gap: var(--space-6);
}

@media (min-width: 920px) {
  .archive-issue__head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 650px);
    justify-content: space-between; /* pushes columns to edges */
    align-items: start;
    column-gap: var(--space-6);
  }

  .archive-issue__frontispiece img {
    width: 100%;
    display: block;
  }

  /* Archive frontispiece — enforce 16:9 crop */
  .archive-issue__frontispiece {
    justify-self: end; /* snap to right edge of the grid/section */
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--surface-2);
    border: 0;
  }

  /* Ensure the image fills and crops */
  .archive-issue__frontispiece img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .archive-issue__frontispiece {
    margin-right: 0;
  }
}

.archive-issue__title {
  margin: 0;
  font-size: var(--text-2xl);
}

.archive-issue__caption {
  margin: var(--space-3) 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.55;
  max-width: 62ch;
}

.archive-issue__frontispiece img {
  border-radius: 0;
  border: none;
  background: var(--surface-2);
}

.archive-issue__backtotop {
  margin-top: var(--space-5);
  font-size: var(--text-sm);
  color: var(--muted);
}

/* ============================================================
   Mobile polish / responsive hardening
   Paste near the end of your file
   ============================================================ */

/* Prevent long tokens from blowing up layouts */
.prose {
  overflow-wrap: anywhere;
}

/* Small screens: slightly tighter main padding */
@media (max-width: 480px) {
  .main {
    padding: var(--space-6) 0 var(--space-7);
  }

  /* Optional: stricter touch target */
  .theme-toggle {
    width: 2.5rem;
    height: 2.5rem;
  }
}

/* Fix archive frontispiece aspect ratio: pick ONE */
@media (min-width: 920px) {
  .archive-issue__frontispiece {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--surface-2);
    border: 0;
  }
  .archive-issue__frontispiece img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

/* Adjust selector to your actual header element/class */
.site-header {
  position: sticky; /* or fixed */
  top: 0;
  z-index: 1000;
  transition: transform 220ms ease;
  will-change: transform;
}

/* Hidden state */
.site-header.is-hidden {
  transform: translateY(-110%);
}

@media (prefers-reduced-motion: reduce) {
  .site-header {
    transition: none;
  }
}
