/* ============================================================================
   LAKSHYA AGARWAL - PORTFOLIO
   Design system. Dark only, no theme toggle.
   ========================================================================= */

/* ---------------------------------------------------------------- TOKENS  */
:root {
  /* surfaces */
  --bg-0: #070b12;
  --bg-1: #0b111b;
  --bg-2: #101826;
  --bg-3: #16202f;
  --bg-quiet: #05080d;

  /* ink */
  --ink-hi: #e6edf6;
  --ink-md: #9db0c4;
  --ink-lo: #6b83a0;

  /* accent - carried over from the previous site's sky blue */
  --accent: #38bdf8;
  --accent-bright: #7dd3fc;
  --accent-dim: rgba(56, 189, 248, 0.10);
  --accent-line: rgba(56, 189, 248, 0.38);

  /* semantic */
  --caution: #d9a245;
  --caution-dim: rgba(217, 162, 69, 0.09);
  --caution-line: rgba(217, 162, 69, 0.32);
  --flag: #d9705c;

  /* structure */
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.28);
  --edge: inset 0 1px 0 rgba(255, 255, 255, 0.04);

  /* type */
  --font-display: Newsreader, ui-serif, Georgia, serif;
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
  --font-mono: JetBrains Mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --t-display: clamp(2.75rem, 6.4vw, 5.75rem);
  --t-h1: clamp(2rem, 4vw, 3.35rem);
  --t-h2: clamp(1.5rem, 2.4vw, 2.1rem);
  --t-h3: clamp(1.1rem, 1.5vw, 1.4rem);
  --t-micro: 0.6875rem;

  /* metrics */
  --content-max: 1200px;
  --measure: 68ch;
  --page-margin: clamp(20px, 5vw, 72px);
  --rail-width: 68px;

  /* motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-ui: 0.24s;
  --dur-reveal: 0.75s;

  /* elevation */
  --shadow-1: 0 16px 40px -24px rgba(0, 0, 0, 0.8);
  --shadow-2: 0 28px 70px -28px rgba(0, 0, 0, 0.9);
}

/* ----------------------------------------------------------------- RESET  */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background-color: var(--bg-0);
  color: var(--ink-md);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* `clip`, not `hidden`: `hidden` turns body into a scroll container and
     breaks `position: sticky` for the case bar. */
  overflow-x: clip;
}

/* Ambient aurora. A single fixed layer drifting on a long loop — it is one
   composited transform per frame, costs no scroll distance, and never moves
   anything the reader is trying to read. Oversized so the edges never enter
   the viewport as it moves. */
body::before {
  content: "";
  position: fixed;
  inset: -30%;
  z-index: -2;
  pointer-events: none;
  will-change: transform;
  background:
    radial-gradient(46% 38% at 72% 18%, rgba(56, 189, 248, 0.10), transparent 68%),
    radial-gradient(40% 34% at 14% 34%, rgba(125, 211, 252, 0.05), transparent 70%),
    radial-gradient(48% 40% at 82% 82%, rgba(56, 189, 248, 0.055), transparent 72%),
    radial-gradient(38% 32% at 34% 88%, rgba(148, 163, 184, 0.04), transparent 70%);
  animation: auroraDrift 48s ease-in-out infinite alternate;
}

@keyframes auroraDrift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-3.2%, 2.4%, 0) scale(1.09);
  }
  100% {
    transform: translate3d(2.6%, -2.8%, 0) scale(1.04);
  }
}

/* Faint engineering grid, masked so it fades out down the page. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.55;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.028) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 18%, transparent 76%);
  mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 18%, transparent 76%);
}

/* Inline code in case write-ups. */
code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  color: var(--accent-bright);
  background: var(--accent-dim);
  border: 1px solid rgba(56, 189, 248, 0.18);
  padding: 1px 6px;
  white-space: nowrap;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur-ui) var(--ease);
}

::selection {
  background: rgba(56, 189, 248, 0.28);
  color: var(--ink-hi);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--bg-2);
  color: var(--ink-hi);
  padding: 12px 20px;
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--accent-line);
}

.skip-link:focus {
  left: 16px;
  top: 16px;
}

/* ------------------------------------------------------------------ TYPE  */
.display {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--t-display);
  line-height: 1.02;
  letter-spacing: -0.022em;
  color: var(--ink-hi);
  text-wrap: balance;
}

.h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--t-h1);
  line-height: 1.08;
  letter-spacing: -0.018em;
  color: var(--ink-hi);
  text-wrap: balance;
}

.h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--t-h2);
  line-height: 1.16;
  letter-spacing: -0.012em;
  color: var(--ink-hi);
}

.h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--t-h3);
  line-height: 1.3;
  letter-spacing: -0.008em;
  color: var(--ink-hi);
}

.micro {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-lo);
}

.micro-accent {
  color: var(--accent);
}

/* Short aside in the mono register, but readable at paragraph length. */
.footnote {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.8;
  color: var(--ink-lo);
  max-width: 76ch;
  padding-left: 16px;
  border-left: 1px solid var(--line-strong);
}

.lede {
  font-size: clamp(1.05rem, 1.35vw, 1.22rem);
  line-height: 1.65;
  color: var(--ink-md);
  max-width: var(--measure);
}

.prose {
  max-width: var(--measure);
}

.prose p + p {
  margin-top: 1.15em;
}

.prose strong {
  color: var(--ink-hi);
  font-weight: 600;
}

.dim {
  color: var(--ink-lo);
}

.hi {
  color: var(--ink-hi);
}

/* ---------------------------------------------------------------- LAYOUT  */
.shell {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--page-margin);
}

.section {
  position: relative;
  padding-block: clamp(72px, 10vw, 132px);
  border-top: 1px solid var(--line);
}

.section.no-rule {
  border-top: 0;
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: clamp(36px, 5vw, 60px);
}

.kicker {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kicker .num {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--accent);
}

.kicker .rule {
  flex: 0 0 auto;
  width: 28px;
  height: 1px;
  background: var(--line-strong);
}

.grid {
  display: grid;
  gap: clamp(16px, 2vw, 24px);
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 205px), 1fr));
}

/* ------------------------------------------------------------------- NAV  */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: 62px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition:
    background-color var(--dur-ui) var(--ease),
    border-color var(--dur-ui) var(--ease);
}

.nav.is-stuck {
  background: rgba(7, 11, 18, 0.82);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom-color: var(--line);
}

.nav-inner {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--page-margin);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-hi);
  white-space: nowrap;
}

.brand .mark {
  width: 7px;
  height: 7px;
  flex: none;
  background: var(--accent);
  transform: rotate(45deg);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
  transition: background-color var(--dur-ui) var(--ease);
}

.brand:hover .mark {
  background: var(--accent-bright);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 30px);
}

.nav-links a {
  position: relative;
  font-size: 0.875rem;
  color: var(--ink-md);
  padding-block: 4px;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.34s var(--ease);
}

.nav-links a:hover {
  color: var(--ink-hi);
}

.nav-links a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav-links a[aria-current="page"] {
  color: var(--ink-hi);
}

.nav-links a[aria-current="page"]::after {
  transform: scaleX(1);
  background: var(--accent-line);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line-strong);
  color: var(--ink-hi);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 7px 12px;
  cursor: pointer;
  transition:
    border-color var(--dur-ui) var(--ease),
    color var(--dur-ui) var(--ease);
}

.nav-toggle:hover {
  border-color: var(--accent-line);
  color: var(--accent);
}

@media (max-width: 760px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    position: fixed;
    inset: 62px 0 auto 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 8px var(--page-margin) 22px;
    background: rgba(7, 11, 18, 0.97);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    clip-path: inset(0 0 100% 0);
    transition: clip-path 0.42s var(--ease);
  }

  .nav-links.is-open {
    clip-path: inset(0 0 0 0);
  }

  .nav-links a {
    width: 100%;
    padding-block: 13px;
    border-bottom: 1px solid var(--line);
    font-size: 0.95rem;
  }

  .nav-links a::after {
    display: none;
  }
}

/* ------------------------------------------------------------------ RAIL  */
.rail {
  position: fixed;
  left: max(18px, calc((100vw - var(--content-max)) / 2 - 6px));
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: var(--rail-width);
}

.rail a {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  color: var(--ink-lo);
  opacity: 0.5;
  transition:
    opacity var(--dur-ui) var(--ease),
    color var(--dur-ui) var(--ease);
}

.rail a .dot {
  width: 5px;
  height: 5px;
  flex: none;
  border: 1px solid currentColor;
  transform: rotate(45deg);
  transition: background-color var(--dur-ui) var(--ease);
}

.rail a:hover {
  opacity: 1;
  color: var(--ink-md);
}

.rail a.is-active {
  opacity: 1;
  color: var(--accent);
}

.rail a.is-active .dot {
  background: var(--accent);
}

@media (max-width: 1180px) {
  .rail {
    display: none;
  }
}

/* ------------------------------------------------------------------ HERO  */
.hero {
  position: relative;
  min-height: clamp(560px, 88vh, 900px);
  display: flex;
  align-items: center;
  padding-block: 120px 72px;
  overflow: hidden;
}

.hero.short {
  min-height: 0;
  padding-block: 148px 20px;
}

/* Constellation canvas - ~44 points, pauses when off-screen. */
#constellation {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.5;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 92% 82% at 72% 42%, #000 8%, transparent 74%);
  mask-image: radial-gradient(ellipse 92% 82% at 72% 42%, #000 8%, transparent 74%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}

@media (max-width: 940px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.hero .display {
  margin-block: 22px 24px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border: 1px solid var(--accent-line);
  background: var(--accent-dim);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent-bright);
}

.status-pill .pulse {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.8s var(--ease-inout) infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.5);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(56, 189, 248, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
  }
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.hero-meta span {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-lo);
}

.hero-meta span b {
  color: var(--ink-md);
  font-weight: 500;
}

.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: clamp(40px, 6vw, 72px);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-lo);
}

.scroll-cue .bar {
  position: relative;
  width: 40px;
  height: 1px;
  background: var(--line-strong);
  overflow: hidden;
}

.scroll-cue .bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: translateX(-100%);
  animation: sweep 2.6s var(--ease-inout) infinite;
}

@keyframes sweep {
  0% {
    transform: translateX(-100%);
  }
  55% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* -------------------------------------------------------------- TERMINAL  */
.terminal {
  background: linear-gradient(180deg, var(--bg-1), var(--bg-quiet));
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-2), var(--edge);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.85;
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(148, 163, 184, 0.05);
  border-bottom: 1px solid var(--line);
}

.terminal-bar .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg-3);
}

.terminal-bar .dot:nth-child(1) {
  background: #d9705c;
}

.terminal-bar .dot:nth-child(2) {
  background: #d9a245;
}

.terminal-bar .dot:nth-child(3) {
  background: #3dd698;
}

.terminal-bar .title {
  margin-left: 8px;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  color: var(--ink-lo);
}

.terminal-body {
  padding: 18px 20px 22px;
  overflow-x: auto;
}

.terminal-body .cmd {
  color: var(--ink-lo);
  white-space: nowrap;
}

.terminal-body .cmd::before {
  content: "$ ";
  color: var(--accent);
}

.terminal-body .k {
  color: var(--accent-bright);
}

.terminal-body .s {
  color: var(--ink-hi);
}

.terminal-body .p {
  color: var(--ink-lo);
}

.terminal-body .row {
  white-space: nowrap;
}

.terminal-body .indent {
  padding-left: 1.7em;
}

.caret {
  display: inline-block;
  width: 8px;
  height: 0.95em;
  vertical-align: -2px;
  background: var(--accent);
  animation: blink 1.15s steps(2, start) infinite;
}

@keyframes blink {
  to {
    visibility: hidden;
  }
}

/* --------------------------------------------------------------- BUTTONS  */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-md);
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition:
    color var(--dur-ui) var(--ease),
    border-color var(--dur-ui) var(--ease);
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--accent-dim);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.44s var(--ease);
}

.btn:hover {
  color: var(--ink-hi);
  border-color: var(--accent-line);
}

.btn:hover::before {
  transform: scaleX(1);
  transform-origin: left;
}

.btn-primary {
  border-color: var(--accent-line);
  color: var(--accent-bright);
  background: var(--accent-dim);
  transition:
    color var(--dur-ui) var(--ease),
    background-color var(--dur-ui) var(--ease),
    border-color var(--dur-ui) var(--ease);
}

.btn-primary::before {
  display: none;
}

.btn-primary:hover {
  color: #041018;
  background: var(--accent);
  border-color: var(--accent);
}

.btn .arrow {
  transition: transform 0.34s var(--ease);
}

.btn:hover .arrow {
  transform: translateX(3px);
}

.btn.is-down:hover .arrow {
  transform: translateY(3px);
}

.xlink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-lo);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition:
    color var(--dur-ui) var(--ease),
    border-color var(--dur-ui) var(--ease);
}

.xlink:hover {
  color: var(--accent);
  border-bottom-color: var(--accent-line);
}

/* Link that sits inside running text and keeps its size. */
.inline-link {
  color: var(--accent-bright);
  border-bottom: 1px solid var(--accent-line);
  transition:
    color var(--dur-ui) var(--ease),
    border-color var(--dur-ui) var(--ease);
}

.inline-link:hover {
  color: var(--ink-hi);
  border-bottom-color: var(--ink-hi);
}

/* ----------------------------------------------------------------- FACTS  */
.fact {
  position: relative;
  padding: 24px 22px 22px;
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.035), transparent);
  border: 1px solid var(--line);
  box-shadow: var(--edge);
  transition:
    border-color var(--dur-ui) var(--ease),
    transform 0.5s var(--ease);
}

.fact:hover {
  border-color: var(--accent-line);
  transform: translateY(-3px);
}

.fact .value {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 3.4vw, 2.9rem);
  line-height: 1;
  color: var(--ink-hi);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}

.fact .note {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--ink-lo);
  line-height: 1.55;
}

/* ------------------------------------------------------------ PRINCIPLES  */
.principle {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: clamp(16px, 3vw, 34px);
  padding-block: clamp(26px, 3.4vw, 38px);
  border-top: 1px solid var(--line);
}

.principle:first-child {
  border-top: 0;
  padding-top: 0;
}

@media (max-width: 640px) {
  .principle {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
}

.principle .id {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.16em;
  color: var(--accent);
  padding-top: 6px;
}

.principle .h3 {
  margin-bottom: 10px;
}

.principle p {
  max-width: var(--measure);
}

.proven {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 16px;
}

.proven .lbl {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-lo);
}

/* ------------------------------------------------------------------ CASE  */
.case {
  position: relative;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.03), transparent 42%);
  box-shadow: var(--edge);
  padding: clamp(24px, 3.6vw, 44px);
  transition: border-color 0.4s var(--ease);
  scroll-margin-top: 96px;
}

.case:hover {
  border-color: var(--line-strong);
}

.case + .case {
  margin-top: clamp(20px, 2.6vw, 32px);
}

.case-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 20px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.case-index {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.16em;
  color: var(--ink-lo);
  margin-bottom: 10px;
}

.case-index b {
  color: var(--accent);
  font-weight: 500;
}

.case-title {
  margin-bottom: 8px;
}

.case-outcome {
  max-width: 58ch;
  color: var(--ink-md);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 16px;
}

.chip {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-lo);
  border: 1px solid var(--line);
  padding: 5px 9px;
  background: rgba(148, 163, 184, 0.04);
  transition:
    border-color var(--dur-ui) var(--ease),
    color var(--dur-ui) var(--ease);
}

.case:hover .chip,
.skill-group:hover .chip {
  border-color: var(--line-strong);
}

.chip-status {
  color: var(--accent-bright);
  border-color: var(--accent-line);
  background: var(--accent-dim);
}

.chip-note {
  color: var(--caution);
  border-color: var(--caution-line);
  background: var(--caution-dim);
}

.case-block {
  margin-bottom: 24px;
}

.case-block:last-child {
  margin-bottom: 0;
}

.case-label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.case-label::before {
  content: "// ";
  color: var(--ink-lo);
}

.case-block p,
.case-block li {
  max-width: var(--measure);
}

.tick li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
}

.tick li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border: 1px solid var(--accent-line);
  transform: rotate(45deg);
}

.limitation {
  border-left: 2px solid var(--caution-line);
  background: var(--caution-dim);
  padding: 16px 20px;
}

.limitation .case-label {
  color: var(--caution);
}

.limitation .case-label::before {
  content: "\26A0  ";
  color: var(--caution);
}

.limitation p {
  color: var(--ink-md);
}

.case-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* --------------------------------------------------------------- ENTRIES  */
.entry {
  display: block;
  padding: clamp(22px, 2.6vw, 30px);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.03), transparent 60%);
  box-shadow: var(--edge);
  height: 100%;
  transition:
    border-color var(--dur-ui) var(--ease),
    transform 0.5s var(--ease);
}

.entry:hover {
  border-color: var(--accent-line);
  transform: translateY(-3px);
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.entry-meta .sep {
  color: var(--line-strong);
}

.entry .h3 {
  margin-bottom: 10px;
}

.entry p {
  font-size: 0.94rem;
}

/* -------------------------------------------------------------- TIMELINE  */
.timeline {
  position: relative;
  padding-left: 30px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 10px;
  bottom: 10px;
  width: 1px;
  background: linear-gradient(180deg, var(--accent-line), var(--line), transparent);
}

.tl-item {
  position: relative;
  padding-bottom: clamp(30px, 4vw, 44px);
}

.tl-item:last-child {
  padding-bottom: 0;
}

.tl-item::before {
  content: "";
  position: absolute;
  left: -30px;
  top: 9px;
  width: 9px;
  height: 9px;
  background: var(--bg-0);
  border: 1px solid var(--accent);
  transform: rotate(45deg);
}

.tl-item .when {
  margin-bottom: 10px;
}

.tl-item .h3 {
  margin-bottom: 5px;
}

.tl-item .where {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

/* ---------------------------------------------------------------- SKILLS  */
.skill-group {
  padding: clamp(20px, 2.4vw, 28px);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.03), transparent 60%);
  box-shadow: var(--edge);
  height: 100%;
  transition: border-color var(--dur-ui) var(--ease);
}

.skill-group:hover {
  border-color: var(--line-strong);
}

.skill-group .h3 {
  margin-bottom: 18px;
}

.skill-group .chips {
  margin-top: 0;
}

/* --------------------------------------------------------------- CONTACT  */
.contact-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 20px;
  padding-block: 20px;
  border-top: 1px solid var(--line);
  transition:
    padding-left var(--dur-ui) var(--ease),
    border-color var(--dur-ui) var(--ease);
}

.contact-list .contact-row:last-child {
  border-bottom: 1px solid var(--line);
}

.contact-row:hover {
  padding-left: 10px;
  border-color: var(--accent-line);
}

.contact-row .val {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--ink-hi);
  word-break: break-word;
  transition: color var(--dur-ui) var(--ease);
}

.contact-row:hover .val {
  color: var(--accent-bright);
}

/* ---------------------------------------------------------------- FOOTER  */
.footer {
  border-top: 1px solid var(--line);
  padding-block: 40px 52px;
  background: linear-gradient(180deg, transparent, rgba(5, 8, 13, 0.7));
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}

.build-stamp {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-lo);
}

.build-stamp .mark {
  width: 6px;
  height: 6px;
  flex: none;
  background: var(--accent);
  transform: rotate(45deg);
}

/* --------------------------------------------------------------- REVEALS  */
/* Scoped to .js so the page is fully readable with JavaScript disabled.
   The class is set by an inline script in <head>, before first paint. */
.js [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition:
    opacity var(--dur-reveal) var(--ease),
    transform var(--dur-reveal) var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}

.js [data-reveal].is-in {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.js [data-reveal="line"] {
  transform: translate3d(0, 26px, 0);
}

.js [data-reveal="line"].is-in {
  transform: translate3d(0, 0, 0);
}

/* --------------------------------------------------------------- UTILITY  */
.stack-sm > * + * {
  margin-top: 10px;
}

.stack-md > * + * {
  margin-top: 18px;
}

.stack-lg > * + * {
  margin-top: 32px;
}

.mt-lg {
  margin-top: clamp(36px, 5vw, 60px);
}

.mt-md {
  margin-top: clamp(22px, 3vw, 34px);
}

.scroll-x {
  overflow-x: auto;
}

/* ============================================================================
   BOOT SEQUENCE
   Full-screen init readout on first load of the home page. Text only - the
   whole thing is built in JS, so it never exists for no-JS or reduced-motion
   visitors, and it is skippable with the button or Esc.
   ========================================================================= */
.boot {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-quiet);
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.9s var(--ease-inout);
}

.boot.is-done {
  clip-path: inset(0 0 100% 0);
  pointer-events: none;
}

.boot::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(760px 520px at 50% 44%, rgba(56, 189, 248, 0.07), transparent 70%),
    repeating-linear-gradient(
      0deg,
      rgba(148, 163, 184, 0.035) 0px,
      rgba(148, 163, 184, 0.035) 1px,
      transparent 1px,
      transparent 3px
    );
}

.boot-inner {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 2 * var(--page-margin)));
}

.boot-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: clamp(0.62rem, 1.5vw, 0.76rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-lo);
  white-space: nowrap;
  opacity: 0;
  transform: translate3d(0, 6px, 0);
  animation: bootIn 0.4s var(--ease) forwards;
}

@keyframes bootIn {
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.boot-line .lead {
  flex: 0 0 auto;
}

.boot-line .fill {
  flex: 1 1 auto;
  overflow: hidden;
  color: rgba(148, 163, 184, 0.3);
}

.boot-line .fill::before {
  content: "........................................";
}

.boot-line .val {
  flex: 0 0 auto;
  color: var(--accent-bright);
}

.boot-line.final {
  margin-top: 14px;
  color: var(--ink-hi);
  letter-spacing: 0.2em;
}

.boot-line.final .lead::before {
  content: "> ";
  color: var(--accent);
}

.boot-bar {
  position: relative;
  height: 1px;
  margin-top: 26px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.boot-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.7);
  transition: width 0.34s linear;
}

.boot-skip {
  position: absolute;
  right: var(--page-margin);
  bottom: calc(var(--page-margin) - 4px);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink-lo);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    color var(--dur-ui) var(--ease),
    border-color var(--dur-ui) var(--ease);
}

.boot-skip:hover {
  color: var(--accent);
  border-color: var(--accent-line);
}

.boot-skip kbd {
  font: inherit;
  padding: 1px 5px;
  border: 1px solid var(--line);
  color: var(--ink-lo);
}

/* Page is frozen while the readout plays. */
body.is-booting {
  overflow: hidden;
}

/* ============================================================================
   STICKY CASE INDEX (work page)
   ========================================================================= */
.case-bar {
  position: sticky;
  top: 62px;
  z-index: 60;
  margin-bottom: clamp(28px, 4vw, 44px);
  background: rgba(7, 11, 18, 0.86);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
  border-block: 1px solid var(--line);
}

.case-bar-inner {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-block: 10px;
}

.case-bar-inner::-webkit-scrollbar {
  display: none;
}

.case-bar a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 12px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-lo);
  border: 1px solid transparent;
  white-space: nowrap;
  transition:
    color var(--dur-ui) var(--ease),
    border-color var(--dur-ui) var(--ease),
    background-color var(--dur-ui) var(--ease);
}

.case-bar a b {
  color: var(--ink-lo);
  font-weight: 500;
  transition: color var(--dur-ui) var(--ease);
}

.case-bar a:hover {
  color: var(--ink-hi);
  border-color: var(--line-strong);
}

.case-bar a.is-active {
  color: var(--ink-hi);
  border-color: var(--accent-line);
  background: var(--accent-dim);
}

.case-bar a.is-active b {
  color: var(--accent);
}

/* ============================================================================
   DISPLAY TYPE - word-level blur reveal
   ========================================================================= */
.js .word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}

.js .word > i {
  display: inline-block;
  font-style: inherit;
  opacity: 0;
  transform: translate3d(0, 0.85em, 0);
  filter: blur(8px);
  transition:
    opacity 0.8s var(--ease),
    transform 0.8s var(--ease),
    filter 0.8s var(--ease);
  transition-delay: var(--word-delay, 0ms);
}

.js [data-reveal].is-in .word > i,
.js .is-in .word > i {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  filter: blur(0);
}

/* Section rules draw in rather than just appearing. */
.js .section {
  border-top-color: transparent;
}

.js .section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--accent-line), var(--line) 34%, var(--line));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.1s var(--ease);
}

.js .section.no-rule::before {
  display: none;
}

.js .section.is-ruled::before {
  transform: scaleX(1);
}

@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;
  }

  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }

  .js .word > i {
    opacity: 1;
    transform: none;
    filter: none;
  }

  .js .section {
    border-top-color: var(--line);
  }

  .js .section::before {
    display: none;
  }

  #constellation {
    display: none;
  }
}
