/* ============================================================
   Anant Khanna — Portfolio
   Technical-document aesthetic: drafting paper, ink, one
   blueprint-blue accent, hairline rules. No build step.
   ============================================================ */

:root {
  --paper: #efe8d9;
  --paper-soft: #e6ddc9;
  --ink: #241f17;
  --ink-soft: #5a5243;
  --ink-faint: #6f6752;
  --line: #d5cbb2;
  --blue: #24418c;
  --blue-bright: #2f52c7;
  --blue-soft: rgba(36, 65, 140, 0.08);
  --nav-bg: rgba(239, 232, 217, 0.88);
  --nav-bg-strong: rgba(239, 232, 217, 0.97);
  --shadow: rgba(54, 44, 26, 0.10);
  --fig-ink: #33291b;
  --fig-soft: #5a5243;
  --fig-blue: #2b4bb0;
  --fig-core: #24418c;
  --dot: rgba(36, 65, 140, 0.09);
  --dot-major: rgba(36, 65, 140, 0.16);
  --nav-h: 64px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

/* dark mode — drafting table at night */
:root[data-theme="dark"] {
  --paper: #17140f;
  --paper-soft: #211d15;
  --ink: #ece3cf;
  --ink-soft: #b3a98f;
  --ink-faint: #857b64;
  --line: #35301f;
  --blue: #8ba1e8;
  --blue-bright: #a3b6f2;
  --blue-soft: rgba(139, 161, 232, 0.12);
  --nav-bg: rgba(23, 20, 15, 0.88);
  --nav-bg-strong: rgba(23, 20, 15, 0.97);
  --shadow: rgba(0, 0, 0, 0.45);
  --fig-ink: #ded3b8;
  --fig-soft: #b3a98f;
  --fig-blue: #8ba1e8;
  --fig-core: #8ba1e8;
  --dot: rgba(139, 161, 232, 0.12);
  --dot-major: rgba(139, 161, 232, 0.2);
}
:root[data-theme="dark"] body::after { filter: invert(1); opacity: 0.13; }
:root[data-theme="dark"] ::selection { background: rgba(139, 161, 232, 0.28); }

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }

body {
  /* engineering reference-point grid: a quiet, uniform dot matrix
     printed on the page itself — scrolls in lockstep with content
     (default attachment), so it never drifts as a separate layer
     or causes the repaint jank that background-attachment:fixed
     is prone to in several browsers. */
  background-color: var(--paper);
  background-image:
    radial-gradient(circle, var(--dot-major) 1.5px, transparent 1.7px),
    radial-gradient(circle, var(--dot) 1px, transparent 1.2px);
  background-size: 128px 128px, 32px 32px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* paper grain */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 3000;
  pointer-events: none;
  opacity: 0.3;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.14 0 0 0 0 0.12 0 0 0 0 0.08 0 0 0 0.3 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: rgba(36, 65, 140, 0.18); }

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

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

/* ============ NAV ============ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(20px, 5vw, 56px);
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.nav.scrolled { border-bottom-color: var(--line); }

.nav-logo {
  font-family: var(--font-display);
  font-weight: 600; font-size: 1.15rem;
  color: var(--ink); letter-spacing: 0.2px;
}
.nav-logo:hover { text-decoration: none; }

.nav-links { display: flex; align-items: center; gap: clamp(14px, 2.2vw, 30px); }
.nav-links a:not(.nav-resume) {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.8rem; letter-spacing: 0.4px;
  transition: color 0.2s;
}
.nav-links a:not(.nav-resume):hover,
.nav-links a.active { color: var(--ink); text-decoration: none; }
.nav-links a.active { color: var(--blue); }
.nav-resume {
  font-family: var(--font-mono); font-size: 0.8rem;
  color: var(--blue);
  border: 1px solid var(--line);
  padding: 7px 14px; border-radius: 3px;
  transition: border-color 0.2s, background 0.2s;
}
.nav-resume:hover { border-color: var(--blue); background: var(--blue-soft); text-decoration: none; }

.theme-toggle {
  font-family: var(--font-mono); font-size: 0.85rem;
  color: var(--ink-soft);
  background: none;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 5px 11px;
  cursor: pointer;
  line-height: 1.4;
  transition: border-color 0.2s, color 0.2s;
}
.theme-toggle:hover { border-color: var(--blue); color: var(--blue); }

.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 10px; z-index: 950; }
.nav-toggle span {
  display: block; width: 24px; height: 1.5px; margin: 7px 0;
  background: var(--ink); border-radius: 2px;
  transition: transform 0.3s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(4.25px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { transform: translateY(-4.25px) rotate(-45deg); }

/* ============ SHARED ============ */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.76rem; letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 14px;
}

.btn-ink {
  display: inline-block;
  font-family: var(--font-mono); font-size: 0.88rem;
  color: var(--paper); background: var(--ink);
  padding: 13px 28px; border-radius: 3px;
  border: 1px solid var(--ink);
  transition: background 0.2s, color 0.2s;
}
.btn-ink:hover { background: var(--blue); border-color: var(--blue); text-decoration: none; }

.link-quiet {
  font-family: var(--font-mono); font-size: 0.88rem;
  color: var(--ink-soft);
  padding: 13px 4px;
}
.link-quiet:hover { color: var(--blue); }

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; }
.reveal.visible {
  opacity: 1;
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  animation-delay: calc(var(--d, 0) * 90ms);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
}

/* ============ HERO ============ */
.hero {
  max-width: 1160px;
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(var(--nav-h) + clamp(40px, 8vh, 90px)) clamp(24px, 6vw, 48px) 60px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}

.hero-name {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: clamp(3.2rem, 9vw, 6.2rem);
  font-weight: 500; line-height: 0.98;
  letter-spacing: -1.5px;
  margin-bottom: 26px;
}

.hero-statement {
  font-size: clamp(1.05rem, 1.8vw, 1.22rem);
  color: var(--ink-soft);
  max-width: 480px;
  margin-bottom: 34px;
}
.hero-statement em {
  font-style: normal; color: var(--ink); font-weight: 500;
  border-bottom: 1px solid var(--line);
}

.hero-cta { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin-bottom: 30px; }

.hero-links { font-size: 0.8rem; color: var(--ink-faint); display: flex; gap: 10px; flex-wrap: wrap; }
.hero-links a { color: var(--ink-soft); }
.hero-links a:hover { color: var(--blue); }

/* ---------- the figure viewport ---------- */
.viewport {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 4px;
  background:
    linear-gradient(var(--paper) 0 0) padding-box,
    var(--paper);
  cursor: pointer;
  user-select: none;
}
/* corner tick marks, like a technical frame */
.viewport::before, .viewport::after,
.fig-caption::before, .fig-caption::after {
  content: ""; position: absolute;
  width: 14px; height: 14px;
  border-color: var(--ink-faint);
  border-style: solid;
}
.viewport::before { top: -1px; left: -1px; border-width: 1.5px 0 0 1.5px; }
.viewport::after { top: -1px; right: -1px; border-width: 1.5px 1.5px 0 0; }
.fig-caption::before { bottom: -1px; left: -1px; border-width: 0 0 1.5px 1.5px; }
.fig-caption::after { bottom: -1px; right: -1px; border-width: 0 1.5px 1.5px 0; }

#hero3d {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 0.92;
}

.fig-caption {
  display: flex; align-items: baseline; gap: 14px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-size: 0.76rem;
  transition: opacity 0.3s ease;
}
.fig-caption.fading { opacity: 0; }
.fig-id { color: var(--blue); letter-spacing: 1px; flex-shrink: 0; }
.fig-name { color: var(--ink); font-weight: 500; }
.fig-ctx { color: var(--ink-faint); margin-left: auto; text-align: right; }

/* tiny viewport HUD annotations */
.hud {
  position: absolute; z-index: 2;
  font-family: var(--font-mono); font-size: 0.62rem;
  letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--ink-faint);
  pointer-events: none;
  user-select: none;
}
.hud-tl { top: 10px; left: 13px; }
.hud-tr { top: 10px; right: 13px; }

/* ============ SECTIONS ============ */
.section {
  position: relative;
  max-width: 1160px; margin: 0 auto;
  padding: clamp(70px, 11vh, 120px) clamp(24px, 6vw, 48px);
  border-top: 1px solid var(--line);
}
/* drafting registration mark on each section rule */
.section::before {
  content: "+";
  position: absolute; top: 0; left: clamp(24px, 6vw, 48px);
  transform: translate(-50%, -55%);
  font-family: var(--font-mono); font-size: 0.85rem; line-height: 1;
  color: var(--ink-faint);
  background: var(--paper);
  padding: 0 5px;
}

.section-head { margin-bottom: clamp(36px, 6vh, 56px); }
.section-title {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: clamp(1.9rem, 4.5vw, 2.7rem);
  font-weight: 500; letter-spacing: -0.5px;
  line-height: 1.15;
}

/* ============ ABOUT ============ */
.about-grid {
  display: grid; grid-template-columns: 1.4fr 1fr;
  gap: clamp(36px, 6vw, 80px); align-items: start;
}
.about-text p { margin-bottom: 18px; color: var(--ink-soft); }
.about-text strong { color: var(--ink); font-weight: 600; }

.now-line {
  margin-top: 28px; padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem; color: var(--ink-soft);
  letter-spacing: 0.3px;
}

.about-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.stat {
  padding: 20px 18px 22px 0;
  border-top: 1px solid var(--line);
}
.stat-num {
  display: block;
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: clamp(2.2rem, 4vw, 2.9rem);
  font-weight: 500; line-height: 1.1;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  display: block; margin-top: 6px;
  font-size: 0.82rem; color: var(--ink-faint); line-height: 1.5;
}

/* ============ EXPERIENCE ============ */
.exp {
  display: grid; grid-template-columns: 200px 1fr;
  gap: clamp(20px, 4vw, 56px);
  padding: 34px 0;
  border-top: 1px solid var(--line);
}
.exp:last-of-type { padding-bottom: 0; }
.exp-date { font-size: 0.78rem; color: var(--ink-faint); letter-spacing: 0.4px; }
.exp-org { font-size: 0.9rem; color: var(--blue); font-weight: 500; margin-top: 4px; }
.exp-body h3 {
  font-family: var(--font-body);
  font-size: 1.12rem; font-weight: 600;
  margin-bottom: 12px;
}
.exp-body ul { list-style: none; }
.exp-body li {
  position: relative; padding-left: 20px; margin-bottom: 9px;
  color: var(--ink-soft); font-size: 0.95rem;
}
.exp-body li::before {
  content: "—"; position: absolute; left: 0; color: var(--ink-faint);
}
.exp-body strong { color: var(--ink); font-weight: 600; }
.exp-tags {
  margin-top: 14px;
  font-size: 0.76rem; color: var(--ink-faint); letter-spacing: 0.3px;
}

/* ============ PROJECTS ============ */
.projects-grid {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 18px;
}
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }

.project {
  position: relative;
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  padding: 24px;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}
.project:hover {
  border-color: var(--ink-faint);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px var(--shadow);
}
/* corner ticks — the same drafting-frame mark as the figure viewports,
   revealed on hover so the resting grid stays quiet */
.project::before, .project::after {
  content: ""; position: absolute; z-index: 1;
  width: 10px; height: 10px;
  border-color: var(--ink-faint);
  border-style: solid;
  opacity: 0; transition: opacity 0.25s;
}
.project::before { top: -1px; left: -1px; border-width: 1.5px 0 0 1.5px; }
.project::after { top: -1px; right: -1px; border-width: 1.5px 1.5px 0 0; }
.project:hover::before, .project:hover::after,
.project:focus-within::before, .project:focus-within::after { opacity: 1; }
.project-top {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  min-height: 22px; margin-bottom: 14px;
  font-size: 0.74rem;
}
.proj-fig { color: var(--ink-faint); letter-spacing: 0.6px; }
.award { color: var(--blue); letter-spacing: 0.4px; }
.proj-link { margin-left: auto; color: var(--ink-faint); }
.proj-link:hover { color: var(--blue); }
.project h3 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: 1.42rem; font-weight: 500;
  margin-bottom: 10px; letter-spacing: -0.2px;
}
.project p { color: var(--ink-soft); font-size: 0.93rem; flex: 1; }
.project .proj-tags {
  margin-top: 16px; flex: 0;
  font-size: 0.74rem; color: var(--ink-faint); letter-spacing: 0.3px;
}

.projects-more { text-align: center; margin-top: 40px; font-size: 0.85rem; }

/* ============ SKILLS ============ */
.skills-layout {
  display: grid; grid-template-columns: 0.95fr 1.05fr;
  gap: clamp(28px, 4vw, 60px);
  align-items: center;
}
#globeViewport { cursor: default; }
#skillsGlobe {
  display: block; width: 100%;
  aspect-ratio: 1 / 0.92;
  cursor: grab;
}
#skillsGlobe.dragging { cursor: grabbing; }

.skills-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0 28px;
}
.skill-group {
  border-top: 1px solid var(--line);
  padding: 20px 24px 4px 0;
}
.skill-group h3 {
  font-size: 0.76rem; font-weight: 500;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 12px;
}
.skill-group p { font-size: 0.9rem; color: var(--ink-soft); line-height: 1.9; }

/* ============ CONTACT ============ */
.contact-blurb { color: var(--ink-soft); max-width: 560px; margin-bottom: 30px; }
.inline-cmd {
  font-family: var(--font-mono); font-size: 0.85em;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 2px 7px;
  white-space: nowrap;
}
.contact-actions { margin-bottom: 26px; }
.contact-links { font-size: 0.82rem; color: var(--ink-faint); display: flex; gap: 10px; flex-wrap: wrap; }
.contact-links a { color: var(--ink-soft); }
.contact-links a:hover { color: var(--blue); }

/* ============ TERMINAL ============ */
.terminal {
  margin-top: 56px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  overflow: hidden;
}
.term-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-soft);
  font-size: 0.74rem; color: var(--ink-soft); letter-spacing: 0.4px;
}
.term-hint { color: var(--ink-faint); }
.term-float-close {
  display: none;
  margin-left: 10px;
  background: none; border: 0; cursor: pointer;
  color: var(--ink-faint); font-family: var(--font-mono); font-size: 0.85rem;
  line-height: 1; padding: 2px 4px;
}
.term-float-close:hover { color: var(--blue); }
.term-body {
  padding: 16px 18px;
  font-size: 0.84rem; line-height: 1.9;
  max-height: 300px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
  cursor: text;
}
.term-out { color: var(--ink-soft); white-space: pre-wrap; word-break: break-word; }
.term-out a { color: var(--blue); }
.term-out .term-cmd { color: var(--blue); font-weight: 500; }
.term-echo { color: var(--ink); }
.term-echo .term-prompt { margin-right: 8px; }
.term-line { display: flex; align-items: center; }
.term-prompt { color: var(--blue); margin-right: 8px; flex-shrink: 0; font-weight: 500; }
#termInput {
  flex: 1; background: transparent; border: 0; outline: 0;
  color: var(--ink); font: inherit; caret-color: var(--blue-bright);
}

/* ---------- floating launcher ---------- */
.term-launcher {
  position: fixed; right: 22px; bottom: 22px; z-index: 1100;
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 0.82rem;
  color: var(--ink); background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 11px 18px;
  box-shadow: 0 10px 26px var(--shadow);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, transform 0.2s;
}
.term-launcher:hover { border-color: var(--blue); color: var(--blue); transform: translateY(-2px); }
.term-launcher.is-open { border-color: var(--blue); color: var(--blue); }
.term-launcher-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--blue); flex-shrink: 0;
}

/* ---------- terminal popped out as a floating panel ---------- */
.terminal--floating {
  position: fixed !important;
  right: 22px; bottom: 78px; left: auto; top: auto;
  width: min(420px, calc(100vw - 44px));
  margin: 0;
  z-index: 1150;
  box-shadow: 0 24px 60px var(--shadow);
  animation: term-pop 0.22s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.terminal--floating .term-body { max-height: min(56vh, 420px); }
.terminal--floating .term-float-close { display: inline-block; }
@keyframes term-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
}
@media (max-width: 500px) {
  .term-launcher { right: 14px; bottom: 14px; padding: 10px 15px; }
  .terminal--floating { right: 14px; bottom: 68px; width: calc(100vw - 28px); }
}

/* ============ COMMAND PALETTE ============ */
.palette-hint {
  font-family: var(--font-mono); font-size: 0.78rem;
  color: var(--ink-soft);
  background: none;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 5px 10px;
  cursor: pointer;
  line-height: 1.4;
  transition: border-color 0.2s, color 0.2s;
}
.palette-hint:hover { border-color: var(--blue); color: var(--blue); }

.palette-scrim {
  position: fixed; inset: 0; z-index: 1400;
  background: rgba(36, 30, 18, 0.22);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 20px 20px;
}
.palette-scrim[hidden] { display: none; }
:root[data-theme="dark"] .palette-scrim { background: rgba(0, 0, 0, 0.55); }

.palette {
  width: min(560px, 100%);
  max-height: 60vh;
  display: flex; flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 30px 70px var(--shadow);
  overflow: hidden;
  animation: term-pop 0.18s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.palette-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.palette-prompt { color: var(--blue); font-weight: 500; }
.palette-input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: 0;
  color: var(--ink); font: inherit; font-size: 0.95rem;
  caret-color: var(--blue-bright);
}
.palette-input::placeholder { color: var(--ink-faint); }
.palette-esc {
  font-size: 0.7rem; color: var(--ink-faint);
  border: 1px solid var(--line); border-radius: 3px;
  padding: 2px 6px; flex-shrink: 0;
}
.palette-list {
  list-style: none;
  overflow-y: auto;
  padding: 6px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.palette-item {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 0.88rem;
  color: var(--ink);
  cursor: pointer;
}
.palette-item > span:first-child {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.palette-item-hint {
  color: var(--ink-faint); font-size: 0.76rem; flex-shrink: 0;
  max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.palette-item.active { background: var(--blue-soft); }
.palette-item.active .palette-item-hint { color: var(--blue); }
.palette-empty {
  padding: 20px 12px; text-align: center;
  color: var(--ink-faint); font-size: 0.85rem;
}

/* ============ FOOTER ============ */
.footer {
  max-width: 1160px; margin: 0 auto;
  text-align: left;
  padding: 26px clamp(24px, 6vw, 48px) 34px;
  color: var(--ink-faint); font-size: 0.76rem;
  border-top: 1px solid var(--line);
}
.footer a { color: var(--ink-soft); }

/* ============ RESPONSIVE ============ */
@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: calc(var(--nav-h) + 48px); }
  .viewport { max-width: 480px; }
  .projects-grid { grid-template-columns: 1fr 1fr; }
  .span-2, .span-3, .span-4 { grid-column: span 1; }
  .skills-layout { grid-template-columns: 1fr; }
  .skills-layout .viewport { margin: 0 auto; width: 100%; }
  .exp { grid-template-columns: 160px 1fr; }
}

@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: fixed; inset: 0; z-index: 940;
    flex-direction: column; justify-content: center;
    background: var(--nav-bg-strong);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    gap: 28px;
    padding: 32px 0;
    overflow-y: auto;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s;
  }
  .nav-links a:not(.nav-resume) { font-size: 1rem; }
  .nav-links .theme-toggle, .nav-links .palette-hint { font-size: 0.9rem; padding: 8px 14px; }
  .nav-links.open { opacity: 1; pointer-events: auto; }
  .projects-grid { grid-template-columns: 1fr; }
  .exp { grid-template-columns: 1fr; gap: 10px; padding: 28px 0; }
  .exp-org { margin-top: 0; display: inline; margin-left: 10px; }
  .exp-meta { display: flex; align-items: baseline; }
  .skills-grid { grid-template-columns: 1fr; }
  .term-body { max-height: 240px; }
}

@media (max-width: 420px) {
  .about-stats { grid-template-columns: 1fr; }
}

/* ============ REDUCED MOTION ============ */
@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;
  }
  .reveal { opacity: 1; transform: none; }
}
