:root {
  /* Catppuccin Mocha */
  --color-base: #1e1e2e;
  --color-mantle: #181825;
  --color-crust: #11111b;
  --color-surface0: #313244;
  --color-surface1: #45475a;
  --color-surface2: #585b70;
  --color-overlay0: #6c7086;
  --color-overlay1: #7f849c;
  --color-text: #cdd6f4;
  --color-subtext0: #a6adc8;
  --color-subtext1: #bac2de;
  --color-mauve: #cba6f7;
  --color-lavender: #b4befe;
  --color-red: #f38ba8;
  --color-peach: #fab387;
  --color-green: #a6e3a1;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --space-10: 8rem;

  /* Typography */
  --font-body: 'Geist Variable', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono Variable', ui-monospace, 'Cascadia Code', 'Fira Code', monospace;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 2rem;
  --font-size-3xl: 3rem;
  --font-size-4xl: 4rem;

  /* Transitions */
  --transition-speed: 200ms;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --color-base: #eff1f5;
    --color-mantle: #e6e9ef;
    --color-crust: #dce0e8;
    --color-surface0: #ccd0da;
    --color-surface1: #bcc0cc;
    --color-surface2: #acb0be;
    --color-overlay0: #9ca0b0;
    --color-overlay1: #8c8fa1;
    --color-text: #4c4f69;
    --color-subtext0: #6c6f85;
    --color-subtext1: #5c5f77;
    --color-mauve: #8839ef;
    --color-lavender: #7287fd;
    --color-red: #d20f39;
    --color-peach: #fe640b;
    --color-green: #40a02b;
  }
}

[data-theme="light"] {
  --color-base: #eff1f5;
  --color-mantle: #e6e9ef;
  --color-crust: #dce0e8;
  --color-surface0: #ccd0da;
  --color-surface1: #bcc0cc;
  --color-surface2: #acb0be;
  --color-overlay0: #9ca0b0;
  --color-overlay1: #8c8fa1;
  --color-text: #4c4f69;
  --color-subtext0: #6c6f85;
  --color-subtext1: #5c5f77;
  --color-mauve: #8839ef;
  --color-lavender: #7287fd;
  --color-red: #d20f39;
  --color-peach: #fe640b;
  --color-green: #40a02b;
}

[data-theme="dark"] {
  --color-base: #1e1e2e;
  --color-mantle: #181825;
  --color-crust: #11111b;
  --color-surface0: #313244;
  --color-surface1: #45475a;
  --color-surface2: #585b70;
  --color-overlay0: #6c7086;
  --color-overlay1: #7f849c;
  --color-text: #cdd6f4;
  --color-subtext0: #a6adc8;
  --color-subtext1: #bac2de;
  --color-mauve: #cba6f7;
  --color-lavender: #b4befe;
  --color-red: #f38ba8;
  --color-peach: #fab387;
  --color-green: #a6e3a1;
}

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

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-base);
}

body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

@media (prefers-reduced-motion: no-preference) {
  body {
    transition: color var(--transition-speed) ease,
                background-color var(--transition-speed) ease;
  }
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background-color: var(--color-mauve);
  color: var(--color-base);
  border-radius: 0.25rem;
  z-index: 200;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: var(--space-2);
}

/* Site header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: transparent;
}

@media (prefers-reduced-motion: no-preference) {
  .site-header {
    transition: background-color var(--transition-speed) ease;
  }
}

.site-header.scrolled {
  background-color: color-mix(in srgb, var(--color-mantle) 80%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--color-surface0) 50%, transparent);
}

/* Navigation */
.nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  max-width: 80rem;
  margin: 0 auto;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-mauve);
  text-decoration: none;
}

.nav-logo:focus-visible {
  outline: 2px solid var(--color-mauve);
  outline-offset: 2px;
}

.nav-links {
  display: flex;
  gap: var(--space-2);
  list-style: none;
  margin-left: auto;
}

@media (min-width: 48em) {
  .nav-links {
    gap: var(--space-4);
  }
}

.nav-links a {
  position: relative;
  color: var(--color-subtext0);
  text-decoration: none;
  font-size: var(--font-size-sm);
  padding-bottom: var(--space-1);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background-color: var(--color-mauve);
}

.nav-links a.active::after,
.nav-links a:hover::after {
  width: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  .nav-links a {
    transition: color var(--transition-speed) ease;
  }

  .nav-links a::after {
    transition: width var(--transition-speed) ease;
  }
}

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

.nav-links a:focus-visible {
  outline: 2px solid var(--color-mauve);
  outline-offset: 2px;
}

/* Theme toggle (styled but hidden until JS activates) */
.theme-toggle {
  background: none;
  border: none;
  padding: var(--space-2);
  cursor: pointer;
  color: var(--color-subtext0);
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (prefers-reduced-motion: no-preference) {
  .theme-toggle {
    transition: color var(--transition-speed) ease,
                transform var(--transition-speed) ease;
  }

  .theme-toggle:active {
    transform: rotate(30deg);
  }
}

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

.theme-toggle:focus-visible {
  outline: 2px solid var(--color-mauve);
  outline-offset: 2px;
}

/* Theme toggle icon visibility via CSS */
[data-theme="dark"] .icon-moon,
:root:not([data-theme]) .icon-moon {
  display: none;
}

[data-theme="light"] .icon-sun {
  display: none;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .icon-sun {
    display: none;
  }

  :root:not([data-theme]) .icon-moon {
    display: block;
  }
}

.nowrap {
  white-space: nowrap;
}

html {
  scroll-padding-top: var(--space-8);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 80vh;
  padding: var(--space-8) var(--space-4);
}

.hero::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40rem;
  height: 40rem;
  transform: translate(-50%, -60%);
  background: radial-gradient(circle, var(--color-mauve) 0%, transparent 70%);
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero-title {
  font-family: var(--font-mono);
  font-size: var(--font-size-3xl);
  font-weight: 700;
  color: var(--color-mauve);
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  color: var(--color-subtext0);
  margin-top: var(--space-2);
}

.hero-description {
  font-size: var(--font-size-lg);
  color: var(--color-subtext1);
  max-width: 36rem;
  margin-top: var(--space-5);
}

.hero-links {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

/* Hero entrance animation */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-title {
    animation: fade-up 0.6s ease both;
  }

  .hero-subtitle {
    animation: fade-up 0.6s ease 0.1s both;
  }

  .hero-description {
    animation: fade-up 0.6s ease 0.2s both;
  }

  .hero-links {
    animation: fade-up 0.6s ease 0.3s both;
  }
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-5);
  border-radius: 0.375rem;
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-decoration: none;
}

@media (prefers-reduced-motion: no-preference) {
  .button {
    transition: background-color var(--transition-speed) ease,
                color var(--transition-speed) ease,
                transform var(--transition-speed) ease;
  }

  .button:hover {
    transform: scale(1.02);
  }

  .button:active {
    transform: scale(0.98);
  }
}

.button-primary {
  background-color: var(--color-mauve);
  color: var(--color-base);
}

.button-primary:hover {
  background-color: var(--color-lavender);
}

.button-secondary {
  background-color: var(--color-surface0);
  color: var(--color-text);
}

.button-secondary:hover {
  background-color: var(--color-surface1);
}

.button:focus-visible {
  outline: 2px solid var(--color-mauve);
  outline-offset: 2px;
}

/* Responsive: hero */
@media (min-width: 48em) {
  .hero-title {
    font-size: var(--font-size-4xl);
  }
}

@media (min-width: 90em) {
  .hero {
    padding: var(--space-10) var(--space-4);
  }

  .hero-title {
    font-size: 5rem;
  }

  .hero-subtitle {
    font-size: var(--font-size-lg);
  }

  .hero-description {
    font-size: var(--font-size-xl);
    max-width: 42rem;
  }
}

/* Sections */
.section {
  padding: var(--space-9) var(--space-4);
}

.section-alt {
  background-color: var(--color-mantle);
}

@media (prefers-reduced-motion: no-preference) {
  .section,
  .section-alt {
    transition: background-color var(--transition-speed) ease;
  }
}

.section-inner {
  max-width: 64rem;
  margin: 0 auto;
  text-align: center;
}

@media (min-width: 90em) {
  .section-inner {
    max-width: 76rem;
  }
}

.section-heading {
  font-family: var(--font-mono);
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--color-mauve);
  margin-bottom: var(--space-6);
}

/* Prose */
.prose {
  text-align: center;
}

.prose p {
  color: var(--color-subtext1);
  line-height: 1.7;
  max-width: 42rem;
  margin-inline: auto;
}

.prose p + p {
  margin-top: var(--space-4);
}

/* Feature grid */
.feature-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
  list-style: none;
}

@media (min-width: 48em) {
  .feature-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.feature-card {
  padding: var(--space-5);
  background-color: var(--color-mantle);
  border-radius: 0.5rem;
  border-left: 3px solid var(--color-mauve);
  text-align: left;
  transition: background-color var(--transition-speed) ease;
}

@media (prefers-reduced-motion: no-preference) {
  .feature-card {
    transition: background-color var(--transition-speed) ease,
                transform var(--transition-speed) ease,
                box-shadow var(--transition-speed) ease;
  }
}

.feature-card:hover {
  background-color: var(--color-surface0);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--color-crust) 40%, transparent);
}

.feature-title {
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.feature-card p {
  font-size: var(--font-size-sm);
  color: var(--color-subtext0);
  line-height: 1.6;
}

/* Scope */
.scope-intro {
  color: var(--color-subtext1);
  margin-bottom: var(--space-5);
}

.scope-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
}

.scope-list li {
  padding: var(--space-2) var(--space-4);
  background-color: var(--color-surface0);
  color: var(--color-subtext0);
  border-radius: 0.375rem;
  font-size: var(--font-size-sm);
  font-family: var(--font-mono);
}

@media (prefers-reduced-motion: no-preference) {
  .scope-list li {
    transition: background-color var(--transition-speed) ease;
  }
}

/* Developer */
.developer-name {
  font-family: var(--font-mono);
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--color-text);
}

.developer-bio {
  color: var(--color-subtext0);
  margin-top: var(--space-2);
}

.developer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-5);
  list-style: none;
  margin-top: var(--space-5);
}

.developer-links a {
  color: var(--color-mauve);
  text-decoration: none;
  font-size: var(--font-size-sm);
}

@media (prefers-reduced-motion: no-preference) {
  .developer-links a {
    transition: color var(--transition-speed) ease;
  }
}

.developer-links a:hover {
  color: var(--color-lavender);
}

.developer-links a:focus-visible {
  outline: 2px solid var(--color-mauve);
  outline-offset: 2px;
}

/* Footer */
.site-footer {
  padding: var(--space-9) var(--space-4);
  background-color: var(--color-crust);
  text-align: center;
  border-top: 1px solid var(--color-surface0);
}

@media (prefers-reduced-motion: no-preference) {
  .site-footer {
    transition: background-color var(--transition-speed) ease,
                border-color var(--transition-speed) ease;
  }
}

.footer-inner {
  max-width: 64rem;
  margin: 0 auto;
}

@media (min-width: 90em) {
  .footer-inner {
    max-width: 76rem;
  }
}

.footer-tagline {
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  color: var(--color-subtext1);
  letter-spacing: 0.02em;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-5);
  list-style: none;
  margin-top: var(--space-4);
}

.footer-links a {
  color: var(--color-subtext0);
  text-decoration: none;
  font-size: var(--font-size-sm);
}

@media (prefers-reduced-motion: no-preference) {
  .footer-links a {
    transition: color var(--transition-speed) ease;
  }
}

.footer-links a:hover {
  color: var(--color-text);
}

.footer-links a:focus-visible {
  outline: 2px solid var(--color-mauve);
  outline-offset: 2px;
}

/* Responsive: sections */
@media (min-width: 48em) {
  .section-heading {
    font-size: var(--font-size-2xl);
  }
}

@media (min-width: 90em) {
  .nav {
    padding: var(--space-3) var(--space-6);
  }

  .section {
    padding: var(--space-10) var(--space-6);
  }

  .feature-card {
    padding: var(--space-6);
  }
}

/* 404 page */
.error-page {
  min-height: 100vh;
}

.error-code {
  font-size: var(--font-size-4xl);
}
