:root {
  --color-primary: #0062FF;
  --color-primary-text: #0062FF;
  --bg: #ffffff;
  --text: #17181c;
  --text-secondary: #4b4e55;
  --nav-bg: rgba(255, 255, 255, 0.75);
  --nav-dropdown-bg: rgba(255, 255, 255, 0.97);
  --nav-border: rgba(20, 20, 40, 0.08);
  --nav-shadow: rgba(0, 98, 255, 0.28);
  --icon-shadow: rgba(0, 98, 255, 0.16);
  --footer-text: #4b4e55;
  --switch-track-bg: #eeece7;
  --switch-thumb: #ffffff;
  --switch-icon-active: #3d3f45;
  --switch-icon-inactive: #a8a9a3;
  --focus-ring: #0062FF;
  --nav-indicator-bg: rgba(0, 98, 255, 0.1);
  --card-bg: #ffffff;
  --card-border: rgba(20, 20, 40, 0.08);
  --card-shadow: rgba(20, 20, 40, 0.1);
  --surface-tint: #f6f7f9;
  --accent-violet: #7c3aed;
  --accent-rose: #e11d48;
  --accent-amber: #b45309;
  --accent-emerald: #059669;
  --accent-cyan: #0891b2;
  --accent-fuchsia: #c026d3;
  --accent-indigo: #4f46e5;
  --blob-shade-1: #0062ff;
  --blob-shade-2: #5ca0ff;
  --blob-shade-3: #003ea6;
  --hero-bg-start: #fbfdff;
  --hero-bg-end: #d5e6ff;
}

[data-theme="dark"] {
  --bg: #0e0f13;
  --text: #f2f3f5;
  --text-secondary: #b7bac2;
  --nav-bg: rgba(24, 25, 30, 0.7);
  --nav-dropdown-bg: rgba(24, 25, 30, 0.96);
  --nav-border: rgba(255, 255, 255, 0.12);
  --nav-shadow: rgba(76, 148, 255, 0.32);
  --icon-shadow: rgba(76, 148, 255, 0.2);
  --footer-text: #b7bac2;
  --color-primary-text: #4c94ff;
  --switch-track-bg: #3a3b42;
  --switch-thumb: #17181c;
  --switch-icon-active: #f2f3f5;
  --switch-icon-inactive: #7d8087;
  --focus-ring: #4c94ff;
  --nav-indicator-bg: rgba(76, 148, 255, 0.16);
  --card-bg: #17181c;
  --card-border: rgba(255, 255, 255, 0.08);
  --card-shadow: rgba(0, 0, 0, 0.4);
  --surface-tint: #16171b;
  --accent-violet: #a78bfa;
  --accent-rose: #fb7185;
  --accent-amber: #fbbf24;
  --accent-emerald: #34d399;
  --accent-cyan: #22d3ee;
  --accent-fuchsia: #e879f9;
  --accent-indigo: #818cf8;
  --blob-shade-1: #4c8dff;
  --blob-shade-2: #9dc4ff;
  --blob-shade-3: #2a5fcc;
  --hero-bg-start: #0f1626;
  --hero-bg-end: #253a5e;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: visible;
}

/* Page-enter choreography: the hero fades in first and fast, then
   everything else that started in view follows after a short beat.
   Content the user scrolls to later reveals immediately, unaffected. */
.hero-reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

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

.reveal.reveal-delayed {
  transition-delay: 0.75s;
}

@media (prefers-reduced-motion: reduce) {
  .hero-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .reveal.reveal-delayed {
    transition-delay: 0s;
  }
}

a {
  transition: color 0.2s ease, opacity 0.2s ease,
    text-decoration-thickness 0.2s ease;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 200;
  background: var(--color-primary);
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 1rem;
}

/* Text links */
.text-link {
  color: var(--color-primary-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.text-link:hover {
  text-decoration-thickness: 2px;
}

/* Focus visibility */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Navbar */
.navbar {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(94%, 1240px);
  z-index: 100;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.75rem 1.5rem;

  background: var(--nav-bg);
  border: 1px solid var(--nav-border);
  border-radius: 999px;
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  box-shadow: 0 8px 32px var(--nav-shadow);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-mark {
  display: block;
  fill: currentColor;
  color: var(--color-primary-text);
  transition: opacity 0.2s ease, color 0.3s ease;
}

.logo .brand-mark {
  width: 38px;
  height: 38px;
}

.logo:hover .brand-mark {
  opacity: 0.7;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.nav-indicator {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--nav-indicator-bg);
  opacity: 0;
  transform: translateX(0);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  pointer-events: none;
  z-index: 0;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  position: relative;
  z-index: 1;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--color-primary-text);
}

.nav-link.active {
  color: var(--color-primary-text);
  font-weight: 700;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 999px;
  cursor: pointer;
}

.nav-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.25s ease, opacity 0.2s ease, background 0.3s ease;
}

.nav-toggle:hover .nav-toggle-bar {
  background: var(--color-primary-text);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Theme toggle switch */
.theme-switch {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem;
  border: none;
  background: transparent;
  cursor: pointer;
}

.switch-track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 64px;
  height: 32px;
  padding: 3px;
  border-radius: 999px;
  background: var(--switch-track-bg);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
  transition: background 0.25s ease;
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--switch-thumb);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s ease, background 0.25s ease;
}

[data-theme="dark"] .switch-thumb {
  transform: translateX(32px);
}

.switch-icon {
  position: relative;
  z-index: 1;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.switch-icon svg {
  width: 16px;
  height: 16px;
  transition: color 0.25s ease;
}

.switch-icon-sun {
  color: var(--switch-icon-active);
}

.switch-icon-moon {
  color: var(--switch-icon-inactive);
}

[data-theme="dark"] .switch-icon-sun {
  color: var(--switch-icon-inactive);
}

[data-theme="dark"] .switch-icon-moon {
  color: var(--switch-icon-active);
}

/* Fade-in transitions */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

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

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Lightbox */
.lightbox-trigger {
  cursor: zoom-in;
}

.lightbox-trigger:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 0.5rem;
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(8, 9, 12, 0.88);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 300;
}

.lightbox-overlay.active {
  display: flex;
}

.lightbox-image,
.lightbox-video {
  max-width: min(90vw, 900px);
  max-height: 85vh;
  border-radius: 0.75rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  animation: lightbox-in 0.2s ease;
}

@keyframes lightbox-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.lightbox-close svg {
  width: 18px;
  height: 18px;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.18);
}

.lightbox-close:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.lightbox-nav svg {
  width: 22px;
  height: 22px;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.18);
}

.lightbox-nav:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

.lightbox-prev {
  left: 1.5rem;
}

.lightbox-next {
  right: 1.5rem;
}

@media (max-width: 700px) {
  .lightbox-nav {
    width: 42px;
    height: 42px;
  }

  .lightbox-prev {
    left: 0.5rem;
  }

  .lightbox-next {
    right: 0.5rem;
  }
}

body.lightbox-lock {
  overflow: hidden;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--nav-border);
  margin-top: 2rem;
  padding: 2.5rem 1.5rem 3rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-align: center;
}

.footer-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--nav-indicator-bg);
}

.footer-logo .brand-mark {
  width: 16px;
  height: 16px;
}

.site-footer p {
  margin: 0;
  color: var(--footer-text);
  font-size: 0.85rem;
}

/* 404 / error page */
.error-main {
  flex: 1;
  width: min(94%, 640px);
  margin: 0 auto;
  padding: 9rem 1.5rem 5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.error-code {
  margin: 0;
  font-size: clamp(4rem, 12vw, 7rem);
  font-weight: 800;
  line-height: 1;
  color: var(--color-primary-text);
}

.error-main h1 {
  margin: 1rem 0 0.75rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.error-main p {
  margin: 0 0 2rem;
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 42ch;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.error-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.error-cta-primary {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 6px 18px var(--icon-shadow);
}

.error-cta-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px var(--icon-shadow);
}

.error-cta-secondary {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text);
}

.error-cta-secondary:hover {
  border-color: var(--color-primary-text);
  color: var(--color-primary-text);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Responsive */
@media (max-width: 700px) {
  .navbar {
    top: 0.75rem;
    padding: 0.6rem 1rem;
  }

  .logo img {
    height: 22px;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-indicator {
    display: none;
  }

  .nav-links {
    position: absolute;
    top: calc(100% + 0.75rem);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.75rem;
    background: var(--nav-dropdown-bg);
    border: 1px solid var(--nav-border);
    border-radius: 1.25rem;
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    box-shadow: 0 8px 32px var(--nav-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    pointer-events: none;
  }

  .nav-links.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
  }

  .nav-link {
    width: 100%;
    text-align: center;
    padding: 0.65rem 1rem;
  }
}
