/* ==========================================================================
   GET /sparsha — styles
   Layers: tokens → base → chrome (header, rail, log, cmdline, boot) →
           sections (hero, routes, story, work, oss, offline, hello) → states
   ========================================================================== */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/bricolage-grotesque-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
  --bg: #F5F3EE;
  --bg-2: #ECE9E2;
  --ink: #151311;
  --ink-2: #47423C;
  --muted: #6B655C;
  --rule: #D6D1C6;
  --ruby: #B3261E;
  --ruby-ink: #8E1C16;
  --ruby-wash: rgb(179 38 30 / 0.08);
  --ruby-on-ink: #F2847D;
  --ok: #256B41;
  --shadow: rgb(21 19 17 / 0.18);
  --dot-bg: var(--ruby);
  --dot-shadow: none;

  --font-sans: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --gutter: clamp(1.25rem, 5vw, 4rem);
  --max: 1200px;
  --header-h: 4rem;
  --ease-out: cubic-bezier(0.2, 0.7, 0.1, 1);
  --ease-in-out: cubic-bezier(0.7, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.45, 0.64, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="day"]) {
    --bg: #121110;
    --bg-2: #1B1A18;
    --ink: #ECE8E0;
    --ink-2: #C7C1B6;
    --muted: #9A9387;
    --rule: #2F2C28;
    --ruby: #E5534B;
    --ruby-ink: #F2847D;
    --ruby-wash: rgb(229 83 75 / 0.12);
    --ruby-on-ink: #A3221B;
    --ok: #5DBB84;
    --shadow: rgb(0 0 0 / 0.5);
    --dot-bg: transparent;
    --dot-shadow: inset -0.16rem -0.06rem 0 0 var(--ink);
    color-scheme: dark;
  }
}

:root[data-theme="night"] {
  --bg: #121110;
  --bg-2: #1B1A18;
  --ink: #ECE8E0;
  --ink-2: #C7C1B6;
  --muted: #9A9387;
  --rule: #2F2C28;
  --ruby: #E5534B;
  --ruby-ink: #F2847D;
  --ruby-wash: rgb(229 83 75 / 0.12);
  --ruby-on-ink: #A3221B;
  --ok: #5DBB84;
  --shadow: rgb(0 0 0 / 0.5);
  --dot-bg: transparent;
  --dot-shadow: inset -0.16rem -0.06rem 0 0 var(--ink);
  color-scheme: dark;
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  transition: background-color 0.4s ease, color 0.4s ease;
}

img,
svg { display: block; max-width: 100%; }
img { height: auto; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
button { font: inherit; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

::selection { background: var(--ruby); color: var(--bg); }

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

[hidden] { display: none !important; }

.wrap {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.muted { color: var(--muted); }
.t-r { color: var(--ruby); }
.t-g { color: var(--ok); }
.t-m { color: var(--muted); }
.t-b { color: var(--ink); font-weight: 600; }

/* Syntax tokens (used in code panels, captions and the composer) */
.k { font-weight: 700; color: var(--ink); }
.c { font-weight: 600; color: var(--ink); }
.m { color: var(--ink-2); }
.f { font-weight: 700; }
.sym { color: var(--ruby); }
.str { color: var(--ok); }
.iv { color: var(--ruby-ink); font-style: italic; }
.cm { color: var(--muted); font-style: italic; }

kbd {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 0.05em 0.35em;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 3px;
  color: var(--ink);
  background: var(--bg);
}

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

.skip {
  position: fixed;
  left: 0.75rem;
  top: -4rem;
  z-index: 200;
  padding: 0.6rem 0.9rem;
  background: var(--ink);
  color: var(--bg);
  font: 500 0.8125rem/1 var(--font-mono);
  border-radius: 3px;
  text-decoration: none;
}
.skip:focus { top: 0.75rem; }

/* Placeholder marker: anything wrapped in .ph still needs real content. */
.ph {
  display: inline-block;
  padding: 0.28rem 0.42rem;
  font: 600 0.625rem/1 var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: 0.15em;
  color: var(--ruby);
  border: 1px dashed var(--ruby);
  border-radius: 2px;
  font-style: normal;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0 1.1rem;
  font: 500 0.875rem/1 var(--font-mono);
  border: 1px solid var(--ink);
  border-radius: 2px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out), background-color 0.2s, border-color 0.2s, color 0.2s;
}
.btn:active { transform: translateY(1px); }
.btn--solid { background: var(--ink); color: var(--bg); }
.btn--solid:hover { background: var(--ruby); border-color: var(--ruby); color: #fff; }
.btn--line { background: transparent; color: var(--ink); }
.btn--line:hover { background: var(--ink); color: var(--bg); }
.btn__verb { color: var(--ruby); transition: color 0.2s; }
.btn--line:hover .btn__verb { color: inherit; }

/* ==========================================================================
   Chrome
   ========================================================================== */

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding-inline: var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, opacity 0.6s 0.15s, background-color 0.4s;
}
.site-header.is-scrolled { border-bottom-color: var(--rule); }

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.wordmark .gem-sm { width: 1.05rem; transition: transform 0.5s var(--ease-spring); }
.wordmark:hover .gem-sm { transform: rotate(-12deg) scale(1.1); }
.wordmark__ext {
  margin-left: -0.35rem;
  font: 400 0.8125rem/1 var(--font-mono);
  color: var(--muted);
}

.gem-sm polygon { fill: var(--ruby); }
.gem-sm path {
  fill: none;
  stroke: var(--bg);
  stroke-width: 4;
  stroke-linejoin: round;
  opacity: 0.55;
}

.site-nav { margin-left: auto; }
.site-nav ul {
  display: flex;
  gap: 1.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav a {
  position: relative;
  display: inline-block;
  padding: 0.5rem 0;
  font: 500 0.8125rem/1 var(--font-mono);
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.2s;
}
.site-nav .verb {
  margin-right: 0.3em;
  font-size: 0.8em;
  color: var(--muted);
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.2rem;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s var(--ease-out);
}
.site-nav a:hover { color: var(--ink); }
.site-nav a:hover::after,
.site-nav a.is-current::after { transform: scaleX(1); transform-origin: left; }
.site-nav a.is-current { color: var(--ruby); }

.theme-toggle {
  display: none;
  align-items: center;
  gap: 0;
  padding: 0.45rem 0.6rem;
  font: 500 0.75rem/1 var(--font-mono);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.js .theme-toggle { display: inline-flex; }
.theme-toggle:hover { border-color: var(--ink); }
.theme-toggle__key { color: var(--muted); }
.theme-toggle__key::after { content: "="; margin-left: 0.1em; }
.theme-toggle__dot {
  width: 0.6rem;
  height: 0.6rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--dot-bg);
  box-shadow: var(--dot-shadow);
}

.menu-toggle {
  display: none;
  align-items: center;
  padding: 0.45rem 0.65rem;
  font: 500 0.75rem/1 var(--font-mono);
  color: var(--bg);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 2px;
  cursor: pointer;
}

@media (max-width: 959px) {
  .site-nav { display: none; }
  .theme-toggle { margin-left: auto; }
  .js .menu-toggle { display: inline-flex; }
}

/* ---------- Routes sheet (small screens) ---------- */

.sheet {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--bg);
  color: var(--ink);
}
.sheet::backdrop { background: rgb(0 0 0 / 0.35); }
.sheet[open] { animation: sheet-in 0.4s var(--ease-out); }
@keyframes sheet-in { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }

.sheet__inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 0 var(--gutter) 2rem;
}
.sheet__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  border-bottom: 1px solid var(--ink);
}
.sheet__title { margin: 0; font: 500 0.875rem/1 var(--font-mono); }
.sheet__close {
  padding: 0.45rem 0.65rem;
  font: 500 0.75rem/1 var(--font-mono);
  color: var(--ink);
  background: none;
  border: 1px solid var(--ink);
  border-radius: 2px;
  cursor: pointer;
}
.sheet__list { margin: 0.5rem 0 0; padding: 0; list-style: none; }
.sheet__list a {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  row-gap: 0.15rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}
.sheet__list .verb { grid-row: 1 / 3; padding-top: 0.55rem; font: 500 0.75rem/1 var(--font-mono); color: var(--ok); }
.sheet__list li:last-child .verb { color: var(--ruby); }
.sheet__list .path { font-size: 1.85rem; font-weight: 620; letter-spacing: -0.025em; line-height: 1.1; }
.sheet__list .note { font-size: 0.875rem; color: var(--muted); }
.sheet__list a:hover .path,
.sheet__list a:focus-visible .path { color: var(--ruby); }

/* ---------- Rail: the request's path ---------- */

.rail { display: none; }
.js .rail {
  display: block;
  position: fixed;
  left: calc(var(--gutter) / 2);
  top: calc(var(--header-h) + 1.5rem);
  bottom: 1.5rem;
  z-index: 30;
  width: 1px;
  pointer-events: none;
  transition: opacity 0.6s 0.2s;
}
.rail__track {
  position: absolute;
  inset: 0;
  background: var(--rule);
}
.rail__fill {
  position: absolute;
  inset: 0;
  background: var(--ruby);
  transform: scaleY(0);
  transform-origin: top;
}
.rail__node {
  position: absolute;
  top: 0;
  left: 0;
  width: 0.5rem;
  height: 0.5rem;
  margin: -0.25rem 0 0 -0.25rem;
  border: 1px solid var(--muted);
  border-radius: 50%;
  background: var(--bg);
  pointer-events: auto;
  cursor: pointer;
  transition: background-color 0.3s, border-color 0.3s;
}
.rail__node.is-passed { background: var(--ruby); border-color: var(--ruby); }
.rail__label {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font: 500 0.625rem/1 var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s, color 0.3s;
}
.rail__node:hover .rail__label { opacity: 1; }
@media (min-width: 1360px) {
  .rail__label { opacity: 1; }
  .rail__node.is-active .rail__label { opacity: 1; color: var(--ink); }
}
.rail__gem {
  position: absolute;
  top: 0;
  left: 0;
  width: 1.15rem;
  margin: -0.55rem 0 0 -0.575rem;
  opacity: 0;
  will-change: transform;
}
.rail__gem .gem-sm { width: 100%; transition: transform 0.4s var(--ease-spring); }
.rail__gem.is-pulse .gem-sm { animation: gem-pulse 0.6s var(--ease-spring); }
@keyframes gem-pulse {
  40% { transform: scale(1.6) rotate(-10deg); }
  100% { transform: none; }
}

@media (max-width: 640px) {
  .js .rail { left: 0.7rem; bottom: 4rem; }
}

/* ---------- Server log ---------- */

.log {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 45;
  width: min(24rem, calc(100vw - 2rem));
  font: 400 0.6875rem/1.6 var(--font-mono);
  color: var(--ink-2);
  background: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 3px;
  box-shadow: 0 14px 30px -18px var(--shadow);
  overflow: hidden;
  transition: opacity 0.25s, background-color 0.4s;
}
.log.is-passthrough[data-state="mini"] { pointer-events: none; }
.log.is-passthrough[data-state="mini"] .log__btn { pointer-events: auto; }
.log.is-see-through { opacity: 0.12; }
.log__bar {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.25rem 0.25rem 0.25rem 0.65rem;
  color: var(--bg);
  background: var(--ink);
}
.log__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.log__btn {
  padding: 0.2rem 0.45rem;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  opacity: 0.75;
  cursor: pointer;
}
.log__btn:hover { opacity: 1; border-color: color-mix(in srgb, var(--bg) 40%, transparent); }
.log__btn[aria-pressed="false"] { text-decoration: line-through; opacity: 0.5; }
.log__btn:focus-visible { outline-color: var(--bg); outline-offset: 0; }
.log__body {
  display: flex;
  flex-direction: column;
  height: calc(2 * 1.6em + 0.9rem);
  margin: 0;
  padding: 0.45rem 0.65rem;
  overflow: hidden;
  list-style: none;
}
.log__body > :first-child { margin-top: auto; }
.log[data-state="full"] .log__body {
  height: min(18rem, 50vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.log__line { flex: none; white-space: pre-wrap; overflow-wrap: anywhere; }

.log-tab {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 45;
  padding: 0.45rem 0.65rem;
  font: 500 0.6875rem/1 var(--font-mono);
  color: var(--bg);
  background: var(--ink);
  border: 0;
  border-radius: 3px;
  cursor: pointer;
}

@media (max-width: 640px) {
  .log { left: 0.5rem; right: 0.5rem; bottom: 0.5rem; width: auto; }
  .log-tab { right: 0.5rem; bottom: 0.5rem; }
  .log[data-state="mini"] .log__bar {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    padding: 0 0.2rem 0 0.4rem;
  }
  .log[data-state="mini"] .log__title,
  .log[data-state="mini"] [data-log-follow] { display: none; }
  .log[data-state="mini"] .log__body {
    height: calc(1.6em + 0.9rem);
    padding: 0.45rem 6.5rem 0.45rem 0.65rem;
  }
  .log[data-state="mini"] .log__line {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .log[data-state="full"] .log__body { height: min(15rem, 45vh); }
}

/* ---------- Vim command line ---------- */

.cmdline {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  height: 2.4rem;
  padding: 0 1rem env(safe-area-inset-bottom);
  font: 0.875rem/1 var(--font-mono);
  color: var(--bg);
  background: var(--ink);
}
.cmdline__prompt { color: var(--ruby); }
.cmdline__input {
  flex: 1;
  min-width: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  outline: none;
  caret-color: var(--ruby);
}
.cmdline__msg {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  margin: 0;
  padding: 0 1rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: var(--ink);
}
.cmdline.is-msg .cmdline__msg { display: flex; }
.cmdline__msg.is-err { color: var(--ruby); }

/* ---------- Boot overlay ---------- */

.boot { display: none; }
.is-booting .boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--gutter);
  padding-bottom: clamp(2rem, 9vh, 5rem);
  background: var(--bg);
}
.boot__screen {
  max-width: 64ch;
  margin: 0;
  font: clamp(0.75rem, 0.68rem + 0.3vw, 0.9375rem)/1.75 var(--font-mono);
  color: var(--ink-2);
  white-space: pre-wrap;
}
.boot__screen code { font: inherit; }
.boot__hint { margin: 1.5rem 0 0; font: 0.6875rem/1 var(--font-mono); color: var(--muted); }
.boot.is-leaving { animation: boot-out 0.75s var(--ease-in-out) forwards; }
@keyframes boot-out { to { clip-path: inset(0 0 100% 0); } }

.is-booting body { overflow: hidden; }
.is-booting .site-header,
.is-booting .rail,
.is-booting .log { opacity: 0; }

/* ==========================================================================
   Sections
   ========================================================================== */

.section { position: relative; padding-block: clamp(5rem, 11vw, 9rem); }

.sec-head {
  position: relative;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
  padding-top: clamp(1.75rem, 3.5vw, 2.75rem);
  border-top: 1px solid var(--ink);
}
.file-tab {
  position: absolute;
  top: 0;
  left: 0;
  max-width: 100%;
  margin: 0;
  padding: 0.5rem 0.75rem 0.45rem;
  overflow: hidden;
  font: 500 0.6875rem/1 var(--font-mono);
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--bg);
  background: var(--ink);
  border-radius: 3px 3px 0 0;
  transform: translateY(-100%);
}
.sec-layer {
  position: absolute;
  top: 0.75rem;
  right: 0;
  margin: 0;
  font: 0.6875rem/1 var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--muted);
}
.sec-title {
  max-width: 17ch;
  margin: 0;
  font-size: clamp(2.25rem, 1rem + 4.4vw, 4.75rem);
  font-weight: 620;
  font-stretch: 94%;
  line-height: 1;
  letter-spacing: -0.028em;
}
.sec-title code {
  font-family: var(--font-mono);
  font-size: 0.8em;
  font-weight: 500;
  letter-spacing: -0.05em;
  color: var(--ruby);
}
.sec-cmd {
  margin: 1.25rem 0 0;
  font: 0.875rem/1.5 var(--font-mono);
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.sec-lede { max-width: 46ch; margin: 0.75rem 0 0; font-size: 1.125rem; color: var(--ink-2); }

/* Line-mask reveal for headings */
.mask {
  display: block;
  overflow: hidden;
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
}
.mask > span { display: inline-block; text-wrap: balance; }

/* ---------- 01 · Hero ---------- */

.hero {
  display: flex;
  min-height: min(100vh, 58rem);
  min-height: min(100svh, 58rem);
  padding-top: calc(var(--header-h) + clamp(1.25rem, 4vh, 2.5rem));
  padding-bottom: clamp(1.25rem, 4vh, 2.25rem);
}
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  column-gap: clamp(1.5rem, 4vw, 4rem);
}
.hero__req {
  grid-column: 1 / -1;
  margin: 0;
  font: 0.8125rem/1.5 var(--font-mono);
  color: var(--ink-2);
}
.hero__gem {
  position: relative;
  z-index: 5;
  grid-column: 2;
  grid-row: 3;
  align-self: center;
  justify-self: end;
  width: clamp(6.5rem, 16vw, 15rem);
}
.hero__gem-art {
  position: relative;
  perspective: 700px;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}
.gem-big {
  width: 100%;
  height: auto;
  overflow: visible;
  transition: transform 0.7s var(--ease-out);
}
.gem-big .facet {
  fill: var(--ruby);
  fill-opacity: 0.4;
  stroke: var(--ink);
  stroke-width: 0.7;
  stroke-linejoin: round;
}
.gem-big .facet:nth-child(1) { fill-opacity: 0.32; }
.gem-big .facet:nth-child(2) { fill-opacity: 0.82; }
.gem-big .facet:nth-child(3) { fill-opacity: 0.55; }
.gem-big .facet:nth-child(4) { fill-opacity: 0.22; }
.gem-big .facet:nth-child(5) { fill-opacity: 0.12; }
.gem-big .facet:nth-child(6) { fill-opacity: 0.62; }
.gem-big .facet:nth-child(7) { fill-opacity: 0.3; }
.gem-big .facet:nth-child(8) { fill-opacity: 0.08; }
.hero__gem-shadow {
  position: absolute;
  left: 28%;
  right: 28%;
  bottom: -9%;
  height: 6%;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0.14;
  filter: blur(7px);
}
.hero__gem-note {
  margin: 1.75rem 0 0;
  font: 0.6875rem/1.4 var(--font-mono);
  color: var(--muted);
  text-align: center;
}

.hero__main { grid-column: 1; grid-row: 3; align-self: end; }
.hero__title {
  margin: 0;
  font-size: clamp(2.4rem, 0.9rem + 5.2vw, 5.9rem);
  font-weight: 650;
  font-stretch: 96%;
  line-height: 0.96;
  letter-spacing: -0.022em;
}
.hero__code {
  position: relative;
  font-family: var(--font-mono);
  font-size: 0.8em;
  font-weight: 500;
  letter-spacing: -0.05em;
  word-spacing: -0.3em;
  color: var(--ruby);
  white-space: nowrap;
}
.caret {
  display: inline-block;
  width: 0.38em;
  height: 0.78em;
  margin-left: 0.1em;
  vertical-align: -0.06em;
  background: var(--ruby);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero__lede {
  max-width: 34ch;
  margin: 1.5rem 0 0;
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  line-height: 1.45;
  color: var(--ink-2);
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }

.hero__meta {
  grid-column: 1 / -1;
  grid-row: 4;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem 1.5rem;
  margin: clamp(2rem, 6vh, 3.5rem) 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font: 0.75rem/1.5 var(--font-mono);
}
.hero__meta dt { color: var(--muted); }
.hero__meta dd { margin: 0.15rem 0 0; color: var(--ink-2); }

@media (max-width: 760px) {
  .hero__grid { grid-template-rows: auto auto minmax(0, 1fr) auto; }
  .hero__gem { grid-column: 1 / -1; grid-row: 2; justify-self: end; margin-block: 1.25rem 0; }
  .hero__main { grid-column: 1 / -1; }
  .hero__gem-note { display: none; }
  .hero__main { align-self: end; }
  .hero__meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero__at { display: block; }
}

/* ---------- 02 · Routes ---------- */

.routes__list { margin: 0; padding: 0; list-style: none; }
.route {
  position: relative;
  display: grid;
  grid-template-columns: 6rem 3.75rem minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 1rem;
  align-items: baseline;
  padding: 1.05rem 2.25rem 1.05rem 0.75rem;
  font: 0.875rem/1.4 var(--font-mono);
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: background-color 0.2s;
}
.route--head {
  padding-block: 0.75rem;
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom-color: var(--ink);
}
.route__prefix { text-align: right; color: var(--muted); }
.route--head span:first-child { text-align: right; }
.route__verb { color: var(--ok); }
.route__verb--post { color: var(--ruby); }
.route__uri { color: var(--ink); transition: color 0.2s; }
.route__action { color: var(--muted); }
.route__note { font-family: var(--font-sans); font-size: 1rem; color: var(--ink-2); }
a.route::after {
  content: "→";
  position: absolute;
  right: 0.75rem;
  top: 50%;
  color: var(--ruby);
  opacity: 0;
  transform: translate(-6px, -50%);
  transition: opacity 0.25s, transform 0.35s var(--ease-out);
}
a.route:hover { background: var(--bg-2); }
a.route:hover .route__uri { color: var(--ruby); }
a.route:hover::after,
a.route:focus-visible::after { opacity: 1; transform: translate(0, -50%); }
.routes__foot { margin: 1.25rem 0 0; font: 0.75rem/1.5 var(--font-mono); color: var(--muted); }

@media (max-width: 760px) {
  .route--head { display: none; }
  .route { grid-template-columns: 3.25rem minmax(0, 1fr); row-gap: 0.25rem; padding-left: 0; }
  .route__prefix,
  .route__action { display: none; }
  .route__note { grid-column: 2; font-size: 0.9375rem; }
}

/* ---------- 03 · Story ---------- */

.story__grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
}

.code-panel {
  margin: 0 0 2.5rem;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--ink);
  border-radius: 3px;
}
.code-panel__tab {
  padding: 0.6rem 0.9rem;
  font: 0.6875rem/1 var(--font-mono);
  color: var(--muted);
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}
.code {
  margin: 0;
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
  font: 0.8125rem/1.75 var(--font-mono);
  color: var(--ink);
  tab-size: 2;
}
.code code { font: inherit; }
.cb {
  margin: 0 -0.25em;
  padding: 0.1em 0.25em;
  border-radius: 2px;
  text-decoration: none;
  transition: background-color 0.2s;
}
.cb:hover,
.cb:focus-visible,
.cb.is-lit { background: var(--ruby-wash); }
.cb:hover .sym { text-decoration: underline; text-underline-offset: 0.2em; }

.prose p { max-width: 58ch; margin: 0 0 1.1rem; color: var(--ink-2); }
.prose p:first-child { font-size: 1.25rem; line-height: 1.5; color: var(--ink); }

.portrait {
  position: sticky;
  top: calc(var(--header-h) + 2rem);
  margin: 0;
}
.portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 3px;
  background: var(--bg-2);
}
.portrait__cap {
  margin-top: 0.75rem;
  font: 0.75rem/1.55 var(--font-mono);
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.callbacks {
  margin: clamp(3rem, 7vw, 5rem) 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--ink);
}
.callback {
  position: relative;
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 1.5rem;
  margin-inline: -0.75rem;
  padding: 1.4rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  transition: background-color 0.3s;
}
.callback__when { margin: 0; font: 0.8125rem/1.7 var(--font-mono); color: var(--muted); }
.callback__name { margin: 0 0 0.25rem; font: 500 0.875rem/1.5 var(--font-mono); color: var(--ruby); }
.callback__body p { max-width: 62ch; margin: 0; color: var(--ink-2); }
.callback.is-lit,
.callback:target { background: var(--ruby-wash); }

@media (max-width: 959px) {
  .story__grid { grid-template-columns: minmax(0, 1fr); }
  .portrait { position: static; max-width: 26rem; }
}
@media (max-width: 640px) {
  .callback { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; }
  .code { padding: 0.9rem 0.85rem; font-size: 0.6875rem; }
}

/* ---------- 04 · Work ---------- */

.scopes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.75rem;
  font-family: var(--font-mono);
}
.scopes__label { margin-right: 0.15rem; font-size: 0.875rem; }
.scope {
  padding: 0.55rem 0.7rem;
  font: 500 0.8125rem/1 var(--font-mono);
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}
.scope:hover { color: var(--ink); border-color: var(--ink); }
.scope[aria-pressed="true"] { color: var(--bg); background: var(--ink); border-color: var(--ink); }
.scopes__count { margin-left: auto; font-size: 0.75rem; color: var(--muted); }

.records { border-top: 1px solid var(--ink); }
.record {
  display: grid;
  grid-template-columns: 7rem minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(1.25rem, 3vw, 2.75rem);
  align-items: start;
  padding: clamp(2rem, 4vw, 3rem) 0;
  border-bottom: 1px solid var(--rule);
}
.record__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  font: 0.75rem/1.3 var(--font-mono);
  color: var(--muted);
}
.record__id { font-weight: 600; color: var(--ink); }
.record__status { padding: 0.22rem 0.42rem; border: 1px solid var(--rule); border-radius: 2px; }
.record__title {
  margin: 0;
  font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.6rem);
  font-weight: 620;
  font-stretch: 92%;
  line-height: 1.05;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}
.record__desc { max-width: 44ch; margin: 0.85rem 0 0; color: var(--ink-2); }
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1.1rem 0 0; padding: 0; list-style: none; }
.tags li {
  padding: 0.38rem 0.5rem;
  font: 0.6875rem/1 var(--font-mono);
  color: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
}
.record__links { display: flex; flex-wrap: wrap; gap: 1.25rem; margin: 1.4rem 0 0; }
.record__links a,
.more__foot a {
  font: 500 0.8125rem/1 var(--font-mono);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.35em;
  transition: color 0.2s, text-decoration-color 0.2s;
}
.record__links a:hover,
.more__foot a:hover { color: var(--ruby); text-decoration-color: currentColor; }

.record__cover {
  position: relative;
  container-type: inline-size;
  aspect-ratio: 16 / 10;
  margin: 0;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: 3px;
}
.record__cover img { width: 100%; height: 100%; object-fit: cover; object-position: top left; }
@media (hover: hover) {
  .record__cover img {
    filter: grayscale(1) contrast(1.04);
    transition: filter 0.6s var(--ease-out), transform 0.9s var(--ease-out);
  }
  .record:hover .record__cover img,
  .record:focus-within .record__cover img { filter: none; transform: scale(1.015); }
}

.record.is-entering { animation: enter 0.45s var(--ease-out); }
.more__list li.is-entering { animation: enter 0.35s var(--ease-out); }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }

/* GlowCart's 16×2 LCD: mirrors the real Arduino sketch (welcome text, 7s order light). */
.lcd {
  position: absolute;
  left: 4%;
  bottom: 6%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem;
  background: #16181A;
  border-radius: 4px;
  box-shadow: 0 8px 20px rgb(0 0 0 / 0.28);
}
.lcd__screen {
  display: grid;
  padding: 0.3em 0.45em;
  font: 600 0.625rem/1.3 var(--font-mono);
  font-size: clamp(0.5rem, 2cqi, 0.8125rem);
  letter-spacing: 0.08em;
  color: #1D260C;
  background: #9DB83A;
  border-radius: 2px;
  box-shadow: inset 0 0 0 2px rgb(0 0 0 / 0.16);
}
.lcd__row { display: block; white-space: pre; }
.lcd__row--order { display: none; }
.lcd__led {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: #4A1310;
  box-shadow: inset 0 -1px 1px rgb(255 255 255 / 0.2);
  transition: background-color 0.15s, box-shadow 0.3s;
}
.record--glowcart.is-order .lcd__row--idle { display: none; }
.record--glowcart.is-order .lcd__row--order { display: block; }
.record--glowcart.is-order .lcd__led {
  background: #FF4D3D;
  box-shadow: 0 0 6px 2px rgb(255 77 61 / 0.7), 0 0 18px 6px rgb(255 77 61 / 0.3);
}
.record--glowcart .record__cover { cursor: pointer; }

.more { margin-top: clamp(3rem, 6vw, 4.5rem); }
.more__query { margin: 0 0 1rem; font: 0.875rem/1.5 var(--font-mono); overflow-wrap: anywhere; }
.more__list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--ink); }
.more__list a {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: baseline;
  padding: 0.85rem 0.5rem;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: background-color 0.2s;
}
.more__list a:hover { background: var(--bg-2); }
.more__name { font: 500 0.875rem/1.4 var(--font-mono); color: var(--ink); overflow-wrap: anywhere; transition: color 0.2s; }
.more__list a:hover .more__name { color: var(--ruby); }
.more__desc { font-size: 0.9375rem; color: var(--ink-2); }
.more__year { font: 0.75rem/1 var(--font-mono); color: var(--muted); }
.more__empty { padding: 1rem 0.5rem; font: 0.8125rem/1.5 var(--font-mono); color: var(--muted); border-bottom: 1px solid var(--rule); }
.more__foot { margin: 1.5rem 0 0; }

@media (max-width: 959px) {
  .record { grid-template-columns: minmax(0, 1fr); gap: 1.1rem; }
  .record__meta { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
  .record__cover { order: 2; }
  .record__body { order: 3; }
}
@media (max-width: 700px) {
  .more__list a { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0.2rem; padding-inline: 0; }
  .more__desc { grid-column: 1 / -1; grid-row: 2; }
  .scopes__count { width: 100%; margin: 0.4rem 0 0; }
}

/* ---------- 05 · Open source ---------- */

.oss__stats { margin: 0 0 2rem; font: 0.875rem/1.5 var(--font-mono); }
.repo {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: clamp(1.25rem, 4vw, 3rem);
  padding: clamp(1.75rem, 3.5vw, 2.5rem) 0;
  border-top: 1px solid var(--rule);
}
.repo:first-child { border-top-color: var(--ink); }
.repo:last-child { border-bottom: 1px solid var(--rule); }
.repo__name { margin: 0; font: 600 1rem/1.35 var(--font-mono); overflow-wrap: anywhere; }
.repo__name a { text-decoration: none; }
.repo__name a:hover { color: var(--ruby); text-decoration: underline; }
.repo__desc { max-width: 34ch; margin: 0.5rem 0 0; font-size: 0.9375rem; color: var(--ink-2); }
.repo__count {
  display: inline-block;
  margin: 0.85rem 0 0;
  padding: 0.25rem 0.45rem;
  font: 0.6875rem/1 var(--font-mono);
  color: var(--ok);
  border: 1px solid currentColor;
  border-radius: 2px;
}
.prs { margin: 0; padding: 0; list-style: none; }
.prs a {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: baseline;
  padding: 0.7rem 0;
  text-decoration: none;
  border-bottom: 1px dashed var(--rule);
}
.prs li:last-child a { border-bottom: 0; }
.pr__num { font: 500 0.8125rem/1.4 var(--font-mono); color: var(--ruby); overflow-wrap: anywhere; }
.pr__title { font-size: 0.9375rem; color: var(--ink); }
.prs a:hover .pr__title { text-decoration: underline; text-underline-offset: 0.2em; }
.pr__date { font: 0.75rem/1 var(--font-mono); color: var(--muted); white-space: nowrap; }
.repo--misc .prs a { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0.15rem; }
.repo--misc .pr__num { grid-column: 1 / -1; font-size: 0.75rem; }
.repo--misc .pr__title { grid-row: 2; }
.repo--misc .pr__date { grid-row: 2; }

@media (max-width: 760px) {
  .repo { grid-template-columns: minmax(0, 1fr); }
  .prs a { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0.15rem; }
  .pr__num { grid-column: 1 / -1; }
  .pr__title,
  .pr__date { grid-row: 2; }
}

/* ---------- 06 · Offline ---------- */

.sound { display: none; }
.js .sound { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-top: 1.5rem; }
.sound__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  font: 500 0.75rem/1 var(--font-mono);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}
.sound__toggle:hover { border-color: var(--ink); }
.sound__toggle[aria-pressed="true"] { color: var(--bg); background: var(--ink); border-color: var(--ink); }
.sound__note { margin: 0; font: 0.6875rem/1.4 var(--font-mono); color: var(--muted); }

/* Equaliser bars: still when idle, moving while something plays */
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 0.7rem; }
.eq i { width: 2px; height: 35%; background: var(--ruby); border-radius: 1px; }
.is-playing .eq i,
.sound__toggle[aria-pressed="true"] .eq i { animation: eq 0.9s ease-in-out infinite; }
.is-playing .eq i:nth-child(2),
.sound__toggle[aria-pressed="true"] .eq i:nth-child(2) { animation-delay: -0.3s; }
.is-playing .eq i:nth-child(3),
.sound__toggle[aria-pressed="true"] .eq i:nth-child(3) { animation-delay: -0.6s; }
@keyframes eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }

.objects {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--rule);
}
.obj {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  min-height: 20rem;
  padding: 1.1rem 1.25rem 1.4rem;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  transition: background-color 0.3s;
}
.obj__file { grid-row: 1; margin: 0; font: 0.6875rem/1.3 var(--font-mono); color: var(--muted); }
.obj__art {
  grid-row: 2;
  justify-self: center;
  align-self: center;
  width: min(8.5rem, 72%);
  margin: 1rem 0;
  overflow: visible;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.55s var(--ease-spring);
}
.obj__art .thin { stroke-width: 1.4; }
.obj__art .acc { stroke: var(--ruby); }
.obj__art .acc-fill { fill: var(--ruby); stroke: none; }
.obj__cursor { animation: blink 1.1s steps(1) infinite; }
.obj__name { grid-row: 3; margin: 0; font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.obj__quip { grid-row: 4; margin: 0.35rem 0 0; font: 0.75rem/1.5 var(--font-mono); color: var(--muted); transition: color 0.3s; }
.obj__now {
  grid-row: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.5rem;
  margin: 0.6rem 0 0;
  font: 500 0.6875rem/1.4 var(--font-mono);
  color: var(--ink);
}
.obj__now a {
  position: relative;
  z-index: 2;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.3em;
}
.obj__now a:hover { color: var(--ruby); text-decoration-color: currentColor; }

/* The whole tile is the click target; the Apple Music link sits above it. */
.obj__btn { display: none; }
.js .obj__btn {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.js .obj__btn:focus-visible { outline: 2px solid var(--ruby); outline-offset: -4px; border-radius: 0; }

.obj:hover,
.obj.is-active { background: var(--bg-2); }
.obj:hover .obj__art,
.obj.is-active .obj__art { transform: rotate(-6deg) translateY(-6px) scale(1.05); }
.obj:hover .obj__quip,
.obj.is-active .obj__quip { color: var(--ink-2); }

@media (max-width: 959px) {
  .objects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .obj { min-height: 16rem; }
}
@media (max-width: 420px) {
  .obj { padding: 0.9rem 0.85rem 1.1rem; }
  .obj__name { font-size: 1rem; }
  .obj__file { font-size: 0.625rem; }
}

/* Hover card that follows the pointer (created by JS) */
.peek {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 55;
  width: 15rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  will-change: transform;
}
.peek.is-on { opacity: 1; }
.peek__inner {
  transform: rotate(var(--r, 0deg)) scale(0.86);
  transform-origin: 50% 60%;
  transition: transform 0.4s var(--ease-spring);
}
.peek.is-on .peek__inner { transform: rotate(var(--r, 0deg)) scale(1); }
.peek__frame {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: #141311;
  border: 1px solid var(--ink);
  border-radius: 4px;
  box-shadow: 0 24px 44px -20px rgb(0 0 0 / 0.5);
}
.peek__frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.22s;
}
.peek__frame img.is-shown { opacity: 1; }
.peek__cap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.45rem;
  width: max-content;
  max-width: 100%;
  margin: 0.5rem 0 0;
  padding: 0.4rem 0.55rem;
  font: 500 0.6875rem/1.3 var(--font-mono);
  color: var(--bg);
  background: var(--ink);
  border-radius: 3px;
}
.peek__title { flex: 1 1 0; min-width: 0; }
.peek__hint { flex-basis: 100%; opacity: 0.6; }
.peek__hint:empty,
.peek__kicker:empty { display: none; }
.peek__kicker { flex-basis: 100%; color: var(--ruby-on-ink); font-style: italic; }
.peek:not(.has-audio) .eq { display: none; }

/* Vim card inside the peek frame */
.vimcard {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 0.7rem 0.75rem 0.55rem;
  font: 0.6875rem/1.6 var(--font-mono);
  color: #E8E3DA;
  background: #141311;
}
.vimcard p { margin: 0; white-space: pre; }
.vimcard__buf { flex: 1; }
.vimcard .ln { display: inline-block; width: 1.6em; color: #6F685E; }
.vimcard .k { color: #F2847D; font-weight: 700; }
.vimcard .c { color: #F4F1EA; font-weight: 600; }
.vimcard .s { color: #8FD3A6; }
.vimcard .tilde { color: #4D5E7A; }
.vimcard__status { margin: 0.4rem -0.75rem 0 !important; padding: 0 0.75rem; color: #141311; background: #C9C3B8; }
.vimcard__mode { margin-right: 0.6rem; padding: 0 0.4rem; color: #fff; background: #B3261E; font-weight: 700; }
.vimcard__cmd { min-height: 1.6em; }
.vimcard__cursor { display: inline-block; width: 0.55em; height: 1.1em; vertical-align: -0.2em; background: #E8E3DA; animation: blink 1.1s steps(1) infinite; }

@media (max-width: 640px) {
  .peek { width: 11.5rem; }
  .vimcard { font-size: 0.5625rem; padding: 0.55rem 0.6rem 0.45rem; }
  .vimcard__status { margin-inline: -0.6rem !important; padding-inline: 0.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .peek__inner,
  .peek.is-on .peek__inner { transform: none; }
}

/* ---------- 07 · Hello ---------- */

.hello__status { max-width: 62ch; margin: 0 0 1.5rem; font: 0.8125rem/1.6 var(--font-mono); color: var(--ink-2); }
.hello__title { max-width: none; }
.hello__grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}
.hello__lede { max-width: 36ch; margin: 0; font-size: clamp(1.125rem, 1rem + 0.4vw, 1.3rem); color: var(--ink-2); }

.email { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin-top: 2rem; }
.email__link {
  font-size: clamp(1.3rem, 0.95rem + 1.6vw, 2.1rem);
  font-weight: 620;
  letter-spacing: -0.025em;
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
  transition: color 0.2s;
}
.email__link:hover { color: var(--ruby); }
.email__copy {
  padding: 0.45rem 0.65rem;
  font: 500 0.75rem/1 var(--font-mono);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.email__copy:hover { color: var(--bg); background: var(--ink); }

.links { margin: 2rem 0 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.links a {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr) auto;
  gap: 1rem;
  padding: 0.85rem 0;
  font: 0.875rem/1.4 var(--font-mono);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
.links__k { color: var(--muted); }
.links__v { color: var(--ink); transition: color 0.2s; }
.links__c { margin-left: 0.4rem; color: var(--muted); font-style: italic; }
.links a:hover .links__v { color: var(--ruby); }

.composer { background: var(--bg-2); border: 1px solid var(--ink); border-radius: 3px; }
.composer__tab {
  margin: 0;
  padding: 0.6rem 0.9rem;
  font: 0.75rem/1 var(--font-mono);
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  border-radius: 3px 3px 0 0;
}
.composer__code { padding: 1.1rem 1.2rem 0.4rem; font: 0.875rem/1.8 var(--font-mono); }
.composer__line { margin: 0; }
.composer__line--field { display: flex; align-items: baseline; gap: 0.35rem; padding-left: 2ch; }
.composer__line--body { align-items: flex-start; }
.composer__line--body label,
.composer__line--body .str { line-height: 2.2; }
.composer input,
.composer textarea {
  flex: 1;
  min-width: 0;
  padding: 0.15rem 0.25rem;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px dashed var(--muted);
  border-radius: 0;
}
.composer textarea { min-height: 6.5rem; line-height: 1.6; resize: vertical; }
.composer input::placeholder,
.composer textarea::placeholder { color: var(--muted); opacity: 1; }
.composer input:focus,
.composer textarea:focus { outline: none; background: var(--ruby-wash); border-bottom: 1px solid var(--ruby); }
.composer__error { min-height: 1.5em; margin: 0; padding: 0 1.2rem; font: 0.75rem/1.5 var(--font-mono); color: var(--ruby); }
.composer__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; padding: 0.5rem 1.2rem 1.2rem; }
.composer__note { margin: 0; font: 0.75rem/1.4 var(--font-mono); color: var(--muted); }

@media (max-width: 959px) {
  .hello__grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .composer__code { padding-inline: 0.85rem; font-size: 0.8125rem; }
  .composer__line--field { padding-left: 1ch; }
}

/* ---------- Footer ---------- */

.site-footer {
  padding-block: 2.5rem 3rem;
  border-top: 1px solid var(--ink);
}
.site-footer__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 2rem;
  font: 0.8125rem/1.7 var(--font-mono);
  color: var(--ink-2);
}
.site-footer p { margin: 0; }
.site-footer__motto { color: var(--ink); }
.site-footer__top { text-decoration-color: var(--rule); }
.site-footer__top:hover { color: var(--ruby); }
.vim-toggle {
  margin-left: 0.35rem;
  padding: 0.15rem 0.45rem;
  font: 0.75rem/1.4 var(--font-mono);
  color: var(--ink-2);
  background: none;
  border: 1px solid var(--rule);
  border-radius: 2px;
  cursor: pointer;
}
.vim-toggle:hover { border-color: var(--ink); color: var(--ink); }
.vim-toggle[aria-pressed="false"] { color: var(--muted); }

@media (min-width: 960px) {
  .site-footer__grid { grid-template-columns: 1.1fr 1fr 1.2fr; }
}
@media (max-width: 640px) {
  .site-footer { padding-bottom: 5rem; }
  .site-footer__grid { grid-template-columns: minmax(0, 1fr); }
  .wrap { padding-left: calc(var(--gutter) + 0.75rem); }
}

/* ==========================================================================
   Motion states
   ========================================================================== */

/* Scroll reveals (only when JS is running) */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.js .reveal.is-in { opacity: 1; transform: none; }
.js .mask > span {
  transform: translateY(105%);
  transition: transform 0.95s var(--ease-out);
}
.js .mask.is-in > span { transform: none; }
.js .mask + .mask > span { transition-delay: 0.08s; }

/* Hero entrance, triggered when the boot overlay leaves (or right away) */
.js .hero__req,
.js .hero__lede,
.js .hero__actions,
.js .hero__meta,
.js .hero__gem {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
.is-ready .hero .mask > span { transform: none; }
.is-ready .hero .mask:nth-child(2) > span { transition-delay: 0.1s; }
.is-ready .hero__req { opacity: 1; transform: none; transition-delay: 0.05s; }
.is-ready .hero__gem { opacity: 1; transform: none; transition-delay: 0.25s; }
.is-ready .hero__lede { opacity: 1; transform: none; transition-delay: 0.3s; }
.is-ready .hero__actions { opacity: 1; transform: none; transition-delay: 0.4s; }
.is-ready .hero__meta { opacity: 1; transform: none; transition-delay: 0.5s; }

@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;
    transition-delay: 0s !important;
  }
  .js .reveal,
  .js .mask > span,
  .js .hero__req,
  .js .hero__lede,
  .js .hero__actions,
  .js .hero__meta,
  .js .hero__gem { opacity: 1; transform: none; }
}

@media print {
  .rail, .log, .log-tab, .site-header, .cmdline, .boot, .skip { display: none !important; }
  .js .reveal, .js .mask > span { opacity: 1; transform: none; }
  .section { padding-block: 2rem; }
}
