:root {
  --bg: #0b0d14;
  --bg2: #11131c;
  --panel: #161925;
  --line: #262a3d;
  --fg: #c8d0f0;
  --muted: #8189ad;
  --dim: #4e5578;
  --blue: #7aa2f7;
  --cyan: #7dcfff;
  --green: #9ece6a;
  --yellow: #e0af68;
  --red: #f7768e;
  --magenta: #bb9af7;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
  /* Width of one monospace cell in em; app.js measures the real one. */
  --cw: 0.6;
  --gutter: 16px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(60rem 30rem at 80% -10%, rgb(187 154 247 / 0.10), transparent 60%),
    radial-gradient(50rem 30rem at -10% 20%, rgb(125 207 255 / 0.07), transparent 60%);
  background-repeat: no-repeat;
  color: var(--fg);
  font: 15px/1.6 var(--mono);
  overflow-x: hidden;
}

a { color: var(--cyan); text-underline-offset: 3px; }
a:hover { color: var(--fg); }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }

code, kbd { font-family: var(--mono); font-size: 0.93em; }
code { color: var(--green); }
kbd {
  display: inline-block;
  padding: 0 0.4em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--panel);
  color: var(--fg);
  line-height: 1.5;
}

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

.skip {
  position: absolute; left: var(--gutter); top: -40px; z-index: 10;
  background: var(--yellow); color: var(--bg); padding: 4px 10px; font-weight: 700;
}
.skip:focus { top: 8px; }

/* Header */

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 10px max(var(--gutter), calc((100vw - 1100px) / 2));
  background: rgb(11 13 20 / 0.82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { color: var(--fg); font-weight: 800; text-decoration: none; letter-spacing: 0.02em; }
.brand .prompt { color: var(--magenta); }
.top nav { display: flex; gap: clamp(0.6rem, 3vw, 1.6rem); flex-wrap: wrap; justify-content: flex-end; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--cyan); }
.top nav a::before { content: "/"; color: var(--dim); }

/* Layout */

main, footer { max-width: 1100px; margin: 0 auto; padding: 0 var(--gutter); }
section { padding: clamp(3rem, 8vw, 6rem) 0 0; }

h2 {
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
h2 .num { color: var(--magenta); font-weight: 400; margin-right: 0.3em; }
h2 .num::after { content: " //"; color: var(--dim); }
.lede { color: var(--muted); max-width: 70ch; margin: 0 0 1.6rem; }

/* Hero */

.hero { padding-top: clamp(2.5rem, 7vw, 5rem); }

.logo {
  margin: 0 0 1.6rem;
  /* 74 columns across the width, at most 15px. */
  font-size: min(15px, calc((100vw - 2 * var(--gutter)) / (74 * var(--cw)) - 0.2px));
  line-height: 1;
  font-weight: 700;
  background: linear-gradient(90deg, var(--magenta), var(--blue) 45%, var(--cyan) 75%, var(--green));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: sheen 9s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 18px rgb(122 162 247 / 0.25));
  overflow: hidden;
}
@keyframes sheen { from { background-position: 0% 0; } to { background-position: 100% 0; } }

.tagline {
  font-size: clamp(1.4rem, 4.6vw, 2.7rem);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 1.2rem;
}
.tagline .hl { color: var(--cyan); }
.pitch { max-width: 72ch; color: var(--fg); font-size: 1.02rem; margin: 0 0 1.6rem; }
.pitch strong { color: var(--magenta); }

.cta { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-bottom: 1rem; }
.btn {
  display: inline-block;
  padding: 0.7em 1.2em;
  border: 1px solid var(--line);
  color: var(--fg);
  text-decoration: none;
  font-weight: 700;
  background: var(--panel);
  transition: border-color 0.15s, transform 0.15s;
}
.btn:hover { border-color: var(--cyan); color: var(--fg); transform: translateY(-1px); }
.btn.primary { background: var(--cyan); color: var(--bg); border-color: var(--cyan); }
.btn.primary:hover { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.btn::before { content: "▸ "; }
.meta { color: var(--muted); font-size: 0.85rem; margin: 0 0 2.5rem; }

/* Terminal frames */

.term {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg2);
  box-shadow: 0 30px 80px -30px rgb(0 0 0 / 0.8), 0 0 0 1px rgb(255 255 255 / 0.02) inset;
  overflow: hidden;
}
.hero-term {
  box-shadow: 0 40px 120px -40px rgb(125 207 255 / 0.25), 0 30px 80px -30px rgb(0 0 0 / 0.9);
}
.bar {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}
.bar i { width: 11px; height: 11px; border-radius: 50%; background: var(--dim); }
.bar i:nth-child(1) { background: var(--red); }
.bar i:nth-child(2) { background: var(--yellow); }
.bar i:nth-child(3) { background: var(--green); }
.bar span { margin-left: 8px; }

.typed { padding: 10px 14px 0; font-size: 0.85rem; color: var(--fg); min-height: 1.6em; }
.typed .ps { color: var(--green); }
.caret {
  display: inline-block; width: 0.6em; height: 1.1em; vertical-align: text-bottom;
  background: var(--fg); margin-left: 2px;
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.scroll {
  container-type: inline-size;
  overflow-x: auto;
  padding: 12px 14px 14px;
  scrollbar-color: var(--dim) transparent;
}

.screen {
  margin: 0;
  color: var(--fg);
  line-height: 1.22;
  white-space: pre;
  /* Fit the screen's columns to the frame; on a phone, stop at 7px and scroll. */
  font-size: clamp(7px, calc(100cqi / (var(--cols) * var(--cw)) - 0.1px), 14px);
  font-variant-ligatures: none;
}
@supports not (container-type: inline-size) {
  .screen { font-size: 11px; }
}

.screen .dim { color: var(--dim); }
.screen .head { color: var(--magenta); font-weight: 700; }
.screen .title { color: var(--fg); font-weight: 700; }
.screen .ok { color: var(--green); }
.screen .warn { color: var(--yellow); }
.screen .bad { color: var(--red); font-weight: 700; }
.screen .idle { color: var(--muted); }
.screen .accent { color: var(--cyan); }
.screen .link { color: var(--blue); text-decoration: underline; text-decoration-color: rgb(122 162 247 / 0.4); }
.screen .task { color: var(--cyan); font-weight: 700; }
.screen .key { color: var(--blue); }

figcaption {
  padding: 10px 14px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}
figcaption::before { content: "# "; color: var(--dim); }

/* Features */

.features {
  list-style: none; padding: 0; margin: 1.5rem 0 0;
  display: grid; gap: 1px;
  grid-template-columns: 1fr;
  background: var(--line);
  border: 1px solid var(--line);
}
@media (min-width: 640px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .features { grid-template-columns: repeat(4, 1fr); } }
.features li {
  background: var(--bg);
  padding: 1.4rem 1.4rem 1.2rem;
  transition: background 0.2s;
}
.features li:hover { background: var(--bg2); }
.features h3 { margin: 0 0 0.6rem; font-size: 1.05rem; line-height: 1.3; }
.features .glyph { color: var(--magenta); display: inline-block; width: 1.4em; }
.features li:nth-child(3n+2) .glyph { color: var(--cyan); }
.features li:nth-child(3n) .glyph { color: var(--green); }
.features p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.features p strong, .features p em { color: var(--fg); font-style: normal; }

/* Screens */

.tabs { display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.tabs button {
  font: inherit; font-size: 0.9rem;
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); padding: 0.55em 1em; cursor: pointer; margin-bottom: -1px;
}
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected="true"] { color: var(--cyan); border-bottom-color: var(--cyan); }
.tabs button[aria-selected="true"]::before { content: "▸ "; }

.panels {
  display: grid; gap: 1rem; margin-top: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}
.term.small .screen { font-size: clamp(9px, calc(100cqi / (var(--cols) * var(--cw)) - 0.1px), 13px); }
/* The info panels are 40 rows of mostly nothing; show their top. */
.term.small .scroll { max-height: 18.5em; overflow-y: hidden; }

/* Install */

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 0.9rem; }
.steps li { counter-increment: step; }
.steps .c { display: block; color: var(--dim); font-size: 0.82rem; margin-bottom: 0.25rem; }
.steps .c::before { content: "# " counter(step) " "; color: var(--magenta); }
.cmdline {
  display: flex; align-items: stretch;
  border: 1px solid var(--line); background: var(--bg2);
}
.cmdline code {
  flex: 1; min-width: 0;
  padding: 0.75em 1em;
  color: var(--fg);
  overflow-x: auto; white-space: pre;
}
.cmdline code::before { content: "$ "; color: var(--green); }
.copy {
  font: inherit; font-size: 0.8rem;
  border: 0; border-left: 1px solid var(--line);
  background: var(--panel); color: var(--muted);
  padding: 0 1em; cursor: pointer; min-width: 5.5em;
}
.copy:hover { color: var(--cyan); }
.copy.done { color: var(--green); }
.after { color: var(--muted); margin-top: 1.6rem; max-width: 75ch; }

/* Footer */

footer { padding-top: 5rem; padding-bottom: 3rem; color: var(--muted); font-size: 0.85rem; }
footer p { margin: 0.3rem 0; }
.foot-art { color: var(--dim); margin: 0 0 1rem; overflow: hidden; }
.quiet { color: var(--dim); }

/* Reveal on scroll (only once app.js has run and motion is fine) */

.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

@media print {
  .js .reveal { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .logo, .caret { animation: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .btn { transition: none; }
}

@media (max-width: 560px) {
  body { font-size: 14px; }
  .top nav a:last-child { display: none; }
  .scroll { padding: 10px; }
}
