/* ==========================================================================
   Kushal Shah, personal site
   Dark-first design with a light theme. No build step.
   ========================================================================== */

:root {
  --bg: #0a0c11;
  --bg-soft: #0e1118;
  --surface: #121620;
  --surface-2: #171c28;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e7e9ef;
  --muted: #9aa3b5;
  --faint: #6b7385;
  --accent: #8b93ff;
  --accent-2: #2dd4bf;
  --accent-ink: #0a0c11;
  --glow: rgba(139, 147, 255, 0.22);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1120px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --card-shadow: none;
  --tint-1: rgba(139, 147, 255, 0.20);
  --tint-2: rgba(45, 212, 191, 0.08);
  --grad-a: var(--accent);
  --grad-b: var(--accent-2);
  --header-bg: rgba(10, 12, 17, 0.72);
  --dot: rgba(255, 255, 255, 0.045);
  --tag-bg: var(--surface-2);
  --tag-text: var(--muted);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f6fa;
    --bg-soft: #ffffff;
    --surface: #ffffff;
    --surface-2: #f1f3f9;
    --border: rgba(16, 24, 40, 0.08);
    --border-strong: rgba(16, 24, 40, 0.15);
    --text: #0b1220;
    --muted: #475467;
    --faint: #667085;
    --accent: #4f46e5;
    --accent-2: #0d9488;
    --accent-ink: #ffffff;
    --glow: rgba(79, 70, 229, 0.12);
    --shadow: 0 2px 4px rgba(16, 24, 40, 0.05), 0 14px 32px rgba(16, 24, 40, 0.09);
    --card-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 14px rgba(16, 24, 40, 0.05);
    --tint-1: rgba(99, 102, 241, 0.13);
    --tint-2: rgba(20, 184, 166, 0.10);
    --grad-a: #4338ca;
    --grad-b: #0f766e;
    --header-bg: rgba(255, 255, 255, 0.78);
    --dot: rgba(16, 24, 40, 0.07);
    --tag-bg: #f1f3f9;
    --tag-text: #344054;
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --bg: #f5f6fa;
  --bg-soft: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --border: rgba(16, 24, 40, 0.08);
  --border-strong: rgba(16, 24, 40, 0.15);
  --text: #0b1220;
  --muted: #475467;
  --faint: #667085;
  --accent: #4f46e5;
  --accent-2: #0d9488;
  --accent-ink: #ffffff;
  --glow: rgba(79, 70, 229, 0.12);
  --shadow: 0 2px 4px rgba(16, 24, 40, 0.05), 0 14px 32px rgba(16, 24, 40, 0.09);
  --card-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 14px rgba(16, 24, 40, 0.05);
  --tint-1: rgba(99, 102, 241, 0.13);
  --tint-2: rgba(20, 184, 166, 0.10);
  --grad-a: #4338ca;
  --grad-b: #0f766e;
  --header-bg: rgba(255, 255, 255, 0.78);
  --dot: rgba(16, 24, 40, 0.07);
  --tag-bg: #f1f3f9;
  --tag-text: #344054;
  color-scheme: light;
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 85% -10%, var(--tint-1), transparent 60%),
    radial-gradient(700px 420px at -10% 20%, var(--tint-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
strong { color: var(--text); font-weight: 600; }
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
ul { margin: 0; padding: 0; }

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

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--faint); }

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: 8px 14px; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  background: var(--header-bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.site-header.scrolled { border-bottom-color: var(--border); }

.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.brand-name { font-size: 15px; }

.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; }
.nav-links a {
  display: block; padding: 8px 12px; border-radius: 8px;
  color: var(--muted); font-size: 14px; font-weight: 500;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--surface-2); text-decoration: none; }

.nav-links a.nav-cta {
  margin-left: 6px; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.nav-links a.nav-cta:hover { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.theme-toggle {
  display: grid; place-items: center; width: 36px; height: 36px; margin-left: 6px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); cursor: pointer; font-size: 14px;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle .icon-light { display: none; }
:root[data-theme="light"] .theme-toggle .icon-light { display: inline; }
:root[data-theme="light"] .theme-toggle .icon-dark { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .icon-light { display: inline; }
  :root:not([data-theme="dark"]) .theme-toggle .icon-dark { display: none; }
}

.nav-toggle {
  display: none; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); cursor: pointer; flex-direction: column; justify-content: center; gap: 5px; padding: 0 10px;
}
.nav-toggle span { display: block; height: 2px; background: var(--text); border-radius: 2px; transition: transform 0.2s ease; }
.nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

/* ---------- Buttons, chips, tags ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 12px;
  font-size: 15px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent; transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 20px var(--glow); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--card-shadow); }
.btn-ghost:hover { border-color: var(--border-strong); }
.btn-icon { width: 44px; justify-content: center; padding: 0; background: var(--surface); color: var(--text); border-color: var(--border); font-size: 18px; box-shadow: var(--card-shadow); }
.btn-icon:hover { color: var(--accent); border-color: var(--border-strong); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; }
.tags li {
  font-family: var(--mono); font-size: 12px; line-height: 1;
  padding: 6px 9px; border-radius: 999px;
  color: var(--tag-text); background: var(--tag-bg); border: 1px solid var(--border);
}

.chip {
  font: 500 14px var(--font); color: var(--muted);
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.is-active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.5fr 1fr; align-items: center; gap: 48px;
  min-height: min(calc(100vh - 68px), 820px); padding-top: 48px; padding-bottom: 72px;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 22px;
  padding: 6px 12px 6px 10px; border-radius: 999px; font-size: 13px; font-weight: 500;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.55); } 70% { box-shadow: 0 0 0 8px rgba(45, 212, 191, 0); } 100% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0); } }

.hero h1 { font-size: clamp(34px, 4.6vw, 56px); font-weight: 800; }
.gradient-text {
  background: linear-gradient(100deg, var(--grad-a), var(--grad-b));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { font-size: 18px; color: var(--muted); max-width: 620px; margin: 22px 0 0; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 30px; list-style: none; color: var(--faint); font-size: 14px; }
.hero-meta i { color: var(--accent); margin-right: 6px; width: 14px; text-align: center; }

.hero-photo { position: relative; justify-self: center; }
.photo-ring {
  position: relative; width: min(360px, 78vw); aspect-ratio: 1; border-radius: 28px; padding: 3px;
  background: linear-gradient(140deg, var(--accent), transparent 40%, var(--accent-2));
  box-shadow: var(--shadow), 0 0 80px var(--glow);
}
.photo-ring img { width: 100%; height: 100%; object-fit: cover; border-radius: 25px; }
.code-chip {
  position: absolute; left: -36px; bottom: 26px; max-width: 320px;
  font-family: var(--mono); font-size: 12.5px; color: var(--muted);
  padding: 10px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.c-key { color: var(--accent); }
.c-str { color: var(--accent-2); }
.c-op { color: var(--faint); }

/* ---------- Sections ---------- */
.section { padding: 72px 24px; }
.section-head { margin-bottom: 40px; max-width: 760px; }
.kicker { font-family: var(--mono); font-size: 13px; color: var(--accent); margin: 0 0 10px; letter-spacing: 0.02em; }
.section h2 { font-size: clamp(28px, 3.4vw, 40px); font-weight: 750; }
.section-sub { color: var(--muted); margin: 12px 0 0; }

/* About */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: start; }
.about-copy p { color: var(--muted); font-size: 17px; margin: 0 0 16px; }
.interests-label { font-family: var(--mono); font-size: 12.5px; color: var(--faint); margin: 22px 0 10px !important; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; list-style: none; }
.stat {
  padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  display: flex; flex-direction: column; gap: 6px;
}
.stat-num { font-size: 24px; font-weight: 750; letter-spacing: -0.02em; background: linear-gradient(100deg, var(--grad-a), var(--grad-b)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-label { font-size: 13.5px; color: var(--muted); line-height: 1.45; }

/* Experience timeline */
.timeline { list-style: none; position: relative; padding: 0; margin: 0; }
.timeline::before { content: ""; position: absolute; left: 172px; top: 8px; bottom: 8px; width: 1px; background: var(--border-strong); }
.t-item { display: grid; grid-template-columns: 172px 1fr; gap: 36px; position: relative; padding-bottom: 22px; }
.t-item::before {
  content: ""; position: absolute; left: 167px; top: 26px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.t-item:first-child::before { background: var(--accent); box-shadow: 0 0 0 5px var(--glow); }
.t-meta { padding-top: 18px; text-align: right; padding-right: 8px; }
.t-date { font-family: var(--mono); font-size: 13px; color: var(--faint); white-space: nowrap; }
.t-card {
  padding: 22px 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.t-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.t-card h3 { font-size: 19px; font-weight: 700; }
.t-card h3 a { color: var(--text); }
.t-role { margin: 4px 0 14px; color: var(--accent); font-size: 14px; font-weight: 500; }
.t-card > ul:not(.tags) { padding-left: 18px; color: var(--muted); font-size: 15px; display: grid; gap: 8px; margin-bottom: 16px; }
.t-card > ul:not(.tags) li::marker { color: var(--faint); }

/* Projects */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.p-card {
  display: flex; flex-direction: column; gap: 12px; padding: 22px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.p-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.p-card.featured { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--surface)), var(--surface)); }
.p-card[hidden] { display: none; }
.p-top { display: flex; justify-content: space-between; align-items: center; }
.p-cat { font-family: var(--mono); font-size: 12px; color: var(--accent-2); }
.p-badge { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.p-card h3 { font-size: 18px; font-weight: 700; }
.p-card p { margin: 0; color: var(--muted); font-size: 14.5px; flex: 1; }
.p-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.p-link { font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.p-link i { font-size: 11px; }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.skill-card { padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--card-shadow); }
.skill-card h3 { font-size: 16px; font-weight: 650; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.skill-card h3 i { color: var(--accent); width: 18px; text-align: center; }
.plain { list-style: none; display: grid; gap: 8px; color: var(--muted); font-size: 14.5px; }
.plain li { padding-left: 16px; position: relative; }
.plain li::before { content: ""; position: absolute; left: 0; top: 0.65em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); }

/* Education */
.edu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.edu-card { display: flex; gap: 18px; align-items: center; padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--card-shadow); }
.edu-card img { width: 56px; height: 56px; border-radius: 12px; object-fit: contain; background: #fff; padding: 4px; flex-shrink: 0; border: 1px solid var(--border); }
.edu-card h3 { font-size: 17px; font-weight: 700; }
.edu-card p { margin: 2px 0 0; color: var(--muted); font-size: 14.5px; }

/* Contact */
.contact-card {
  text-align: center; padding: 56px 32px; border-radius: 24px;
  background:
    radial-gradient(600px 240px at 50% 0%, var(--glow), transparent 70%),
    var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
}
.contact-card .lead { margin: 16px auto 0; }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 28px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0 40px; color: var(--faint); font-size: 14px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.footer-inner p { margin: 0; }
.footer-links { display: flex; gap: 6px; list-style: none; }
.footer-links a { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--muted); font-size: 17px; }
.footer-links a:hover { color: var(--text); background: var(--surface); text-decoration: none; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .pulse { animation: none; }
  .btn, .p-card { transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .project-grid, .skills-grid { grid-template-columns: 1fr 1fr; }
  .about-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 10px 16px 16px; background: var(--bg-soft); border-bottom: 1px solid var(--border);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px; }
  .theme-toggle { margin: 6px 0 0 12px; }

  .hero { grid-template-columns: 1fr; gap: 36px; min-height: auto; padding-top: 32px; text-align: left; }
  .hero-photo { order: -1; justify-self: start; }
  .photo-ring { width: 168px; border-radius: 24px; }
  .photo-ring img { border-radius: 21px; }
  .code-chip { display: none; }

  .timeline::before { left: 6px; }
  .t-item { grid-template-columns: 1fr; gap: 6px; padding-left: 28px; }
  .t-item::before { left: 1px; top: 4px; }
  .t-meta { text-align: left; padding: 0; }
}

@media (max-width: 620px) {
  .container { padding-left: 16px; padding-right: 16px; }
  .section { padding: 64px 16px; }
  .project-grid, .skills-grid, .edu-grid, .stat-grid { grid-template-columns: 1fr; }
  .lead { font-size: 16.5px; }
  .hero-cta .btn:not(.btn-icon) { flex: 1 1 auto; justify-content: center; }
  .contact-card { padding: 40px 20px; }
  .contact-actions .btn { width: 100%; justify-content: center; }
  .footer-inner { flex-direction: column-reverse; }
}
