/* ==========================================================================
   Catalystica — quiet pages (/legal, 404)
   Self-contained on purpose: styles.css carries the homepage's motion system,
   these pages only need the tokens, the two type voices and three surfaces.
   Paths are root-absolute because 404.html is served for any URL depth.
   ========================================================================== */

@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --blue: #5472FB;
  --ink: #0C1821;
  --white: #FFFFFF;
  --fg2-white: rgba(12, 24, 33, 0.72);   /* secondary text on white, ~7.3:1 */
  --rule-white: rgba(12, 24, 33, 0.16);
  --band-fg: rgba(255, 255, 255, 0.72);  /* secondary text on ink */

  --ease-react: cubic-bezier(0.16, 1, 0.3, 1);
  --t-micro: 0.3s;
  --t-short: 0.6s;

  --gutter: clamp(20px, 4.5vw, 64px);
  --measure: 720px;
  --text-size: clamp(17px, 1.35vw, 19px);
}

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

html {
  -webkit-text-size-adjust: 100%;
  color-scheme: light;
  background: var(--ink);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-synthesis: none;
  font-weight: 500;
  background: var(--white);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

@supports (min-height: 100svh) { body { min-height: 100svh; } }

a { color: inherit; }

:where(a, button):focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: 2px;
}

/* Surfaces */
[data-surface="blue"] { background: var(--blue); color: var(--ink); }
[data-surface="ink"] { background: var(--ink); color: var(--white); }
[data-surface="white"] { background: var(--white); color: var(--ink); }

[data-surface="blue"] ::selection,
[data-surface="white"] ::selection { background: var(--ink); color: var(--white); }
[data-surface="ink"] ::selection { background: var(--white); color: var(--ink); }

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

/* Skip link: off-screen until focused. */
.skip {
  position: absolute;
  z-index: 100;
  left: var(--gutter);
  top: 12px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus-visible { transform: none; outline-color: var(--ink); }

/* ---------- Nav (mirrors the homepage) ---------- */
.nav {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: clamp(24px, 3vw, 40px) var(--gutter) 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand svg { flex: none; width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 8; }

/* 19px bold counts as large text: AA on blue. */
.nav-meta { font-weight: 700; font-size: 19px; letter-spacing: -0.01em; }

/* The nav link to /ecuador: one underline geometry on every page (colour follows the surface). */
a.nav-meta { text-decoration-thickness: 2px; text-underline-offset: 6px; }

/* ---------- The mark (decorative) ---------- */
.mark { display: block; width: 100%; height: auto; fill: var(--white); overflow: visible; }

.mark-rest {
  transform-box: view-box;
  transform-origin: 50% 50%;
  transform: rotate(-10deg);
}

/* ---------- Display voice ---------- */
.display {
  font-weight: 900;
  line-height: 0.94;
  letter-spacing: -0.045em;
  margin-inline-start: -0.045em;
  text-wrap: balance;
}

/* ==========================================================================
   /legal
   ========================================================================== */

.masthead { position: relative; }

.title-band {
  position: relative;
  overflow: hidden;
  padding: clamp(72px, 10vw, 144px) var(--gutter) clamp(48px, 6vw, 88px);
}

.title-band .mark-wrap {
  position: absolute;
  z-index: 0;
  right: clamp(-96px, -6vw, -28px);
  bottom: clamp(-120px, -9vw, -40px);
  width: clamp(150px, 30vw, 420px);
  pointer-events: none;
}

.title-band .eyebrow {
  position: relative;
  z-index: 1;
  display: block;
  margin-bottom: clamp(16px, 2vw, 28px);
  font-weight: 700;
  font-size: clamp(19px, 1.6vw, 22px);
  letter-spacing: -0.01em;
}

.title-band h1 {
  position: relative;
  z-index: 1;
  font-size: clamp(42px, 7.4vw, 108px);
  max-width: 12ch;
}

@media (max-width: 608px) { .title-band h1 { letter-spacing: -0.035em; } }

/* Body layout: one column on phones, a quiet index beside the text from 1100px. */
.doc {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: minmax(0, var(--measure));
  grid-template-areas: "intro" "toc" "body";
  row-gap: clamp(48px, 6vw, 72px);
  padding: clamp(56px, 7vw, 104px) var(--gutter) clamp(88px, 10vw, 152px);
}

.doc-intro { grid-area: intro; }
.toc { grid-area: toc; }
.doc-body { grid-area: body; }

@media (min-width: 1100px) {
  .doc {
    grid-template-columns: minmax(200px, 260px) minmax(0, var(--measure));
    grid-template-areas: "toc intro" "toc body";
    column-gap: clamp(56px, 7vw, 128px);
  }
  .toc {
    position: sticky;
    top: 40px;
    align-self: start;
  }
}

/* Reading voice */
.doc p,
.doc li,
.doc dd {
  font-weight: 450;
  font-size: var(--text-size);
  line-height: 1.6;
  letter-spacing: -0.005em;
  text-wrap: pretty;
}

.doc strong { font-weight: 650; }

.doc a {
  text-decoration-line: underline;
  text-decoration-color: var(--blue);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  overflow-wrap: anywhere;
  transition: text-decoration-color var(--t-micro) var(--ease-react);
}

@media (hover: hover) {
  .doc a:hover { text-decoration-color: var(--ink); }
}

.lede {
  font-size: clamp(19px, 1.7vw, 23px) !important;
  font-weight: 500 !important;
  line-height: 1.5 !important;
  letter-spacing: -0.015em !important;
}

/* Who, where, since when */
.facts {
  margin-top: clamp(32px, 4vw, 48px);
  border-bottom: 1px solid var(--ink);
}

.facts div {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px 24px;
  padding: 14px 0;
  border-top: 1px solid var(--ink);
}

.facts dt {
  font-weight: 500;
  font-size: 15px;
  line-height: 1.5;
  color: var(--fg2-white);
}

.facts dd { font-weight: 550 !important; line-height: 1.45 !important; }

@media (min-width: 560px) {
  .facts div { grid-template-columns: 9.5em 1fr; align-items: baseline; }
}

/* Index */
.toc h2 {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: 0;
  color: var(--fg2-white);
  margin-bottom: 12px;
}

.toc ol { list-style: none; counter-reset: toc; }

.toc li {
  counter-increment: toc;
  font-size: 16px !important;
  line-height: 1.35 !important;
  border-top: 1px solid var(--rule-white);
}

.toc li:last-child { border-bottom: 1px solid var(--rule-white); }

.toc a {
  display: grid;
  grid-template-columns: 2.2em 1fr;
  padding: 10px 0;
  font-weight: 500;
  text-decoration: none !important;
}

.toc a::before {
  content: counter(toc, decimal-leading-zero);
  color: var(--fg2-white);
  font-variant-numeric: tabular-nums;
}

@media (hover: hover) {
  .toc a:hover span { text-decoration: underline; text-decoration-color: var(--blue); text-decoration-thickness: 2px; text-underline-offset: 4px; }
}

/* Sections */
.doc-body section {
  padding-top: clamp(28px, 3vw, 40px);
  border-top: 1px solid var(--ink);
  scroll-margin-top: 24px;
}

.doc-body section + section { margin-top: clamp(48px, 6vw, 72px); }

.doc-body h2 {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  font-weight: 750;
  font-size: clamp(24px, 2.3vw, 32px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.doc-body h2 .num {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0;
  color: var(--fg2-white);
  font-variant-numeric: tabular-nums;
}

.doc-body p + p,
.doc-body p + ul,
.doc-body ul + p { margin-top: 16px; }

.doc-body ul { list-style: none; }

.doc-body ul li {
  position: relative;
  padding-left: 22px;
}

.doc-body ul li + li { margin-top: 10px; }

/* Bullets: the homepage's blue status dot. */
.doc-body ul li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: calc(0.8em - 4px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
}

.doc-body code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.88em;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(12, 24, 33, 0.06);
}

/* ---------- Footer: a short echo of the homepage closing ---------- */
.foot {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: clamp(32px, 4vw, 48px);
  padding: clamp(80px, 10vw, 144px) var(--gutter) 0;
}

.foot .mark-wrap {
  position: absolute;
  z-index: 0;
  top: clamp(-80px, -5vw, -24px);
  right: clamp(-96px, -6vw, -28px);
  width: clamp(120px, 22vw, 320px);
  pointer-events: none;
}

.foot-line {
  position: relative;
  z-index: 1;
  font-size: clamp(40px, 6.4vw, 96px);
  max-width: 11ch;
}

.pill {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  max-width: 100%;
  padding: clamp(15px, 1.5vw, 20px) clamp(20px, 2.2vw, 30px);
  background: var(--ink);
  color: var(--white);
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: clamp(16px, 1.5vw, 20px);
  letter-spacing: -0.01em;
  transition: background var(--t-micro) var(--ease-react), color var(--t-micro) var(--ease-react);
}

.pill span { min-width: 0; }

/* Narrow phones: the address keeps one line (the arrow is decoration). */
@media (max-width: 359px) {
  .pill { gap: 10px; padding-inline: 18px; font-size: 15px; }
  .pill svg { display: none; }
}

.pill svg {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--t-short) var(--ease-react);
}

@media (hover: hover) {
  .pill:hover { background: var(--white); color: var(--ink); }
  .pill:hover svg { transform: rotate(45deg); }
}

.pill:focus-visible { background: var(--white); color: var(--ink); outline-color: var(--ink); }
.pill:focus-visible svg { transform: rotate(45deg); }

.foot-bar {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px 24px;
  margin: clamp(40px, 6vw, 96px) calc(var(--gutter) * -1) 0;
  padding: 20px var(--gutter);
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  color: var(--band-fg);
  font-size: 15px;
  line-height: 1.2;
}

.foot-bar .sign { font-weight: 700; letter-spacing: -0.02em; color: var(--white); }

.foot-bar .links { display: flex; flex-wrap: wrap; gap: 8px 24px; }

.foot-bar a {
  color: var(--white);
  font-weight: 500;
  text-decoration: none;
  padding-block: 4px;
  margin-block: -4px;
}

.foot-bar a:hover { text-decoration: underline; text-underline-offset: 5px; }

.foot-bar a[aria-current="page"] { color: var(--band-fg); }

/* ==========================================================================
   404
   ========================================================================== */

.lost {
  position: relative;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lost .mark-wrap {
  position: absolute;
  z-index: 0;
  top: clamp(72px, 8.5vw, 120px);
  right: clamp(-120px, -8vw, -40px);
  width: min(clamp(200px, 32vw, 460px), 52vh);
  pointer-events: none;
}

.lost-copy {
  position: relative;
  z-index: 1;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(20px, 2.4vw, 32px);
  padding: clamp(160px, 22vh, 280px) var(--gutter) clamp(40px, 6vw, 88px);
}

.lost-copy .eyebrow {
  font-weight: 700;
  font-size: clamp(19px, 1.6vw, 22px);
  letter-spacing: -0.01em;
}

.lost-copy h1 {
  font-size: clamp(48px, min(9.2vw, 13.5vh), 132px);
  max-width: 10ch;
}

@media (max-width: 608px) { .lost-copy h1 { letter-spacing: -0.035em; } }

.lost-copy .pill { margin-top: clamp(4px, 1vw, 12px); }

@media (max-width: 719px) {
  .lost .mark-wrap { width: 56vw; top: 76px; right: -40px; }
}

/* ---------- Reduced motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

@media print {
  [data-surface] { background: none !important; color: #000 !important; }
  .mark-wrap, .toc, .skip, .pill svg { display: none !important; }
  .doc { display: block; padding: 0; }
  .doc-body section { break-inside: avoid; }
  .foot { padding: 24px 0 0; }
  .foot-line { font-size: 24px; }
  .pill { padding: 0; background: none; color: #000; }
  .foot-bar { margin: 16px 0 0; padding: 0; color: #000; }
  .foot-bar .sign, .foot-bar a { color: #000; }
}
