/* =========================================================================
   Dr. Rajeev Kumar — personal site
   Futuristic, graphic-forward, but high-contrast and easy to navigate.
   Single dark theme. Built for accessibility (WCAG AA) and performance.
   ========================================================================= */

/* ---------- Design tokens ---------- */
:root {
  --bg:        #070b16;
  --bg-2:      #0b1122;
  --surface:   rgba(20, 28, 51, 0.55);
  --surface-2: rgba(28, 38, 68, 0.75);
  --border:    rgba(120, 150, 220, 0.18);
  --border-strong: rgba(120, 150, 220, 0.4);

  --text:      #eaf0ff;
  --text-soft: #b9c4e0;
  --text-mute: #8694b8;

  --cyan:   #00e5ff;
  --violet: #a26bff;
  --pink:   #ff4d9d;

  --accent: var(--cyan);
  --grad:   linear-gradient(110deg, var(--cyan), var(--violet) 55%, var(--pink));

  --radius:   16px;
  --radius-sm: 10px;
  --maxw: 1140px;

  --shadow: 0 18px 50px -22px rgba(0, 0, 0, 0.8);
  --glow:   0 0 0 1px rgba(0, 229, 255, 0.25), 0 0 28px -6px rgba(0, 229, 255, 0.45);

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

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* Layered background: deep gradient + faint grid, painted on body. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1100px 700px at 78% -8%, rgba(162, 107, 255, 0.20), transparent 60%),
    radial-gradient(900px 600px at 10% 8%, rgba(0, 229, 255, 0.16), transparent 55%),
    radial-gradient(800px 800px at 50% 120%, rgba(255, 77, 157, 0.12), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  will-change: transform;
  animation: bg-drift 26s ease-in-out infinite alternate;
}
@keyframes bg-drift {
  from { transform: translate3d(0, 0, 0) scale(1.04); }
  to   { transform: translate3d(-2.5%, 2%, 0) scale(1.12); }
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(120, 150, 220, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 150, 220, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 100% 70% at 50% 0%, #000 35%, transparent 80%);
}

/* Particle canvas sits above the static background, below content. */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Accessibility helpers ---------- */
.skip-link {
  position: absolute;
  left: 12px;
  top: -120px;
  z-index: 200;
  background: var(--cyan);
  color: #05121a;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 8px;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

.visually-hidden, .sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

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

/* ---------- Layout ---------- */
.container {
  width: min(100% - 2.4rem, var(--maxw));
  margin-inline: auto;
}
.section { padding: clamp(3.5rem, 8vw, 7rem) 0; position: relative; }
.section-alt { background: rgba(8, 13, 28, 0.55); }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  margin-bottom: 1.6rem;
}
.section-index {
  font-family: "Space Grotesk", monospace;
  color: var(--accent);
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  opacity: 0.85;
}
h1, h2, h3, h4 { font-family: "Space Grotesk", "Inter", sans-serif; line-height: 1.12; font-weight: 700; }
h2 { font-size: clamp(1.7rem, 4vw, 2.6rem); letter-spacing: -0.01em; }
h3 { font-size: 1.2rem; }
.section-lead { color: var(--text-soft); max-width: 65ch; margin-bottom: 2rem; font-size: 1.05rem; }

/* Justify the bulk prose for a clean, block-aligned look (not the cards) */
.about-text p,
.section-lead {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}
.muted { color: var(--text-mute); }

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: var(--cyan);
  -webkit-text-fill-color: transparent;
}

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(7, 11, 22, 0.55);
  border-bottom: 1px solid transparent;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}
.site-header.scrolled {
  background: rgba(7, 11, 22, 0.9);
  border-bottom-color: var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
}
.brand { display: flex; align-items: center; gap: 0.6rem; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 11px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  color: #05121a;
  background: var(--grad);
  box-shadow: var(--glow);
}
.brand-text { font-family: "Space Grotesk", sans-serif; letter-spacing: 0.01em; white-space: nowrap; }

.primary-nav ul {
  list-style: none;
  display: flex;
  gap: 0.25rem;
  padding: 0;
}
.primary-nav a {
  display: block;
  color: var(--text-soft);
  padding: 0.5rem 0.65rem;
  border-radius: 9px;
  font-size: 0.93rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
}
.primary-nav a:hover { color: var(--text); background: rgba(120, 150, 220, 0.1); text-decoration: none; }
.primary-nav a.active { color: var(--cyan); background: rgba(0, 229, 255, 0.1); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px;
  cursor: pointer;
}
.nav-toggle-bar {
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.2s;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.98rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.25s, background 0.25s;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-primary { background: var(--grad); color: #05121a; box-shadow: var(--glow); }
.btn-primary:hover { box-shadow: 0 0 0 1px rgba(0,229,255,0.4), 0 12px 30px -8px rgba(0,229,255,0.6); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }

/* ---------- Hero ---------- */
.hero { padding: clamp(3rem, 9vw, 7rem) 0 clamp(2.5rem, 6vw, 4rem); }
.hero-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.eyebrow {
  font-family: "Space Grotesk", monospace;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.82rem;
  color: var(--cyan);
  margin-bottom: 1rem;
}
.hero h1 {
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  letter-spacing: -0.02em;
  text-wrap: balance;
  display: inline-block;            /* keep the clipped background sized to the text */
  background: linear-gradient(180deg, #ffffff, #c3d0f0);
  -webkit-background-clip: text;
  background-clip: text;
  color: #eaf0ff;                   /* solid fallback if clip fails (no gray box) */
  -webkit-text-fill-color: transparent; /* robust transparent fill for the clip */
}
.hero-tagline { font-size: clamp(1.2rem, 2.4vw, 1.62rem); color: var(--text); margin-top: 1rem; max-width: 38ch; text-wrap: balance; }
.hero-sub { color: var(--text-soft); margin-top: 1.1rem; max-width: 60ch; text-wrap: pretty; }
.hero-honor { margin-top: 1.4rem; }
.hero-honor-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 209, 102, 0.45);
  background: rgba(255, 209, 102, 0.08);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.3;
  text-decoration: none;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.hero-honor-link:hover {
  background: rgba(255, 209, 102, 0.16);
  border-color: rgba(255, 209, 102, 0.7);
  transform: translateY(-1px);
}
.hero-honor-link strong { color: #ffd166; font-weight: 600; }
.hero-honor-badge {
  display: inline-grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  background: #ffd166;
  color: #1a1300;
  font-size: 0.9rem;
  flex: none;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 1.8rem; }

.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.avatar {
  width: 168px; height: 208px;
  margin: 0 auto 1.3rem;
  border-radius: 50%;            /* non-square box + 50% = ellipse (oval) */
  display: grid;
  place-items: center;
  color: var(--text);
  background: var(--bg-2);
  border: 2px solid var(--border-strong);
  box-shadow: var(--glow);
  position: relative;
}
.avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 28%;   /* keep the face centered in the oval */
}
.avatar::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 1px solid rgba(0, 229, 255, 0.45);
  animation: haloPulse 3.6s ease-in-out infinite;
}
@keyframes haloPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.0); opacity: 0.55; }
  50%      { box-shadow: 0 0 22px 2px rgba(0, 229, 255, 0.35); opacity: 1; }
}
.hero-tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.hero-tags li {
  font-size: 0.82rem;
  color: var(--text-soft);
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(120, 150, 220, 0.06);
}

/* ---------- Metrics ---------- */
.metrics {
  list-style: none;
  padding: 1.5rem 0 0;
  margin-top: 2.5rem;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
  border-top: 1px solid var(--border);
}
.metrics li { text-align: center; }
.metric-num {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: var(--cyan);
  -webkit-text-fill-color: transparent;
}
.metric-label { font-size: 0.8rem; color: var(--text-mute); letter-spacing: 0.02em; }
.metrics-note { font-size: 0.82rem; color: var(--text-mute); margin-top: 0.8rem; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 2.5rem; align-items: start; }
.about-text p + p { margin-top: 1rem; }
.about-text { color: var(--text-soft); }
.about-text strong { color: var(--text); }
.about-facts {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.about-facts dl { display: grid; gap: 1rem; }
.about-facts dt { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--cyan); }
.about-facts dd { color: var(--text); font-weight: 500; }

/* ---------- Cards ---------- */
.card-grid {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
}
.card-grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}
.card:hover { transform: translateY(-5px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card:hover::before { transform: scaleX(1); }
.card h3 { margin-bottom: 0.5rem; color: var(--text); }
.card p { color: var(--text-soft); font-size: 0.95rem; }
.card.mini { padding: 1.1rem 1.3rem; }
.card.mini h4 { color: var(--cyan); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.35rem; }

/* Journal-cover-style graphic at the top of research cards */
.card-cover {
  margin: -1.5rem -1.5rem 1.2rem;        /* bleed to the card edges */
  aspect-ratio: 20 / 11;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.card-cover svg { width: 100%; height: 100%; display: block; transition: transform 0.5s var(--ease); }
.card:hover .card-cover svg { transform: scale(1.06); }
.card-cover .spark { animation: coverPulse 3.2s ease-in-out infinite; transform-origin: center; }
@keyframes coverPulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* ---------- Techniques chips ---------- */
.techniques { margin-top: 2.5rem; }
.techniques-title { margin-bottom: 1rem; color: var(--text); }
.chip-set { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.chip {
  font-size: 0.85rem;
  color: var(--text-soft);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(120, 150, 220, 0.06);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.chip:hover { color: var(--text); border-color: var(--cyan); background: rgba(0, 229, 255, 0.08); }

/* ---------- Timeline ---------- */
.timeline-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }
.timeline-heading { color: var(--cyan); margin-bottom: 1.4rem; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.12em; }
.timeline { list-style: none; padding: 0; position: relative; margin-left: 0.5rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--cyan), var(--violet), transparent);
}
.timeline-item { position: relative; padding: 0 0 1.6rem 1.9rem; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: 0; top: 6px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--cyan);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.6);
}
.t-date { font-family: "Space Grotesk", monospace; font-size: 0.8rem; color: var(--cyan); letter-spacing: 0.04em; }
.timeline-item h4 { margin: 0.2rem 0 0.1rem; color: var(--text); font-size: 1.05rem; }
.t-org { color: var(--text-soft); font-size: 0.92rem; font-style: italic; }
.timeline-item p:last-child { color: var(--text-soft); font-size: 0.93rem; margin-top: 0.3rem; }

/* ---------- Publications ---------- */
.pub-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.pub-search { flex: 1 1 280px; }
.pub-search input {
  width: 100%;
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}
.pub-search input::placeholder { color: var(--text-mute); }
.pub-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.filter-btn {
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-soft);
  font-size: 0.88rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.filter-btn:hover { color: var(--text); border-color: var(--border-strong); }
.filter-btn.is-active { color: #05121a; background: var(--cyan); border-color: var(--cyan); font-weight: 600; }
.pub-count { color: var(--text-mute); font-size: 0.85rem; margin-bottom: 0.2rem; }
.pub-sync { color: var(--cyan); font-size: 0.82rem; margin-bottom: 1.2rem; min-height: 1em; }

.pub-list { display: grid; gap: 2.2rem; }
.pub-group-title {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.15rem;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.pub-group-title::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
}
.pub-group-count {
  font-size: 0.72rem;
  color: var(--text-mute);
  font-weight: 500;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
}
.pub-group-list { list-style: none; padding: 0; display: grid; gap: 0.9rem; }
.pub-cites {
  font-size: 0.78rem;
  color: var(--pink);
  font-weight: 600;
}
.pub-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.3rem;
  transition: border-color 0.25s, transform 0.25s var(--ease), background 0.25s;
}
.pub-item:hover { border-left-color: var(--cyan); transform: translateX(4px); background: var(--surface-2); }
.pub-item .pub-title { color: var(--text); font-weight: 600; font-family: "Space Grotesk", sans-serif; font-size: 1.02rem; }
.pub-item .pub-title a { color: inherit; }
.pub-item .pub-authors { color: var(--text-soft); font-size: 0.9rem; margin-top: 0.3rem; }
.pub-item .pub-authors strong { color: var(--cyan); font-weight: 600; }
.pub-item .pub-meta { color: var(--text-mute); font-size: 0.86rem; margin-top: 0.35rem; display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem; align-items: center; }
.pub-item .pub-journal { font-style: italic; color: var(--text-soft); }
.pub-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.pub-badge.first { color: var(--cyan); border-color: rgba(0, 229, 255, 0.4); }
.pub-badge.metric { color: var(--violet); border-color: rgba(162, 107, 255, 0.4); }
.pub-badge.eq { color: #ffd166; border-color: rgba(255, 209, 102, 0.5); background: rgba(255, 209, 102, 0.08); }

/* Equal-contribution (co-first author) papers: gold contour to set them apart. */
.pub-item.is-eq {
  border-color: rgba(255, 209, 102, 0.45);
  border-left-color: #ffd166;
  box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.18);
}
.pub-item.is-eq:hover { border-left-color: #ffd166; border-color: rgba(255, 209, 102, 0.7); }

/* Legend chip explaining the gold contour. */
.pub-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-mute);
  margin: 0 0 1.2rem;
}
.pub-legend::before {
  content: "";
  width: 1.4rem; height: 0.9rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 209, 102, 0.45);
  border-left: 3px solid #ffd166;
  background: rgba(255, 209, 102, 0.08);
}
.pub-empty { color: var(--text-mute); padding: 1.5rem 0; }
.noscript-note { color: var(--text-soft); }

/* ---------- Two-column generic ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }
.subhead { color: var(--cyan); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.85rem; margin-bottom: 1rem; }
.plain-list { list-style: none; padding: 0; display: grid; gap: 0.9rem; }
.plain-list li {
  color: var(--text-soft);
  padding-left: 1.2rem;
  position: relative;
  font-size: 0.95rem;
}
.plain-list li::before { content: "▸"; position: absolute; left: 0; color: var(--cyan); }
.plain-list li strong { color: var(--text); }
.editorial { margin-top: 2.5rem; }
.editorial .muted { margin-top: 1rem; font-size: 0.9rem; }

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.contact-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  color: var(--text);
  transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s;
}
.contact-card:hover { transform: translateY(-4px); border-color: var(--cyan); box-shadow: var(--glow); text-decoration: none; }
.contact-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: rgba(0, 229, 255, 0.1);
  color: var(--cyan);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}
.contact-label { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-mute); }
.contact-value { color: var(--text); font-weight: 600; word-break: break-word; }
.contact-value.contact-go { color: var(--cyan); font-weight: 600; }
.contact-location { margin-top: 1.6rem; color: var(--text-soft); font-size: 0.95rem; }

/* ---------- Software ---------- */
.software-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.2rem;
  align-items: stretch;
}
.software-card { display: flex; flex-direction: column; gap: 0.9rem; }
.software-card > p { color: var(--text-soft); font-size: 0.96rem; }
.software-head { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.software-head h3 { margin: 0; }
.software-actions { margin-top: auto; padding-top: 0.3rem; }
.software-card .chip-set { margin: 0.1rem 0; }
.software-note { margin-top: 1.4rem; font-size: 0.9rem; }
.techniques-text { color: var(--text-soft); max-width: 74ch; }

.badge-live, .badge-dev {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}
.badge-live { color: var(--cyan); border-color: rgba(0, 229, 255, 0.45); background: rgba(0, 229, 255, 0.08); }
.badge-dev { color: #ffd166; border-color: rgba(255, 209, 102, 0.45); background: rgba(255, 209, 102, 0.08); }

/* ---------- Gallery ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.gallery-item {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  position: relative;
}
.gallery-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}
.gallery-item:hover img { transform: scale(1.05); }
.gallery-item figcaption {
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  color: var(--text-soft);
}
.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-mute);
  padding: 3rem 1rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

/* ---------- Honors: certificates & credentials ---------- */
.honors-certs { margin-top: 2.6rem; }
.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.4rem;
  margin-top: 1.2rem;
}
.cert-card {
  margin: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.cert-card img {
  width: 100%;
  display: block;
  background: #fff;
  object-fit: contain;
  max-height: 320px;
}
.cert-card figcaption { padding: 1rem 1.1rem 1.2rem; }
.cert-card figcaption h4 {
  margin: 0 0 0.4rem;
  font-size: 1.02rem;
  color: var(--text);
}
.cert-card figcaption p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-soft);
  text-wrap: pretty;
}

/* ---------- Lightbox (click an image to enlarge) ---------- */
.gallery-item img,
.cert-card img { cursor: zoom-in; }
body.lightbox-open { overflow: hidden; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(4, 6, 18, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.lightbox.is-open { display: flex; }
.lightbox-figure {
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}
.lightbox-img {
  max-width: 92vw;
  max-height: 82vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.lightbox-cap {
  color: #eaf0ff;
  font-size: 0.92rem;
  text-align: center;
  max-width: 70ch;
  text-wrap: pretty;
}
.lightbox-close {
  position: absolute;
  top: clamp(0.6rem, 2vw, 1.2rem);
  right: clamp(0.6rem, 2vw, 1.2rem);
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s var(--ease);
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.2); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 2rem 0; margin-top: 2rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 0.6rem 1.5rem; align-items: center; justify-content: space-between; }
.footer-inner p { color: var(--text-mute); font-size: 0.88rem; }
.to-top { color: var(--cyan); font-weight: 600; font-size: 0.9rem; }

/* ---------- Reveal-on-scroll ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Tab / page navigation ----------
   With JS (html.has-js), each routed section behaves like its own page: only the
   active one is shown. Without JS, no rule applies and the page scrolls normally. */
.has-js .route { display: none; }
.has-js .route.is-active { display: block; animation: pageIn 0.45s var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.has-js .route.is-active:focus { outline: none; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-card { max-width: 360px; }
  .about-grid, .timeline-wrap, .two-col { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(3, 1fr); gap: 1.4rem 1rem; }
}

@media (max-width: 1180px) {
  .nav-toggle { display: flex; }
  .primary-nav {
    position: fixed;
    inset: 60px 0 auto 0;
    background: rgba(7, 11, 22, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    transform: translateY(-150%);
    transition: transform 0.35s var(--ease);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
  }
  .primary-nav.open { transform: translateY(0); }
  .primary-nav ul { flex-direction: column; gap: 0.2rem; padding: 1rem 1.2rem 1.6rem; }
  .primary-nav a { padding: 0.8rem 1rem; font-size: 1.05rem; }
  .pub-controls { flex-direction: column; align-items: stretch; }
}

@media (max-width: 460px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .brand-text { font-size: 0.95rem; }
}

/* ---------- Motion / contrast preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  /* The decorative background is intentionally kept alive even under reduced
     motion (site owner's preference). Its drift is slow and non-essential, and
     the particle layer is JS/rAF-driven so it keeps animating regardless. */
  body::before {
    animation-duration: 26s !important;
    animation-iteration-count: infinite !important;
  }
}

@media print {
  #bg-canvas, .site-header, .nav-toggle, .to-top, .hero-actions { display: none !important; }
  body { background: #fff; color: #000; }
  body::before, body::after { display: none; }
  .card, .pub-item, .contact-card, .about-facts, .hero-card { box-shadow: none; border-color: #ccc; }
}
