/* =========================================================
   TOKENS
========================================================= */
:root {
  --bg: #090b14;
  --bg-elevated: #0e1120;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #e9ebf5;
  --text-muted: #9aa1c2;
  --text-faint: #5c6488;

  --violet: #7c5cff;
  --cyan: #22d3ee;
  --amber: #ffb84d;

  --gradient: linear-gradient(135deg, var(--violet) 0%, var(--cyan) 100%);

  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  --container: 1180px;
  --radius: 14px;
  --radius-sm: 8px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Faint, static film grain — cinematic texture, no runtime cost */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Cursor spotlight — added by JS only on fine-pointer devices */
#cursor-spotlight {
  position: fixed;
  inset: 0;
  z-index: 9997;
  pointer-events: none;
  background: radial-gradient(600px circle at var(--x, 50%) var(--y, 50%), rgba(124, 92, 255, 0.07), transparent 70%);
  mix-blend-mode: screen;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.15; }

.mono { font-family: var(--font-mono); }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  color: var(--cyan);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.file-label {
  color: var(--text-faint);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.section__title {
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  font-weight: 600;
  margin-bottom: 40px;
}

/* faint background grid for texture */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 40%, transparent 100%);
}

/* slow-drifting ambient glow, sitewide — very low opacity, purely atmospheric */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}
.bg-blobs span {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.16;
}
.bg-blobs span:nth-child(1) {
  width: 420px; height: 420px;
  background: var(--violet);
  top: -10%; left: -8%;
  animation: blobDrift1 26s ease-in-out infinite;
}
.bg-blobs span:nth-child(2) {
  width: 380px; height: 380px;
  background: var(--cyan);
  top: 35%; right: -10%;
  animation: blobDrift2 32s ease-in-out infinite;
}
.bg-blobs span:nth-child(3) {
  width: 340px; height: 340px;
  background: var(--violet);
  bottom: -12%; left: 30%;
  animation: blobDrift3 30s ease-in-out infinite;
}
@keyframes blobDrift1 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(60px, 40px); } }
@keyframes blobDrift2 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-50px, 60px); } }
@keyframes blobDrift3 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(40px, -50px); } }
@media (prefers-reduced-motion: reduce) {
  .bg-blobs span { animation: none !important; }
}

/* =========================================================
   REVEAL ANIMATION
========================================================= */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--delay, 0ms);
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { transition: none; transform: none; opacity: 1; }
}

/* Cinematic title reveal — used on section headings for a bigger,
   more deliberate entrance than the standard fade above. */
.reveal-cinematic {
  opacity: 0;
  transform: scale(1.06);
  filter: blur(6px);
  transition: opacity 1s var(--ease), transform 1s var(--ease), filter 1s var(--ease);
  transition-delay: var(--delay, 0ms);
}
.reveal-cinematic.is-visible {
  opacity: 1;
  transform: scale(1);
  filter: blur(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal-cinematic { transition: none; transform: none; filter: none; opacity: 1; }
}

/* =========================================================
   3D TILT + GLARE — applied by initTilt() in animations.js.
   Perspective lives in the transform itself so no parent
   `perspective`/`transform-style` juggling is needed.
========================================================= */
.tilt {
  position: relative;
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.35s var(--ease);
  will-change: transform;
}
.tilt:hover,
.tilt:focus-within {
  transition: transform 0.08s linear;
}
.tilt::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--glare-x, 50%) var(--glare-y, 50%), rgba(255, 255, 255, 0.12), transparent 55%);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  pointer-events: none;
}
.tilt:hover::before { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .tilt { transform: none !important; }
  .tilt::before { display: none; }
}

/* =========================================================
   BUTTONS
========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  font-family: inherit;
  border: 1px solid transparent;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
  cursor: pointer;
  white-space: nowrap;
}
.btn--primary {
  background: var(--gradient);
  color: #060713;
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -8px rgba(124, 92, 255, 0.55); }

.btn--ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn--ghost:hover { background: var(--surface-hover); border-color: var(--cyan); }

.btn--sm { padding: 8px 16px; font-size: 0.8rem; }

/* =========================================================
   NAV
========================================================= */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 18px 0;
  transition: background 0.3s var(--ease), padding 0.3s var(--ease), border-color 0.3s var(--ease);
  border-bottom: 1px solid transparent;
  /* Always carry a soft scrim, even before scrolling — the nav sits
     directly over the animated hero (3D scene / canvas), and a fully
     transparent nav made the logo and links hard to read against it. */
  background: linear-gradient(to bottom, rgba(5, 6, 12, 0.55), rgba(5, 6, 12, 0));
}
.nav.is-scrolled {
  background: rgba(9, 11, 20, 0.75);
  backdrop-filter: blur(14px);
  padding: 12px 0;
  border-bottom-color: var(--border);
}
.nav__inner { display: flex; align-items: center; gap: 24px; }

.nav__brand {
  width: 40px; height: 40px;
  flex-shrink: 0;
  display: flex;
}
.nav__brand svg { width: 100%; height: 100%; }

.nav__links {
  display: flex;
  gap: 26px;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.nav__links a {
  color: var(--text-muted);
  position: relative;
  padding-bottom: 4px;
  transition: color 0.2s;
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 1.5px;
  background: var(--gradient);
  transition: width 0.25s var(--ease);
}
.nav__links a:hover, .nav__links a.is-active { color: var(--text); }
.nav__links a.is-active::after { width: 100%; }

.nav__resume { flex-shrink: 0; }

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none; border: none; cursor: pointer;
  width: 32px; height: 32px;
  align-items: center; justify-content: center;
}
.nav__toggle span {
  width: 22px; height: 2px; background: var(--text);
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}
.nav__toggle.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle.is-active span:nth-child(2) { opacity: 0; }
.nav__toggle.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =========================================================
   HERO
========================================================= */
.hero {
  position: relative;
  min-height: 100vh;   /* fallback for browsers without svh support */
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-top: 80px;
  overflow: hidden;
  scroll-margin-top: 80px;
  /* cinematic edge vignette — sits over the 3D/canvas layer, behind the
     positioned text (z-index: 3), drawing focus to the center */
  box-shadow: inset 0 0 18vw 4vw rgba(5, 6, 12, 0.65);
}
.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.8;
  touch-action: none; /* allow drag-to-rotate on the 3D hero without scrolling the page */
}
.hero__inner { position: relative; z-index: 3; max-width: 860px; }

.hero__name {
  font-size: clamp(2rem, 4.8vw, 3.4rem);
  font-weight: 700;
  margin: 14px 0 6px;
  letter-spacing: -0.02em;
  background: linear-gradient(110deg, var(--text) 0%, var(--text) 35%, var(--violet) 48%, var(--cyan) 58%, var(--text) 70%, var(--text) 100%);
  background-size: 260% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: nameShimmer 7s linear infinite;
  /* Break at the character the typing has actually reached, rather than
     relocating a whole already-typed word to the next line once it no
     longer fits — that whole-word relocation is what read as the text
     "jumping" left/right during typing. */
  overflow-wrap: break-word;
  word-break: break-word;
  /* Reserves room for the longest looping phrase wrapping onto multiple
     lines, so the page content below doesn't jump as shorter/longer
     phrases cycle through — only the name is shown statically if
     reduced-motion disables the loop, so this is a harmless minimum. */
  min-height: 2.5em;
}
@keyframes nameShimmer {
  from { background-position: 0% center; }
  to { background-position: -260% center; }
}
@media (prefers-reduced-motion: reduce) {
  .hero__name { animation: none; background-position: 0 center; min-height: 0; }
}

.hero__greeting {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 500;
  color: var(--text-muted);
  margin: 2px 0 0;
}

.typing-cursor {
  display: inline-block;
  width: 3px;
  height: 0.85em;
  margin-left: 4px;
  vertical-align: -0.08em;
  background: var(--cyan);
  animation: cursorBlink 0.9s step-end infinite;
}
@keyframes cursorBlink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .typing-cursor { animation: none; opacity: 0.7; }
}
.hero__role {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  font-weight: 600;
  margin-bottom: 18px;
}
.hero__bio {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 520px;
  margin-bottom: 22px;
}
.hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-bottom: 30px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.hero__fact {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.hero__fact svg { color: var(--cyan); flex-shrink: 0; }
.status-dot-sm {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18);
  flex-shrink: 0;
}
.hero__actions { display: flex; gap: 16px; flex-wrap: wrap; }

.hero__scroll {
  position: absolute;
  bottom: 34px; left: 50%;
  transform: translateX(-50%);
  width: 22px; height: 34px;
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  z-index: 1;
}
.hero__scroll span {
  position: absolute;
  top: 6px; left: 50%;
  width: 4px; height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--cyan);
  animation: scrollDot 1.8s infinite;
}
@keyframes scrollDot {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(14px); opacity: 0; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .hero__scroll span { animation: none; }
}

/* =========================================================
   SECTIONS (shared)
========================================================= */
.section { padding: 96px 0; position: relative; scroll-margin-top: 80px; }
.section--alt { background: linear-gradient(180deg, transparent, rgba(124, 92, 255, 0.035), transparent); }

/* ---- About ---- */
.about__grid {
  display: grid;
  grid-template-columns: auto 1.3fr 1fr;
  gap: 40px;
  align-items: start;
}
.about__avatar { flex-shrink: 0; }

/* ---- Avatar (hero + about) — real photo via personal.avatarUrl, or an
   auto-generated initials badge in the site's gradient as a placeholder.
   Shared rules size/frame both the <img> and the generated <svg>. ---- */
.hero__avatar, .about__avatar { position: relative; border-radius: 50%; }
.hero__avatar { width: 108px; height: 108px; margin-bottom: 18px; }
.about__avatar { width: 128px; height: 128px; }
.hero__avatar::before, .about__avatar::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--gradient);
  z-index: -1;
  opacity: 0.9;
}
.avatar-img, .avatar-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg);
}
.about__text { color: var(--text-muted); font-size: 1.05rem; max-width: 60ch; }
.about__stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex; flex-direction: column; gap: 6px;
}
.stat__value { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; }
.stat__label { color: var(--text-faint); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* ---- GitHub Activity (live, fetched client-side — see js/github.js) ---- */
.github__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 20px;
}
.github__grid .stat__value { display: flex; align-items: baseline; gap: 6px; }
.github__note {
  color: var(--text-faint);
  font-size: 0.85rem;
  margin-top: 22px;
}
.github__note a { color: var(--cyan); border-bottom: 1px solid rgba(34, 211, 238, 0.3); }
.github__repos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 26px;
}
.repo-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  animation: repoFadeIn 0.6s var(--ease) forwards;
}
@keyframes repoFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .repo-card { animation: none; }
}
.repo-card__name { font-family: var(--font-mono); font-size: 0.88rem; color: var(--text); }
.repo-card__desc { color: var(--text-muted); font-size: 0.85rem; margin: 6px 0 10px; }
.repo-card__meta { display: flex; gap: 14px; color: var(--text-faint); font-size: 0.78rem; font-family: var(--font-mono); }
.repo-card__meta span { display: inline-flex; align-items: center; gap: 4px; }

/* ---- Skills ---- */
.skills__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
}
.skill-card__title { color: var(--cyan); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 18px; }
.skill-list { display: flex; flex-direction: column; gap: 14px; }
.skill-row__top { display: flex; justify-content: space-between; font-size: 0.92rem; margin-bottom: 6px; }
.skill-row__pct { color: var(--text-faint); }
.skill-bar { height: 5px; background: rgba(255,255,255,0.07); border-radius: 4px; overflow: hidden; }
.skill-bar__fill {
  height: 100%;
  width: 0%;
  background: var(--gradient);
  border-radius: 4px;
  transition: width 1.1s var(--ease);
}

/* ---- Experience timeline ---- */
.timeline { position: relative; display: flex; flex-direction: column; gap: 46px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px; top: 6px; bottom: 6px;
  width: 1px;
  background: linear-gradient(var(--violet), transparent);
}
.timeline__item { position: relative; padding-left: 34px; }
.timeline__marker {
  position: absolute; left: 0; top: 6px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--cyan);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.12);
}
.timeline__period { color: var(--text-faint); font-size: 0.78rem; margin-bottom: 6px; }
.timeline__role { font-size: 1.25rem; font-weight: 600; }
.timeline__company { color: var(--text-muted); margin: 4px 0 14px; font-size: 0.94rem; }
.timeline__points { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.timeline__points li { color: var(--text-muted); position: relative; padding-left: 18px; font-size: 0.95rem; }
.timeline__points li::before { content: "→"; position: absolute; left: 0; color: var(--violet); }

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(124, 92, 255, 0.1);
  border: 1px solid rgba(124, 92, 255, 0.25);
  color: #c9bfff;
}

/* ---- Projects ---- */
.projects__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 22px;
}
.project-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  overflow: hidden;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}
.project-card:hover { transform: translateY(-6px); border-color: var(--border-strong); }
.project-card__glow {
  position: absolute; top: -60%; right: -30%;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(124,92,255,0.25), transparent 70%);
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}
.project-card:hover .project-card__glow { opacity: 1; }
.project-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.project-card__head h3 { font-size: 1.15rem; font-weight: 600; }
.badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  background: rgba(255, 184, 77, 0.14);
  color: var(--amber);
  border: 1px solid rgba(255, 184, 77, 0.3);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.project-card__desc { color: var(--text-muted); font-size: 0.94rem; margin-bottom: 16px; }
.project-card__links { display: flex; gap: 18px; margin-top: 16px; }

/* ---- Interests / curiosity ---- */
.interests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
}
.interest-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 26px;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}
.interest-card:hover { transform: translateY(-6px); border-color: var(--border-strong); }
.interest-card__icon {
  width: 56px;
  height: 56px;
  margin-bottom: 18px;
  filter: drop-shadow(0 0 10px rgba(124, 92, 255, 0.35));
}
.interest-card__icon svg { width: 100%; height: 100%; }
.interest-card h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 10px; }
.interest-card p { color: var(--text-muted); font-size: 0.92rem; line-height: 1.6; }

/* ---- Icon motion: robot bob/blink, firing neurons, orbiting electron,
   pulsing circuit traces. All original, drawn/authored for this site. ---- */
.robot-bob { transform-box: view-box; animation: robotBob 3.2s ease-in-out infinite; }
@keyframes robotBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.robot-eye { transform-box: fill-box; transform-origin: center; animation: robotBlink 4.6s ease-in-out infinite; }
.robot-eye--r { animation-delay: 0.08s; }
@keyframes robotBlink { 0%, 92%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.15); } }
.robot-antenna { animation: antennaPulse 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes antennaPulse { 0%, 100% { opacity: 1; filter: drop-shadow(0 0 0 transparent); } 50% { opacity: 0.55; filter: drop-shadow(0 0 4px currentColor); } }

.ai-node { animation: aiFire 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.ai-node--core { animation-name: aiFireCore; }
@keyframes aiFire { 0%, 100% { opacity: 0.5; transform: scale(0.85); } 40% { opacity: 1; transform: scale(1.15); } }
@keyframes aiFireCore { 0%, 100% { opacity: 0.75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.2); } }

.orbit-ring { transform-box: fill-box; transform-origin: center; }
.orbit-ring--1 { animation: ring1Spin 10s linear infinite; }
.orbit-ring--2 { animation: ring2Spin 7s linear infinite reverse; }
.orbit-ring--3 { animation: ring3Spin 13s linear infinite; }
/* Each ring's starting tilt (0deg / 60deg / 120deg) is baked into its own
   keyframes rather than left on the SVG `transform` attribute — a CSS
   `transform` animation silently overrides any XML transform attribute
   on the same element, so the old approach collapsed all three rings
   onto the same (untilted) orientation once animated. */
@keyframes ring1Spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes ring2Spin { from { transform: rotate(60deg); } to { transform: rotate(420deg); } }
@keyframes ring3Spin { from { transform: rotate(120deg); } to { transform: rotate(480deg); } }
.quantum-nucleus { animation: nucleusPulse 2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes nucleusPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }

.chip-legs { animation: chipPulse 1.1s linear infinite; }
@keyframes chipPulse { to { stroke-dashoffset: -8; } }
.chip-core { animation: nucleusPulse 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.chip-arrow { transform-box: fill-box; transform-origin: center; animation: chipArrowFloat 2.4s ease-in-out infinite; }
@keyframes chipArrowFloat { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(2px, -2px); } }

@media (prefers-reduced-motion: reduce) {
  .robot-bob, .robot-eye, .robot-antenna, .ai-node, .orbit-ring,
  .quantum-nucleus, .chip-legs, .chip-core, .chip-arrow {
    animation: none !important;
    transform: none !important;
  }
}
.project-card__links a { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--text-muted); transition: color 0.2s; }
.project-card__links a:hover { color: var(--cyan); }

/* ---- Certifications ---- */
.certs__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}
.cert-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex; gap: 16px; align-items: flex-start;
  transition: border-color 0.25s, transform 0.25s var(--ease);
}
.cert-card:hover { border-color: rgba(34, 211, 238, 0.4); transform: translateY(-3px); }
.cert-card__link { display: flex; gap: 16px; align-items: flex-start; }
.cert-card__badge {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: var(--cyan);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem;
}
.cert-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.cert-card__meta { color: var(--text-faint); font-size: 0.82rem; }

/* ---- Education ---- */
.edu-list { display: flex; flex-direction: column; gap: 28px; }
.edu-item {
  border-left: 2px solid var(--border);
  padding-left: 22px;
}
.edu-item h3 { font-size: 1.1rem; margin: 4px 0; }
.edu-item__school { color: var(--text-muted); font-size: 0.95rem; }
.edu-item__details { color: var(--text-faint); font-size: 0.88rem; margin-top: 6px; }

/* ---- Contact ---- */
.contact__inner { text-align: center; display: flex; flex-direction: column; align-items: center; }
.contact__lead { color: var(--text-muted); max-width: 480px; margin: 0 auto 34px; }
.contact__links { display: flex; flex-direction: column; align-items: center; gap: 26px; }
.social-row { display: flex; gap: 16px; }
.social-icon {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}
.social-icon:hover { color: var(--cyan); border-color: var(--cyan); transform: translateY(-3px); }

/* =========================================================
   FOOTER
========================================================= */
.footer {
  position: relative;
  border-top: 1px solid var(--border);
  padding: 52px 0 0;
}
.footer::before {
  content: "";
  position: absolute;
  top: -1px; left: 0; right: 0;
  height: 1px;
  background: var(--gradient);
  opacity: 0.5;
}
.footer__top {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 32px;
  align-items: start;
  padding-bottom: 36px;
}
.footer__brand { display: flex; flex-direction: column; gap: 14px; max-width: 340px; }
.footer__logo { width: 40px; height: 40px; }
.footer__tagline { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }
.footer__nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.footer__nav a { color: var(--text-muted); transition: color 0.2s; }
.footer__nav a:hover { color: var(--cyan); }
.footer .social-row { gap: 12px; }
.footer .social-icon { width: 38px; height: 38px; }
.footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 22px 0;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.78rem;
}
.footer__top-link { color: var(--text-faint); transition: color 0.2s; }
.footer__top-link:hover { color: var(--cyan); }
@media (max-width: 760px) {
  .footer__top { grid-template-columns: 1fr; gap: 26px; }
}

/* =========================================================
   RESUME PREVIEW MODAL — view-only, no download affordance
========================================================= */
.resume-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}
.resume-modal.is-open { opacity: 1; pointer-events: auto; }
.resume-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 12, 0.78);
  backdrop-filter: blur(6px);
}
.resume-modal__panel {
  position: relative;
  width: min(880px, 100%);
  height: min(86vh, 1000px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.3s var(--ease);
}
.resume-modal.is-open .resume-modal__panel { transform: translateY(0) scale(1); }
.resume-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
}
.resume-modal__close {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s;
}
.resume-modal__close:hover { color: var(--text); border-color: var(--border-strong); }
.resume-modal__body { flex: 1; background: #fff; }
.resume-modal__body iframe { width: 100%; height: 100%; border: none; }
@media (prefers-reduced-motion: reduce) {
  .resume-modal, .resume-modal__panel { transition: none; }
}

/* =========================================================
   RESPONSIVE
========================================================= */
@media (max-width: 900px) {
  .about__grid { grid-template-columns: 1fr; gap: 36px; }
  .about__avatar { width: 96px; height: 96px; }
}

@media (max-width: 760px) {
  .nav__links {
    position: fixed;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    background: rgba(9, 11, 20, 0.97);
    backdrop-filter: blur(16px);
    padding: 26px 24px;
    gap: 20px;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  }
  .nav__links.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }
  .nav__toggle { display: flex; }
  .nav__resume { display: none; }

  .section { padding: 76px 0; }
  .about__stats { grid-template-columns: 1fr 1fr; }
  .hero__actions { flex-direction: column; align-items: stretch; }
  .hero__actions .btn { justify-content: center; }
}

@media (max-width: 480px) {
  .container { padding: 0 18px; }
  .stat__value { font-size: 1.7rem; }
  .cert-card, .cert-card__link { flex-direction: column; }
  .hero { box-shadow: inset 0 0 12vw 3vw rgba(5, 6, 12, 0.6); }
}

/* Visible keyboard focus */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}
