/* ==========================================================================
   CHAOS — BOOK ONE: BASE STYLES & ATMOSPHERIC SHADER BACKGROUND
   ========================================================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--color-bg-base);
  color: var(--color-text-main);
  font-family: var(--font-sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  position: relative;
  background-color: var(--color-bg-base);
  background-image: 
    radial-gradient(circle at 15% 15%, rgb(30, 8, 16) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgb(10, 24, 36) 0%, transparent 45%),
    linear-gradient(180deg, rgb(6, 8, 12) 0%, rgb(10, 14, 22) 50%, rgb(4, 6, 10) 100%);
}

/* Keep the environment neutral: palette identity belongs to the rain and UI,
   so the atmospheric streaks remain legible instead of tinting the page. */
:root[data-palette="2056"] body,
:root[data-palette="2026"] body,
body.mode-2056,
body.mode-2026 {
  background-image:
    radial-gradient(circle at 15% 15%, rgb(20, 22, 30) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgb(12, 20, 30) 0%, transparent 45%),
    linear-gradient(180deg, rgb(6, 8, 12) 0%, rgb(10, 14, 22) 50%, rgb(4, 6, 10) 100%);
}

/* Canvas Layer */
#ambient-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
}

#ripple-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 99;
}

:root[data-rain="off"] #ambient-canvas {
  display: none;
}

/* The Effects preference suppresses all ornamental motion while preserving
   functional state changes such as menus, dialogs, and focus treatment. */
:root[data-effects="off"] {
  scroll-behavior: auto;
}

:root[data-effects="off"] *,
:root[data-effects="off"] *::before,
:root[data-effects="off"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  transition-delay: 0ms !important;
}

:root[data-effects="off"] .scanline-bar,
:root[data-effects="off"] .glitch-text::before,
:root[data-effects="off"] .glitch-text::after,
:root[data-effects="off"] .launch-banner::after {
  display: none;
}

:root[data-effects="off"] .btn:hover,
:root[data-effects="off"] .card:hover,
:root[data-effects="off"] .threat-card:hover,
:root[data-effects="off"] .cover-wrapper:hover,
:root[data-effects="off"] .character-thumb-btn:hover {
  transform: none;
}

/* Typography Base */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--color-text-bright);
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1.2;
}

p {
  line-height: 1.7;
  color: var(--color-text-main);
  font-family: var(--font-sans);
}

a {
  color: var(--color-accent-cyan-bright);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

/* Focus Outline Accessibility */
:focus-visible {
  outline: 2px solid var(--color-accent-cyan-bright);
  outline-offset: 4px;
}
