/*
  Pampu homepage: Amber Hour light arc on Liquid Glass 2.0 layout.
  The page background shifts sunlit afternoon -> warm golden hour -> espresso dusk as you scroll.
  The four .sky layers sit right after <body> in index.html; amber-hour.js sets html[data-light] and
  this file crossfades the layers. Also lets the condo cinema stage show the dusk sky until it pins.
  Scripts off: no data-light, so the sunlit cream afternoon sky stays. Wrapped in @layer pages.
*/
@layer pages {
  /* Light layers: warm sunlit afternoon underneath, golden hour, subtle sunbeam, espresso dusk on top */
  .sky {
    position: fixed;
    inset: 0;
    z-index: -10;
    pointer-events: none;
  }

  .sky__layer {
    position: absolute;
    inset: 0;
  }

  .sky__afternoon {
    background:
      radial-gradient(70% 55% at 14% 6%, rgba(255, 252, 246, 0.95), transparent 70%),
      radial-gradient(circle at 50% 42%, #FFF8EE 0%, #F6EEE3 45%, #EBDCC6 100%);
  }

  .sky__golden {
    opacity: 0;
    background:
      radial-gradient(60% 50% at 84% 12%, rgba(242, 153, 56, 0.30), transparent 68%),
      radial-gradient(circle at 50% 42%, #FFF6E8 0%, #F8E4C6 45%, #EFC48A 100%);
  }

  .sky__sunbeam {
    background: linear-gradient(118deg, transparent 22%, rgba(255, 248, 236, 0.55) 34%, transparent 46%);
  }

  .sky__dusk {
    opacity: 0;
    background:
      radial-gradient(48% 38% at 50% 50%, rgba(245, 183, 107, 0.16), transparent 70%),
      radial-gradient(circle at 50% 40%, #3A2410 0%, #24170A 55%, #160D04 100%);
  }

  :root:is([data-light="golden"], [data-light="dusk"]) .sky__golden {
    opacity: 1;
  }

  :root[data-light="dusk"] .sky__dusk {
    opacity: 1;
  }

  /* Amber Night dark theme: lamp-lit espresso afternoon and deeper golden hour; no sunbeam */
  :root[data-theme="dark"] .sky__afternoon {
    background:
      radial-gradient(64% 50% at 15% 10%, rgba(215, 139, 48, 0.14), transparent 70%),
      linear-gradient(180deg, #1E1308 0%, #1A1006 55%, #150C04 100%);
  }

  :root[data-theme="dark"] .sky__golden {
    background:
      radial-gradient(60% 50% at 84% 12%, rgba(242, 153, 56, 0.22), transparent 68%),
      radial-gradient(circle at 50% 42%, #3A2410 0%, #2A1B0C 50%, #1C1207 100%);
  }

  :root[data-theme="dark"] .sky__sunbeam {
    opacity: 0;
  }

  /* Crossfade under no-preference only. amber-hour.js adds .is-live after scroll/load so initial paint is instant. */
  @media (prefers-reduced-motion: no-preference) {
    .sky.is-live .sky__layer {
      transition: opacity 1.2s cubic-bezier(0.65, 0, 0.35, 1);
    }
  }

  /* The sky replaces site.css's fixed body::before backdrop on the homepage only (other pages keep theirs) */
  body:has(> .sky)::before {
    display: none;
  }

  /* Pinned condo cinema stays transparent so the dusk sky shows until it pins; film fades in over P 3.0 -> 3.2. */
  .cinema.cinema--interactive,
  .cinema--interactive .cinema__sticky {
    background: transparent;
  }

  .cinema--interactive.cinema--frames .cinema__frames,
  .cinema--interactive :is(.cinema__plate--facade, .cinema__plate--window, .cinema__plate--closeup),
  .cinema--interactive .cinema__vignette {
    opacity: var(--film-o, 1);
  }

  .cinema--interactive .cinema__grain {
    opacity: calc(0.09 * var(--film-o, 1));
  }
}
