/* Natter project page. Pixel look taken from the 32 x 32 mascot sprite:
   square corners, 3px frames, hard offset shadows, colors from the sprite palette. */
:root {
  /* sprite palette (same in both themes) */
  --s-ink: #0d2b17;
  --s-green: #3cb84e;
  --s-mid: #22823a;
  --s-light: #86e264;
  --s-pale: #cdf29a;
  --s-red: #f0405e;

  --bg: #f5f7ec;
  --bg-hero: #ebf1dd;
  --grid: rgb(13 43 23 / .06);
  --surface: #ffffff;
  --surface-2: #eef3e2;
  --fg: #0d2b17;
  --muted: #3e5446;
  --line: #cbd8bf;
  --frame: #0d2b17;
  --drop: #bcd3a6;
  --accent: #1b7531;
  --accent-fill: #3cb84e;
  --on-accent: #0d2b17;
  --accent-soft: #dcf4c4;
  --plan: #6b4700;
  --plan-soft: #ffe9a6;
  --no: #a81d36;
  --no-soft: #ffdfe5;
  --code-bg: #e7eedb;
  --hl: #cdf29a;
  --term-bg: #0f2216;
  --term-bar: #173221;
  --term-fg: #e4f3d8;
  --term-muted: #8faa94;
  --term-line: #2b4a35;
  --syn-k: #86e264;
  --syn-s: #ffd866;
  --syn-b: #93d4ff;
  --syn-c: #8faa94;
  --syn-err: #ff8296;
  --b: 3px;  /* frame width = one "pixel" */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Cascadia Code", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
  --snake-h: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 6' shape-rendering='crispEdges'%3E%3Crect width='8' height='6' fill='%233cb84e'/%3E%3Crect width='8' height='1' fill='%230d2b17'/%3E%3Crect y='1' width='8' height='1' fill='%2386e264'/%3E%3Crect x='2' y='2' width='1' height='1' fill='%2322823a'/%3E%3Crect x='6' y='3' width='1' height='1' fill='%2322823a'/%3E%3Crect y='4' width='8' height='1' fill='%23cdf29a'/%3E%3Crect y='5' width='8' height='1' fill='%230d2b17'/%3E%3C/svg%3E");
  --snake-v: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 8' shape-rendering='crispEdges'%3E%3Crect width='6' height='8' fill='%233cb84e'/%3E%3Crect width='1' height='8' fill='%230d2b17'/%3E%3Crect x='1' width='1' height='8' fill='%2386e264'/%3E%3Crect x='2' y='2' width='1' height='1' fill='%2322823a'/%3E%3Crect x='3' y='6' width='1' height='1' fill='%2322823a'/%3E%3Crect x='4' width='1' height='8' fill='%23cdf29a'/%3E%3Crect x='5' width='1' height='8' fill='%230d2b17'/%3E%3C/svg%3E");
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1810;
    --bg-hero: #10211a;
    --grid: rgb(134 226 100 / .05);
    --surface: #13261a;
    --surface-2: #193222;
    --fg: #e6f3dc;
    --muted: #a8c1aa;
    --line: #29452f;
    --frame: #3d6a48;
    --drop: #050c07;
    --accent: #86e264;
    --accent-fill: #3cb84e;
    --on-accent: #0d2b17;
    --accent-soft: #1c3a20;
    --plan: #ffd866;
    --plan-soft: #3a300c;
    --no: #ff8fa1;
    --no-soft: #3f1820;
    --code-bg: #1d3424;
    --hl: transparent;
    --term-bg: #07110b;
    --term-bar: #0f2016;
    --term-line: #234030;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 17px/1.6 var(--font); }
img { display: block; }
.wrap {
  width: 100%; max-width: 1120px; margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { text-decoration-style: dotted; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 20; background: var(--surface); color: var(--fg); padding: 10px 14px; border: var(--b) solid var(--frame); font-weight: 700; }
.skip:focus { top: 12px; }
h1, h2, h3, .brand, .btn, .eyebrow, .kicker, nav a, .gh-small { font-family: var(--mono); }

/* ---------- Hero ---------- */
.hero {
  background:
    linear-gradient(var(--grid) 2px, transparent 2px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--grid) 2px, transparent 2px) 0 0 / 32px 32px,
    var(--bg-hero);
  position: relative;
}
/* a long pixel snake body closes the hero */
.hero::after { content: ""; display: block; height: 24px; background: var(--snake-h) 0 0 / 32px 24px; image-rendering: pixelated; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 6px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 800; font-size: 21px; color: var(--fg); text-decoration: none; }
.brand img { width: 32px; height: 32px; image-rendering: pixelated; }
.gh-small { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; font-weight: 700; font-size: 15px; color: var(--fg); text-decoration: none; background: var(--surface); border: var(--b) solid var(--frame); }
.gh-small:hover { background: var(--accent-soft); }

.hero-grid { display: grid; gap: 32px 56px; grid-template-columns: minmax(0, 1fr); padding-top: 28px; padding-bottom: 56px; align-items: end; }
@media (min-width: 920px) { .hero-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); padding-top: 36px; padding-bottom: 64px; } }

.eyebrow { display: inline-block; margin: 0 0 16px; font-weight: 700; font-size: 12.5px; line-height: 1; letter-spacing: .08em; text-transform: uppercase; color: var(--on-accent); background: var(--s-light); padding: 7px 10px; }
h1 { font-size: clamp(34px, 5.4vw, 58px); line-height: 1.06; margin: 0 0 20px; letter-spacing: -.035em; font-weight: 800; text-wrap: balance; }
.hl { background: linear-gradient(transparent 58%, var(--hl) 58% 92%, transparent 92%); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
@media (prefers-color-scheme: dark) { .hl { color: var(--s-light); } }
.lead { font-size: clamp(17px, 2.1vw, 19.5px); color: var(--muted); max-width: 52ch; margin: 0 0 26px; }
.links { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 28px; }
@media (max-width: 480px) { .links { gap: 10px; } .links .btn { padding: 0 12px; font-size: 15px; } }

/* Buttons: notched pixel corners drawn with box-shadow, hard drop shadow */
.btn {
  --c: var(--frame);
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 18px; margin: var(--b);
  font-weight: 700; font-size: 16px; text-decoration: none; color: var(--fg); background: var(--surface);
  box-shadow:
    0 calc(-1 * var(--b)) 0 var(--c), 0 var(--b) 0 var(--c), calc(-1 * var(--b)) 0 0 var(--c), var(--b) 0 0 var(--c),
    var(--b) calc(3 * var(--b)) 0 var(--drop), calc(2 * var(--b)) calc(2 * var(--b)) 0 var(--drop), calc(3 * var(--b)) var(--b) 0 var(--drop);
}
.btn:hover { background: var(--accent-soft); }
.btn.primary { background: var(--accent-fill); color: var(--on-accent); --c: var(--s-ink); }
.btn.primary:hover { background: var(--s-light); }
.btn:focus-visible { outline-offset: calc(3 * var(--b)); }
@media (prefers-color-scheme: light) { .btn { --drop: var(--s-ink); } }

.notice { background: var(--surface); border: var(--b) solid var(--frame); padding: 14px 16px; max-width: 60ch; box-shadow: 6px 6px 0 var(--drop); }
.notice p { margin: 0; font-size: 15.5px; line-height: 1.8; }

/* Sprite sitting on the code window. 1 sprite pixel = 7px (5px on phones). */
.hero-art { --sp: 7px; position: relative; margin: 0; padding-top: calc(31 * var(--sp)); min-width: 0; }
.sprite { position: absolute; top: 0; right: 28px; width: calc(32 * var(--sp)); height: calc(32 * var(--sp)); z-index: 2; overflow: visible; }
.term { position: relative; background: var(--term-bg); color: var(--term-fg); border: var(--b) solid var(--s-ink); box-shadow: 8px 8px 0 var(--drop); }
@media (prefers-color-scheme: dark) { .term { border-color: var(--frame); } }
.term-bar { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; background: var(--term-bar); border-bottom: var(--b) solid var(--term-line); }
.dot { width: 10px; height: 10px; background: #4d6a55; }
.dot:first-child { background: var(--s-red); }
.dot:nth-child(2) { background: #ffd866; }
.dot:nth-child(3) { background: var(--s-light); }
.term-name { margin-left: 8px; font: 13px var(--mono); color: var(--term-muted); }
.term pre { margin: 0; overflow-x: auto; font: 14.5px/1.65 var(--mono); }
.term-code { padding: 14px 16px 12px 0; }
.term-code code { display: block; min-width: max-content; }
.ln { display: inline-block; width: 3.2ch; margin-right: 1.4ch; text-align: right; color: var(--term-muted); user-select: none; }
.k { color: var(--syn-k); }
.s { color: var(--syn-s); }
.b { color: var(--syn-b); }
.c { color: var(--syn-c); }
.term-out-label { padding: 6px 16px; font: 700 11.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--term-muted); border-top: var(--b) dashed var(--term-line); }
.term-out { padding: 0 16px 16px; color: var(--term-fg); }
.err { color: var(--syn-err); font-weight: 700; }
.hint { color: var(--syn-s); }
.cursor { display: inline-block; width: .6em; height: 1.1em; margin-left: .25em; vertical-align: -.2em; background: var(--s-light); }
.hero-art figcaption { margin-top: 14px; font-size: 13.5px; color: var(--muted); text-align: right; }

/* Mascot animation: blink and tongue flick, in whole frames */
.lid { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .lid { animation: blink 5s steps(1, end) infinite; }
  .tongue { animation: flick 3.6s steps(1, end) infinite 1s; }
  .cursor { animation: cursor 1.1s steps(1, end) infinite; }
  .btn:active { transform: translate(var(--b), var(--b)); }
  html { scroll-behavior: smooth; }
}
@keyframes blink { 0% { opacity: 0; } 94% { opacity: 1; } 97% { opacity: 0; } }
@keyframes flick { 0% { opacity: 0; } 70% { opacity: 1; } 76% { opacity: 0; } 80% { opacity: 1; } 88% { opacity: 0; } }
@keyframes cursor { 0% { opacity: 1; } 50% { opacity: 0; } }

/* ---------- Navigation ---------- */
nav { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: var(--b) solid var(--frame); }
.nav-inner { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-top: 6px; padding-bottom: 6px; }
.nav-inner::-webkit-scrollbar { display: none; }
nav a { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; color: var(--muted); text-decoration: none; font-size: 14.5px; font-weight: 700; white-space: nowrap; }
nav a:hover { background: var(--accent-soft); color: var(--fg); }
nav a:focus-visible { outline-offset: -3px; }

/* ---------- Sections ---------- */
section { padding-top: 76px; scroll-margin-top: 60px; }
.kicker { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.kicker::before { content: ""; width: 12px; height: 12px; flex: none; background: var(--s-green); box-shadow: 0 0 0 2px var(--s-ink); }
h2 { font-size: clamp(27px, 4vw, 40px); line-height: 1.1; letter-spacing: -.03em; margin: 0 0 16px; font-weight: 800; text-wrap: balance; }
h3 { font-size: 18px; line-height: 1.3; margin: 0 0 6px; letter-spacing: -.02em; }
p { margin: 0 0 14px; }
.intro { font-size: 18.5px; color: var(--muted); max-width: 62ch; margin-bottom: 30px; }
.aside-note { max-width: 70ch; color: var(--muted); padding-left: 16px; border-left: 6px solid var(--line); }
code { font-family: var(--mono); font-size: .86em; background: var(--code-bg); padding: .1em .35em; overflow-wrap: anywhere; }

/* Why: feature grid */
.features { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); }
.features li { background: var(--surface); border: var(--b) solid var(--frame); box-shadow: 6px 6px 0 var(--drop); padding: 18px 20px 18px; min-width: 0; }
.features p { margin: 0; color: var(--muted); font-size: 16px; }
.chip { display: inline-block; margin-bottom: 14px; font-size: 13.5px; font-weight: 700; color: var(--on-accent); background: var(--s-pale); padding: 4px 9px; box-shadow: inset 0 0 0 2px var(--s-mid); }

/* How: pipeline + facts */
.pipeline { list-style: none; margin: 0 0 36px; padding: 0; display: flex; flex-wrap: wrap; gap: 14px 0; }
.pipeline li { position: relative; display: flex; align-items: center; font: 700 15.5px var(--mono); background: var(--surface); border: var(--b) solid var(--frame); padding: 8px 16px; }
.pipeline li:not(:last-child) { margin-right: 34px; }
/* pixel arrow: a 3-step triangle */
.pipeline li:not(:last-child)::after {
  content: ""; position: absolute; right: -23px; top: 50%; width: 12px; height: 20px; margin-top: -10px; background: var(--muted);
  clip-path: polygon(0 0, 4px 0, 4px 4px, 8px 4px, 8px 8px, 12px 8px, 12px 12px, 8px 12px, 8px 16px, 4px 16px, 4px 20px, 0 20px);
}
.pipeline li.vm { background: var(--accent-fill); color: var(--on-accent); border-color: var(--s-ink); }
.facts { margin: 0; display: grid; gap: 0 40px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.facts div { padding: 16px 0; border-top: var(--b) dotted var(--line); }
.facts dt { font-weight: 700; margin-bottom: 4px; display: flex; gap: 10px; align-items: baseline; }
.facts dt::before { content: ""; flex: none; width: 8px; height: 8px; background: var(--accent); transform: translateY(-1px); }
.facts dd { margin: 0 0 0 18px; color: var(--muted); }

/* Tables */
.scroll { overflow-x: auto; border: var(--b) solid var(--frame); background: var(--surface); margin: 0 6px 22px 0; box-shadow: 6px 6px 0 var(--drop); -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; min-width: 600px; font-size: 15.5px; }
th, td { text-align: left; vertical-align: top; padding: 12px 16px; border-bottom: 2px solid var(--line); }
th { font: 700 12px var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 700; width: 18%; }
td:last-child { width: 1%; white-space: nowrap; }
td code { font-size: .84em; }

/* Status tags: color plus shape (full, half, empty square) */
.tag { display: inline-flex; align-items: center; gap: 6px; font: 700 12px/1.5 var(--mono); padding: 2px 8px; white-space: nowrap; vertical-align: 1px; box-shadow: inset 0 0 0 2px currentColor; }
.tag::before { content: ""; width: 8px; height: 8px; flex: none; box-sizing: border-box; border: 2px solid currentColor; }
.t-have { background: var(--accent-soft); color: var(--accent); }
.t-have::before { background: currentColor; }
.t-plan { background: var(--plan-soft); color: var(--plan); }
.t-plan::before { background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
.t-no { background: var(--no-soft); color: var(--no); }
p.tag { margin: 4px 0 0; }

/* Determinism: full-width band */
.band { margin-top: 84px; padding: 64px 0; background: var(--surface); border-block: var(--b) solid var(--frame); }
.trio { display: grid; gap: 28px 40px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); margin-top: 12px; }
.trio p { color: var(--muted); margin: 0; }
.trio .trio-sym { display: inline-block; font: 800 clamp(24px, 3.2vw, 32px)/1 var(--mono); color: var(--on-accent); background: var(--s-pale); padding: 8px 12px; margin-bottom: 16px; letter-spacing: -.03em; box-shadow: 4px 4px 0 var(--s-mid); }

/* Embedding: text + code side by side */
.embed { display: grid; gap: 16px 48px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 880px) { .embed { grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); } .embed > div { padding-top: 8px; } }
.codeblock { margin: 0 8px 8px 0; background: var(--term-bg); color: var(--term-fg); border: var(--b) solid var(--s-ink); padding: 18px 20px; overflow-x: auto; font: 14.5px/1.65 var(--mono); box-shadow: 8px 8px 0 var(--drop); }
.embed .codeblock + .codeblock { margin-top: 20px; }
.embed .codeblock + p { margin-top: 20px; }
@media (prefers-color-scheme: dark) { .codeblock { border-color: var(--frame); } }
.codeblock code, .term code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }

/* Footer */
footer { margin-top: 100px; background: var(--bg-hero); }
footer::before { content: ""; display: block; height: 24px; background: var(--snake-h) 0 0 / 32px 24px; image-rendering: pixelated; }
.foot { display: flex; align-items: center; gap: 16px; padding-top: 22px; padding-bottom: 30px; color: var(--muted); font-size: 15.5px; }
.foot p { margin: 0; }
.foot-mark { flex: none; width: 64px; height: 64px; image-rendering: pixelated; }

@media (max-width: 560px) {
  body { font-size: 16.5px; }
  .wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .hero-art { --sp: 5px; }
  .sprite { right: 12px; }
  .term pre, .codeblock { font-size: 13px; }
  section { padding-top: 60px; }
  .band { padding: 48px 0; margin-top: 64px; }
  .pipeline li { padding: 7px 12px; font-size: 14.5px; }
  .pipeline li:not(:last-child) { margin-right: 30px; }
  .pipeline li:not(:last-child)::after { right: -21px; }
  /* tables become stacked rows so the status stays visible */
  .scroll { overflow: visible; }
  table { min-width: 0; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 14px 16px; border-bottom: 2px solid var(--line); }
  tbody tr:last-child { border-bottom: 0; }
  td { padding: 0; border: 0; width: auto !important; }
  td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; color: var(--muted); }
  td:last-child { grid-column: 2; grid-row: 1; }
}
