/* ============ THEME TOKENS ============ */
:root {
  --bg: #fafaf9;
  --bg-alt: #f1f1ef;
  --card: #ffffff;
  --text: #1c1917;
  --muted: #57534e;
  --border: #e7e5e4;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --radius: 12px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --bg-alt: #151820;
    --card: #1a1e27;
    --text: #e7e9ee;
    --muted: #9aa1ad;
    --border: #2a2f3a;
    --accent: #60a5fa;
    --accent-soft: rgba(96, 165, 250, 0.14);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115;
  --bg-alt: #151820;
  --card: #1a1e27;
  --text: #e7e9ee;
  --muted: #9aa1ad;
  --border: #2a2f3a;
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.14);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* ============ BASE ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s, color 0.25s;
}
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

.container { width: min(1100px, 100% - 32px); margin-inline: auto; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-block;
  padding: 0.75rem 1.4rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1.5px solid var(--accent);
  transition: transform 0.15s, background 0.2s, color 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-ghost { color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-lg { padding: 1rem 2rem; font-size: 1rem; }

.icon-btn {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }

/* ============ NAV ============ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.nav.scrolled { border-bottom-color: var(--border); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-family: var(--mono); font-weight: 700; font-size: 1.3rem; }
.logo span { color: var(--accent); }
.nav-links { display: flex; gap: 2rem; }
.nav-links a { font-size: 0.92rem; color: var(--muted); font-weight: 500; transition: color 0.2s; }
.nav-links a:hover, .nav-links a.active { color: var(--accent); }
.nav-actions { display: flex; gap: 4px; }
.menu-btn { display: none; }

.moon { display: none; }
:root[data-theme="dark"] .sun { display: none; }
:root[data-theme="dark"] .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sun { display: none; }
  :root:not([data-theme="light"]) .moon { display: block; }
}

/* ============ HERO ============ */
.hero { min-height: calc(100vh - 64px); display: flex; align-items: center; padding: 4rem 0; }
.eyebrow { font-family: var(--mono); color: var(--accent); margin-bottom: 1rem; }
.hero h1 { font-size: clamp(2.6rem, 8vw, 5rem); line-height: 1.05; letter-spacing: -0.03em; }
.hero-sub {
  font-size: clamp(1.8rem, 6vw, 3.6rem);
  line-height: 1.1;
  color: var(--muted);
  letter-spacing: -0.02em;
  margin-top: 0.4rem;
}
.hero-text { max-width: 560px; color: var(--muted); margin: 1.5rem 0 2rem; font-size: 1.05rem; }
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; }
.socials { display: flex; gap: 1rem; margin-top: 2.5rem; }
.socials a { color: var(--muted); transition: color 0.2s, transform 0.2s; display: block; }
.socials a:hover { color: var(--accent); transform: translateY(-3px); }

/* ============ SECTIONS ============ */
.section { padding: 6rem 0; }
.section:nth-of-type(even) { background: var(--bg-alt); }
.section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin-bottom: 2.5rem;
  letter-spacing: -0.02em;
}
.section-title span { font-family: var(--mono); color: var(--accent); font-size: 0.8em; font-weight: 400; }
.section-title::after { content: ""; flex: 1; max-width: 280px; height: 1px; background: var(--border); }
.section-title.center { justify-content: center; }
.section-intro { color: var(--muted); margin: -1.5rem 0 2rem; }
.module-tags { margin-top: 0.75rem; }
@media (min-width: 769px) and (max-width: 1000px) {
  .nav-links { gap: 1.1rem; }
}
.section-title.center::after { display: none; }

/* ============ ABOUT ============ */
.about-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 3.5rem; align-items: start; }
.about-text p { color: var(--muted); margin-bottom: 1rem; }
.about-text strong { color: var(--text); }
.about-text .btn { margin-top: 0.5rem; }
.about-text .interests { margin: 0.25rem 0 1.5rem; }
.about-text .interests li { font-family: var(--sans); font-size: 0.85rem; }
.about-photo { position: relative; max-width: 300px; justify-self: center; width: 100%; }
.about-photo img, .photo-placeholder {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  object-fit: cover;
  position: relative;
  z-index: 1;
}
.photo-placeholder {
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 4rem;
  font-weight: 700;
}
.about-photo::after {
  content: "";
  position: absolute;
  inset: 16px -16px -16px 16px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  z-index: 0;
  transition: inset 0.25s;
}
.about-photo:hover::after { inset: 10px -10px -10px 10px; }
.about-photo img { aspect-ratio: 4 / 5; height: auto; object-position: center 20%; }

.about-wide { margin-top: 4rem; }
.about-wide img {
  width: 100%;
  height: auto;
  max-height: 460px;
  object-fit: cover;
  object-position: center 45%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.about-wide figcaption { margin-top: 0.75rem; font-family: var(--mono); font-size: 0.82rem; color: var(--muted); }

/* ============ SKILLS ============ */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 1.25rem; }
.skill-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.skill-card h3 { font-size: 1.05rem; margin-bottom: 1rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tags li {
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

/* ============ PROJECTS ============ */
.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 2rem; }
.filter {
  font: 500 0.9rem var(--sans);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}
.filter:hover { color: var(--accent); border-color: var(--accent); }
.filter.active { background: var(--accent); border-color: var(--accent); color: var(--bg); }

.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 1.25rem; }
.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.project-body { padding: 1.75rem; display: flex; flex-direction: column; flex: 1; }
.project-body p + p, .project-body p + .project-points { margin-top: 0.75rem; }
.project-points { margin-top: 0.9rem; display: grid; gap: 0.5rem; }
.project-points li {
  position: relative;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.project-points li::before { content: "▹"; position: absolute; left: 0; color: var(--accent); }

/* ============ GALLERY ============ */
.gallery { border-bottom: 1px solid var(--border); background: var(--bg-alt); }
.gallery-main {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0b0d11;
  cursor: zoom-in;
}
.gallery-main img, .gallery-main video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.gallery-main .expand {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font: 500 0.75rem var(--mono);
  cursor: pointer;
}
.gallery-thumbs { display: flex; gap: 6px; padding: 8px 10px 0; overflow-x: auto; }
.gallery-thumbs button {
  position: relative;
  flex: 0 0 auto;
  width: 72px;
  height: 44px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: #0b0d11;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s, border-color 0.2s;
}
.gallery-thumbs button:hover { opacity: 1; }
.gallery-thumbs button.active { opacity: 1; border-color: var(--accent); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs .play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.8rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}
.gallery.single .gallery-thumbs { display: none; }
.gallery.light .gallery-main, .gallery.light .gallery-thumbs button { background: #fff; }
.gallery-caption { padding: 8px 12px 10px; font-family: var(--mono); font-size: 0.75rem; color: var(--muted); min-height: 1.5em; }

/* ============ LIGHTBOX ============ */
.lightbox {
  border: none;
  padding: 0;
  background: transparent;
  max-width: min(1400px, 94vw);
  max-height: 94vh;
  margin: auto;
  overflow: visible;
}
.lightbox::backdrop { background: rgba(5, 7, 10, 0.88); }
.lightbox-content img, .lightbox-content video {
  display: block;
  max-width: min(1400px, 94vw);
  max-height: 84vh;
  border-radius: 8px;
  margin: 0 auto;
}
.lightbox-caption { color: #e7e9ee; text-align: center; font-family: var(--mono); font-size: 0.85rem; margin-top: 0.75rem; }
.lightbox-close {
  position: fixed;
  top: 14px;
  right: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.25); }
.project-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: var(--accent); }
.project-card.hidden { display: none !important; }
.project-top { display: flex; justify-content: space-between; align-items: center; color: var(--accent); margin-bottom: 1.25rem; }
.project-card.featured { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .project-card.featured { display: grid; grid-template-columns: 1.25fr 1fr; }
  .project-card.featured .gallery { border-bottom: none; border-right: 1px solid var(--border); display: flex; flex-direction: column; justify-content: center; }
}
.badge {
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
}
.badge.award { background: var(--accent); color: var(--bg); }
.project-links { display: flex; gap: 1rem; }
.project-links a { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); }
.project-links a:hover { color: var(--accent); }
.project-card h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.project-card p { color: var(--muted); font-size: 0.95rem; }
.project-tech { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: auto; padding-top: 1.25rem; font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }

/* ============ TIMELINE ============ */
.timeline { position: relative; padding-left: 2rem; border-left: 2px solid var(--border); max-width: 760px; }
.timeline > li { position: relative; padding-bottom: 2.5rem; }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before {
  content: "";
  position: absolute;
  left: calc(-2rem - 7px);
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.section:nth-of-type(even) .timeline > li::before { background: var(--bg-alt); }
.date { font-family: var(--mono); font-size: 0.82rem; color: var(--accent); }
.timeline h3 { font-size: 1.15rem; margin-top: 0.2rem; }
.where { color: var(--text); font-weight: 500; opacity: 0.8; margin-bottom: 0.4rem; }
.timeline p:not(.where) { color: var(--muted); }

/* ============ CONTACT ============ */
.contact-inner { text-align: center; max-width: 600px; }
.contact-inner p { color: var(--muted); margin-bottom: 2rem; font-size: 1.05rem; }

/* ============ FOOTER ============ */
.footer { padding: 2rem 0; text-align: center; font-family: var(--mono); font-size: 0.82rem; color: var(--muted); border-top: 1px solid var(--border); }

/* ============ SCROLL REVEAL ============ */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .menu-btn { display: grid; }
  .nav-links {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  .nav-links.open { max-height: 480px; }
  .nav-links a { display: block; padding: 1rem 16px; }
  .about-grid { grid-template-columns: 1fr; gap: 3rem; }
  .about-photo { max-width: 240px; }
  .section { padding: 4.5rem 0; }
  .projects-grid { grid-template-columns: 1fr; }
}

.project-points code { font-family: var(--mono); font-size: 0.85em; color: var(--accent); }

/* =====================================================================
   VISUAL REFRESH: "mission control" theme
   ===================================================================== */
:root {
  --display: "Space Grotesk", var(--sans);
  --bg: #f6f8fc;
  --bg-alt: #eef2f9;
  --border: #dfe5ef;
  --grid: rgba(37, 99, 235, 0.06);
  --glow: rgba(37, 99, 235, 0.18);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #080b12;
    --bg-alt: #0c111b;
    --card: #0f1520;
    --border: #1d2636;
    --grid: rgba(96, 165, 250, 0.05);
    --glow: rgba(96, 165, 250, 0.22);
  }
}
:root[data-theme="dark"] {
  --bg: #080b12;
  --bg-alt: #0c111b;
  --card: #0f1520;
  --border: #1d2636;
  --grid: rgba(96, 165, 250, 0.05);
  --glow: rgba(96, 165, 250, 0.22);
}

/* Blueprint grid behind everything */
body {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px;
}
h1, h2, h3, .logo { font-family: var(--display); }
.section:nth-of-type(even) { background: transparent; }
.section { border-top: 1px solid var(--border); position: relative; }
.section:nth-of-type(even) .timeline > li::before, .timeline > li::before { background: var(--bg); }
::selection { background: var(--accent); color: var(--bg); }

/* Scroll progress */
.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 200;
  background: var(--accent); transform-origin: 0 50%; transform: scaleX(0);
  box-shadow: 0 0 10px var(--accent);
}

/* Nav */
.logo { letter-spacing: -0.02em; }
.nav-links a { position: relative; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px;
  background: var(--accent); transform: scaleX(0); transition: transform 0.25s; border-radius: 2px;
}
.nav-links a.active::after, .nav-links a:hover::after { transform: scaleX(1); }

/* Buttons */
.btn { border-radius: 10px; }
.btn-primary { box-shadow: 0 6px 24px -6px var(--glow), 0 0 0 1px var(--accent); }
.btn-primary:hover { box-shadow: 0 10px 32px -6px var(--accent); }

/* ============ HERO ============ */
.hero {
  position: relative;
  overflow: hidden;
  min-height: calc(100svh - 64px);
  isolation: isolate;
}
.hero-canvas { position: absolute; inset: 0; z-index: -2; }
.hero-fade {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(90deg, var(--bg) 0%, var(--bg) 30%, color-mix(in srgb, var(--bg) 70%, transparent) 52%, transparent 75%),
    linear-gradient(0deg, var(--bg) 0%, transparent 22%),
    linear-gradient(180deg, var(--bg) 0%, transparent 12%);
}
.hero-inner { position: relative; }
.eyebrow { display: flex; align-items: center; gap: 0.75rem; font-size: 0.85rem; letter-spacing: 0.12em; text-transform: uppercase; }
.eyebrow-line { width: 36px; height: 1px; background: var(--accent); display: inline-block; }
.hero h1 { font-size: clamp(3rem, 10vw, 6.5rem); letter-spacing: -0.045em; line-height: 0.95; font-weight: 700; }
.accent-dot { color: var(--accent); }
.hero-role {
  font-family: var(--mono); font-size: clamp(1.05rem, 2.6vw, 1.5rem); margin-top: 1.25rem; color: var(--muted);
  min-height: 1.6em;
}
.hero-role .prompt { color: var(--accent); margin-right: 0.35rem; }
.hero-role .role { color: var(--text); font-weight: 500; }
.caret {
  display: inline-block; width: 0.6ch; height: 1.1em; margin-left: 2px; vertical-align: -0.15em;
  background: var(--accent); animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.hero-text { max-width: 520px; }
.hero-cta { align-items: center; }
.hero-cta .socials { margin: 0 0 0 0.5rem; }

/* HUD overlay */
.hud { position: absolute; inset: 24px; pointer-events: none; z-index: 0; }
.hud-corner { position: absolute; width: 22px; height: 22px; border: 0 solid var(--accent); opacity: 0.7; }
.hud-corner.tl { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.hud-corner.tr { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.hud-corner.bl { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.hud-corner.br { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }
.hud-panel {
  position: absolute; top: 20px; right: 28px; font-family: var(--mono); font-size: 0.72rem;
  color: var(--muted); background: color-mix(in srgb, var(--card) 80%, transparent);
  border: 1px solid var(--border); border-radius: 8px; padding: 0.7rem 0.9rem; backdrop-filter: blur(6px);
  min-width: 190px;
}
.hud-live { color: var(--accent); font-weight: 700; letter-spacing: 0.06em; margin-bottom: 0.4rem; display: flex; align-items: center; gap: 0.4rem; }
.hud-live .dot { width: 7px; height: 7px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 8px #ef4444; animation: blink 1.2s steps(1) infinite; }
.hud-panel dl div { display: flex; justify-content: space-between; gap: 1rem; }
.hud-panel dt { opacity: 0.7; }
.hud-panel dd { color: var(--text); }

.scroll-cue {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  width: 22px; height: 36px; border: 2px solid var(--muted); border-radius: 12px; opacity: 0.6;
}
.scroll-cue span {
  position: absolute; left: 50%; top: 6px; width: 3px; height: 7px; margin-left: -1.5px;
  background: var(--accent); border-radius: 2px; animation: cue 1.6s ease-in-out infinite;
}
@keyframes cue { 0% { transform: translateY(0); opacity: 1; } 80% { transform: translateY(12px); opacity: 0; } 100% { opacity: 0; } }

/* ============ STATS ============ */
.stats { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--card) 60%, transparent); }
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); }
.stat { padding: 1.8rem 1rem; display: flex; flex-direction: column; gap: 0.3rem; border-left: 1px solid var(--border); }
.stat:first-child { border-left: none; }
.stat-num { font-family: var(--display); font-size: clamp(1.8rem, 3.5vw, 2.6rem); font-weight: 700; letter-spacing: -0.03em; color: var(--accent); line-height: 1; }
.stat-label { font-family: var(--mono); font-size: 0.74rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ============ SECTION TITLES ============ */
.section-title { font-size: clamp(1.9rem, 5vw, 2.8rem); letter-spacing: -0.03em; }
.section-title span {
  font-size: 0.42em; padding: 0.3em 0.6em; border: 1px solid var(--accent); border-radius: 6px;
  letter-spacing: 0.05em; align-self: center;
}
.section-title::after { background: linear-gradient(90deg, var(--border), transparent); max-width: none; }

/* ============ CARDS: spotlight + HUD corners ============ */
.project-card, .skill-card { position: relative; isolation: isolate; }
.project-card::before, .skill-card::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, -200px), var(--glow), transparent 60%);
  opacity: 0; transition: opacity 0.3s;
}
.project-card:hover::before, .skill-card:hover::before { opacity: 1; }
.project-card::after {
  content: ""; position: absolute; inset: 8px; pointer-events: none; border-radius: 6px; opacity: 0;
  transition: opacity 0.3s, inset 0.3s;
  background:
    linear-gradient(var(--accent), var(--accent)) top left / 14px 2px,
    linear-gradient(var(--accent), var(--accent)) top left / 2px 14px,
    linear-gradient(var(--accent), var(--accent)) top right / 14px 2px,
    linear-gradient(var(--accent), var(--accent)) top right / 2px 14px,
    linear-gradient(var(--accent), var(--accent)) bottom left / 14px 2px,
    linear-gradient(var(--accent), var(--accent)) bottom left / 2px 14px,
    linear-gradient(var(--accent), var(--accent)) bottom right / 14px 2px,
    linear-gradient(var(--accent), var(--accent)) bottom right / 2px 14px;
  background-repeat: no-repeat;
}
.project-card:hover::after { opacity: 1; inset: 4px; }
.project-card:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.skill-card { transition: border-color 0.2s, transform 0.2s; }
.skill-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); transform: translateY(-3px); }

/* Photo frame accent */
.about-photo::after { border-style: dashed; }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .hud-panel { display: none; }
  .hero-fade {
    background:
      linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 80%, transparent) 60%, color-mix(in srgb, var(--bg) 55%, transparent) 100%),
      linear-gradient(0deg, var(--bg) 0%, transparent 25%);
  }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat { border-left: none; border-top: 1px solid var(--border); }
  .stat:nth-child(even) { border-left: 1px solid var(--border); }
  .stat:nth-child(-n+2) { border-top: none; }
  .stat:last-child { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .hud { inset: 12px; }
  .scroll-cue { display: none; }
  .hero-cta .socials { margin: 0.5rem 0 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .caret, .hud-live .dot, .scroll-cue span { animation: none; }
}

/* ============ HERO SCENE TABS ============ */
.scene-tabs {
  position: absolute; right: 48px; bottom: 44px; z-index: 2;
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end;
  max-width: 52%;
}
.scene-tabs button {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  background: color-mix(in srgb, var(--card) 75%, transparent);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px 8px;
  font: 500 0.72rem var(--mono); color: var(--muted); cursor: pointer;
  backdrop-filter: blur(6px); transition: color 0.2s, border-color 0.2s;
  min-width: 96px;
}
.scene-tabs button:hover { color: var(--text); border-color: var(--accent); }
.scene-tabs button.active { color: var(--text); border-color: var(--accent); }
.scene-tabs .bar { display: block; width: 100%; height: 2px; background: var(--border); border-radius: 2px; overflow: hidden; }
.scene-tabs .bar span { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }
.scene-tabs button:not(.active) .bar span { transform: scaleX(0) !important; }

/* Stats are links now */
a.stat { color: inherit; transition: background 0.2s; }
a.stat:hover { background: var(--accent-soft); }
a.stat:hover .stat-label { color: var(--text); }
.stat-label { text-transform: none; letter-spacing: 0; font-size: 0.8rem; line-height: 1.4; }

@media (max-width: 900px) {
  .scene-tabs { left: 16px; right: 16px; bottom: 20px; max-width: none; justify-content: flex-start; }
  .scene-tabs button { min-width: 0; padding: 6px 8px 7px; }
}
@media (max-width: 600px) {
  .scene-tabs { display: none; }
}

/* ============ CONTENT UPDATE: 4 stats, 6 skill cards, role lines ============ */
@media (min-width: 901px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .skills-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .stat:last-child { grid-column: auto; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .skills-grid { grid-template-columns: 1fr; }
}
.role-line { margin: 0.75rem 0 0.4rem; color: var(--text); }
.role-line strong { color: var(--accent); font-weight: 600; }
.contact-inner .contact-email { margin: 1.25rem 0 0; font-family: var(--mono); font-size: 1rem; }
.contact-email a, .footer a { color: var(--accent); }
.contact-email a:hover, .footer a:hover { text-decoration: underline; }

/* Featured card: gallery and system overview on the left, my work on the right */
.project-extra { border-top: 1px solid var(--border); }
.project-extra .role-line { margin-top: 0; }
@media (min-width: 900px) {
  .project-card.featured {
    grid-template-columns: 1.2fr 1fr;
    grid-template-areas: "gallery body" "extra body";
    grid-template-rows: auto 1fr;
  }
  .project-card.featured .gallery { grid-area: gallery; justify-content: flex-start; }
  .project-card.featured > .project-body:not(.project-extra) { grid-area: body; border-left: 1px solid var(--border); }
  .project-card.featured .project-extra { grid-area: extra; }
  .project-card.featured .gallery { border-right: none; }
}

/* Contact links */
.contact-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; }
.contact-links a {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.75rem 1.1rem; border: 1px solid var(--border); border-radius: 10px;
  font-family: var(--mono); font-size: 0.95rem; color: var(--text);
  transition: border-color 0.2s, color 0.2s, transform 0.2s;
}
.contact-links a:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.contact-links svg { color: var(--accent); flex-shrink: 0; }

/* Never allow sideways page drag on phones */
html, body { overflow-x: clip; }

/* ============ MOBILE HERO: text on top, animation stage below ============ */
@media (max-width: 600px) {
  .hero {
    display: block; min-height: 0;
    padding: 2.25rem 0 calc(min(88vw, 360px) + 70px);
  }
  .hero-fade {
    background:
      linear-gradient(180deg,
        var(--bg) 0,
        color-mix(in srgb, var(--bg) 90%, transparent) calc(var(--stage-top, 60%) - 40px),
        color-mix(in srgb, var(--bg) 0%, transparent) calc(var(--stage-top, 60%) + 10px)),
      linear-gradient(0deg, var(--bg) 0, transparent 70px);
  }
  .scene-tabs {
    display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    left: 16px; right: 16px; bottom: 18px; justify-content: space-between; gap: 6px;
  }
  .scene-tabs::-webkit-scrollbar { display: none; }
  .scene-tabs button { flex: 1 0 auto; min-width: 0; padding: 6px 8px 7px; font-size: 0.7rem; }
  .hud-corner.tl, .hud-corner.tr { display: none; }
}

/* ============ MOBILE: no top bar, floating light/dark button ============ */
@media (max-width: 768px) {
  .nav {
    position: fixed; top: auto; left: auto; right: 16px; bottom: 16px;
    background: none; backdrop-filter: none; -webkit-backdrop-filter: none;
    border: none; pointer-events: none;
  }
  .nav .container { width: auto; padding: 0; margin: 0; }
  .nav-inner { height: auto; }
  .nav nav, .menu-btn { display: none !important; }
  .nav #theme-toggle {
    pointer-events: auto;
    width: 48px; height: 48px; padding: 0; border-radius: 50%;
    background: color-mix(in srgb, var(--card) 85%, transparent);
    border: 1px solid var(--border);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  }
  .nav #theme-toggle:hover { border-color: var(--accent); }
}
@media (max-width: 600px) {
  /* Leave room for the floating light/dark button beside the scene tabs */
  .scene-tabs { right: 76px; bottom: 16px; }
  .scene-tabs button { padding: 6px 6px 7px; font-size: 0.66rem; }
  .hero { padding-top: 3rem; }
}
.team-line { margin-top: 0.75rem; font-size: 0.88rem !important; }
@media (min-width: 900px) {
  .project-card.featured { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
  .project-card.featured > * { min-width: 0; }
}
.part-head {
  margin: 1.1rem 0 0.2rem; font-family: var(--display); font-size: 1rem; font-weight: 600;
  color: var(--accent); padding-bottom: 0.4rem; border-bottom: 1px solid var(--border);
}
.sub-head {
  margin: 0.9rem 0 0.1rem; font-family: var(--mono); font-size: 0.74rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text);
}
.project-extra .sub-head:first-child { margin-top: 0; }
.team-line { margin-top: 0.4rem; }

/* SkySpot card: title + my part on the right, gallery + overview on the left */
.project-card.featured .sky-head { padding-bottom: 0; flex: none; }
.project-card.featured .sky-head h3 { margin-bottom: 0; }
.project-card.featured .sky-part .part-head { margin-top: 0; }
.project-card.featured .sky-part { padding-top: 1rem; }
@media (min-width: 900px) {
  .project-card.featured {
    grid-template-areas: "gallery head" "gallery part" "extra part";
    grid-template-rows: auto auto 1fr;
  }
  .project-card.featured > .project-body.sky-head { grid-area: head; border-left: 1px solid var(--border); }
  .project-card.featured > .project-body.sky-part { grid-area: part; border-left: 1px solid var(--border); }
}
/* Phone order for the SkySpot card: pictures, title, overview, then my part */
.project-card.featured > .gallery { order: 0; }
.project-card.featured > .sky-head { order: 1; }
.project-card.featured > .project-extra { order: 2; border-top: none; padding-top: 0.75rem; }
.project-card.featured > .sky-part { order: 3; }
.project-card.featured .project-extra .project-tech { margin-top: 1rem; }
@media (min-width: 900px) {
  .project-card.featured > .project-extra { border-top: 1px solid var(--border); padding-top: 1.75rem; }
}

/* Gallery thumbnail scrollbar: thin, rounded, in the site's colours */
.gallery-thumbs {
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--accent) 55%, transparent) transparent;
}
.gallery-thumbs::-webkit-scrollbar { height: 6px; }
.gallery-thumbs::-webkit-scrollbar-track { background: transparent; }
.gallery-thumbs::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 999px;
}
.gallery-thumbs::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.gallery-thumbs:hover { scrollbar-color: var(--accent) transparent; }

/* ============ CARD ALIGNMENT: cards in a row share gallery, badge, title and text rows ============ */
@supports (grid-template-rows: subgrid) {
  .projects-grid > .project-card:not(.featured) {
    display: grid;
    grid-row: span 4;
    grid-template-rows: subgrid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .projects-grid > .project-card:not(.featured) > .gallery { grid-row: 1; align-self: stretch; }
  .projects-grid > .project-card:not(.featured) > .project-body {
    grid-row: 2 / span 3;
    display: grid;
    grid-template-rows: subgrid;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    gap: 0;
  }
  .projects-grid > .project-card:not(.featured) .project-top { align-self: start; }
  .projects-grid > .project-card:not(.featured) .project-body > h3 { align-self: start; }
}
.project-rest { display: flex; flex-direction: column; }
.project-rest > .project-tech { margin-top: auto; padding-top: 1rem; }

/* SkySpot headings use the same heading font as card titles */
.part-head { font-family: var(--display); font-size: 1.05rem; font-weight: 600; color: var(--text); }
.sub-head {
  font-family: var(--display); font-size: 0.95rem; font-weight: 600;
  letter-spacing: normal; text-transform: none; color: var(--accent);
}
