/* =========================================================================
   MXX — base layer
   Design tokens, reset, typography, layout primitives, navigation, footer.
   No effects that run continuously: no gradients-in-motion, no filters,
   no shadows that force repaints. Everything here is static paint.
   ========================================================================= */

/* ---------- Fonts (self-hosted, latin subset, ~136 KB total) ------------- */
@font-face {
  font-family: "Inter Tight";
  src: url("../fonts/intertight-var-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2074, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-var-latin.woff2") format("woff2");
  font-weight: 300 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2074, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/instrumentserif-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/instrumentserif-italic-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ---------- Tokens ------------------------------------------------------- */
:root {
  /* Colour — two grounds (paper / ink) and a single accent taken from the
     MXX monogram. Nothing else. */
  --paper: #f3f1ec;
  --paper-2: #e9e6e0;
  --ink: #101012;
  --ink-2: #1a1a1d;
  --accent: #c2a06a;

  /* Per-section theming: every section sets --bg/--fg, children inherit. */
  --bg: var(--paper);
  --fg: var(--ink);
  --fg-mute: color-mix(in srgb, var(--fg) 55%, transparent);
  --fg-faint: color-mix(in srgb, var(--fg) 16%, transparent);
  --rule: color-mix(in srgb, var(--fg) 18%, transparent);

  /* Type */
  --font-display: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-text: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;

  --t-display: clamp(2.75rem, 10.5vw, 9.5rem);
  --t-h1: clamp(2.25rem, 7vw, 5.5rem);
  --t-h2: clamp(1.75rem, 4.2vw, 3.25rem);
  --t-lead: clamp(1.125rem, 2.2vw, 1.85rem);
  --t-body: clamp(0.95rem, 1.05vw, 1.0625rem);
  --t-meta: 0.6875rem;

  /* Space */
  --gutter: clamp(1.25rem, 5vw, 5.5rem);
  --gap: clamp(1rem, 2.5vw, 2.5rem);
  --nav-h: 4.5rem;

  /* Motion — the whole system reads from these four lines. */
  --e-out: cubic-bezier(0.16, 1, 0.3, 1);       /* quiet, decisive settle */
  --e-inout: cubic-bezier(0.65, 0, 0.35, 1);
  --d-fast: 0.5s;
  --d-base: 0.7s;
  --d-slow: 0.9s;
  --stagger: 70ms;
  --rise: 26px;
}

/* ---------- Reset -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-text);
  font-size: var(--t-body);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color var(--d-base) var(--e-inout),
              color var(--d-base) var(--e-inout);
}

img, picture, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; }
ul, ol { list-style: none; }

a {
  color: inherit;
  text-decoration: none;
}

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

::selection { background: var(--accent); color: var(--ink); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--ink);
  color: var(--paper);
  padding: 0.75rem 1.25rem;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Theme sections ---------------------------------------------- */
/* --fg-mute & friends must be re-declared wherever --fg changes: a custom
   property's var() references are resolved at its declaration site, so the
   :root copies would otherwise stay ink-coloured on a dark section. */
.theme-ink {
  --bg: var(--ink);
  --fg: var(--paper);
  --fg-mute: color-mix(in srgb, var(--paper) 58%, transparent);
  --fg-faint: color-mix(in srgb, var(--paper) 18%, transparent);
  --rule: color-mix(in srgb, var(--paper) 22%, transparent);
  background: var(--bg);
  color: var(--fg);
}
.theme-paper {
  --bg: var(--paper);
  --fg: var(--ink);
  --fg-mute: color-mix(in srgb, var(--ink) 55%, transparent);
  --fg-faint: color-mix(in srgb, var(--ink) 16%, transparent);
  --rule: color-mix(in srgb, var(--ink) 18%, transparent);
  background: var(--bg);
  color: var(--fg);
}

/* ---------- Typography --------------------------------------------------- */
.display,
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 0.94;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.display {
  font-size: var(--t-display);
  letter-spacing: -0.045em;
  line-height: 0.88;
}
.h1 { font-size: var(--t-h1); }
.h2 { font-size: var(--t-h2); }

.serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.lead {
  font-size: var(--t-lead);
  line-height: 1.35;
  letter-spacing: -0.015em;
  text-wrap: pretty;
}

.meta {
  font-family: var(--font-text);
  font-size: var(--t-meta);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-mute);
  line-height: 1.4;
}

.prose p + p { margin-top: 1.1em; }
.prose { max-width: 62ch; color: var(--fg-mute); }
.prose strong { color: var(--fg); font-weight: 500; }

.rule {
  height: 1px;
  background: var(--rule);
  transform-origin: left center;
}

/* Inline link with a rule that grows on hover — transform only, no layout. */
.link {
  position: relative;
  display: inline-block;
  padding-bottom: 2px;
}
.link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(var(--sx, 1));
  transform-origin: right center;
  transition: transform var(--d-fast) var(--e-out);
}
.link:hover::after,
.link:focus-visible::after { --sx: 0; }
.link--reveal::after { --sx: 0; transform-origin: left center; }
.link--reveal:hover::after,
.link--reveal:focus-visible::after { --sx: 1; }

/* ---------- Layout ------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: 100rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gap);
}
@media (max-width: 860px) {
  .grid { grid-template-columns: repeat(6, 1fr); }
}

/* Column placements. These exist as classes rather than inline styles so the
   12-column values can collapse on the 6-column mobile grid — an inline
   `grid-column: 9 / span 4` would otherwise spill into implicit tracks and
   push the page sideways. */
.col-main   { grid-column: 1 / span 7; }
.col-wide   { grid-column: 1 / span 8; }
.col-half   { grid-column: 1 / span 6; }
.col-title  { grid-column: 1 / span 4; }
.col-side   { grid-column: 9 / span 4; }
.col-end    { grid-column: 10 / span 3; }
.col-list   { grid-column: 6 / span 6; }
.col-nav    { grid-column: 9 / span 2; }
.col-links  { grid-column: 11 / span 2; }

@media (max-width: 860px) {
  .col-main, .col-wide, .col-half, .col-title,
  .col-side, .col-end, .col-list { grid-column: 1 / -1; }
  .col-nav   { grid-column: 1 / span 3; }
  .col-links { grid-column: 4 / span 3; }
}

/* Two-column rows must be allowed to stack rather than run off the edge. */
.list-rows li,
.series__facts li,
.board__list li,
.stat { flex-wrap: wrap; }

/* ---------- Media -------------------------------------------------------- */
/* Every figure carries its own aspect-ratio + placeholder colour so the page
   never reflows while an image decodes. */
.media {
  position: relative;
  overflow: hidden;
  background: var(--media-bg, var(--paper-2));
  aspect-ratio: var(--ar, 3 / 2);
}
.media picture { display: block; width: 100%; height: 100%; }
.media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--pos, center);
}
figure { margin: 0; }
figcaption {
  margin-top: 0.85rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

/* ---------- Header / navigation ------------------------------------------ */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;   /* above .menu — the Close button has to stay clickable */
  height: var(--nav-h);
  display: flex;
  align-items: center;
  /* Colour is driven by the section currently on screen. */
  color: var(--nav-fg, var(--ink));
  transition: color var(--d-fast) var(--e-inout);
  pointer-events: none;
}
.site-header > .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-header a, .site-header button { pointer-events: auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.brand__name { letter-spacing: 0.22em; text-transform: uppercase; font-size: 0.72rem; }

.nav {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 2.5vw, 2.5rem);
}
.nav a {
  font-size: var(--t-meta);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.6;
  transition: opacity var(--d-fast) var(--e-out);
}
.nav a:hover,
.nav a:focus-visible { opacity: 1; }
.nav a[aria-current="page"] { opacity: 1; }
.nav a[aria-current="page"]::before {
  content: "";
  display: inline-block;
  width: 4px; height: 4px;
  margin-right: 0.5rem;
  vertical-align: 0.2em;
  background: var(--accent);
  border-radius: 50%;
}

/* Mobile menu */
.nav-toggle {
  display: none;
  background: none;
  border: 0;
  cursor: pointer;
  font-size: var(--t-meta);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.5rem 0;
}
/* While the overlay is open the header sits on top of it, so it has to be
   inverted to stay visible. */
.menu-open .site-header { color: var(--paper); }

.menu {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: var(--ink);
  color: var(--paper);
  /* the overlay is its own dark scope — without these the muted text in the
     footer would inherit the ink-on-ink values from :root */
  --fg: var(--paper);
  --fg-mute: color-mix(in srgb, var(--paper) 58%, transparent);
  --rule: color-mix(in srgb, var(--paper) 22%, transparent);
  display: flex;
  flex-direction: column;
  padding: calc(var(--nav-h) + 1.5rem) var(--gutter) calc(var(--gutter) + 1rem);
  /* Off-canvas by transform only — no width/height animation. */
  transform: translateY(-100%);
  transition: transform var(--d-base) var(--e-inout), visibility 0s linear var(--d-base);
  visibility: hidden;
}
.menu.is-open {
  transform: translateY(0);
  visibility: visible;
  transition: transform var(--d-base) var(--e-inout), visibility 0s;
}
.menu ol { display: grid; gap: 0.25rem; }
/* Display type is for the nav list only — the footer links stay small. */
.menu ol a {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 12vw, 4rem);
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.menu a {
  display: block;
  opacity: 0;
  transform: translateY(var(--rise));
  transition: opacity var(--d-base) var(--e-out), transform var(--d-base) var(--e-out);
  transition-delay: calc(var(--i, 0) * 60ms);
}
.menu.is-open a { opacity: 1; transform: none; }
.menu__foot { margin-top: auto; padding-top: 2rem; }
.menu__foot a { display: inline-block; }   /* keep the rule under the text only */

@media (max-width: 760px) {
  .nav { display: none; }
  .nav-toggle { display: block; }
}

/* ---------- Footer ------------------------------------------------------- */
.site-footer {
  padding: clamp(3rem, 8vw, 7rem) 0 2rem;
  border-top: 1px solid var(--rule);
  margin-top: clamp(4rem, 10vw, 9rem);
}
.site-footer .grid { align-items: end; row-gap: 2.5rem; }
.footer-links { display: grid; gap: 0.35rem; }
.colophon {
  margin-top: clamp(3rem, 6vw, 5rem);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
}

/* ---------- Page shell (inner pages) ------------------------------------- */
.page-head {
  padding-top: calc(var(--nav-h) + clamp(3rem, 12vh, 9rem));
  padding-bottom: clamp(2.5rem, 7vw, 5.5rem);
}
.section { padding-block: clamp(3.5rem, 9vw, 8rem); }
.section--tight { padding-block: clamp(2.5rem, 5vw, 4.5rem); }
