/* Tokens y base común a todas las experiencias. */
:root {
  --ink: #2a201b;
  --ink-soft: #5e4f45;
  --paper: #f6f0e6;
  --paper-deep: #ece2d1;
  --accent: #7a1f2b;        /* borgoña */
  --accent-deep: #561520;
  --gold: #b48d55;
  --gold-light: #dcc293;
  --night: #1a1411;
  --ok: #3c6b4a;
  --error: #9b2c2c;

  --font-display: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --font-script: 'Pinyon Script', 'Snell Roundhand', 'Apple Chancery', cursive;
  --font-ui: 'Jost', 'Avenir Next', 'Helvetica Neue', system-ui, sans-serif;

  --ease-out: cubic-bezier(.22, .8, .24, 1);
  --ease-soft: cubic-bezier(.45, .05, .25, 1);
  --radius: 14px;

  /* Textura de papel generada (sin imágenes externas). */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .27 0 0 0 0 .2 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --fibers: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .32 0 0 0 0 .24 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--night);
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.is-open { background: var(--paper); }
body.is-locked { overflow: hidden; }

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

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

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

.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  background: var(--paper); color: var(--ink); padding: 10px 16px; border-radius: 999px;
  text-decoration: none; transition: top .2s;
}
.skip-link:focus { top: 12px; }

.noscript { color: var(--paper); text-align: center; padding: 40px 20px; }

/* Botón de música: visible en ambas capas. */
.music-toggle {
  position: fixed; z-index: 60;
  top: max(14px, env(safe-area-inset-top)); right: 14px;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 16px 0 12px;
  border-radius: 999px; border: 1px solid rgba(220, 194, 147, .45);
  background: rgba(26, 20, 17, .55); color: var(--gold-light);
  font-size: .78rem; letter-spacing: .18em; text-transform: uppercase;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}
body.is-open .music-toggle { background: rgba(246, 240, 230, .82); color: var(--accent); border-color: rgba(122, 31, 43, .25); }
.music-icon { width: 16px; height: 14px; display: inline-flex; align-items: flex-end; gap: 2px; }
.music-icon::before, .music-icon::after { content: ''; width: 3px; height: 40%; background: currentColor; border-radius: 1px; }
.music-icon { background: linear-gradient(currentColor, currentColor) center bottom / 3px 70% no-repeat; }
.music-toggle[aria-pressed="true"] .music-icon::before { animation: bar 1s var(--ease-soft) infinite alternate; }
.music-toggle[aria-pressed="true"] .music-icon::after { animation: bar 1.3s var(--ease-soft) infinite alternate-reverse; }
@keyframes bar { from { height: 25%; } to { height: 100%; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
