/* ==========================================================================
   Webplic — editor-themed portfolio
   Palette is zinc + emerald, taken directly from new-design.svg.
   ========================================================================== */

:root {
  --bg: #09090b;
  --surface: #18181b;
  --surface-2: #1f1f23;
  --raised: #27272a;
  --border: #3f3f46;
  --border-soft: #27272a;

  --text: #fafafa;
  --text-2: #d4d4d8;
  --muted: #a1a1aa;
  --faint: #71717a;

  --accent: #34d399;
  --accent-strong: #10b981;
  --accent-ink: #052e1c;

  --blue: #60a5fa;
  --violet: #a78bfa;
  --amber: #f59e0b;
  --red: #ef4444;

  --font-display: "Schibsted Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 8px;
  --gutter: 48px;
  --max: 1440px;
  --topbar-h: 56px;
  --statusbar-h: 32px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: var(--statusbar-h);
  overflow-x: hidden;
}

/* Soft emerald glow behind the hero + a faint dot grid that fades out. */
body::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1100px;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(600px 380px at 78% 260px, rgb(16 185 129 / 0.10), transparent 70%),
    radial-gradient(circle at 1px 1px, rgb(255 255 255 / 0.06) 1px, transparent 0) 0 0 / 28px 28px;
  -webkit-mask-image: linear-gradient(180deg, #000 30%, transparent);
          mask-image: linear-gradient(180deg, #000 30%, transparent);
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
ul, ol { list-style: none; }

::selection { background: rgb(52 211 153 / 0.3); color: var(--text); }

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

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

.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius);
  transform: translateY(-150%);
  transition: transform 0.2s;
}
.skip:focus { transform: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 42px;
  padding: 0 24px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.2s var(--ease-out), box-shadow 0.2s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 14px; height: 14px; fill: currentColor; }

.btn-solid {
  background: var(--accent-strong);
  color: var(--bg);
  font-weight: 700;
}
.btn-solid:hover {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgb(16 185 129 / 0.18), 0 8px 24px -8px rgb(16 185 129 / 0.6);
}

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

.btn-outline {
  height: 30px;
  padding: 0 12px;
  font-size: 13px;
  color: var(--accent);
  border-color: var(--accent-strong);
  background: rgb(16 185 129 / 0.06);
}
.btn-outline:hover { background: rgb(16 185 129 / 0.16); color: var(--text); }

.btn-block { width: 100%; }

/* ==========================================================================
   Top bar (editor chrome)
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-inline: var(--gutter);
  background: rgb(24 24 27 / 0.82);
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
          backdrop-filter: saturate(160%) blur(14px);
}

.logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.tabs {
  position: absolute;
  left: 50%;
  bottom: -1px;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  height: calc(var(--topbar-h) - 18px);
}

.tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 0 16px;
  font-size: 13px;
  color: var(--muted);
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  transition: color 0.2s, background-color 0.2s;
}
.tab:hover { color: var(--text); }
.tab .ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linejoin: round; stroke-linecap: round; }
.tab .close { width: 12px; font-size: 14px; line-height: 1; opacity: 0; color: var(--muted); }

.tab[aria-current="true"] {
  color: var(--text);
  background: var(--bg);
  border-color: var(--border);
}
.tab[aria-current="true"] .ico { stroke: var(--accent); }
.tab[aria-current="true"] .close { opacity: 1; }
/* Emerald top edge on the active tab, like a focused editor tab. */
.tab[aria-current="true"]::before {
  content: "";
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 2px;
  border-radius: 6px 6px 0 0;
  background: var(--accent-strong);
}

.topbar-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.kbd-hint {
  display: flex;
  gap: 3px;
  padding: 4px;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--faint);
  transition: color 0.2s;
}
.kbd-hint:hover { color: var(--text); }
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface);
}

/* ==========================================================================
   Shared window chrome (macOS-style traffic lights)
   ========================================================================== */
.window {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.window-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.dots { position: absolute; left: 16px; display: flex; gap: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.dots i:nth-child(2) { background: var(--amber); }
.dots i:nth-child(3) { background: var(--accent-strong); }

.window-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
}
.window-title svg {
  width: 14px; height: 14px;
  fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round;
}

.window-body { padding: 24px; }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
  padding-top: 84px;
  padding-bottom: 72px;
}

.decl {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--accent);
}
.chip {
  padding: 2px 7px;
  font-size: 12px;
  border: 1px solid var(--accent-strong);
  border-radius: 3px;
  background: rgb(16 185 129 / 0.1);
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--text);
  letter-spacing: -0.025em;
  line-height: 1.1;
}

h1 {
  margin-top: 28px;
  font-size: clamp(3rem, 5.2vw, 4.25rem);
  font-weight: 800;
  line-height: 1;
}

.hero-sub {
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.4vw, 2.9rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--muted);
  max-width: 18ch;
  /* Subtle metallic sheen across the grey headline. */
  background: linear-gradient(100deg, var(--muted) 0%, #d4d4d8 45%, var(--muted) 60%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}


.lead {
  margin-top: 20px;
  max-width: 40rem;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-2);
}


.hero-window {
  margin-top: 28px;
  box-shadow: 0 30px 80px -30px rgb(0 0 0 / 0.8), 0 0 0 1px rgb(255 255 255 / 0.02);
}

.code {
  padding: 18px 0 20px;
  font-size: 13px;
  line-height: 22px;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
  tab-size: 2;
}
.code .line {
  display: block;
  min-height: 22px;
  padding: 0 20px;
  border-left: 2px solid transparent;
  transition: background-color 0.3s, border-color 0.3s;
}
/* The line whose tool the agent is currently calling. */
.code .line.exec {
  background: rgb(16 185 129 / 0.1);
  border-left-color: var(--accent);
}
.code .line.exec .ln { color: var(--accent); }
.code .ln { display: inline-block; width: 2.4ch; margin-right: 1ch; color: var(--faint); user-select: none; transition: color 0.3s; }
.code .kw { color: var(--violet); }
.code .cls { color: var(--blue); }
.code .fn { color: #93c5fd; }
.code .var { color: var(--amber); }
.code .str { color: var(--accent); }
.code .str2 { color: var(--amber); }
.code .pn { color: var(--faint); }
.code .prop { color: var(--muted); }
.cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  margin-left: 1px;
  vertical-align: -3px;
  background: var(--accent);
  animation: blink 1s steps(1) infinite;
}

.run-btn {
  position: absolute;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: rgb(16 185 129 / 0.08);
  border: 1px solid rgb(16 185 129 / 0.5);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.run-btn:hover { background: rgb(16 185 129 / 0.2); color: var(--text); }
.run-btn svg { width: 10px; height: 10px; fill: currentColor; }
.run-btn[data-busy] svg { animation: spin-pulse 1s ease-in-out infinite; }
@keyframes spin-pulse { 50% { opacity: 0.35; } }

/* ---------- Integrated terminal ---------- */
.term { border-top: 1px solid var(--border); background: #111113; }
.term-tabs {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 32px;
  padding: 0 20px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.term-tabs .on { color: var(--text-2); box-shadow: inset 0 -1px 0 var(--accent-strong); line-height: 31px; }
.term-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
}
.term-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); transition: background-color 0.3s; }
.term-status[data-state="running"] { color: var(--accent); }
.term-status[data-state="running"] i { background: var(--accent); animation: spin-pulse 0.9s ease-in-out infinite; }

.term-body {
  height: 190px;
  padding: 6px 20px 14px;
  overflow: hidden;
  font-size: 12px;
  line-height: 20px;
  color: var(--text-2);
  /* Older lines fade out at the top as output scrolls. */
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 28px);
          mask-image: linear-gradient(180deg, transparent 0, #000 28px);
}
.term-body p { white-space: pre-wrap; word-break: break-word; }
.term-body .str { color: var(--accent); }
.t-prompt { color: var(--accent); margin-right: 4px; }
.t-dim { color: var(--faint); }
.t-tool { color: var(--blue); }
.t-ok { color: var(--accent); }
.t-think { color: var(--violet); }
.t-answer { margin-top: 4px; color: var(--text); }
.t-answer::before { content: "◆ "; color: var(--accent); }
.t-meta { color: var(--faint); margin-bottom: 10px; }

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

/* ==========================================================================
   Sections
   ========================================================================== */
.section { padding-top: 64px; padding-bottom: 96px; }

.section-head { margin-bottom: 48px; }
.eyebrow { font-size: 14px; color: var(--accent); }
.section-head h2 {
  margin-top: 8px;
  font-size: clamp(2rem, 3.4vw, 2.6rem);
  font-weight: 700;
}
.section-head h2::after {
  content: "";
  display: block;
  width: 60px;
  height: 2px;
  margin-top: 18px;
  background: var(--accent-strong);
  transform-origin: left;
  transition: transform 0.9s var(--ease-out) 0.2s;
}
.js .section-head.reveal:not(.in) h2::after { transform: scaleX(0); }

.body { color: var(--text-2); line-height: 1.6; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; align-items: start; }

/* ---------- About ---------- */
.about {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 48px;
  align-items: start;
}

.portrait {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
/* About: AI-agent workstation illustration (square, sized in cqw). */
.ws {
  container-type: size;
  background:
    radial-gradient(70% 55% at 50% 38%, rgb(16 185 129 / 0.16), transparent 70%),
    radial-gradient(circle at 1px 1px, rgb(255 255 255 / 0.05) 1px, transparent 0) 0 0 / 16px 16px,
    linear-gradient(180deg, #0b0d0c, #070808);
}
.ws-main, .ws-side {
  position: absolute;
  border: 1px solid #3f3f46;
  background: #111113;
  box-shadow: 0 0 0 1.2cqw #050506, 0 4cqw 10cqw -2cqw rgb(0 0 0 / 0.9), 0 0 12cqw -4cqw rgb(52 211 153 / 0.25);
  overflow: hidden;
}
.ws-main { left: 7cqw; right: 7cqw; top: 8cqw; height: 54cqw; border-radius: 2.4cqw; }
.ws-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 6.5cqw;
  font-size: 2.6cqw;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.ws-bar .dots { left: 2.6cqw; gap: 1.2cqw; }
.ws-bar .dots i { width: 1.6cqw; height: 1.6cqw; }

.ws-code { position: relative; padding: 3cqw 4cqw 0; }
.ws-scroll {
  height: 30cqw;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent);
          mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent);
}
.ws-scroll p, .ws-caret-line {
  display: flex;
  align-items: center;
  gap: 1.2cqw;
  height: 3.3cqw;
  padding-left: calc(var(--in, 0) * 3.2cqw);
}
/* Code is duplicated inside the track, so scrolling by half loops seamlessly. */
.ws-track { animation: ws-scroll 30s linear infinite; }
@keyframes ws-scroll { to { transform: translateY(-50%); } }
.ws i { display: block; height: 1.3cqw; border-radius: 1cqw; }
.c-kw { background: var(--violet); }
.c-fn { background: #93c5fd; }
.c-str { background: var(--accent); }
.c-var { background: var(--amber); }
.c-pn { background: #71717a; }
.c-cm { background: #3f3f46; }

.ws-caret-line {
  margin-top: 0.6cqw;
  border-left: 0.4cqw solid var(--accent);
  background: rgb(16 185 129 / 0.08);
  margin-left: -4cqw;
  padding-left: 7.2cqw;
}
.ws-typing { width: 0; animation: ws-type 3.2s steps(8) infinite; }
@keyframes ws-type { 0% { width: 0; } 60%, 100% { width: 26%; } }
.ws-caret { width: 0.5cqw; height: 2.4cqw; background: var(--accent); animation: blink 1s steps(1) infinite; }

.ws-agent {
  position: absolute;
  right: 3cqw;
  bottom: 3cqw;
  display: inline-flex;
  align-items: center;
  gap: 1.4cqw;
  padding: 1cqw 2.2cqw;
  font-size: 2.5cqw;
  color: var(--text-2);
  border: 1px solid rgb(167 139 250 / 0.5);
  border-radius: 4cqw;
  background: rgb(46 16 101 / 0.75);
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
}
.ws-agent > span:nth-child(2) { color: var(--violet); font-weight: 700; }
.ws-spark { color: var(--violet); animation: spin-pulse 1.6s ease-in-out infinite; }
.ws-task { color: var(--text); transition: opacity 0.3s; }
.ws-task.swap { opacity: 0; }

.ws-stand {
  position: absolute;
  left: 50%;
  top: 62cqw;
  width: 12cqw;
  height: 3.5cqw;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #27272a, #18181b);
  clip-path: polygon(20% 0, 80% 0, 100% 100%, 0 100%);
}

.ws-side { top: 67cqw; height: 22cqw; width: 41cqw; border-radius: 2cqw; padding: 2.6cqw 3cqw; }
.ws-term { left: 7cqw; font-size: 2.4cqw; line-height: 1.55; }
.ws-term ul { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; overflow: hidden; }
.ws-term li { white-space: nowrap; }
.ws-term .ok { color: var(--accent); }
.ws-term .dim { color: var(--muted); }
.ws-term li.new { animation: row-in 0.4s var(--ease-out); }

.ws-chart { right: 7cqw; display: flex; flex-direction: column; }
.ws-chart p { display: flex; justify-content: space-between; font-size: 2.4cqw; color: var(--muted); }
.ws-chart b { color: var(--text); font-variant-numeric: tabular-nums; }
.ws-chart svg { flex: 1; width: 200%; margin-top: 1.5cqw; animation: waves 8s linear infinite; }
.ws-spark-line { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }

.ws-desk {
  position: absolute;
  left: 4cqw;
  right: 4cqw;
  top: 93cqw;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgb(52 211 153 / 0.5), transparent);
  box-shadow: 0 0 4cqw 0.5cqw rgb(52 211 153 / 0.2);
}
.ws.paused *, .ws.paused { animation-play-state: paused !important; }
/* Scanline sheen that sweeps once when the portrait scrolls in. */
.portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgb(52 211 153 / 0.18) 50%, transparent 100%);
  transform: translateY(-100%);
  pointer-events: none;
}
.portrait.in::after { animation: scan 1.4s var(--ease-out) 0.3s both; }
@keyframes scan { to { transform: translateY(100%); } }

.about-copy { padding-top: 76px; }
.about-lead {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  letter-spacing: -0.01em;
}
.about-copy .body { margin-top: 24px; font-size: 15px; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 32px;
}
.stat {
  padding: 20px 15px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.25s, transform 0.25s var(--ease-out);
}
.stat:hover { border-color: var(--accent-strong); transform: translateY(-2px); }
.stat dt {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.stat dd { margin-top: 8px; font-size: 12px; color: var(--muted); }

/* ---------- Skills ---------- */
.skill-card h3 { font-family: var(--font-body); font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.bars { margin-top: 20px; display: grid; gap: 22px; }
.bars li {
  display: grid;
  grid-template-columns: 1fr auto;
  row-gap: 8px;
  font-size: 14px;
  color: var(--text-2);
}
.bars i {
  grid-column: 1 / -1;
  position: relative;
  height: 4px;
  border-radius: 2px;
  background: var(--raised);
  overflow: hidden;
}
.bars i::before {
  content: "";
  position: absolute;
  inset: 0;
  width: calc(var(--v) * 1%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  transform-origin: left;
  transition: transform 1.2s var(--ease-out);
}
.bars li:nth-child(2) i::before { transition-delay: 0.08s; }
.bars li:nth-child(3) i::before { transition-delay: 0.16s; }
.bars li:nth-child(4) i::before { transition-delay: 0.24s; }
.bars li:nth-child(5) i::before { transition-delay: 0.32s; }
.js .skill-card:not(.in) .bars i::before { transform: scaleX(0); }

/* ---------- Cursor spotlight (shared by cards) ---------- */
.spotlight { position: relative; isolation: isolate; }
.spotlight::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgb(52 211 153 / 0.08), transparent 45%);
}
.spotlight::after {
  /* Border that lights up near the cursor. */
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 3;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgb(52 211 153 / 0.7), transparent 60%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.spotlight:hover::before, .spotlight:hover::after { opacity: 1; }

/* ---------- Projects ---------- */
.project {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s;
}
.project:hover { transform: translateY(-4px); box-shadow: 0 24px 48px -24px rgb(0 0 0 / 0.9); }

.project-media {
  aspect-ratio: 432 / 180;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 1px solid var(--border-soft);
  background: var(--raised);
}
.project-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s var(--ease-out); }
.project:hover .project-media img { transform: scale(1.05); }

/* ---------- Ticketing illustration (first project) ----------
   Sized in container-query units so the whole scene scales with the card. */
.gate {
  position: relative;
  container-type: size;
  background:
    radial-gradient(60% 90% at 22% 100%, rgb(16 185 129 / 0.22), transparent 70%),
    radial-gradient(circle at 1px 1px, rgb(255 255 255 / 0.07) 1px, transparent 0) 0 0 / 14px 14px,
    #0c0f0e;
}

.gate-phone {
  position: absolute;
  left: 12cqh;
  top: 12cqh;
  width: 62cqh;
  height: 110cqh;
  padding: 5cqh 4cqh;
  border: 1px solid #52525b;
  border-radius: 11cqh;
  background: linear-gradient(160deg, #27272a, #18181b 60%);
  box-shadow: 0 0 0 3cqh #0a0a0b, 0 20cqh 40cqh -10cqh rgb(0 0 0 / 0.9);
  transform: rotate(-6deg);
  transform-origin: 50% 100%;
}
.gate-phone::before {
  /* speaker notch */
  content: "";
  position: absolute;
  top: 2.2cqh;
  left: 50%;
  width: 14cqh;
  height: 1.6cqh;
  border-radius: 1cqh;
  background: #0a0a0b;
  transform: translateX(-50%);
}
.gate-ticket {
  height: 100%;
  padding: 5cqh 4.5cqh;
  border-radius: 6cqh;
  background: linear-gradient(180deg, #fafafa, #e4e4e7);
  color: #18181b;
  /* ticket stub perforation */
  -webkit-mask: radial-gradient(3cqh at 0 38cqh, #0000 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(3cqh at 100% 38cqh, #0000 98%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(3cqh at 0 38cqh, #0000 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(3cqh at 100% 38cqh, #0000 98%, #000) right / 51% 100% no-repeat;
}
.gt-head { display: flex; justify-content: space-between; align-items: center; gap: 2cqh; white-space: nowrap; font-size: 5cqh; font-weight: 700; letter-spacing: 0.02em; }
.gt-tier { padding: 0.4cqh 2cqh; border-radius: 2cqh; background: var(--accent-strong); color: #fff; font-size: 4cqh; }
.gt-id { margin-top: 3cqh; font-size: 4.4cqh; text-align: center; color: #52525b; }

.gate-qr {
  position: relative;
  margin: 6cqh auto 0;
  width: 44cqh;
  padding: 2.5cqh;
  border-radius: 2.5cqh;
  background: #fff;
  box-shadow: 0 0 0 0.6cqh transparent;
  transition: box-shadow 0.3s;
}
.gate-qr .qr { width: 100%; height: auto; fill: #09090b; transition: opacity 0.3s; }
.gate-beam {
  position: absolute;
  left: -2cqh;
  right: -2cqh;
  top: 0;
  height: 1cqh;
  border-radius: 1cqh;
  background: var(--accent);
  box-shadow: 0 0 4cqh 1.5cqh rgb(52 211 153 / 0.55);
  opacity: 0;
}
.gate.scanning .gate-beam { animation: beam 0.9s ease-in-out; }
@keyframes beam {
  0% { top: 0; opacity: 0; }
  15%, 85% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
.gate-ok {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: rgb(16 185 129 / 0.92);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.25s, transform 0.35s var(--ease-out), background-color 0.25s;
}
.gate-ok svg { width: 55%; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 20; stroke-dashoffset: 20; transition: stroke-dashoffset 0.4s 0.1s var(--ease-out); }
.gate.ok .gate-ok { opacity: 1; transform: none; }
.gate.ok .gate-ok svg { stroke-dashoffset: 0; }
.gate.ok .gate-qr { box-shadow: 0 0 0 0.6cqh var(--accent), 0 0 8cqh rgb(52 211 153 / 0.6); }
.gate.denied .gate-ok { opacity: 1; transform: none; background: rgb(239 68 68 / 0.92); }
.gate.denied .gate-ok svg { stroke-dasharray: none; stroke-dashoffset: 0; }
.gate.denied .gate-qr { box-shadow: 0 0 0 0.6cqh var(--red), 0 0 8cqh rgb(239 68 68 / 0.5); }

/* Dotted link from phone to scanner; a packet travels along it on each scan. */
.gate-link {
  position: absolute;
  left: 80cqh;
  width: 20cqh;
  top: 50cqh;
  height: 1px;
  background: repeating-linear-gradient(90deg, #52525b 0 1.5cqh, transparent 1.5cqh 3cqh);
}
.gate-link i {
  position: absolute;
  top: -1cqh;
  left: 0;
  width: 2cqh;
  height: 2cqh;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 3cqh var(--accent);
  opacity: 0;
}
.gate.scanning .gate-link i { animation: packet 0.9s ease-in 0.3s; }
@keyframes packet { 0% { left: 0; opacity: 1; } 90% { opacity: 1; } 100% { left: 100%; opacity: 0; } }

.gate-panel {
  position: absolute;
  top: 12cqh;
  right: 8cqh;
  bottom: 12cqh;
  left: 102cqh;
  display: flex;
  flex-direction: column;
  padding: 5cqh 6cqh;
  font-size: 5.2cqh;
  line-height: 1.3;
  color: var(--text-2);
  background: rgb(24 24 27 / 0.9);
  border: 1px solid var(--border);
  border-radius: 4cqh;
  box-shadow: 0 16cqh 30cqh -12cqh rgb(0 0 0 / 0.9);
}
.gp-head { display: flex; justify-content: space-between; color: var(--muted); letter-spacing: 0.04em; font-size: 4.4cqh; }
.gp-live { display: inline-flex; align-items: center; gap: 1.6cqh; color: var(--accent); }
.gp-live i { width: 2cqh; height: 2cqh; border-radius: 50%; background: var(--accent); animation: spin-pulse 1.4s ease-in-out infinite; }

.gp-log { flex: 1; margin-top: 3.5cqh; overflow: hidden; }
.gp-log li {
  display: flex;
  justify-content: space-between;
  gap: 3cqh;
  padding: 1.6cqh 0;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.gp-log li span:last-child { color: var(--faint); }
.gp-log .ok span:first-child { color: var(--accent); }
.gp-log .bad span:first-child { color: #f87171; }
.gp-log li.new { animation: row-in 0.45s var(--ease-out); }
@keyframes row-in { from { opacity: 0; transform: translateY(-60%); background: rgb(52 211 153 / 0.15); } }

.gp-count { margin-top: 3cqh; font-size: 4.6cqh; color: var(--muted); }
.gp-count b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.gp-count i {
  display: block;
  position: relative;
  height: 1.6cqh;
  margin-top: 2cqh;
  border-radius: 1cqh;
  background: var(--raised);
  overflow: hidden;
}
.gp-count i::before {
  content: "";
  position: absolute;
  inset: 0;
  width: calc(var(--p) * 1%);
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  transition: width 0.5s var(--ease-out);
}

/* ---------- Swim app illustration (second project) ---------- */
.swim {
  --water: #22d3ee;
  --water-deep: #0891b2;
  position: relative;
  container-type: size;
  overflow: hidden;
  background:
    radial-gradient(70% 80% at 50% 110%, rgb(34 211 238 / 0.28), transparent 70%),
    repeating-linear-gradient(90deg, transparent 0 39cqh, rgb(255 255 255 / 0.04) 39cqh 40cqh),
    linear-gradient(180deg, #071923, #062a36);
}
/* Lane ropes across the pool. */
.swim::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(180deg, transparent 0 33cqh, rgb(34 211 238 / 0.12) 33cqh 34cqh);
}
.swim-waves { position: absolute; left: 0; bottom: 0; width: 200%; height: 30cqh; animation: waves 9s linear infinite; }
.swim-waves .w1 { fill: rgb(34 211 238 / 0.14); }
.swim-waves .w2 { fill: rgb(8 145 178 / 0.22); animation: bob 4s ease-in-out infinite; }
@keyframes waves { to { transform: translateX(-50%); } }
@keyframes bob { 50% { transform: translateY(2px); } }
.swim.paused .swim-waves, .swim.paused .swim-waves .w2 { animation-play-state: paused; }

.swim-os {
  position: absolute;
  top: 7cqh;
  padding: 0.8cqh 3cqh;
  font-size: 4.4cqh;
  font-weight: 700;
  color: var(--water);
  border: 1px solid rgb(34 211 238 / 0.5);
  border-radius: 10cqh;
  background: rgb(6 42 54 / 0.8);
}
.os-ios { left: 8cqh; }
.os-android { right: 8cqh; }

.swim-phone {
  position: absolute;
  top: 12cqh;
  width: 62cqh;
  height: 112cqh;
  padding: 3cqh;
  border: 1px solid #52525b;
  background: #18181b;
  box-shadow: 0 0 0 2cqh #0a0a0b, 0 20cqh 40cqh -10cqh rgb(0 0 0 / 0.9);
}
.swim-phone.ios { left: 40cqh; border-radius: 12cqh; transform: rotate(-5deg); }
.swim-phone.android { right: 40cqh; border-radius: 7cqh; transform: rotate(5deg); }
/* Dynamic Island vs. punch-hole camera: the tell-tale of each platform. */
.swim-phone::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 5cqh;
  left: 50%;
  transform: translateX(-50%);
  background: #0a0a0b;
}
.swim-phone.ios::before { width: 18cqh; height: 5cqh; border-radius: 3cqh; }
.swim-phone.android::before { width: 4cqh; height: 4cqh; border-radius: 50%; }

.sp-screen {
  position: relative;
  height: 100%;
  padding: 11cqh 5cqh 4cqh;
  overflow: hidden;
  color: #0f172a;
  background: linear-gradient(180deg, #f0fdff, #ffffff 40%);
}
.ios .sp-screen { border-radius: 9cqh; }
.android .sp-screen { border-radius: 4.5cqh; }
.sp-title { font-family: var(--font-display); font-size: 6cqh; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.sp-sub { margin-top: 0.6cqh; font-size: 3.8cqh; color: #64748b; line-height: 1.2; }

.sp-slots { margin-top: 4cqh; display: grid; gap: 2.4cqh; }
.sp-slots li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2.2cqh 3cqh;
  font-size: 3.8cqh;
  font-weight: 600;
  border-radius: 2.6cqh;
  background: #e0f7fb;
  color: #0e7490;
  transition: background-color 0.3s, color 0.3s, transform 0.3s var(--ease-out);
}
.sp-slots li.full { background: #f1f5f9; color: #94a3b8; text-decoration: line-through; }
.sp-slots li.full span:last-child { text-decoration: none; }
.sp-pick { padding: 0.4cqh 2cqh; border-radius: 4cqh; background: #fff; font-size: 3.4cqh; }
.sp-slots li.booked { background: var(--water-deep); color: #fff; transform: scale(1.04); }
.sp-slots li.booked .sp-pick { background: rgb(255 255 255 / 0.25); color: #fff; }

.sp-tap {
  position: absolute;
  width: 9cqh;
  height: 9cqh;
  border-radius: 50%;
  background: rgb(8 145 178 / 0.35);
  border: 1px solid rgb(8 145 178 / 0.6);
  opacity: 0;
  pointer-events: none;
}
.swim.tapping .sp-tap { animation: tap 0.6s var(--ease-out); }
@keyframes tap { 0% { opacity: 0; transform: scale(1.8); } 40% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(0.8); } }

/* Sync link between the phones. */
.swim-link {
  position: absolute;
  left: 106cqh;
  right: 106cqh;
  top: 48cqh;
  height: 1px;
  background: repeating-linear-gradient(90deg, rgb(34 211 238 / 0.5) 0 1.5cqh, transparent 1.5cqh 3cqh);
}
.swim-link i {
  position: absolute;
  top: -1cqh;
  left: 0;
  width: 2cqh;
  height: 2cqh;
  border-radius: 50%;
  background: var(--water);
  box-shadow: 0 0 3cqh var(--water);
  opacity: 0;
}
.swim.syncing .swim-link i { animation: packet 0.7s ease-in; }

.sp-notif {
  position: absolute;
  z-index: 1;
  top: 2cqh;
  left: 2.5cqh;
  right: 2.5cqh;
  padding: 2cqh 3cqh;
  font-size: 3.2cqh;
  line-height: 1.3;
  color: #f8fafc;
  border-radius: 3cqh;
  background: rgb(15 23 42 / 0.94);
  box-shadow: 0 3cqh 8cqh -2cqh rgb(0 0 0 / 0.5);
  transform: translateY(-130%);
  transition: transform 0.5s var(--ease-out);
}
.sp-notif b { display: block; font-size: 3.6cqh; color: var(--water); }
.sp-notif span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swim.notified .sp-notif { transform: none; }

.sp-ring { position: relative; width: 30cqh; margin: 4cqh auto 0; }
.sp-ring svg { width: 100%; transform: rotate(-90deg); }
.sp-ring circle { fill: none; stroke: #e0f2f7; stroke-width: 3.4; }
.sp-ring .val {
  stroke: var(--water-deep);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: calc(100 - var(--p));
  transition: stroke-dashoffset 0.9s var(--ease-out);
}
.sp-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 5cqh; font-weight: 700; color: #0e7490; }

.sp-badges { display: flex; justify-content: center; gap: 2cqh; margin-top: 4cqh; }
.sp-badges i { width: 6cqh; height: 6cqh; border-radius: 50%; background: #e2e8f0; transition: background-color 0.4s, box-shadow 0.4s; }
.sp-badges i.on { background: linear-gradient(135deg, #fbbf24, #f59e0b); box-shadow: 0 0 0 0.6cqh #fef3c7; }

/* ---------- Payments failover illustration (third project) ----------
   The scene is 240 × 100 cqh, and the SVG wires use the same 240 × 100 viewBox,
   so wires and HTML boxes share one coordinate system. */
.pay {
  --ok: #34d399;
  --bad: #f87171;
  --pay: #a78bfa;
  position: relative;
  container-type: size;
  overflow: hidden;
  background:
    radial-gradient(55% 90% at 20% 50%, rgb(139 92 246 / 0.22), transparent 70%),
    radial-gradient(circle at 1px 1px, rgb(255 255 255 / 0.06) 1px, transparent 0) 0 0 / 14px 14px,
    #0d0b14;
}

.pay-wires { position: absolute; inset: 0; width: 100%; height: 100%; }
.pay-wires path { fill: none; vector-effect: non-scaling-stroke; }
.pay-wires .wire { stroke: #3f3f46; stroke-width: 1; stroke-dasharray: 3 3; }
.pay-wires .flow { stroke-width: 2; stroke-linecap: round; stroke-dasharray: 18 100; stroke-dashoffset: 18; opacity: 0; }
.pay-wires .to-a { stroke: var(--pay); }
.pay-wires .to-b { stroke: var(--ok); }
.pay.to-a .flow.to-a, .pay.to-b .flow.to-b { animation: flow 0.7s ease-in forwards; }
@keyframes flow { 0% { opacity: 1; stroke-dashoffset: 18; } 90% { opacity: 1; } 100% { opacity: 0; stroke-dashoffset: -100; } }

/* Checkout card */
.pay-checkout {
  position: absolute;
  left: 8cqh;
  top: 14cqh;
  width: 64cqh;
  height: 72cqh;
  padding: 6cqh 6cqh;
  border-radius: 5cqh;
  background: linear-gradient(180deg, #ffffff, #f4f4f5);
  color: #18181b;
  box-shadow: 0 16cqh 30cqh -10cqh rgb(0 0 0 / 0.8), 0 0 0 1px rgb(255 255 255 / 0.1);
}
.pc-label { font-size: 4cqh; color: #71717a; line-height: 1.2; }
.pc-amount { margin-top: 1cqh; font-family: var(--font-display); font-size: 9cqh; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pc-method {
  display: flex;
  align-items: center;
  gap: 2.4cqh;
  margin-top: 4cqh;
  padding: 2.6cqh 3cqh;
  font-size: 4cqh;
  font-weight: 600;
  border: 1px solid #e4e4e7;
  border-radius: 2.6cqh;
  background: #fff;
  white-space: nowrap;
}
.pc-method i { flex-shrink: 0; width: 6cqh; height: 4cqh; border-radius: 1cqh; background: linear-gradient(135deg, #8b5cf6, #3b82f6); }
.pc-method span { transition: opacity 0.25s; }
.pay.swap .pc-method span { opacity: 0; }

.pc-btn {
  position: relative;
  display: grid;
  place-items: center;
  height: 12cqh;
  margin-top: 4cqh;
  font-size: 4.4cqh;
  font-weight: 700;
  color: #fff;
  border-radius: 2.6cqh;
  background: #18181b;
  transition: background-color 0.3s, transform 0.2s;
}
.pc-btn > span { grid-area: 1 / 1; display: inline-flex; align-items: center; gap: 2cqh; opacity: 0; transition: opacity 0.2s; }
.pc-idle { opacity: 1 !important; }
.pay.busy .pc-idle, .pay.done .pc-idle { opacity: 0 !important; }
.pay.busy .pc-busy { opacity: 1; }
.pay.busy .pc-btn { transform: scale(0.97); }
.pay.done .pc-busy { opacity: 0; }
.pay.done .pc-done { opacity: 1; }
.pay.done .pc-btn { background: #059669; transform: none; }
.pc-busy i { width: 3.6cqh; height: 3.6cqh; border-radius: 50%; border: 0.7cqh solid rgb(255 255 255 / 0.3); border-top-color: #fff; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Gateways */
.pay-gw {
  position: absolute;
  left: 94cqh;
  width: 56cqh;
  height: 20cqh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1cqh;
  padding: 0 4cqh;
  font-size: 3.8cqh;
  line-height: 1.2;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 3cqh;
  background: rgb(24 24 27 / 0.92);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.gw-a { top: 18cqh; }
.gw-b { top: 62cqh; }
.pay-gw b { font-size: 4.2cqh; font-weight: 700; color: var(--text); }
.pay-gw > span { display: none; align-items: center; gap: 1.6cqh; }
.pay-gw .gw-idle { display: inline-flex; }
.gw-idle i { width: 1.8cqh; height: 1.8cqh; border-radius: 50%; background: var(--faint); }
.gw-bad { color: var(--bad); }
.gw-ok { color: var(--ok); }
.pay.a-fail .gw-a .gw-idle, .pay.a-ok .gw-a .gw-idle, .pay.b-ok .gw-b .gw-idle { display: none; }
.pay.a-fail .gw-a .gw-bad, .pay.a-ok .gw-a .gw-ok, .pay.b-ok .gw-b .gw-ok { display: inline-flex; }
.pay.a-fail .gw-a { border-color: rgb(248 113 113 / 0.7); box-shadow: 0 0 6cqh rgb(248 113 113 / 0.25); animation: shake 0.35s; }
.pay.a-ok .gw-a, .pay.b-ok .gw-b { border-color: rgb(52 211 153 / 0.7); box-shadow: 0 0 6cqh rgb(52 211 153 / 0.25); }
@keyframes shake { 25% { transform: translateX(-1cqh); } 75% { transform: translateX(1cqh); } }

.pay-reroute {
  position: absolute;
  left: 97cqh;
  top: 45cqh;
  font-size: 3.8cqh;
  color: var(--pay);
  opacity: 0;
  transform: translateY(1cqh);
  transition: opacity 0.25s, transform 0.25s;
}
.pay.rerouting .pay-reroute { opacity: 1; transform: none; }

/* Live failover panel */
.pay-panel {
  position: absolute;
  left: 164cqh;
  right: 6cqh;
  top: 12cqh;
  bottom: 12cqh;
  display: flex;
  flex-direction: column;
  padding: 5cqh 5cqh;
  font-size: 3.8cqh;
  line-height: 1.25;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4cqh;
  background: rgb(24 24 27 / 0.92);
  box-shadow: 0 16cqh 30cqh -12cqh rgb(0 0 0 / 0.9);
}
.pp-head { display: flex; justify-content: space-between; font-size: 3.6cqh; letter-spacing: 0.06em; }
.pp-live { display: inline-flex; align-items: center; gap: 1.4cqh; color: var(--ok); }
.pp-live i { width: 1.8cqh; height: 1.8cqh; border-radius: 50%; background: var(--ok); animation: spin-pulse 1.4s ease-in-out infinite; }
.pp-label { margin-top: auto; }
.pp-saved {
  font-size: 8cqh;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ok);
  font-variant-numeric: tabular-nums;
  transition: text-shadow 0.4s;
}
.pay.bump .pp-saved { text-shadow: 0 0 5cqh rgb(52 211 153 / 0.7); }
.pp-rate { display: flex; justify-content: space-between; margin-top: 3cqh; }
.pp-rate b { color: var(--text); }
.pp-bar {
  position: relative;
  display: block;
  height: 1.6cqh;
  margin-top: 1.6cqh;
  border-radius: 1cqh;
  background: var(--raised);
  overflow: hidden;
}
.pp-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 99.9%;
  background: linear-gradient(90deg, var(--accent-strong), var(--ok), var(--accent-strong));
  background-size: 200% 100%;
  animation: shimmer 2.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.pay.paused .pp-bar::before { animation-play-state: paused; }
.pp-foot { margin-top: auto; font-size: 3.4cqh; color: var(--faint); }
.pp-foot span { color: var(--text-2); }

/* ---------- AI assistant illustration (fourth project) ---------- */
.ai {
  --ok: #34d399;
  --ai: #a78bfa;
  --ai-2: #60a5fa;
  position: relative;
  container-type: size;
  overflow: hidden;
  background:
    radial-gradient(50% 80% at 30% 40%, rgb(139 92 246 / 0.25), transparent 70%),
    radial-gradient(40% 70% at 85% 90%, rgb(59 130 246 / 0.18), transparent 70%),
    radial-gradient(circle at 1px 1px, rgb(255 255 255 / 0.06) 1px, transparent 0) 0 0 / 14px 14px,
    #0b0a12;
}

.ai-chat {
  position: absolute;
  left: 8cqh;
  top: 9cqh;
  bottom: 9cqh;
  width: 138cqh;
  display: flex;
  flex-direction: column;
  border-radius: 4cqh;
  background: #fafafa;
  color: #18181b;
  overflow: hidden;
  box-shadow: 0 16cqh 30cqh -10cqh rgb(0 0 0 / 0.85), 0 0 0 1px rgb(255 255 255 / 0.08);
}
.ac-head {
  display: flex;
  align-items: center;
  gap: 2.4cqh;
  padding: 2.6cqh 4cqh;
  border-bottom: 1px solid #e4e4e7;
  background: #fff;
  font-size: 3.8cqh;
  line-height: 1.2;
}
.ac-head b { display: block; font-size: 4cqh; }
.ac-head small { display: block; font-size: 3.2cqh; color: #16a34a; }
.ac-avatar {
  display: grid;
  place-items: center;
  width: 7cqh;
  height: 7cqh;
  border-radius: 50%;
  font-size: 3.6cqh;
  color: #fff;
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
}

.ac-body { flex: 1; display: flex; flex-direction: column; gap: 2.2cqh; padding: 3.4cqh 4cqh; font-size: 3.8cqh; line-height: 1.35; }
.ac-q, .ac-a { max-width: 82%; padding: 2cqh 3cqh; border-radius: 3cqh; }
.ac-q { align-self: flex-end; color: #fff; background: #18181b; border-bottom-right-radius: 0.8cqh; }
.ac-a { align-self: flex-start; background: #ede9fe; color: #2e1065; border-bottom-left-radius: 0.8cqh; min-height: 1.35em; }
.ac-search { display: flex; align-items: center; gap: 1.8cqh; font-size: 3.2cqh; color: #7c3aed; }
.ac-spin { width: 2.8cqh; height: 2.8cqh; border-radius: 50%; border: 0.6cqh solid #ddd6fe; border-top-color: #7c3aed; animation: spin 0.8s linear infinite; }
.ac-act {
  align-self: flex-start;
  padding: 0.8cqh 2.4cqh;
  font-size: 3.2cqh;
  color: #047857;
  border: 1px solid #a7f3d0;
  border-radius: 3cqh;
  background: #ecfdf5;
}
.ac-act.handoff { color: #1d4ed8; border-color: #bfdbfe; background: #eff6ff; }

/* Step visibility is driven by classes on .ai (JS). Without JS all steps show. */
.js .ai .ac-q, .js .ai .ac-search, .js .ai .ac-a, .js .ai .ac-act {
  opacity: 0;
  transform: translateY(1.5cqh);
  transition: opacity 0.35s, transform 0.35s var(--ease-out);
}
.js .ai.s-q .ac-q, .js .ai.s-search .ac-search, .js .ai.s-a .ac-a, .js .ai.s-act .ac-act { opacity: 1; transform: none; }
.js .ai.s-a .ac-search { opacity: 0.55; }
.js .ai.s-a .ac-spin { animation: none; border-color: #7c3aed; }

.ai-panel {
  position: absolute;
  left: 156cqh;
  right: 8cqh;
  top: 9cqh;
  bottom: 9cqh;
  display: flex;
  flex-direction: column;
  padding: 5cqh;
  font-size: 3.6cqh;
  line-height: 1.3;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4cqh;
  background: rgb(24 24 27 / 0.92);
  box-shadow: 0 16cqh 30cqh -12cqh rgb(0 0 0 / 0.9);
}
.ai-big {
  font-size: 10cqh;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(90deg, var(--ai), var(--ai-2));
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ai-bar { position: relative; display: block; height: 1.6cqh; margin-top: 2cqh; border-radius: 1cqh; background: var(--raised); overflow: hidden; }
.ai-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  width: calc(var(--p) * 1%);
  background: linear-gradient(90deg, var(--ai), var(--ai-2));
  transition: width 0.6s var(--ease-out);
}
.ai-rows { margin-top: auto; display: grid; gap: 1.4cqh; }
.ai-rows p { display: flex; justify-content: space-between; gap: 2cqh; white-space: nowrap; }
.ai-rows b { color: var(--text); font-weight: 700; }

/* Featured deployments: 2 × 2, equal-height cards. */
.projects { align-items: stretch; }

.project-body { flex: 1; padding: 20px 20px 22px; }
.project h3 { font-size: 20px; font-weight: 700; }
.project-body p { margin-top: 10px; font-size: 14px; line-height: 1.5; color: var(--text-2); }

/* ---------- Contact ---------- */
.contact { gap: 48px; }
.contact-copy h3 { font-family: var(--font-display); font-size: 24px; font-weight: 700; }
.contact-copy .body { margin-top: 24px; font-size: 15px; }

.creds {
  margin-top: 24px;
  padding: 20px;
  display: grid;
  gap: 10px;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}
.creds .k { color: var(--muted); }
.creds a { border-bottom: 1px dashed var(--border); transition: color 0.2s, border-color 0.2s; }
.creds a:hover { color: var(--accent); border-color: var(--accent); }

.copy {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  background: none;
  border: 0;
  border-bottom: 1px dashed var(--border);
  cursor: copy;
  font-family: var(--font-mono);
  transition: color 0.2s, border-color 0.2s;
}
.copy:hover { color: var(--accent); border-color: var(--accent); }
.copy-state { font-size: 11px; color: var(--accent); }

.form .window-body { display: grid; gap: 16px; }
.field { display: grid; gap: 8px; }
.field > span { font-size: 13px; color: var(--text); }
.field input, .field textarea {
  width: 100%;
  padding: 11px 16px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  caret-color: var(--accent);
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.field textarea { resize: vertical; min-height: 44px; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent-strong);
  background: var(--bg);
  box-shadow: 0 0 0 3px rgb(16 185 129 / 0.18);
}
.field [aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 3px rgb(239 68 68 / 0.15); }

.form-status { min-height: 0; font-size: 12px; color: var(--muted); }
.form-status:empty { display: none; }
.form-status.err { color: #f87171; }
.form-status.ok { color: var(--accent); }
.form .btn-solid { height: 42px; margin-top: 4px; }

/* ==========================================================================
   Status bar
   ========================================================================== */
.statusbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 50;
  height: var(--statusbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  font-size: 11px;
  color: var(--muted);
  background: rgb(24 24 27 / 0.9);
  border-top: 1px solid var(--border);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
}
.statusbar > div { display: flex; align-items: center; gap: 20px; white-space: nowrap; }
.statusbar span { display: inline-flex; align-items: center; gap: 6px; }
.statusbar svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.sb-section { color: var(--text-2); }

.pulse {
  position: relative;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-strong);
}
.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent);
  animation: ping 2s var(--ease-out) infinite;
}
@keyframes ping { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(3); opacity: 0; } }

/* ==========================================================================
   Command palette
   ========================================================================== */
.palette {
  margin: 14vh auto auto;
  width: min(560px, calc(100% - 32px));
  max-height: none;
  padding: 0;
  background: transparent;
  border: 0;
  color: inherit;
  overflow: visible;
}
.palette::backdrop { background: rgb(0 0 0 / 0.6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.palette[open] .palette-inner { animation: pop 0.22s var(--ease-out); }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }

.palette-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 40px 80px -20px rgb(0 0 0 / 0.9), 0 0 0 1px rgb(52 211 153 / 0.08);
  overflow: hidden;
}
.palette-input {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}
.palette-input input {
  flex: 1;
  height: 52px;
  background: none;
  border: 0;
  outline: none;
  font-size: 15px;
  color: var(--text);
}
.palette-input input::placeholder { color: var(--faint); }
.palette-input kbd { color: var(--faint); }

.palette-list { max-height: 320px; overflow-y: auto; padding: 6px; font-size: 13px; }
.palette-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--text-2);
  cursor: pointer;
}
.palette-list li .hint { color: var(--faint); font-size: 11px; }
.palette-list li[aria-selected="true"] { background: rgb(16 185 129 / 0.12); color: var(--text); }
.palette-list li[aria-selected="true"] .hint { color: var(--accent); }
.palette-list .empty { color: var(--faint); cursor: default; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--statusbar-h) + 20px);
  z-index: 60;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--accent-strong);
  border-radius: 8px;
  box-shadow: 0 16px 40px -12px rgb(0 0 0 / 0.8);
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   Scroll reveal
   ========================================================================== */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
  transition-delay: var(--d, 0s);
}
.js .reveal.in { opacity: 1; transform: none; }
/* Cards keep their own hover transform once revealed. */
.js .project.reveal.in { transition: opacity 0.8s var(--ease-out), transform 0.35s var(--ease-out), box-shadow 0.35s; transition-delay: var(--d, 0s), 0s, 0s; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1180px) {
  .tabs .tab:nth-child(n + 3) { display: none; }
  .about { grid-template-columns: 320px 1fr; }
  .about-copy { padding-top: 0; }
  .stats { gap: 16px; }
}

@media (max-width: 960px) {
  :root { --gutter: 32px; }
  .tabs { display: none; }
  .hero { grid-template-columns: 1fr; padding-top: 56px; padding-bottom: 72px; }
  .hero-window { margin-top: 0; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .grid-2 { grid-template-columns: 1fr; }
  .about { grid-template-columns: 1fr; }
  .portrait { max-width: 400px; }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; --topbar-h: 52px; }
  .kbd-hint { display: none; }
  .logo { font-size: 16px; }
  .topbar-actions .btn-outline { font-size: 12px; padding: 0 10px; }
  .hero { padding-top: 40px; gap: 36px; }
  .code { font-size: 11.5px; line-height: 20px; }
  .code .line { padding: 0 12px; min-height: 20px; }
  .term-tabs, .term-body { padding-inline: 12px; }
  .term-body { height: 210px; font-size: 11px; line-height: 18px; }
  .run-btn { right: 8px; }
  .section { padding-top: 40px; padding-bottom: 56px; }
  .section-head { margin-bottom: 32px; }
  .grid-3 { grid-template-columns: 1fr; }
  .stats { gap: 12px; }
  .stat dt { font-size: 24px; }
  .window-body { padding: 20px; }
  .statusbar { padding: 0 16px; }
  .statusbar .hide-sm, .sb-section { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}
