/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body, h1, h2, h3, p, ul, ol, li, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
html { scroll-behavior: smooth; }

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

/* ---------- Theme tokens ---------- */
:root {
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --container: 1120px;
  --ease: cubic-bezier(.16,1,.3,1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #0a0a0c;
  --bg-elevated: #131316;
  --bg-elevated-2: #1a1a1e;
  --text: #f5f5f7;
  --text-secondary: #a1a1a6;
  --border: rgba(255,255,255,0.09);
  --border-strong: rgba(255,255,255,0.4);
  --accent: #22b8db;
  --accent-badge: #22b8db;
  --accent-text: #04222a;
  --nav-bg: rgba(10,10,12,0.72);
  --shadow: 0 20px 40px rgba(0,0,0,0.35);
  --glow: radial-gradient(600px circle at 50% 0%, rgba(34,184,219,0.18), transparent 60%);
}

[data-theme="light"] {
  --bg: #fbfbfd;
  --bg-elevated: #ffffff;
  --bg-elevated-2: #f5f5f7;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --border: rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.45);
  --accent: #007391;
  --accent-badge: #00566d;
  --accent-text: #ffffff;
  --nav-bg: rgba(251,251,253,0.72);
  --shadow: 0 20px 40px rgba(0,0,0,0.08);
  --glow: radial-gradient(600px circle at 50% 0%, rgba(0,115,145,0.10), transparent 60%);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s var(--ease), color .35s var(--ease);
  line-height: 1.5;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-text);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  z-index: 200;
}
.skip-link:focus { left: 16px; top: 16px; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: transparent;
  transition: background-color .3s var(--ease), border-color .3s var(--ease), backdrop-filter .3s var(--ease);
  border-bottom: 1px solid transparent;
}
.site-header.scrolled {
  background: var(--nav-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
}
.site-nav {
  display: flex;
  gap: 32px;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  padding: 9px 0;
  font-size: 14px;
  color: var(--text-secondary);
  transition: color .2s var(--ease);
}
.site-nav a:hover { color: var(--text); }

.header-actions { display: flex; align-items: center; gap: 8px; }

.theme-toggle {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong);
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.theme-toggle:hover { border-color: var(--accent); transform: translateY(-1px); }
.theme-toggle .icon { width: 18px; height: 18px; }
.icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

.nav-toggle {
  display: none;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.nav-toggle span {
  width: 16px; height: 1.5px;
  background: var(--text);
  transition: transform .25s var(--ease), opacity .25s var(--ease);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  transition: transform .2s var(--ease), background-color .2s var(--ease), border-color .2s var(--ease), opacity .2s var(--ease);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}
.btn-primary:hover { opacity: 0.88; }
.btn-ghost {
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { background: var(--bg-elevated); }
.btn-sm { padding: 9px 18px; font-size: 14px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 180px 0 120px;
  overflow: hidden;
}
.hero-glow {
  position: absolute;
  inset: 0;
  background: var(--glow);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 56px;
}
.hero-photo {
  flex-shrink: 0;
  width: 128px; height: 128px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }
.hero-text { max-width: 680px; }
.eyebrow {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 20px;
  letter-spacing: 0.01em;
}
.hero h1 {
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 24px;
}
.hero-lede {
  font-size: clamp(17px, 2vw, 20px);
  color: var(--text-secondary);
  max-width: 620px;
  margin-bottom: 40px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

/* ---------- Sections ---------- */
.section { padding: 100px 0; }
.section-alt { background: var(--bg-elevated); }
.section-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.section-subtitle {
  color: var(--text-secondary);
  font-size: 17px;
  margin-bottom: 48px;
  max-width: 620px;
}
.section-subtitle a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px;
}
.about-lead {
  font-size: 19px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: transform .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease);
}
.section-alt .card { background: var(--bg-elevated-2); }
.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.card-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  margin-bottom: 20px;
}
.card-icon svg { width: 22px; height: 22px; }
.card h3 { font-size: 19px; font-weight: 600; margin-bottom: 10px; letter-spacing: -0.01em; }
.card p { color: var(--text-secondary); font-size: 15px; line-height: 1.6; }

/* ---------- Projects ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.project-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.project-grid .card-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  margin-bottom: 0;
  flex-shrink: 0;
}
.project-grid .card-icon svg { width: 32px; height: 32px; }
.project-grid .card h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}
.card-tagline {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0;
}
.project-grid .card { display: flex; flex-direction: column; }
.project-grid .card > p { margin-bottom: 24px; flex: 1 0 auto; }
.project-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}
.project-links .btn { margin-left: auto; }
.app-store-badge {
  display: inline-flex;
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.app-store-badge:hover { transform: translateY(-1px); opacity: 0.88; }
.app-store-badge img { height: 40px; width: auto; }

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  border-left: 1px solid var(--border);
  margin-left: 6px;
}
.timeline-item {
  position: relative;
  padding: 0 0 48px 32px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker {
  position: absolute;
  left: -6.5px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.timeline-head h3 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.timeline-date {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.timeline-org { color: var(--accent); font-size: 14px; font-weight: 500; margin-bottom: 14px; }
.timeline-content ul { display: flex; flex-direction: column; gap: 8px; }
.timeline-content li {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
  padding-left: 18px;
  position: relative;
}
.timeline-content li::before {
  content: "";
  position: absolute;
  left: 0; top: 9px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--border-strong);
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px 32px;
}
.skill-group h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 13.5px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}
.section-alt .chip { background: var(--bg); }

/* ---------- Education ---------- */
.education-list { display: flex; flex-direction: column; gap: 32px; }
.education-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.education-head h3 { font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.education-list p { color: var(--text-secondary); font-size: 15px; max-width: 640px; }
.badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-badge);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  padding: 3px 9px;
  border-radius: 999px;
}

/* ---------- Contact ---------- */
.contact-inner { text-align: center; max-width: 640px; }
.contact-inner .section-title { margin-bottom: 12px; }
.contact-inner .section-subtitle { margin: 0 auto 40px; }
.contact-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- Footer ---------- */
.site-footer { padding: 72px 0 40px; border-top: 1px solid var(--border); }
.footer-grid {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 32px;
  padding-bottom: 40px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--border);
}
.footer-col h3 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.footer-statement { max-width: 360px; }
.footer-statement.footer-col p {
  font-size: clamp(26px, 3.2vw, 36px);
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 80px;
}
.footer-col p { font-size: 15px; line-height: 1.7; }
.footer-connect { text-align: center; margin-bottom: 32px; }
.footer-social {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}
.social-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  transition: border-color .2s var(--ease), transform .2s var(--ease), color .2s var(--ease);
}
.social-icon:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent); }
.social-icon svg { width: 18px; height: 18px; }
.footer-quote {
  font-style: italic;
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.footer-inner a {
  display: inline-flex;
  align-items: center;
  padding: 6px 0;
  margin: -6px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color .2s var(--ease);
}
.footer-inner a:hover { color: var(--text); }

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0.01ms !important;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero-inner { flex-direction: column; align-items: flex-start; gap: 32px; }
  .about-grid { grid-template-columns: 1fr; gap: 24px; }
  .project-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { flex-direction: column; gap: 28px; }
  .footer-meta { gap: 40px; }
}

@media (max-width: 640px) {
  .site-nav {
    position: absolute;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    transition: max-height .3s var(--ease), visibility 0s linear .3s;
  }
  .site-nav.open {
    max-height: 320px;
    visibility: visible;
    transition: max-height .3s var(--ease), visibility 0s linear 0s;
  }
  .site-nav a {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    font-size: 16px;
  }
  .nav-toggle { display: flex; }
  .nav-toggle.open span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
  .nav-toggle.open span:nth-child(2) { opacity: 0; }
  .nav-toggle.open span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

  .hero { padding: 140px 0 80px; }
  .hero-photo { width: 96px; height: 96px; }
  .section { padding: 72px 0; }
  .skills-grid { grid-template-columns: 1fr; }
  .timeline-head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .footer-inner { flex-direction: column; gap: 12px; text-align: center; }
  .project-links { flex-direction: column; align-items: flex-end; gap: 10px; }
}
