/* ===== ASMR BASE STYLES ===== */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;1,300;1,400&family=Inter:wght@300;400;500&display=swap');

:root {
  --bg:       #0a0a12;
  --surface:  #111122;
  --surface2: #191930;
  --border:   rgba(139, 124, 248, 0.12);
  --accent:   #8b7cf8;
  --accent2:  #5ce8d4;
  --text:     #e8e4f0;
  --muted:    #7d7a96; /* lightened from #6b6880 — WCAG AA 4.8:1 on dark bg */
  --danger:   #f87c8b;

  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans:  'Inter', system-ui, sans-serif;

  --radius:   12px;
  --radius-lg: 20px;
  --transition: 0.35s ease;
  --glow: 0 0 30px rgba(139, 124, 248, 0.18);
}

/* ===== COLOR THEMES ===== */
/* default = midnight (variables already in :root above) */

html[data-theme="forest"] {
  --bg:       #060d06;
  --surface:  #0b160b;
  --surface2: #111f11;
  --border:   rgba(82, 201, 122, 0.12);
  --accent:   #52c97a;
  --accent2:  #a8d95c;
  --muted:    #638667; /* lightened for WCAG AA */
  --glow:     0 0 30px rgba(82, 201, 122, 0.18);
}

html[data-theme="ocean"] {
  --bg:       #040c18;
  --surface:  #081525;
  --surface2: #0d1f35;
  --border:   rgba(74, 184, 232, 0.12);
  --accent:   #4ab8e8;
  --accent2:  #5ce8d4;
  --muted:    #5b839e; /* lightened for WCAG AA */
  --glow:     0 0 30px rgba(74, 184, 232, 0.18);
}

html[data-theme="ember"] {
  --bg:       #120806;
  --surface:  #1e0e08;
  --surface2: #2a1410;
  --border:   rgba(248, 124, 92, 0.12);
  --accent:   #f87c5c;
  --accent2:  #f8b85c;
  --muted:    #a96f58; /* lightened for WCAG AA */
  --glow:     0 0 30px rgba(248, 124, 92, 0.18);
}

html[data-theme="dawn"] {
  --bg:       #f7f3ee;
  --surface:  #ece6dc;
  --surface2: #e2dbd0;
  --border:   rgba(100, 70, 30, 0.15);
  --accent:   #7c5cbf;
  --accent2:  #3d9e76;
  --text:     #1c1410;
  --muted:    #5e5044; /* darkened for WCAG AA on light bg */
  --danger:   #b03030;
  --glow:     0 0 30px rgba(124, 92, 191, 0.20);
}

/* High Contrast — WCAG AA: all text/bg combos ≥ 4.5:1 */
html[data-theme="contrast"] {
  --bg:       #000000;
  --surface:  #0d0d0d;
  --surface2: #1a1a1a;
  --border:   rgba(255, 255, 255, 0.5);
  --accent:   #ffff00;
  --accent2:  #00ffff;
  --text:     #ffffff;
  --muted:    #cccccc;
  --danger:   #ff6b6b;
  --glow:     0 0 20px rgba(255, 255, 0, 0.35);
}
/* Ensure links, headings, and small text remain readable in contrast mode */
html[data-theme="contrast"] a              { color: #ffff00; }
html[data-theme="contrast"] a:hover        { color: #00ffff; }
html[data-theme="contrast"] p,
html[data-theme="contrast"] .text-muted,
html[data-theme="contrast"] [class*="muted"] { color: #cccccc; }
html[data-theme="contrast"] button:focus-visible,
html[data-theme="contrast"] a:focus-visible,
html[data-theme="contrast"] input:focus-visible,
html[data-theme="contrast"] select:focus-visible,
html[data-theme="contrast"] textarea:focus-visible {
  outline: 3px solid #ffff00;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(255, 255, 0, 0.35);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.6rem); }

p { color: var(--muted); font-size: 0.95rem; }

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent2); }

img { max-width: 100%; display: block; }

button {
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(139, 124, 248, 0.5);
  transition: transform 0.2s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.3); }

select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.5rem 1rem;
  font-family: var(--font-sans);
  outline: none;
  cursor: pointer;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===== ACCESSIBILITY: Focus States ===== */
/* Remove default outline only when using mouse; keep for keyboard */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
/* Higher specificity for buttons */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(139, 124, 248, 0.18);
}

/* ===== ACCESSIBILITY: Skip-to-content link ===== */
.skip-link {
  position: fixed;
  top: -100px;
  left: 1rem;
  z-index: 9999;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 1rem; }

/* ===== MICRO-INTERACTIONS ===== */
/* Button press scale */
.btn:active,
button:active:not(:disabled) {
  transform: scale(0.96);
  transition: transform 0.1s ease;
}
/* Smooth hover lift for cards */
.card,
.visual-card,
.sound-card,
.trigger-card {
  transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover,
.visual-card:hover,
.sound-card:hover,
.trigger-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
/* Icon spin on hover for nav logo */
.nav__logo:hover span {
  display: inline-block;
  animation: spin-once 0.5s ease;
}
@keyframes spin-once {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* prefers-reduced-motion: disable decorative animations */
@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;
  }
  canvas { display: none; }
}

/* ===== EMPTY STATE COMPONENT ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem 1.5rem;
  text-align: center;
}
.empty-state__svg {
  width: 100px;
  height: 100px;
  opacity: 0.7;
  animation: float 4s ease-in-out infinite;
}
.empty-state__title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--text);
  margin: 0;
}
.empty-state__hint {
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 320px;
  line-height: 1.6;
  margin: 0;
}

/* Utility */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.section    { padding: 5rem 0; }
.section-sm { padding: 3rem 0; }
.text-center { text-align: center; }
.text-accent  { color: var(--accent); }
.text-accent2 { color: var(--accent2); }
.text-muted   { color: var(--muted); }

/* Glow pulse animation */
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(139, 124, 248, 0.2); }
  50%       { box-shadow: 0 0 40px rgba(139, 124, 248, 0.45); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

@keyframes breathe {
  0%, 100% { transform: scale(1);   opacity: 0.6; }
  50%       { transform: scale(1.18); opacity: 1; }
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in-up { animation: fade-in-up 0.8s ease forwards; }
.float      { animation: float 6s ease-in-out infinite; }

/* ===== SEASONAL BANNER ===== */
.seasonal-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: rgba(var(--sb-rgb, 139,124,248), 0.08);
  border-bottom: 1px solid color-mix(in srgb, var(--sb-color, var(--accent)) 25%, transparent);
  font-size: 0.88rem;
  color: var(--text);
  flex-wrap: wrap;
}

.seasonal-banner__emoji { font-size: 1.1rem; flex-shrink: 0; }

.seasonal-banner__text { flex: 1; line-height: 1.5; }
.seasonal-banner__text a { color: var(--sb-color, var(--accent)); text-decoration: none; }
.seasonal-banner__text a:hover { text-decoration: underline; }

.seasonal-banner__close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.2rem 0.4rem;
  flex-shrink: 0;
  transition: color 0.2s;
}
.seasonal-banner__close:hover { color: var(--text); }

/* ===== WHAT'S NEW GRID ===== */
.whats-new-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.2rem;
}

.wn-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  transition: border-color 0.2s, transform 0.2s;
}

.wn-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.wn-card__badge {
  display: inline-block;
  font-size: 0.7rem;
  background: rgba(139,124,248,0.12);
  color: var(--accent);
  border-radius: 100px;
  padding: 0.15em 0.6em;
  letter-spacing: 0.06em;
  font-family: var(--font-sans);
  margin-bottom: 0.6rem;
}

.wn-card__title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 400;
  color: var(--text);
  margin: 0 0 0.4rem;
}

.wn-card__desc {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 0.8rem;
}

.wn-card__link {
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.03em;
}
.wn-card__link:hover { text-decoration: underline; }

/* ===== PAGE LOAD FADE-IN ===== */
@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

body { animation: page-fade-in 0.35s ease forwards; }

@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
}

/* ===== PRINT STYLES ===== */
@media print {
  .nav, .footer, #themePicker, .nav__toggle, .btn, button:not(.print-visible) { display: none !important; }
  body { background: #fff !important; color: #111 !important; font-size: 12pt; }
  a { color: #333 !important; text-decoration: underline; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #666; }
  a[href^="#"]::after, a[href^="javascript:"]::after { content: ""; }
  h1, h2, h3, h4 { color: #111 !important; page-break-after: avoid; }
  p, li { color: #333 !important; orphans: 3; widows: 3; }
  section, article { page-break-inside: avoid; }
  canvas, video, audio { display: none !important; }
  @page { margin: 2cm; }
}

/* WCAG 2.2 SC 2.5.8 — minimum target size */
button, [role="button"], a.btn, .nav__toggle,
input[type="checkbox"], input[type="radio"], input[type="range"],
.modal-overlay button, .toast button {
  min-block-size: 24px;
  min-inline-size: 24px;
}
/* WCAG 2.2 SC 2.4.13 — focus appearance already provided by existing :focus-visible rule above */

/* prefers-reduced-data — disable expensive canvas/animations on save-data mode */
@media (prefers-reduced-data: reduce) {
  canvas { display: none !important; }
  .hero-particles, .ambient-canvas { display: none !important; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* WCAG 2.2 SC 2.4.11 — Focus Not Obscured (Minimum)
   Sticky nav can hide focused element when scrolled to via anchor;
   scroll-margin-top pushes scroll position below nav. */
:target, [id]:focus-visible {
  scroll-margin-top: 5rem;
}
h1[id], h2[id], h3[id], h4[id], section[id], article[id] {
  scroll-margin-top: 5rem;
}

/* Print stylesheet polish — clean PDF-ready output via browser "Save as PDF" */
@media print {
  body {
    background: white !important;
    color: black !important;
    font-size: 11pt;
    line-height: 1.5;
  }
  /* Hide non-essential UI for print/PDF */
  .nav, .footer-sitemap, .skip-link, .toast-container, .modal-overlay,
  .next-step, .recent-added, .hub-spokes, .feed-subscribe,
  .preview-btn, .nav__toggle, .search-modal,
  canvas, .breathe-bg-canvas, .hero-particles, .ambient-canvas,
  audio, video, iframe { display: none !important; }
  /* Make links readable */
  a {
    color: black !important;
    text-decoration: underline !important;
  }
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #555;
  }
  /* No widows/orphans */
  p, li { orphans: 3; widows: 3; }
  h1, h2, h3, h4 { page-break-after: avoid; color: black !important; }
  /* Hint: download as PDF via browser */
  body:before {
    content: "Saved from asmr-relax.top — use your browser's Save as PDF for offline reading.";
    display: block;
    text-align: center;
    font-size: 8pt;
    color: #888;
    margin-bottom: 1rem;
    padding: 0.5rem;
    border-bottom: 1px solid #ccc;
  }
}

/* Page transition — subtle fade on load */
@media (prefers-reduced-motion: no-preference) {
  body {
    animation: page-fade-in 0.4s ease-out;
  }
  @keyframes page-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
  }
}

/* Theme-switch transition — smooth color shift when theme toggled */
html, body, .nav, .modal-box, .toast, .recent-added, .hub-spokes,
.next-step, .related-grid, .qa-block, .definition-block,
.compare-table, .feed-subscribe {
  transition: background-color 0.3s ease, color 0.2s ease, border-color 0.2s ease;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0ms !important;
  }
}
