/* ASTRAL Design Tokens & Base Accessibility System */
:root {
  color-scheme: dark;
  --void: #10111b;
  --ink: #171824;
  --surface: rgba(23, 24, 36, 0.82);
  --surface-strong: rgba(16, 17, 27, 0.94);
  --paper: #faf1e6;
  --ivory: #fff4e4;
  --gold: #f0cb9e;
  --gold-bright: #ffe1b5;
  --sakura: #d99aa8;
  --muted: #c8bac1;
  --muted-soft: #b6a6b6;
  --line: rgba(189, 169, 143, 0.31);
  --line-strong: rgba(240, 203, 158, 0.5);
  --scene-accent: #f0cb9e;
  --scene-glow: rgba(240, 203, 158, 0.22);
  --scene-rim: rgba(206, 218, 245, 0.32);
  --scene-tint: rgba(22, 26, 48, 0.65);
  --frame: clamp(22px, 5.5vw, 100px);
  --serif: 'Cormorant Garamond', 'Cambria', 'Times New Roman', serif;
  --sans: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease-cinematic: cubic-bezier(0.2, 0.7, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

html {
  scroll-behavior: smooth;
  scrollbar-width: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body {
  margin: 0;
  background: var(--void);
  color: var(--paper);
  font: 16px/1.55 var(--sans);
  isolation: isolate;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

input, textarea, select, [contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
}

a {
  color: inherit;
}

button, input {
  font: inherit;
}

[hidden] {
  display: none !important;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 4px;
}

::selection {
  background: #9f5a74;
  color: #fff3eb;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: var(--frame);
  z-index: 100;
  padding: 10px 16px;
  background: var(--surface-strong);
  color: var(--ivory);
  border: 1px solid var(--gold);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.85rem;
}

.skip-link:focus {
  top: 12px;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  margin: 0;
}

section[id] {
  scroll-margin-top: 64px;
}

.chapter-kicker {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.scene-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(16, 18, 32, 0.72);
  color: var(--paper);
  cursor: pointer;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.scene-button:hover {
  background: rgba(34, 30, 50, 0.86);
  border-color: var(--gold);
  color: var(--ivory);
}

.scene-button[aria-pressed="true"] {
  background: var(--gold);
  border-color: var(--gold);
  color: #1b131e;
  font-weight: 600;
}

.scene-button[aria-disabled="true"] {
  opacity: 0.45;
  cursor: default;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
  }
}

.interface-water {
  position: fixed;
  inset: 0;
  z-index: 80;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.interface-water[popover] {
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.interface-water::backdrop { background: transparent; pointer-events: none; }

.astral-world-canvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: block;
}

body[data-universe-gl="active"] .profile-atmosphere {
  opacity: 0.12;
  transition: opacity 0.6s ease;
}

.touch-feedback-ripple {
  position: fixed;
  z-index: 82;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--scene-accent, #ffe1b5);
  box-shadow: 0 0 14px var(--scene-glow, rgba(228, 191, 147, 0.36));
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.35);
  animation: touch-ripple-pop 0.68s cubic-bezier(0.18, 0.78, 0.24, 1) forwards;
}

@keyframes touch-ripple-pop {
  0% {
    opacity: 0.92;
    transform: translate(-50%, -50%) scale(0.35);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(3.4);
  }
}

.profile-atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(22, 13, 28, 0.03) 0%, rgba(22, 13, 28, 0.08) 38%, rgba(16, 11, 24, 0.22) 62%, rgba(12, 9, 20, 0.36) 100%),
    linear-gradient(0deg, rgba(14, 10, 22, 0.42) 0%, rgba(14, 10, 22, 0.0) 32%),
    radial-gradient(ellipse at 28% 34%, rgba(166, 113, 132, .32), transparent 42%),
    linear-gradient(135deg, #201725, #15131f 58%, #10131a);
}

body[data-wallpaper-mounted="true"] .profile-atmosphere {
  background: transparent;
}

.site-legal {
  position: fixed;
  z-index: 20;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  font-size: 11px;
  letter-spacing: .08em;
}

.site-legal a {
  color: rgba(245, 224, 215, .72);
  text-underline-offset: 3px;
}

@media (max-width: 760px) {
  .profile-atmosphere {
    background-position: 36% top;
  }
}

.profile-atmosphere::after {
  position: absolute;
  inset: 0;
  content: '';
  opacity: .34;
  background:
    radial-gradient(circle at 19% 18%, #f1d4ac 0 1px, transparent 1.8px),
    radial-gradient(circle at 44% 24%, #c1a6bd 0 1px, transparent 1.6px),
    radial-gradient(circle at 88% 62%, #bca1aa 0 .7px, transparent 1.4px),
    radial-gradient(circle at 66% 75%, #eec7ad 0 .8px, transparent 1.5px),
    radial-gradient(circle at 31% 62%, #d8c2d0 0 .9px, transparent 1.7px),
    radial-gradient(circle at 77% 21%, #f4dcc0 0 1px, transparent 2px);
  animation: atmosphere-shimmer 16s ease-in-out infinite alternate;
}

@keyframes atmosphere-shimmer {
  from { opacity: .26; }
  to { opacity: .42; }
}

@media (prefers-reduced-motion: reduce) {
  .profile-atmosphere::after {
    animation: none;
  }
}
