/* rk-ambient.css — "Living sky": the fleet's ambient layer (4 Dec 2026).
   Canonical template: tools/ambient/ambient.template.css. Built per site by tools/ambient/build.py, which stamps the class
   prefix (rk / pr), each design's own selector map and the site's sky palette.
   The stars and constellation lines are drawn by rk-sky.js on one fixed canvas, screen-blended so they only appear on dark
   grounds. This file is the CSS half: aurora breath in the hero, a slowly turning lotus mandala behind each illustration,
   light that follows the cursor, the hero entrance, card glow, a staggered cascade after each section reveals, a sheen on the
   primary button and a reading-progress line. Nothing here hides content unless the lead JS has marked a section revealed.
   Motion runs regardless of the OS power setting (owner's instruction, 4 Dec 2026): no prefers-reduced-motion gate here. */

:root{--sky1:#f2c568;--sky2:#f3eadf;--sky3:#c98aa8;--amb:cubic-bezier(.2,.7,.2,1)}

/* ---------- the sky itself (rk-sky.js creates the canvas) ---------- */
.rk-sky{position:fixed;inset:0;width:100%;height:100%;pointer-events:none;z-index:5;mix-blend-mode:screen;contain:strict;animation:rkSkyIn 1.8s ease both}
@keyframes rkSkyIn{from{opacity:0}to{opacity:1}}
/* surfaces sit above the sky, so lines never run across something being read */
:is(.rk-card,.rk-xc,.rk-src article,.rk-price,.rk-faq details,.rk-claim>div,.rk-panel,.rk-ftform,.rk-toc,.rk-sidecta,.rk-table,.rk-inline,.rk-player,.rk-sp,.rk-step i,.rk-cartline){position:relative;z-index:6}
@media print{.rk-sky,.rk-progress{display:none}}

/* ---------- reading progress ---------- */
.rk-progress{position:fixed;left:0;top:0;width:100%;height:2px;z-index:60;pointer-events:none;transform:scaleX(0);transform-origin:0 50%;opacity:0;
  background:linear-gradient(90deg,color-mix(in srgb,var(--sky1) 40%,transparent),var(--sky1));transition:opacity .4s ease}
.rk-progress.rk-on{opacity:.9}

/* ---------- hero: aurora breath + light that follows the cursor ---------- */
.rk-hero{isolation:isolate;--mx:62%;--my:40%}
.rk-hero::before{content:"";position:absolute;inset:-18%;z-index:-1;pointer-events:none;
  background:radial-gradient(42% 48% at 80% 46%,color-mix(in srgb,var(--ac) 20%,transparent),transparent 72%),
             radial-gradient(38% 44% at 8% 92%,color-mix(in srgb,var(--sky3) 13%,transparent),transparent 72%),
             radial-gradient(56% 56% at 44% 4%,rgba(255,255,255,.07),transparent 70%);
  animation:rkAurora 26s ease-in-out infinite alternate}
.rk-hero::after{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;opacity:0;transition:opacity .9s ease;
  background:radial-gradient(560px circle at var(--mx) var(--my),color-mix(in srgb,var(--ac) 15%,transparent),transparent 64%)}
.rk-hero.rk-lit::after{opacity:1}

/* ---------- hero art: a lotus mandala turning once every few minutes, and a halo that breathes ---------- */
.rk-hero-art::before{content:"";position:absolute;inset:-22% -18%;z-index:0;pointer-events:none;opacity:.46;
  background:var(--ac);
  -webkit-mask:url(/assets/mandala.svg?v=29939921) center/contain no-repeat,radial-gradient(closest-side,transparent 36%,#000 60%);
          mask:url(/assets/mandala.svg?v=29939921) center/contain no-repeat,radial-gradient(closest-side,transparent 36%,#000 60%);
  -webkit-mask-composite:source-in;mask-composite:intersect;
  animation:rkSpin 160s linear infinite}
.rk-hero-art::after{content:"";position:absolute;inset:-8%;z-index:0;pointer-events:none;
  background:radial-gradient(closest-side,color-mix(in srgb,var(--ac) 30%,transparent),transparent 74%);
  animation:rkBreath 9s ease-in-out infinite alternate}
.rk-hero-art>svg{position:relative;z-index:1;translate:calc(var(--px,0)*12px) calc(var(--py,0)*10px);transition:translate .9s var(--amb);
  animation:rkFloat 7s ease-in-out infinite alternate}

/* ---------- the last call and the dark sections between: a quieter version of the same light ---------- */
:is(.rk-night,.rk-deep):not(.rk-hero):not(.rk-final)::before{content:"";position:absolute;inset:-12%;pointer-events:none;z-index:0;
  background:radial-gradient(50% 60% at 12% 18%,color-mix(in srgb,var(--ac) 12%,transparent),transparent 70%),
             radial-gradient(46% 56% at 90% 84%,color-mix(in srgb,var(--sky3) 11%,transparent),transparent 70%);
  animation:rkAurora 36s ease-in-out infinite alternate}
.rk-final{isolation:isolate}
.rk-final::before{content:"";position:absolute;inset:-12%;z-index:-1;pointer-events:none;
  background:radial-gradient(46% 52% at 50% 42%,color-mix(in srgb,var(--ac) 18%,transparent),transparent 70%);
  animation:rkBreath 11s ease-in-out infinite alternate}
.rk-final>svg{animation:rkRot 170s linear infinite;transform-origin:50% 50%}

/* ---------- light sections: a slow wash of warm and rose light ---------- */
:is(.rk-paper,.rk-sand,.rk-sage):not(.rk-hero)::before{content:"";position:absolute;inset:-10%;pointer-events:none;z-index:0;
  background:radial-gradient(46% 54% at 88% 14%,color-mix(in srgb,var(--amber) 16%,transparent),transparent 70%),
             radial-gradient(42% 48% at 8% 88%,color-mix(in srgb,var(--rose) 22%,transparent),transparent 70%);
  animation:rkHaze 40s ease-in-out infinite alternate}

/* ---------- the hero arrives once: headline, lead, buttons, art ---------- */
.rk-hero .rk-h1,.rk-hero .rk-lead,.rk-hero .rk-row,.rk-hero .rk-hero-art{animation:rkRise 1.05s var(--amb) both}
.rk-hero .rk-h1{animation-delay:.06s}.rk-hero .rk-lead{animation-delay:.2s}.rk-hero .rk-row{animation-delay:.34s}.rk-hero .rk-hero-art{animation-delay:.16s}
@supports ((-webkit-background-clip:text) or (background-clip:text)){
  .rk-hero .rk-h1 em{background:linear-gradient(105deg,var(--ac) 0%,var(--ac) 40%,var(--sky2) 50%,var(--ac) 60%,var(--ac) 100%);
    background-size:260% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;-webkit-text-fill-color:transparent;
    animation:rkShimmer 9s ease-in-out 1.4s infinite}
}
@media print{.rk-hero .rk-h1 em{background:none;color:var(--ac);-webkit-text-fill-color:currentColor}}

/* ---------- after a section reveals, its cards follow one another ---------- */
.rk-sec.rk-in:is(.rk-grid,.rk-steps,.rk-src,.rk-faq,.rk-spine)>*,.rk-sec.rk-in :is(.rk-grid,.rk-steps,.rk-src,.rk-faq,.rk-spine)>*{animation:rkRise .8s var(--amb) backwards;animation-delay:calc(var(--i,0)*80ms + 120ms)}
.rk-sec :is(.rk-grid,.rk-steps,.rk-src,.rk-faq,.rk-spine)>:nth-child(2){--i:1}
.rk-sec :is(.rk-grid,.rk-steps,.rk-src,.rk-faq,.rk-spine)>:nth-child(3){--i:2}
.rk-sec :is(.rk-grid,.rk-steps,.rk-src,.rk-faq,.rk-spine)>:nth-child(4){--i:3}
.rk-sec :is(.rk-grid,.rk-steps,.rk-src,.rk-faq,.rk-spine)>:nth-child(n+5){--i:4}

/* ---------- cards that glow where you point (rk-sky.js marks the targets with .rk-glow) ---------- */
@media (hover:hover) and (pointer:fine){
  .rk-glow{isolation:isolate}
  .rk-glow::after{content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;z-index:-1;opacity:0;transition:opacity .55s ease;
    background:radial-gradient(300px circle at var(--gx,50%) var(--gy,-20%),color-mix(in srgb,var(--ac) 17%,transparent),transparent 62%)}
  .rk-glow:hover::after,.rk-glow:focus-visible::after{opacity:1}
  .rk-cta{position:relative;overflow:hidden}
  .rk-cta::after{content:"";position:absolute;top:-45%;bottom:-45%;left:0;width:36%;pointer-events:none;opacity:0;transform:translateX(-170%) skewX(-20deg);
    background:linear-gradient(90deg,transparent,rgba(255,255,255,.55),transparent)}
  .rk-cta:hover::after,.rk-cta:focus-visible::after{opacity:1;animation:rkSheen .9s ease}
}

@keyframes rkAurora{from{transform:translate3d(-2.5%,-1.5%,0) scale(1)}to{transform:translate3d(2.5%,2%,0) scale(1.07)}}
@keyframes rkHaze{from{transform:translate3d(-2%,-1.5%,0) scale(1)}to{transform:translate3d(2%,2%,0) scale(1.05)}}
@keyframes rkSpin{to{transform:rotate(360deg)}}
@keyframes rkRot{to{rotate:360deg}}
@keyframes rkBreath{from{transform:scale(.94);opacity:.6}to{transform:scale(1.08);opacity:1}}
@keyframes rkFloat{from{transform:translateY(-5px)}to{transform:translateY(6px)}}
@keyframes rkRise{from{opacity:0;transform:translate3d(0,26px,0)}to{opacity:1;transform:none}}
@keyframes rkShimmer{0%,58%{background-position:120% 0}100%{background-position:-40% 0}}
@keyframes rkSheen{from{transform:translateX(-170%) skewX(-20deg)}to{transform:translateX(390%) skewX(-20deg)}}
