/* ---------- Fonts (self-hosted Inter subset, OFL) ---------- */
@font-face { font-family: "Inter"; src: url("/fonts/Inter-Regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/Inter-Medium.woff") format("woff"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter Display"; src: url("/fonts/InterDisplay-SemiBold.woff") format("woff"); font-weight: 600; font-style: normal; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  --bg: #0a0f1a;          /* midnight */
  --surface: #0f1626;     /* panel */
  --surface-2: #131c2f;
  --line: #1d283d;
  --line-strong: #2b3a57;
  --text: #e7ecf4;
  --muted: #9aa6bd;
  --faint: #5f6b84;
  --signal: #f0b44c;      /* amber: in-flight, incoming */
  --signal-soft: rgba(240, 180, 76, 0.12);
  --flow: #7ea6e0;        /* steel blue: edges, links */
  --ok: #6fcf97;
  --ok-soft: rgba(111, 207, 151, 0.12);

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Inter Display", "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --wrap: 1120px;
  --gutter: clamp(20px, 5vw, 40px);
  --radius-lg: 16px;
  --radius: 10px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body::before { /* single quiet top light, no glows elsewhere */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 720px; pointer-events: none; z-index: 0;
  background: radial-gradient(60% 70% at 70% 0%, rgba(126, 166, 224, 0.09), transparent 70%);
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3, h4, dl, dd, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
::selection { background: rgba(240, 180, 76, 0.3); color: #fff; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 6px; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); position: relative; z-index: 1; }

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--signal); color: #111; padding: 8px 14px; border-radius: 8px; font-weight: 500;
}
.skip:focus { top: 12px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 15, 26, 0.72);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.mark { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; letter-spacing: -0.01em; }
.mark-bg { fill: var(--surface-2); stroke: var(--line-strong); }
.mark-node { fill: var(--flow); }
.mark-node--hot { fill: var(--signal); }
.mark-edge { stroke: var(--flow); stroke-width: 1.4; opacity: .55; fill: none; }
.nav { display: flex; gap: clamp(14px, 3vw, 28px); font-size: .9375rem; }
.nav a { color: var(--muted); padding: 6px 0; transition: color .15s ease; }
.nav a:hover, .nav a[aria-current="true"] { color: var(--text); }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(56px, 10vw, 112px) clamp(56px, 8vw, 96px); position: relative; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 64px); align-items: center; }
.hero h1 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2.75rem, 7vw, 4.75rem); line-height: 1; letter-spacing: -0.035em;
}
.hero-role {
  margin-top: 20px; font-size: clamp(1.25rem, 2.4vw, 1.5rem); line-height: 1.35; letter-spacing: -0.015em;
  color: var(--text); max-width: 30ch; font-weight: 500;
}
.hero-intro { margin-top: 18px; color: var(--muted); font-size: 1.0625rem; max-width: 56ch; }

.status { margin-top: 32px; border-top: 1px solid var(--line); max-width: 520px; }
.status-row { display: grid; grid-template-columns: 104px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.status dt { color: var(--muted); font-size: .875rem; display: inline-flex; align-items: center; gap: 9px; }
.status dd { display: flex; flex-wrap: wrap; column-gap: 12px; row-gap: 2px; align-items: baseline; }
.status strong { font-weight: 500; }
.status dd .logo--sm { align-self: center; margin-right: -2px; }
.status-detail { color: var(--muted); font-size: .9375rem; }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; display: inline-block; }
.dot--incoming { background: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
.dot--now { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

.hero-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.btn {
  display: inline-flex; align-items: center; gap: 9px; height: 42px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface);
  font-size: .9375rem; font-weight: 500; color: var(--text);
  transition: border-color .15s ease, background-color .15s ease;
}
.btn:hover { border-color: #3d5078; background: var(--surface-2); }
.btn--primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn--primary:hover { background: #fff; border-color: #fff; }
.icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Hero graph */
.hero-graph { position: relative; aspect-ratio: 390 / 260; width: 100%; max-width: 480px; justify-self: end; }
.hero-graph::before { /* faint engineering grid behind the graph only */
  content: ""; position: absolute; inset: 4% 2%;
  background-image: radial-gradient(circle, rgba(154, 166, 189, 0.16) 1px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent);
          mask-image: radial-gradient(closest-side, #000 55%, transparent);
}
#flow { position: relative; width: 100%; height: 100%; overflow: visible; }
#flow .edges path { fill: none; stroke: var(--line-strong); stroke-width: 1.5; }
#flow .edge-retry { fill: none; stroke: var(--signal); stroke-width: 1.2; stroke-dasharray: 3 5; opacity: .35; }
#flow .nodes circle { fill: var(--bg); stroke: var(--flow); stroke-width: 1.6; transition: fill .3s ease, stroke .3s ease; }
#flow .nodes circle.is-ack { fill: var(--ok); stroke: var(--ok); }
#flow .sink { fill: var(--surface-2); stroke: var(--flow); stroke-width: 1.6; }
#flow .sink-lines { stroke: var(--flow); stroke-width: 1.6; stroke-linecap: round; opacity: .7; }
#flow .packet { fill: var(--signal); }
#flow .packet--retry { fill: none; stroke: var(--signal); stroke-width: 1.5; }

/* One orchestrated load sequence */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(8px); animation: rise .7s cubic-bezier(.2,.7,.2,1) forwards; animation-delay: calc(var(--d, 0) * 90ms + 60ms); }
  #flow .edges path, #flow .edge-retry { stroke-dasharray: 260; stroke-dashoffset: 260; animation: draw 1.1s cubic-bezier(.4,0,.2,1) forwards .35s; }
  #flow .edge-retry { animation-name: draw-dashed; }
  #flow .nodes { opacity: 0; animation: fade .6s ease forwards .25s; }
}
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes fade { to { opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes draw-dashed { 0% { stroke-dasharray: 260; stroke-dashoffset: 260; } 99% { stroke-dasharray: 260; stroke-dashoffset: 0; } 100% { stroke-dasharray: 3 5; stroke-dashoffset: 0; } }

/* ---------- Sections ---------- */
.section { padding-block: clamp(64px, 9vw, 112px); border-top: 1px solid var(--line); }
.section-title {
  font-family: var(--display); font-weight: 600; font-size: clamp(1.75rem, 3.4vw, 2.25rem);
  letter-spacing: -0.025em; line-height: 1.15;
}
.section-note { margin-top: 12px; color: var(--muted); max-width: 62ch; }

/* ---------- Experience ---------- */
.timeline { margin-top: clamp(32px, 5vw, 48px); display: grid; gap: clamp(40px, 6vw, 64px); }
.role { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: clamp(20px, 4vw, 48px); }
.role-meta { padding-top: 6px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.dates { color: var(--muted); font-size: .9375rem; font-variant-numeric: tabular-nums; }
.dates--prior { color: var(--faint); color: #7c88a0; }
.badge {
  display: inline-flex; align-items: center; gap: 8px; height: 26px; padding: 0 11px;
  border-radius: 999px; font-size: .8125rem; font-weight: 500; border: 1px solid var(--line-strong); color: var(--muted);
}
.badge--incoming { color: var(--signal); border-color: rgba(240, 180, 76, 0.35); background: var(--signal-soft); }
.badge--now { color: var(--ok); border-color: rgba(111, 207, 151, 0.3); background: var(--ok-soft); }

/* LinkedIn-style square company tile. Monogram until a logo image is added. */
.logo {
  flex: none; display: inline-grid; place-items: center; overflow: hidden;
  width: 48px; height: 48px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  font-family: var(--display); font-weight: 600; font-size: 1.25rem; color: var(--text);
}
.logo img { width: 100%; height: 100%; object-fit: cover; }
.logo:has(img) { border-color: rgba(255, 255, 255, 0.08); background: none; }
.logo--sm { width: 24px; height: 24px; border-radius: 6px; font-size: .75rem; }
.role-head { display: flex; align-items: flex-start; gap: 16px; }
.featured-card .logo { width: 56px; height: 56px; border-radius: 12px; font-size: 1.5rem; }
.role-head h3 { font-family: var(--display); font-weight: 600; font-size: 1.625rem; letter-spacing: -0.02em; line-height: 1.2; }
.role-title { margin-top: 4px; font-weight: 500; }
.role-team { color: var(--muted); font-size: .9375rem; }

.featured-card {
  position: relative; padding: clamp(24px, 4vw, 40px);
  border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface-2), var(--surface) 60%);
  overflow: hidden;
}
.featured-card::before { /* amber hairline: the only accent on the card */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--signal) 20%, var(--signal) 50%, transparent 85%); opacity: .7;
}
.featured-card /* LinkedIn-style square company tile. Monogram until a logo image is added. */
.logo {
  flex: none; display: inline-grid; place-items: center; overflow: hidden;
  width: 48px; height: 48px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  font-family: var(--display); font-weight: 600; font-size: 1.25rem; color: var(--text);
}
.logo img { width: 100%; height: 100%; object-fit: cover; }
.logo:has(img) { border-color: rgba(255, 255, 255, 0.08); background: none; }
.logo--sm { width: 24px; height: 24px; border-radius: 6px; font-size: .75rem; }
.role-head { display: flex; align-items: flex-start; gap: 16px; }
.featured-card .logo { width: 56px; height: 56px; border-radius: 12px; font-size: 1.5rem; }
.role-head h3 { font-size: clamp(1.75rem, 3vw, 2.125rem); }
.role-summary { margin-top: 18px; font-size: 1.0625rem; color: #c9d1df; max-width: 66ch; }
.sub { margin-top: 28px; font-size: .9375rem; font-weight: 500; color: var(--text); }
.focus-list { margin-top: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.focus-list li { position: relative; padding: 11px 0 11px 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9375rem; }
.focus-list li::before { content: ""; position: absolute; left: 2px; top: 20px; width: 8px; height: 1.5px; background: var(--signal); }

.tech { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 6px 18px; font-family: var(--mono); font-size: .8125rem; color: var(--flow); }

.highlights { margin-top: 28px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.highlight { background: var(--bg); padding: 22px 22px 24px; }
.highlight--wide { grid-column: 1 / -1; background: var(--surface); }
.highlight h4 { font-size: 1rem; font-weight: 500; letter-spacing: -0.005em; }
.highlight--wide h4 { font-family: var(--display); font-weight: 600; font-size: 1.1875rem; letter-spacing: -0.015em; }
.highlight p { margin-top: 8px; color: var(--muted); max-width: 72ch; }
.highlight ul { margin-top: 10px; display: grid; gap: 8px; }
.highlight li { color: var(--muted); font-size: .9375rem; line-height: 1.5; padding-left: 14px; position: relative; }
.highlight li::before { content: ""; position: absolute; left: 0; top: .72em; width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong); }

.text-link { display: inline-block; margin-top: 14px; color: var(--flow); font-weight: 500; font-size: .9375rem; border-bottom: 1px solid rgba(126, 166, 224, 0.35); padding-bottom: 1px; transition: border-color .15s ease, color .15s ease; }
.text-link:hover { color: #a9c4ec; border-color: #a9c4ec; }

.bullets { margin-top: 18px; display: grid; gap: 10px; max-width: 72ch; }
.bullets li { position: relative; padding-left: 18px; color: var(--muted); }
.bullets li::before { content: ""; position: absolute; left: 0; top: .78em; width: 8px; height: 1.5px; background: var(--line-strong); }
.metric { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---------- Case studies ---------- */
.case { margin-top: clamp(36px, 5vw, 56px); padding: clamp(24px, 4vw, 40px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.case + .case { margin-top: 24px; }
.case-head h3 { font-family: var(--display); font-weight: 600; font-size: clamp(1.375rem, 2.6vw, 1.75rem); letter-spacing: -0.02em; line-height: 1.2; }
.case-sub { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .9375rem; color: var(--muted); }
.case-sub span + span { font-family: var(--mono); font-size: .8125rem; color: var(--flow); }

.diagram { margin-top: 28px; padding: clamp(16px, 3vw, 28px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); overflow-x: auto; }
.diagram svg { width: 100%; height: auto; }
.diagram .diagram-v { display: none; max-width: 320px; margin-inline: auto; }
.diagram figcaption { margin-top: 16px; font-size: .875rem; color: var(--muted); }
.dg-box rect { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.2; }
.dg-box--hot rect { fill: var(--surface-2); stroke: var(--signal); }
.dg-box--ok rect { stroke: var(--ok); }
.dg-box--warn rect { stroke: var(--signal); stroke-dasharray: 4 4; }
.dg-box text, .dg-small { fill: var(--text); font-family: var(--sans); font-size: 15px; text-anchor: middle; dominant-baseline: middle; }
.dg-strong { font-weight: 500; font-size: 16px !important; }
.dg-small { fill: var(--muted) !important; font-size: 13px !important; }
.dg-edge { stroke: var(--flow); stroke-width: 1.5; fill: none; }
.dg-edge--warn { stroke: var(--signal); stroke-dasharray: 4 4; }
.arrowhead { fill: var(--flow); }

.psi { margin-top: 28px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 3vw, 36px); }
.psi dt { font-weight: 500; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--line-strong); }
.psi div:last-child dt { border-bottom-color: var(--signal); }
.psi dd { color: var(--muted); font-size: .9375rem; }
.bullets--cols { margin-top: 24px; max-width: none; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 32px; }
.bullets--cols li { font-size: .9375rem; }

/* ---------- Skills ---------- */
.skills { margin-top: clamp(28px, 4vw, 44px); display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.skills-heading { font-size: 1rem; font-weight: 500; color: var(--text); padding-bottom: 12px; }
.skill-rows > div { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.skill-rows > div:last-child { border-bottom: 1px solid var(--line); }
.skill-rows dt { color: var(--muted); font-size: .9375rem; }
.skill-rows ul { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.skill-rows li { font-size: .9375rem; }
.skills-group--learning { padding: 24px; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); }
.skills-group--learning .skills-heading { padding-bottom: 4px; }
.skills-note { color: var(--muted); font-size: .875rem; }
.interest-list { margin-top: 16px; display: grid; gap: 10px; }
.interest-list li { display: flex; align-items: center; gap: 12px; font-size: .9375rem; }
.interest-list li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--signal); flex: none; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); align-items: start; }
.about-text { margin-top: 20px; font-size: clamp(1.0625rem, 1.6vw, 1.1875rem); line-height: 1.65; color: #c9d1df; max-width: 60ch; }
.about-text + .about-text { margin-top: 14px; color: var(--muted); }
.edu { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); margin-top: 6px; }
.edu-title { font-size: .875rem; font-weight: 500; color: var(--muted); }
.edu-school { margin-top: 10px; font-family: var(--display); font-weight: 600; font-size: 1.25rem; letter-spacing: -0.015em; }
.edu-degree { margin-top: 4px; color: var(--muted); font-size: .9375rem; }
.edu-facts { margin-top: 16px; display: grid; gap: 0; }
.edu-facts div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); font-size: .9375rem; }
.edu-facts dt { color: var(--muted); }
.edu-facts dd { font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: clamp(56px, 8vw, 88px) 40px; }
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 20px 32px; align-items: start; }
.footer-inner .section-title { font-size: clamp(1.5rem, 3vw, 1.875rem); }
.footer-line { margin-top: 10px; color: var(--muted); }
.footer-links { display: flex; gap: 24px; align-self: end; }
.footer-mail { color: var(--text); border-bottom: 1px solid var(--line-strong); transition: border-color .15s ease; }
.footer-mail:hover { border-color: var(--text); }
.footer-links a { color: var(--muted); font-size: .9375rem; border-bottom: 1px solid transparent; transition: color .15s ease, border-color .15s ease; }
.footer-links a:hover { color: var(--text); border-color: var(--line-strong); }
.copyright { grid-column: 1 / -1; font-size: .8125rem; color: #7c88a0; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .highlights { grid-template-columns: 1fr 1fr; }
  .highlights .highlight:last-child { grid-column: 1 / -1; }
  .bullets--cols { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-graph { justify-self: center; max-width: 440px; margin-top: 8px; }
  .role { grid-template-columns: 1fr; gap: 14px; }
  .role-meta { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding-top: 0; }
  .skills, .about-grid { grid-template-columns: 1fr; }
  .psi { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 600px) {
  .mark span { display: none; }
  .nav { gap: 18px; font-size: .875rem; }
  .status-row { grid-template-columns: 84px 1fr; }
  .focus-list { grid-template-columns: 1fr; }
  .highlights { grid-template-columns: 1fr; }
  .skill-rows > div { grid-template-columns: 1fr; gap: 6px; }
  .footer-inner { grid-template-columns: 1fr; }
  .hero-graph { max-width: 340px; }
  .hero { padding-bottom: 40px; }
  .diagram > svg:first-child { display: none; }
  .diagram .diagram-v { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation: none !important; }
}

/* Resume-aligned additions */
.highlights--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.highlights--2 .highlight:last-child { grid-column: auto; }
.text-link--inline { margin-top: 0; font-size: inherit; }
.dg-box--fail rect { stroke: #e07a7a; stroke-dasharray: 4 4; }
.case-head--row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 16px; }
.case-text { margin-top: 16px; color: var(--muted); max-width: 72ch; }
@media (max-width: 600px) { .highlights--2 { grid-template-columns: 1fr; } }
