/* ================= Fonts (self-hosted, latin subset, OFL) ================= */
@font-face { font-family: "Sora"; src: url(/assets/fonts/sora.woff2) format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url(/assets/fonts/plex-400.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url(/assets/fonts/plex-500.woff2) format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url(/assets/fonts/plex-600.woff2) format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(/assets/fonts/jetbrains-mono.woff2) format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; }

/* ================= Tokens (light is the default) ================= */
:root[data-theme="dark"] {
  --bg: #0E1116;
  --surface: #161B22;
  --surface-2: #1C222B;
  --border: #262D36;
  --text: #E6EAF0;
  --muted: #8B95A3;
  --accent: #4FD1C5;
  --accent-soft: rgba(79, 209, 197, .12);
  --amber: #F6C177;
  --amber-soft: rgba(246, 193, 119, .12);
  --ok: #7EE787;
  --danger: #F47067;
  --nav-bg: rgba(22, 27, 34, .8);
  --dot: rgba(230, 234, 240, .06);
  --on-accent: #0E1116;
  color-scheme: dark;
}
:root,
:root[data-theme="light"] {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --surface-2: #F0F2F5;
  --border: #E2E5EA;
  --text: #12161C;
  --muted: #5B6472;
  --accent: #0F8A80;
  --accent-soft: rgba(15, 138, 128, .1);
  --amber: #B7791F;
  --amber-soft: rgba(183, 121, 31, .1);
  --ok: #1A7F37;
  --danger: #CF222E;
  --nav-bg: rgba(255, 255, 255, .8);
  --dot: rgba(18, 22, 28, .08);
  --on-accent: #FFFFFF;
  color-scheme: light;
}

:root {
  --f-head: "Sora", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --radius: 12px;
  --gutter: 24px;
  --section-gap: 120px;
  --nav-h: 64px;
}

/* ================= Base ================= */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 var(--f-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--f-head); margin: 0; line-height: 1.2; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { display: block; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--f-mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

.eyebrow { font: 500 14px/1 var(--f-mono); color: var(--accent); margin-bottom: 12px; }
.section { padding-top: var(--section-gap); }
.section__title { font-size: 32px; font-weight: 600; margin-bottom: 40px; letter-spacing: -.01em; }

/* ================= UI bits ================= */
/* Icons are <svg><use href="/assets/icons.svg#id"/></svg>; colour comes from currentColor */
.ui-icon, .si, .ic { display: inline-block; width: 18px; height: 18px; flex: none; vertical-align: middle; }
.ic { width: 20px; height: 20px; color: var(--text); }
.ic--sm { width: 16px; height: 16px; color: var(--muted); }
/* Brand colour on hover (--b is set per logo); swap to text colour where the brand would vanish */
[data-theme="dark"] [data-bd], [data-theme="light"] [data-bl] { --b: var(--text) !important; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 20px;
  border-radius: 10px; border: 1px solid transparent;
  font: 500 15px/1 var(--f-body);
  transition: border-color .15s, background-color .15s, color .15s, transform .15s;
  white-space: nowrap;
}
.btn--sm { height: 34px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn--sm .ui-icon { width: 16px; height: 16px; }
.btn--primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn--primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn--primary { position: relative; overflow: hidden; }
.btn--primary::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%);
  translate: -120% 0; transition: translate .6s ease;
}
.btn--primary:hover::after { translate: 120% 0; }
.btn--outline { border-color: var(--border); background: var(--surface); }
.btn--outline:hover { border-color: var(--accent); color: var(--accent); }
.link { color: var(--accent); font-weight: 500; padding: 0 4px; }
.link:hover { text-decoration: underline; text-underline-offset: 4px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 8px;
  background: none; border: 1px solid transparent;
}
.icon-btn:hover { border-color: var(--border); color: var(--accent); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.badge {
  display: inline-block;
  font: 500 11px/1 var(--f-mono); text-transform: uppercase; letter-spacing: .06em;
  padding: 5px 8px; border-radius: 6px;
}
.badge--amber { color: var(--amber); background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips li {
  font: 400 12px/1 var(--f-mono); color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 5px 8px; border-radius: 6px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .2s, transform .2s;
  position: relative;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
/* Cursor spotlight (position set by main.js on fine pointers) */
.card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), var(--accent-soft), transparent 65%);
  opacity: 0; transition: opacity .3s;
}
.card:hover::after { opacity: 1; }

/* ================= Nav ================= */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav__inner { height: 100%; display: flex; align-items: center; gap: 24px; }
.nav__logo { font: 700 20px/1 var(--f-head); color: var(--accent); letter-spacing: .02em; margin-right: auto; }
.nav__links { display: flex; gap: 28px; }
.nav__links a { position: relative; font-size: 15px; color: var(--muted); transition: color .15s; }
.nav__links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; border-radius: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .25s ease;
}
.nav__links a:hover::after, .nav__links a.active::after { transform: scaleX(1); }
.nav__links a:hover, .nav__links a.active { color: var(--accent); }
.nav__actions { display: flex; align-items: center; gap: 8px; }
.nav__burger { display: none; }
.i-moon { display: none; }
[data-theme="light"] .i-sun { display: none; }
[data-theme="light"] .i-moon { display: block; }

/* ================= Hero ================= */
.hero { position: relative; padding: 112px 0 40px; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-mask-image: linear-gradient(#000 55%, transparent);
  mask-image: linear-gradient(#000 55%, transparent);
}
.hero__grid { display: grid; grid-template-columns: 3fr 2fr; gap: 48px; align-items: center; }
.hero__name { font-size: 56px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 16px; }
.hero__headline { font: 600 28px/1.25 var(--f-head); color: var(--muted); margin-bottom: 20px; }
.hero__lead { font-size: 18px; max-width: 60ch; margin-bottom: 16px; }
.hero__proof { font-size: 13px; color: var(--muted); margin-bottom: 32px; }
.hero__cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 24px; }
.hero__loc { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }

/* ================= Terminal ================= */
.term {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 12px 40px -24px rgba(0, 0, 0, .5);
}
.term__bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot.r { background: #FF5F57; } .dot.a { background: #FEBC2E; } .dot.g { background: #28C840; }
.term__title { font: 400 12px/1 var(--f-mono); color: var(--muted); margin-left: 8px; }
.term__body {
  margin: 0; padding: 20px;
  font: 400 13.5px/1.75 var(--f-mono);
  color: var(--text); white-space: pre; overflow-x: auto;
  min-height: 200px;
}
.term__body .p { color: var(--accent); }
.term__body .ok { color: var(--ok); }
.term__body .c { color: var(--muted); }
.term__body .fn { color: var(--amber); }
.js .term__body .tl { visibility: hidden; }
.js .term__body .tl.on { visibility: visible; }
.term__body .tl.typing::after { content: "▋"; color: var(--accent); margin-left: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ================= About ================= */
.about { display: grid; grid-template-columns: 280px 1fr; gap: 48px; align-items: start; }
.about__photo {
  width: 280px; height: 280px; border-radius: var(--radius);
  border: 1px solid var(--accent); object-fit: cover;
  display: block; background: var(--surface);
}
.about picture { display: block; }
.about__photo--mono {
  display: grid; place-items: center;
  background: var(--surface); color: var(--accent);
  font: 700 84px/1 var(--f-head); letter-spacing: .02em;
}
.about__body > p:not(.small) { margin-bottom: 18px; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin: 32px 0 20px; padding-top: 24px; border-top: 1px solid var(--border); }
.facts dt { font: 400 12px/1 var(--f-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.facts dd { margin: 0; font: 600 18px/1.35 var(--f-head); }

/* ================= Experience ================= */
.role { padding: 28px 32px; margin-bottom: 32px; }
.role:hover { transform: none; }
.role__head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.role__logo {
  width: 48px; height: 48px; flex: none; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--border); background: var(--accent-soft);
  font: 700 16px/1 var(--f-head); color: var(--accent);
}
.role__who { flex: 1; }
.role__who h3 { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.role__who p { font-size: 15px; }
.role__date { font-size: 13px; white-space: nowrap; padding-top: 6px; }
.role__summary { max-width: 72ch; }

.timeline { position: relative; margin-left: 8px; padding-left: 32px; border-left: 2px solid transparent; }
.timeline::before {
  content: ""; position: absolute; left: -2px; top: 0; bottom: 0; width: 2px;
  background: var(--accent); transform-origin: top;
}
.timeline.rv-line::before { transform: scaleY(0); transition: transform 1.4s cubic-bezier(.2, .7, .2, 1) .1s; }
.timeline.rv-line.rv-in::before { transform: none; }
.tl-item { position: relative; padding-bottom: 32px; }
.tl-item:last-child { padding-bottom: 4px; }
.tl-item::before {
  content: ""; position: absolute; left: -39px; top: 7px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.tl-item__head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.tl-item__head h4 { font-size: 18px; font-weight: 600; }
.tl-item > p { color: var(--muted); max-width: 80ch; margin-bottom: 12px; }
.tl-item > p:last-child { margin-bottom: 0; }
.tl-toggle {
  margin-left: auto; width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
}
.tl-toggle:hover { border-color: var(--accent); color: var(--accent); }
.tl-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.tl-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.tl-more { margin: 0 0 14px; padding-left: 4px; }
.tl-more li { position: relative; padding-left: 18px; margin-bottom: 6px; color: var(--muted); font-size: 16px; }
.tl-more li::before { content: "▸"; position: absolute; left: 0; color: var(--accent); }

/* ================= Projects ================= */
.flagship { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; margin-bottom: 32px; }
.flagship__visual {
  display: flex; align-items: center; justify-content: center; padding: 24px;
  border-right: 1px solid var(--border);
  background: radial-gradient(var(--dot) 1px, transparent 1px) 0 0 / 20px 20px, var(--bg);
}
.flagship__body { padding: 32px; display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.flagship__title { display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 600; }
.flagship__title .ic { width: 26px; height: 26px; }
.flagship__body > p.muted { font-size: 16px; margin-top: -6px; }
.bullets li { position: relative; padding-left: 20px; margin-bottom: 8px; font-size: 15.5px; }
.bullets li::before { content: "▸"; position: absolute; left: 0; color: var(--accent); }
.flagship__links { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.copy-pill {
  display: inline-flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: 13px; color: var(--text);
}
.copy-pill:hover, .copy-pill.copied { border-color: var(--accent); color: var(--accent); }
.copy-pill .ui-icon { width: 15px; height: 15px; }

.diagram { flex: 1; width: 100%; height: auto; max-width: 600px; }
.diagram text { font: 500 14px var(--f-mono); fill: var(--text); text-anchor: middle; }
.diagram .d-sub { font-size: 11px; fill: var(--muted); }
.d-node rect { fill: var(--surface); stroke: var(--accent); stroke-width: 1.5; }
.d-node--out rect { fill: var(--accent-soft); stroke-width: 2; }
.d-edge path { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.d-head { fill: var(--accent); }
.d-head-r { fill: var(--danger); }
.d-repair { fill: none; stroke: var(--danger); stroke-width: 1.5; stroke-dasharray: 5 4; }
.d-group { fill: none; stroke: var(--border); stroke-dasharray: 4 4; }
.diagram .d-label { font-size: 13px; fill: var(--muted); text-anchor: start; }
.diagram .d-label--r { fill: var(--danger); text-anchor: middle; }

.term--cover { width: 100%; max-width: 440px; box-shadow: none; }
.term--cover .term__body { font-size: 12.5px; line-height: 1.65; min-height: 0; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; margin-bottom: 56px; }
.pcard { display: flex; flex-direction: column; overflow: hidden; }
.pcard__cover {
  position: relative; height: 140px;
  display: grid; place-items: center;
  border-bottom: 1px solid var(--border);
  background: radial-gradient(var(--dot) 1px, transparent 1px) 0 0 / 20px 20px, var(--surface);
}
.pcard__icon { position: absolute; top: 16px; left: 16px; width: 26px; height: 26px; }
.logos { display: flex; gap: 18px; color: var(--muted); }
.logos .si { width: 32px; height: 32px; opacity: .85; transition: color .2s, opacity .2s; }
.pcard:hover .logos .si { opacity: 1; }
.pcard__body { padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.pcard__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pcard__head h3 { font-size: 20px; font-weight: 600; }
.pcard__head span { white-space: nowrap; }
.pcard__desc {
  color: var(--muted); font-size: 15.5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pcard .chips { margin-top: auto; }
.pcard__foot {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 24px; border-top: 1px solid var(--border);
  font-size: 14px; color: var(--muted);
}
.pcard__foot:hover { color: var(--accent); }
.pcard__foot .ui-icon { width: 16px; height: 16px; }

.lab__label { margin-bottom: 16px; }
.lab { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.lab__card { padding: 20px 22px; border: 1px dashed var(--border); border-radius: var(--radius); }
.lab__top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.lab__card h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.lab__card p { font-size: 14px; color: var(--muted); line-height: 1.55; }

/* ================= Skills ================= */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.skill-group { padding: 22px; }
.skill-group:hover { transform: none; }
.skill-group--top { border-top: 2px solid var(--accent); }
.skill-group h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills li {
  display: inline-flex; align-items: center; gap: 7px;
  font: 400 13px/1 var(--f-mono);
  padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2);
  transition: border-color .15s;
}
.pills li .si { width: 16px; height: 16px; color: var(--muted); transition: color .15s; }
.pills li:hover { border-color: color-mix(in srgb, var(--b, var(--accent)) 60%, var(--border)); }
.pills li:hover .si, .logos .si:hover { color: var(--b, var(--accent)); }

/* ================= Education ================= */
.edu { display: grid; grid-template-columns: 2fr 3fr; gap: 32px; align-items: start; }
.edu__card { padding: 28px; display: flex; flex-direction: column; gap: 8px; }
.edu__card:hover { transform: none; }
.edu__card h3 { font: 600 20px/1.35 var(--f-head); }
.edu__card h3 .ic { margin: -3px 6px 0 0; }
.edu__card .chips { margin-top: 8px; }
.cgpa { margin: 12px 0 4px; display: flex; align-items: baseline; gap: 6px; }
.cgpa strong { font: 700 32px/1 var(--f-head); color: var(--accent); font-variant-numeric: tabular-nums; }
.cgpa span { font: 600 15px/1 var(--f-head); color: var(--muted); }

.certs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.cert {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  transition: border-color .2s;
}
.cert:hover { border-color: var(--accent); }
.cert > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.cert strong { font-size: 14.5px; font-weight: 600; line-height: 1.35; }
.cert span:not(.si):not(.cert__logo) { font: 400 12px/1.3 var(--f-mono); color: var(--muted); }
.cert__logo { width: 24px; height: 24px; flex: none; display: grid; place-items: center; color: var(--muted); }
.cert__logo .si { width: 24px; height: 24px; }
.cert:hover .cert__logo .si { color: var(--b, var(--accent)); }
.cert__logo--text {
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border);
  font: 600 9px/1 var(--f-mono); color: var(--muted);
}
.cert__verify { font-size: 13px; color: var(--accent); white-space: nowrap; }
.langs { margin-top: 18px; }

/* ================= Contact & footer ================= */
.contact {
  max-width: 640px; margin: 0 auto; padding: 48px 40px; text-align: center;
  background: var(--surface); border: 1px solid var(--accent); border-radius: 16px;
}
.contact__lead { font-size: 18px; margin-bottom: 24px; }
.contact__email { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; margin-bottom: 28px; }
.contact__email a { font-size: 20px; word-break: break-all; }
.contact__email a:hover { color: var(--accent); }
.contact__email .btn.copied { border-color: var(--accent); color: var(--accent); }
.contact__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

.footer { margin-top: var(--section-gap); border-top: 1px solid var(--border); padding: 24px 0; }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; font-size: 13px; color: var(--muted); }
.footer a:hover { color: var(--accent); }


/* ================= Resume preview ================= */
.resume {
  width: min(960px, calc(100% - 32px)); height: min(92vh, 1240px);
  max-width: none; max-height: none; padding: 0; overflow: hidden;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 24px 64px -24px rgba(0, 0, 0, .45);
}
.resume[open] { display: flex; flex-direction: column; }
.resume::backdrop { background: rgba(14, 17, 22, .55); }
.resume__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px 10px 20px; border-bottom: 1px solid var(--border);
}
.resume__title { font-size: 16px; font-weight: 600; }
.resume__actions { display: flex; align-items: center; gap: 8px; }
.resume__body { position: relative; flex: 1; background: #E9ECF0; }
.resume__frame { display: block; width: 100%; height: 100%; border: 0; opacity: 0; transition: opacity .2s; }
.resume__frame.ready { opacity: 1; }
.resume__loading { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: #5B6472; }
.resume__frame.ready + .resume__loading, .resume__loading[hidden] { display: none; }
html.modal-open { overflow: hidden; }

/* ================= Motion =================
   Only opacity/transform animate (compositor-friendly). Everything is off under reduced motion. */
@keyframes rise { from { opacity: 0; translate: 0 18px; } to { opacity: 1; translate: 0 0; } }
@keyframes drift { to { translate: 4% -5%; scale: 1.08; } }
@keyframes float { 50% { translate: 0 -6px; } }
@keyframes grow { to { transform: scaleX(1); } }

.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .4s ease-out, transform .4s ease-out; }
.js .reveal.in { opacity: 1; transform: none; }

/* Items inside sections rise one after another (classes added by main.js) */
.rv { opacity: 0; }
.rv.rv-in { animation: rise .55s cubic-bezier(.2, .7, .2, 1) var(--d, 0ms) both; }

/* Hero: staggered entrance, drifting glow, floating terminal */
.js .hero__text > * { animation: rise .6s cubic-bezier(.2, .7, .2, 1) both; }
.js .hero__text > :nth-child(2) { animation-delay: .06s; }
.js .hero__text > :nth-child(3) { animation-delay: .12s; }
.js .hero__text > :nth-child(4) { animation-delay: .18s; }
.js .hero__text > :nth-child(5) { animation-delay: .24s; }
.js .hero__text > :nth-child(6) { animation-delay: .30s; }
.js .hero__text > :nth-child(7) { animation-delay: .36s; }
.js .hero__visual { animation: rise .7s cubic-bezier(.2, .7, .2, 1) .2s both; }
.hero__visual .term { animation: float 7s ease-in-out 1.2s infinite; }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38% 48% at 78% 38%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(32% 42% at 12% 72%, color-mix(in srgb, var(--amber) 12%, transparent), transparent 70%);
  animation: drift 16s ease-in-out infinite alternate;
}

/* Diagram packets */
.d-pkt { fill: var(--accent); }
.d-pkt--r { fill: var(--danger); }

/* Scroll progress bar (CSS scroll-driven; browsers without support simply don't show it) */
.progress { display: none; }
@supports (animation-timeline: scroll()) {
  .progress {
    display: block; position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60;
    background: var(--accent); transform: scaleX(0); transform-origin: 0 50%;
    animation: grow linear both; animation-timeline: scroll(root);
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .js .hero__text > *, .js .hero__visual, .hero__visual .term, .hero::after { animation: none; }
  .d-pkts { display: none; }
  .btn--primary::after { display: none; }
  .card, .btn, .card:hover, .btn--primary:hover { transition: none; transform: none; }
  .term__body .tl.typing::after { animation: none; }
}

/* ================= Responsive ================= */
@media (max-width: 960px) {
  .skills { grid-template-columns: repeat(2, 1fr); }
  .flagship { grid-template-columns: 1fr; }
  .flagship__visual { border-right: 0; border-bottom: 1px solid var(--border); }
  .edu { grid-template-columns: 1fr; }
  .lab { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .nav__links {
    display: none;
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 8px 16px 16px;
  }
  .nav__links.open { display: flex; }
  .nav__links a { padding: 12px 4px; font-size: 16px; border-bottom: 1px solid var(--border); }
  .nav__links a:last-child { border-bottom: 0; }
  .nav__links a::after { display: none; }
  .nav__burger { display: inline-grid; }

  .hero__grid { grid-template-columns: 1fr; }
  .hero__visual { width: 80%; }
  .about { grid-template-columns: 1fr; gap: 28px; }
  .about__photo { width: 160px; height: 160px; }
  .about__photo--mono { font-size: 48px; }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; --section-gap: 72px; }
  body { font-size: 16px; }
  .section__title { font-size: 24px; margin-bottom: 28px; }
  .hero { padding-top: 64px; }
  .hero__name { font-size: 36px; }
  .hero__headline { font-size: 21px; }
  .hero__lead { font-size: 17px; }
  .hero__visual { width: 100%; }
  .term__body { font-size: 12px; padding: 16px; min-height: 0; }
  .nav__resume { display: none; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .role { padding: 22px 20px; }
  .role__head { flex-wrap: wrap; }
  .role__date { width: 100%; padding: 0 0 0 64px; margin-top: -8px; }
  .role__who h3 { font-size: 19px; }
  .timeline { padding-left: 22px; }
  .tl-item::before { left: -29px; }
  .flagship__visual, .flagship__body { padding: 22px 20px; }
  .flagship__title { font-size: 22px; }
  .term--cover .term__body { font-size: 11px; }
  .grid { grid-template-columns: 1fr; }
  .skills { grid-template-columns: 1fr; }
  .contact { padding: 32px 20px; }
  .contact__email a { font-size: 16px; }
}

@media (max-width: 640px) {
  .resume { width: 100%; height: 100%; height: 100dvh; border: 0; border-radius: 0; }
  .resume__bar { padding: 8px 8px 8px 16px; }
  .resume__actions { gap: 6px; }
  .resume__actions .btn span { display: none; }
  .resume__actions .btn { padding: 0 10px; }
}

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