/* =========================================================
   Jaymin Khatri — Portfolio
   Tech-forward · minimal · elegant
   ========================================================= */

/* ---------- Self-hosted fonts (no external dependency) ---------- */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("assets/fonts/space-grotesk.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("assets/fonts/inter.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("assets/fonts/jetbrains-mono.woff2") format("woff2");
}

/* ---------- Design tokens ---------- */
:root {
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Light theme */
  --bg: #fafaf8;
  --bg-alt: #f2f2ee;
  --surface: #ffffff;
  --surface-2: #f7f7f4;
  --text: #0a0a0b;
  --text-soft: #54565f;
  --text-faint: #8a8c95;
  --border: rgba(10, 10, 11, 0.10);
  --border-strong: rgba(10, 10, 11, 0.16);
  --accent: #2f5bff;
  --accent-strong: #1d44e6;
  --accent-soft: rgba(47, 91, 255, 0.10);
  --shadow-sm: 0 1px 2px rgba(10, 10, 11, 0.04), 0 1px 1px rgba(10, 10, 11, 0.03);
  --shadow-md: 0 10px 30px -12px rgba(10, 10, 11, 0.18);
  --shadow-lg: 0 30px 60px -20px rgba(10, 10, 11, 0.22);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --container: 1140px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="dark"] {
  --bg: #0a0c11;
  --bg-alt: #0e1017;
  --surface: #12141c;
  --surface-2: #171a23;
  --text: #f3f4f7;
  --text-soft: #a6abb8;
  --text-faint: #6b7180;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --accent: #6e8dff;
  --accent-strong: #8aa3ff;
  --accent-soft: rgba(110, 141, 255, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, 0.7);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

img, svg { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.08; letter-spacing: -0.02em; }

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

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

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 2.5rem);
}

.mono { font-family: var(--font-mono); font-weight: 500; }
.muted { color: var(--text-soft); }
.accent-text { color: var(--accent); }

.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.skip-link {
  position: absolute; left: 50%; transform: translateX(-50%) translateY(-150%);
  top: 12px; z-index: 200; background: var(--text); color: var(--bg);
  padding: 0.6rem 1rem; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 600;
  transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: translateX(-50%) translateY(0); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-body); font-weight: 600; font-size: 0.95rem;
  padding: 0.8rem 1.3rem; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; white-space: nowrap;
  transition: transform 0.25s var(--ease), background-color 0.25s var(--ease),
    border-color 0.25s var(--ease), color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.btn .icon { width: 18px; height: 18px; }
.btn-sm { padding: 0.5rem 0.9rem; font-size: 0.875rem; }

.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-primary:hover .icon { transform: translateX(3px); transition: transform 0.25s var(--ease); }

.btn-outline { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); border-color: var(--text); transform: translateY(-2px); }

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

/* ---------- Icon button ---------- */
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 50%; border: 1px solid var(--border); background: transparent;
  color: var(--text); cursor: pointer;
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease), backdrop-filter 0.3s var(--ease);
  border-bottom: 1px solid transparent;
}
.site-header.scrolled {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom-color: var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 1rem; }

.brand { display: inline-flex; align-items: center; gap: 0.65rem; font-weight: 600; }
.brand-mark {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  background: var(--text); color: var(--bg); border-radius: 10px;
  font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; letter-spacing: -0.03em;
}
.brand-name { font-family: var(--font-display); letter-spacing: -0.02em; font-size: 1.05rem; }

.nav-links { display: flex; align-items: center; gap: 0.35rem; }
.nav-link {
  position: relative; padding: 0.5rem 0.85rem; border-radius: 999px;
  font-size: 0.92rem; font-weight: 500; color: var(--text-soft);
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--text); background: var(--surface-2); }

.nav-actions { display: flex; align-items: center; gap: 0.6rem; }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
.menu-toggle { display: none; }

/* ---------- Mobile menu ---------- */
.mobile-menu {
  position: fixed; inset: 0; z-index: 150; background: var(--bg);
  display: flex; flex-direction: column; padding-bottom: 2rem;
  animation: menuIn 0.3s var(--ease);
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.mobile-menu[hidden] { display: none; }
.mobile-menu-head { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.mobile-links { display: flex; flex-direction: column; padding: 1rem clamp(1.25rem, 5vw, 2.5rem); gap: 0.25rem; flex: 1; }
.mobile-links a {
  display: flex; align-items: baseline; gap: 1rem; padding: 1rem 0.5rem;
  font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em;
  border-bottom: 1px solid var(--border);
}
.mobile-links a .mono { font-size: 0.85rem; color: var(--accent); font-family: var(--font-mono); }
.mobile-cv { margin: 0 clamp(1.25rem, 5vw, 2.5rem); justify-content: center; }

/* ---------- Hero ---------- */
.hero { position: relative; padding-top: clamp(3rem, 8vw, 6rem); padding-bottom: clamp(3rem, 7vw, 5rem); overflow: hidden; }
.hero-inner {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: clamp(2rem, 5vw, 4rem); align-items: center;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-family: var(--font-mono); font-size: 0.8rem; font-weight: 500; letter-spacing: 0.02em;
  color: var(--text-soft); padding: 0.4rem 0.85rem; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); margin-bottom: 1.5rem;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.hero-title { font-size: clamp(2.4rem, 6vw, 4rem); margin-bottom: 1.4rem; max-width: 16ch; }
.hero-lead { font-size: clamp(1.02rem, 1.6vw, 1.2rem); color: var(--text-soft); max-width: 52ch; }
.hero-lead strong { color: var(--text); font-weight: 600; }

.hero-cta { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 2rem; }

.hero-status {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.55rem;
  margin-top: 2rem; font-size: 0.9rem; color: var(--text-soft);
}
.hero-status .icon { width: 16px; height: 16px; color: var(--text-faint); }
.hero-status .sep { color: var(--text-faint); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,0.18); }

/* Hero visual card */
.hero-visual { display: flex; justify-content: center; }
.viz-card {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.4rem; box-shadow: var(--shadow-lg);
  position: relative; overflow: hidden;
}
.viz-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: linear-gradient(140deg, var(--accent-soft), transparent 40%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.viz-head { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; margin-bottom: 1.2rem; }
.viz-label { font-size: 0.78rem; color: var(--text-soft); }
.viz-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 600;
}
.viz-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,0.14);
}
.viz-focus {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
}
.viz-focus-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 14px;
  color: var(--accent);
  background: var(--accent-soft);
}
.viz-focus-icon .icon { width: 22px; height: 22px; }
.viz-kicker {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--text-faint);
  font-size: 0.68rem;
}
.viz-title {
  display: block;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.1;
}
.viz-modules {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0.9rem 0;
}
.viz-module {
  display: grid;
  gap: 0.35rem;
  min-height: 108px;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.viz-module .icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
}
.viz-module span {
  color: var(--text);
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1.15;
}
.viz-module small {
  color: var(--text-soft);
  font-size: 0.68rem;
  line-height: 1.2;
}
/* ---------- Proof band ---------- */
.stats { border-block: 1px solid var(--border); background: var(--surface); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat {
  display: grid;
  align-content: start;
  gap: 0.45rem;
  min-height: 188px;
  padding: clamp(1.5rem, 3vw, 2.1rem) 1.35rem;
  text-align: left;
  border-right: 1px solid var(--border);
}
.stat:last-child { border-right: none; }
.stat-num { display: block; font-family: var(--font-display); font-weight: 700; font-size: clamp(2.2rem, 4vw, 3rem); letter-spacing: -0.03em; color: var(--text); line-height: 1; }
.stat-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  margin-bottom: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
}
.stat-icon .icon { width: 18px; height: 18px; }
.stat-kicker {
  color: var(--text-faint);
  font-size: 0.68rem;
}
.stat-title {
  display: block;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.15;
}
.stat-label { display: block; color: var(--text-soft); font-size: 0.78rem; line-height: 1.45; }

/* ---------- Sections ---------- */
.section { padding-block: clamp(4.5rem, 10vw, 8rem); }
.section-alt { background: var(--bg-alt); }
.section-head { margin-bottom: clamp(2.5rem, 5vw, 3.5rem); max-width: 640px; }
.section-eyebrow { display: block; font-size: 0.82rem; color: var(--accent); margin-bottom: 0.9rem; letter-spacing: 0.04em; }
.section-title { font-size: clamp(1.8rem, 4vw, 2.7rem); }

/* About */
.about-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.about-copy p { font-size: clamp(1.02rem, 1.4vw, 1.15rem); color: var(--text-soft); }
.about-copy p + p { margin-top: 1.2rem; }
.about-copy strong { color: var(--text); font-weight: 600; }
.focus-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.focus-list li {
  display: flex; align-items: center; gap: 0.85rem; padding: 1rem 1.2rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  font-weight: 500; font-size: 0.98rem;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease);
}
.focus-list li:hover { transform: translateX(4px); border-color: var(--border-strong); }
.focus-list .icon { width: 20px; height: 20px; color: var(--accent); flex-shrink: 0; }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.skill-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.6rem; transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.skill-card:hover { transform: translateY(-6px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.skill-icon {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 1.1rem;
}
.skill-icon .icon { width: 22px; height: 22px; }
.skill-card h3 { font-size: 1.18rem; margin-bottom: 0.4rem; }
.skill-card .muted { font-size: 0.9rem; margin-bottom: 1.1rem; }
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chips li {
  font-family: var(--font-mono); font-size: 0.78rem; padding: 0.32rem 0.7rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text-soft);
}

/* Timeline */
.timeline { list-style: none; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 19px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.tl-item { position: relative; display: grid; grid-template-columns: 40px 1fr; gap: 1.5rem; padding-bottom: 2.5rem; }
.tl-item:last-child { padding-bottom: 0; }
.tl-marker {
  position: relative; z-index: 1; display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 50%; background: var(--surface); border: 1px solid var(--border-strong); color: var(--accent);
}
.tl-marker .icon { width: 18px; height: 18px; }
.tl-body { padding-top: 0.3rem; }
.tl-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.tl-body h3 { font-size: 1.3rem; }
.tl-date { font-size: 0.82rem; color: var(--text-faint); white-space: nowrap; }
.tl-org { color: var(--accent); font-weight: 500; font-size: 0.95rem; margin: 0.2rem 0 0.9rem; }
.tl-points { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.tl-points li { position: relative; padding-left: 1.4rem; color: var(--text-soft); font-size: 0.98rem; }
.tl-points li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: 0.6; }
.tl-points strong { color: var(--text); font-weight: 600; }

/* Certifications */
.cert-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.cert-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; display: flex; flex-direction: column; gap: 0.9rem;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.cert-card:hover { transform: translateY(-5px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.cert-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.cert-icon .icon { width: 20px; height: 20px; }
.cert-card h3 { font-size: 1.05rem; line-height: 1.3; flex: 1; }
.cert-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.85rem; color: var(--text-soft); }
.cert-meta .mono { font-size: 0.78rem; color: var(--text-faint); }

/* Education */
.edu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.edu-card {
  display: flex; gap: 1.2rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.8rem;
}
.edu-next { background: var(--surface-2); border-style: dashed; }
.edu-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.edu-icon .icon { width: 22px; height: 22px; }
.edu-card h3 { font-size: 1.25rem; }
.edu-detail { font-size: 0.95rem; color: var(--text-soft); margin-top: 0.5rem; }
.edu-detail strong { color: var(--text); font-weight: 600; }

/* Contact */
.section-contact { padding-block: clamp(4.5rem, 10vw, 8rem); }
.contact-inner { text-align: center; max-width: 760px; margin-inline: auto; }
.contact-inner .section-eyebrow { display: inline-block; }
.contact-title { font-size: clamp(2rem, 5vw, 3.2rem); margin-bottom: 1rem; }
.contact-lead { font-size: clamp(1.02rem, 1.5vw, 1.15rem); color: var(--text-soft); max-width: 48ch; margin: 0 auto 2.8rem; }
.contact-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; text-align: left; }
.contact-card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem; transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.contact-card-link:hover { transform: translateY(-5px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.contact-card-head { display: flex; align-items: center; gap: 0.55rem; color: var(--text-soft); font-size: 0.85rem; font-weight: 500; margin-bottom: 0.7rem; }
.contact-card-head .icon { width: 18px; height: 18px; color: var(--accent); }
.contact-value { display: block; font-weight: 500; font-size: 0.95rem; word-break: break-word; }
a.contact-value:hover { color: var(--accent); }
.contact-go { width: 18px; height: 18px; color: var(--text-faint); position: absolute; top: 1.4rem; right: 1.4rem; transition: transform 0.25s var(--ease), color 0.25s var(--ease); }
.contact-card-link:hover .contact-go { transform: translate(2px, -2px); color: var(--accent); }
.copy-btn {
  position: absolute; top: 1.1rem; right: 1.1rem; width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--text-soft); cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.copy-btn:hover { color: var(--text); border-color: var(--border-strong); }
.copy-btn .icon { width: 16px; height: 16px; }
.copy-btn .icon-check { display: none; color: #22c55e; }
.copy-btn.copied .icon-copy { display: none; }
.copy-btn.copied .icon-check { display: block; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding-block: 2.5rem; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem; }
.footer-brand { display: flex; align-items: center; gap: 0.8rem; }
.footer-name { font-family: var(--font-display); font-weight: 600; }
.footer-tag { font-size: 0.85rem; }
.footer-links { display: flex; gap: 1.4rem; }
.footer-links a { font-size: 0.92rem; color: var(--text-soft); transition: color 0.2s var(--ease); }
.footer-links a:hover { color: var(--text); }
.footer-meta { font-size: 0.85rem; }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; bottom: 1.6rem; right: 1.6rem; z-index: 90; width: 46px; height: 46px;
  display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; box-shadow: var(--shadow-md);
  opacity: 0; transform: translateY(12px); transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), background-color 0.2s var(--ease);
}
.to-top.show { opacity: 1; transform: none; }
.to-top:hover { background: var(--surface-2); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 1.6rem; left: 50%; transform: translateX(-50%) translateY(20px);
  z-index: 200; background: var(--text); color: var(--bg); padding: 0.7rem 1.2rem;
  border-radius: 999px; font-size: 0.9rem; font-weight: 500; box-shadow: var(--shadow-lg);
  opacity: 0; transition: opacity 0.3s var(--ease), transform 0.3s var(--ease); pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Section sub ---------- */
.section-sub { font-size: clamp(1rem, 1.4vw, 1.12rem); color: var(--text-soft); margin-top: 0.9rem; max-width: 54ch; }

/* ---------- Projects ---------- */
.project-featured {
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: clamp(1.6rem, 4vw, 2.8rem); margin-bottom: 1.25rem;
}
.project-badges { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.project-tag {
  font-size: 0.72rem; padding: 0.3rem 0.62rem; border: 1px solid var(--border);
  border-radius: 7px; background: var(--surface-2); color: var(--text-soft); letter-spacing: 0.02em;
}
.badge { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; font-weight: 600; padding: 0.3rem 0.62rem; border-radius: 999px; }
.badge .icon { width: 13px; height: 13px; }
.badge-star { background: var(--accent-soft); color: var(--accent); }
.badge-progress { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
html[data-theme="dark"] .badge-progress { color: #4ade80; background: rgba(74, 222, 128, 0.12); }
.badge-progress .pulse { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.project-title { font-size: clamp(1.4rem, 2.6vw, 1.95rem); margin-bottom: 0.8rem; }
.project-title.sm { font-size: 1.25rem; margin-bottom: 0.6rem; }
.project-desc { color: var(--text-soft); font-size: 0.97rem; }
.project-features { list-style: none; padding: 0; margin: 1.3rem 0; display: flex; flex-direction: column; gap: 0.6rem; }
.project-features li { display: flex; align-items: center; gap: 0.6rem; font-size: 0.93rem; }
.project-features .icon { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }
.project-takeaway { font-size: 0.92rem; color: var(--text-soft); border-left: 2px solid var(--accent); padding-left: 1.1rem; }
.project-takeaway .mono { display: block; font-size: 0.74rem; margin-bottom: 0.35rem; }
.project-visual { display: flex; align-items: center; min-width: 0; }

.projects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.project-card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.project-card:hover { transform: translateY(-6px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.project-card .browser, .project-card .terminal, .project-card .code-window { border-radius: 0; border-left: none; border-right: none; border-top: none; box-shadow: none; }
.project-card-body { padding: 1.5rem; }

/* Terminal / browser / code window shells */
.terminal, .browser, .code-window { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-md); width: 100%; }
.term-bar, .browser-bar { display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem 0.9rem; }
.term-dots { display: inline-flex; gap: 6px; flex-shrink: 0; }
.term-dots i { width: 11px; height: 11px; border-radius: 50%; }
.term-dots i:nth-child(1) { background: #ff5f57; }
.term-dots i:nth-child(2) { background: #febc2e; }
.term-dots i:nth-child(3) { background: #28c840; }

/* Terminal (always dark) */
.terminal { background: #0c0f16; border-color: rgba(255, 255, 255, 0.09); }
.terminal .term-bar { background: rgba(255, 255, 255, 0.04); border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.term-title { font-size: 0.74rem; color: rgba(255, 255, 255, 0.5); }
.term-body { padding: 1.1rem 1.2rem; font-size: 0.8rem; line-height: 1.7; color: #cdd3e0; }
.term-line { white-space: pre-wrap; margin: 0; }
.term-prompt { color: var(--accent); }
.term-dim { color: rgba(205, 211, 224, 0.5); }
.term-ok { color: #4ade80; }
.seat-map { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 0.6rem 0; max-width: 240px; }
.seat { text-align: center; font-size: 0.68rem; padding: 0.32rem 0; border-radius: 5px; background: rgba(255, 255, 255, 0.09); color: rgba(255, 255, 255, 0.72); }
.seat.taken { background: rgba(255, 255, 255, 0.035); color: rgba(255, 255, 255, 0.25); text-decoration: line-through; }
.seat.sel { background: var(--accent); color: #fff; }
.cursor { display: inline-block; width: 8px; height: 1em; background: #4ade80; margin-left: 5px; vertical-align: text-bottom; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Browser (themed) */
.browser { background: var(--bg-alt); }
.browser .browser-bar { background: var(--surface); border-bottom: 1px solid var(--border); }
.browser-url { font-size: 0.72rem; color: var(--text-faint); background: var(--surface-2); padding: 0.28rem 0.7rem; border-radius: 999px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.browser-tabs { display: flex; gap: 0.3rem; padding: 0.6rem 0.9rem 0; background: var(--surface); }
.bw-tab { font-size: 0.72rem; padding: 0.4rem 0.75rem; border-radius: 8px 8px 0 0; color: var(--text-faint); background: var(--surface-2); }
.bw-tab.active { color: var(--text); background: var(--bg-alt); font-weight: 500; }
.browser-body { padding: 1.1rem; display: flex; flex-direction: column; gap: 0.7rem; }
.bw-h { height: 10px; width: 45%; border-radius: 5px; background: var(--border-strong); }
.bw-row { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; padding: 0.65rem 0.8rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.bw-cell { height: 8px; border-radius: 4px; background: var(--border-strong); opacity: 0.7; }
.bw-cell.w-lg { width: 60%; }
.bw-cell.w-md { width: 42%; }
.bw-pill { font-size: 0.62rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 0.22rem 0.5rem; border-radius: 999px; flex-shrink: 0; }

/* HTML website preview card */
.html-preview {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
  min-height: 232px;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 18%, transparent), transparent 42%),
    linear-gradient(145deg, var(--surface), var(--surface-2));
  border-bottom: 1px solid var(--border);
}
.html-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  color: var(--text-soft);
  font-size: 0.72rem;
}
.html-preview-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  color: var(--text-soft);
  font-weight: 600;
}
.html-preview-head .icon {
  width: 15px;
  height: 15px;
  color: var(--accent);
}
.html-preview-main {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.html-outcome-card {
  display: grid;
  gap: 0.8rem;
  padding: 1rem;
}
.html-outcome-kicker {
  color: var(--text-faint);
  font-size: 0.68rem;
}
.html-outcome-card strong {
  max-width: 20ch;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.22rem;
  line-height: 1.15;
}
.html-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}
.html-flow span {
  display: block;
  padding: 0.55rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}
.html-preview-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.html-preview-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 500;
}
.html-preview-list li span {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

/* Code window (always dark) */
.code-window { background: #0c0f16; border-color: rgba(255, 255, 255, 0.09); }
.code-window .browser-bar { background: rgba(255, 255, 255, 0.04); border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.code-window .browser-url { color: rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.06); flex: 0 1 auto; }
.code-body { margin: 0; padding: 1.1rem 1.2rem; font-size: 0.8rem; line-height: 1.75; color: #cdd3e0; white-space: pre; overflow-x: auto; }
.code-body .cl { display: block; }
.tok-com { color: #6b7280; }
.tok-kw { color: #c084fc; }
.tok-str { color: #86efac; }
.tok-fn { color: #60a5fa; }

/* Certifications description */
.cert-card h3 { flex: 0 0 auto; }
.cert-desc { font-size: 0.86rem; line-height: 1.5; color: var(--text-soft); flex: 1; }

/* ---------- Leadership ---------- */
.lead-panel {
  position: relative; display: grid; grid-template-columns: 1fr auto; gap: clamp(2rem, 5vw, 4rem);
  align-items: center; overflow: hidden; background: var(--text); color: var(--bg);
  border-radius: var(--radius-lg); padding: clamp(2rem, 5vw, 3.6rem);
}
.lead-glow { position: absolute; top: -45%; right: -8%; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, var(--accent), transparent 70%); opacity: 0.4; pointer-events: none; }
.lead-content { position: relative; z-index: 1; max-width: 580px; }
.lead-panel .section-eyebrow { color: var(--accent); }
.lead-title { font-size: clamp(1.7rem, 3.5vw, 2.4rem); margin-bottom: 1rem; }
.lead-text { color: color-mix(in srgb, var(--bg) 72%, var(--text)); font-size: 0.99rem; }
.lead-text strong { color: var(--bg); font-weight: 600; }
.lead-tags { list-style: none; padding: 0; margin-top: 1.6rem; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.lead-tags li {
  display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.85rem; font-weight: 500;
  padding: 0.45rem 0.85rem; border-radius: 999px; color: var(--bg);
  background: color-mix(in srgb, var(--bg) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--bg) 20%, transparent);
}
.lead-tags .icon { width: 16px; height: 16px; color: var(--accent); }
.lead-stat { position: relative; z-index: 1; text-align: center; padding-left: clamp(2rem, 5vw, 4rem); border-left: 1px solid color-mix(in srgb, var(--bg) 18%, transparent); }
.lead-stat-num { display: block; font-family: var(--font-display); font-weight: 700; font-size: clamp(4rem, 9vw, 6rem); line-height: 1; color: var(--bg); letter-spacing: -0.04em; }
.lead-stat-label { display: block; margin-top: 0.5rem; font-size: 0.85rem; color: color-mix(in srgb, var(--bg) 65%, var(--text)); max-width: 14ch; margin-inline: auto; }

/* ---------- Robustness ---------- */
h1, h2, h3, p { overflow-wrap: break-word; }

/* ---------- Experience filters ---------- */
.exp-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2.6rem; }
.exp-filter {
  font-family: var(--font-body); font-size: 0.88rem; font-weight: 500; padding: 0.5rem 1.05rem;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
  cursor: pointer; transition: background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.exp-filter:hover { border-color: var(--border-strong); color: var(--text); }
.exp-filter.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.tl-item { transition: opacity 0.3s var(--ease); }
.tl-item.is-hidden { display: none; }

/* ---------- Contact form ---------- */
.contact-cards-2 { grid-template-columns: repeat(2, 1fr); max-width: 620px; margin-inline: auto; }
.contact-form { max-width: 620px; margin: 1.6rem auto 0; text-align: left; display: flex; flex-direction: column; gap: 0.9rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.field { display: flex; flex-direction: column; gap: 0.42rem; }
.field > span { font-size: 0.82rem; font-weight: 500; color: var(--text-soft); }
.field input, .field select, .field textarea {
  width: 100%; padding: 0.7rem 0.85rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-family: var(--font-body); font-size: 0.95rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field textarea { resize: vertical; min-height: 104px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-submit { align-self: flex-start; margin-top: 0.3rem; }
.form-note { font-size: 0.8rem; margin-top: 0.1rem; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .cv-btn { display: none; }
  .menu-toggle { display: inline-grid; }
  .hero-inner { grid-template-columns: 1fr; }
  .viz-card { max-width: 460px; }
  .about-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .cert-grid { grid-template-columns: repeat(2, 1fr); }
  .project-featured { grid-template-columns: 1fr; }
  .lead-panel { grid-template-columns: 1fr; gap: 2rem; }
  .lead-stat { border-left: none; padding-left: 0; text-align: left; display: flex; align-items: baseline; gap: 0.9rem; }
  .lead-stat-num { font-size: 3.4rem; }
  .lead-stat-label { margin: 0; max-width: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: none; }
  .stat:nth-child(1), .stat:nth-child(2) { border-bottom: 1px solid var(--border); }
}

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

@media (max-width: 600px) {
  .nav { height: 64px; }
  .brand-name { display: none; }
  .skills-grid, .cert-grid, .edu-grid, .contact-cards, .projects-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat { border-right: none; border-bottom: 1px solid var(--border); }
  .stat:last-child { border-bottom: none; }
  .tl-item { gap: 1rem; grid-template-columns: 36px 1fr; }
  .tl-marker { width: 36px; height: 36px; }
  .timeline::before { left: 17px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .to-top { bottom: 1rem; right: 1rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .reveal { opacity: 1; transform: none; }
}
