/* ─────────────────────────────────────────────────────────────
   rahgoddess · base
   Palette, type, and the persistent chrome (threshold, cursor,
   sound orb, compass rose, grain). Room styles live in rooms.css.
   ───────────────────────────────────────────────────────────── */

:root {
  --noir: #0b0608;
  --velvet: #1a0a0f;
  --oxblood: #5a0f1a;
  --crimson: #c41e3a;
  --rose: #f2a7b5;
  --blush: #fbe3e8;
  --gold: #d4a64a;
  --champagne: #f5e6c8;
  --ink: #1b1f3b;
  --moss: #3d5a3a;

  --bg: var(--noir);
  --fg: var(--champagne);
  --accent: var(--crimson);

  --display: "Bodoni Moda", "Didot", "Bodoni 72", serif;
  --serif: "Cormorant Garamond", "Garamond", Georgia, serif;
  --mono: "Space Mono", ui-monospace, monospace;
  /* Bodoni's hairlines all but vanish on a 1080p screen at weight 400 and its
     largest optical size; a touch more weight, and a capped optical size on
     big type, keeps them visible without losing the delicacy */
  --display-weight: 460;
  --display-opsz: "opsz" 48;

  --ease-silk: cubic-bezier(.22, 1, .36, 1);
  --ease-snap: cubic-bezier(.7, 0, .2, 1);
  --gutter: clamp(16px, 4vw, 64px);
}

/* Each room retints the whole house as it becomes active */
body[data-room="ouverture"]    { --bg: #0b0608; --accent: var(--crimson); }
body[data-room="manifeste"]    { --bg: #f5e6c8; --fg: #1a0a0f; --accent: var(--crimson); }
body[data-room="paris"]        { --bg: #0c0e1f; --accent: var(--gold); }
body[data-room="bibliotheque"] { --bg: #f1e7d6; --fg: #241418; --accent: var(--oxblood); }
body[data-room="ecrans"]       { --bg: #060606; --accent: #7cf2c8; }
body[data-room="table"]        { --bg: #2a0910; --accent: var(--gold); }
body[data-room="forces"]       { --bg: #020104; --accent: var(--crimson); }
body[data-room="musique"]      { --bg: #12071c; --accent: var(--rose); }
body[data-room="chiens"]       { --bg: #f2a7b5; --fg: #2a0910; --accent: var(--oxblood); }
body[data-room="finale"]       { --bg: #0b0608; --accent: var(--rose); }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: auto; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: clamp(18px, 1.25vw, 22px);
  line-height: 1.45;
  overflow-x: hidden;
  transition: background-color 1.2s var(--ease-silk), color 1.2s var(--ease-silk);
}
body.locked { overflow: hidden; height: 100vh; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3 { font-family: var(--display); font-weight: var(--display-weight); font-weight: var(--display-weight); font-variation-settings: var(--display-opsz); margin: 0; line-height: .92; letter-spacing: -.02em; }
em { font-style: italic; }
canvas { display: block; }
::selection { background: var(--accent); color: var(--noir); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

@media (hover: hover) and (pointer: fine) {
  body.has-cursor, body.has-cursor button, body.has-cursor a { cursor: none; }
  body.has-cursor input { cursor: text; }
}

/* ── Le Seuil ─────────────────────────────────────────────── */
#seuil {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-content: center; justify-items: center; gap: 1.2rem;
  background: radial-gradient(ellipse at 50% 60%, #2a0910 0%, var(--noir) 65%);
  color: var(--champagne);
  text-align: center;
  padding: var(--gutter);
  transition: clip-path 1.6s var(--ease-snap);
  clip-path: circle(150% at var(--ox, 50%) var(--oy, 50%));
}
#seuil.leaving { clip-path: circle(0% at var(--ox, 50%) var(--oy, 50%)); }
.seuil-orb {
  width: 22vmin; height: 22vmin; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8a9b, var(--crimson) 45%, var(--oxblood) 80%);
  box-shadow: 0 0 80px 10px rgba(196, 30, 58, .45), inset -12px -18px 40px rgba(0,0,0,.5);
  animation: heartbeat 1.1s infinite var(--ease-silk);
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(1.08); }
  24% { transform: scale(.98); }
  36% { transform: scale(1.05); }
}
.seuil-whisper { font-style: italic; letter-spacing: .3em; text-transform: lowercase; opacity: .7; margin: 0; }
.seuil-mark { font-size: clamp(3.5rem, 13vw, 11rem); font-weight: var(--display-weight); }
.seuil-mark em { display: block; font-size: .42em; color: var(--rose); letter-spacing: .12em; margin-top: .1em; }
.seuil-choices { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; margin-top: 1rem; }
.seuil-choices button, .pill {
  font-family: var(--display); font-weight: var(--display-weight); font-style: italic; font-size: 1.15rem;
  padding: .8em 1.6em; border: 1px solid currentColor; border-radius: 999px;
  transition: background .4s, color .4s, transform .4s var(--ease-silk);
}
.seuil-choices button span, .pill span {
  display: block; font-family: var(--mono); font-style: normal; font-size: .6rem;
  letter-spacing: .2em; text-transform: uppercase; opacity: .6;
}
.seuil-choices button:hover, .pill:hover { background: var(--champagne); color: var(--noir); transform: scale(1.05); }

/* ── Grain: a film-stock veil over everything ─────────────── */
.grain {
  position: fixed; inset: -50%; z-index: 90; pointer-events: none; opacity: .09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -4%); } 60% { transform: translate(-4%, -1%); }
  80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}

/* ── Cursor ───────────────────────────────────────────────── */
#cursor {
  position: fixed; left: 0; top: 0; z-index: 120; pointer-events: none;   /* above everything, the threshold included */
  width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%;
  background: var(--champagne); mix-blend-mode: difference;
  display: grid; place-items: center;
  transition: width .35s var(--ease-silk), height .35s var(--ease-silk), margin .35s var(--ease-silk), opacity .3s;
  opacity: 0;
}
body.has-cursor #cursor { opacity: 1; }
body.cursor-native, body.cursor-native * { cursor: auto !important; }
body.cursor-native button, body.cursor-native .tv-hint button { cursor: pointer !important; }
body.cursor-native #cursor { opacity: 0 !important; }
#cursor.big { width: 96px; height: 96px; margin: -48px 0 0 -48px; }
#cursor.down { width: 30px; height: 30px; margin: -15px 0 0 -15px; }
.cursor-label { font-family: var(--mono); font-size: 13px; color: #000; white-space: nowrap; }

/* ── Sound orb: four bars that dance to the master analyser ─ */
#sound-orb {
  position: fixed; right: var(--gutter); top: var(--gutter); z-index: 80;
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid currentColor;
  display: flex; align-items: center; justify-content: center; gap: 3px;
  color: var(--fg); mix-blend-mode: difference; color: #fff;
  opacity: 0; transition: opacity 1s 1s;
}
body.entered #sound-orb { opacity: 1; }
#sound-orb i { width: 3px; height: 4px; background: currentColor; border-radius: 2px; transition: height .08s; }
#sound-orb[aria-pressed="false"] i { height: 2px !important; }

/* ── La Rose: a compass instead of a nav bar ──────────────── */
#rose {
  position: fixed; left: var(--gutter); bottom: var(--gutter); z-index: 80;
  width: 64px; height: 64px;
  opacity: 0; transition: opacity 1s 1.2s;
}
body.entered #rose { opacity: 1; }
.rose-heart {
  position: absolute; inset: 0; border-radius: 50%;
  background: var(--accent); color: var(--noir);
  display: grid; place-items: center;
  font-family: var(--display); font-weight: var(--display-weight); font-style: italic; font-size: .7rem; line-height: 1;
  text-align: center; padding: 6px;
  box-shadow: 0 0 0 0 var(--accent);
  animation: rosepulse 3s infinite;
  transition: background 1.2s, transform .5s var(--ease-silk);
  z-index: 2;
}
.rose-heart:hover { transform: scale(1.1); }
@keyframes rosepulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 100% { box-shadow: 0 0 0 22px transparent; } }
.rose-petals { list-style: none; margin: 0; padding: 0; position: absolute; left: 32px; bottom: 32px; }
.rose-petals li {
  position: absolute; left: 0; bottom: 0;
  transform: rotate(var(--a)) translateX(0) rotate(calc(-1 * var(--a)));
  opacity: 0; pointer-events: none;
  transition: transform .7s var(--ease-silk), opacity .4s;
  transition-delay: calc(var(--i) * 30ms);
}
#rose.open .rose-petals li {
  transform: rotate(var(--a)) translateX(var(--r, 170px)) rotate(calc(-1 * var(--a)));
  opacity: 1; pointer-events: auto;
}
.rose-petals button {
  display: block; transform: translate(-50%, 50%);
  font-family: var(--display); font-weight: var(--display-weight); font-size: 1.05rem; white-space: nowrap;
  padding: .3em .7em; border-radius: 999px;
  background: var(--champagne); color: var(--noir);
  box-shadow: 0 6px 30px rgba(0,0,0,.3);
  transition: background .3s, color .3s;
}
.rose-petals button[aria-current="true"], .rose-petals button:hover { background: var(--accent); color: var(--champagne); }
.rose-petals small { display: block; font-family: var(--mono); font-size: .5rem; letter-spacing: .15em; text-transform: uppercase; opacity: .6; }
#rose.open::before {
  content: ""; position: fixed; inset: 0; background: rgba(11, 6, 8, .55); backdrop-filter: blur(6px);
  z-index: -1;
}

/* ── Shared room scaffolding ──────────────────────────────── */
.room { position: relative; min-height: 100vh; min-height: 100svh; overflow: clip; isolation: isolate; }
.room > canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.sticky { position: sticky; top: 0; height: 100vh; height: 100svh; display: grid; place-items: center; }
.room-head { padding: calc(var(--gutter) * 2) var(--gutter) var(--gutter); max-width: 60rem; }
.room-head h2 { font-size: clamp(3rem, 9vw, 8rem); }
.room-head p { font-size: 1.3em; font-style: italic; max-width: 32ch; }
.room-num { font-family: var(--mono); font-size: .75rem; letter-spacing: .3em; color: var(--accent); display: block; margin-bottom: 1rem; }
kbd { font-family: var(--mono); font-size: .8em; border: 1px solid currentColor; border-radius: 4px; padding: 0 .3em; }

/* Elements that drift in when their room arrives */
[data-reveal] { opacity: 0; transform: translateY(40px); transition: opacity 1.2s var(--ease-silk), transform 1.2s var(--ease-silk); }
.room.seen [data-reveal] { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .2s !important; }
  .grain { display: none; }
}
