/* ==========================================================================
   Design system
   ========================================================================== */
:root {
  color-scheme: dark;

  /* surfaces */
  --bg: #08090b;
  --bg-1: #0c0e11;
  --bg-2: #111318;
  --bg-3: #171a20;
  --bg-4: #1e222a;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --line-3: rgba(255, 255, 255, 0.2);

  /* text */
  --text: #e8eaed;
  --text-2: #a3a9b3;
  --text-3: #7f8691;

  /* accents */
  --accent: #5cb6ff;
  --accent-2: #8f9bff;
  --accent-soft: rgba(92, 182, 255, 0.12);
  --accent-line: rgba(92, 182, 255, 0.35);
  --amber: #f0b45e;
  --amber-soft: rgba(240, 180, 94, 0.12);
  --ok: #5fd0b4;
  --err: #ff7a85;

  /* macOS window controls */
  --light-close: #ff5f57;
  --light-min: #febc2e;
  --light-max: #28c840;

  /* syntax */
  --syn-kw: #a495ff;
  --syn-fn: #5cb6ff;
  --syn-str: #e7c07f;
  --syn-num: #f0a35e;
  --syn-com: #5d636e;
  --syn-prop: #84d3e8;
  --syn-dec: #f0b45e;

  /* type */
  --font-sans: "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* geometry */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --container: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 56px;

  /* motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-1: 140ms;
  --dur-2: 260ms;
  --dur-3: 600ms;

  --shadow-window: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 30px 80px -20px rgba(0, 0, 0, 0.7),
    0 0 0 1px var(--line);
}

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

html {
  -webkit-text-size-adjust: 100%;
  /* in-page navigation is animated in JS (scrollToSection) */
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* faint engineering grid behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
  opacity: 0.55;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

code,
kbd,
pre,
.mono {
  font-family: var(--font-mono);
}

::selection {
  background: rgba(92, 182, 255, 0.3);
  color: #fff;
}

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

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 8px 14px;
  background: var(--accent);
  color: #001020;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transform: translateY(-150%);
  transition: transform var(--dur-2) var(--ease-out);
}

.skip-link:focus {
  transform: none;
}

/* content spans 80% of the screen: 10% space on each side */
.container {
  width: 100%;
  margin-inline: auto;
  padding-inline: 10vw;
}

/* tablets and phones keep a fixed gutter so content isn't squeezed */
@media (max-width: 860px) {
  .container {
    padding-inline: var(--gutter);
  }
}

/* ==========================================================================
   Primitives
   ========================================================================== */
.btn {
  --mx: 0px;
  --my: 0px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  color: var(--text);
  transform: translate(var(--mx), var(--my));
  transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1),
    transform var(--dur-2) var(--ease-out);
}

.btn:hover {
  background: var(--bg-3);
  border-color: var(--line-3);
}

.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.btn--primary {
  background: var(--text);
  color: #0a0b0d;
  border-color: transparent;
}

.btn--primary:hover {
  background: #fff;
  border-color: transparent;
}

.btn--accent {
  background: var(--accent);
  color: #001426;
  border-color: transparent;
}

.btn--accent:hover {
  background: #7cc5ff;
  border-color: transparent;
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}

.btn--ghost:hover {
  color: var(--text);
  background: var(--bg-2);
  border-color: var(--line);
}

.btn--icon {
  width: 40px;
  padding: 0;
  justify-content: center;
}

.btn--sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.btn .arrow {
  transition: transform var(--dur-2) var(--ease-out);
}

.btn:hover .arrow {
  transform: translateX(3px);
}

kbd,
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
  background: var(--bg-3);
  color: var(--text-2);
  font-size: 11px;
  font-family: var(--font-mono);
  line-height: 1;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}

.chip--accent {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(95, 208, 180, 0.15);
  flex: none;
}

.dot--accent {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.dot--amber {
  background: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
}

.dot--pulse {
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    box-shadow: 0 0 0 6px transparent;
  }
}

.todo {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px dashed rgba(240, 180, 94, 0.4);
  padding: 1px 6px;
  border-radius: 4px;
}

/* Window chrome used by editor, terminal, previews */
.window {
  position: relative;
  background: var(--bg-1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-window);
  overflow: hidden;
}

.window__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 38px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
}

.window__lights {
  display: flex;
  gap: 6px;
}

.window__lights span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--light-close);
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.25);
}

.window__lights span:nth-child(2) {
  background: var(--light-min);
}

.window__lights span:nth-child(3) {
  background: var(--light-max);
}

.window__title {
  flex: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(8, 9, 11, 0.72);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-2), opacity 600ms var(--ease-out), transform 700ms var(--ease-out);
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-2);
  min-width: 0;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #050a14;
  flex: none;
}

.brand__mark svg {
  width: 18px;
  height: 18px;
}

.brand__cursor {
  animation: blink 1.1s steps(1) infinite;
}

.brand__path {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand__path b {
  color: var(--text);
  font-weight: 500;
}

.brand__path .seg {
  color: var(--accent);
  transition: opacity var(--dur-2);
}

.brand__wave {
  display: inline-block;
  font-size: 15px;
  line-height: 1;
  transform-origin: 70% 70%;
  animation: wave 1.8s ease-in-out 0.6s 1;
}

.brand__wave.is-pop {
  animation: emoji-pop 420ms var(--ease-out);
}

@keyframes emoji-pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.6);
  }
  60% {
    transform: translateY(-1px) scale(1.12);
  }
}

.brand:hover .brand__wave {
  animation: wave 1.2s ease-in-out 1;
}

@keyframes wave {
  0%, 60%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  40% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
}

.nav {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.nav a {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--text-2);
  transition: color var(--dur-1), background var(--dur-1);
}

.nav a:hover,
.nav a[aria-current="true"] {
  color: var(--text);
  background: var(--bg-2);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.palette-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 8px 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  color: var(--text-3);
  font-size: 13px;
  transition: border-color var(--dur-1), color var(--dur-1);
}

.palette-trigger:hover {
  border-color: var(--line-3);
  color: var(--text-2);
}

.palette-trigger .keys {
  display: flex;
  gap: 3px;
}

.palette-trigger__label-mobile {
  display: none;
}

/* ==========================================================================
   Sections
   ========================================================================== */
.section {
  padding-block: clamp(48px, 6vw, 80px);
  position: relative;
}

.section--tight {
  padding-block: clamp(36px, 4.5vw, 56px);
}

/* the section right after the hero shouldn't double the hero's bottom space */
.hero + .section {
  padding-top: clamp(32px, 4vw, 48px);
}

.section-head {
  display: grid;
  gap: 12px;
  margin-bottom: clamp(24px, 3vw, 36px);
  max-width: 720px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-3);
  letter-spacing: 0.01em;
}

.eyebrow__num {
  color: var(--accent);
}

.eyebrow::after {
  content: "";
  width: 40px;
  height: 1px;
  background: var(--line-2);
}

.h2 {
  font-size: clamp(28px, 3.6vw, 40px);
  line-height: 1.12;
  letter-spacing: -0.03em;
  font-weight: 600;
}

.h2 .muted {
  color: var(--text-3);
}

.lead {
  color: var(--text-2);
  font-size: clamp(16px, 1.4vw, 17.5px);
  max-width: 62ch;
}

/* Section arrival: replayed when you navigate to a section */
.is-arriving .section-head > *,
.is-arriving.cs-section > h2 {
  animation: arrive 700ms var(--ease-out) both;
}

.is-arriving .section-head > :nth-child(2) {
  animation-delay: 70ms;
}

.is-arriving .section-head > :nth-child(3) {
  animation-delay: 140ms;
}

.is-arriving .eyebrow::after {
  animation: sweep 900ms var(--ease-out) both;
}

@keyframes arrive {
  from {
    opacity: 0.25;
    transform: translateY(14px);
    filter: blur(2px);
  }
}

@keyframes sweep {
  from {
    width: 0;
    background: var(--accent);
  }
  60% {
    width: 120px;
    background: var(--accent);
  }
  to {
    width: 40px;
  }
}

.brand__path .seg.is-swap {
  animation: seg-in 380ms var(--ease-out);
}

@keyframes seg-in {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
}

.brand__path .seg {
  display: inline-block;
}

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  filter: blur(6px);
  transition: opacity 800ms var(--ease-out), transform 900ms var(--ease-out), filter 800ms var(--ease-out);
  transition-delay: var(--d, 0ms);
}

/* windows rise and settle into place */
.window.reveal {
  transform: translateY(36px) scale(0.97);
}

.reveal.is-in {
  opacity: 1;
  transform: none;
  filter: none;
}

/* the line after each section label draws in */
.eyebrow.reveal::after {
  width: 0;
  transition: width 900ms var(--ease-out) 250ms;
}

.eyebrow.reveal.is-in::after {
  width: 40px;
}

/* career entries slide in from the timeline rail */
.entry {
  opacity: 0;
  transform: translateX(-18px);
  transition: opacity 700ms var(--ease-out), transform 800ms var(--ease-out);
}

.entry.is-in {
  opacity: 1;
  transform: none;
}

/* ---- First-load intro ---- */
.is-booting .site-header {
  opacity: 0;
  transform: translateY(-14px);
}

.is-booting main,
.is-booting .site-footer {
  opacity: 0;
}

main,
.site-footer {
  transition: opacity 500ms var(--ease-out);
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity 550ms var(--ease-out), visibility 0s linear 550ms;
}

.boot.is-done {
  opacity: 0;
  visibility: hidden;
}

.boot__inner {
  width: min(380px, 84vw);
  display: grid;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 14px;
  transition: transform 550ms var(--ease-out);
}

.boot.is-done .boot__inner {
  transform: translateY(-10px) scale(0.98);
}

.boot__ps1 {
  color: var(--accent);
}

.boot__cmd {
  color: var(--text);
}

.boot__line .caret {
  margin-left: 2px;
}

.boot__bar {
  height: 2px;
  border-radius: 2px;
  background: var(--line-2);
  overflow: hidden;
}

.boot__bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 480ms var(--ease-in-out);
}

.boot.is-loading .boot__bar i {
  transform: scaleX(1);
}

.boot__status {
  font-size: 12px;
  color: var(--text-3);
}

.boot__status.is-ok {
  color: var(--ok);
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  padding-top: clamp(24px, 4vw, 48px);
  padding-bottom: clamp(32px, 4vw, 56px);
  position: relative;
}

/* on desktop the hero fills the screen under the header, content centred */
@media (min-width: 1081px) and (min-height: 700px) {
  .hero {
    min-height: calc(100vh - var(--header-h));
    min-height: calc(100svh - var(--header-h));
    display: grid;
    align-content: center;
    padding-block: 48px;
  }
}

.hero::before {
  content: "";
  position: absolute;
  top: -120px;
  left: 50%;
  width: min(1100px, 120vw);
  height: 600px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(92, 182, 255, 0.12), transparent 70%),
    radial-gradient(closest-side at 70% 40%, rgba(143, 155, 255, 0.08), transparent 70%);
  pointer-events: none;
  z-index: -1;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: clamp(24px, 3.5vw, 48px);
  align-items: center;
}

.hero__status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--bg-1);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 20px;
}

.hero__status .sep {
  color: var(--text-3);
}

.hero__name {
  font-size: clamp(38px, 5.4vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 600;
}

.hero__role {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: clamp(15px, 1.5vw, 18px);
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero__role .prompt {
  color: var(--text-3);
}

.caret {
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.hero__lead {
  margin-top: 20px;
  font-size: clamp(17px, 1.5vw, 19px);
  line-height: 1.65;
  color: #c3c8cf;
  max-width: 31em;
  text-wrap: pretty;
}

.hero__lead strong {
  color: var(--text);
  font-weight: 500;
}

.hero__ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.hero__facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 32px;
  border-top: 1px solid var(--line);
}

.hero__fact {
  padding: 16px 16px 0 0;
}

.hero__fact + .hero__fact {
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.hero__fact dt {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
}

.hero__fact dd {
  margin: 6px 0 0;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* Workspace (explorer | editor / terminal) */
/* explorer | editor on top; terminal spans the full width below */
.workspace {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  grid-template-rows: auto auto auto auto;
}

.workspace > .terminal {
  grid-column: 1 / -1;
}

.workspace .window__bar {
  grid-column: 1 / -1;
}

.ws-explorer {
  border-right: 1px solid var(--line);
  background: var(--bg-1);
  padding: 10px 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.ws-explorer__title {
  padding: 4px 14px 8px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.ws-explorer__folder {
  padding: 3px 14px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ws-file {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 4px 14px 4px 28px;
  color: var(--text-2);
  text-align: left;
  border-left: 2px solid transparent;
  transition: background var(--dur-1), color var(--dur-1);
}

.ws-file:hover {
  background: var(--bg-2);
  color: var(--text);
}

.ws-file[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--text);
  border-left-color: var(--accent);
}

.file-ico {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-grid;
  place-items: center;
  font-size: 8px;
  font-weight: 700;
  flex: none;
  color: #050a14;
}

.file-ico--py {
  background: var(--accent);
}

.file-ico--md {
  background: var(--text-3);
}

.file-ico--json {
  background: var(--amber);
}

.ws-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
}

.ws-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
  overflow-x: auto;
  scrollbar-width: none;
}

.ws-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  height: 34px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
  border-right: 1px solid var(--line);
  white-space: nowrap;
  position: relative;
}

.ws-tab[aria-selected="true"] {
  color: var(--text);
  background: var(--bg);
}

.ws-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent);
}

.editor {
  background: var(--bg);
  padding: 14px 0;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.75;
  /* fixed height: switching files must not resize the window */
  height: 290px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-4) transparent;
}

.editor__line {
  display: grid;
  grid-template-columns: 44px 1fr;
  white-space: pre;
  opacity: 0;
  transform: translateX(-4px);
  animation: line-in 420ms var(--ease-out) forwards;
  animation-delay: calc(var(--i) * 45ms);
}

.editor__line:hover {
  background: rgba(255, 255, 255, 0.025);
}

.editor__ln {
  color: #3a3f48;
  text-align: right;
  padding-right: 16px;
  user-select: none;
}

@keyframes line-in {
  to {
    opacity: 1;
    transform: none;
  }
}

.tok-kw {
  color: var(--syn-kw);
}
.tok-fn {
  color: var(--syn-fn);
}
.tok-str {
  color: var(--syn-str);
}
.tok-num {
  color: var(--syn-num);
}
.tok-com {
  color: var(--syn-com);
  font-style: italic;
}
.tok-prop {
  color: var(--syn-prop);
}
.tok-dec {
  color: var(--syn-dec);
}
.tok-h {
  color: var(--text);
  font-weight: 600;
}
.tok-mute {
  color: var(--text-3);
}

/* Terminal */
.terminal {
  border-top: 1px solid var(--line-2);
  background: var(--bg-1);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
}

.terminal__head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
  height: 30px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.terminal__head .active {
  color: var(--text);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 6px;
  margin-top: 7px;
}

.terminal__head .branch {
  margin-left: auto;
  text-transform: none;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.terminal__body {
  height: 236px;
  overflow-y: auto;
  padding: 10px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-4) transparent;
}

.terminal__line {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-2);
}

.terminal__line .ps1,
.terminal__input-row .ps1 {
  color: var(--accent);
}

.terminal__line .cmd {
  color: var(--text);
}

.terminal__line.is-ok {
  color: var(--ok);
}

.terminal__line.is-err {
  color: var(--err);
}

.terminal__line.is-dim {
  color: var(--text-3);
}

.terminal__line a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent-line);
}

.terminal__input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.terminal__input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  caret-color: var(--accent);
  padding: 0;
}

.terminal__input:focus-visible {
  outline: none;
}

.terminal__body:focus-within {
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.statusbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 24px;
  padding: 0 12px;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
}

.statusbar span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.statusbar .right {
  margin-left: auto;
}

/* ==========================================================================
   What I build (pillars)
   ========================================================================== */
.pillars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.pillar {
  background: var(--bg-1);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  transition: background var(--dur-2);
}

.pillar:hover {
  background: var(--bg-2);
}

.pillar__file {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pillar h3 {
  font-size: 19px;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.pillar p {
  color: var(--text-2);
  font-size: 15px;
}

.pillar__list {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-2);
}

.pillar__list li {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 6px;
}

.pillar__list li::before {
  content: "→";
  color: var(--accent);
}

/* ==========================================================================
   Projects explorer
   ========================================================================== */
.explorer {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 600px;
}

.explorer .window__bar {
  grid-column: 1 / -1;
}

.tree {
  border-right: 1px solid var(--line);
  padding: 12px 0;
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-1);
}

.tree__label {
  padding: 4px 16px 10px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.tree__root {
  padding: 4px 16px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tree__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 16px 7px 20px;
  text-align: left;
  color: var(--text-2);
  border-left: 2px solid transparent;
  transition: background var(--dur-1), color var(--dur-1), border-color var(--dur-1);
}

.tree__item .branch-glyph {
  color: #3a3f48;
}

.tree__item:hover {
  background: var(--bg-2);
  color: var(--text);
}

.tree__item[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--text);
  border-left-color: var(--accent);
}

.tree__item[aria-selected="true"] .folder-ico {
  color: var(--accent);
}

.folder-ico {
  width: 14px;
  height: 14px;
  color: var(--text-3);
  flex: none;
}

.tree__meta {
  margin-top: 18px;
  padding: 14px 16px 0;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--text-3);
  display: grid;
  gap: 6px;
}

.preview {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  background: var(--bg);
}

.preview__crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
}

.preview__crumbs .cur {
  color: var(--text);
}

.preview__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0;
  min-height: 0;
}

.preview__info {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--line);
}

.preview__company {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preview__company .role {
  color: var(--amber);
}

.preview__title {
  font-size: clamp(24px, 2.6vw, 30px);
  letter-spacing: -0.03em;
  font-weight: 600;
  line-height: 1.15;
}

.preview__tagline {
  color: var(--text);
  font-size: 16px;
}

.preview__summary {
  color: var(--text-2);
  font-size: 14.5px;
}

.facts {
  display: grid;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.facts div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 12px;
  background: var(--bg-1);
}

.facts div + div {
  border-top: 1px solid var(--line);
}

.facts dt {
  color: var(--text-3);
}

.facts dd {
  margin: 0;
  color: var(--text);
  text-align: right;
}

.preview__actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preview__visual {
  padding: 24px;
  display: grid;
  align-content: center;
  background: radial-gradient(ellipse at 50% 30%, rgba(92, 182, 255, 0.05), transparent 70%), var(--bg);
  min-width: 0;
}

.preview-swap {
  animation: swap-in 520ms var(--ease-out);
}

@keyframes swap-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* Archive */
.archive {
  margin-top: 40px;
}

.archive__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-3);
}

.archive__head .cmd {
  color: var(--text-2);
}

.archive__head .cmd::before {
  content: "$ ";
  color: var(--accent);
}

.archive__list {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.archive__row {
  display: grid;
  grid-template-columns: 200px 180px minmax(0, 1fr) auto;
  gap: 24px;
  align-items: baseline;
  padding: 18px 22px;
  background: var(--bg-1);
  transition: background var(--dur-1);
}

.archive__row + .archive__row {
  border-top: 1px solid var(--line);
}

.archive__row:hover {
  background: var(--bg-2);
}

.archive__name {
  font-weight: 500;
  letter-spacing: -0.01em;
}

.archive__company {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-3);
}

.archive__summary {
  font-size: 14px;
  color: var(--text-2);
}

/* ==========================================================================
   Project visuals
   ========================================================================== */
.viz {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-1);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow: hidden;
}

.viz__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text-3);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.viz__head .live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ok);
  letter-spacing: 0.04em;
}

.viz__body {
  padding: 14px;
  display: grid;
  gap: 14px;
}

.viz__note {
  font-size: 10.5px;
  color: var(--text-3);
  padding: 8px 14px;
  border-top: 1px solid var(--line);
}

/* voice */
.status-rows {
  display: grid;
  gap: 6px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  color: var(--text-2);
}

.status-row b {
  font-weight: 500;
  color: var(--text-3);
  transition: color var(--dur-2);
}

.status-row b.is-ok {
  color: var(--ok);
}

.wave {
  display: grid;
  grid-template-columns: 76px 1fr;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
  font-size: 11px;
}

.wave__bars {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 26px;
}

.wave__bars i {
  flex: 1;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.85;
  transform: scaleY(0.12);
  transform-origin: center;
}

.wave--out .wave__bars i {
  background: var(--accent-2);
}

.wave--proc .wave__bars i {
  background: var(--amber);
}

.is-live .wave__bars i {
  animation: bar 1.2s ease-in-out infinite;
  animation-delay: calc(var(--k) * -73ms);
}

@keyframes bar {
  0%,
  100% {
    transform: scaleY(0.12);
  }
  50% {
    transform: scaleY(var(--h, 0.8));
  }
}

.transcript {
  display: grid;
  gap: 5px;
  min-height: 92px;
  border-top: 1px dashed var(--line-2);
  padding-top: 12px;
}

.transcript p {
  color: var(--text-2);
  animation: swap-in 400ms var(--ease-out);
}

.transcript .who {
  color: var(--text-3);
}

.transcript .who--ai {
  color: var(--accent-2);
}

.transcript .who--tool {
  color: var(--amber);
}

.transcript .who--ui {
  color: var(--ok);
}

/* voice: chat on the left, signal on the right when there's room */
.viz--voice {
  container-type: inline-size;
}

.voice-split {
  display: grid;
  gap: 16px;
}

.voice-signal {
  display: grid;
  gap: 14px;
  align-content: start;
  order: -1;
}

.voice-chat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* fixed height: new messages scroll inside instead of resizing the panel */
  height: 230px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* no visible scrollbar: it flickered in as messages animated and shifted them sideways */
  scrollbar-width: none;
  font-family: var(--font-sans);
  /* older messages fade out at the top */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 28px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 28px);
  border-top: 1px dashed var(--line-2);
  padding-top: 14px;
}

.voice-chat::-webkit-scrollbar {
  display: none;
}

/* first message pushes the rest to the bottom while there are only a few */
.voice-chat > :first-child {
  margin-top: auto;
}

.viz__head-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.voice-restart {
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
}

/* restart only appears once the conversation ends; visibility (not display)
   keeps its space reserved so the panel height never changes */
.voice-restart {
  visibility: hidden;
  opacity: 0;
  transition: opacity 300ms var(--ease-out), visibility 0s linear 300ms;
}

.voice-restart.is-ready {
  visibility: visible;
  opacity: 1;
  transition: opacity 300ms var(--ease-out);
}

.voice-restart.is-ready {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.live.is-ended {
  color: var(--text-3);
}

.live.is-ended .dot {
  background: var(--text-3);
  box-shadow: none;
  animation: none;
}

@container (min-width: 680px) {
  .voice-split {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 0;
  }

  .voice-chat {
    order: 0;
    height: 320px;
    border-top: 0;
    padding: 4px 20px 4px 4px;
    border-right: 1px solid var(--line);
  }

  .voice-signal {
    order: 1;
    padding-left: 20px;
    align-content: center;
  }

  .voice-signal .wave__bars {
    height: 40px;
  }
}

.msg {
  max-width: 82%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text);
  animation: msg-in 380ms var(--ease-out);
}

.msg__who {
  display: block;
  margin-bottom: 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
}

.msg--guest {
  align-self: flex-start;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.msg--ai {
  align-self: flex-end;
  background: rgba(143, 155, 255, 0.12);
  border: 1px solid rgba(143, 155, 255, 0.35);
  border-bottom-right-radius: 4px;
}

.msg--ai .msg__who {
  color: var(--accent-2);
}

.msg--tool,
.msg--ui {
  align-self: center;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.msg--tool {
  color: var(--amber);
  background: var(--amber-soft);
}

.msg--ui {
  color: var(--ok);
  border: 1px dashed rgba(95, 208, 180, 0.45);
}

.msg--tool .msg__who,
.msg--ui .msg__who {
  display: inline;
  margin-right: 6px;
  color: inherit;
  opacity: 0.7;
}

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

/* the speaking channel lights up, the others dim */
.viz--voice .wave {
  opacity: 0.35;
  transition: opacity 300ms var(--ease-out);
}

.viz--voice .wave.is-active {
  opacity: 1;
}

/* throughput */
.throughput {
  display: grid;
  gap: 14px;
}

.tp-row {
  display: grid;
  gap: 6px;
}

.tp-row__label {
  display: flex;
  justify-content: space-between;
  color: var(--text-3);
}

.tp-row__label b {
  font-weight: 500;
  color: var(--text);
  font-size: 13px;
}

.tp-bar {
  height: 10px;
  border-radius: 3px;
  background: var(--bg-3);
  overflow: hidden;
}

.tp-bar i {
  display: block;
  height: 100%;
  width: var(--w);
  background: var(--text-3);
  border-radius: 3px;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 1400ms var(--ease-out);
}

.tp-row--after .tp-bar i {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition-delay: 300ms;
}

.is-live .tp-bar i,
.is-done .tp-bar i {
  transform: scaleX(1);
}

.tp-delta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px dashed var(--line-2);
}

.tp-delta strong {
  font-family: var(--font-sans);
  font-size: 34px;
  letter-spacing: -0.04em;
  font-weight: 600;
  color: var(--accent);
}

/* pipeline */
.pipe {
  display: grid;
  gap: 10px;
}

.pipe__track {
  display: grid;
  grid-template-columns: 1fr 26px 1fr 26px 1fr 26px 1fr;
  align-items: center;
}

.pipe__node {
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: var(--bg-2);
  padding: 9px 6px;
  text-align: center;
  color: var(--text);
  font-size: 11px;
  line-height: 1.3;
}

.pipe__node--core {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.pipe__link {
  position: relative;
  height: 1px;
  background: var(--line-3);
  overflow: hidden;
}

.pipe__link::after {
  content: "";
  position: absolute;
  inset: -1px auto -1px 0;
  width: 10px;
  background: var(--accent);
  border-radius: 2px;
  transform: translateX(-12px);
}

.is-live .pipe__link::after {
  animation: travel 1.8s var(--ease-in-out) infinite;
  animation-delay: var(--dl, 0s);
}

@keyframes travel {
  to {
    transform: translateX(30px);
  }
}

.pipe__jobs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.pipe__job {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  color: var(--text-2);
  font-size: 10.5px;
  display: grid;
  gap: 2px;
}

.pipe__job b {
  color: var(--text);
  font-weight: 500;
}

.pipe__job .st {
  color: var(--text-3);
}

.pipe__job.is-run .st {
  color: var(--amber);
}

.pipe__job.is-ok .st {
  color: var(--ok);
}

/* report */
.report__stages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.report__stage {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  color: var(--text-3);
  font-size: 10.5px;
  position: relative;
  overflow: hidden;
}

.report__stage::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
}

.report__stage.is-run {
  color: var(--text);
}

.report__stage.is-run::after {
  transition: transform 700ms linear;
  transform: scaleX(1);
}

.report__stage.is-ok {
  color: var(--ok);
}

.report__stage.is-ok::after {
  transform: scaleX(1);
  background: var(--ok);
}

.report__card {
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
  background: var(--bg);
  transition: opacity var(--dur-3) var(--ease-out);
}

.report__card.is-pending {
  opacity: 0.35;
}

.report__card h4 {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text);
  font-weight: 500;
}

.report__row {
  display: grid;
  grid-template-columns: 1fr 60px;
  gap: 10px;
  align-items: center;
  color: var(--text-3);
}

.skeleton {
  height: 8px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--bg-3), var(--bg-4), var(--bg-3));
  background-size: 200% 100%;
}

.is-live .skeleton {
  animation: shimmer 1.8s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ==========================================================================
   Architecture diagram
   ========================================================================== */
.diagram {
  --cols: 1;
  display: grid;
  gap: 0;
  font-family: var(--font-mono);
}

.diagram__row {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: 0;
}

.diagram__cell {
  display: flex;
  justify-content: center;
  padding-inline: 4px;
}

.diagram__node {
  width: 100%;
  max-width: 260px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--bg-2);
  padding: 10px 12px;
  text-align: center;
  transition: border-color var(--dur-2), background var(--dur-2), transform var(--dur-2) var(--ease-out);
}

.diagram__node:hover {
  border-color: var(--line-3);
  transform: translateY(-1px);
}

.diagram__node--accent {
  border-color: var(--accent-line);
  background: linear-gradient(180deg, rgba(92, 182, 255, 0.1), rgba(92, 182, 255, 0.03));
}

.diagram__node--todo {
  border-style: dashed;
  border-color: rgba(240, 180, 94, 0.4);
}

.diagram__t {
  font-size: 12.5px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.35;
}

.diagram__s {
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 3px;
  line-height: 1.4;
}

.diagram__node--todo .diagram__s {
  color: var(--amber);
}

.diagram__link {
  position: relative;
  height: 44px;
}

.diagram__link svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.diagram__link .wire {
  stroke: var(--line-3);
  stroke-width: 1;
  fill: none;
}

.diagram__link .packet {
  stroke: var(--accent);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 6 94;
  stroke-dashoffset: 6;
  opacity: 0;
}

.is-live .diagram__link .packet {
  opacity: 1;
  animation: packet 2.2s var(--ease-in-out) infinite;
  animation-delay: var(--dl, 0s);
}

@keyframes packet {
  from {
    stroke-dashoffset: 6;
  }
  to {
    stroke-dashoffset: -94;
  }
}

.diagram__edge {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(8px, -50%);
  font-size: 10.5px;
  color: var(--text-3);
  background: var(--bg);
  padding: 0 6px;
  white-space: nowrap;
}

.diagram--compact .diagram__node {
  padding: 7px 6px;
}

.diagram--compact .diagram__t {
  font-size: 11px;
}

.diagram--compact .diagram__s {
  display: none;
}

.diagram--compact .diagram__link {
  height: 26px;
}

.diagram-frame {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: radial-gradient(ellipse at 50% 0%, rgba(92, 182, 255, 0.06), transparent 60%), var(--bg-1);
  padding: clamp(20px, 4vw, 40px) clamp(12px, 3vw, 32px);
}

.diagram-frame figcaption {
  margin-top: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
}

/* ==========================================================================
   Stack explorer
   ========================================================================== */
.stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 520px;
}

.stack .window__bar {
  grid-column: 1 / -1;
}

.stack__tree {
  padding: 14px 0;
  border-right: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 13px;
  max-height: 560px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-4) transparent;
}

.stack__group > button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 18px;
  color: var(--text-2);
  text-align: left;
}

.stack__group > button:hover {
  color: var(--text);
}

.stack__group > button .chev {
  width: 12px;
  height: 12px;
  transition: transform var(--dur-2) var(--ease-out);
  color: var(--text-3);
}

.stack__group > button[aria-expanded="true"] .chev {
  transform: rotate(90deg);
}

.stack__group .count {
  margin-left: auto;
  color: var(--text-3);
  font-size: 11px;
}

.stack__items {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur-3) var(--ease-out);
}

.stack__group > button[aria-expanded="true"] + .stack__items {
  grid-template-rows: 1fr;
}

.stack__items > ul {
  overflow: hidden;
}

.stack__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 5px 18px 5px 40px;
  color: var(--text-2);
  text-align: left;
  position: relative;
  border-left: 2px solid transparent;
}

.stack__item::before {
  content: "";
  position: absolute;
  left: 23px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line-2);
}

.stack__item:hover {
  background: var(--bg-2);
  color: var(--text);
}

.stack__item[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--text);
  border-left-color: var(--accent);
}

.stack__item .uses {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-3);
}

.stack__item .uses.has {
  color: var(--accent);
}

.stack__detail {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--bg);
}

.stack__detail-kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
}

.stack__detail h3 {
  font-size: 26px;
  letter-spacing: -0.03em;
  font-weight: 600;
}

.usage {
  font-family: var(--font-mono);
  font-size: 13px;
  display: grid;
  gap: 2px;
  align-content: start;
  /* long lists (e.g. Python) scroll inside the panel instead of stretching it */
  max-height: 380px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-4) transparent;
}

.usage__title {
  color: var(--text-3);
  margin-bottom: 6px;
}

.usage a,
.usage span.item {
  display: flex;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--text);
  animation: swap-in 360ms var(--ease-out) backwards;
  animation-delay: calc(var(--i) * 40ms);
}

.usage a:hover {
  background: var(--bg-2);
}

.usage .glyph {
  color: var(--text-3);
}

.usage .kind {
  margin-left: auto;
  color: var(--text-3);
  font-size: 11px;
}

.usage__note {
  padding: 10px 12px;
  border-left: 2px solid var(--accent-line);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.6;
}

.usage__empty {
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.6;
  padding: 10px 12px;
  border: 1px dashed var(--line-2);
  border-radius: 8px;
}

/* ==========================================================================
   Experience (git log)
   ========================================================================== */
.gitlog {
  position: relative;
}

.gitlog__cmd {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 20px;
}

.gitlog__cmd::before {
  content: "$ ";
  color: var(--accent);
}

.gitlog__list {
  position: relative;
  padding-left: 40px;
}

.gitlog__rail,
.gitlog__progress {
  position: absolute;
  left: 11px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
}

.gitlog__rail {
  background: var(--line-2);
}

.gitlog__progress {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  transform-origin: top;
  transform: scaleY(var(--p, 0));
}

.entry {
  position: relative;
  padding-bottom: 28px;
}

.entry__node {
  position: absolute;
  left: -36px;
  top: 22px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line-3);
  background: var(--bg);
  transition: border-color var(--dur-3), box-shadow var(--dur-3);
}

.entry.is-in .entry__node {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.entry--head .entry__node {
  background: var(--accent);
}

.entry__card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  overflow: hidden;
  transition: border-color var(--dur-2);
}

.entry__card:hover {
  border-color: var(--line-2);
}

.entry--head .entry__card {
  border-color: var(--accent-line);
  background: linear-gradient(180deg, rgba(92, 182, 255, 0.05), transparent 120px), var(--bg-1);
}

.entry__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 24px;
  padding: 20px 24px;
}

.entry__refs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
  grid-column: 1 / -1;
}

.ref-head {
  color: var(--accent);
}

.ref-head b {
  color: var(--ok);
  font-weight: 500;
}

.entry__company {
  font-size: 20px;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.entry__role {
  color: var(--text-2);
  font-size: 15px;
  margin-top: 2px;
}

.entry__when {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-2);
}

.entry__when span {
  display: block;
  color: var(--text-3);
}

.entry__summary {
  grid-column: 1 / -1;
  color: var(--text-2);
  font-size: 15px;
}

.entry__tags {
  grid-column: 1 / -1;
}

.entry details {
  border-top: 1px solid var(--line);
}

.entry summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 24px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color var(--dur-1), background var(--dur-1);
}

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

.entry summary:hover {
  color: var(--text);
  background: var(--bg-2);
}

.entry summary .chev {
  width: 12px;
  height: 12px;
  transition: transform var(--dur-2) var(--ease-out);
}

.entry details[open] summary .chev {
  transform: rotate(90deg);
}

.entry__points {
  padding: 4px 24px 22px;
  display: grid;
  gap: 10px;
}

.entry__points li {
  position: relative;
  padding-left: 22px;
  font-size: 14.5px;
  color: var(--text-2);
}

.entry__points li::before {
  content: "+";
  position: absolute;
  left: 0;
  font-family: var(--font-mono);
  color: var(--ok);
}

/* ==========================================================================
   Principles
   ========================================================================== */
.principles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.principle {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  padding: 26px;
  display: grid;
  gap: 12px;
  align-content: start;
  position: relative;
  overflow: hidden;
  --x: 50%;
  --y: 50%;
}

.principle::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(360px circle at var(--x) var(--y), rgba(92, 182, 255, 0.08), transparent 60%);
  opacity: 0;
  transition: opacity var(--dur-2);
  pointer-events: none;
}

.principle:hover::before {
  opacity: 1;
}

.principle__rule {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
}

.principle__rule b {
  color: var(--amber);
  font-weight: 500;
}

.principle h3 {
  font-size: 19px;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.principle p {
  color: var(--text-2);
  font-size: 15px;
}

/* ==========================================================================
   About
   ========================================================================== */
.about {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: start;
}

.about__text {
  display: grid;
  gap: 20px;
  font-size: clamp(16.5px, 1.4vw, 18px);
  color: var(--text-2);
  line-height: 1.7;
}

.about__text strong {
  color: var(--text);
  font-weight: 500;
}

.kv {
  font-family: var(--font-mono);
  font-size: 13px;
}

.kv__row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 16px;
  padding: 12px 18px;
}

.kv__row + .kv__row {
  border-top: 1px solid var(--line);
}

.kv dt {
  color: var(--text-3);
}

.kv dd {
  margin: 0;
  color: var(--text);
}

.kv dd span {
  color: var(--text-3);
  display: block;
}

/* ==========================================================================
   Resume
   ========================================================================== */
.resume {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: center;
  padding: clamp(24px, 4vw, 44px);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  background: radial-gradient(ellipse at 100% 0%, rgba(143, 155, 255, 0.1), transparent 55%),
    radial-gradient(ellipse at 0% 100%, rgba(92, 182, 255, 0.08), transparent 55%), var(--bg-1);
  position: relative;
  overflow: hidden;
}

.resume__file {
  display: flex;
  align-items: center;
  gap: 16px;
}

.resume__icon {
  width: 52px;
  height: 64px;
  border-radius: 6px;
  border: 1px solid var(--line-3);
  background: var(--bg-3);
  display: grid;
  place-items: end center;
  padding-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--err);
  font-weight: 600;
  flex: none;
  position: relative;
}

.resume__icon::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 10px;
  right: 10px;
  height: 22px;
  background: repeating-linear-gradient(var(--line-3) 0 1px, transparent 1px 5px);
}

.resume__name {
  font-size: clamp(22px, 2.6vw, 28px);
  letter-spacing: -0.03em;
  font-weight: 600;
}

.resume__role {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 14px;
}

.resume__meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
}

.resume__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.resume__includes {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* ==========================================================================
   Contact
   ========================================================================== */
.contact {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(32px, 6vw, 72px);
  align-items: start;
}

/* contact is the last section: don't stack its full bottom padding on the footer's */
#contact {
  padding-bottom: clamp(32px, 4vw, 48px);
}

/* while the form is hidden, the links take the full width in a row */
.contact:has(> #contact-form[hidden]) {
  grid-template-columns: minmax(0, 1fr);
}

.contact:has(> #contact-form[hidden]) .contact__links {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.contact__links {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.contact__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-1);
  font-size: 14px;
  color: var(--text-2);
  transition: border-color var(--dur-1), color var(--dur-1), background var(--dur-1);
  min-width: 0;
}

.contact__link:hover {
  color: var(--text);
  border-color: var(--line-2);
  background: var(--bg-2);
}

.contact__link svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--text-3);
}

.contact__link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact__link .go {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
}

.request {
  font-family: var(--font-mono);
  font-size: 13.5px;
}

.request__line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  flex-wrap: wrap;
}

.method {
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--amber-soft);
  color: var(--amber);
  font-weight: 600;
  font-size: 12px;
}

.request__line .path {
  color: var(--text);
}

.request__line .hdr {
  margin-left: auto;
  color: var(--text-3);
  font-size: 12px;
}

.request__body {
  padding: 18px 18px 8px;
  line-height: 1.9;
}

.request__body .brace {
  color: var(--text-3);
}

.field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding-left: 20px;
}

.field label {
  color: var(--syn-prop);
  white-space: nowrap;
  min-width: 92px;
  padding-top: 5px;
}

.field label::after {
  content: ":";
  color: var(--text-3);
}

.field input,
.field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 10px;
  color: var(--syn-str);
  outline: none;
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
  resize: vertical;
  line-height: 1.6;
}

.field textarea {
  min-height: 110px;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #4c525c;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: rgba(255, 122, 133, 0.6);
}

.field + .field {
  margin-top: 10px;
}

.hp {
  position: absolute;
  left: -9999px;
}

.request__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.request__hint {
  color: var(--text-3);
  font-size: 12px;
}

.response {
  border-top: 1px solid var(--line);
  background: var(--bg);
  padding: 14px 18px;
  font-size: 13px;
  display: none;
}

.response.is-shown {
  display: block;
  animation: swap-in 400ms var(--ease-out);
}

.response .status {
  font-weight: 600;
}

.response .status.ok {
  color: var(--ok);
}

.response .status.err {
  color: var(--err);
}

.response .status.pending {
  color: var(--amber);
}

.response pre {
  margin: 6px 0 0;
  color: var(--text-2);
  white-space: pre-wrap;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 28px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-3);
}

.site-footer__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px 40px;
  align-items: end;
}

.site-footer__id {
  color: var(--text-2);
}

.site-footer__id b {
  color: var(--text);
  font-weight: 500;
}

.site-footer__id p + p {
  margin-top: 4px;
}

.site-footer__links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.site-footer__links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
  transition: color var(--dur-1);
}

.site-footer__links svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.site-footer__links a:hover {
  color: var(--accent);
}

.site-footer__copy {
  grid-column: 1 / -1;
  color: var(--text-2);
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* ==========================================================================
   Command palette
   ========================================================================== */
.palette {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
}

.palette.is-open {
  display: flex;
}

.palette__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 5, 7, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade 200ms ease-out;
}

.palette__panel {
  position: relative;
  width: 100%;
  max-width: 600px;
  background: var(--bg-1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-window), 0 0 0 1px var(--line-2);
  overflow: hidden;
  animation: palette-in 260ms var(--ease-out);
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes palette-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.985);
  }
}

.palette__input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.palette__input-row .gt {
  font-family: var(--font-mono);
  color: var(--accent);
}

.palette__input {
  flex: 1;
  height: 54px;
  background: transparent;
  border: 0;
  outline: none;
  font-size: 15px;
}

.palette__input:focus-visible {
  outline: none;
}

.palette__list {
  max-height: min(420px, 60vh);
  overflow-y: auto;
  padding: 6px;
}

.palette__group {
  padding: 10px 10px 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.palette__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
}

.palette__item[aria-selected="true"] {
  background: var(--bg-3);
  color: var(--text);
}

.palette__item .ico {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  background: var(--bg-3);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  flex: none;
}

.palette__item[aria-selected="true"] .ico {
  color: var(--accent);
  border-color: var(--accent-line);
}

.palette__item .hint {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-3);
}

.palette__empty {
  padding: 28px;
  text-align: center;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 13px;
}

.palette__foot {
  display: flex;
  gap: 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-3);
}

.palette__foot span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   Case study pages
   ========================================================================== */
.cs-hero {
  padding-top: clamp(40px, 6vw, 72px);
  padding-bottom: clamp(40px, 5vw, 64px);
  border-bottom: 1px solid var(--line);
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 32px;
}

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

.crumbs .cur {
  color: var(--text);
}

.crumbs .seg {
  opacity: 0;
  animation: crumb 420ms var(--ease-out) forwards;
  animation-delay: calc(var(--i) * 110ms);
}

@keyframes crumb {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.cs-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: end;
}

.cs-title {
  font-size: clamp(34px, 5vw, 56px);
  letter-spacing: -0.045em;
  line-height: 1.04;
  font-weight: 600;
}

.cs-tagline {
  margin-top: 18px;
  font-size: clamp(17px, 1.6vw, 20px);
  color: var(--text-2);
  max-width: 36em;
}

.cs-meta {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  overflow: hidden;
}

.cs-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  padding-block: clamp(48px, 7vw, 88px);
}

.toc {
  position: sticky;
  top: calc(var(--header-h) + 32px);
  align-self: start;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.toc__title {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 12px;
}

.toc ol {
  display: grid;
  gap: 2px;
  border-left: 1px solid var(--line);
}

.toc a {
  display: block;
  padding: 5px 0 5px 14px;
  margin-left: -1px;
  border-left: 1px solid transparent;
  color: var(--text-3);
  transition: color var(--dur-1), border-color var(--dur-1);
}

.toc a:hover {
  color: var(--text);
}

.toc a[aria-current="true"] {
  color: var(--accent);
  border-left-color: var(--accent);
}

.cs-content {
  display: grid;
  gap: clamp(48px, 6vw, 72px);
  min-width: 0;
}

.cs-section {
  display: grid;
  gap: 18px;
}

.cs-section > h2 {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: clamp(22px, 2.4vw, 28px);
  letter-spacing: -0.025em;
  font-weight: 600;
}

.cs-section > h2 .n {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  font-weight: 400;
}

.cs-section p,
.cs-section li {
  color: var(--text-2);
  font-size: 16.5px;
  line-height: 1.7;
  max-width: 68ch;
}

.cs-section p strong,
.cs-section li strong {
  color: var(--text);
  font-weight: 500;
}

.cs-list {
  display: grid;
  gap: 12px;
}

.cs-list li {
  position: relative;
  padding-left: 26px;
}

.cs-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  font-family: var(--font-mono);
  color: var(--accent);
}

.decisions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.decision {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-1);
  padding: 18px 20px;
  display: grid;
  gap: 8px;
  align-content: start;
}

.decision h3 {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.decision p {
  font-size: 14.5px;
}

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

.result-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.result-band > div {
  background: var(--bg-1);
  padding: 22px;
}

.result-band dt {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-3);
}

.result-band dd {
  margin: 6px 0 0;
  font-size: 20px;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.cs-next {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding-bottom: clamp(56px, 8vw, 96px);
}

.cs-next a {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  padding: 20px 22px;
  display: grid;
  gap: 4px;
  transition: border-color var(--dur-1), background var(--dur-1);
}

.cs-next a:hover {
  border-color: var(--line-2);
  background: var(--bg-2);
}

.cs-next a:last-child {
  text-align: right;
}

.cs-next .k {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
}

.cs-next .v {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* Case-study pages fade up into place when they open */
[data-page="case-study"] main {
  animation: page-in 520ms var(--ease-out) both;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* Page transition veil (navigating between pages) */
.page-veil {
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
  background: var(--bg);
  opacity: 0;
  transition: opacity 260ms var(--ease-out);
}

.page-veil.is-active {
  opacity: 1;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .nav {
    display: none;
  }

  .header-actions {
    margin-left: auto;
  }

  .hero__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .preview__body {
    grid-template-columns: minmax(0, 1fr);
  }

  .preview__info {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .archive__row {
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 6px 24px;
  }

  .archive__company {
    grid-column: 1;
  }

  .archive__summary {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .archive__row .chips {
    grid-column: 2;
  }

  .about,
  .contact {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .pillars {
    grid-template-columns: minmax(0, 1fr);
  }

  .explorer {
    grid-template-columns: minmax(0, 1fr);
  }

  /* explorer becomes a horizontal folder strip */
  .tree {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px;
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 4px;
  }

  .tree__label,
  .tree__root,
  .tree__meta,
  .tree__item .branch-glyph {
    display: none;
  }

  .tree__list {
    display: flex;
    gap: 4px;
  }

  .tree__item {
    white-space: nowrap;
    border-left: 0;
    border-radius: 6px;
    padding: 7px 12px;
  }

  .stack {
    grid-template-columns: minmax(0, 1fr);
  }

  .stack__tree {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 360px;
  }

  .principles,
  .decisions {
    grid-template-columns: minmax(0, 1fr);
  }

  .resume {
    grid-template-columns: minmax(0, 1fr);
  }

  .resume__actions {
    justify-content: flex-start;
  }

  .cs-hero__grid,
  .cs-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 640px) {
  :root {
    --header-h: 52px;
  }

  .brand__path {
    font-size: 12px;
  }

  .brand__wave {
    display: none;
  }

  .palette-trigger .keys,
  .palette-trigger__label {
    display: none;
  }

  .palette-trigger__label-mobile {
    display: inline;
  }

  .header-actions .btn--resume {
    display: none;
  }

  /* workspace: stacked Project / Code / Terminal, no explorer column */
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .ws-explorer {
    display: none;
  }

  .editor {
    height: 250px;
    font-size: 11.5px;
  }

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

  .editor__ln {
    padding-right: 10px;
  }

  .terminal__body {
    height: 160px;
  }

  .statusbar .hide-sm {
    display: none;
  }

  .hero__facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero__fact,
  .hero__fact + .hero__fact {
    padding: 12px 0;
    border-left: 0;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: baseline;
  }

  .hero__fact + .hero__fact {
    border-top: 1px solid var(--line);
  }

  .hero__fact dd {
    margin: 0;
    text-align: right;
  }

  .hero__ctas .btn:not(.btn--icon) {
    flex: 1 1 auto;
    justify-content: center;
  }

  .archive__head {
    flex-direction: column;
    gap: 4px;
  }

  .preview__info,
  .preview__visual,
  .stack__detail {
    padding: 20px;
  }

  .archive__row {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    padding: 16px 18px;
  }

  .archive__summary,
  .archive__row .chips {
    grid-column: 1;
    grid-row: auto;
  }

  .gitlog__list {
    padding-left: 28px;
  }

  .gitlog__rail,
  .gitlog__progress {
    left: 5px;
  }

  .entry__node {
    left: -29px;
    width: 14px;
    height: 14px;
  }

  .entry__top {
    grid-template-columns: minmax(0, 1fr);
    padding: 18px;
  }

  .entry__when {
    text-align: left;
  }

  .entry summary {
    padding: 12px 18px;
  }

  .entry__points {
    padding: 4px 18px 18px;
  }

  .kv__row {
    grid-template-columns: 96px minmax(0, 1fr);
    padding: 12px 14px;
  }

  .field {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding-left: 8px;
  }

  .field label {
    min-width: 0;
  }

  .request__line .hdr {
    margin-left: 0;
    width: 100%;
  }

  .resume__actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .pipe__track {
    grid-template-columns: 1fr 14px 1fr 14px 1fr 14px 1fr;
  }

  .pipe__node {
    font-size: 10px;
    padding: 8px 3px;
  }

  .diagram__t {
    font-size: 11px;
  }

  .diagram__s {
    font-size: 9.5px;
  }

  .diagram__cell {
    padding-inline: 2px;
  }

  .diagram__node {
    padding: 8px 5px;
  }

  .diagram__edge {
    transform: translate(6px, -50%);
    font-size: 9.5px;
  }

  .result-band {
    grid-template-columns: minmax(0, 1fr);
  }

  .cs-next {
    grid-template-columns: minmax(0, 1fr);
  }

  .cs-next a:last-child {
    text-align: left;
  }

  .site-footer__inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .palette {
    padding-top: 10vh;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
  }

  .reveal,
  .entry {
    opacity: 1;
    transform: none;
    filter: none;
  }

  .caret {
    animation: none;
  }

  .is-live .wave__bars i,
  .is-live .pipe__link::after,
  .is-live .diagram__link .packet,
  .is-live .skeleton {
    animation: none;
  }

  .is-live .wave__bars i {
    transform: scaleY(var(--h, 0.5));
  }
}
