/* ==========================================================================
   Worldnode landing page
   Structure: fonts → tokens → base → utilities → components → sections → responsive

   Instrument Sans and IBM Plex Mono are self-hosted under the SIL Open Font
   License. License texts: ../fonts/OFL-InstrumentSans.txt and
   ../fonts/OFL-IBMPlexMono.txt.

   No call to action is rendered. .button and .hero__actions are reserved for
   a later waitlist control. The mount points are #waitlist-header,
   #waitlist-hero and #waitlist-footer, and they stay empty.
   ========================================================================== */

/* ---------- 0. Fonts ---------- */
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url("../fonts/instrument-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url("../fonts/instrument-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- 1. Tokens ---------- */
:root {
  --color-ink: #070606;
  --color-cream: #f4ece0;
  --color-cream-muted: rgba(244, 236, 224, 0.64);
  /* 0.40 in the mockup, raised so 11px captions clear 4.5:1 on the ink background. */
  --color-cream-faint: rgba(244, 236, 224, 0.58);
  --color-line: rgba(244, 236, 224, 0.14);
  --color-line-strong: rgba(244, 236, 224, 0.28);

  --color-accent: #ff6b24;
  --color-accent-soft: rgba(255, 107, 36, 0.16);
  --color-accent-line: rgba(255, 107, 36, 0.55);
  --color-orange-field: #ff5a1e;
  /* Darkened from the mockup's #d9480f so 11.5px type clears 4.5:1 on paper. */
  --color-eyebrow-on-paper: #b0340a;

  --color-paper: #ece4d6;
  --color-paper-ink: #12100e;
  --color-paper-muted: rgba(18, 16, 14, 0.66);
  --color-paper-line: rgba(18, 16, 14, 0.2);

  --font-sans: "Instrument Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --gutter: 48px;
  --container: 1244px;
  --stipple-height: 240px;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--color-ink); scroll-behavior: smooth; color-scheme: dark; }
body {
  position: relative;
  margin: 0;
  overflow-x: hidden;
  background: var(--color-ink);
  color: var(--color-cream);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.012em;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol, figure, pre { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }

.skip-link {
  position: absolute; left: var(--gutter); top: -60px; z-index: 200;
  padding: 10px 14px; background: var(--color-cream); color: var(--color-ink); font-size: 14px;
}
.skip-link:focus { top: 12px; }

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

/* ---------- 3. Utilities ---------- */
.container { position: relative; width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }

.eyebrow {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--color-accent);
}
.eyebrow::before { content: ""; width: 28px; height: 1px; background: currentColor; }

.display {
  font-size: clamp(56px, 8.9vw, 128px);
  font-weight: 600; line-height: 0.86; letter-spacing: -0.065em;
}
.lede {
  max-width: 520px;
  font-size: clamp(18px, 1.46vw, 21px); line-height: 1.32; letter-spacing: -0.02em;
  color: var(--color-cream-muted);
}
.lede strong { color: var(--color-cream); font-weight: 500; }

/*
  Reserved for the later waitlist control. Nothing in the document uses
  .button today. #waitlist-hero is a hidden .hero__actions, so removing
  [hidden] and placing a control inside it picks these rules up.
*/
.button {
  display: inline-flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 16px; border: 1px solid transparent; border-radius: 2px;
  background: var(--color-accent); color: #140a04;
  font: 600 13.5px/1 var(--font-sans); letter-spacing: -0.01em; white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.button:hover { background: var(--color-cream); }
.button--large { height: 48px; padding: 0 22px; font-size: 15px; }
.button--ghost { background: transparent; border-color: var(--color-line-strong); color: var(--color-cream); }
.button--ghost:hover { background: transparent; border-color: var(--color-cream); }

.waitlist-slot[hidden] { display: none !important; }

/* ---------- 4. Components ---------- */

/* Animated film grain: one fixed-size layer, positioned over the whole document */
.grain { position: absolute; inset: 0; z-index: 90; overflow: hidden; pointer-events: none; }
.grain::before {
  content: ""; position: absolute; inset: -320px;
  background: url("../assets/grain.webp") 0 0 / 320px 320px repeat;
  animation: grain-shift 0.7s steps(1) infinite;
}
@keyframes grain-shift {
  0%   { transform: translate(0, 0); }
  14%  { transform: translate(-96px, 64px); }
  28%  { transform: translate(112px, -48px); }
  42%  { transform: translate(-40px, -120px); }
  57%  { transform: translate(80px, 100px); }
  71%  { transform: translate(-128px, -24px); }
  85%  { transform: translate(48px, 140px); }
}

/* Stippled dissolve between sections (black dots on transparent) */
.stipple {
  position: absolute; left: 0; z-index: 2; width: 100%; height: var(--stipple-height);
  background: url("../assets/stipple.webp") center top / 100% 100% no-repeat;
  pointer-events: none;
}
.stipple--top { top: -1px; }
.stipple--bottom { bottom: -1px; transform: scaleY(-1); }

/* Wordmark */
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 600; letter-spacing: -0.04em; }
.wordmark__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--color-accent); box-shadow: 0 0 0 4px var(--color-accent-soft); }

/* Source / date chip — the product motif (used sparingly) */
.fact-chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase;
  border: 1px solid var(--color-line-strong); border-radius: 2px;
}
.fact-chip__value { font-family: var(--font-sans); font-size: 13px; font-weight: 500; letter-spacing: -0.015em; text-transform: none; }
.fact-chip__source { padding: 1px 6px; border: 1px solid var(--color-accent-line); background: var(--color-accent-soft); color: var(--color-accent); border-radius: 2px; }
.fact-chip__date { color: var(--color-cream-muted); }
.fact-chip--glass {
  background: rgba(9, 7, 6, 0.6);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.fact-chip--paper { border-color: var(--color-paper-ink); color: var(--color-paper-ink); }
.fact-chip--paper .fact-chip__source { background: var(--color-paper-ink); border-color: var(--color-paper-ink); color: var(--color-paper); }
.fact-chip--paper .fact-chip__date { color: var(--color-paper-muted); }
.fact-chip--unknown { border-style: dashed; border-color: rgba(18, 16, 14, 0.7); color: rgba(18, 16, 14, 0.82); }
.fact-chip--suppressed { color: rgba(18, 16, 14, 0.82); text-decoration: line-through; text-decoration-thickness: 1px; }

/* Terminal card (code samples) */
.terminal {
  background: rgba(10, 8, 7, 0.62);
  border: 1px solid var(--color-line-strong); border-radius: 4px;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.terminal__bar {
  display: flex; justify-content: space-between; gap: 16px; padding: 11px 16px;
  border-bottom: 1px solid var(--color-line);
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-cream-faint);
}
.terminal__bar b { font-weight: 400; color: var(--color-accent); }
.terminal__code {
  padding: 18px 18px 22px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.75; color: rgba(244, 236, 224, 0.82);
}
.code-comment { color: rgba(244, 236, 224, 0.64); }
.code-key { color: var(--color-accent); }
.code-string { color: var(--color-cream); }

/* ---------- 5. Sections ---------- */

/* 5.1 Site header (overlays the hero) */
.site-header { position: absolute; top: 0; left: 0; right: 0; z-index: 10; border-bottom: 1px solid var(--color-line); }
.site-header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 72px;
}
.site-nav { justify-self: center; }
.site-header__end { justify-self: end; }
.site-nav__list { display: flex; gap: 34px; }
.site-nav__link {
  display: inline-flex; align-items: center; height: 72px;
  font-size: 14px; color: var(--color-cream-muted);
}
.site-nav__link:hover { color: var(--color-cream); }

/* 5.2 Hero */
.hero {
  position: relative; overflow: hidden;
  height: clamp(720px, 70vw, 1040px);
  background: var(--color-ink);
}
.hero__visual { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; }
.hero__shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 6, 6, 0.7) 0%, rgba(7, 6, 6, 0.25) 40%, rgba(7, 6, 6, 0) 62%),
    linear-gradient(180deg, rgba(7, 6, 6, 0) 75%, rgba(7, 6, 6, 0.55) 100%);
}
.hero__content { position: relative; z-index: 4; padding-top: clamp(112px, 9.4vw, 136px); }
.hero__title {
  margin: 26px 0 0 -0.05em;
  font-size: clamp(76px, 12.8vw, 184px);
  font-weight: 600; line-height: 0.8; letter-spacing: -0.072em;
}
.hero__lede { margin-top: 40px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

.hero__caption {
  position: absolute; z-index: 4; bottom: 44px; left: 0; right: 0;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  line-height: 1.8; color: var(--color-cream-faint);
}
.hero__caption b { font-weight: 400; color: var(--color-cream-muted); }

/* Small product hint: one source/date chip tied to a point on the limb */
.hero__hint {
  position: absolute; z-index: 5;
  right: max(var(--gutter), calc((100% - var(--container)) / 2 + var(--gutter)));
  bottom: clamp(120px, 12vw, 176px);
  display: flex; align-items: center; gap: 0;
}
.hero__hint-dot {
  width: 11px; height: 11px; border-radius: 50%; flex: none;
  background: var(--color-cream); border: 3px solid var(--color-ink);
  box-shadow: 0 0 0 1px var(--color-accent), 0 0 0 7px var(--color-accent-soft);
}
.hero__hint-line { width: 56px; height: 1px; background: var(--color-accent-line); flex: none; }
.hero__hint-note { display: block; margin-top: 10px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-cream-faint); }

/* 5.3 Vision (orange field + halftone map) */
.section-vision { position: relative; overflow: hidden; padding: 210px 0 0; background: var(--color-orange-field); color: #0b0807; }
.section-vision .eyebrow { color: #0b0807; }
.section-vision__title { margin-top: 24px; font-size: clamp(48px, 8.9vw, 128px); font-weight: 600; line-height: 0.86; letter-spacing: -0.068em; }
.section-vision__title span { display: block; }
.section-vision__lede { margin-top: 30px; color: rgba(11, 8, 7, 0.78); }

.map-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 26px;
  margin-top: 70px; padding-bottom: 14px; border-bottom: 1px solid rgba(11, 8, 7, 0.5);
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
}
.map-legend__swatch { display: inline-block; vertical-align: -1px; margin-right: 10px; }
.map-legend__swatch--entity { width: 9px; height: 9px; border-radius: 50%; background: #0b0807; box-shadow: 0 0 0 3px var(--color-orange-field), 0 0 0 4px #0b0807; }
.map-legend__swatch--link { width: 28px; border-top: 1px dashed #0b0807; vertical-align: 3px; }
.map-legend__flag { margin-left: auto; padding: 2px 7px; border: 1px solid #0b0807; }

.world-map {
  position: relative; width: 100%; aspect-ratio: 1920 / 760; margin-top: 10px;
  background: var(--color-orange-field);
}
.world-map__image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.world-map__links { position: absolute; inset: 0; width: 100%; height: 100%; }
.world-map__links line { stroke: #0b0807; stroke-width: 1.5; stroke-dasharray: 3 5; vector-effect: non-scaling-stroke; }
.world-map__pins { position: absolute; inset: 0; }
.pin { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%); z-index: 3; }
.pin__dot {
  display: block; width: 11px; height: 11px; border-radius: 50%;
  background: #fff3e6; border: 3px solid #0b0807; box-shadow: 0 0 0 5px rgba(255, 243, 230, 0.35);
}
.pin__label {
  position: absolute; left: 18px; top: -10px; padding: 4px 8px; white-space: nowrap;
  background: #0b0807; color: var(--color-cream);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
}
.pin__id { margin-left: 8px; color: var(--color-accent); }
.pin--flip .pin__label { left: auto; right: 18px; }
.world-map__scale {
  display: flex; justify-content: space-between; padding: 14px 0 calc(var(--stipple-height) - 10px);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; color: rgba(11, 8, 7, 0.7);
}

/* 5.4 Built for agents */
.section-agents { position: relative; overflow: hidden; padding: 170px 0 230px; background: var(--color-ink); }
.section-agents__glow {
  position: absolute; right: -330px; top: 430px; width: 1500px; height: 900px;
  background: url("../assets/haze.webp") center / 100% 100% no-repeat; pointer-events: none;
}
.section-agents__title { margin-top: 24px; font-size: clamp(60px, 12.2vw, 176px); font-weight: 600; line-height: 0.8; letter-spacing: -0.07em; }
.section-agents__lede { margin-top: 34px; }
.planned-note {
  max-width: 40em;
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.01em;
  line-height: 1.55;
  color: var(--color-cream-muted);
}
/* minmax(0, 1fr), and min-width: 0 on the card: a long code line scrolls inside its card
   and cannot widen the column past the screen. */
.code-samples { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-top: 76px; }
.code-samples .terminal { min-width: 0; }

/* 5.5 Principles (paper) */
.section-principles { position: relative; overflow: hidden; padding: 240px 0 270px; background: var(--color-paper); color: var(--color-paper-ink); }
.section-principles .eyebrow { color: var(--color-eyebrow-on-paper); }
.section-principles__title { margin-top: 24px; }
.rules { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 96px; border-top: 1px solid var(--color-paper-ink); }
.rule { display: flex; flex-direction: column; min-height: 330px; margin-right: 32px; padding: 22px 32px 0 0; border-right: 1px solid var(--color-paper-line); }
.rule:last-child { margin-right: 0; border-right: 0; }
.rule__meta { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; color: var(--color-paper-muted); }
.rule__title { margin-top: 56px; font-size: clamp(34px, 3.05vw, 44px); font-weight: 600; line-height: 0.96; letter-spacing: -0.055em; }
.rule__text { max-width: 22em; margin-top: 18px; color: var(--color-paper-muted); line-height: 1.45; }
.rule__demo { margin-top: auto; padding: 26px 0 28px; }

/* 5.6 Footer */
.site-footer { position: relative; overflow: hidden; padding-top: 80px; background: var(--color-ink); }
.site-footer__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 40px; padding-bottom: 80px; }
.site-footer__note { max-width: 520px; margin-top: 14px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em; line-height: 1.7; color: var(--color-cream-faint); }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 12px 28px; font-size: 14px; color: var(--color-cream-muted); }
.site-footer__links a { display: inline-flex; align-items: center; min-height: 44px; }
.site-footer__links a:hover { color: var(--color-cream); }
.site-footer__giant {
  height: clamp(80px, 13.2vw, 190px); margin-left: -0.05em; overflow: hidden; white-space: nowrap;
  font-size: clamp(100px, 18.2vw, 262px); font-weight: 600; line-height: 0.8; letter-spacing: -0.075em;
  color: rgba(244, 236, 224, 0.08);
}

/* ---------- 6. Responsive ---------- */
@media (max-width: 1100px) {
  .code-samples, .rules { grid-template-columns: minmax(0, 1fr); }
  .rule { min-height: 0; margin-right: 0; padding-bottom: 8px; border-right: 0; border-bottom: 1px solid var(--color-paper-line); }
  .rule:last-child { border-bottom: 0; }
  .hero__hint { display: none; }
}
@media (max-width: 800px) {
  :root { --gutter: 20px; --stipple-height: 140px; }
  .site-nav { display: none; }
  .hero { height: auto; min-height: 640px; padding-bottom: 150px; }
  .hero__visual { object-position: 62% 100%; }
  .hero__caption { bottom: 24px; }
  .section-vision, .section-principles { padding-top: 150px; }
  .section-agents { padding-top: 110px; }
  .section-agents { padding-bottom: 170px; }
  .section-principles { padding-bottom: 180px; }
  .map-legend { margin-top: 44px; }
  .map-legend__flag { margin-left: 0; }
  .world-map { aspect-ratio: auto; height: 300px; overflow: hidden; }
  /* One frame for the image, the lines and the pins: the whole map at 300px tall,
     centred, cropped at the sides. The three stay in the same coordinates. */
  .world-map__image, .world-map__links, .world-map__pins {
    inset: 0 auto 0 50%; width: calc(300px * 1920 / 760); max-width: none; height: 300px; transform: translateX(-50%);
  }
  .pin__label { display: none; }
  .world-map__scale { display: none; }
  .section-vision { padding-bottom: 150px; }
  .site-footer__top { flex-direction: column; }
}
@media (max-width: 420px) {
  .hero__title { font-size: clamp(48px, 20vw, 76px); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .grain::before { animation: none; }
  .button { transition: none; }
}
