/* CSS Reset and Base Styles */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', Ubuntu, Cantarell, 'Helvetica Neue', Arial, sans-serif;
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

/* Root element (where Yew mounts) */
#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

:root {
  --aurora-gradient: linear-gradient(135deg, #4ECDC4 0%, #A78BFA 50%, #FF6B6B 100%);
  --aurora-glow: 0 0 30px rgba(78, 205, 196, 0.6), 0 0 60px rgba(167, 139, 250, 0.4);
}

/* Noise overlay - Texture.
   Painted on its own compositor layer with no blend mode: mix-blend-mode
   pulls every element underneath into a single blend group, forcing a
   full-page re-raster on any repaint. */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: var(--noise-texture);
  background-repeat: repeat;
  background-size: 64px 64px;
  opacity: 0.035;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

/* Grain is decoration; drop it where raster budget is tightest. */
@media (max-width: 640px) {
  body::before {
    display: none;
  }
}

/* Global Aurora REMOVED - Moved to components */

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

h1 {
  font-size: var(--text-2xl);
}

h2 {
  font-size: var(--text-xl);
}

h3 {
  font-size: var(--text-lg);
}

p {
  margin: 0 0 var(--s-4) 0;
  line-height: 1.6;
}

/* Remove default margins from last children */
p:last-child,
ul:last-child,
ol:last-child {
  margin-bottom: 0;
}

/* Links */
a {
  color: var(--teal);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}

a:hover {
  color: var(--coral);
  text-decoration: underline;
}

/* Images and media */
img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Form elements base styling */
input,
textarea,
select,
button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* Focus styles for accessibility */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
  border-radius: var(--r-s);
}

/* Remove default button styles */
button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

/* Lists */
ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Accessibility utilities */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Skip link for keyboard navigation */
.skip-link {
  position: absolute;
  top: -40px;
  left: var(--s-4);
  background: var(--coral);
  color: white;
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-m);
  text-decoration: none;
  font-weight: 600;
  z-index: 1000;
  transition: top var(--dur-fast) var(--ease-out);
}

.skip-link:focus {
  top: var(--s-4);
}

/* Reduced motion support - critical for accessibility */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* Keep focus outline animations for accessibility */
  *:focus-visible {
    transition: outline var(--dur-fast) var(--ease-out) !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --shadow-soft: 0 0 0 1px currentColor;
    --shadow-float: 0 0 0 2px currentColor;
    --shadow-button: 0 0 0 1px currentColor;
  }
}