/* ===========================================================================
   Karthik Javanappa — Portfolio
   Hand-built, dependency-free. Dark-first with a light theme toggle.
   One accent colour, flat surfaces, animation-light.
   =========================================================================== */

/* ----- Design tokens ----------------------------------------------------- */
:root {
  /* Dark theme — neutral warm-black palette (Ultrarare-inspired) */
  --bg: #141414;
  --bg-2: #1b1b1c;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.20);
  --text: #d6d6d8;
  --heading: #ffffff;
  --muted: #9a9a9e;
  --faint: #6b6b70;
  --accent: #ffffff;
  --accent-ink: #141414;
  --accent-soft: rgba(255, 255, 255, 0.08);
  --ring: rgba(255, 255, 255, 0.22);
  --net-edge: rgba(255, 255, 255, 0.12);
  --net-node: rgba(255, 255, 255, 0.30);
  --net-ring: rgba(255, 255, 255, 0.32);
  --shadow: 0 18px 44px -18px rgba(0, 0, 0, 0.72);
  --shadow-sm: 0 8px 24px -14px rgba(0, 0, 0, 0.6);
  --glass: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.10);
  --glass-shadow: 0 14px 36px -18px rgba(0, 0, 0, 0.6);

  --maxw: 1160px;
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Space Grotesk", var(--font);
}

[data-theme="light"] {
  --bg: #fafbfc;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f4f7;
  --border: rgba(15, 23, 42, 0.10);
  --border-strong: rgba(15, 23, 42, 0.20);
  --text: #303b4e;
  --heading: #0d1322;
  --muted: #5a6478;
  --faint: #8b93a5;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: rgba(15, 118, 110, 0.08);
  --ring: rgba(15, 118, 110, 0.25);
  --net-edge: rgba(15, 23, 42, 0.12);
  --net-node: rgba(15, 23, 42, 0.28);
  --net-ring: rgba(15, 118, 110, 0.35);
  --shadow: 0 18px 44px -22px rgba(20, 30, 70, 0.28);
  --shadow-sm: 0 8px 24px -16px rgba(20, 30, 70, 0.22);
  --glass: rgba(255, 255, 255, 0.62);
  --glass-border: rgba(15, 23, 42, 0.08);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  --glass-shadow: 0 14px 34px -20px rgba(20, 30, 70, 0.18);
}

/* ----- Reset / base ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul { list-style: none; padding: 0; }
h1, h2, h3, h4 { font-family: var(--display); color: var(--heading); line-height: 1.1; font-weight: 600; letter-spacing: -0.02em; }
em.accent-text { font-style: normal; white-space: nowrap; }

::selection { background: var(--accent); color: var(--accent-ink); }

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

/* ----- Layout helpers ---------------------------------------------------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 24px; }
.section { padding: 88px 0; position: relative; }
.section--tight { padding: 60px 0; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--display);
  font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before { content: ""; width: 26px; height: 2px; border-radius: 2px; background: var(--accent); }

.section-head { max-width: 680px; margin-bottom: 48px; }
.section-head h2 { font-size: clamp(27px, 4vw, 40px); margin: 14px 0 12px; }
.section-head p { color: var(--muted); font-size: 16.5px; }

.accent-text { color: var(--accent); }

/* ----- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 22px; border-radius: var(--radius-sm);
  font-family: var(--display); font-weight: 600; font-size: 15px; letter-spacing: -0.01em;
  transition: background .2s ease, border-color .2s ease, color .2s ease, opacity .2s ease;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn-primary { color: var(--accent-ink); background: var(--accent); }
.btn-primary:hover { opacity: .88; }
.btn-ghost { color: var(--heading); border: 1px solid var(--border-strong); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ----- Navigation -------------------------------------------------------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  transition: background .3s ease, border-color .3s ease;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom-color: var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.brand { display: flex; align-items: center; gap: 11px; font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--heading); letter-spacing: -0.02em; }
.brand .mark {
  width: 36px; height: 36px; border-radius: 9px; background: var(--accent);
  display: grid; place-items: center; color: var(--accent-ink); font-weight: 700; font-size: 16px;
}
.brand small { display: block; font-family: var(--font); font-weight: 500; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 2px; position: relative; }
.nav-links a {
  position: relative; padding: 9px 13px; border-radius: 8px;
  font-size: 14.5px; font-weight: 500; color: var(--muted);
  transition: color .2s ease, background .2s ease;
}
.nav-links a:hover, .nav-links a.active { color: var(--heading); background: var(--surface-2); }
.nav-links a.active::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: 3px; height: 2px;
  border-radius: 2px; background: var(--accent);
}
/* JS-driven gliding underline (replaces the per-link one when enabled) */
.nav-links.has-glide a.active::after { display: none; }
.nav-underline {
  position: absolute; left: 0; bottom: 3px; width: 0; height: 2px;
  border-radius: 2px; background: var(--accent); opacity: 0; transform: translateX(0);
  pointer-events: none;
  transition: transform .3s cubic-bezier(.4,0,.2,1), width .3s cubic-bezier(.4,0,.2,1), opacity .2s ease;
}
@media (max-width: 720px) { .nav-underline { display: none; } }
@media (prefers-reduced-motion: reduce) { .nav-underline { transition: opacity .2s ease; } }

.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-cta { padding: 10px 18px; font-size: 14px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: border-color .2s ease, color .2s ease;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .moon { display: none; }
[data-theme="light"] .theme-toggle .sun { display: none; }
[data-theme="light"] .theme-toggle .moon { display: block; }

.nav-toggle { display: none; }

/* ----- Hero -------------------------------------------------------------- */
.hero { position: relative; padding: 140px 0 72px; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; }

/* signature motif: agent-workflow node graph */
.hero-net {
  position: absolute; top: 40px; right: -120px;
  width: min(760px, 70vw); height: auto;
  opacity: .55;
}
[data-theme="light"] .hero-net { opacity: .45; }
.hero-net .edge-flow {
  stroke: var(--accent); stroke-opacity: .45;
  stroke-dasharray: 6 10;
  animation: edge-flow 4.5s linear infinite;
}
@keyframes edge-flow { to { stroke-dashoffset: -64; } }
.hero-net .pulse { animation: node-pulse 3.6s ease-in-out infinite; }
.hero-net .pulse.d2 { animation-delay: 1.2s; }
.hero-net .pulse.d3 { animation-delay: 2.4s; }
@keyframes node-pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
/* JS-driven data packets travelling input → hub → output */
.hero-net .net-pulse { fill: var(--accent); filter: drop-shadow(0 0 4px var(--net-ring)); }
@media (prefers-reduced-motion: reduce) {
  .hero-net { transform: none !important; }
  .hero-net .edge-flow { stroke-dasharray: none; }
  .hero-net .pulse { opacity: .8; }
  .hero-net .net-pulses { display: none; }
}

.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 56px; align-items: center; }

.status-pill {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 15px 7px 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 13.5px; font-weight: 500; color: var(--text);
  margin-bottom: 26px;
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px rgba(128,128,128,.18); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 3px rgba(128,128,128,.18); } 50% { box-shadow: 0 0 0 7px rgba(128,128,128,0); } }

.hero h1 { font-size: clamp(29px, 3.5vw, 41px); line-height: 1.12; margin-bottom: 22px; }
.hero h1 .line { display: block; }
/* dark theme: Ultrarare-style grey lead-in + bold-white emphasis */
[data-theme="dark"] .hero h1 { color: #adadb3; }
[data-theme="dark"] .hero h1 .accent-text { color: var(--heading); font-weight: 700; }
.hero-lead { font-size: clamp(16.5px, 2.2vw, 18.5px); color: var(--muted); max-width: 560px; margin-bottom: 30px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 34px; }

.hero-socials { display: flex; align-items: center; gap: 14px; }
.hero-socials span { font-size: 13px; color: var(--faint); letter-spacing: .04em; }
.hero-socials a { color: var(--muted); transition: color .2s ease; }
.hero-socials a:hover { color: var(--accent); }
.hero-socials svg { width: 20px; height: 20px; }

/* hero portrait */
.hero-photo { position: relative; justify-self: center; }
.hero-photo .frame {
  position: relative; width: min(360px, 76vw); aspect-ratio: 4/4.4;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  box-shadow: var(--shadow);
}
.hero-photo .frame img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
/* hero stats — static */
.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 60px; padding-top: 34px; border-top: 1px solid var(--border); }
.stat .num { font-family: var(--display); font-size: clamp(25px, 3.6vw, 34px); font-weight: 700; color: var(--heading); line-height: 1; }
.stat .label { font-size: 13.5px; color: var(--muted); margin-top: 8px; }

/* ----- Trusted brands (marquee) ------------------------------------------ */
.marquee { border-block: 1px solid var(--border); background: var(--bg-2); overflow: hidden; padding: 24px 0; }
.marquee .lead { text-align: center; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--faint); margin-bottom: 16px; }
.marquee-track { display: flex; gap: 48px; width: max-content; animation: scroll-x 30s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span { font-family: var(--display); font-weight: 600; font-size: 17px; color: var(--muted); white-space: nowrap; }
@keyframes scroll-x { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .marquee-track { animation: none; } }

/* ----- AI Projects (tabbed explorer) ------------------------------------- */
.proj-explorer { display: grid; grid-template-columns: 0.92fr 1.08fr; gap: 22px; align-items: start; }
.proj-tabs { display: flex; flex-direction: column; gap: 8px; }
.proj-tab {
  display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 15px 17px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  transition: border-color .2s ease, background .2s ease, transform .15s ease;
}
.proj-tab:hover { border-color: var(--border-strong); transform: translateX(3px); }
.proj-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.proj-tab.is-active { border-color: var(--accent); background: var(--accent-soft); }
.proj-tab .pt-num { font-family: var(--display); font-weight: 700; font-size: 13px; color: var(--accent); letter-spacing: .06em; }
.proj-tab .pt-text { display: flex; flex-direction: column; gap: 2px; }
.proj-tab .pt-text b { font-family: var(--display); font-size: 15.5px; color: var(--heading); font-weight: 600; }
.proj-tab .pt-text small { font-size: 12.5px; color: var(--muted); }

.proj-panel {
  padding: 28px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface);
}
.proj-panel[hidden] { display: none; }
.proj-panel:not([hidden]) { animation: panel-in .3s ease both; }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .proj-panel:not([hidden]) { animation: none; } }
.proj-panel h3 { font-size: 22px; margin: 14px 0 18px; }

.pc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pc-tags span {
  font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid transparent;
}
.pc-pai { display: grid; gap: 14px; margin-bottom: 18px; }
.pc-pai dt {
  font-family: var(--display); font-size: 11.5px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 3px;
}
.pc-pai dd { margin: 0; font-size: 15px; color: var(--text); }
.pc-more { border-top: 1px solid var(--border); padding-top: 14px; }
.pc-more summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--display); font-size: 14px; font-weight: 600; color: var(--muted);
  transition: color .2s ease;
}
.pc-more summary::-webkit-details-marker { display: none; }
.pc-more summary::after { content: "+"; font-size: 16px; color: var(--accent); }
.pc-more[open] summary::after { content: "–"; }
.pc-more summary:hover, .pc-more[open] summary { color: var(--accent); }
.pc-more summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.pc-more p { margin-top: 10px; font-size: 14px; color: var(--muted); }

/* ----- About ------------------------------------------------------------- */
.about-grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 56px; align-items: center; }
.about-photo { position: relative; }
.about-photo img { border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); width: 100%; }
.about-photo .badge {
  position: absolute; bottom: -20px; right: -14px;
  padding: 14px 18px; border-radius: var(--radius-sm); text-align: center;
  background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-sm);
}
.about-photo .badge b { font-family: var(--display); font-size: 24px; display: block; line-height: 1; }
.about-photo .badge span { font-size: 11px; font-weight: 600; letter-spacing: .06em; }
.about-body p { color: var(--muted); margin-bottom: 16px; font-size: 16px; }
.about-body p strong { color: var(--text); font-weight: 600; }

/* ----- Tag rows (Education › Languages) ---------------------------------- */
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { font-size: 13px; padding: 5px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }

/* ----- Career (horizontal scroller) ------------------------------------- */
.career { position: relative; }
.career-track {
  display: flex; gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 6px 4px 20px; margin: 0 -4px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-behavior: smooth;
  cursor: grab;
}
.career-track.dragging { cursor: grabbing; scroll-behavior: auto; scroll-snap-type: none; }
.career-track::-webkit-scrollbar { display: none; }
.career-track:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--radius); }
@media (prefers-reduced-motion: reduce) { .career-track { scroll-behavior: auto; } }
.job-card {
  flex: 0 0 clamp(270px, 78vw, 360px); scroll-snap-align: start;
  display: flex; flex-direction: column; user-select: none;
  padding: 24px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); transition: border-color .2s ease;
}
.job-card:hover { border-color: var(--border-strong); }
.job-date { font-family: var(--display); font-size: 13px; font-weight: 600; color: var(--accent); }
.job-role { font-size: 18px; margin: 8px 0 4px; }
.job-role span { color: var(--muted); font-weight: 500; font-size: 14px; }
.job-org { font-size: 14.5px; color: var(--text); font-weight: 600; margin-bottom: 14px; }
.job-org .place { color: var(--faint); font-weight: 400; }
.job-card ul { display: grid; gap: 9px; }
.job-card li { position: relative; padding-left: 18px; font-size: 14px; color: var(--muted); }
.job-card li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: .7; }

.career-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; }
.career-hint { font-size: 12.5px; color: var(--faint); letter-spacing: .03em; }
.career-progress { flex: 1; height: 2px; border-radius: 2px; background: var(--border); position: relative; overflow: hidden; max-width: 280px; }
.career-progress span { position: absolute; left: 0; top: 0; height: 100%; background: var(--accent); border-radius: 2px; transition: left .3s ease, width .3s ease; }
.career-arrows { display: flex; gap: 10px; }
.career-arrow {
  width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--heading);
  transition: border-color .2s ease, color .2s ease, opacity .2s ease;
}
.career-arrow:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.career-arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.career-arrow:disabled { opacity: .3; cursor: default; }
.career-arrow svg { width: 20px; height: 20px; }

/* ----- Education + Awards split ----------------------------------------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.block-title { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-size: 20px; color: var(--heading); margin-bottom: 20px; }
.block-title .bt-ico { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.block-title .bt-ico svg { width: 19px; height: 19px; }

.edu-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.edu-item:last-of-type { border-bottom: none; }
.edu-item .e-date { font-size: 13px; font-weight: 600; color: var(--accent); font-family: var(--display); }
.edu-item h4 { font-size: 16.5px; margin: 5px 0 3px; }
.edu-item .e-org { font-size: 14.5px; color: var(--text); }
.edu-item .e-note { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.edu-item .e-note .pill { display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin: 4px 6px 0 0; }

.awards-list { display: grid; gap: 10px; }
.award {
  display: flex; gap: 14px; align-items: baseline; padding: 12px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  transition: border-color .2s ease;
}
.award { transition: border-color .2s ease, transform .2s ease; }
.award:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.award .a-yr { flex: none; font-family: var(--display); font-size: 13px; font-weight: 700; color: var(--accent); }
.award b { font-family: var(--display); font-size: 14.5px; color: var(--heading); display: block; line-height: 1.3; }
.award span { font-size: 13px; color: var(--muted); }

/* ----- Writing ------------------------------------------------------------ */
.blog-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.blog-card {
  display: flex; flex-direction: column; gap: 12px; padding: 24px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
  transition: border-color .2s ease, transform .2s ease;
}
.blog-card:hover { border-color: var(--accent); transform: translateY(-4px); }
.blog-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.blog-card--featured { grid-column: 1 / -1; border-color: var(--border-strong); }
.blog-meta { display: flex; align-items: center; gap: 12px; }
.blog-cat { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); }
.blog-date { font-size: 13px; color: var(--faint); }
.blog-card h3 { font-size: 19px; line-height: 1.3; }
.blog-card--featured h3 { font-size: 22px; }
.blog-card .read { margin-top: auto; font-family: var(--display); font-size: 14px; font-weight: 600; color: var(--text); display: inline-flex; align-items: center; gap: 6px; transition: color .2s ease; }
.blog-card:hover .read { color: var(--accent); }
.blog-card .read svg { width: 15px; height: 15px; }

/* ----- Testimonials ------------------------------------------------------ */
.quote-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.quote-card {
  padding: 26px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface);
}
.quote-card p { font-size: 15.5px; color: var(--text); margin-bottom: 20px; }
.quote-card p::before { content: "“"; color: var(--accent); font-family: Georgia, serif; font-size: 1.4em; line-height: 0; margin-right: 2px; }
.quote-card p::after { content: "”"; color: var(--accent); font-family: Georgia, serif; font-size: 1.4em; line-height: 0; margin-left: 2px; }
.quote-who { display: flex; align-items: center; gap: 13px; }
.quote-who .av { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; color: var(--accent-ink); font-family: var(--display); font-weight: 700; font-size: 16px; }
.quote-who b { font-family: var(--display); font-size: 15px; color: var(--heading); display: block; }
.quote-who span { font-size: 13px; color: var(--muted); }

/* ----- CV banner --------------------------------------------------------- */
.cv-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px;
  padding: 34px 38px; border-radius: var(--radius); position: relative; overflow: hidden;
  border: 1px solid var(--border-strong);
  background: var(--accent-soft);
}
.cv-banner h3 { font-size: clamp(21px, 3vw, 27px); margin-bottom: 8px; }
.cv-banner p { color: var(--muted); max-width: 480px; }

/* ----- Contact ----------------------------------------------------------- */
.contact-grid { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 44px; }
.contact-info .ci { display: flex; gap: 15px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); }
.contact-info .ci:last-child { border-bottom: none; }
.contact-info .ci-ico { flex: none; width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--accent); }
.contact-info .ci-ico svg { width: 19px; height: 19px; }
.contact-info .ci small { display: block; font-size: 12.5px; color: var(--faint); letter-spacing: .04em; text-transform: uppercase; }
.contact-info .ci a, .contact-info .ci b { font-size: 15.5px; color: var(--text); font-weight: 500; transition: color .2s ease; }
.contact-info .ci a:hover { color: var(--accent); }
.ci-copy {
  margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border);
  font-family: var(--display); font-size: 12.5px; font-weight: 600; color: var(--muted);
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.ci-copy:hover { color: var(--accent); border-color: var(--accent); }
.ci-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ci-copy svg { width: 15px; height: 15px; }
.ci-copy .ci-check-ico, .ci-copy .ci-copied { display: none; }
.ci-copy.copied { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.ci-copy.copied .ci-copy-ico, .ci-copy.copied .ci-copy-label { display: none; }
.ci-copy.copied .ci-check-ico, .ci-copy.copied .ci-copied { display: inline; }

.contact-form { padding: 28px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 7px; font-family: var(--display); }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); font: inherit; font-size: 15px;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.field textarea { resize: vertical; min-height: 110px; }
.form-note { font-size: 13px; color: var(--faint); margin-top: 12px; }

/* ----- Footer ------------------------------------------------------------ */
.footer { border-top: 1px solid var(--border); padding: 44px 0 32px; background: var(--bg-2); }
.footer-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 28px; margin-bottom: 28px; }
.footer-brand { max-width: 340px; }
.footer-brand .brand { margin-bottom: 14px; }
.footer-brand p { font-size: 14px; color: var(--muted); }
.footer-cols { display: flex; gap: 56px; flex-wrap: wrap; }
.footer-col h5 { font-family: var(--display); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-bottom: 14px; }
.footer-col a { display: block; font-size: 14.5px; color: var(--muted); padding: 5px 0; transition: color .2s ease; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding-top: 24px; border-top: 1px solid var(--border); }
.footer-bottom p { font-size: 13.5px; color: var(--faint); }
.footer-social { display: flex; gap: 10px; }
.footer-social a { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; border: 1px solid var(--border); color: var(--muted); transition: color .2s ease, border-color .2s ease; }
.footer-social a:hover { color: var(--accent); border-color: var(--accent); }
.footer-social svg { width: 18px; height: 18px; }

/* ----- Scroll reveal ----------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .55s ease, transform .55s ease; }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: .07s; }
.reveal[data-delay="2"] { transition-delay: .14s; }
.reveal[data-delay="3"] { transition-delay: .21s; }

/* back to top — sits above the chat launcher */
.to-top {
  position: fixed; right: 24px; bottom: 92px; z-index: 90; width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--heading);
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm); opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top svg { width: 19px; height: 19px; }

/* ----- Ask my AI chat widget --------------------------------------------- */
.chat-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 95;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 20px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--display); font-weight: 600; font-size: 15px;
  box-shadow: var(--shadow);
  transition: opacity .2s ease;
}
.chat-fab:hover { opacity: .9; }
.chat-fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.chat-fab svg { width: 18px; height: 18px; }
.chat-fab[aria-expanded="true"] { display: none; }

.chat-panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 96;
  width: min(380px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 48px) - env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column;
  border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--bg-2); box-shadow: var(--shadow);
  overflow: hidden;
}
.chat-panel[hidden] { display: none; }

.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.chat-head b { font-family: var(--display); font-size: 16px; color: var(--heading); display: block; line-height: 1.25; }
.chat-head span { font-size: 12.5px; color: var(--muted); }
.chat-close { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); transition: color .2s ease, background .2s ease; }
.chat-close:hover { color: var(--heading); background: var(--surface-2); }
.chat-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chat-close svg { width: 16px; height: 16px; }

.chat-log { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.chat-msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; white-space: pre-line; animation: chat-msg-in .25s ease both; }
.chat-msg.bot { align-self: flex-start; background: var(--surface-2); color: var(--text); border-bottom-left-radius: 4px; }
.chat-msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
@keyframes chat-msg-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.chat-typing { display: inline-flex; align-items: center; gap: 4px; padding: 3px 0; }
.chat-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: chat-typing 1.2s infinite ease-in-out; }
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes chat-typing { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .chat-msg { animation: none; }
  .chat-typing span { animation: none; opacity: .6; }
}

.chat-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 12px; }
.chat-chips button {
  font-size: 12.5px; font-weight: 500; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: border-color .2s ease, color .2s ease;
}
.chat-chips button:hover { border-color: var(--accent); color: var(--accent); }
.chat-chips button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.chat-form { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
.chat-form input {
  flex: 1; padding: 11px 13px; border-radius: var(--radius-sm); font: inherit; font-size: 14px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
}
.chat-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.chat-form button {
  flex: none; width: 42px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center;
  transition: opacity .2s ease;
}
.chat-form button:hover { opacity: .88; }
.chat-form button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chat-form button svg { width: 16px; height: 16px; }

.chat-note { font-size: 11.5px; color: var(--faint); text-align: center; padding: 0 18px 12px; }

/* ----- Glassmorphism (Apple/CRED-inspired, restrained) ------------------- */
/* frosted look on all surface cards (translucency + top-edge highlight + lift) */
.proj-tab, .proj-panel, .job-card, .award, .quote-card, .cv-banner,
.blog-card, .contact-form {
  background-color: var(--glass);
  background-image: none;
  border-color: var(--glass-border);
  box-shadow: var(--glass-hi), var(--glass-shadow);
}
/* real backdrop blur reserved for overlays + controls (keeps perf high) */
.proj-panel, .contact-form, .cv-banner,
.status-pill, .btn-ghost, .icon-btn, .career-arrow, .to-top {
  -webkit-backdrop-filter: blur(13px) saturate(125%);
  backdrop-filter: blur(13px) saturate(125%);
}
.status-pill, .btn-ghost, .icon-btn, .career-arrow, .to-top {
  background-color: var(--glass);
  border-color: var(--glass-border);
  box-shadow: var(--glass-hi);
}
.chat-panel {
  background: color-mix(in srgb, var(--bg-2) 78%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  box-shadow: var(--glass-hi), var(--shadow);
}
/* subtle ambient light pools so the frost has depth to pick up */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(60% 50% at 82% -6%, rgba(255,255,255,0.05), transparent 62%),
    radial-gradient(52% 44% at 4% 104%, rgba(255,255,255,0.035), transparent 62%);
}
[data-theme="light"] body::before {
  background:
    radial-gradient(60% 50% at 82% -6%, rgba(60,90,160,0.06), transparent 62%),
    radial-gradient(52% 44% at 4% 104%, rgba(60,90,160,0.045), transparent 62%);
}
/* legibility fallback where backdrop-filter is unsupported */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .chat-panel { background: var(--bg-2); }
}

/* CRED/Apple sheen refinements — dark-theme only, no new backdrop-filter blur.
   A & B add a top specular light-catch (layered background-image over the
   already-frosted --glass surface); C adds a tactile hover lift. */
/* A — hero status pill: faint specular top-light (dot color left untouched) */
[data-theme="dark"] .status-pill {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 58%);
  box-shadow: var(--glass-hi), 0 6px 18px -10px rgba(0, 0, 0, 0.5);
}
/* B — AI Projects detail panel: light-catch sheen + deeper lift */
[data-theme="dark"] .proj-panel {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 38%);
  box-shadow: var(--glass-hi), 0 22px 50px -24px rgba(0, 0, 0, 0.62);
}
/* C — testimonial + job cards: tactile hover (transform/shadow only, GPU-cheap) */
[data-theme="dark"] .quote-card { transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease; }
[data-theme="dark"] .quote-card:hover,
[data-theme="dark"] .job-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow: var(--glass-hi), 0 18px 40px -22px rgba(0, 0, 0, 0.55);
}

/* ----- Responsive -------------------------------------------------------- */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 44px; }
  .hero-photo { order: -1; }
  .hero-net { right: -200px; opacity: .3; }
  .about-grid { grid-template-columns: 1fr; gap: 56px; }
  .proj-explorer { grid-template-columns: 1fr; gap: 16px; }
  .split { grid-template-columns: 1fr; gap: 48px; }
  .contact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .section { padding: 68px 0; }
  .nav-links { position: fixed; inset: 70px 0 auto 0; flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--bg-2); border-bottom: 1px solid var(--border); padding: 14px 20px 22px;
    transform: translateY(-130%); transition: transform .3s ease; box-shadow: var(--shadow); }
  .nav-links.open { transform: none; }
  .nav-links a { padding: 13px 14px; font-size: 16px; }
  .nav-links a.active::after { display: none; }
  .nav-toggle { display: grid; }
  .nav-actions .nav-cta { display: none; }
  .brand span { white-space: nowrap; }
  .brand { font-size: 16px; }
  .hero { padding-top: 120px; }
  .hero-net { display: none; }
  .hero-stats { grid-template-columns: 1fr 1fr; gap: 24px 18px; }
  .blog-grid, .quote-grid { grid-template-columns: 1fr; }
  .cv-banner { padding: 28px 24px; }
  .footer-top { flex-direction: column; }
  .to-top { right: 18px; bottom: 86px; }
  .chat-fab { right: 18px; bottom: 18px; }
  .chat-panel { right: 16px; bottom: 16px; }
}
@media (max-width: 420px) {
  .hero-stats { grid-template-columns: 1fr 1fr; }
}
