/* Sparky's site, in the same family as meeting-copilot's. Highlighter yellow
   marks the answers that matter, the terminal palette is the app's own, and
   keys look like keys. Type is Atkinson Hyperlegible, drawn for legibility
   first. No build step. */

:root {
  --sun: #FFC61A;
  --ink: #11161D;

  --paper: #FFFFFF;
  --paper-2: #F2F4F7;
  --text: #11161D;
  --muted: #4D5562;
  --line: rgba(17, 22, 29, 0.14);
  --rule: #11161D;
  --focus: #11161D;

  /* The yellow surfaces: the hero and the band at the end. */
  --hero: var(--sun);
  --hero-text: var(--ink);
  --hero-head: var(--ink);
  --hero-muted: rgba(17, 22, 29, 0.78);
  --hero-line: rgba(17, 22, 29, 0.3);
  --cap-face: rgba(255, 255, 255, 0.34);
  --term-shadow: 0 2px 0 rgba(17, 22, 29, 0.9), 0 40px 70px -36px rgba(74, 52, 0, 0.6);

  /* Highlighter. */
  --mark: #FFD24D;
  --mark-text: var(--ink);

  /* Keys. k1 is the primary key, k2 the plain one. */
  --k1-face: var(--sun);
  --k1-text: var(--ink);
  --k1-edge: var(--ink);
  --k2-face: var(--paper);
  --k2-text: var(--ink);
  --k2-edge: var(--ink);

  /* The app's palette (sparky/theme.py and the browser chat). */
  --t-bg: #0D1117;
  --t-panel: #161B22;
  --t-border: #30363D;
  --t-text: #E6EDF3;
  --t-muted: #8B949E;
  --r-green: #34D399;
  --r-cyan: #38BDF8;
  --r-magenta: #E879F9;
  --r-amber: #FBBF24;
  --r-red: #F87171;

  --sans: "Atkinson Hyperlegible Next", "Helvetica Neue", Arial, sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 40px);
  --section: clamp(4rem, 9vw, 7rem);

  color-scheme: light;
}

/* Dark: the yellow surfaces dim to a deep amber and the yellow moves into the
   type, so the page reads as the same highlighter, at night. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10151C;
    --paper-2: #161C25;
    --text: #E7EBF0;
    --muted: #A5AEBB;
    --line: rgba(231, 235, 240, 0.13);
    --rule: rgba(231, 235, 240, 0.55);
    --focus: var(--sun);
    --hero: #1F1909;
    --hero-text: #F2EAD0;
    --hero-head: var(--sun);
    --hero-muted: #C4B994;
    --hero-line: rgba(255, 198, 26, 0.28);
    --cap-face: rgba(255, 198, 26, 0.08);
    --term-shadow: 0 0 0 1px rgba(255, 198, 26, 0.12), 0 40px 70px -36px rgba(0, 0, 0, 0.8);
    --mark: rgba(255, 198, 26, 0.26);
    --mark-text: #FFF4D1;
    --k1-face: var(--sun);
    --k1-text: var(--ink);
    --k1-edge: #A07A00;
    --k2-face: transparent;
    --k2-text: var(--text);
    --k2-edge: rgba(231, 235, 240, 0.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #10151C;
  --paper-2: #161C25;
  --text: #E7EBF0;
  --muted: #A5AEBB;
  --line: rgba(231, 235, 240, 0.13);
  --rule: rgba(231, 235, 240, 0.55);
  --focus: var(--sun);
  --hero: #1F1909;
  --hero-text: #F2EAD0;
  --hero-head: var(--sun);
  --hero-muted: #C4B994;
  --hero-line: rgba(255, 198, 26, 0.28);
  --cap-face: rgba(255, 198, 26, 0.08);
  --term-shadow: 0 0 0 1px rgba(255, 198, 26, 0.12), 0 40px 70px -36px rgba(0, 0, 0, 0.8);
  --mark: rgba(255, 198, 26, 0.26);
  --mark-text: #FFF4D1;
  --k1-face: var(--sun);
  --k1-text: var(--ink);
  --k1-edge: #A07A00;
  --k2-face: transparent;
  --k2-text: var(--text);
  --k2-edge: rgba(231, 235, 240, 0.55);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 1rem; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, dl, dd, figure, ol, ul, pre { margin: 0; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
strong { font-weight: 700; }

code, kbd, pre { font-family: var(--mono); }
code { font-size: 0.9em; background: var(--paper-2); padding: 0.08em 0.32em; border-radius: 5px; overflow-wrap: break-word; }
.alt code { background: var(--paper); }
kbd {
  display: inline-block; min-width: 1.7em; text-align: center;
  font-size: 0.8em; font-weight: 700; line-height: 1.2;
  padding: 0.12em 0.4em 0.1em; border-radius: 0.35em;
  border: 1.5px solid currentColor; box-shadow: 0 2px 0 currentColor;
  vertical-align: 0.1em;
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--sun); padding: 8px 12px; border-radius: 8px; z-index: 5; }
.skip:focus { left: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1180px; margin: 0 auto; padding-inline: var(--gutter); }

/* The two brand marks: ink budgie on light, yellow budgie on dark. */
.mark-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mark-light { display: none; }
  :root:not([data-theme="light"]) .mark-dark { display: block; }
}
:root[data-theme="dark"] .mark-light { display: none; }
:root[data-theme="dark"] .mark-dark { display: block; }

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

/* Smaller than meeting-copilot's: "on a USB stick." has to fit beside the terminal. */
h1 {
  font-size: clamp(2.5rem, 1rem + 4.4vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 0.98;
  color: var(--hero-head);
}
.nobr { white-space: nowrap; }
h2 {
  font-size: clamp(2rem, 1.35rem + 2.3vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.028em;
  line-height: 1.04;
  max-width: 20ch;
  text-wrap: balance;
}
h3 { font-size: 1.3rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
.intro { font-size: clamp(1.15rem, 1.05rem + 0.4vw, 1.3rem); line-height: 1.55; max-width: 38rem; color: var(--muted); }
.fine { font-size: 0.95rem; color: var(--muted); max-width: 36rem; }

mark {
  background: var(--mark); color: var(--mark-text);
  padding: 0.12em 0.18em; border-radius: 0.2em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* ---------------------------------------------------------------- keys as buttons */

.actions { display: flex; flex-wrap: wrap; gap: 0.9rem 1rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px;
  padding: 0.7rem 1.3rem; border-radius: 12px;
  background: var(--k2-face); color: var(--k2-text);
  border: 2px solid var(--k2-edge); box-shadow: 0 4px 0 var(--k2-edge);
  font-weight: 700; font-size: 1rem; line-height: 1.2; text-decoration: none;
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, background-color 0.15s;
}
.btn:hover { text-decoration: none; background: color-mix(in srgb, var(--k2-face), var(--k2-text) 8%); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--k2-edge); }
.btn-primary { background: var(--k1-face); color: var(--k1-text); border-color: var(--k1-edge); box-shadow: 0 4px 0 var(--k1-edge); }
.btn-primary:hover { background: color-mix(in srgb, var(--k1-face), #fff 14%); }
.btn-primary:active { box-shadow: 0 1px 0 var(--k1-edge); }

/* ---------------------------------------------------------------- header and hero */

.top, .hero { background: var(--hero); color: var(--hero-text); }
.top { --focus: var(--hero-head); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1rem; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 800; font-size: 1.25rem; letter-spacing: -0.015em; text-decoration: none; color: var(--hero-head); }
.top nav { display: flex; align-items: center; gap: 0.3rem 1.5rem; flex-wrap: wrap; justify-content: flex-end; }
.top nav a { text-decoration: none; font-weight: 600; font-size: 1rem; }
.top nav a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.theme {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
  background: var(--cap-face); color: inherit; cursor: pointer;
  border: 1.5px solid currentColor; border-radius: 9px; box-shadow: 0 2px 0 currentColor;
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out;
}
.theme:active { transform: translateY(2px); box-shadow: 0 0 0 currentColor; }

.hero { --focus: var(--hero-head); padding-block: clamp(2rem, 1rem + 4vw, 4.5rem) clamp(3.5rem, 2rem + 5vw, 6.5rem); border-bottom: 1px solid var(--hero-line); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2.5rem, 5vw, 5rem); align-items: center; }
.lede { font-size: clamp(1.15rem, 1rem + 0.55vw, 1.375rem); line-height: 1.5; max-width: 33rem; margin-top: 1.6rem; }
.hero .actions { margin-top: 2rem; }
.hero .fine { color: var(--hero-muted); margin-top: 1.6rem; max-width: 33rem; }

/* Hero keys: ink on the yellow, yellow on the dimmed amber. */
.hero {
  --k1-face: var(--ink); --k1-text: var(--sun); --k1-edge: var(--ink);
  --k2-face: transparent; --k2-text: var(--ink); --k2-edge: var(--ink);
}
.hero .btn-primary { box-shadow: 0 4px 0 rgba(17, 22, 29, 0.42); }
.hero .btn-primary:hover { background: #1F2833; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero {
    --k1-face: var(--sun); --k1-text: var(--ink); --k1-edge: #A07A00;
    --k2-text: var(--sun); --k2-edge: rgba(255, 198, 26, 0.7);
  }
  :root:not([data-theme="light"]) .hero .btn-primary { box-shadow: 0 4px 0 #A07A00; }
  :root:not([data-theme="light"]) .hero .btn-primary:hover { background: #FFD24D; }
}
:root[data-theme="dark"] .hero {
  --k1-face: var(--sun); --k1-text: var(--ink); --k1-edge: #A07A00;
  --k2-text: var(--sun); --k2-edge: rgba(255, 198, 26, 0.7);
}
:root[data-theme="dark"] .hero .btn-primary { box-shadow: 0 4px 0 #A07A00; }
:root[data-theme="dark"] .hero .btn-primary:hover { background: #FFD24D; }

/* ---------------------------------------------------------------- the terminal, as the app draws it */

.term {
  background: var(--t-bg); color: var(--t-text);
  border: 1px solid var(--t-border); border-radius: 14px;
  font-family: var(--mono); font-size: 0.8125rem; line-height: 1.5;
  padding: 0.7rem 0.95rem 0.95rem;
  box-shadow: var(--term-shadow);
  overflow-wrap: anywhere;
}
.term-bar { display: flex; align-items: center; gap: 6px; color: var(--t-muted); font-size: 0.75rem; }
.term-bar span { width: 10px; height: 10px; border-radius: 50%; }
.term-bar span:nth-child(1) { background: #FF5F57; }
.term-bar span:nth-child(2) { background: #FEBC2E; }
.term-bar span:nth-child(3) { background: #28C840; }
.term-bar b { margin-inline: auto; font-weight: 400; padding-right: 36px; }
.dim { color: var(--t-muted); }
.ok { color: var(--r-green); }

/* The launch banner: the mark beside the version, model, mode and folder. */
.t-banner { display: flex; align-items: center; gap: 1rem; margin-top: 1.1rem; }
.t-banner img { flex: none; width: 48px; height: 48px; image-rendering: pixelated; }
.t-brand { color: var(--sun); }
.t-hint { margin-top: 0.7rem; }

/* The conversation. */
.t-log { margin-top: 1.2rem; }
.t-you { color: #fff; }
.t-you + .t-you { margin-top: 1rem; }
.arrow { color: var(--sun); font-weight: 700; }
.t-out { display: grid; margin-top: 0.75rem; }
.t-out > * { grid-area: 1 / 1; }
.t-think { visibility: hidden; align-self: start; }
.t-think.on { visibility: visible; }
.t-stats { margin-top: 0.5rem; }
.term .wait { visibility: hidden; }
.caret { color: var(--t-muted); animation: blink 1s steps(2, start) infinite; }

/* The bottom toolbar, full width like the terminal's. */
.t-bar {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 1.1em;
  margin: 1.2rem -0.95rem -0.95rem; padding: 0.45rem 0.95rem;
  background: var(--t-panel); border-top: 1px solid var(--t-border); border-radius: 0 0 13px 13px;
  color: var(--t-muted);
}
.t-model { color: #fff; border-radius: 2px; }
.t-model.flash { animation: swapped 1.4s ease-out; }
.kc { display: inline-block; background: #30363D; color: #fff; font-weight: 700; padding: 0 0.5em; margin-right: 0.3em; transition: transform 0.08s ease-out, box-shadow 0.15s; }
.kc-t { background: var(--sun); color: var(--ink); }
.kc.hit { transform: translateY(1px); box-shadow: 0 0 0 2px #fff; }

@keyframes swapped {
  0%, 40% { background: var(--sun); color: var(--ink); box-shadow: 0 0 0 2px var(--sun); }
  100% { background: transparent; color: #fff; box-shadow: 0 0 0 2px transparent; }
}
@keyframes blink { to { visibility: hidden; } }

.demo figcaption {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  margin-top: 1.1rem; font-size: 0.95rem; line-height: 1.5; color: var(--hero-muted);
}
.demo figcaption kbd { font-size: 0.85em; }
.replay {
  flex: none; font: inherit; font-weight: 700; color: var(--hero-text); cursor: pointer;
  background: none; border: 0; padding: 0.15rem 0; text-decoration: underline; text-underline-offset: 0.2em;
}

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

.section { padding-block: var(--section); }
.section.alt { background: var(--paper-2); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2.5rem, 6vw, 5.5rem); align-items: start; }
.split > div > * + * { margin-top: 1.1rem; }
.split > div > h2 + * { margin-top: 1.5rem; }

/* Who it is for */
.who-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 2.5rem clamp(2.5rem, 6vw, 5.5rem); }
.who-copy > * + * { margin-top: 1.2rem; }
.who-copy > h2 + * { margin-top: 1.5rem; }
.who-copy .intro { color: var(--text); }
.who-copy p:not(.intro) { color: var(--muted); max-width: 34rem; }
.who-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.4rem clamp(1.5rem, 3vw, 2.75rem); align-self: start; padding-top: 0.6rem; }
.who-list > div { border-top: 2px solid var(--rule); padding-top: 1rem; }
.who-list dt { font-size: 1.25rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; margin-bottom: 0.55rem; }
.who-list dd { color: var(--muted); }
.who-note { grid-column: 2; color: var(--muted); font-size: 1rem; max-width: 40rem; }

/* Set up a stick */
.steps { padding-left: 1.5rem; }
.split > div > .steps { margin-top: 1.8rem; }
.steps li { padding-left: 0.3rem; }
.steps li + li { margin-top: 0.9rem; }
.steps li::marker { font-weight: 700; }
.code {
  background: var(--t-bg); color: var(--t-text); border: 1px solid var(--t-border); border-radius: 12px;
  padding: 1rem 1rem; font-size: 0.78rem; line-height: 1.6; overflow-x: auto;
}
.code code { background: none; padding: 0; font-size: inherit; color: inherit; overflow-wrap: normal; }
.code .c { color: var(--t-muted); }
.code .p { color: var(--sun); }
.facts-list { list-style: none; padding: 0; }
.split > div > .facts-list { margin-top: 1.8rem; }
.facts-list li { padding-block: 1rem; border-top: 1px solid var(--line); color: var(--muted); }
.facts-list li:last-child { border-bottom: 1px solid var(--line); }
.facts-list strong { color: var(--text); }

/* Pick by purpose */
.section .wrap > h2 + .intro { margin-top: 1.4rem; }
.purposes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2.4rem clamp(1.25rem, 2.5vw, 2.25rem); margin-top: 3rem; }
.purposes > li { border-top: 2px solid var(--rule); padding-top: 1rem; }
.purposes h3 { font-size: 1.25rem; }
.purposes .tag { display: inline-block; margin-top: 0.5rem; font-size: 0.88rem; font-weight: 700; }
.purposes p { margin-top: 0.6rem; color: var(--muted); font-size: 1rem; }
.purposes > li.aside { border-top-style: dashed; }   /* a note, not a purpose */
.any { margin-top: 3rem; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem clamp(2rem, 5vw, 4rem); align-items: center; }
.any p { color: var(--muted); max-width: 34rem; }

/* Four ways to use it */
.ways { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.6rem clamp(2rem, 5vw, 4rem); margin-top: 3rem; }
.way { border-top: 2px solid var(--rule); padding-top: 1rem; }
.way h3 { margin-bottom: 0.6rem; }
.way > p { color: var(--muted); max-width: 34rem; }
.way .code { margin-top: 1.1rem; }
.keymap-h { margin-top: clamp(3.5rem, 7vw, 5rem); }
.keymap-h + p { margin-top: 0.6rem; }
.keymap { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.8rem clamp(1.25rem, 2.5vw, 2.25rem); margin-top: 1.6rem; }
.keymap > div { border-top: 2px solid var(--rule); padding-top: 0.9rem; }
.keymap dt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem; margin-bottom: 0.5rem; font-size: 1.05rem; }
.keymap dt code { font-weight: 700; }
.keymap dd { color: var(--muted); font-size: 1rem; }

/* How it runs */
.band { padding-block: var(--section); }
.band.dark { --focus: var(--sun); background: var(--t-bg); color: var(--t-text); }
.band.dark h2 { color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .band.dark { border-block: 1px solid var(--t-border); }
}
:root[data-theme="dark"] .band.dark { border-block: 1px solid var(--t-border); }
.runs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 2.5rem clamp(2rem, 5vw, 4.5rem); align-items: start; margin-top: 2.4rem; }
.flow {
  font-size: 0.86rem; line-height: 1.6; white-space: pre; overflow-x: auto;
  padding: 1.2rem 1.4rem; background: var(--t-panel); color: var(--t-muted);
  border: 1px solid var(--t-border); border-radius: 12px;
}
.flow b { color: #fff; font-weight: 700; }
.flow i { font-style: normal; }
.flow .fa { color: var(--sun); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem clamp(1.5rem, 3vw, 2.5rem); }
.facts > div { border-top: 2px solid var(--t-border); padding-top: 1rem; }
.facts dt { font-weight: 700; margin-bottom: 0.4rem; color: #fff; }
.facts dd { color: #A9B2BD; }
.facts code { background: var(--t-panel); color: var(--t-text); }

/* Where your data goes: back on the yellow */
.band.sun { --focus: var(--hero-head); background: var(--hero); color: var(--hero-text); }
.band.sun h2 { color: var(--hero-head); }
.band.sun h2 + p { margin-top: 1.8rem; }
.band.sun p { max-width: 36rem; }
.band.sun p + p { margin-top: 1.1rem; }
.band.sun code { background: var(--cap-face); }

/* Footer */
.foot { background: var(--paper-2); font-size: 0.95rem; }
.foot-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; padding-block: 1.8rem; }
.foot p { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--muted); }
.foot nav { display: flex; gap: 0.4rem 1.4rem; flex-wrap: wrap; }

/* ---------------------------------------------------------------- motion off */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .caret { animation: none; }
  .btn, .theme, .kc { transition: none; }
}

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

@media (max-width: 960px) {
  .hero-grid, .split, .who-grid, .runs, .any { grid-template-columns: minmax(0, 1fr); }
  .purposes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .keymap { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .who-note { grid-column: 1; }
}
@media (max-width: 760px) {
  .who-list, .facts, .ways { grid-template-columns: minmax(0, 1fr); }
  .keymap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top nav a:not(:last-of-type) { display: none; }   /* GitHub alone; the sections are one scroll away */
  .top nav { gap: 1rem; }
}
@media (max-width: 480px) {
  body { font-size: 1.0625rem; }
  .btn { width: 100%; }
  .term { font-size: 0.75rem; padding-inline: 0.7rem; }
  .t-bar { margin-inline: -0.7rem; padding-inline: 0.7rem; }
  .t-banner img { width: 40px; height: 40px; }
  .purposes { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .code { font-size: 0.72rem; padding-inline: 0.8rem; }
  .flow { font-size: 0.72rem; padding: 1rem 0.75rem; }
  .demo figcaption { flex-direction: column; gap: 0.5rem; }
}
