/* ============================================================
   Muzzammil Ahmed - portfolio
   Design system: "Dark Engineering Console"
   ============================================================ */

/* ---------- 1. tokens ---------- */

:root {
  color-scheme: dark;

  --bg: #07080c;
  --bg-elev: #0a0c12;
  --surface: #0f1219;
  --surface-2: #151926;
  --surface-3: #1c2130;

  --line: rgba(255, 255, 255, 0.075);
  --line-2: rgba(255, 255, 255, 0.14);

  --tx: #e9ebf4;
  --tx-2: #a2a9c0;
  --tx-3: #6d748d;

  --violet: #6d5efc;
  --violet-2: #9a8dff;
  --mint: #22d3a7;
  --amber: #ffb066;

  --glow: rgba(109, 94, 252, 0.4);
  --glow-mint: rgba(34, 211, 167, 0.32);

  --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;

  --shell: 1180px;
  --gutter: clamp(1.15rem, 4vw, 2.5rem);
  --radius: 18px;
  --radius-sm: 11px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --header-h: 68px;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f4f6fb;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --surface-3: #e3e8f3;

  --line: rgba(12, 16, 34, 0.09);
  --line-2: rgba(12, 16, 34, 0.17);

  --tx: #11131e;
  --tx-2: #4d5470;
  --tx-3: #7b8299;

  --violet: #5a46f0;
  --violet-2: #6d5efc;
  --mint: #0d9a76;
  --amber: #c06a12;

  --glow: rgba(90, 70, 240, 0.22);
  --glow-mint: rgba(13, 154, 118, 0.2);
}

/* ---------- 2. reset ---------- */

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

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--tx-2);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

body.is-locked {
  overflow: hidden;
}

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

img {
  height: auto;
}

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

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
}

button {
  cursor: pointer;
}

ul {
  list-style: none;
}

/* component display rules (flex/grid) otherwise beat the hidden attribute */
[hidden] {
  display: none !important;
}

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

::selection {
  background: var(--violet);
  color: #fff;
}

/* ---------- 3. typography ---------- */

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  color: var(--tx);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.t-hero {
  font-size: clamp(2.55rem, 7vw, 5rem);
  font-weight: 800;
  letter-spacing: -0.045em;
}

.t-section {
  font-size: clamp(1.95rem, 4.6vw, 3.05rem);
}

.t-card {
  font-size: clamp(1.1rem, 1.8vw, 1.3rem);
  letter-spacing: -0.02em;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.grad-tx {
  background: linear-gradient(96deg, var(--violet-2) 0%, var(--mint) 62%, var(--amber) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- 4. layout ---------- */

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

.section {
  position: relative;
  z-index: 1;
  padding-block: clamp(4.5rem, 11vw, 8.5rem);
}

.section--tint {
  background: var(--bg-elev);
  border-block: 1px solid var(--line);
}

.sec-head {
  max-width: 640px;
  margin-bottom: clamp(2.4rem, 5vw, 4rem);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--mint);
  margin-bottom: 1.1rem;
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
}

.sec-head p {
  margin-top: 1rem;
  font-size: 1.03rem;
  color: var(--tx-2);
  max-width: 54ch;
}

.skip-link {
  position: fixed;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 200;
  padding: 0.65rem 1.1rem;
  background: var(--violet);
  color: #fff;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  transform: translateY(-180%);
  transition: transform 0.25s var(--ease);
}

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

.icon {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.icon--solid {
  fill: currentColor;
  stroke: none;
}

/* ---------- 5. buttons ---------- */

.btn {
  --btn-bg: var(--surface-2);
  --btn-tx: var(--tx);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-tx);
  border: 1px solid var(--line-2);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease),
    box-shadow 0.25s var(--ease), background-color 0.25s var(--ease);
}

.btn:hover {
  transform: translateY(-2px);
  border-color: var(--violet);
}

.btn:active {
  transform: translateY(0);
}

.btn .icon {
  width: 1.05em;
  height: 1.05em;
}

.btn--primary {
  --btn-tx: #fff;
  background: linear-gradient(135deg, var(--violet) 0%, #4f3fe0 100%);
  border-color: transparent;
  box-shadow: 0 10px 30px -10px var(--glow);
}

.btn--primary:hover {
  box-shadow: 0 16px 40px -12px var(--glow);
  border-color: transparent;
}

.btn--ghost {
  background: transparent;
}

.btn--sm {
  padding: 0.55rem 1rem;
  font-size: 0.82rem;
}

.btn.is-busy {
  pointer-events: none;
  opacity: 0.75;
}

/* ---------- 6. progress + header ---------- */

.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 120;
}

.progress__fill {
  height: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, var(--violet) 0%, var(--mint) 70%, var(--amber) 100%);
}

.header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.header.is-stuck {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom-color: var(--line);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--tx);
  letter-spacing: -0.02em;
}

.brand__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 4px var(--glow-mint);
}

.brand__mark {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.05em;
  background: linear-gradient(120deg, var(--violet-2), var(--mint));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.nav a {
  position: relative;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--tx-2);
  transition: color 0.22s var(--ease), background-color 0.22s var(--ease);
}

.nav a:hover {
  color: var(--tx);
  background: var(--surface-2);
}

.nav a.is-active {
  color: var(--tx);
}

.nav a.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0.12rem;
  width: 14px;
  height: 2px;
  border-radius: 2px;
  transform: translateX(-50%);
  background: var(--violet-2);
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.theme-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  color: var(--tx-2);
  transition: color 0.22s var(--ease), border-color 0.22s var(--ease),
    transform 0.35s var(--ease);
}

.theme-btn:hover {
  color: var(--tx);
  border-color: var(--violet);
  transform: rotate(20deg);
}

.theme-btn .icon {
  width: 17px;
  height: 17px;
}

.theme-btn .icon--moon {
  display: none;
}

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

:root[data-theme="light"] .theme-btn .icon--moon {
  display: block;
}

.burger {
  display: none;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  color: var(--tx);
}

.burger .icon {
  width: 19px;
  height: 19px;
}

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(320px, 84vw);
  z-index: 140;
  background: var(--bg-elev);
  border-left: 1px solid var(--line);
  padding: 1.5rem var(--gutter) 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  transform: translateX(101%);
  transition: transform 0.42s var(--ease);
  overflow-y: auto;
}

.drawer.is-open {
  transform: none;
}

.drawer__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.4rem;
}

.drawer a {
  padding: 0.85rem 0.4rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--tx);
}

.drawer a .idx {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--violet-2);
  margin-right: 0.75rem;
}

.drawer .btn {
  margin-top: 1.6rem;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 130;
  background: rgba(4, 5, 9, 0.72);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease), visibility 0.35s;
}

.scrim.is-open {
  opacity: 1;
  visibility: visible;
}

/* ---------- 7. webgl stage ---------- */

#stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  contain: strict;
}

#stage canvas {
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.9s ease;
}

#stage.is-live canvas {
  opacity: 1;
}

/* CSS-only backdrop: visible before three.js boots and as the permanent
   fallback when WebGL is unavailable. */
.stage-fallback {
  position: absolute;
  inset: 0;
  background: radial-gradient(
      58% 44% at 16% 24%,
      color-mix(in srgb, var(--violet) 26%, transparent),
      transparent 70%
    ),
    radial-gradient(
      46% 38% at 84% 70%,
      color-mix(in srgb, var(--mint) 18%, transparent),
      transparent 72%
    );
  transition: opacity 0.9s ease;
}

#stage.is-live .stage-fallback {
  opacity: 0;
}

/* Keeps hero and pipeline copy legible wherever the scene drifts behind it. */
#stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
      101deg,
      var(--bg) 0%,
      color-mix(in srgb, var(--bg) 72%, transparent) 30%,
      transparent 58%
    ),
    linear-gradient(0deg, color-mix(in srgb, var(--bg) 55%, transparent) 0%, transparent 26%);
}

/* ---------- 8. hero ---------- */

.hero {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-block: calc(var(--header-h) + 3rem) 4rem;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  width: 100%;
}

/* a grid item's default min-width is auto, so one wide child drags the whole
   column past the viewport on a 320px screen */
.hero__grid > * {
  min-width: 0;
}

.hero__lead {
  margin-top: 1.5rem;
  font-size: clamp(1rem, 1.35vw, 1.12rem);
  color: var(--tx-2);
  max-width: 52ch;
}

.hero__lead strong {
  color: var(--tx);
  font-weight: 600;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2.2rem;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  margin-top: 2.4rem;
  font-size: 0.82rem;
  color: var(--tx-3);
}

.hero__meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.hero__meta .icon {
  width: 14px;
  height: 14px;
  color: var(--violet-2);
}

.socials {
  display: flex;
  gap: 0.5rem;
}

.socials a {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  color: var(--tx-2);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  transition: color 0.22s var(--ease), border-color 0.22s var(--ease),
    transform 0.22s var(--ease);
}

.socials a:hover {
  color: var(--tx);
  border-color: var(--violet);
  transform: translateY(-3px);
}

.socials .icon {
  width: 17px;
  height: 17px;
}

/* stat strip */
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 2.6rem;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.stats > div {
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 1.05rem 1.1rem;
}

.stats dt {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.6vw, 1.85rem);
  font-weight: 700;
  color: var(--tx);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stats dd {
  font-size: 0.74rem;
  color: var(--tx-3);
  margin-top: 0.2rem;
  line-height: 1.35;
}

.hero__side {
  display: grid;
  gap: 1.1rem;
  align-content: center;
  min-width: 0;
}

/* github activity */
.gh {
  display: grid;
  gap: 0.6rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.gh__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.78rem;
}

.gh__ttl {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  color: var(--tx-2);
}

.gh__ttl .icon {
  width: 15px;
  height: 15px;
}

.gh__link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--tx-3);
}

.gh__link:hover {
  color: var(--mint);
}

.gh__plot {
  display: grid;
  width: 100%;
  aspect-ratio: var(--gh-cols, 53) / 7;
  grid-template-columns: repeat(var(--gh-cols, 53), 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 1.5px;
}

.gh__plot i {
  border-radius: 2px;
  background: color-mix(in srgb, var(--surface-2) 82%, var(--line));
  outline-offset: 2px;
  transition: transform 0.12s ease;
}

.gh__plot i[data-tip]:hover,
.gh__plot i[data-tip]:focus-visible {
  transform: scale(1.55);
}

.gh__plot i[data-lv="1"] {
  background: color-mix(in srgb, var(--mint) 34%, var(--surface-2));
}

.gh__plot i[data-lv="2"] {
  background: color-mix(in srgb, var(--mint) 58%, var(--surface-2));
}

.gh__plot i[data-lv="3"] {
  background: color-mix(in srgb, var(--mint) 80%, var(--surface-2));
}

.gh__plot i[data-lv="4"] {
  background: var(--mint);
}

.gh__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.4rem;
  font-size: 0.72rem;
  color: var(--tx-3);
}

.gh__foot div {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}

.gh__foot dt {
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--tx);
}

.gh__tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 120;
  padding: 0.34rem 0.6rem;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: var(--surface-2);
  box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.9);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  white-space: nowrap;
  pointer-events: none;
}

/* avatar card */
.hero__card {
  position: relative;
  border-radius: 26px;
  border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 1.35rem;
  box-shadow: 0 34px 90px -40px rgba(0, 0, 0, 0.85);
}

.hero__card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(150deg, var(--violet), transparent 42%, var(--mint));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.55;
  pointer-events: none;
}

.hero__card img {
  width: 100%;
  border-radius: 18px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: radial-gradient(
    72% 72% at 50% 18%,
    color-mix(in srgb, var(--violet) 42%, transparent),
    color-mix(in srgb, var(--surface-2) 92%, transparent) 78%
  );
}

.hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1.1rem;
}

.chip {
  padding: 0.3rem 0.68rem;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tx-2);
}

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 1.6rem;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--tx-3);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.scroll-hint__rail {
  width: 1px;
  height: 42px;
  background: linear-gradient(var(--violet-2), transparent);
  position: relative;
  overflow: hidden;
}

.scroll-hint__rail::after {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 1px;
  height: 14px;
  background: var(--mint);
  animation: railRun 2.1s ease-in-out infinite;
}

@keyframes railRun {
  0% {
    transform: translateY(-16px);
  }
  100% {
    transform: translateY(46px);
  }
}

/* Opaque wrapper for everything past the WebGL stage, so the fixed canvas
   stops showing through once the pipeline is done. */
.after-stage {
  position: relative;
  z-index: 1;
  background: var(--bg);
}

/* ---------- 9. pipeline (scroll-driven 3D) ---------- */

.pipeline {
  position: relative;
  z-index: 1;
  height: 560vh;
}

.pipeline__sticky {
  position: sticky;
  top: 0;
  height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-block: calc(var(--header-h) + 1.5rem) 2rem;
  pointer-events: none;
}

.pipeline__sticky > * {
  pointer-events: auto;
}

.pipeline__head {
  max-width: 430px;
}

.pipeline__head h2 {
  font-size: clamp(1.6rem, 3.4vw, 2.35rem);
}

.pipeline__head p {
  margin-top: 0.7rem;
  font-size: 0.94rem;
  color: var(--tx-2);
}

.pipeline__panel {
  max-width: 470px;
  min-width: 0;
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 1.35rem 1.4rem;
  box-shadow: 0 28px 70px -34px rgba(0, 0, 0, 0.9);
}

.pipeline__panel .step-no {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  color: var(--violet-2);
  margin-bottom: 0.5rem;
}

.pipeline__panel h3 {
  font-size: 1.28rem;
}

.pipeline__panel p {
  margin-top: 0.55rem;
  font-size: 0.9rem;
  color: var(--tx-2);
  min-height: 3.2em;
}

.pipeline__panel .tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.9rem;
}

.pipeline__panel .tags .tag__ic {
  display: block;
  flex: none;
  width: 19px;
  height: 19px;
}

.pipeline__panel .tags .tag__ic svg {
  width: 100%;
  height: 100%;
  border-radius: 5px;
}

.pipeline__foot {
  display: flex;
  min-width: 0;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.pipeline__panel .tags > span {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  height: 28px;
  padding: 0 0.6rem 0 0.4rem;
  border-radius: 8px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--tx-2);
  transition: transform 0.2s var(--ease), color 0.2s var(--ease);
}

.pipeline__panel .tags > span:hover {
  transform: translateY(-1px);
  color: var(--tx);
}

/* no-JS / reduced-motion rendering of the six stages */
.stage-source {
  list-style: none;
  counter-reset: stage;
  display: grid;
  gap: 1rem;
  margin-top: 2.5rem;
}

.stage-source li {
  position: relative;
  counter-increment: stage;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  padding: 1.3rem 1.4rem 1.4rem 3.9rem;
}

.stage-source li::before {
  content: counter(stage, decimal-leading-zero);
  position: absolute;
  left: 1.35rem;
  top: 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--violet-2);
}

.stage-source h3 {
  font-size: 1.1rem;
}

.stage-source p {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--tx-2);
}

/* once the interactive panel takes over, the source list is data only */
.stage-source[hidden] {
  display: none;
}

/* stage rail */
.rail {
  display: flex;
  min-width: 0;
  gap: 0.4rem;
  padding: 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}

.rail::-webkit-scrollbar {
  display: none;
}

.rail button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tx-3);
  white-space: nowrap;
  transition: color 0.25s var(--ease), background-color 0.25s var(--ease);
}

.rail button::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
  transition: opacity 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.rail button:hover {
  color: var(--tx-2);
}

.rail button.is-active {
  color: var(--tx);
  background: color-mix(in srgb, var(--violet) 24%, transparent);
}

.rail button.is-active::before {
  background: var(--mint);
  opacity: 1;
  box-shadow: 0 0 0 3px var(--glow-mint);
}

/* ---------- 10. misc bits ---------- */

.caret {
  display: inline-block;
  width: 7px;
  height: 1em;
  background: var(--mint);
  vertical-align: text-bottom;
  animation: blink 1.05s steps(1) infinite;
}

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

}

/* ---------- 12. projects ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 2rem;
}

.filters button {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--tx-2);
  transition: color 0.22s var(--ease), border-color 0.22s var(--ease),
    background-color 0.22s var(--ease);
}

.filters button:hover {
  color: var(--tx);
  border-color: var(--violet);
}

.filters button.is-active {
  color: #fff;
  background: var(--violet);
  border-color: transparent;
}

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr));
  gap: 1.15rem;
}

.pcard {
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.35s var(--ease), transform 0.35s var(--ease),
    box-shadow 0.35s var(--ease), opacity 0.3s var(--ease);
}

.pcard:hover {
  border-color: var(--line-2);
  transform: translateY(-4px);
  box-shadow: 0 32px 70px -42px rgba(0, 0, 0, 0.95);
}

.pcard[hidden] {
  display: none;
}

.pcard.is-dimmed {
  opacity: 0.18;
  pointer-events: none;
}

/* the floating 3D device shot */
.pcard__stage {
  position: relative;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  padding: 1.1rem 1.1rem 0;
  perspective: 1000px;
  background: radial-gradient(
      68% 62% at 50% 108%,
      color-mix(in srgb, var(--accent, var(--violet)) 26%, transparent),
      transparent 72%
    ),
    linear-gradient(180deg, var(--surface-2), var(--surface));
  overflow: hidden;
}

.pcard__glow {
  position: absolute;
  left: 50%;
  bottom: -34%;
  width: 74%;
  aspect-ratio: 1;
  translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--accent, var(--violet)) 46%, transparent),
    transparent 66%
  );
  filter: blur(26px);
  opacity: 0.5;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}

.pcard:hover .pcard__glow {
  opacity: 1;
}

.pcard__shot {
  position: relative;
  width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg))
    translateZ(var(--tz, 0px)) scale(var(--sc, 1.02));
  transition: transform 0.5s var(--ease);
  will-change: transform;
}

.pcard.is-tilting .pcard__shot {
  transition: transform 0.12s linear;
}

.pcard__grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(74% 74% at 50% 40%, #000 20%, transparent 100%);
  -webkit-mask-image: radial-gradient(74% 74% at 50% 40%, #000 20%, transparent 100%);
  opacity: 0.75;
  pointer-events: none;
}

.pcard__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.3rem 1.4rem 1.4rem;
  border-top: 1px solid var(--line);
}

.pcard__kind {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent, var(--violet-2));
  margin-bottom: 0.6rem;
}

.pcard__kind .icon {
  width: 12px;
  height: 12px;
}

.pcard h3 {
  font-size: 1.13rem;
}

.pcard__desc {
  margin-top: 0.6rem;
  font-size: 0.885rem;
  color: var(--tx-2);
  flex: 1;
}

.pcard__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 1.05rem;
}

.pcard__tags span {
  padding: 0.24rem 0.6rem;
  border-radius: 7px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--tx-3);
}

.pcard__links {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.2rem;
}

/* ---------- 13. timeline ---------- */

.tl {
  position: relative;
  display: grid;
  gap: 1rem;
  padding-left: 1.9rem;
}

.tl::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 0.6rem;
  bottom: 0.6rem;
  width: 1px;
  background: linear-gradient(180deg, var(--violet), var(--mint), transparent);
  opacity: 0.45;
}

.tl__item {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 1.4rem 1.5rem;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}

.tl__item:hover {
  border-color: var(--line-2);
  transform: translateX(3px);
}

.tl__item::before {
  content: "";
  position: absolute;
  left: -1.9rem;
  top: 1.75rem;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--violet-2);
  translate: -1px 0;
}

.tl__item.is-live::before {
  background: var(--mint);
  border-color: var(--mint);
  box-shadow: 0 0 0 4px var(--glow-mint);
}

.tl__top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
}

.tl__item h3 {
  font-size: 1.08rem;
}

.tl__when {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--tx-3);
  white-space: nowrap;
}

.tl__org {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  font-size: 0.87rem;
  color: var(--violet-2);
  font-weight: 500;
}

.badge {
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.63rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tx-3);
}

.badge--mint {
  color: var(--mint);
  border-color: color-mix(in srgb, var(--mint) 34%, transparent);
  background: color-mix(in srgb, var(--mint) 12%, transparent);
}

.tl__list {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
}

.tl__list li {
  position: relative;
  padding-left: 1.15rem;
  font-size: 0.885rem;
  color: var(--tx-2);
}

.tl__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.66em;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  rotate: 45deg;
  background: var(--mint);
  opacity: 0.75;
}

.tl__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 1.05rem;
}

.tl__tags span {
  padding: 0.24rem 0.62rem;
  border-radius: 7px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--tx-3);
}

/* min() so the track can collapse below its own minimum on a narrow phone */
.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr));
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}

.col-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.4rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 650;
  color: var(--tx);
}

.col-head .icon {
  width: 18px;
  height: 18px;
  color: var(--mint);
}

/* ---------- 14. contact ---------- */

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}

.contact-cards {
  display: grid;
  gap: 0.75rem;
}

.ccard {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}

.ccard:hover {
  border-color: var(--violet);
  transform: translateX(3px);
}

.ccard__ico {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--violet) 16%, transparent);
  color: var(--violet-2);
  flex: none;
}

.ccard__ico .icon {
  width: 17px;
  height: 17px;
}

.ccard small {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.63rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tx-3);
}

.ccard strong {
  font-size: 0.9rem;
  font-weight: 550;
  color: var(--tx);
  word-break: break-word;
}

.form {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: clamp(1.35rem, 3vw, 2rem);
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tx-3);
  margin-bottom: 0.45rem;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--tx);
  font-size: 0.92rem;
  transition: border-color 0.22s var(--ease), background-color 0.22s var(--ease);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--tx-3);
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--violet);
  background: color-mix(in srgb, var(--violet) 8%, var(--surface-2));
}

.field textarea {
  min-height: 128px;
  resize: vertical;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 0 1rem;
}

.form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.4rem;
}

.form__note {
  margin-top: 0.9rem;
  font-size: 0.78rem;
  color: var(--tx-3);
}

.form__note[data-state="error"] {
  color: var(--amber);
}

/* ---------- 15. footer ---------- */

.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
  padding-block: 2.6rem;
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
}

.footer small {
  font-size: 0.8rem;
  color: var(--tx-3);
}

.to-top {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  /* the assistant owns the corner; this sits above it */
  bottom: calc(clamp(1rem, 3vw, 2rem) + 68px);
  z-index: 115;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--tx-2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease),
    visibility 0.3s, color 0.2s, border-color 0.2s;
}

.to-top.is-on {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.to-top:hover {
  color: var(--tx);
  border-color: var(--violet);
}

.to-top .icon {
  width: 18px;
  height: 18px;
}

/* ---------- 15b. floating assistant ---------- */

.bot-btn {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 118;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(140deg, var(--violet-2), var(--violet) 60%, var(--mint));
  color: #fff;
  box-shadow: 0 14px 34px -12px var(--glow), 0 2px 8px rgba(0, 0, 0, 0.28);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
    opacity 0.3s var(--ease), visibility 0.3s;
}

.bot-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 20px 44px -14px var(--glow), 0 2px 10px rgba(0, 0, 0, 0.32);
}

.bot-btn .icon {
  grid-area: 1 / 1;
  width: 24px;
  height: 24px;
  transition: opacity 0.2s var(--ease), transform 0.25s var(--ease);
}

.bot-btn__close,
.bot-btn.is-open .bot-btn__open {
  opacity: 0;
  transform: rotate(-45deg) scale(0.7);
}

.bot-btn.is-open .bot-btn__close {
  opacity: 1;
  transform: none;
}

/* a soft ring that says "there is something here", once */
.bot-btn__ping {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  animation: bot-ping 3.4s ease-out 1.6s 3;
}

.bot-btn.is-open .bot-btn__ping {
  animation: none;
}

/* spread rings rather than a scaled box: a transform would push the element
   past the right edge of a small viewport */
@keyframes bot-ping {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--violet-2) 60%, transparent);
  }
  70%,
  100% {
    box-shadow: 0 0 0 16px transparent;
  }
}

.bot {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: calc(clamp(1rem, 3vw, 2rem) + 68px);
  z-index: 118;
  display: flex;
  flex-direction: column;
  width: min(374px, calc(100vw - 2rem));
  max-height: min(560px, calc(100vh - 9rem));
  border-radius: 20px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  box-shadow: 0 30px 70px -28px rgba(0, 0, 0, 0.65);
  overflow: hidden;
  transform-origin: 100% 100%;
  animation: bot-in 0.26s var(--ease) both;
}

@keyframes bot-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
}

.bot__bar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.8rem 0.85rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(
    120deg,
    color-mix(in srgb, var(--violet) 16%, var(--surface-2)),
    var(--surface-2) 70%
  );
}

/* the site's own mark, so the assistant reads as part of the site */
.bot__avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--violet-2), var(--violet));
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.bot__who {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}

.bot__who strong {
  font-size: 0.88rem;
}

.bot__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  justify-self: start;
  padding: 0.08rem 0.44rem 0.08rem 0.36rem;
  border: 1px solid color-mix(in srgb, var(--mint) 42%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--mint) 14%, transparent);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--mint);
}

.bot__live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 0 var(--glow-mint);
  animation: live 2.4s ease-out infinite;
}

@keyframes live {
  0%,
  70%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--mint) 55%, transparent);
  }
  35% {
    box-shadow: 0 0 0 4px transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bot__live {
    animation: none;
  }
}

.bot__close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  border: 1px solid transparent;
  background: none;
  color: var(--tx-3);
}

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

.bot__close .icon {
  width: 15px;
  height: 15px;
}

/* ---- the conversation ---- */

.bot__log {
  flex: 1;
  min-height: 180px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.9rem;
  scrollbar-width: thin;
}

.bot__log::-webkit-scrollbar {
  width: 8px;
}

.bot__log::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: var(--line-2);
}

.msg {
  display: flex;
  max-width: 100%;
  animation: msg-in 0.24s var(--ease) both;
}

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

.msg__b {
  max-width: 85%;
  padding: 0.55rem 0.8rem;
  border-radius: 16px;
  font-size: 0.85rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.msg--bot .msg__b {
  border-bottom-left-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--tx);
}

.msg--me {
  justify-content: flex-end;
}

.msg--me .msg__b {
  border-bottom-right-radius: 5px;
  background: var(--violet);
  color: #fff;
}

.msg--note .msg__b {
  max-width: 100%;
  padding: 0.35rem 0.2rem;
  background: none;
  border: none;
  font-size: 0.78rem;
  color: var(--tx-3);
}

/* typing dots */
.msg--typing .msg__b {
  display: inline-flex;
  gap: 4px;
  padding: 0.7rem 0.85rem;
}

.msg--typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tx-3);
  animation: dot 1.1s ease-in-out infinite;
}

.msg--typing i:nth-child(2) {
  animation-delay: 0.15s;
}

.msg--typing i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes dot {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* ---- quick replies ---- */

.bot__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 0.9rem 0.7rem;
}

.bot__chips button {
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: none;
  font-size: 0.75rem;
  color: var(--tx-2);
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}

.bot__chips button:hover {
  color: var(--tx);
  border-color: var(--violet);
  background: color-mix(in srgb, var(--violet) 12%, transparent);
}

/* ---- composer ---- */

.bot__form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.7rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.bot__form input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--bg-elev);
  font: inherit;
  font-size: 0.85rem;
  color: var(--tx);
}

.bot__form input::placeholder {
  color: var(--tx-3);
}

.bot__form input:focus-visible {
  outline: none;
  border-color: var(--violet);
}

.bot__send {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  border: none;
  background: var(--violet);
  color: #fff;
}

.bot__send:hover {
  background: var(--violet-2);
}

.bot__send .icon {
  width: 15px;
  height: 15px;
}

@media (max-width: 560px) {
  .bot {
    right: 0.6rem;
    left: 0.6rem;
    width: auto;
    max-height: min(70vh, calc(100vh - 8rem));
  }
}

/* ---------- 16. reveal ---------- */

.rv {
  opacity: 0;
  transform: translateY(22px);
}

.rv-on {
  opacity: 1;
  transform: none;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--d, 0ms);
}

/* ---------- 17. responsive ---------- */

@media (max-width: 1020px) {
  .hero__grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .hero__card {
    max-width: 380px;
  }

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

/* Short laptop screens. Dropping the section heading leaves the sticky column
   with one child, and space-between then parks it against the TOP — straight
   over the subject. It belongs at the bottom, where the scene is framed to
   clear it, and it has to give back some height on the way. */
@media (max-height: 780px) and (min-width: 861px) {
  .pipeline__head {
    display: none;
  }

  .pipeline__sticky {
    justify-content: flex-end;
    gap: 0.9rem;
    padding-block: calc(var(--header-h) + 1rem) 1.1rem;
  }

  .pipeline__panel {
    padding: 1rem 1.15rem 1.1rem;
  }

  .pipeline__panel p {
    margin-top: 0.45rem;
    min-height: 0;
  }

  .pipeline__panel .tags {
    margin-top: 0.7rem;
  }
}

/* Very short landscape - a 13" laptop with the browser chrome open. The caption
   would otherwise own half the viewport. */
@media (max-height: 620px) and (min-width: 861px) {
  .pipeline__panel {
    max-width: 400px;
  }

  .pipeline__panel h3 {
    font-size: 1.12rem;
  }

  .pipeline__panel p {
    font-size: 0.85rem;
  }
}

@media (max-width: 860px) {
  :root {
    --header-h: 60px;
  }

  /* Portrait puts the copy top-centre in the hero and bottom-centre in the
     pipeline, so the scrim has to move with it rather than sit on one side. */
  #stage::after {
    background: linear-gradient(
      180deg,
      var(--bg) 0%,
      color-mix(in srgb, var(--bg) 86%, transparent) 46%,
      color-mix(in srgb, var(--bg) 40%, transparent) 78%,
      transparent 100%
    );
  }

  #stage.in-pipeline::after {
    background: linear-gradient(
      0deg,
      var(--bg) 0%,
      color-mix(in srgb, var(--bg) 78%, transparent) 34%,
      transparent 62%
    );
  }

  .nav,
  .header__actions .btn {
    display: none;
  }

  .burger {
    display: grid;
  }

  .pipeline {
    height: 460vh;
  }

  .pipeline__head {
    display: none;
  }

  /* Portrait splits the screen between the scene and the caption, so every
     millimetre the caption gives back is scene. Sit it flush to the bottom
     edge and keep its own padding tight. */
  .pipeline__sticky {
    justify-content: flex-end;
    gap: 0.7rem;
    padding-block: calc(var(--header-h) + 1rem) 0.75rem;
  }

  .pipeline__foot {
    flex-direction: column;
    /* column + wrap makes flex spill into a second column and stretch the
       panel to its content width - keep it a single column here */
    flex-wrap: nowrap;
    align-items: stretch;
  }

  .pipeline__panel {
    max-width: 100%;
    padding: 1rem 1.1rem 1.05rem;
  }

  .pipeline__panel p {
    margin-top: 0.45rem;
    /* the reserved line keeps the card from jumping between stages on a wide
       screen; in portrait every description already overflows it */
    min-height: 0;
  }

  .pipeline__panel .tags {
    margin-top: 0.65rem;
  }

  .scroll-hint {
    display: none;
  }

  /* the stage rail owns the bottom of the screen while the pipeline is live,
     so the two floating buttons get out of the scene's way */
  body.in-pipeline .to-top,
  body.in-pipeline .bot-btn:not(.is-open) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

@media (max-width: 560px) {
  /* a mono date string is ~230px wide and will not break on its own */
  .tl__when {
    white-space: normal;
  }

  .tl {
    padding-left: 1.5rem;
  }

  .tl__item {
    padding: 1.15rem 1.15rem;
  }

  .tl__item::before {
    left: -1.5rem;
  }

  .brand__word {
    display: none;
  }

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

  .projects,
  .stack-grid {
    grid-template-columns: 1fr;
  }

}

/* ---------- 18. reduced motion ---------- */

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

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

  .rv {
    opacity: 1;
    transform: none;
  }

  .pipeline {
    height: auto;
  }

  .pipeline__sticky {
    position: static;
    height: auto;
    gap: 2rem;
  }
}
