:root {
  --navy: #17365d;
  --teal: #1890a8;
  --ink: #1c2430;
  --muted: #566173;
  --line: #e2e7ee;
  --bg: #ffffff;
  --bg-alt: #f5f8fb;
  --card: #ffffff;
  --radius: 10px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --navy: #9cc3ef;
    --teal: #4cc3da;
    --ink: #e6ebf2;
    --muted: #a3aebd;
    --line: #2a3443;
    --bg: #0f1620;
    --bg-alt: #141d29;
    --card: #182230;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }

body {
  margin: 0;
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal); }
a:hover { text-decoration-thickness: 2px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 1.5rem; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--bg); padding: .5rem 1rem; z-index: 10; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 3.75rem; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.nav nav a { margin-left: 1.25rem; color: var(--muted); text-decoration: none; font-size: .95rem; }
.nav nav a:hover { color: var(--teal); }

/* Sections */
section { padding: 4.5rem 0; }
section.alt { background: var(--bg-alt); }
h1, h2, h3 { line-height: 1.25; color: var(--ink); }
h2 { font-size: 1.75rem; margin: 0 0 .5rem; }
h2.sub { font-size: 1.25rem; margin-top: 2.5rem; }
h3 { font-size: 1.1rem; margin: 0 0 .5rem; }
.section-lede { color: var(--muted); margin: 0 0 2rem; max-width: 46rem; }

/* Hero */
.hero { padding: 6rem 0 4rem; }
.eyebrow { color: var(--teal); font-weight: 600; letter-spacing: .02em; margin: 0 0 1rem; }
.hero h1 { font-size: clamp(2rem, 4.2vw, 3rem); max-width: 50rem; margin: 0 0 1.25rem; color: var(--navy); }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 46rem; margin: 0 0 2rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: -0.75rem 0 2rem; padding: 0; }
.chips span {
  font-size: .85rem; font-weight: 600; color: var(--navy);
  border: 1px solid var(--line); background: var(--bg-alt);
  border-radius: 999px; padding: .3rem .8rem;
}
.btn {
  display: inline-block; padding: .65rem 1.25rem; margin-right: .5rem;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink); text-decoration: none; font-weight: 600;
}
.btn.primary { background: var(--navy); border-color: var(--navy); color: var(--bg); }
.btn:hover { border-color: var(--teal); }

/* Grids */
.grid { display: grid; gap: 1.25rem; }
.stats { padding: 0 0 4rem; }
.stats-grid { grid-template-columns: repeat(3, 1fr); gap: 1.75rem 1.5rem; }
@media (max-width: 720px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
.stat {
  border-top: 3px solid var(--teal); padding-top: .75rem;
}
.stat strong { display: block; font-size: 1.5rem; color: var(--navy); }
.stat span { display: block; font-size: .9rem; color: var(--muted); line-height: 1.45; }

.cases { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.case, .project {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem;
}
.case dl { margin: 0; }
.case dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--teal); font-weight: 700; margin-top: 1rem; }
.case dd { margin: .25rem 0 0; color: var(--muted); font-size: .95rem; }

.projects { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.project { display: block; color: inherit; text-decoration: none; transition: border-color .15s; }
.project:hover { border-color: var(--teal); }
.project h3 { color: var(--teal); }
.project p { color: var(--muted); margin: 0 0 .75rem; font-size: .95rem; }
.project .tags { font-size: .85rem; color: var(--navy); margin: 0; }

/* Experience */
.role { padding: 1.5rem 0; border-bottom: 1px solid var(--line); }
.role:last-child { border-bottom: 0; }
.role-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .25rem 1rem; }
.role-head h3 { margin: 0; }
.role-head h3 span { color: var(--teal); }
.when { margin: 0; color: var(--muted); font-size: .9rem; }
.role ul { margin: .75rem 0 0; padding-left: 1.2rem; color: var(--muted); }
.role li { margin: .35rem 0; }

/* Skills */
.skills { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.skills h3 { font-size: .95rem; color: var(--navy); }
.skills p { margin: 0; color: var(--muted); font-size: .95rem; }
.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.plain { list-style: none; padding: 0; margin: 0; color: var(--muted); }
.plain li { padding: .3rem 0; }
.certs { margin: 0; }
.certs dt { font-weight: 700; color: var(--navy); font-size: .9rem; margin-top: .75rem; }
.certs dd { margin: .15rem 0 0; color: var(--muted); font-size: .95rem; }
.nw { white-space: nowrap; }
.cert-badges { display: flex; flex-wrap: wrap; gap: .6rem; margin: .25rem 0 .75rem; }
.cert-badges a { display: flex; flex-direction: column; align-items: center; width: 84px; text-decoration: none; }
.cert-badges img { width: 72px; height: 72px; object-fit: contain; }
.cert-badges span { margin-top: .3rem; font-size: .72rem; line-height: 1.2; color: var(--muted); text-align: center; }
.cert-badges a:hover span { color: var(--teal); }
.cert-note { margin: -.25rem 0 .5rem; color: var(--teal); font-weight: 600; font-size: .95rem; }

.contact p { font-size: 1.1rem; color: var(--muted); max-width: 40rem; }

.site-footer { border-top: 1px solid var(--line); padding: 2rem 0; color: var(--muted); font-size: .9rem; }

@media (max-width: 640px) {
  .nav nav a { margin-left: .75rem; font-size: .85rem; }
  .nav nav a:nth-child(2) { display: none; }
  section { padding: 3.5rem 0; }
  .hero { padding: 4rem 0 3rem; }
}

/* Platform map (D3) */
.map-wrap { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; }
#platform-map {
  width: 100%; height: 540px; display: block;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.map-links line { stroke: var(--line); stroke-width: 1.2; transition: opacity .25s; }
.map-links line.on { stroke: var(--teal); stroke-width: 2; stroke-dasharray: 5 5; animation: map-dash 1s linear infinite; }
.map-links line.dim { opacity: .35; }
@keyframes map-dash { to { stroke-dashoffset: -10; } }
.map-node { cursor: grab; transition: opacity .25s; }
.map-node.hub { cursor: pointer; }
.map-node .dot { fill: var(--card); stroke: var(--muted); stroke-width: 1.5; }
.map-node.hub .dot { fill: var(--teal); stroke: var(--card); stroke-width: 3; }
.map-node .halo { fill: var(--teal); opacity: 0; }
.map-node.hub.active .halo { opacity: .18; animation: map-pulse 1.8s ease-in-out infinite; }
@keyframes map-pulse { 50% { opacity: .05; } }
.map-node text { font-size: 12px; fill: var(--muted); paint-order: stroke; stroke: var(--card); stroke-width: 3px; }
.map-node.hub text { font-size: 14px; font-weight: 700; fill: var(--ink); }
.map-node.active text { fill: var(--teal); }
.map-node.dim { opacity: .22; }
.map-node:focus { outline: none; }
.map-node:focus-visible .dot { stroke: var(--ink); stroke-width: 3; }
#map-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; align-self: stretch;
}
#map-panel h3 { font-size: 1.35rem; color: var(--navy); margin: 0 0 .75rem; }
.map-kicker { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--teal); font-weight: 700; margin: 1rem 0 .35rem; }
.map-kicker:first-child { margin-top: 0; }
.map-result { font-size: 1.05rem; color: var(--ink); margin: 0; }
.map-tools { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; }
.map-tools span { font-size: .8rem; border: 1px solid var(--line); background: var(--bg-alt); border-radius: 999px; padding: .15rem .6rem; color: var(--muted); }
.map-projects { margin: 0; }
.map-hint { color: var(--muted); margin: 0; }
#platform-map.compact .map-node.tool text { opacity: 0; transition: opacity .25s; }
#platform-map.compact .map-node.tool:not(.dim) text { opacity: 1; }
@media (max-width: 820px) {
  .map-wrap { grid-template-columns: 1fr; }
  #platform-map { height: 460px; }
}
@media (prefers-reduced-motion: reduce) {
  .map-links line.on, .map-node.hub.active .halo { animation: none; }
}
