/* Cloudflare World: the landing page.
   Ink and paper, one signal colour, sharp boxes, mono metadata. */

@font-face { font-family: "Display"; src: url("/display.woff2") format("woff2"); font-weight: 300 800; font-display: swap; }
@font-face { font-family: "Mono"; src: url("/mono.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --bg: #f4f4f3;
  --bg-2: #ebebea;
  --panel: #fbfbfa;
  --ink: #0d0e10;
  --ink-2: #3c3f44;
  --dim: #6b6f75;
  --line: #d6d7d5;
  --line-2: #bfc1be;
  --grid: rgba(13, 14, 16, 0.045);
  --signal: #d6450a;
  --signal-ink: #ffffff;
  --signal-soft: rgba(214, 69, 10, 0.1);
  --land: #0d0e10;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1320px;
  --display: "Display", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0b0c;
    --bg-2: #101214;
    --panel: #0e1012;
    --ink: #ecece9;
    --ink-2: #b9bbb8;
    --dim: #80858b;
    --line: #22262a;
    --line-2: #343a40;
    --grid: rgba(236, 236, 233, 0.035);
    --signal: #ff6a1f;
    --signal-ink: #0a0b0c;
    --signal-soft: rgba(255, 106, 31, 0.12);
    --land: #ecece9;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0b0c;
  --bg-2: #101214;
  --panel: #0e1012;
  --ink: #ecece9;
  --ink-2: #b9bbb8;
  --dim: #80858b;
  --line: #22262a;
  --line-2: #343a40;
  --grid: rgba(236, 236, 233, 0.035);
  --signal: #ff6a1f;
  --signal-ink: #0a0b0c;
  --signal-soft: rgba(255, 106, 31, 0.12);
  --land: #ecece9;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--display);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
/* The blueprint grid behind everything: hard 1px lines every 48px. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.125em; }
.mono { font-family: var(--mono); font-feature-settings: "zero" 1; letter-spacing: 0; }
a { color: inherit; }
code { font-family: var(--mono); font-size: 0.88em; padding: 1px 6px; border: 1px solid var(--line-2); background: var(--panel); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

/* ---- scroll progress */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 30; pointer-events: none; }
.progress i { display: block; height: 100%; width: 100%; background: var(--signal); transform-origin: 0 50%; transform: scaleX(0); }

/* ---- top bar */
.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  height: 56px;
  display: flex; align-items: center; gap: 24px;
  padding-inline: var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.mark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 600 15px/1 var(--mono); letter-spacing: -0.01em; }
.mark .i { font-size: 18px; color: var(--signal); }
.mark b { color: var(--signal); font-weight: 600; }
.nav { display: flex; gap: 2px; margin-left: 12px; }
.nav a { font: 500 13px/1 var(--mono); color: var(--dim); text-decoration: none; padding: 8px 10px; border: 1px solid transparent; }
.nav a:hover { color: var(--ink); border-color: var(--line); }
.nav a.on { color: var(--ink); border-color: var(--line-2); background: var(--panel); }
.bar-end { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.clock { font-size: 12px; color: var(--dim); }
.clock span { color: var(--ink); }
.theme { display: grid; place-items: center; width: 34px; height: 34px; background: transparent; color: var(--ink); border: 1px solid var(--line-2); cursor: pointer; font-size: 15px; }
.theme:hover { border-color: var(--ink); }
.theme .sun { display: none; }
:root[data-theme="dark"] .theme .sun { display: block; }
:root[data-theme="dark"] .theme .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .sun { display: block; }
  :root:not([data-theme="light"]) .theme .moon { display: none; }
}

/* ---- hero */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto auto;
  padding-top: 56px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.globe {
  position: absolute;
  top: 56px; right: max(-12vw, -180px);
  width: min(88vh, 62vw);
  height: min(88vh, 62vw);
  touch-action: pan-y;
  cursor: grab;
}
.globe:active { cursor: grabbing; }
.hero-copy { position: relative; align-self: center; padding-block: 40px 28px; pointer-events: none; }
.hero-copy > * { pointer-events: auto; max-width: 720px; }
.kicker { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 28px; font-size: 12px; color: var(--dim); text-transform: lowercase; padding: 6px 10px; border: 1px solid var(--line-2); background: var(--panel); }
.dot { width: 7px; height: 7px; background: var(--signal); animation: blink 2.4s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
h1 {
  margin: 0;
  font-weight: 700;
  font-size: clamp(48px, 7.2vw, 112px);
  line-height: 0.92;
  letter-spacing: -0.045em;
}
h1 em { font-style: normal; color: var(--signal); }
.lead { margin: 28px 0 0; font-size: clamp(17px, 1.5vw, 21px); line-height: 1.5; color: var(--ink-2); max-width: 600px; text-wrap: pretty; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 36px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 18px;
  font: 500 14px/1 var(--mono);
  text-decoration: none;
  border: 1px solid var(--ink);
  background: var(--bg);
  transition: transform 0.15s ease;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 2px 2px 0 var(--ink); }
.btn.solid { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); }
.btn.solid:hover { box-shadow: 2px 2px 0 var(--ink); }
.readout {
  position: relative;
  display: grid; grid-template-columns: repeat(4, 1fr);
  margin: 0 auto;
  border-top: 1px solid var(--line);
  padding-block: 0;
}
.readout > div { padding: 18px 0 20px; border-right: 1px solid var(--line); padding-left: 18px; background: color-mix(in srgb, var(--bg) 70%, transparent); }
.readout > div:first-child { padding-left: 0; }
.readout > div:last-child { border-right: 0; }
.readout dt { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.08em; }
.readout dd { margin: 6px 0 0; font-size: clamp(26px, 3.2vw, 44px); font-weight: 500; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.hero-note { position: relative; margin: 0 auto; padding-block: 0 18px; font-size: 12px; color: var(--dim); min-height: 36px; }
.hero-note span::before { content: "> "; color: var(--signal); }

/* ---- section heads */
section { position: relative; }
.head { display: grid; grid-template-columns: 120px 1fr; column-gap: 24px; padding-block: 120px 56px; }
.head .num, .chapter-break .num { margin: 10px 0 0; font-size: 13px; color: var(--signal); }
.head .num::before, .chapter-break .num::before { content: "§ "; color: var(--dim); }
h2 { margin: 0; font-size: clamp(40px, 5.6vw, 84px); font-weight: 700; letter-spacing: -0.04em; line-height: 0.95; }
.head .sub { grid-column: 2; margin: 20px 0 0; max-width: 640px; font-size: 19px; color: var(--ink-2); text-wrap: pretty; }

/* ---- idea */
.tenets { list-style: none; margin: 0 0 40px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line-2); background: var(--panel); }
.tenets li { padding: 32px 28px 36px; border-right: 1px solid var(--line); position: relative; }
.tenets li:last-child { border-right: 0; }
.tenets .i { font-size: 26px; color: var(--signal); stroke-width: 1.6; }
.tenets h3 { margin: 48px 0 12px; font-size: 30px; letter-spacing: -0.03em; line-height: 1.05; }
.tenets p { margin: 0; color: var(--ink-2); }
.tenets li::after { content: counter(list-item, decimal-leading-zero); position: absolute; top: 32px; right: 28px; font: 12px var(--mono); color: var(--dim); }

/* ---- map */
.map { border-block: 1px solid var(--line); margin-top: 80px; background: color-mix(in srgb, var(--bg-2) 60%, transparent); }
.map-frame { padding-bottom: 96px; position: relative; }
.blueprint { display: block; width: 100%; height: auto; border: 1px solid var(--line-2); background: var(--panel); }
.map-legend { display: flex; flex-wrap: wrap; gap: 18px; font-size: 12px; color: var(--dim); padding: 0 0 12px; }
.map-legend span { display: inline-flex; align-items: center; gap: 8px; }
.k { width: 12px; height: 12px; border: 1px solid var(--ink); display: inline-block; }
.k.you { background: var(--ink); }
.k.app { background: var(--panel); }
.k.int { background: var(--panel); border-style: dashed; }
.k.prim { background: var(--signal); border-color: var(--signal); }
.map-read { margin: 0; padding: 12px 16px; border: 1px solid var(--line-2); border-top: 0; font-size: 13px; color: var(--ink-2); min-height: 46px; background: var(--panel); }
.map-read::before { content: "> "; color: var(--signal); }

/* Shared by the map and the chapter flows. */
.node rect { fill: var(--panel); stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; transition: fill 0.2s, stroke 0.2s; }
.node.int rect { stroke-dasharray: 4 3; }
.node.you rect { fill: var(--ink); }
.node.you text { fill: var(--bg); }
.node.prim rect { fill: var(--bg-2); stroke: var(--line-2); }
.node.prim .kind { fill: var(--signal); }
.node text { fill: var(--ink); font: 500 13px var(--mono); }
.node .kind { fill: var(--dim); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; }
.node.on rect { stroke: var(--signal); stroke-width: 2; }
.node.prim.on rect, .node.hot rect { fill: var(--signal-soft); stroke: var(--signal); }
.node.dim { opacity: 0.28; }
.node { transition: opacity 0.25s; }
.blueprint .node { cursor: pointer; }
.edge { fill: none; stroke: var(--line-2); stroke-width: 1; vector-effect: non-scaling-stroke; transition: stroke 0.25s, opacity 0.25s; }
.edge.on { stroke: var(--signal); stroke-width: 1.6; }
.edge.dim { opacity: 0.15; }
.packet { fill: var(--signal); }
.packet.ink { fill: var(--ink); }
.label-step { fill: var(--signal); font: 600 11px var(--mono); }
.col-label { fill: var(--dim); font: 500 11px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }
.col-line { stroke: var(--line); stroke-dasharray: 2 4; }

/* ---- services: the sticky scope + chapters */
.services { padding-bottom: 40px; }
.chapters { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 56px; align-items: start; }
.scope { position: sticky; top: 88px; height: calc(100vh - 140px); min-height: 420px; display: flex; align-items: center; }
.scope-box { width: 100%; border: 1px solid var(--ink); background: var(--panel); box-shadow: 6px 6px 0 var(--line-2); }
.scope-top, .scope-bottom { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; font-size: 12px; color: var(--dim); }
.scope-top { border-bottom: 1px solid var(--line); }
.scope-top [data-scope-name] { color: var(--ink); font-weight: 600; }
.scope-top [data-scope-name]::before { content: "■ "; color: var(--signal); }
.scope-bottom { border-top: 1px solid var(--line); }
.live { display: inline-flex; align-items: center; gap: 8px; }
.live i { width: 7px; height: 7px; background: var(--signal); animation: blink 1.2s steps(1) infinite; }
.flow { display: block; width: 100%; height: auto; }
.flow.swap { animation: swap 0.35s ease; }
@keyframes swap { from { opacity: 0; } to { opacity: 1; } }

.chapter { min-height: 88vh; padding-block: 12vh; display: flex; flex-direction: column; justify-content: center; border-top: 1px solid var(--line); }
.chapter:first-child { border-top: 0; padding-top: 0; }
.tag { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; margin: 0 0 20px; font-size: 13px; padding: 6px 10px; border: 1px solid var(--line-2); color: var(--ink-2); }
.tag .i { color: var(--signal); }
.chapter h3 { margin: 0; font-size: clamp(34px, 3.8vw, 56px); line-height: 1; letter-spacing: -0.04em; font-weight: 700; text-wrap: balance; }
.why { margin: 20px 0 32px; font-size: 18px; color: var(--ink-2); text-wrap: pretty; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; border-top: 1px solid var(--line); }
.steps li {
  counter-increment: s;
  position: relative;
  padding: 14px 0 14px 52px;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  transition: color 0.3s;
}
.steps li::before {
  content: counter(s, decimal-leading-zero);
  position: absolute; left: 0; top: 14px;
  width: 34px; text-align: center;
  font: 500 12px/24px var(--mono);
  border: 1px solid var(--line-2);
  color: var(--dim);
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.steps li.on { color: var(--ink); }
.steps li.on::before { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.steps li { cursor: pointer; }
.parts { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 28px 0 0; padding: 0; font-size: 12px; }
.parts li { padding: 5px 9px; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink-2); }
.chapter-break { padding-block: 18vh 6vh; border-top: 1px solid var(--line); }
.chapter-break .num { margin: 0 0 16px; }
.chapter-break .sub { margin: 20px 0 0; font-size: 19px; color: var(--ink-2); }

/* ---- principles */
.rules { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--ink); border-left: 1px solid var(--line); }
.rule { padding: 32px 32px 40px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--panel); }
.rule > .mono { margin: 0; font-size: 12px; color: var(--signal); text-transform: uppercase; letter-spacing: 0.1em; }
.rule h3 { margin: 40px 0 10px; font-size: 30px; line-height: 1.05; letter-spacing: -0.03em; }
.rule p:last-child { margin: 0; color: var(--ink-2); max-width: 520px; }
.term { margin: 96px 0 140px; border: 1px solid var(--ink); background: #0a0b0c; color: #d9dbd6; box-shadow: 8px 8px 0 var(--signal); }
.term-top { display: flex; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid #262a2e; font-size: 12px; color: #80858b; }
.term-top i { display: inline-block; width: 10px; height: 10px; border: 1px solid #4a5056; margin-right: 6px; }
.term pre { margin: 0; padding: 22px 22px 26px; min-height: 340px; font-size: 13px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.term .p { color: #ff6a1f; }
.term .ok { color: #9be39b; }
.term .d { color: #80858b; }
.term .cur { display: inline-block; width: 8px; height: 1.1em; vertical-align: -0.2em; background: #d9dbd6; animation: blink 1s steps(1) infinite; }

/* ---- footer + key bar */
.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px; padding-block: 40px 120px; border-top: 1px solid var(--line); }
.foot p { margin: 0; color: var(--dim); font-size: 13px; }
.foot > a { margin-left: auto; display: inline-flex; gap: 8px; align-items: center; font-size: 13px; text-decoration: none; color: var(--dim); }
.foot > a:hover { color: var(--ink); }
.keys {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center; gap: 0;
  border-top: 1px solid var(--line-2);
  background: var(--bg);
  font-size: 12px;
}
.keys a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px 8px; text-decoration: none; color: var(--dim); border-right: 1px solid var(--line); }
.keys a:first-child { border-left: 1px solid var(--line); }
.keys a:hover { color: var(--ink); }
.keys kbd { font: 600 11px/1 var(--mono); padding: 3px 5px; background: var(--ink); color: var(--bg); }
.keys a.on { color: var(--ink); background: var(--panel); }
.keys a.on kbd { background: var(--signal); color: var(--signal-ink); }

/* ---- reveal on scroll: a short fade, nothing that slides around much */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .reveal.in { opacity: 1; transform: none; }
.tenets .reveal:nth-child(2), .rules .reveal:nth-child(2) { transition-delay: 0.08s; }
.tenets .reveal:nth-child(3), .rules .reveal:nth-child(3) { transition-delay: 0.16s; }
.rules .reveal:nth-child(4) { transition-delay: 0.24s; }

/* ---- smaller screens */
@media (max-width: 1100px) {
  .keys { display: none; }
  .foot { padding-bottom: 48px; }
}
@media (max-width: 900px) {
  .nav { display: none; }
  .globe { position: relative; top: auto; right: auto; width: min(100vw, 560px); height: min(100vw, 560px); margin: 0 auto -8vw; grid-row: 1; justify-self: center; }
  .hero { grid-template-rows: auto auto auto auto; }
  .hero-copy { padding-block: 0 40px; }
  .head { grid-template-columns: 1fr; padding-block: 88px 40px; }
  .head .sub { grid-column: 1; }
  .head .num { margin: 0 0 14px; }
  .tenets { grid-template-columns: 1fr; }
  .tenets li { border-right: 0; border-bottom: 1px solid var(--line); }
  .tenets li:last-child { border-bottom: 0; }
  .tenets h3 { margin-top: 28px; }
  .chapters { display: block; }
  .scope { position: sticky; top: 56px; height: auto; min-height: 0; z-index: 5; padding: 10px 0; background: var(--bg); margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); border-bottom: 1px solid var(--line); }
  .scope-box { box-shadow: none; }
  .scope-top, .scope-bottom { padding: 6px 10px; font-size: 11px; }
  .flow { max-height: 30vh; }
  .chapter { min-height: 0; padding-block: 56px; }
  .rules { grid-template-columns: 1fr; }
  .readout { grid-template-columns: repeat(2, 1fr); }
  .readout > div:nth-child(2) { border-right: 0; }
  .readout > div:nth-child(3) { padding-left: 0; }
  .readout > div:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .map-frame { overflow-x: auto; }
  .blueprint { min-width: 760px; }
}
@media (max-width: 520px) {
  .bar { gap: 12px; }
  .clock { display: none; }
  .btn { flex: 1 1 auto; justify-content: center; }
  .term pre { font-size: 12px; min-height: 300px; padding: 16px; }
  .rule, .tenets li { padding: 24px 20px 28px; }
  .tenets li::after { right: 20px; top: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}
