/* ============================================================
   Open Edge — ESP
   Minimal editorial system: black serif on white, mono meta,
   hairline rules, one restrained accent. Inspired by europe2031.ai
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-2: #fafafa;
  --fg: #16130f;
  --muted: #605a52;
  --faint: #8b857c;
  --rule: #e5e2dc;
  --rule-strong: #cbc7bf;
  --accent: #0b6b43;        /* muted forest — ESP green, restrained */
  --accent-ink: #095c39;
  --sel: #d9f0e3;

  --serif: "Iowan Old Style", "Charter", "Sorts Mill Goudy", Georgia, "Times New Roman", Times, serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --maxw: 1280px;
  --pad: clamp(22px, 5vw, 88px);
  --measure: 64ch;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

[data-theme="dark"] {
  --bg: #0e0d0c;
  --bg-2: #141312;
  --fg: #ece9e3;
  --muted: #a7a199;
  --faint: #7c766d;
  --rule: #272522;
  --rule-strong: #3a3733;
  --accent: #5fd39a;
  --accent-ink: #7ee0ad;
  --sel: #10362a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
  overflow-x: hidden;
  transition: background .4s var(--ease), color .4s var(--ease);
}

::selection { background: var(--sel); }

h1, h2, h3 { font-weight: 600; line-height: 1.05; letter-spacing: -.015em; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
em, i { font-style: italic; }
strong { font-weight: 600; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad); }

.skip-link { position: absolute; left: -999px; top: 0; z-index: 200; background: var(--fg); color: var(--bg); padding: 10px 16px; }
.skip-link:focus { left: 0; }

/* ---- meta / eyebrow / labels ---- */
.meta {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
}
.meta--accent { color: var(--accent); }

.accent { color: var(--accent); }

/* ============================ NAV ============================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  transition: background .3s var(--ease), border-color .3s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-stuck { background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(120%) blur(8px); border-bottom-color: var(--rule); }
.nav__inner { display: flex; align-items: center; gap: 28px; height: 60px; }

.brand { display: inline-flex; align-items: baseline; gap: 8px; font-family: var(--mono); font-size: .82rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; }
.brand__mark { align-self: center; flex: none; }
.footer__mark { display: inline-block; vertical-align: -3px; margin-right: 8px; }
.brand b { font-weight: 600; }
.brand__dim { color: var(--accent); margin-left: 4px; }

.nav__links { display: flex; gap: 26px; margin-left: auto; }
.nav__links a {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); padding: 6px 0; position: relative; transition: color .2s var(--ease);
}
.nav__links a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px; background: var(--fg); transition: right .25s var(--ease); }
.nav__links a:hover { color: var(--fg); }
.nav__links a:hover::after { right: 0; }

.theme-toggle {
  background: none; border: none; cursor: pointer; color: var(--muted);
  width: 30px; height: 30px; display: grid; place-items: center; padding: 0;
  border-radius: 50%; transition: color .2s var(--ease), background .2s var(--ease);
}
.theme-toggle:hover { color: var(--fg); }
.theme-toggle .moon { display: block; }
.theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }

/* ============================ HERO ============================ */
.hero { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; position: relative; padding-top: 96px; padding-bottom: 96px; }
.hero__inner { position: relative; z-index: 2; max-width: min(88vw, 780px); }
.hero__eyebrow { margin-bottom: 24px; }
.hero__title { font-size: clamp(3rem, 7vw, 5.4rem); font-weight: 600; letter-spacing: -.03em; max-width: 9ch; }
.hero__sub { margin-top: 22px; font-size: clamp(1.25rem, 2.6vw, 1.8rem); font-weight: 400; color: var(--fg); max-width: 26ch; line-height: 1.2; }
.hero__byline { margin-top: 26px; font-style: italic; color: var(--muted); font-size: 1.1rem; max-width: 46ch; line-height: 1.5; }
.hero__foot { margin-top: 30px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.hero__date { color: var(--faint); }
.hero__powered { display: inline-flex; align-items: center; gap: 7px; }
.hero__powered .celestia-mark { color: var(--faint); }

/* hero illustration helpers (var() can't be used in SVG presentation attrs) */
.ha-faint { stroke: var(--faint); fill: none; }
.ha-rule { stroke: var(--rule-strong); fill: none; }
.ha-accent { stroke: var(--accent); fill: none; }
.ha-accent-fill { fill: var(--accent); stroke: none; }
.ha-odo { fill: var(--muted); font-family: var(--mono); font-size: 19px; letter-spacing: 5px; }
.ha-cap { fill: var(--faint); font-family: var(--mono); font-size: 10.5px; letter-spacing: 3px; }

/* ---- scroll-driven metering gauge (fixed; JS-positioned) ---- */
.gauge {
  position: fixed; z-index: 110; top: 24vh; right: 5vw;
  width: min(34vw, 430px); display: flex; flex-direction: column; align-items: center; gap: 12px;
  pointer-events: none; will-change: top, right, width;
}
.gauge__dial { width: 100%; }
.gauge__dial svg { width: 100%; height: auto; display: block; }
.gauge-track { stroke: var(--rule-strong); fill: none; }
.gauge-prog { stroke: var(--accent); fill: none; stroke-linecap: round; }
/* readout overlaid on the dial (position/size set by JS as it docks) */
.gauge__num {
  position: absolute; left: 50%; top: 64%; transform: translate(-50%, -50%);
  text-align: center; white-space: nowrap;
  font-family: var(--mono); color: var(--muted); letter-spacing: .22em;
  font-variant-numeric: tabular-nums; font-size: 18px; line-height: 1; padding-left: .22em;
}

.scrollcue { position: absolute; left: var(--pad); bottom: 20px; font-family: var(--mono); font-size: .62rem; letter-spacing: .3em; text-transform: uppercase; color: var(--faint); display: flex; align-items: center; gap: 10px; }
.scrollcue i { width: 34px; height: 1px; background: var(--rule-strong); display: inline-block; position: relative; overflow: hidden; }
.scrollcue i::after { content: ""; position: absolute; inset: 0; width: 12px; background: var(--accent); animation: cue 2.4s var(--ease) infinite; }
@keyframes cue { 0% { transform: translateX(-14px); } 100% { transform: translateX(40px); } }

/* ============================ SECTIONS ============================ */
.rule { border: none; border-top: 1px solid var(--rule); margin: 0; }
/* padding-block only: the horizontal padding comes from .wrap (a `padding:
   X 0` shorthand here would zero it out and pin sections to the viewport edge) */
.section { padding-block: clamp(70px, 11vh, 140px); }
.section__head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.section__label { margin-bottom: 30px; }
.section__title { font-size: clamp(1.9rem, 4.6vw, 3.4rem); font-weight: 600; max-width: 20ch; letter-spacing: -.02em; }
.section__lede { margin-top: 26px; font-size: clamp(1.15rem, 1.9vw, 1.45rem); color: var(--muted); max-width: var(--measure); line-height: 1.5; }
.section__lede strong, .prose strong { color: var(--fg); }

.prose { max-width: var(--measure); margin-top: 30px; color: var(--fg); }
.prose p + p { margin-top: 1.1em; }
.prose--muted { color: var(--muted); }

/* two-column editorial layout */
.split { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: clamp(30px, 6vw, 90px); align-items: start; }
.split--narrow { grid-template-columns: 1fr 1fr; }

/* numbered list of ideas (no cards) */
.items { margin-top: 8px; }
.item { display: grid; grid-template-columns: auto 1fr; gap: 22px; padding: 30px 0; border-top: 1px solid var(--rule); }
.item:first-child { border-top: 1px solid var(--rule-strong); }
.item__n { font-family: var(--mono); font-size: .78rem; color: var(--accent); letter-spacing: .08em; padding-top: 6px; }
.item__body h3 { font-size: 1.5rem; font-weight: 600; margin-bottom: 8px; max-width: 42ch; text-wrap: balance; }
.item__body p { color: var(--muted); max-width: var(--measure); }
.item__body p strong { color: var(--fg); }

/* inline lettered small heads */
.subgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 clamp(24px, 4vw, 56px); margin-top: 40px; }
.subgrid > div { padding: 26px 0; border-top: 1px solid var(--rule-strong); }
.subgrid h3 { font-size: 1.35rem; font-weight: 600; margin-bottom: 8px; }
.subgrid p { color: var(--muted); font-size: 1rem; }
.subgrid .meta { margin-bottom: 14px; }

/* ---- diagrams (minimal line art) ---- */
.figure { margin-top: 54px; }
.figure svg { width: 100%; height: auto; display: block; }
.figure__cap { margin-top: 18px; text-align: center; }
.dg-box { fill: none; stroke: var(--rule-strong); stroke-width: 1.25; }
.dg-box--accent { stroke: var(--accent); }
.dg-fill { fill: var(--bg-2); stroke: var(--rule-strong); stroke-width: 1.25; }
.dg-line { fill: none; stroke: var(--faint); stroke-width: 1.25; }
.dg-line--accent { stroke: var(--accent); stroke-width: 1.5; }
.dg-title { fill: var(--fg); font-family: var(--serif); font-size: 20px; font-weight: 600; }
.dg-mono { fill: var(--muted); font-family: var(--mono); font-size: 12px; letter-spacing: .04em; }
.dg-mono--accent { fill: var(--accent); }
.dg-mono--faint { fill: var(--faint); font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.dg-desc { fill: var(--muted); font-family: var(--serif); font-size: 14px; }

/* ---- ordered steps (use case) ---- */
.steps { list-style: none; margin: 40px 0 0; padding: 0; max-width: var(--measure); }
.steps li { display: grid; grid-template-columns: auto 1fr; gap: 22px; padding: 22px 0; border-top: 1px solid var(--rule); }
.steps li:first-child { border-top-color: var(--rule-strong); }
.steps .n { font-family: var(--mono); font-size: .8rem; color: var(--accent); padding-top: 4px; }
.steps b { font-weight: 600; display: block; font-size: 1.2rem; }
.steps span { color: var(--muted); }

.note { margin-top: 34px; max-width: var(--measure); padding-left: 22px; border-left: 2px solid var(--accent); }
.note b { font-weight: 600; }
.note span { color: var(--muted); display: block; margin-top: 4px; }

/* ---- principles ---- */
.principles { list-style: none; margin: 40px 0 0; padding: 0; columns: 2; column-gap: clamp(30px, 6vw, 80px); max-width: 1000px; }
.principles li { break-inside: avoid; padding: 18px 0; border-top: 1px solid var(--rule); }
.principles li:first-child, .principles li:nth-child(4) { border-top-color: var(--rule-strong); }
.principles b { font-weight: 600; }
.principles span { color: var(--muted); display: block; margin-top: 2px; font-size: 1rem; }

/* ---- act items + hover-driven in-depth pane ---- */
.itemsplit { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.itemsplit .item__body h3 { font-size: 1.3rem; }
.itemsplit .item__body p { font-size: .98rem; }
.itemsplit .item { cursor: pointer; scroll-margin-top: 84px; }
.item__more { display: inline-block; margin-top: 12px; font-family: var(--mono); font-size: .66rem; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); transition: color .2s var(--ease); }
.item__more::after { content: "→"; margin-left: 8px; display: inline-block; transition: transform .2s var(--ease); }
.itemsplit .item:hover .item__more::after { transform: translateX(5px); }
.itemsplit .item.is-active .item__more { color: var(--faint); }
.itemsplit .item.is-active .item__more::after { content: "· shown"; transform: none; }
.item__inline { display: none; } /* narrow-screen inline article (JS-filled) */
.detail { position: sticky; top: 92px; margin-top: 38px; border-left: 2px solid transparent; padding-left: clamp(18px, 2.5vw, 30px); }
.detail:has(.detail__pane.is-active) { border-left-color: var(--accent); }
.detail__pane { display: none; }
.detail__pane.is-active { display: block; animation: dfade .35s var(--ease); }
@keyframes dfade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.detail__pane > .meta { display: block; margin-bottom: 14px; }
.detail__prose { font-size: .98rem; line-height: 1.62; }
.detail__prose p + p { margin-top: .9em; }
@media (max-width: 900px) {
  .itemsplit { grid-template-columns: 1fr; }
  /* Single column: the side pane disappears entirely; tapping an item swaps
     its summary for the in-depth article in place (.item__inline, JS-filled),
     tapping again swaps back. */
  .detail { display: none; }
  .item__more { display: inline-block; } /* tap affordance */
  .item.is-open .item__more { display: none; }
  .item.is-open .item__body > p { display: none; }
  .item.is-open .item__inline { display: block; animation: dfade .35s var(--ease); }
  .item__inline > .meta { display: block; margin: 14px 0; }
  .item__close {
    display: inline-block; margin-top: 18px; font-family: var(--mono); font-size: .66rem;
    letter-spacing: .18em; text-transform: uppercase; color: var(--accent);
  }
}
@media (prefers-reduced-motion: reduce) { .detail__pane.is-active, .item.is-open .item__inline { animation: none; } }

/* ---- story arc strip (five acts) ---- */
.arc { list-style: none; margin: 48px 0 0; padding: 0; display: flex; flex-wrap: wrap; align-items: stretch; gap: 12px 0; }
.arc li { display: flex; align-items: center; }
.arc li:not(:last-child)::after { content: "→"; font-family: var(--mono); color: var(--accent); margin: 0 16px; }
.arc__step { display: block; border: 1px solid var(--rule-strong); padding: 16px 18px 14px; min-width: 168px; height: 100%; transition: border-color .2s var(--ease), background .2s var(--ease); }
a.arc__step:hover { border-color: var(--accent); background: var(--bg-2); }
.arc__step .meta { display: block; margin-bottom: 10px; }
.arc__step b { display: block; font-weight: 600; font-size: 1.12rem; margin-bottom: 4px; }
.arc__step span { color: var(--muted); font-size: .95rem; line-height: 1.45; display: block; max-width: 24ch; }
.arc__step--accent { border-color: var(--accent); }

/* arc strip docked at the bottom of the hero: the intro copy centers in the
   space above it; the strip compresses to one row on wide screens */
.hero__inner { margin-top: auto; }
.hero .arc { margin-top: auto; padding-top: 36px; }
@media (min-width: 901px) {
  .hero .arc li { flex: 1; min-width: 0; }
  .hero .arc li:not(:last-child)::after { margin: 0 12px; }
  .hero .arc .arc__step { flex: 1; min-width: 0; padding: 13px 14px 11px; }
  .hero .arc .arc__step b { font-size: 1rem; }
  .hero .arc .arc__step span { font-size: .84rem; max-width: none; }
  .hero .arc .arc__step .meta { margin-bottom: 6px; }
}
@media (max-width: 900px) {
  .arc { flex-direction: column; }
  .arc li { flex-direction: column; align-items: stretch; }
  .arc li:not(:last-child)::after { content: "↓"; margin: 10px 0; text-align: center; }
}

/* ---- act-to-act bridge line ---- */
.bridge { margin: clamp(56px, 9vh, 96px) auto 0; text-align: center; max-width: 46ch; font-style: italic; font-size: 1.18rem; color: var(--muted); }
.bridge::before { content: "↓"; display: block; font-style: normal; font-family: var(--mono); color: var(--accent); margin-bottom: 14px; }

/* ---- pull quote ---- */
.pull { text-align: center; padding: clamp(70px, 12vh, 150px) 0; }
.pull blockquote { margin: 0 auto; max-width: 24ch; font-size: clamp(1.8rem, 4.4vw, 3.2rem); font-weight: 400; line-height: 1.18; letter-spacing: -.02em; }
.pull .attr { margin-top: 28px; }

/* ---- CTA ---- */
.cta { text-align: center; padding: clamp(80px, 14vh, 170px) 0; }
.cta__title { font-size: clamp(2.2rem, 6vw, 4.4rem); font-weight: 600; letter-spacing: -.025em; }
.cta__lede { margin: 24px auto 0; max-width: 48ch; color: var(--muted); font-size: 1.2rem; }
.link-lg { display: inline-flex; align-items: center; gap: 10px; margin-top: 40px; font-family: var(--mono); font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: var(--fg); border-bottom: 1px solid var(--fg); padding-bottom: 6px; transition: gap .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease); }
.link-lg:hover { gap: 16px; color: var(--accent); border-color: var(--accent); }

.link-inline { color: var(--accent); border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); transition: border-color .2s var(--ease); }
.link-inline:hover { border-color: var(--accent); }

/* ============================ FOOTER ============================ */
.footer { border-top: 1px solid var(--rule-strong); padding: 56px 0 44px; }
.footer__inner { display: flex; justify-content: space-between; align-items: flex-start; gap: 30px; flex-wrap: wrap; }
.footer__brand b { font-family: var(--mono); font-size: .82rem; letter-spacing: .16em; text-transform: uppercase; }
.footer__brand p { color: var(--muted); margin-top: 8px; max-width: 34ch; font-size: 1rem; }
.footer__nav { display: flex; gap: 22px; flex-wrap: wrap; }
.footer__nav a { font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.footer__nav a:hover { color: var(--fg); }
.footer__meta { color: var(--faint); font-family: var(--mono); font-size: .68rem; letter-spacing: .06em; text-align: right; }
.footer__meta p + p { margin-top: 6px; }

/* ============================ REVEAL ============================ */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 900px) {
  body { font-size: 18px; }
  .nav__links { display: none; }
  .hero__inner { max-width: 100%; }
  .split, .split--narrow { grid-template-columns: 1fr; gap: 30px; }
  .subgrid { grid-template-columns: 1fr; }
  .principles { columns: 1; }
  .footer__meta { text-align: left; }
}
/* below the JS mobile breakpoint (760): toggle right-aligned, the gauge
   (JS-positioned, right: 64) docks just left of it in the header band */
@media (max-width: 759px) {
  /* toggle right-aligned but held clear of the gauge, which sits in the far
     corner (JS-positioned at right: 14, 40px wide) */
  .theme-toggle { margin-left: auto; margin-right: 44px; }
  /* tighter hero rhythm, and a hero short enough (svh = visible viewport,
     unlike vh which hides behind the URL bar) that the next section's top
     edge peeks above the fold as a scroll cue */
  .hero { min-height: 86vh; min-height: 86svh; padding-top: 120px; padding-bottom: 48px; }
  .hero__eyebrow { margin-bottom: 18px; }
  .hero__sub { margin-top: 16px; }
  .hero__byline { margin-top: 20px; }
  .hero__foot { margin-top: 24px; }
  /* denser act strip (mirrors the compressed one-row desktop variant) so the
     five stacked cards don't dominate the scroll */
  .hero .arc { padding-top: 64px; }
  .arc__step { padding: 13px 14px 11px; }
  .arc__step .meta { margin-bottom: 6px; }
  .arc__step b { font-size: 1.02rem; }
  .arc__step span { font-size: .88rem; }
  .arc li:not(:last-child)::after { margin: 8px 0; }
}
@media (max-width: 560px) {
  .item { grid-template-columns: 1fr; gap: 10px; }
  .item__n { padding-top: 0; }
  .steps li { grid-template-columns: 1fr; gap: 6px; }
}
