/* ===== Header ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: color-mix(in srgb, var(--primary) 85%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  transition: color 0.2s;
  white-space: nowrap;
}

.logo:hover,
.logo:focus-visible {
  color: var(--accent);
}

.logo img {
  width: 28px;
  height: 28px;
}

/* Section nav */
.nav-sections {
  display: flex;
  gap: 1.5rem;
}

.nav-sections a {
  color: var(--header-text);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  transition: color 0.2s;
}

.nav-sections a:hover {
  color: #fff;
}

/* Nav actions (social + dark mode) */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.social-links {
  display: flex;
  gap: 0.5rem;
}

.social-links a {
  color: var(--header-text);
  transition: color 0.2s;
  display: flex;
}

.social-links a:hover {
  color: var(--accent);
}

/* Dark mode toggle */
.darkmode-toggle {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: background 0.2s;
  color: var(--header-text);
  position: relative;
}

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

.icon-sun,
.icon-moon {
  display: flex;
  transition: opacity 0.3s, transform 0.3s;
}

/* Light theme: show sun, hide moon */
.icon-moon {
  position: absolute;
  opacity: 0;
  transform: scale(0.5) rotate(-90deg);
}

.icon-sun {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* Dark OS → show moon */
@media (prefers-color-scheme: dark) {
  .icon-sun {
    position: absolute;
    opacity: 0;
    transform: scale(0.5) rotate(90deg);
  }
  .icon-moon {
    position: relative;
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* Light OS + checked → show moon */
@media (prefers-color-scheme: light) {
  :root:has(#darkmode-switch:checked) .icon-sun {
    position: absolute;
    opacity: 0;
    transform: scale(0.5) rotate(90deg);
  }
  :root:has(#darkmode-switch:checked) .icon-moon {
    position: relative;
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* Dark OS + checked → show sun */
@media (prefers-color-scheme: dark) {
  :root:has(#darkmode-switch:checked) .icon-sun {
    position: relative;
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
  :root:has(#darkmode-switch:checked) .icon-moon {
    position: absolute;
    opacity: 0;
    transform: scale(0.5) rotate(-90deg);
  }
}

/* ===== Main ===== */
main {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ===== Sections ===== */
.section {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 4rem 1.5rem;
}

.section:nth-child(even) {
  background: var(--surface);
  --card-bg: var(--bg);
}

.section:nth-child(odd) {
  background: var(--bg);
  --card-bg: var(--surface);
}

.section-inner {
  width: 100%;
  max-width: var(--max-width);
}

.section-title {
  color: var(--accent);
  margin-bottom: 2rem;
  text-wrap: balance;
  position: relative;
  padding-bottom: 0.75rem;
}

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

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.85rem;
  background: var(--primary);
  color: rgba(255, 255, 255, 0.4);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  .nav-sections {
    display: none;
  }

  .section {
    padding: 3rem 1.25rem;
  }
}

@media (max-width: 480px) {
  .social-links {
    gap: 0.25rem;
  }
}

/* ===== Print ===== */
@media print {
  .header,
  .hero-actions,
  .darkmode-toggle,
  .footer {
    display: none;
  }

  .hero {
    min-height: auto;
    padding: 2rem 0;
    background: #fff !important;
    color: #000 !important;
  }

  .hero-name {
    font-size: 2.5rem;
    color: #000 !important;
  }

  .hero-tagline {
    color: #333 !important;
  }

  .metrics {
    background: #fff !important;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
  }

  .metric-value {
    color: #000 !important;
  }

  .metric-label {
    color: #555 !important;
  }

  .reveal,
  .timeline-item,
  .project-card,
  .cert-item,
  .metric {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  .section {
    padding: 1.5rem 0;
    break-inside: avoid;
  }

  body {
    background: #fff;
    color: #000;
  }
}
