/* ===========================
   Variables & Reset
   =========================== */
:root {
  --bg-primary: #0a0f1a;
  --bg-secondary: #141c2e;
  --border: #1e2a42;
  --text-primary: #e2e8f0;
  --text-muted: #7a8ba8;
  --accent: #38bdf8;
  --accent-dim: #1e3a5f;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --dot-color: rgba(30, 42, 66, 0.5);
}

[data-theme="light"] {
  --bg-primary: #f8f9fb;
  --bg-secondary: #ffffff;
  --border: #e2e6ee;
  --text-primary: #1a1f2e;
  --text-muted: #5a6478;
  --accent: #0c7fd4;
  --accent-dim: #dbeeff;
  --dot-color: rgba(200, 210, 225, 0.6);
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 1rem;
  line-height: 1.7;
  transition: background-color 0.3s, color 0.3s;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--text-primary);
}

/* ===========================
   Utility
   =========================== */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section-heading {
  font-size: 1.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2.5rem;
  position: relative;
  display: inline-block;
}

.section-heading::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===========================
   Navigation
   =========================== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1rem 0;
  transition: background-color 0.3s, box-shadow 0.3s;
}

.nav.scrolled {
  background-color: rgba(10, 15, 26, 0.95);
  box-shadow: 0 1px 12px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .nav.scrolled {
  background-color: rgba(248, 249, 251, 0.95);
  box-shadow: 0 1px 12px rgba(0, 0, 0, 0.08);
}

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

.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.04em;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

.theme-icon {
  width: 18px;
  height: 18px;
  display: block;
  position: relative;
}

/* Moon (dark mode) */
.theme-icon::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--text-muted);
  clip-path: polygon(40% 0%, 100% 0%, 100% 100%, 40% 100%, 25% 85%, 15% 65%, 15% 35%, 25% 15%);
  transition: clip-path 0.3s, background 0.3s;
}

/* Sun (light mode) */
[data-theme="light"] .theme-icon::before {
  clip-path: circle(35% at 50% 50%);
  background: var(--accent);
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

/* Mobile nav */
@media (max-width: 767px) {
  .hamburger {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 60vw;
    max-width: 280px;
    background: var(--bg-secondary);
    flex-direction: column;
    padding: 5rem 2rem 2rem;
    gap: 1.5rem;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
  }

  .nav-links.open {
    transform: translateX(0);
  }

  .hamburger.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .hamburger.open span:nth-child(2) {
    opacity: 0;
  }

  .hamburger.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }
}

/* ===========================
   Hero / About
   =========================== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  padding-top: 4rem;
  background-image: radial-gradient(var(--dot-color) 1px, transparent 1px);
  background-size: 24px 24px;
}

.hero-layout {
  display: flex;
  align-items: center;
  gap: 3rem;
}

.hero-content {
  animation: fadeInUp 0.8s ease both;
  flex: 1;
}

.hero-headshot {
  flex-shrink: 0;
  animation: fadeInUp 0.8s 0.15s ease both;
}

.hero-headshot img {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 2px solid var(--border);
  object-fit: cover;
}

.hero h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.hero .subtitle {
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.5rem;
}

.hero .bio {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 600px;
  line-height: 1.8;
  margin-bottom: 2rem;
}

/* Button */
.btn {
  display: inline-block;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.6rem 1.5rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background-color 0.2s, color 0.2s;
}

.btn:hover {
  background-color: var(--accent);
  color: var(--bg-primary);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  animation: bounce 2s infinite;
}

.scroll-indicator::before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  40% {
    transform: translateX(-50%) translateY(-8px);
  }
  60% {
    transform: translateX(-50%) translateY(-4px);
  }
}

/* ===========================
   Stats Banner
   =========================== */
.stats-banner {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.stats-banner .container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stat {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.stat-sep {
  color: var(--border);
  font-size: 0.9rem;
  margin: 0 0.25rem;
}

/* ===========================
   Now
   =========================== */
.now {
  padding: 5rem 0 3rem;
}

.now-text {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 650px;
  line-height: 1.8;
}

/* ===========================
   Experience & Education (timeline)
   =========================== */
.experience,
.education {
  padding: 6rem 0;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.timeline-entry {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.75rem;
  transition: border-color 0.25s;
}

.timeline-entry:hover {
  border-color: var(--accent);
}

.timeline-header h3 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.timeline-meta {
  display: block;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.timeline-date {
  display: block;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-top: 0.25rem;
  margin-bottom: 0.75rem;
}

.timeline-details {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.timeline-details li {
  color: var(--text-muted);
  font-size: 0.92rem;
  padding-left: 1rem;
  position: relative;
}

.timeline-details li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* ===========================
   Projects
   =========================== */
.projects {
  padding: 6rem 0;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.75rem;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(56, 189, 248, 0.08);
}

.card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.tag {
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.card-link {
  font-size: 0.85rem;
  font-weight: 500;
}

/* ===========================
   Skills
   =========================== */
.skills {
  padding: 6rem 0;
}

.skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

.skill-category h3 {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.chip {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  transition: border-color 0.2s;
}

.chip:hover {
  border-color: var(--accent);
}

/* ===========================
   Interests
   =========================== */
.interests {
  padding: 4rem 0;
}

.interests-list {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}

.interest-item {
  flex: 1 1 200px;
}

.interest-item h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.interest-item p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* ===========================
   Contact
   =========================== */
.contact {
  padding: 6rem 0;
  text-align: center;
}

.contact .section-heading {
  display: block;
  text-align: center;
}

.contact .section-heading::after {
  left: 50%;
  transform: translateX(-50%);
}

.contact-note {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 1rem;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem 2rem;
}

.contact-links a {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.contact-links a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ===========================
   Footer
   =========================== */
.site-footer {
  padding: 2rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ===========================
   Responsive: 768px+
   =========================== */
@media (min-width: 768px) {
  .hero h1 {
    font-size: 3rem;
  }

  .card-grid {
    grid-template-columns: 1fr 1fr;
  }

  .skills-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Mobile: stack headshot above text */
@media (max-width: 767px) {
  .hero-layout {
    flex-direction: column-reverse;
    text-align: center;
  }

  .hero-headshot img {
    width: 140px;
    height: 140px;
  }

  .hero .bio {
    margin-left: auto;
    margin-right: auto;
  }

  .stats-banner .container {
    gap: 0.3rem;
  }

  .stat {
    font-size: 0.8rem;
  }
}
