:root,
:root[data-theme="dark"] {
  --bg: #0b1222;
  --surface: #121c33;
  --surface-2: #17233f;
  --line: #24344f;
  --text: #e9eef7;
  --muted: #97a7c0;
  --accent: #5b8def;
  --accent-2: #a78bfa;
  --accent-text: #ffffff;
  --signal: #f6b84a;
  --ok: #3fd29f;
  --bug: #f25f5f;
  --event: #c4a5ff;

  /* One color per layer of the system, reused across the page. */
  --c-edge: #38bdf8;
  --c-service: #6d7dff;
  --c-data: #2dd4bf;
  --c-async: #b48cff;
  --c-security: #f6b84a;
  --c-ai: #f472b6;
  --c-concepts: #94a3b8;

  --blob-1: rgba(91, 141, 239, 0.22);
  --blob-2: rgba(167, 139, 250, 0.16);
  --blob-3: rgba(45, 212, 191, 0.1);
  --shadow: 0 10px 30px rgba(3, 8, 20, 0.45);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f4f6fc;
  --surface: #ffffff;
  --surface-2: #f7f8fe;
  --line: #d9e0ee;
  --text: #121d36;
  --muted: #56647e;
  --accent: #2f5fd8;
  --accent-2: #7c4dcc;
  --accent-text: #ffffff;
  --signal: #c47f0a;
  --ok: #13875f;
  --bug: #c93838;
  --event: #7c4dcc;

  --c-edge: #0284c7;
  --c-service: #4f46e5;
  --c-data: #0d9488;
  --c-async: #7c3aed;
  --c-security: #b45309;
  --c-ai: #db2777;
  --c-concepts: #475569;

  --blob-1: rgba(47, 95, 216, 0.14);
  --blob-2: rgba(124, 77, 204, 0.1);
  --blob-3: rgba(13, 148, 136, 0.08);
  --shadow: 0 10px 30px rgba(30, 50, 100, 0.1);
  color-scheme: light;
}

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

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

/* Page color and soft colored light live on <html>, so the fixed 3D layer can sit between them and the content. */
html {
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 600px at 8% -5%, var(--blob-1), transparent 70%),
    radial-gradient(800px 600px at 100% 20%, var(--blob-2), transparent 70%),
    radial-gradient(900px 700px at 40% 110%, var(--blob-3), transparent 70%);
  background-attachment: fixed;
}

body {
  margin: 0;
  background: transparent;
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 1.125rem;
  line-height: 1.65;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1,
h2,
h3,
h4 {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  margin: 0;
  line-height: 1.1;
}

a {
  color: inherit;
}

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

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--accent-text);
  z-index: 20;
  border-radius: 6px;
}

.skip:focus {
  top: 12px;
}

/* 3D background behind the whole page */

.bg3d {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.bg3d canvas {
  display: block;
}

/* Top bar */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  letter-spacing: -0.02em;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}

.topbar nav {
  display: flex;
  gap: 22px;
  margin-left: auto;
}

.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 1rem;
}

.topbar nav a:hover {
  color: var(--text);
}

.nav-resume {
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

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

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

/* Hero */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
  gap: 24px;
  min-height: 100svh;
  max-width: 1360px;
  margin: 0 auto;
  padding: 96px clamp(16px, 4vw, 48px) 48px;
}

.hero-text {
  position: relative;
  z-index: 2;
}

.hero h1 {
  font-size: clamp(3rem, 6.2vw, 5.4rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.95;
  padding-bottom: 0.06em;
  background: linear-gradient(120deg, var(--text) 30%, var(--accent) 75%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  padding: 6px 14px;
  border: 1px solid color-mix(in srgb, var(--ok) 45%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--ok) 12%, transparent);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent);
  animation: status-pulse 2s ease-out infinite;
}

@keyframes status-pulse {
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

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

.role {
  margin: 20px 0 0;
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: clamp(1.15rem, 1.7vw, 1.4rem);
  font-weight: 500;
  color: var(--text);
}

.lede {
  max-width: 36ch;
  margin: 12px 0 0;
  font-size: clamp(1.1rem, 1.6vw, 1.3rem);
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  text-decoration: none;
  font-weight: 500;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

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

.btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-text);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 35%, transparent);
}

.btn-primary:hover {
  border-color: transparent;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 50%, transparent);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  max-width: 560px;
  margin: 36px 0 0;
}

.stats > div {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
}

.stats dt {
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stats dd {
  margin: 4px 0 0;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--muted);
}

/* 3D system */

.hero-stage {
  position: relative;
  margin: 0;
}

.stage {
  position: relative;
  height: min(70vh, 640px);
  min-height: 420px;
}

.stage canvas {
  display: block;
  cursor: grab;
}

.stage canvas:active {
  cursor: grabbing;
}

.stage .labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.node-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 220px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  text-align: center;
  transition: opacity 0.3s ease, padding 0.15s ease, border-color 0.15s ease;
}

.label-name {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.label-desc {
  display: none;
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.labels-faded .node-label:not(.is-active) {
  opacity: 0;
}

/* The part being hovered or tapped gets a full card with its description. */
.node-label.is-active {
  z-index: 5;
  padding: 8px 12px;
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.node-label.is-active .label-name {
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.node-label.is-active .label-desc {
  display: block;
}

.hero-stage figcaption {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: right;
}

.hero-stage figcaption p {
  margin: 0;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 8px var(--signal);
}

.swatch-event {
  background: var(--event);
  box-shadow: 0 0 8px var(--event);
}

.swatch-bug {
  background: linear-gradient(90deg, var(--bug) 50%, var(--ok) 50%);
  box-shadow: none;
}

.swatch-down {
  border-radius: 2px;
  background: color-mix(in srgb, var(--bug) 45%, transparent);
  outline: 1.5px solid var(--bug);
  box-shadow: none;
}

.hint-drag {
  display: none;
}

@media (pointer: fine) {
  .hint-drag {
    display: inline;
  }

  .hint-tap {
    display: none;
  }
}

/* Sections tilt up into place the first time they scroll into view. */

.js-reveal .block {
  opacity: 0;
  transform: perspective(1400px) rotateX(12deg) translateY(48px);
  transform-origin: 50% 0;
  transition: opacity 0.7s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.js-reveal .block.in-view {
  opacity: 1;
  transform: none;
}

/* Cards tilt toward the cursor; titles lift off the surface and a light follows the mouse. */

.projects,
.stats,
.skills,
.steps {
  perspective: 1100px;
}

.tilt {
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.25s ease-out, border-color 0.25s ease;
  will-change: transform;
}

.tilt > h3,
.tilt > h4,
.tilt > dt {
  transform: translateZ(26px);
}

.tilt > .tags,
.tilt > dd {
  transform: translateZ(14px);
}

.tilt::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.09), transparent 45%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tilt:hover::after {
  opacity: 1;
}

/* Content blocks */

.block {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  gap: 32px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 72px clamp(16px, 4vw, 48px);
  border-top: 1px solid var(--line);
  scroll-margin-top: 64px;
}

.block h2 {
  font-size: clamp(2rem, 3.4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.prose {
  max-width: 64ch;
}

.prose p,
p.prose {
  margin: 0 0 1em;
}

.sub {
  margin: 40px 0 20px;
  font-size: 1.4rem;
  font-weight: 500;
}

/* Experience and education timeline */

.timeline {
  list-style: none;
  max-width: 820px;
  margin: 0;
  padding: 0 0 0 28px;
  border-left: 2px solid var(--line);
}

.timeline li {
  position: relative;
  padding-bottom: 36px;
}

.timeline li:last-child {
  padding-bottom: 0;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -36px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 4px var(--bg);
}

.timeline .when {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.timeline h3 {
  margin-top: 4px;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.timeline .where {
  margin: 4px 0 0;
  font-weight: 600;
  color: var(--accent);
}

.timeline p:not(.when):not(.where) {
  max-width: 64ch;
  margin: 10px 0 0;
}

/* Project cards */

.projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.project {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease;
}

.project:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}

.project h3 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 16px;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 2px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
}

.project dl {
  margin: 0;
}

.project dt {
  margin-top: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.project dt:first-child {
  margin-top: 0;
}

.project dd {
  margin: 2px 0 0;
  font-size: 1rem;
  line-height: 1.55;
}

.project dt:last-of-type + dd {
  color: var(--ok);
  font-weight: 500;
}

/* Cards share a raised, softly lit surface. */
.steps li,
.skills > div {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow);
}

.steps {
  list-style: none;
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 820px;
  margin: 0 0 32px;
  padding: 0;
  perspective: 900px;
}

.steps li {
  --step-color: var(--c-edge);
  counter-increment: step;
  position: relative;
  padding: 20px 20px 20px 66px;
  transition: transform 0.25s ease-out, border-color 0.25s ease;
  will-change: transform;
}

.steps li:nth-child(2) { --step-color: var(--c-service); }
.steps li:nth-child(3) { --step-color: var(--c-data); }
.steps li:nth-child(4) { --step-color: var(--c-async); }

.steps li:hover {
  border-color: color-mix(in srgb, var(--step-color) 60%, var(--line));
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 20px;
  top: 18px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--step-color), color-mix(in srgb, var(--step-color) 55%, #000));
  color: #fff;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--step-color) 35%, transparent);
}

.steps h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.steps p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.text-link {
  color: var(--accent);
  font-weight: 600;
  text-underline-offset: 4px;
}

.skills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 980px;
  margin: 0;
}

.skills > div {
  --group-color: var(--c-edge);
  padding: 18px 20px;
  border-top: 3px solid var(--group-color);
}

.skills .group-frameworks { --group-color: var(--c-service); }
.skills .group-security { --group-color: var(--c-security); }
.skills .group-data { --group-color: var(--c-data); }
.skills .group-ai { --group-color: var(--c-ai); }
.skills .group-build { --group-color: var(--c-async); }
.skills .group-concepts { --group-color: var(--c-concepts); }

.skills dt {
  margin-bottom: 12px;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
}

.skills dd {
  margin: 0;
}

.skills ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.skills li {
  padding: 6px 12px;
  border: 1px solid color-mix(in srgb, var(--group-color) 45%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--group-color) 12%, transparent);
  font-size: 0.95rem;
}

.contact {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 820px;
}

.contact a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  transition: color 0.2s ease;
}

.contact a:hover {
  color: var(--accent);
}

.contact-note {
  margin: 20px 0 24px;
  color: var(--muted);
  font-size: 1rem;
}

.contact .handle {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.95rem;
  color: var(--muted);
  letter-spacing: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.footer {
  max-width: 1360px;
  margin: 0 auto;
  padding: 32px clamp(16px, 4vw, 48px) 48px;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer p {
  margin: 0;
}

/* Small screens */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 12px;
    min-height: 0;
    padding-top: 84px;
  }

  .stage {
    height: 62svh;
    min-height: 440px;
  }

  .hero-stage figcaption {
    align-items: flex-start;
    text-align: left;
  }

  .legend {
    justify-content: flex-start;
  }

  .node-label {
    max-width: 165px;
  }

  .label-name {
    font-size: 11px;
  }

  .node-label.is-active .label-name {
    font-size: 14px;
  }

  .label-desc {
    font-size: 12px;
  }

  .block {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 56px 16px;
  }

  .steps,
  .skills,
  .projects {
    grid-template-columns: minmax(0, 1fr);
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .topbar nav {
    display: none;
  }

  .nav-resume {
    margin-left: auto;
  }
}

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

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
