/* Transitions (Dodd, 2026-10-25: "things don't just fade out and fade in; each element has its own way of moving out
   and in"). One motion language for the desk:
     the frame stays (scene, top bar, menu) and the lit menu plate slides; the content changes;
     titles slide in from the left, the hero (pack, binder, card) scales up from a little below, plates and rows rise,
     small side text drifts in from the left; exits are shorter than entrances and move the same way back.
   Title -> desk: the IRIS wordmark flies into the menu's IRIS (app.js), the scene's shade eases from the title look
   to the desk look (no gradient snapping = no black fades popping in at the bottom and left), the top bar drops in,
   the menu items stagger in from the left, the hub plate and its lines rise, the pack scales up. ~700 ms in all.
   View swaps (Today / Artists / Stats) and Settings use the same moves (app.js: swapView, openSettings/closeSettings).
   Reduced motion: no travel, just quick fades (bottom of this file + app.js). Only transform and opacity animate. */
:root {
  --t-out: cubic-bezier(.4, 0, .7, .2);   /* exits: gather, then go */
  --t-spring: linear(0, .049, .169, .324, .488, .643, .778, .887, .97, 1.027, 1.062, 1.079, 1.083, 1.079, 1.068, 1.055, 1.041, 1.029, 1.017, 1.009, 1.002, .997, .995, .993, .993, .994, .996, .998, .999, 1);
}

/* ---------- the scene's shade: typed numbers, so the gradient eases instead of snapping ---------- */
@property --sh-l0 { syntax: "<number>"; inherits: false; initial-value: .92; }
@property --sh-l1 { syntax: "<number>"; inherits: false; initial-value: .6; }
@property --sh-l1p { syntax: "<percentage>"; inherits: false; initial-value: 32%; }
@property --sh-l2p { syntax: "<percentage>"; inherits: false; initial-value: 58%; }
@property --sh-v0 { syntax: "<number>"; inherits: false; initial-value: 0; }
@property --sh-v1 { syntax: "<number>"; inherits: false; initial-value: 0; }
@property --sh-v2 { syntax: "<number>"; inherits: false; initial-value: 0; }
@property --sh-v3 { syntax: "<number>"; inherits: false; initial-value: 0; }
@property --sh-v4 { syntax: "<number>"; inherits: false; initial-value: 0; }
/* !important: style.css swaps whole gradients per screen (those can't animate); this one shape covers all three looks */
.stage .stage-shade {
  --sh-l0: .92; --sh-l1: .6; --sh-l1p: 32%; --sh-l2p: 58%; --sh-v0: 0; --sh-v1: 0; --sh-v2: 0; --sh-v3: 0; --sh-v4: 0;
  background:
    linear-gradient(90deg, rgba(7, 5, 6, var(--sh-l0)) 0%, rgba(7, 5, 6, var(--sh-l1)) var(--sh-l1p), rgba(7, 5, 6, 0) var(--sh-l2p)),
    linear-gradient(180deg, rgba(7, 5, 6, var(--sh-v0)) 0%, rgba(7, 5, 6, var(--sh-v1)) 30%, rgba(7, 5, 6, var(--sh-v2)) 52%,
      rgba(7, 5, 6, var(--sh-v3)) 68%, rgba(7, 5, 6, var(--sh-v4)) 88%) !important;
  transition: --sh-l0 .65s var(--ease), --sh-l1 .65s var(--ease), --sh-l1p .65s var(--ease), --sh-l2p .65s var(--ease),
    --sh-v0 .6s var(--ease), --sh-v1 .6s var(--ease), --sh-v2 .6s var(--ease), --sh-v3 .7s var(--ease), --sh-v4 .7s var(--ease);
}
body[data-screen="desk"] .stage .stage-shade { --sh-l0: .82; --sh-l1: .35; --sh-l1p: 16%; --sh-l2p: 30%; --sh-v0: 0; --sh-v1: 0; --sh-v2: 0; --sh-v3: .42; --sh-v4: .84; }
/* Artists and Stats are reading pages: the scene steps back */
body[data-screen="desk"]:is([data-view="artists"], [data-view="stats"], [data-view="pass"], [data-view="inventory"], [data-view="account"], [data-view="shop"], [data-view="profile"]) .stage .stage-shade { --sh-v0: .62; --sh-v1: .5; --sh-v2: .58; --sh-v3: .66; --sh-v4: .94; }

/* ---------- title screen out ---------- */
.intro.leaving { animation: none; pointer-events: none; }
.intro.leaving .wordmark { transform-origin: 0 0; }
.intro.leaving .intro-sub { animation: t-out-left 220ms var(--t-out) forwards; }
.intro.leaving .intro-line, .intro.leaving .intro-hint { animation: t-out-down 200ms var(--t-out) forwards; }
.intro.leaving #enterBtn { animation: t-press-out 260ms var(--t-out) forwards; }
/* returning (#94): the greeting slides off left, the label after it; the ledger's lines fly to the desk (welcome.js) */
.intro.leaving .wl-hi { animation: t-out-left 260ms var(--t-out) forwards; }
.intro.leaving .wl-name { animation: none; }
.intro.leaving .wl-lede { animation: t-out-left 200ms 30ms var(--t-out) forwards; }
@keyframes t-out-left { to { opacity: 0; transform: translateX(-18px); } }
@keyframes t-out-down { to { opacity: 0; transform: translateY(8px); } }
@keyframes t-press-out { 0% { transform: scale(1); } 30% { transform: scale(.96); opacity: 1; } 100% { transform: scale(.98) translateY(6px); opacity: 0; } }

/* ---------- desk in (app.js adds .t-enter for ~0.9s) ---------- */
.desk.t-enter .top { animation: t-drop 440ms 110ms var(--ease) both; }
.desk.t-enter .brand b { animation: t-fade 40ms 480ms linear both; }           /* the flying wordmark (500 ms) lands here */
.desk.t-enter .brand span { animation: t-from-left 300ms 420ms var(--ease) both; }
/* the menu comes in once the flying IRIS has passed over it */
.desk.t-enter .nav > button { animation: t-from-left 380ms var(--ease) both; animation-delay: 250ms; }
.desk.t-enter .nav > button:nth-child(2) { animation-delay: 290ms; }
.desk.t-enter .nav > button:nth-child(3) { animation-delay: 330ms; }
.desk.t-enter .nav > button:nth-child(4) { animation-delay: 370ms; }
.desk.t-enter .nav > button:nth-child(5) { animation-delay: 410ms; }
.desk.t-enter .nav > button:nth-child(6) { animation-delay: 450ms; }
.desk.t-enter .nav-lit { animation: t-lit-in 400ms 300ms var(--ease) both; transform-origin: 0 50%; }
.desk.t-enter .panel { animation: t-plate 480ms 150ms var(--ease) both; }
.desk.t-enter .pcard { animation: t-hero 560ms 200ms var(--t-spring) both; }
.desk.t-enter .pinfo > * { animation: t-rise 420ms var(--ease) both; animation-delay: 250ms; }
.desk.t-enter .pinfo > .phead { animation-name: t-from-left; animation-delay: 220ms; }
.desk.t-enter .pinfo > :nth-child(2) { animation-delay: 280ms; }
.desk.t-enter .pinfo > :nth-child(3) { animation-delay: 300ms; }
.desk.t-enter .pinfo > :nth-child(4) { animation-delay: 320ms; }
.desk.t-enter .pinfo > :nth-child(5) { animation-delay: 340ms; }
.desk.t-enter .pinfo > :nth-child(n+6) { animation-delay: 360ms; }
.desk.t-enter .workspace > *, .desk.t-enter .modview > * { animation: t-rise 440ms 220ms var(--ease) both; }
/* Home (home.css): the stage's words and buttons rise after the pack, then the log on the right, then the day bar */
.desk.t-enter .hm-obj { animation: t-hero 560ms 200ms var(--t-spring) both; }
.desk.t-enter .hm-prompt > * { animation: t-rise 420ms 280ms var(--ease) both; }
.desk.t-enter .hm-prompt > .phead { animation-name: t-from-left; animation-delay: 240ms; }
.desk.t-enter .hm-prompt > .pacts { animation-delay: 320ms; }
.desk.t-enter .hm-hand { animation: t-rise 420ms 360ms var(--ease) both; }
.desk.t-enter .hud-drops > .hd-btn { animation: t-drop 380ms 380ms var(--ease) both; } /* #85 they drop out from under the plate */
.desk.t-enter .hud-drops > .hd-btn ~ .hd-btn { animation-delay: 430ms; }
.desk.t-enter .hm-day { animation: t-rise 460ms 400ms var(--ease) both; }
/* phones: the top bar sits under the menu row, right in the flying IRIS's path, so it drops in once IRIS has passed */
@media (max-width: 860px) { .desk.t-enter .top { animation-duration: 360ms; animation-delay: 380ms; } }
@keyframes t-fade { from { opacity: 0; } }
@keyframes t-drop { from { opacity: 0; transform: translateY(-18px); } }
@keyframes t-from-left { from { opacity: 0; transform: translateX(-22px); } }
@keyframes t-from-right { from { opacity: 0; transform: translateX(22px); } }
@keyframes t-rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes t-plate { from { opacity: 0; transform: translateY(18px) scale(.985); } }
@keyframes t-hero { from { opacity: 0; transform: translateY(22px) scale(.92); } }
@keyframes t-lit-in { from { opacity: 0; } }

/* ---------- the main menu's lit plate: one plate slides between the items (app.js moves it) ---------- */
.nav { position: relative; }
.nav > button { z-index: 1; }
.nav-lit { position: absolute; left: 0; top: 0; z-index: 0; width: 0; height: 0; pointer-events: none; border-radius: 0 8px 8px 0; opacity: 0;
  background: linear-gradient(90deg, rgba(94, 34, 38, .52), rgba(30, 15, 18, 0));
  transition: transform 260ms var(--t-spring), width 200ms var(--ease), height 200ms var(--ease), opacity 160ms ease; }
.nav-lit::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 2px; background: var(--red); box-shadow: 0 0 10px var(--red); }
.nav.has-lit .nav-lit { opacity: 1; }
body:is([data-theme], :not([data-theme])) .side .nav.has-lit > button[aria-current="true"] { background: none; } /* beats the per-theme washes */
.nav.has-lit > button[aria-current="true"]::before { content: none; }
.nav.lit-jump .nav-lit { transition: none; }
body[data-theme="holo"] .nav-lit { background: linear-gradient(90deg, rgba(150, 165, 210, .2), rgba(20, 20, 28, 0)); }
body[data-theme="holo"] .nav-lit::before { background: linear-gradient(180deg, #ffc7e6, #c9f3ff 50%, #e2d4ff); box-shadow: 0 0 10px rgba(170, 200, 255, .6); }
/* on the Battle Pass the plate turns gold (app.js sets .nav[data-on]); it eases colour as it slides */
.nav[data-on="pass"] .nav-lit, .nav[data-on="shop"] .nav-lit { background: linear-gradient(90deg, rgba(150, 112, 40, .42), rgba(40, 28, 10, 0)); }
.nav[data-on="pass"] .nav-lit::before, .nav[data-on="shop"] .nav-lit::before { background: linear-gradient(180deg, #fff1c4, #e7bd63 55%, #b98a3b); box-shadow: 0 0 12px rgba(240, 200, 112, .75); }
@media (max-width: 860px) {  /* phones: the menu is a tab bar along the bottom (home.css); the plate is a soft lit tile with a bar on its top edge */
  .nav-lit { border-radius: var(--r-lg); background: linear-gradient(180deg, rgba(94, 34, 38, .55), rgba(30, 15, 18, .18)); }
  .nav-lit::before { top: 0; bottom: auto; left: 26%; right: 26%; width: auto; height: 2px; border-radius: 0 0 2px 2px; }
  body[data-theme="holo"] .nav-lit { background: linear-gradient(180deg, rgba(150, 165, 210, .24), rgba(20, 20, 28, .1)); }
  .nav[data-on="pass"] .nav-lit, .nav[data-on="shop"] .nav-lit { background: linear-gradient(180deg, rgba(150, 112, 40, .45), rgba(40, 28, 10, .15)); }
}

/* ---------- Settings: in with its own moves, out quicker ---------- */
.set-sheet:not([hidden]) { animation: t-fade 200ms ease-out both; }
.set-sheet .set-panel { animation: t-sheet-in 300ms var(--ease) both; transform-origin: 50% 40%; }
.set-sheet .set-head h2 { animation: t-from-left 340ms 60ms var(--ease) both; }
.set-sheet .set-x { animation: t-spin-in 340ms 80ms var(--ease) both; }
.set-sheet .set-tabs [role=tab] { animation: t-from-left 320ms var(--ease) both; animation-delay: 90ms; }
.set-sheet .set-tabs [role=tab]:nth-child(2) { animation-delay: 120ms; }
.set-sheet .set-tabs [role=tab]:nth-child(3) { animation-delay: 150ms; }
.set-sheet .set-tabs [role=tab]:nth-child(4) { animation-delay: 180ms; }
.set-sheet .set-lit { animation: t-fade 260ms 160ms ease-out both; }
/* every time a pane shows (opening, or switching tabs) its rows rise in turn */
.set-sheet .set-pane > * { animation: t-rise 300ms var(--ease) both; animation-delay: 110ms; }
.set-sheet .set-pane > :nth-child(2) { animation-delay: 135ms; }
.set-sheet .set-pane > :nth-child(3) { animation-delay: 160ms; }
.set-sheet .set-pane > :nth-child(4) { animation-delay: 185ms; }
.set-sheet .set-pane > :nth-child(n+5) { animation-delay: 210ms; }
.set-sheet .set-foot .btn { animation: t-rise 300ms 200ms var(--ease) both; }
.set-sheet.closing { animation: t-fade-out 190ms ease-in forwards; pointer-events: none; }
.set-sheet.closing .set-panel { animation: t-sheet-out 170ms var(--t-out) forwards; }
.set-sheet.closing .set-panel * { animation: none; }
@keyframes t-sheet-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes t-sheet-out { to { opacity: 0; transform: translateY(8px) scale(.975); } }
@keyframes t-fade-out { to { opacity: 0; } }
@keyframes t-spin-in { from { opacity: 0; transform: rotate(-60deg) scale(.8); } }

/* ---------- reduced motion: no travel, quick fades, feedback kept ---------- */
@media (prefers-reduced-motion: reduce) {
  .desk.t-enter :is(.top, .brand b, .brand span, .nav > button, .nav-lit, .panel, .pcard, .pinfo > *, .workspace > *, .modview > *, .hm-obj, .hm-prompt > *, .hm-hand, .hud-drops > .hd-btn, .hm-day),
  .set-sheet :is(.set-panel, .set-head h2, .set-x, [role=tab], .set-lit, .set-pane > *, .set-foot .btn) {
    animation-name: t-fade !important; animation-duration: 160ms !important; animation-delay: 0ms !important; animation-timing-function: ease-out !important; }
  .intro.leaving :is(.intro-sub, .intro-line, .intro-hint, .wl-hi, .wl-lede, #enterBtn) { animation: t-fade-out 140ms ease forwards !important; }
  .set-sheet.closing, .set-sheet.closing .set-panel { animation: t-fade-out 120ms ease forwards !important; }
  .nav-lit { transition: opacity 120ms ease; }
}
