/* ============================================================
   ajbarryiii.com
   Jet black, a mint-white ink, and three accents: aurora green, glacial
   cyan, ember. A light "paper" scheme behind :theme. One narrow column of
   text over a wall of typed code. The Kea-B console (end of this file) is
   lifted from wildernesslabs.ai and stays a dark instrument in both schemes.
   ============================================================ */

:root {
  --bg: #000000;
  --bg-rgb: 0, 0, 0;
  --ink: #e9f2ec;
  --ink-dim: #9aa7a0;
  --ink-faint: #5b665f;
  --aurora: #6dffa8;
  --aurora-rgb: 109, 255, 168;
  --glacier: #67e8f9;
  --glacier-rgb: 103, 232, 249;
  --ember: #f5c66b;
  --coral: #ff7d5e;
  --on-accent: #04120a;
  --line: rgba(233, 242, 236, 0.1);
  --line-strong: rgba(233, 242, 236, 0.2);
  --card: rgba(8, 9, 9, 0.66);
  --wall-alpha: 0.6;
  --col: 600px;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --vim-h: 2rem;
}

/* ---------- Colour schemes (:theme <name>; ids match js/theme.js) ----------
   Each block sets the variables on whatever carries data-theme: the <html>
   element for the page, or a single chip in :help previewing itself. */

[data-theme="default"] {
  --bg: #000000;
  --bg-rgb: 0, 0, 0;
  --ink: #e9f2ec;
  --ink-dim: #9aa7a0;
  --ink-faint: #5b665f;
  --aurora: #6dffa8;
  --aurora-rgb: 109, 255, 168;
  --glacier: #67e8f9;
  --glacier-rgb: 103, 232, 249;
  --ember: #f5c66b;
  --coral: #ff7d5e;
  --on-accent: #04120a;
  --line: rgba(233, 242, 236, 0.1);
  --line-strong: rgba(233, 242, 236, 0.2);
  --card: rgba(8, 9, 9, 0.66);
  --wall-alpha: 0.6;
}

[data-theme="light"] {
  --bg: #f4f5f1;
  --bg-rgb: 244, 245, 241;
  --ink: #101714;
  --ink-dim: #35403a;
  --ink-faint: #5f6b65;
  --aurora: #0b7a3e;
  --aurora-rgb: 11, 122, 62;
  --glacier: #0a6f86;
  --glacier-rgb: 10, 111, 134;
  --ember: #8f5a00;
  --coral: #bf3f23;
  --on-accent: #ffffff;
  --line: rgba(16, 23, 20, 0.14);
  --line-strong: rgba(16, 23, 20, 0.3);
  --card: rgba(255, 255, 255, 0.7);
  --wall-alpha: 0.62;
}

[data-theme="vscode"] {
  --bg: #1f1f1f;
  --bg-rgb: 31, 31, 31;
  --ink: #d4d4d4;
  --ink-dim: #a0a0a0;
  --ink-faint: #6f6f6f;
  --aurora: #569cd6;
  --aurora-rgb: 86, 156, 214;
  --glacier: #4ec9b0;
  --glacier-rgb: 78, 201, 176;
  --ember: #dcdcaa;
  --coral: #f14c4c;
  --on-accent: #ffffff;
  --line: rgba(212, 212, 212, 0.1);
  --line-strong: rgba(212, 212, 212, 0.22);
  --card: rgba(37, 37, 38, 0.7);
  --wall-alpha: 0.62;
}

[data-theme="rose-pine"] {
  --bg: #191724;
  --bg-rgb: 25, 23, 36;
  --ink: #e0def4;
  --ink-dim: #908caa;
  --ink-faint: #6e6a86;
  --aurora: #c4a7e7;
  --aurora-rgb: 196, 167, 231;
  --glacier: #9ccfd8;
  --glacier-rgb: 156, 207, 216;
  --ember: #f6c177;
  --coral: #eb6f92;
  --on-accent: #191724;
  --line: rgba(224, 222, 244, 0.1);
  --line-strong: rgba(224, 222, 244, 0.22);
  --card: rgba(31, 29, 46, 0.72);
  --wall-alpha: 0.6;
}

[data-theme="rose-pine-dawn"] {
  --bg: #faf4ed;
  --bg-rgb: 250, 244, 237;
  --ink: #575279;
  --ink-dim: #797593;
  --ink-faint: #9893a5;
  --aurora: #907aa9;
  --aurora-rgb: 144, 122, 169;
  --glacier: #56949f;
  --glacier-rgb: 86, 148, 159;
  --ember: #ea9d34;
  --coral: #b4637a;
  --on-accent: #faf4ed;
  --line: rgba(87, 82, 121, 0.14);
  --line-strong: rgba(87, 82, 121, 0.3);
  --card: rgba(255, 250, 243, 0.75);
  --wall-alpha: 0.62;
}

[data-theme="gruvbox"] {
  --bg: #282828;
  --bg-rgb: 40, 40, 40;
  --ink: #ebdbb2;
  --ink-dim: #a89984;
  --ink-faint: #7c6f64;
  --aurora: #b8bb26;
  --aurora-rgb: 184, 187, 38;
  --glacier: #8ec07c;
  --glacier-rgb: 142, 192, 124;
  --ember: #fe8019;
  --coral: #fb4934;
  --on-accent: #282828;
  --line: rgba(235, 219, 178, 0.1);
  --line-strong: rgba(235, 219, 178, 0.22);
  --card: rgba(50, 48, 47, 0.72);
  --wall-alpha: 0.6;
}

[data-theme="gruvbox-light"] {
  --bg: #fbf1c7;
  --bg-rgb: 251, 241, 199;
  --ink: #3c3836;
  --ink-dim: #665c54;
  --ink-faint: #928374;
  --aurora: #79740e;
  --aurora-rgb: 121, 116, 14;
  --glacier: #427b58;
  --glacier-rgb: 66, 123, 88;
  --ember: #b57614;
  --coral: #9d0006;
  --on-accent: #fbf1c7;
  --line: rgba(60, 56, 54, 0.14);
  --line-strong: rgba(60, 56, 54, 0.3);
  --card: rgba(242, 229, 188, 0.75);
  --wall-alpha: 0.62;
}

[data-theme="catppuccin"] {
  --bg: #1e1e2e;
  --bg-rgb: 30, 30, 46;
  --ink: #cdd6f4;
  --ink-dim: #a6adc8;
  --ink-faint: #7f849c;
  --aurora: #cba6f7;
  --aurora-rgb: 203, 166, 247;
  --glacier: #94e2d5;
  --glacier-rgb: 148, 226, 213;
  --ember: #fab387;
  --coral: #f38ba8;
  --on-accent: #1e1e2e;
  --line: rgba(205, 214, 244, 0.1);
  --line-strong: rgba(205, 214, 244, 0.22);
  --card: rgba(24, 24, 37, 0.72);
  --wall-alpha: 0.6;
}

[data-theme="nord"] {
  --bg: #2e3440;
  --bg-rgb: 46, 52, 64;
  --ink: #eceff4;
  --ink-dim: #b5bfcf;
  --ink-faint: #7b8699;
  --aurora: #88c0d0;
  --aurora-rgb: 136, 192, 208;
  --glacier: #81a1c1;
  --glacier-rgb: 129, 161, 193;
  --ember: #ebcb8b;
  --coral: #bf616a;
  --on-accent: #2e3440;
  --line: rgba(236, 239, 244, 0.1);
  --line-strong: rgba(236, 239, 244, 0.22);
  --card: rgba(59, 66, 82, 0.72);
  --wall-alpha: 0.6;
}

/* Quieter wall where there is a lot to read. */
[data-wall="quiet"] { --wall-alpha: 0.34; }
[data-wall="quiet"][data-kind="light"] { --wall-alpha: 0.36; }

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; overflow-x: clip; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--vim-h);
  transition: background-color 0.45s var(--ease-out), color 0.45s var(--ease-out);
}

::selection { background: rgba(var(--aurora-rgb), 0.28); }

a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line-strong); transition: color 0.25s, border-color 0.25s; }
a:hover { color: var(--aurora); border-bottom-color: rgba(var(--aurora-rgb), 0.5); }

kbd {
  font-family: var(--font-mono);
  font-size: 0.8em;
  padding: 0.04em 0.4em;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--ink-dim);
  background: rgba(var(--bg-rgb), 0.5);
}

/* ---------- Theme sweep (View Transitions, where available) ---------- */

::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

::view-transition-new(root) { animation: theme-sweep 0.75s var(--ease-out) forwards; }

@keyframes theme-sweep {
  from { clip-path: circle(0 at 2rem calc(100% - 1rem)); }
  to { clip-path: circle(160% at 2rem calc(100% - 1rem)); }
}

/* ---------- Wall ---------- */

.wall {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  transition: opacity 0.8s var(--ease-out);
}

.field-paused .wall { opacity: 0.35; }

main { position: relative; z-index: 2; transition: opacity 0.7s var(--ease-out); }

/* The window is open: the page steps aside, the picture is the page. */
.window-open main { opacity: 0.06; pointer-events: none; }
.doom main { opacity: 0; }
.doom .wall { cursor: none; }
.window-open .vim { opacity: 0.55; }

/* ---------- The column ---------- */

.page {
  position: relative;
  max-width: var(--col);
  margin: 0 auto;
  padding: 3rem 1.4rem 5rem;
}

.page--wide { --col: 760px; }

.page--home {
  min-height: calc(100svh - var(--vim-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 2rem;
  padding-bottom: 3rem;
}

/* A soft scrim the width of the column, the full height of the page, so prose
   reads over the wall while the code stays visible either side of it. */
.page::before {
  content: "";
  position: absolute;
  inset: -2rem -4rem;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(var(--bg-rgb), 0.82) 14%, rgba(var(--bg-rgb), 0.82) 86%, transparent),
    linear-gradient(180deg, transparent, rgba(var(--bg-rgb), 0.3) 10%, rgba(var(--bg-rgb), 0.3) 90%, transparent);
}

.page--home::before { inset: 0 -4rem; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 3rem;
  font-size: 0.86rem;
}

.top .back { color: var(--ink-dim); border: 0; }
.top .back:hover { color: var(--aurora); }

.keys { display: flex; gap: 0.5rem; justify-content: flex-end; }
.page--home .keys { position: absolute; top: 1.4rem; right: 1.4rem; }

.key {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  color: var(--ink-dim);
  background: rgba(var(--bg-rgb), 0.35);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.32rem 0.55rem;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.key kbd { font-size: 0.68rem; color: var(--ink-faint); border-bottom-width: 1px; }
.key__cur { color: var(--aurora); }
.key:hover { color: var(--ink); border-color: rgba(var(--aurora-rgb), 0.5); box-shadow: 0 0 18px rgba(var(--aurora-rgb), 0.15); }
.key:hover kbd { color: var(--ink-dim); }

.masthead h1,
.title {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 6vw, 3.2rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.title__sub { display: block; margin-top: 0.35rem; font-size: 0.55em; letter-spacing: -0.02em; color: var(--ink-dim); }

.tagline {
  margin-top: 0.9rem;
  color: var(--ink-dim);
  font-size: 0.95rem;
  line-height: 1.7;
  max-width: 52ch;
}

.tagline b { color: var(--ink); font-weight: 500; }

.rule { border: 0; border-top: 1px solid var(--line); margin: 1.7rem 0; }

.list { list-style: none; }

.list li {
  display: grid;
  grid-template-columns: 1.1rem minmax(0, 1fr);
  gap: 0.15rem 0.4rem;
  padding: 0.3rem 0.5rem 0.3rem 0;
  transition: background-color 0.3s, box-shadow 0.3s;
}

.list li::before { content: "-"; color: var(--ink-faint); grid-row: 1 / span 3; }
.list li > a { grid-column: 2; justify-self: start; }
.list .desc { grid-column: 2; color: var(--ink-dim); font-size: 0.9rem; line-height: 1.6; }
.list .date { grid-column: 2; color: var(--ink-faint); font-size: 0.78rem; letter-spacing: 0.04em; }
.list--roomy li { padding: 0.75rem 0.5rem 0.75rem 0; }
.list--roomy .desc { max-width: 62ch; }

.ext { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; font-size: 0.9rem; }

.hint { margin-top: 2.2rem; font-size: 0.78rem; color: var(--ink-faint); line-height: 1.9; }
.hint kbd { font-size: 0.72rem; }

.linkish {
  font: inherit;
  color: var(--ink-dim);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  padding: 0;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s;
}

.linkish:hover { color: var(--aurora); border-bottom-color: rgba(var(--aurora-rgb), 0.5); }

/* A piece on the proud page */
.piece { margin: 1.2rem 0 1.8rem; padding: 0.4rem 0.6rem 0.4rem 0; transition: box-shadow 0.3s, background-color 0.3s; }
.piece h2 { font-family: var(--font-display); font-size: 1.35rem; font-weight: 500; letter-spacing: -0.02em; margin-bottom: 0.5rem; }
.piece > p { color: var(--ink-dim); font-size: 0.92rem; line-height: 1.7; max-width: 64ch; }
.piece > p b { color: var(--ink); font-weight: 500; }
.piece .demo { margin: 1.3rem 0; }
.piece .ext { margin-top: 0.4rem; font-size: 0.84rem; }

.foot { margin-top: 3.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line); color: var(--ink-faint); font-size: 0.8rem; line-height: 1.8; }
.foot a { color: var(--ink-dim); }

/* A post */
.post .meta { color: var(--ink-faint); font-size: 0.78rem; letter-spacing: 0.04em; margin-top: 0.7rem; }
.post article { margin-top: 2.2rem; }
.post article h2 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 500; letter-spacing: -0.02em; margin: 2.4rem 0 0.8rem; }
.post article p { color: var(--ink-dim); font-size: 0.95rem; line-height: 1.75; margin-bottom: 1rem; }
.post article p b { color: var(--ink); font-weight: 500; }
.post article ul { margin: 0 0 1rem 1.1rem; color: var(--ink-dim); font-size: 0.95rem; line-height: 1.75; }
.post article code { font-size: 0.86em; padding: 0.08em 0.35em; border-radius: 4px; background: rgba(var(--aurora-rgb), 0.08); color: var(--ink); }
.post article pre {
  margin: 1.1rem 0 1.4rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  overflow-x: auto;
  font-size: 0.78rem;
  line-height: 1.65;
  color: var(--ink-dim);
}
.post article pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
.post article pre .k { color: var(--aurora); }
.post article pre .s { color: var(--glacier); }
.post article pre .c { color: var(--ink-faint); }

/* The vim cursor line. */
.is-cursor { box-shadow: inset 3px 0 0 var(--aurora); background-color: rgba(var(--aurora-rgb), 0.05); padding-left: 0.6rem; }

/* ---------- Status line ---------- */

.vim {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 0;
  height: var(--vim-h);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1;
  color: var(--ink-faint);
  background: rgba(var(--bg-rgb), 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  transition: opacity 0.7s var(--ease-out);
}

.vim__mode {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.9rem 0 1.1rem;
  height: 100%;
  color: var(--ink-dim);
  text-transform: lowercase;
  letter-spacing: 0.08em;
}

.vim__mode::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--aurora);
  box-shadow: 0 0 10px rgba(var(--aurora-rgb), 0.8);
  transition: background-color 0.25s, box-shadow 0.25s;
}

.vim[data-mode="COMMAND"] .vim__mode::before,
.vim[data-mode="SEARCH"] .vim__mode::before { background: var(--glacier); box-shadow: 0 0 10px rgba(var(--glacier-rgb), 0.8); }
.vim[data-mode="RECORDING"] .vim__mode::before { background: var(--coral); box-shadow: 0 0 10px var(--coral); animation: pulse 1.1s ease-in-out infinite; }
.vim[data-mode="RUNNING"] .vim__mode::before { background: var(--ember); box-shadow: 0 0 10px var(--ember); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.vim__path { padding: 0 0.9rem; height: 100%; display: inline-flex; align-items: center; color: var(--ink); border-left: 1px solid var(--line); border-right: 1px solid var(--line); }

.vim__line { flex: 1; min-width: 0; display: flex; align-items: center; padding: 0 0.9rem; color: var(--ink); }
.vim__form { display: flex; align-items: center; flex: 1; min-width: 0; }
.vim__form[hidden] { display: none; }
.vim__prefix { color: var(--ink); }
.vim__input { flex: 1; min-width: 0; font: inherit; color: var(--ink); background: none; border: 0; outline: none; padding: 0 0.1rem; caret-color: var(--aurora); }
.vim__input[hidden] { display: none; }
.vim__typed { white-space: pre; }
.vim__typed[hidden] { display: none; }
.vim__form.is-typing .vim__typed::after { content: ""; display: inline-block; width: 0.6em; height: 1em; vertical-align: -0.15em; background: var(--aurora); }
.vim__echo { flex: 1; min-width: 0; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vim__echo--error { color: var(--coral); }
.vim__hint { color: var(--ink-faint); white-space: nowrap; display: inline-flex; gap: 0.35rem; align-items: center; }
.vim__hint kbd { font-size: 0.66rem; padding: 0.02em 0.32em; border-bottom-width: 1px; }
.vim__form:not([hidden]) ~ .vim__echo,
.vim__form:not([hidden]) ~ .vim__hint,
.vim__echo:not(:empty) ~ .vim__hint { display: none; }
.vim__showcmd { min-width: 1.6rem; color: var(--ink); }
.vim__pos { padding: 0 1.1rem 0 0.9rem; height: 100%; display: inline-flex; align-items: center; color: var(--ink-dim); font-variant-numeric: tabular-nums; white-space: pre; border-left: 1px solid var(--line); }

/* ---------- Help ---------- */

.help {
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgb(var(--bg-rgb));
  color: var(--ink);
  padding: 1.5rem 1.6rem 1.3rem;
  width: min(720px, calc(100vw - 2rem));
  max-height: calc(100svh - 2rem);
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.5);
}

.help::backdrop { background: rgba(0, 0, 0, 0.6); }
.help[open] { animation: rise 0.35s var(--ease-out) both; }
.help__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.help h2 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 500; letter-spacing: -0.02em; }
.help h3 { font-size: 0.66rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 0.7rem; }
.help__cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 1.6rem; }
.help__cols > section { min-width: 0; }
.help dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.5rem 0.9rem; align-items: baseline; }
.help dt { color: var(--aurora); white-space: nowrap; }
.help dd { color: var(--ink-dim); line-height: 1.45; min-width: 0; overflow-wrap: anywhere; }
.help__themes { margin-top: 1.4rem; }
.help__chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* A scheme chip is painted with the scheme it names. */
.chip-theme {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  font-size: 0.76rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.38rem 0.8rem 0.38rem 0.55rem;
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s;
}

.chip-theme::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--aurora); box-shadow: 0 0 8px rgba(var(--aurora-rgb), 0.7); }
.chip-theme:hover { transform: translateY(-1px); box-shadow: 0 0 0 2px rgba(var(--aurora-rgb), 0.35); }
.help__foot { margin-top: 1.3rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--ink-faint); line-height: 1.5; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Reveal ---------- */

.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out); transition-delay: var(--d, 0s); }
.reveal--in { opacity: 1; transform: none; }

/* ---------- Buttons (the console uses these) ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.72rem 1.35rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.3s var(--ease-out), border-color 0.3s, background 0.3s, box-shadow 0.3s;
}

.btn svg { width: 17px; height: 17px; }
.btn:hover { transform: translateY(-2px); border-color: rgba(var(--aurora-rgb), 0.55); }
.btn:active { transform: translateY(0); }
.btn--solid { background: var(--aurora); border-color: var(--aurora); color: var(--on-accent); font-weight: 600; }
.btn--solid:hover { box-shadow: 0 0 34px rgba(var(--aurora-rgb), 0.35); border-color: var(--aurora); }
.btn--ghost:hover { background: rgba(var(--aurora-rgb), 0.06); }
.btn--sm { padding: 0.55rem 1.05rem; font-size: 0.82rem; }
.btn--sm svg { width: 15px; height: 15px; }

/* ============================================================
   Kea-B console — lifted from wildernesslabs.ai. Pinned to the dark
   instrument palette so it reads the same in both schemes.
   ============================================================ */

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

.demo {
  --ink: #e9f2ec;
  --ink-dim: #9aa7a0;
  --ink-faint: #57695f;
  --aurora: #6dffa8;
  --aurora-rgb: 109, 255, 168;
  --glacier: #67e8f9;
  --ember: #f5c66b;
  --on-accent: #04120a;
  --line: rgba(233, 242, 236, 0.09);
  --line-strong: rgba(233, 242, 236, 0.18);
  --lvl: 0;
  --accent: 109, 255, 168;
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: var(--ink);
  font-family: var(--font-display);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: linear-gradient(180deg, rgb(13, 15, 14), rgb(3, 4, 4));
  box-shadow: 0 50px 120px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(233, 242, 236, 0.07);
  overflow: hidden;
  isolation: isolate;
}

.demo::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(520px 240px at 50% -12%, rgba(var(--accent), 0.11), transparent 72%); transition: background 0.6s; }

.demo[data-state="loading"], .demo[data-state="transcribing"] { --accent: 103, 232, 249; }
.demo[data-state="recording"] { --accent: 255, 125, 94; }
.demo[data-state="unsupported"], .demo[data-state="error"] { --accent: 245, 198, 107; }

.demo__bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--line); font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.16em; text-transform: uppercase; }
.demo__id { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); white-space: nowrap; min-width: 0; }
.demo__spec { color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; }
.demo__spec::before { content: "/"; margin-right: 0.6rem; color: var(--line-strong); }
.demo__led { width: 7px; height: 7px; border-radius: 50%; flex: none; background: rgb(var(--accent)); box-shadow: 0 0 10px rgba(var(--accent), 0.9); transition: background 0.4s, box-shadow 0.4s; }
.demo[data-state="idle"] .demo__led { background: var(--ink-faint); box-shadow: none; }
.demo[data-state="loading"] .demo__led, .demo[data-state="transcribing"] .demo__led, .demo[data-state="recording"] .demo__led { animation: pulse 1.1s ease-in-out infinite; }
.demo__state { flex: none; padding: 0.28rem 0.65rem; border: 1px solid rgba(var(--accent), 0.3); border-radius: 999px; color: rgb(var(--accent)); background: rgba(var(--accent), 0.06); font-variant-numeric: tabular-nums; transition: color 0.4s, border-color 0.4s, background 0.4s; }
.demo[data-state="idle"] .demo__state { color: var(--ink-dim); border-color: var(--line-strong); background: transparent; }

.demo__viz { position: relative; height: 148px; padding: 0 1.25rem; border-bottom: 1px solid var(--line); background: linear-gradient(rgba(233, 242, 236, 0.035) 1px, transparent 1px) 0 50% / 100% 50%, linear-gradient(180deg, rgba(2, 3, 3, 0.55), rgba(2, 3, 3, 0.15)); -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent); mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent); }
.demo__viz canvas { display: block; width: 100%; height: 100%; }

.demo__body { flex: 1; display: flex; flex-direction: column; gap: 1.2rem; min-height: 372px; padding: clamp(1.4rem, 3vw, 2rem) clamp(1.2rem, 3vw, 2rem) clamp(1.2rem, 2.4vw, 1.6rem); }
.demo__panel { flex: 1; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.demo__panel[hidden] { display: none; }
.demo__panel--center { align-items: center; text-align: center; }
.demo__panel--in { animation: demo-in 0.55s var(--ease-out) both; }
@keyframes demo-in { from { opacity: 0; transform: translateY(8px); } }

.demo__help { margin-top: 1.1rem; font-size: 0.84rem; color: var(--ink-faint); max-width: 34ch; line-height: 1.55; }
.demo__note { margin-top: 1.1rem; font-family: var(--font-mono); font-size: 0.68rem; line-height: 1.5; color: var(--ember); border: 1px solid rgba(245, 198, 107, 0.28); background: rgba(245, 198, 107, 0.06); border-radius: 10px; padding: 0.5rem 0.75rem; max-width: 36ch; }
.demo__load { padding: 0.85rem 1.5rem; font-size: 0.95rem; }
.demo__link { font: inherit; color: var(--ink-dim); background: none; border: 0; border-bottom: 1px solid var(--line-strong); cursor: pointer; padding: 0; transition: color 0.25s, border-color 0.25s; }
.demo__link:hover { color: var(--ink); border-bottom-color: var(--ink-dim); }
.demo__link[hidden] { display: none; }
.demo__label { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-faint); }
.demo__msg { font-size: 1.02rem; line-height: 1.6; color: var(--ink); max-width: 48ch; }
.demo__msg--center { margin-bottom: 1.3rem; }
.demo__notice { font-size: 0.86rem; line-height: 1.55; color: var(--ember); text-align: center; border: 1px solid rgba(245, 198, 107, 0.24); background: rgba(245, 198, 107, 0.05); border-radius: 12px; padding: 0.7rem 1rem; animation: demo-in 0.45s var(--ease-out) both; }
.demo__notice[hidden] { display: none; }

.load__row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.load__phase { font-size: 1.08rem; font-weight: 500; letter-spacing: -0.01em; }
.load__count { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.load__bar { position: relative; height: 3px; margin: 1rem 0 0.85rem; border-radius: 99px; background: rgba(233, 242, 236, 0.08); overflow: hidden; }
.load__bar span { position: absolute; inset: 0; border-radius: inherit; transform-origin: left; transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, var(--glacier), var(--aurora)); box-shadow: 0 0 14px rgba(109, 255, 168, 0.7); transition: transform 0.25s linear; }
.demo[data-phase="verify"] .load__bar span::after, .demo[data-phase="compile"] .load__bar span::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent); background-size: 30% 100%; background-repeat: no-repeat; animation: shimmer 1.1s linear infinite; }
@keyframes shimmer { from { background-position: -40% 0; } to { background-position: 140% 0; } }
.load__row--sub { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.04em; color: var(--ink-faint); }

.rec { position: relative; display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; border: 0; cursor: pointer; color: #04120a; background: var(--aurora); box-shadow: 0 0 0 7px rgba(109, 255, 168, 0.1), 0 0 44px rgba(109, 255, 168, 0.28); transition: transform 0.35s var(--ease-out), background 0.35s, color 0.35s, box-shadow 0.35s; }
.rec > * { grid-area: 1 / 1; }
.rec:hover { transform: scale(1.04); box-shadow: 0 0 0 9px rgba(109, 255, 168, 0.14), 0 0 60px rgba(109, 255, 168, 0.42); }
.rec:active { transform: scale(0.97); }
.rec:disabled { cursor: progress; }
.rec__mic { width: 30px; height: 30px; }
.rec__stop { display: none; width: 22px; height: 22px; border-radius: 5px; background: currentColor; }
.rec__ring { position: absolute; inset: -16px; border-radius: 50%; border: 1px solid rgba(109, 255, 168, 0.26); pointer-events: none; animation: rec-breathe 3.2s ease-in-out infinite; }
@keyframes rec-breathe { 0%, 100% { transform: scale(0.94); opacity: 0.35; } 50% { transform: scale(1.06); opacity: 1; } }
.rec__spin { display: none; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(103, 232, 249, 0.12); border-top-color: var(--glacier); animation: spin 0.85s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
.demo[data-state="recording"] .rec { color: #1d0804; background: #ff7d5e; box-shadow: 0 0 0 calc(7px + var(--lvl) * 14px) rgba(255, 125, 94, 0.13), 0 0 calc(34px + var(--lvl) * 54px) rgba(255, 125, 94, 0.38); transition: transform 0.35s var(--ease-out), background 0.35s, color 0.35s, box-shadow 0.09s linear; }
.demo[data-state="recording"] .rec__ring { border-color: rgba(255, 125, 94, 0.4); animation: none; transform: scale(calc(1 + var(--lvl) * 0.3)); opacity: calc(0.35 + var(--lvl) * 0.65); transition: transform 0.09s linear, opacity 0.09s linear; }
.demo[data-state="recording"] .rec__mic { display: none; }
.demo[data-state="recording"] .rec__stop { display: block; }
.demo[data-state="transcribing"] .rec, .demo[data-state="arming"] .rec { color: var(--glacier); background: rgba(103, 232, 249, 0.07); box-shadow: inset 0 0 0 1px rgba(103, 232, 249, 0.22); transform: none; }
.demo[data-state="transcribing"] .rec__ring, .demo[data-state="arming"] .rec__ring { display: none; }
.demo[data-state="transcribing"] .rec__spin, .demo[data-state="arming"] .rec__spin { display: block; }
.rec__label { margin-top: 1.55rem; font-size: 1.06rem; font-weight: 500; letter-spacing: -0.01em; }
.rec__timer { margin-top: 0.3rem; font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.demo[data-state="recording"] #kea-elapsed { color: #ff9d85; }
.rec__limit { margin-top: 0.75rem; visibility: hidden; font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); opacity: 0; transition: opacity 0.4s; }
.demo[data-state="recording"] .rec__limit { opacity: 1; visibility: visible; }

.demo__panel[data-panel="result"] { justify-content: flex-start; }
.result__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; }
.result__src { min-width: 0; font-family: var(--font-mono); font-size: 0.66rem; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result__text { font-size: clamp(1.14rem, 1.75vw, 1.4rem); font-weight: 300; line-height: 1.55; letter-spacing: -0.012em; color: var(--ink); overflow-wrap: break-word; }
.result__text .w { display: inline-block; animation: word-in 0.6s var(--ease-out) both; animation-delay: var(--t, 0ms); }
@keyframes word-in { from { opacity: 0; transform: translateY(0.4em); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }
.result__empty { color: var(--ink-faint); }
.result__stats { display: flex; flex-wrap: wrap; row-gap: 0.25rem; margin-top: 1.15rem; font-family: var(--font-mono); font-size: 0.7rem; line-height: 1.6; color: var(--ink-faint); animation: demo-in 0.6s var(--ease-out) both; animation-delay: var(--t, 0ms); }
.result__stats span:not(:last-child)::after { content: "·"; margin: 0 0.6rem; color: var(--ink-faint); }
.result__stats b { color: var(--ink); font-weight: 500; }
.result__stats span:nth-child(3) b { color: var(--aurora); }
.result__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.4rem; }

.steps { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem; margin-top: auto; }
.steps[hidden] { display: none; }
.steps li { position: relative; display: flex; flex-direction: column; gap: 0.2rem; padding-top: 0.85rem; font-family: var(--font-mono); color: var(--ink-faint); transition: color 0.4s; }
.steps li::before, .steps li::after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; border-radius: 2px; background: var(--line); }
.steps li::after { background: var(--aurora); box-shadow: 0 0 10px rgba(109, 255, 168, 0.5); transform: scaleX(0); transform-origin: left; transition: transform 0.5s var(--ease-out), background 0.3s; }
.steps__n { font-size: 0.6rem; letter-spacing: 0.14em; }
.steps__t { font-family: var(--font-display); font-size: 0.86rem; color: var(--ink-dim); transition: color 0.4s; }
.steps__d { font-size: 0.62rem; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps li[data-s="active"] { color: var(--glacier); }
.steps li[data-s="active"] .steps__t { color: var(--ink); }
.steps li[data-s="active"]::after { background: var(--glacier); box-shadow: 0 0 10px rgba(103, 232, 249, 0.6); transform: scaleX(var(--p, 0.08)); }
.steps li[data-s="done"] { color: var(--aurora); }
.steps li[data-s="done"] .steps__t { color: var(--ink); }
.steps li[data-s="done"]::after { transform: scaleX(1); }


.pre { margin-top: 1.5rem; }
.pre[hidden] { display: none; }
.pre__list { list-style: none; display: grid; gap: 0.65rem; margin-top: 0.8rem; }
.pre__item { border: 1px solid var(--line); border-radius: 14px; padding: 0.9rem 1rem; background: rgba(233, 242, 236, 0.02); }
.pre__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.3rem 1rem; margin-bottom: 0.45rem; }
.pre__title { font-size: 0.9rem; font-weight: 500; }
.pre__meta { font-family: var(--font-mono); font-size: 0.62rem; color: var(--ink-faint); }
.pre__text { font-size: 0.92rem; font-weight: 300; line-height: 1.6; color: var(--ink-dim); }
.pre__credit { margin-top: 0.5rem; font-family: var(--font-mono); font-size: 0.6rem; line-height: 1.6; color: var(--ink-faint); opacity: 0.8; }

.demo__foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 1.25rem; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.demo__private { display: inline-flex; align-items: center; gap: 0.45rem; white-space: nowrap; }
.demo__private svg { width: 12px; height: 12px; color: var(--aurora); }
.demo__adapter { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; letter-spacing: 0.04em; }

.demo :focus-visible, .btn:focus-visible, .key:focus-visible, .linkish:focus-visible, a:focus-visible { outline: 2px solid var(--glacier); outline-offset: 3px; }
.rec:focus-visible { outline-offset: 22px; }
.demo:focus { outline: none; }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .vim__mode::before, .help[open] { animation: none !important; }
  html { scroll-behavior: auto; }
  ::view-transition-new(root) { animation: none; }
  .demo__led, .rec__ring, .demo__panel--in, .demo__notice, .result__stats, .result__text .w, .load__bar span::after { animation: none !important; }
  .rec__spin { animation-duration: 2.4s; }
  .wall, .load__bar span, main { transition: none; }
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  :root { --wall-alpha: 0.36; }
  [data-wall="quiet"] { --wall-alpha: 0.26; }
  .page::before { inset: -2rem 0; }
  .page--home::before { inset: 0; }
  .help__cols { grid-template-columns: 1fr; }
  .vim__hint { display: none; }
}

@media (max-width: 520px) {
  body { font-size: 14px; }
  .page { padding-left: 1.1rem; padding-right: 1.1rem; }
  .page--home .keys { position: static; justify-content: flex-start; margin-bottom: 2rem; }
  .vim { font-size: 0.66rem; }
  .vim__path { display: none; }
  .help dt { white-space: normal; }
  .demo { border-radius: 18px; }
  .demo__bar, .demo__foot { padding-left: 1rem; padding-right: 1rem; }
  .demo__spec { display: none; }
  .demo__viz { height: 116px; padding: 0 0.8rem; }
  .demo__body { min-height: 270px; }
  .rec { width: 76px; height: 76px; }
  .demo__private { letter-spacing: 0.1em; }
  .demo__foot { flex-wrap: wrap; row-gap: 0.35rem; }
  .demo__adapter { white-space: normal; }
  .steps { gap: 0.7rem; }
  .steps__d { white-space: normal; line-height: 1.45; }
  .result__head { flex-direction: column; gap: 0.35rem; }
  .result__src { white-space: normal; }
}
