/* Nibble — the download page.
 *
 * Single dark theme by choice: the product is a black 128x128 screen, and a
 * light ground would fight it. Colours are drawn from the console's own
 * sixteen so the site and the tool are visibly the same object.
 *
 * Type pairs a monospace display face (set large and tight — this is a code
 * tool) against a humanist sans for running text, with mono returning only for
 * labels and figures. No webfonts: the page has to stay self-contained. */

:root {
  /* Ground: near-black with a blue bias, so the console's true #000 reads
     blacker inside its bezel. */
  --ink:      #0b0c10;
  --ink-2:    #101219;
  --ink-3:    #161923;
  --rule:     #1d2b53;   /* console dark-blue, used for hairlines */
  --rule-2:   #141a2e;

  --text:     #c2c3c7;   /* console light-grey */
  --soft:     #8a8b91;
  --dim:      #5f574f;   /* console dark-grey — warm, deliberately not neutral */
  --bright:   #fff1e8;   /* console white — warm */

  --accent:   #ffec27;   /* the one bold colour */
  --go:       #00e436;   /* primary action only */
  --hot:      #ff004d;

  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", "SF Mono", Menlo,
          Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, sans-serif;

  --page: 1080px;
  --gut: 28px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--bright); text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding-inline: var(--gut);
}

/* ---------- type scale ---------- */

h1, h2, h3 { margin: 0; text-wrap: balance; }

h1 {
  font-family: var(--mono);
  font-size: clamp(2.15rem, 5.4vw, 3.7rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--bright);
  /* The headline sets its own breaks; balancing on top of them strands
     one-word lines. */
  text-wrap: normal;
}

h2 {
  font-family: var(--mono);
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--bright);
}

h3 {
  font-size: 1rem;
  font-weight: 650;
  color: var(--bright);
  letter-spacing: -0.005em;
}

p { margin: 0; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
}

.lede {
  font-size: 1.075rem;
  line-height: 1.68;
  max-width: 60ch;
  color: var(--text);
}

.small { font-size: 0.875rem; }
.soft { color: var(--soft); }
.dim { color: var(--dim); }

code, .mono { font-family: var(--mono); font-size: 0.92em; }
code { color: var(--accent); }

/* ---------- header ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule-2);
}
.bar > .wrap {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--bright);
  text-decoration: none;
  font-size: 0.9rem;
}
/* Four of the console's colours, as a cartridge chip. */
.logo i {
  width: 16px; height: 16px;
  border-radius: 3px;
  background:
    linear-gradient(135deg, var(--accent) 0 25%, #ffa300 25% 50%,
                    var(--hot) 50% 75%, #ff77a8 75% 100%);
}
.bar .spacer { flex: 1; }
.bar nav {
  display: flex;
  gap: 22px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.bar nav a { color: var(--soft); text-decoration: none; }
.bar nav a:hover { color: var(--bright); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  padding: 11px 18px;
  border: 1px solid var(--rule);
  border-radius: 5px;
  background: var(--ink-2);
  color: var(--text);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: border-color .15s, color .15s, background .15s, transform .1s;
}
.btn:hover { border-color: var(--soft); color: var(--bright); transform: translateY(-1px); }
.btn .sub {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--dim);
  margin-top: 1px;
}
.btn.go {
  background: var(--go);
  border-color: var(--go);
  color: #00280e;
}
.btn.go .sub { color: #005b21; }
.btn.go:hover { background: #34ff6b; border-color: #34ff6b; color: #00280e; }
.btn.sm { padding: 7px 13px; font-size: 0.8rem; }

/* ---------- the screen ---------- */

/* A bezel. Scanlines are laid over the content, never under it. */
.screen {
  position: relative;
  background: #000;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 9px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .75), inset 0 0 0 1px rgba(255, 241, 232, .03);
}
.screen::after {
  content: "";
  position: absolute;
  inset: 9px;
  pointer-events: none;
  border-radius: 2px;
  background: repeating-linear-gradient(
    to bottom, rgba(0, 0, 0, .17) 0 1px, transparent 1px 3px);
}
.screen img,
.screen iframe {
  display: block;
  width: 100%;
  /* height:auto is load-bearing. An <img height="128"> attribute becomes a
     presentational hint of height:128px; with only `width` overridden in CSS,
     that hint wins and the picture renders squashed, aspect-ratio ignored. */
  height: auto;
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 2px;
  background: #000;
  image-rendering: pixelated;
}

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: 1.06fr .94fr;
  gap: 56px;
  align-items: center;
  padding: 72px 0 60px;
}
.hero-copy { display: flex; flex-direction: column; gap: 20px; align-items: start; }
.hero h1 .accent { color: var(--accent); }

.cta { display: flex; flex-wrap: wrap; gap: 10px; }

.playnote {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--soft);
  text-align: center;
  margin-top: 12px;
}
.playnote b { color: var(--accent); font-weight: 600; }

/* ---------- spec strip ---------- */

.strip {
  border-top: 1px solid var(--rule-2);
  border-bottom: 1px solid var(--rule-2);
}
.strip > .wrap {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
/* Dividers as borders, not a background showing through grid gaps — the gap
   trick bleeds colour into the wrapper's side padding. */
.strip .cell {
  padding: 18px 0 18px 20px;
  border-left: 1px solid var(--rule-2);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.strip .cell:first-child { border-left: 0; padding-left: 0; }
.strip .cell b {
  display: block;
  color: var(--bright);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.strip .cell span {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--dim);
}

/* ---------- what's new band ---------- */

.news { border-bottom: 1px solid var(--rule-2); }
.news > .wrap {
  display: flex;
  gap: 16px;
  align-items: baseline;
  padding: 16px 0;
}
.news .tag {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #00280e;
  background: var(--go);
  border-radius: 3px;
  padding: 3px 7px;
  white-space: nowrap;
}
.news p { font-size: 0.9rem; color: var(--soft); max-width: 72ch; }

@media (max-width: 640px) {
  .news > .wrap { flex-direction: column; gap: 9px; }
}

/* ---------- sections ---------- */

section { padding: 76px 0; }
section + section { border-top: 1px solid var(--rule-2); }

.head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 38px; max-width: 62ch; }

/* ---------- tabbed screenshot viewer ---------- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--rule-2);
}
.tabs button {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 9px 15px;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

.viewer { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; align-items: center; }
/* Exactly 3x: 384px of image + 18px padding + 2px border.
   A 128px screenshot must land on a whole-number scale, or nearest-neighbour
   gives some source pixels three device pixels and others four — which turns
   a 3x5 bitmap font to mush. */
.viewer .screen { width: 404px; max-width: 100%; }
.viewer .note { display: flex; flex-direction: column; gap: 12px; }
.viewer .note p { max-width: 46ch; }

.panel[hidden] { display: none; }

/* ---------- feature list (rules, not cards) ---------- */

.rows { display: grid; gap: 0; }
.row {
  display: grid;
  grid-template-columns: 15rem 1fr;
  gap: 32px;
  padding: 22px 0;
  border-top: 1px solid var(--rule-2);
  align-items: start;
}
.row:last-child { border-bottom: 1px solid var(--rule-2); }
.row p { color: var(--soft); max-width: 58ch; }

/* ---------- code ---------- */

.window {
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
  background: var(--ink-2);
}
.window .title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule-2);
  background: var(--ink-3);
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}
.window .title i {
  width: 8px; height: 8px; border-radius: 2px; background: var(--rule);
}
.window pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.83rem;
  line-height: 1.72;
  color: var(--text);
}
pre .k { color: #ff77a8; }
pre .f { color: #29adff; }
pre .c { color: #83769c; font-style: italic; }
pre .n { color: #ffccaa; }
pre .s { color: var(--go); }

.split { display: grid; grid-template-columns: 1.15fr .85fr; gap: 44px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- specs table ---------- */

.specs { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.specs th {
  text-align: left;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 600;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--rule-2);
}
.specs td {
  padding: 11px 0;
  border-bottom: 1px solid var(--rule-2);
  vertical-align: baseline;
}
.specs td:first-child { color: var(--dim); width: 46%; }
.specs td:last-child {
  color: var(--bright);
  font-family: var(--mono);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- steps ---------- */

.steps { display: grid; gap: 0; counter-reset: step; list-style: none; margin: 0; padding: 0; }
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  gap: 18px;
  padding: 20px 0;
  border-top: 1px solid var(--rule-2);
  align-items: start;
}
.steps li:last-child { border-bottom: 1px solid var(--rule-2); }
.steps li::before {
  content: counter(step);
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid var(--rule);
  border-radius: 4px;
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
}
.steps p { color: var(--soft); max-width: 56ch; }
.kbd {
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--ink-3);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--bright);
}

/* ---------- footer ---------- */

footer {
  border-top: 1px solid var(--rule-2);
  padding: 40px 0 64px;
}
footer .wrap { display: flex; flex-direction: column; gap: 10px; }
footer a { color: var(--soft); }

/* ---------- entrance ---------- */

.rise { opacity: 0; transform: translateY(14px); animation: rise .7s cubic-bezier(.2,.7,.3,1) forwards; }
.rise:nth-child(2) { animation-delay: .06s; }
.rise:nth-child(3) { animation-delay: .12s; }
.rise:nth-child(4) { animation-delay: .18s; }
.rise:nth-child(5) { animation-delay: .24s; }
@keyframes rise { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rise { animation: none; opacity: 1; transform: none; }
  * { transition-duration: .01ms !important; }
}

/* ---------- narrow ---------- */

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 36px; padding: 44px 0; }
  .hero-screen { max-width: 420px; width: 100%; }
  .viewer { grid-template-columns: 1fr; gap: 26px; }
  /* Narrow screens cannot fit 3x, so fall back to 2x rather than a fractional
     scale that would smear the pixels. */
  .viewer .screen { width: 276px; max-width: 100%; }
  .split { grid-template-columns: 1fr; gap: 28px; }
  .row { grid-template-columns: 1fr; gap: 6px; }
  .strip > .wrap { grid-template-columns: repeat(2, 1fr); }
  section { padding: 54px 0; }
  .bar nav { display: none; }
}
