/* pilotlight.sh — hand-written, no build step, no external requests. */

:root {
  color-scheme: dark;

  --bg:        #0a0c10;
  --bg-raised: #11141b;
  --bg-chrome: #171b24;
  --bg-inset:  #0d1016;
  --border:    #232936;
  --border-hi: #333c4d;

  --text:      #d4d8e0;
  --text-dim:  #8b93a3;
  --heading:   #f2f5fa;

  --flame-1:   #5eead4;
  --flame-2:   #38bdf8;
  --flame-3:   #3b82f6;
  --amber:     #f59e0b;
  --green:     #4ade80;
  --red:       #f87171;
  --violet:    #c084fc;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", "DejaVu Sans Mono", monospace;

  --wrap: 1080px;
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.65;
  /* A faint grid, like phosphor bleed. */
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(59, 130, 246, 0.10), transparent 70%);
  background-repeat: no-repeat;
}

.sprite { position: absolute; }

img, svg { max-width: 100%; }

a { color: var(--flame-2); text-decoration: none; }
a:hover { text-decoration: underline; }

code { font-family: var(--mono); font-size: 0.92em; }

p code, li code, td code, dd code {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.08em 0.36em;
  color: var(--flame-1);
  white-space: nowrap;
}

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 20px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: absolute; left: 12px; top: -60px;
  z-index: 100;
  background: var(--bg-chrome);
  border: 1px solid var(--flame-1);
  color: var(--flame-1);
  padding: 8px 14px; border-radius: 6px;
  transition: top 0.15s ease;
}
.skip:focus { top: 12px; }

/* ─────────────────────────────────────────────────────────── marks ── */

.mark { display: block; }
.mark-sm { width: 18px; height: 18px; flex: none; }
.mark-lg { width: 52px; height: 52px; margin-bottom: 18px; }

/* The pilot light never sits perfectly still. */
.core { animation: flicker 4.2s ease-in-out infinite; transform-origin: 50% 70%; }
@keyframes flicker {
  0%, 100% { opacity: 1;    }
  38%      { opacity: 0.55; }
  52%      { opacity: 0.9;  }
  71%      { opacity: 0.62; }
}

.caret {
  display: inline-block;
  width: 0.55em; height: 1em;
  background: var(--flame-1);
  vertical-align: -0.14em;
  margin-left: 0.18em;
  animation: blink 1.15s steps(1) infinite;
}
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* ────────────────────────────────────────────────────────── topbar ── */

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 12, 16, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex; align-items: center; gap: 20px;
  min-height: 52px;
}

.brand {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--heading); font-weight: 600; letter-spacing: -0.02em;
  flex: none;
}
.brand:hover { text-decoration: none; color: var(--flame-1); }

.topbar nav {
  display: flex; align-items: center; gap: 4px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.topbar nav::-webkit-scrollbar { display: none; }

.topbar nav a {
  color: var(--text-dim);
  font-size: 13px;
  padding: 5px 9px;
  border-radius: 5px;
  white-space: nowrap;
}
.topbar nav a:hover {
  color: var(--flame-1);
  background: var(--bg-raised);
  text-decoration: none;
}
.topbar nav a.ext { color: var(--text); }

/* ──────────────────────────────────────────────────────── sections ── */

.band { padding: 72px 0; border-top: 1px solid var(--border); }
.band:first-of-type { border-top: 0; }

section[id] { scroll-margin-top: 68px; }

h1, h2, h3 { color: var(--heading); letter-spacing: -0.02em; line-height: 1.25; }

h2 {
  font-size: clamp(21px, 3.4vw, 27px);
  margin: 0 0 14px;
}
.hash { color: var(--flame-3); margin-right: 0.4em; }

h3 { font-size: 16px; margin: 0 0 8px; }
h3.sub { margin: 40px 0 14px; font-size: 15px; color: var(--text-dim); }

.section-lede {
  max-width: 68ch;
  color: var(--text-dim);
  margin: 0 0 32px;
}

.fineprint { color: var(--text-dim); font-size: 13.5px; }

/* ──────────────────────────────────────────────────────────── hero ── */

.hero { padding: 56px 0 76px; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 44px;
  align-items: start;
}

.hero h1 {
  font-size: clamp(38px, 7vw, 58px);
  margin: 0 0 10px;
  font-weight: 700;
}

.tagline {
  font-size: clamp(16px, 2.2vw, 19px);
  color: var(--flame-1);
  margin: 0 0 18px;
  max-width: 30ch;
}

.lede { color: var(--text-dim); margin: 0 0 26px; max-width: 54ch; }

.hero-cmd { margin-bottom: 20px; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 28px; }

.btn {
  display: inline-block;
  padding: 9px 18px;
  border: 1px solid var(--border-hi);
  border-radius: 6px;
  color: var(--text);
  background: var(--bg-raised);
  font-size: 14px;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.btn:hover { border-color: var(--flame-1); color: var(--flame-1); text-decoration: none; }
.btn-primary { border-color: var(--flame-3); color: var(--flame-1); }
.btn-primary:hover { background: rgba(59, 130, 246, 0.12); }

.prerelease {
  border-left: 2px solid var(--amber);
  padding: 2px 0 2px 14px;
  margin: 0;
  color: var(--text-dim);
  font-size: 13.5px;
}
.prerelease strong { color: var(--amber); font-weight: 600; }

/* ──────────────────────────────────────────────────────── terminal ── */

.term {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 14px 40px -18px rgba(0, 0, 0, 0.8);
}

.term-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 13px;
  background: var(--bg-chrome);
  border-bottom: 1px solid var(--border);
}

.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot-r { background: #ff5f57; }
.dot-y { background: #febc2e; }
.dot-g { background: #28c840; }

.term-title {
  margin-left: 8px;
  color: var(--text-dim);
  font-size: 12px;
}

.replay {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border-hi);
  color: var(--text-dim);
  font-family: var(--mono); font-size: 11.5px;
  padding: 2px 9px; border-radius: 5px;
  cursor: pointer;
}
.replay:hover { color: var(--flame-1); border-color: var(--flame-1); }

.term-body { overflow-x: auto; padding: 16px 0; }

.term-body pre {
  margin: 0;
  padding: 0 18px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.62;
  white-space: pre;
  min-width: max-content;
}

.term-flush { box-shadow: none; }

/* Terminal token colors. */
.prompt { color: var(--flame-3); user-select: none; }
.dim    { color: var(--text-dim); }
.ok     { color: var(--green); }
.err    { color: var(--red); }
.hdr    { color: var(--text-dim); text-transform: none; }
.px1    { color: var(--flame-1); }
.px2    { color: var(--violet); }
.px3    { color: var(--amber); }

/* TOML tokens. */
.c { color: var(--text-dim); font-style: italic; }
.t { color: var(--flame-3); font-weight: 600; }
.k { color: var(--text); }
.s { color: var(--flame-1); }
.n { color: var(--amber); }
.p { color: var(--text-dim); }

/* Session animation. `.line` stays inline on purpose: the literal newlines
   between the spans do the line-breaking, so hiding a line with
   `visibility` leaves its line box — and the terminal's height — intact.
   Making these display:block would emit an anonymous block per newline
   (white-space:pre keeps them) and double-space the whole session. */
.session .line.is-hidden { visibility: hidden; }

.session .cmd::after {
  content: "";
  display: none;
  width: 0.55em; height: 1.05em;
  background: var(--flame-1);
  vertical-align: -0.18em;
}
.session .cmd.is-typing::after { display: inline-block; }

/* ──────────────────────────────────────────────────────── cmdline ── */

.cmdline {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px 11px 15px;
  overflow-x: auto;
}
.cmdline .prompt { flex: none; }
.cmdline code {
  color: var(--text);
  font-size: 13px;
  white-space: pre;
  flex: 1 1 auto;
}

.copy {
  flex: none;
  background: var(--bg-chrome);
  border: 1px solid var(--border-hi);
  color: var(--text-dim);
  font-family: var(--mono); font-size: 11.5px;
  padding: 4px 11px; border-radius: 5px;
  cursor: pointer;
  position: sticky; right: 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.copy:hover { color: var(--flame-1); border-color: var(--flame-1); }
.copy.done { color: var(--green); border-color: var(--green); }

/* ──────────────────────────────────────────────────────── compare ── */

.compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

/* ─────────────────────────────────────────────────────── features ── */

.features {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(268px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.features li {
  background: var(--bg-raised);
  padding: 22px 22px 24px;
  transition: background 0.15s ease;
}
.features li:hover { background: var(--bg-chrome); }

.features .num {
  display: block;
  color: var(--flame-3);
  font-size: 12px;
  margin-bottom: 10px;
}
.features h3 { margin-bottom: 6px; }
.features p { margin: 0; color: var(--text-dim); font-size: 14px; line-height: 1.6; }

/* ───────────────────────────────────────────────────────── config ── */

.config-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.config-notes h3 { margin-top: 0; color: var(--flame-1); }
.config-notes h3 + p { margin-top: 0; }
.config-notes > h3:not(:first-child) { margin-top: 30px; }
.config-notes p { color: var(--text-dim); font-size: 14.5px; }

.envvars {
  margin: 0 0 4px;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px 14px;
  font-size: 13px;
}
.envvars dt { color: var(--text); }
.envvars dd { margin: 0; color: var(--flame-1); }

/* ─────────────────────────────────────────────────────────── tabs ── */

.tablist {
  display: flex; flex-wrap: wrap; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}

.tablist [role="tab"] {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-family: var(--mono); font-size: 14px;
  padding: 9px 14px;
  cursor: pointer;
  margin-bottom: -1px;
}
.tablist [role="tab"]:hover { color: var(--text); }
.tablist [role="tab"][aria-selected="true"] {
  color: var(--flame-1);
  border-bottom-color: var(--flame-1);
}

[role="tabpanel"] { max-width: 74ch; }
[role="tabpanel"] p { color: var(--text-dim); font-size: 14.5px; }
[role="tabpanel"] .cmdline + p { margin-top: 14px; }
[role="tabpanel"] p + .cmdline { margin-top: 20px; }
[role="tabpanel"] strong { color: var(--text); }

/* ────────────────────────────────────────────────────────── table ── */

.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }

.cmds { border-collapse: collapse; width: 100%; min-width: 620px; font-size: 14px; }
.cmds th {
  text-align: left;
  background: var(--bg-chrome);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
}
.cmds td { padding: 10px 18px; border-bottom: 1px solid var(--border); vertical-align: top; }
.cmds tr:last-child td { border-bottom: 0; }
.cmds tbody tr { background: var(--bg-raised); }
.cmds tbody tr:hover { background: var(--bg-chrome); }
.cmds td:first-child { white-space: nowrap; }
.cmds td:first-child code {
  background: transparent; border: 0; padding: 0;
  color: var(--flame-1);
}
.cmds td:last-child { color: var(--text-dim); }

/* ───────────────────────────────────────────────────────── footer ── */

footer { border-top: 1px solid var(--border); padding: 30px 0 44px; }

.footer-inner {
  display: flex; flex-wrap: wrap; gap: 10px 26px;
  align-items: center; justify-content: space-between;
  font-size: 13px;
}
.footer-inner p { margin: 0; display: flex; align-items: center; gap: 9px; }
.footer-inner a { color: var(--text-dim); }
.footer-inner a:hover { color: var(--flame-1); }
.footer-inner .caret { width: 0.5em; height: 0.9em; }

/* ───────────────────────────────────────────────────────── mobile ── */

@media (max-width: 900px) {
  .hero-grid, .config-grid { grid-template-columns: minmax(0, 1fr); }
  .hero { padding: 36px 0 56px; }
  .band { padding: 56px 0; }
}

@media (max-width: 620px) {
  body { font-size: 15px; }
  .term-body pre, .cmdline code { font-size: 12px; }
  .brand span { display: none; }
  .topbar nav { margin-left: 0; }
  .hero-actions .btn { flex: 1 1 auto; text-align: center; }
}

/* ────────────────────────────────────────────────── reduced motion ── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .caret { opacity: 1; }
  .core { opacity: 1; }
}
