/* ---------------------------------------------------------------------------
   Jason Csizmadi — Portfolio v2 (designcraft build)
   Editorial spread with a working margin: sticky mono label rail + content
   track. Physical, responsive, intentional — the site demonstrates the
   designcraft doc instead of describing it.
--------------------------------------------------------------------------- */

/* Scales — every value below must come from these ramps:
   type:    11 / 13 / 16 / 26 / section clamp(28–40) / display clamp(42–112)
   spacing: 4 / 8 / 12 / 16 / 24 / 32 / 48 / 64 / 96 / 144
   width:   full-bleed canvas, fluid gutters via --pad-x (24 → 96px)
   radius:  6 (chips, kbd) / 12 (covers, cards) / 16 (dialog)
            + 999 pills + 50% circles
   shadow:  one light source, top. Dark-UI recipe: faint inner top highlight
            + hairline edge + grounding drop. Lift = stacked 2/4/8 drops. */
:root {
  --pad-x: clamp(24px, 6vw, 96px);
  --rail-w: 176px;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, monospace;
  --header-h: 56px;
  --ease-out-expo: cubic-bezier(0.23, 1, 0.32, 1);
}

[data-theme="light"] {
  --bg: #faf9f7;
  --bg-card: #ffffff;
  --bg-cover: #ffffff;
  --cover-icon: #e4e2dd;
  --cover-dot: rgba(26, 26, 28, 0.08);
  --text: #1a1a1c;
  --text-muted: #55555c;
  --text-faint: #9a9aa1;
  --line: #e9e7e2;
  --border-ui: #e4e2dd;
  --accent: #b07d10;
  --accent-soft: rgba(176, 125, 16, 0.1);
  --green: #1da462;
  --kbd-bg: #f0ede8;
  --overlay: rgba(26, 26, 28, 0.35);
  --toast-bg: #1a1a1c;
  --toast-text: #faf9f7;
  --shadow-card:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.75),
    inset 0 0 0 1px rgba(26, 26, 28, 0.08),
    0 30px 80px rgba(26, 26, 28, 0.14),
    0 8px 24px rgba(26, 26, 28, 0.1);
  --shadow-lift:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.75),
    inset 0 0 0 1px rgba(26, 26, 28, 0.08),
    0 40px 90px rgba(26, 26, 28, 0.18),
    0 10px 28px rgba(26, 26, 28, 0.12);
}

[data-theme="dark"] {
  --bg: #0a0a0b;
  --bg-card: #131316;
  --bg-cover: #121214;
  --cover-icon: #26262b;
  --cover-dot: rgba(255, 255, 255, 0.05);
  --text: #e8e8ea;
  --text-muted: #9b9ba3;
  --text-faint: #5e5e66;
  --line: #1c1c20;
  --border-ui: #232328;
  --accent: #e3b341;
  --accent-soft: rgba(227, 179, 65, 0.12);
  --green: #4ade80;
  --kbd-bg: #1c1c20;
  --overlay: rgba(0, 0, 0, 0.6);
  --toast-bg: #e8e8ea;
  --toast-text: #0a0a0b;
  --shadow-card:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.06),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 30px 80px rgba(0, 0, 0, 0.55),
    0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lift:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.06),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 40px 90px rgba(0, 0, 0, 0.65),
    0 10px 28px rgba(0, 0, 0, 0.5);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

a { color: inherit; }

em {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.06em;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  background: var(--kbd-bg);
  border: 1px solid var(--border-ui);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

::selection { background: var(--accent-soft); color: var(--accent); }

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

button { font-family: inherit; }

button:active { translate: 0 1px; } /* physical downstroke */

section[id] { scroll-margin-top: calc(var(--header-h) + 24px); }

/* --- Scroll progress hairline ---------------------------------------------- */

#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  z-index: 60;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  transition: background-color 0.3s ease;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--header-h);
  padding: 0 var(--pad-x);
}

.header-mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  transition: scale 0.15s ease;
}

.header-mark:active { scale: 0.96; }

.header-mark .avatar { transition: box-shadow 0.2s ease; }

.header-mark:hover .avatar { box-shadow: 0 0 0 3px var(--accent-soft); }

.mark-lockup { display: flex; flex-direction: column; line-height: 1.3; }

.mark-name { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }

.mark-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}

.header-spacer { flex: 1; }

.header-nav { display: flex; gap: 16px; margin-right: 4px; }

.header-nav a {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.header-nav a:hover { color: var(--accent); }

.cmdk-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border-ui);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.cmdk-trigger:hover { border-color: var(--accent); color: var(--text); }

.kbd-group { display: inline-flex; gap: 4px; }

.header-sep { width: 1px; height: 16px; background: var(--border-ui); }

.theme-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.theme-btn:hover { color: var(--text); background: var(--accent-soft); }

.theme-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  padding: 4px 8px;
  background: var(--toast-bg);
  color: var(--toast-text);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 6px;
  opacity: 0;
  translate: 0 -3px;
  pointer-events: none;
  transition: opacity 0.15s ease, translate 0.15s ease;
}

.theme-btn:hover::after { opacity: 1; translate: 0 0; transition-delay: 0.4s; }

[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }

/* --- Page + spread grid ------------------------------------------------------ */

.page {
  padding: 0 var(--pad-x);
}

.spread {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  gap: 32px;
  border-top: 1px solid var(--line);
  padding: 64px 0 96px;
}

.rail-label {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.spread-body { min-width: 0; }

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(28px, 3.6vw, 40px);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin-bottom: 48px;
}

.section-title em { color: var(--accent); font-size: 1em; }

/* --- Hero: full-height cover spread ------------------------------------------- */

.hero {
  display: flex;
  flex-direction: column;
  min-height: calc(100svh - var(--header-h));
  padding: 96px 0 64px;
}

.hero-foot { margin-top: auto; padding-top: 64px; }

.kicker {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.display {
  font-family: var(--font-serif);
  font-size: clamp(48px, 9.5vw, 168px);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.02;
  margin-top: 24px;
  min-height: 2.1em; /* reserve two lines so rotating statements never shift the page */
}

.display em { color: var(--accent); font-size: 1em; }

#display-line {
  display: inline-block;
  transition: opacity 0.25s ease, translate 0.25s ease;
  /* Own compositing layer: prevents per-glyph speckle while the
     statement crossfades at near-zero opacity on the dark bg */
  will-change: opacity, translate;
}

#display-line.flip-out { opacity: 0; translate: 0 12px; }
#display-line.flip-in { opacity: 0; translate: 0 -12px; transition: none; }

/* Builder-voice spans: mono, optically matched to the serif's x-height */
.display-mono {
  font-family: var(--font-mono);
  font-style: normal;
  font-weight: 500;
  font-size: 0.62em;
  letter-spacing: -0.04em;
  color: var(--accent);
}

.flip-word.flip-out { opacity: 0; translate: 0 12px; }
.flip-word.flip-in { opacity: 0; translate: 0 -12px; transition: none; }

.hero-annotation {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 12px;
  user-select: none;
}

.deck {
  max-width: 62ch;
  color: var(--text-muted);
}

.deck em { color: var(--accent); }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
}

.avatar {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.avatar span {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 32%;
  transform: scale(1.14);
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: color 0.2s ease;
}

a.meta-item:hover { color: var(--accent); }

.meta-sep { width: 1px; height: 12px; background: var(--border-ui); }

.time-diff { color: var(--text-faint); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18);
}

.copy-email {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s ease;
}

.copy-email:hover { color: var(--accent); }

/* --- Era strip ------------------------------------------------------------- */

.era-strip {
  position: relative;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 24px;
  padding-top: 32px;
}

.era-strip::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-ui);
}

.era { position: relative; }

.era-dot {
  position: absolute;
  top: -36.5px;
  left: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: color-mix(in oklab, var(--accent) calc(var(--p, 0) * 100%), var(--text-faint));
  scale: calc(1 + var(--p, 0) * 0.6);
  transition: scale 0.25s var(--ease-out-expo), background-color 0.25s ease;
}

.era-year {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  translate: 0 calc(var(--p, 0) * -2px);
  transition: translate 0.25s var(--ease-out-expo);
}

.era-name {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 400;
  line-height: 1.2;
  margin: 4px 0 8px;
}

.era-note { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* --- Work ------------------------------------------------------------- */

/* Live projects share the ledger DNA: one strong left edge, hairline rows */
.work-row {
  display: grid;
  grid-template-columns: minmax(320px, 480px) 1fr;
  gap: 48px;
  align-items: start;
  text-decoration: none;
  padding: 40px 0;
  border-top: 1px solid var(--line);
}

.work-row:first-of-type { border-top: none; padding-top: 0; }

.work-row:last-of-type { padding-bottom: 48px; }

/* Covers keep their image's own ratio — never crop the artifact.
   Frame recipe from Pixxxel .window: inset top highlight, hairline edge,
   deep grounding drops. On hover the whole frame lifts. */
.work-cover {
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-cover);
  box-shadow: var(--shadow-card);
  will-change: transform;
  transition: box-shadow 0.4s ease, translate 0.4s var(--ease-out-expo),
    scale 0.4s var(--ease-out-expo);
}

.work-cover img,
.work-cover video {
  display: block;
  width: 100%;
  height: auto;
}

.work-row:hover .work-cover {
  translate: 0 -4px;
  scale: 1.02;
  box-shadow: var(--shadow-lift);
}

.work-info { padding-top: 4px; } /* optical alignment with the cover's top edge */

.work-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.work-title h3 { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; }

.live-dot {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-soft);
  flex-shrink: 0;
}

.live-dot::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.work-stance { margin: 8px 0 12px; color: var(--text-muted); max-width: 44ch; }

.work-meta {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-faint);
}

.lab-head { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin-top: 64px; }

.lab-stance { margin: 4px 0 32px; color: var(--text-muted); }

.lab-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px 32px;
}

.lab-card { min-width: 0; }

.lab-cover {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  margin-bottom: 16px;
  background-color: var(--bg-cover);
  color: var(--cover-icon);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  will-change: transform;
}

/* Dot field fades toward the edges so the glyph stays the single focus */
.lab-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--cover-dot) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 20%, transparent 72%);
}

.lab-cover svg {
  position: relative;
  width: 40px;
  height: 40px;
}

.lab-card .work-title h3 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }

.lab-card .work-stance { margin: 4px 0 8px; font-size: 13px; }

/* --- Toolchain ------------------------------------------------------------- */

.toolchain-intro {
  max-width: 58ch;
  color: var(--text-muted);
  margin-bottom: 64px;
}

.toolchain-intro em { color: var(--accent); }

.stages {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
}

.stage {
  border-top: 1px solid var(--border-ui);
  padding-top: 16px;
  min-width: 0;
}

.stage-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
}

.stage-name {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 8px 0 12px;
}

.stage-tools {
  list-style: none;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  line-height: 1.9;
  margin-bottom: 12px;
}

.stage-why { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

.toolchain-coda {
  max-width: 58ch;
  margin-top: 48px;
  color: var(--text-muted);
}

.toolchain-coda em { color: var(--accent); }

/* --- Experience ledger --------------------------------------------------------- */

.ledger { display: flex; flex-direction: column; }

.ledger-co {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 24px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.ledger-co:first-child { border-top: none; padding-top: 0; }

.ledger-years {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}

.infinity { font-size: 13px; line-height: 1; }

.ledger-main { min-width: 0; }

.ledger-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.ledger-head h3 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }

.current-dot {
  position: relative;
  display: grid;
  place-items: center;
  width: 12px;
  height: 12px;
}

.current-dot::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.current-ping {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--green);
  opacity: 0.4;
  animation: ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
  80%, 100% { transform: scale(2); opacity: 0; }
}

.pos summary {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  border-radius: 6px;
  padding: 4px 8px 4px 0;
  transition: background-color 0.15s ease-out;
}

.pos summary::-webkit-details-marker { display: none; }

.pos summary:hover { background: var(--accent-soft); }

.pos summary h4 {
  font-size: 16px;
  font-weight: 550;
  letter-spacing: -0.005em;
  min-width: 0;
}

.pos-meta {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.pos-chevrons { color: var(--text-faint); flex-shrink: 0; transition: rotate 0.2s ease; }

.pos[open] .pos-chevrons { rotate: 180deg; }

.pos-body { padding: 8px 0 8px 0; }

.pos-body ul { list-style: none; }

.pos-body li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-muted);
}

.pos-body li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.pos-body li:last-child { margin-bottom: 0; }

.pos-body strong { color: var(--text); font-weight: 600; }

.ledger-extra .ledger-years { text-transform: uppercase; letter-spacing: 0.14em; font-size: 11px; }

.extra-line { font-size: 16px; color: var(--text-muted); }

.extra-line strong { color: var(--text); font-weight: 600; }

/* --- Writing ------------------------------------------------------------- */

.writing-list { display: flex; flex-direction: column; }

.writing-row {
  display: grid;
  grid-template-columns: 132px 1fr auto;
  gap: 24px;
  align-items: baseline;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
}

.writing-row:first-child { border-top: none; padding-top: 0; }

.writing-date {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.writing-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.writing-main strong {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: color 0.2s ease;
}

.writing-row:hover .writing-main strong { color: var(--accent); }

.writing-summary { font-size: 13px; color: var(--text-muted); }

.writing-arrow {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-faint);
  transition: translate 0.2s ease, color 0.2s ease;
}

.writing-row:hover .writing-arrow { translate: 2px -2px; color: var(--accent); }

/* --- Colophon ------------------------------------------------------------- */

.say-hi {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 96px;
}

.btn-talk {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #0a0a0b;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(227, 179, 65, 0.28);
  transition: translate 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease;
}

.btn-talk:hover { translate: 0 -2px; opacity: 0.92; }

.btn-talk:active { translate: 0 1px; box-shadow: 0 2px 6px rgba(227, 179, 65, 0.28); }

.outro-mail {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  text-decoration: none;
  transition: color 0.2s ease;
}

.outro-mail:hover { color: var(--accent); }

.colophon-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.colophon-head {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 16px;
}

.colophon-list { list-style: none; }

.colophon-list li { margin-bottom: 8px; font-size: 13px; color: var(--text-muted); }

.colophon-list a {
  text-decoration: none;
  font-family: var(--font-mono);
  transition: color 0.2s ease;
}

.colophon-list a:hover { color: var(--accent); }

.colophon-prose li { line-height: 1.7; margin-bottom: 12px; }

.colophon-prose em { color: var(--accent); }

.mono-hint { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }

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

footer { border-top: 1px solid var(--line); }

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 32px var(--pad-x) 64px;
}

.footnote { font-size: 13px; color: var(--text-faint); }

/* --- Command menu ------------------------------------------------------------ */

.cmdk-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--overlay);
  backdrop-filter: blur(2px);
  display: grid;
  justify-items: center;
  align-items: start;
  padding-top: 14vh;
}

.cmdk-overlay[hidden] { display: none; }

.cmdk-dialog {
  width: min(560px, calc(100vw - 32px));
  background: var(--bg);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: cmdk-in 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

@keyframes cmdk-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.cmdk-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 16px;
  color: var(--text-faint);
}

#cmdk-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
}

#cmdk-input::placeholder { color: var(--text-faint); }

.cmdk-close {
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
}

.cmdk-close:hover { color: var(--text); background: var(--accent-soft); }

.cmdk-list-frame {
  margin: 0 8px;
  border: 1px solid var(--border-ui);
  border-radius: 12px;
  background: var(--bg-card);
  overflow: hidden;
}

.cmdk-list {
  max-height: 320px;
  min-height: 200px;
  overflow-y: auto;
  padding: 8px;
  overscroll-behavior: contain;
}

.cmdk-group-heading {
  padding: 8px 8px 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
}

.cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.cmdk-item[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }

.cmdk-item .cmdk-icon {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.cmdk-item[aria-selected="true"] .cmdk-icon { color: var(--accent); }

.cmdk-item .cmdk-shortcut {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--text-faint);
}

.cmdk-empty {
  display: grid;
  place-items: center;
  padding: 32px 0;
  font-size: 13px;
  color: var(--text-faint);
}

.cmdk-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 42px;
  padding: 0 16px;
}

.jc-mark {
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--accent);
  color: #0a0a0b;
  font-family: var(--font-mono);
  font-weight: 600;
  user-select: none;
}

.jc-mark-sm { width: 22px; height: 22px; font-size: 11px; opacity: 0.6; }

.cmdk-footer-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.cmdk-footer-sep { width: 1px; height: 14px; background: var(--border-ui); margin: 0 4px; }

/* --- Toasts ------------------------------------------------------------- */

#toasts {
  position: fixed;
  bottom: 24px;
  left: 50%;
  translate: -50% 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 8px 16px;
  background: var(--toast-bg);
  color: var(--toast-text);
  font-size: 13px;
  font-weight: 500;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  animation: toast-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.3s ease, translate 0.3s ease;
}

.toast.toast-out { opacity: 0; translate: 0 8px; }

@keyframes toast-in {
  from { opacity: 0; translate: 0 12px; }
  to { opacity: 1; translate: 0 0; }
}

/* --- Staggered hierarchy entrances -------------------------------------------
   designcraft: "Animate the Hierarchy, Not Just the Layer." Sections get .rv;
   children carry --i and cascade in when the section enters the viewport.
   Gated on html.js so content is never hidden if the script fails to run. */

html.js .rv :where(.kicker, .display, .hero-annotation, .deck, .hero-meta,
  .section-title, .era, .work-row, .lab-head, .lab-stance, .lab-card,
  .toolchain-intro, .stage, .toolchain-coda, .ledger-co, .writing-row, .say-hi, .colophon-col) {
  opacity: 0;
  translate: 0 16px;
  transition: opacity 0.7s ease, translate 0.7s var(--ease-out-expo);
  transition-delay: calc(var(--i, 0) * 64ms);
}

html.js .rv.visible :where(.kicker, .display, .hero-annotation, .deck, .hero-meta,
  .section-title, .era, .work-row, .lab-head, .lab-stance, .lab-card,
  .toolchain-intro, .stage, .toolchain-coda, .ledger-co, .writing-row, .say-hi, .colophon-col) {
  opacity: 1;
  translate: 0 0;
}

/* --- Reduced motion (a first-class state, not a fallback) --------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  html.js .rv :where(.kicker, .display, .hero-annotation, .deck, .hero-meta,
    .section-title, .era, .work-row, .lab-head, .lab-stance, .lab-card,
    .toolchain-intro, .stage, .toolchain-coda, .ledger-co, .writing-row, .say-hi, .colophon-col) {
    opacity: 1;
    translate: none;
    transition: none;
  }

  #scroll-progress { display: none; }

  .era-dot, .era-year { transition: none; scale: none; translate: none; }

  .cmdk-dialog, .toast { animation: none; }

  .current-ping { animation: none; }

  #display-line { transition: none; }

  .work-row:hover .work-cover { translate: none; scale: none; }

  .btn-talk:hover { translate: none; }
}

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

@media (min-width: 1440px) {
  /* Full-width canvas: the Lab reads as a specimen shelf */
  .lab-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 960px) {
  .spread { grid-template-columns: 1fr; gap: 0; padding: 48px 0 64px; }

  .rail-label { position: static; margin-bottom: 24px; }

  .section-title { margin-bottom: 32px; }

  .era-strip { grid-template-columns: repeat(3, 1fr); gap: 32px 24px; }

  .era-dot { display: none; }

  .work-row { grid-template-columns: 1fr; gap: 16px; padding: 32px 0; }

  .stages { grid-template-columns: repeat(2, 1fr); gap: 32px 24px; }

  .lab-head { margin-top: 48px; }
}

@media (max-width: 640px) {
  .hero { min-height: auto; padding: 64px 0; }

  .hero-foot { padding-top: 48px; }

  /* longest statement runs three lines at phone widths */
  .display { min-height: 3.15em; }

  .mark-lockup { display: none; }

  .header-nav { gap: 12px; }

  .kbd-group { display: none; }

  .cmdk-trigger { width: 32px; justify-content: center; padding: 0; }

  .era-strip { grid-template-columns: 1fr; gap: 24px; padding-top: 0; }

  .era-strip::before { display: none; }

  .era { border-left: 1px solid var(--border-ui); padding-left: 16px; }

  .lab-grid { grid-template-columns: 1fr; gap: 32px; }

  .stages { grid-template-columns: 1fr; }

  .ledger-co { grid-template-columns: 1fr; gap: 4px; padding: 16px 0; }

  .writing-row { grid-template-columns: 1fr; gap: 4px; padding: 16px 0; }

  .writing-arrow { display: none; }

  .pos summary { flex-wrap: wrap; }

  .pos-meta { margin-left: 0; width: 100%; padding-left: 0; }

  .colophon-grid { grid-template-columns: 1fr; gap: 48px; }

  .say-hi { margin-bottom: 64px; }

  .footer-inner { flex-direction: column; }
}
