:root {
  --bg: #f6f8fb;
  --bg-alt: #ffffff;
  --text: #172033;
  --muted: #516079;
  --card: #ffffff;
  --border: #d9e0ea;
  --primary: #2563eb;
  --primary-text: #ffffff;
  --shadow: 0 10px 30px rgba(23, 32, 51, 0.08);
  --bg-glow-1: rgba(37, 99, 235, 0.18);
  --bg-glow-2: rgba(14, 165, 233, 0.14);
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-alt: #111827;
  --text: #e5edf8;
  --muted: #a9b7cc;
  --card: #162033;
  --border: #243247;
  --primary: #60a5fa;
  --primary-text: #08111f;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --bg-glow-1: rgba(96, 165, 250, 0.18);
  --bg-glow-2: rgba(52, 211, 153, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 500px at -10% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(700px 420px at 110% 0%, var(--bg-glow-2), transparent 55%),
    radial-gradient(700px 500px at 50% 120%, rgba(99, 102, 241, 0.10), transparent 60%),
    url("bg-pattern.svg");
  background-repeat: no-repeat, no-repeat, no-repeat, repeat;
  background-size: auto, auto, auto, 180px 180px;
  background-attachment: fixed, fixed, fixed, fixed;
  color: var(--text);
  transition: background-color 0.2s ease, color 0.2s ease;
}
[data-theme="dark"] body {
  background-image:
    radial-gradient(900px 500px at -10% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(700px 420px at 110% 0%, var(--bg-glow-2), transparent 55%),
    radial-gradient(800px 520px at 50% 120%, rgba(167, 139, 250, 0.10), transparent 60%),
    url("bg-pattern-dark.svg");
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.container {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  border-bottom: 1px solid var(--border);
}
@supports ((-webkit-backdrop-filter: blur(8px)) or (backdrop-filter: blur(8px))) {
  .site-header { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
  flex-wrap: wrap;
}
.brand { font-weight: 700; }
.brand .role { color: var(--muted); font-weight: 500; margin-left: 0.35rem; font-size: 0.95rem; }
.nav { display: flex; gap: 0.9rem; flex-wrap: wrap; }
.nav a { color: var(--muted); font-weight: 500; }
.nav a:hover { color: var(--text); text-decoration: none; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
}
.theme-toggle:hover { border-color: var(--primary); }
.theme-toggle .icon { display: inline-flex; line-height: 0; }

.hero { padding: 4rem 0 2rem; }
.hero-inner {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
.eyebrow { color: var(--primary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 0.5rem; font-size: 0.85rem; }
h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.15; margin: 0 0 1rem; }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 70ch; }
.adjacent-note { color: var(--muted); margin: 0.5rem 0 0; max-width: 70ch; }
.hero-proof { margin: 1rem 0 0; padding-left: 1.2rem; color: var(--text); }
.hero-proof li { margin-bottom: 0.4rem; }
.hero-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 0.7rem 1rem;
  border-radius: 0.7rem;
  font-weight: 600;
  border: 1px solid var(--border);
}
.btn.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn.secondary { background: var(--card); color: var(--text); }
.btn:hover { text-decoration: none; filter: brightness(1.03); }

.section { padding: 3rem 0; }
.section.alt {
  background: color-mix(in srgb, var(--bg-alt) 88%, transparent);
  background: rgba(255, 255, 255, 0.55);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(2px);
}
[data-theme="dark"] .section.alt { background: rgba(17, 24, 39, 0.55); }
.section h2 { margin-top: 0; font-size: 1.8rem; }
.section-intro { color: var(--muted); max-width: 75ch; }

.grid { display: grid; gap: 1rem; }
.impact-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.skills-grid, .projects-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.two-col-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.stack { display: grid; gap: 1rem; }

.card, .hero-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.card h3, .hero-card h2 { margin-top: 0; }
.hero-card ul, .card ul { padding-left: 1.2rem; margin: 0.5rem 0 0; }
.meta { color: var(--muted); margin: 0.15rem 0 0.5rem; font-size: 0.95rem; }
.tags { color: var(--muted); font-size: 0.95rem; margin-bottom: 0; }
.project-type { color: var(--primary); font-weight: 600; font-size: 0.9rem; margin: 0 0 0.25rem; }
.project-case p { margin: 0.35rem 0; }
.item-header h3 { margin-bottom: 0.2rem; }
.volunteer-card { margin-top: 1rem; }

.profile-card { text-align: left; }
.profile-photo {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 1rem;
  border: 1px solid var(--border);
  display: block;
  margin-bottom: 0.75rem;
  background: var(--bg-alt);
}
.impact-card { text-align: left; }
.impact-metric { font-size: 1.4rem; font-weight: 700; color: var(--primary); margin: 0 0 0.25rem; }
.cta-text { font-size: 1.05rem; }
.contact-card p { margin: 0.4rem 0; }

.site-footer {
  padding: 1.5rem 0 2.5rem;
  color: var(--muted);
  text-align: center;
}

.modal {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}
.modal.open { display: flex; }
.modal-backdrop {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(15, 23, 42, 0.55);
}
.modal-content {
  position: relative;
  width: min(720px, 100%);
  max-height: 85vh;
  overflow: auto;
  z-index: 1;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.modal-header h2 { margin: 0; font-size: 1.5rem; }
.modal-close {
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}
.modal-close:hover { border-color: var(--primary); }
.modal-item { padding: 0.75rem 0; }
.modal-item h3 { margin: 0 0 0.25rem; font-size: 1.1rem; }
.modal-item p { margin: 0.25rem 0; }
.modal-body .contact-card { border: 0; box-shadow: none; padding: 0; background: transparent; }

.project-carousel { display: block; }
.carousel-viewport { min-height: 160px; }
.carousel-slide { display: none !important; border-top: 0; padding: 0; }
.carousel-slide.active { display: block !important; }
.carousel-slide[hidden] { display: none !important; }
.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}
.carousel-arrow {
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.carousel-arrow:hover { border-color: var(--primary); color: var(--primary); }
.carousel-indicator {
  text-align: center;
  color: var(--muted);
  margin: 0;
  min-width: 3.5rem;
  font-size: 0.95rem;
}

@media (max-width: 800px) {
  .hero-inner { grid-template-columns: 1fr; }
  .header-inner { align-items: flex-start; }
  .nav { gap: 0.6rem 0.8rem; }
}

@media (max-width: 600px) {
  .container { width: min(1100px, calc(100% - 1.25rem)); }
  .header-inner { padding: 0.7rem 0; }
  .brand { font-size: 0.98rem; }
  .brand .role { display: block; margin-left: 0; margin-top: 0.1rem; font-size: 0.9rem; }
  .nav { width: 100%; order: 3; gap: 0.45rem 0.75rem; font-size: 0.95rem; }
  .theme-toggle { margin-left: auto; }
  .hero { padding: 2.5rem 0 1.5rem; }
  .section { padding: 2.25rem 0; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { text-align: center; width: 100%; }
  .card, .hero-card { padding: 1rem; }
  .modal { padding: 0.75rem; }
  .modal-content { max-height: 88vh; }
  .carousel-controls { gap: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
