/* A living atlas, with still pages. All loops are opt-in and compositor-only. */
:root { --ambient-brass:#a18852; --ambient-moss:#71845c; --ambient-ease:cubic-bezier(.45,0,.55,1); }
body, [data-boss] { --ambient-brass:var(--theme-bright,#a18852); --ambient-moss:var(--theme-accent,#71845c); }
.atlas-ambience { position:fixed; inset:0; overflow:hidden; pointer-events:none; z-index:1; }
.atlas-ambience *, .ambient-instrument *, .ambient-library-seal * { pointer-events:none; }
.ambient-edge { position:absolute; top:93px; bottom:24px; width:18px; color:var(--ambient-brass); opacity:.72; }
.ambient-edge-west { left:235px; }
.ambient-edge-east { right:11px; }
.ambient-edge > svg { display:block; width:100%; height:100%; overflow:hidden; }
.ambient-leyline { stroke:#b9ba9e; stroke-width:.65; opacity:.5; }
.ambient-map-ticks { stroke:#a8af91; stroke-width:.8; opacity:.48; }
.ambient-map-mark { stroke:var(--ambient-brass); stroke-width:.8; opacity:.5; }
.ambient-ley-light { fill:var(--ambient-brass); opacity:.45; }
.ambient-light-trail { stroke:var(--ambient-brass); stroke-width:.8; opacity:.38; }

.topbar .motion-toggle { flex-shrink:0; display:inline-flex; align-items:center; justify-content:center; min-width:44px; min-height:44px; padding:5px; border-color:transparent; border-radius:50%; color:var(--theme-accent,#879066); }
.topbar .motion-toggle::before { content:none; }
.topbar .motion-toggle:hover { background:#e9ecdf; border-color:#c9d0b8; }
.topbar .motion-toggle[aria-pressed="true"] { color:#7f8877; }
.ambient-instrument { display:block; width:32px; height:32px; flex-shrink:0; }
.ambient-compass { display:block; width:100%; height:100%; overflow:visible; stroke:currentColor; stroke-width:.9; }
.ambient-compass-rim { opacity:.65; }
.ambient-compass-face { stroke-width:.6; fill:#dbe3c5; fill-opacity:.25; opacity:.6; }
.ambient-compass-ticks { stroke-width:1; opacity:.7; }
.ambient-compass-halo { stroke:var(--ambient-brass); stroke-width:1.2; }
.ambient-compass-needle { stroke:var(--ambient-moss); stroke-width:.9; }
.ambient-compass-arrow { fill:#c0caa5; fill-opacity:.3; }
.ambient-compass-point { fill:var(--ambient-brass); stroke:var(--ambient-brass); }
.ambient-compass-pin { fill:var(--ambient-brass); stroke:none; }
.ambient-compass-pivot { fill:var(--paper); stroke:var(--ambient-brass); }
.ambient-library-intro { position:relative; }
.ambient-library-seal { position:absolute; top:5px; right:20px; display:block; width:110px; height:110px; color:#9da78b; pointer-events:none; opacity:.78; }
.ambient-library-seal .ambient-compass-face { fill-opacity:.12; }
.ambient-library-seal .ambient-compass-halo { stroke-width:.65; }
.ambient-library-seal .ambient-compass-needle { stroke-width:.6; }

.ambient-stone { transform-origin:100px 82px; }
.ambient-engraving { fill:none; stroke:#fff0bc; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; opacity:.16; pointer-events:none; }
.pathway:not([open]) .ambient-engraving { stroke:#b3b878; opacity:.12; }
.ambient-stone-shadow { transform-origin:103px 124px; }
.ambient-starfield, .ambient-rune-ring { transform-origin:100px 76px; }
.ambient-sigil-ring, .ambient-sigil-satellite { transform-origin:120px 120px; }
.ambient-sigil-arc { stroke:var(--theme-accent,currentColor); stroke-width:1.1; opacity:.46; fill:none; }
.ambient-sigil-pin { fill:var(--theme-bright,currentColor); stroke:none; opacity:.8; }
.ambient-eye-glow { fill:none; stroke:var(--theme-bright,#b59c58); stroke-width:2.4; stroke-linecap:round; opacity:0; }
.ambient-compass-halo, .ambient-compass-needle { transform-origin:24px 24px; }

/* Declarations are paused by default, including bespoke themes loaded before or
   after this file. No-JS, unknown preferences, and offscreen art remain still. */
html .ambient-motion,
html [data-ambient-zone] .ambient-motion,
html [data-ambient-zone].ambient-motion { animation-play-state:paused; }

@media (prefers-reduced-motion:no-preference) {
  html[data-motion="full"] .ambient-stone { animation:atlas-stone-float 7.6s var(--ambient-ease) var(--ambient-phase,-1.8s) infinite; }
  html[data-motion="full"] .ambient-stone-shadow { animation:atlas-stone-shadow 7.6s var(--ambient-ease) var(--ambient-phase,-1.8s) infinite; }
  html[data-motion="full"] .ambient-engraving { animation:atlas-engraving-breath 7.6s var(--ambient-ease) var(--ambient-phase,-1.8s) infinite; }
  html[data-motion="full"] .ambient-starfield { animation:atlas-starlight 11s var(--ambient-ease) var(--ambient-phase,-1.8s) infinite; }
  html[data-motion="full"] .ambient-rune-ring { animation:atlas-rune-orbit 28s var(--ambient-ease) var(--ambient-phase,-1.8s) infinite; }
  html[data-motion="full"] .ambient-sigil-ring { animation:atlas-sigil-orbit 34s var(--ambient-ease) var(--ambient-phase,-1.8s) infinite; }
  html[data-motion="full"] .ambient-sigil-satellite { animation:atlas-sigil-satellite 19s var(--ambient-ease) var(--ambient-phase,-1.8s) infinite; }
  html[data-motion="full"] .ambient-eye-glow { animation:atlas-eye-glint 10.4s var(--ambient-ease) var(--ambient-phase,-1.8s) infinite; }
  html[data-motion="full"] .ambient-compass-needle { animation:atlas-compass-seek 9.6s var(--ambient-ease) -2.1s infinite; }
  html[data-motion="full"] .ambient-compass-halo { animation:atlas-compass-halo 21s var(--ambient-ease) -5.5s infinite; }
  html[data-motion="full"] .ambient-ley-light { animation:atlas-ley-drift 16s var(--ambient-ease) -3.1s infinite; }
  html[data-motion="full"] .ambient-ley-light-1 { animation-duration:19s; animation-delay:-10s; }
  html[data-motion="full"] .ambient-ley-light-2 { animation-duration:23s; animation-delay:-17s; }
  html[data-motion="full"] .encounter-orbit { animation:atlas-encounter-orbit var(--encounter-duration,32s) var(--ambient-ease) var(--encounter-delay,-7s) infinite; }
  html[data-motion="full"] .encounter-wisp { animation:atlas-encounter-wisp var(--encounter-duration,14s) var(--ambient-ease) var(--encounter-delay,-3s) infinite; }
  html[data-motion="full"] .encounter-particle { animation:atlas-encounter-particle var(--encounter-duration,11s) var(--ambient-ease) var(--encounter-delay,-4s) infinite; }
  html[data-motion="full"] .encounter-float { animation:atlas-encounter-float var(--encounter-duration,9s) var(--ambient-ease) var(--encounter-delay,-2s) infinite; }
  html[data-motion="full"] .encounter-glint { animation:atlas-encounter-glint var(--encounter-duration,8s) var(--ambient-ease) var(--encounter-delay,-2s) infinite; }
  html[data-motion="full"] .encounter-breath { animation:atlas-encounter-breath var(--encounter-duration,12s) var(--ambient-ease) var(--encounter-delay,-5s) infinite; }
  html[data-motion="full"] .encounter-trace { animation:atlas-encounter-trace var(--encounter-duration,10s) var(--ambient-ease) var(--encounter-delay,-3s) infinite; }

  /* This gate deliberately outranks all animation shorthands above and the
     encounter theme selectors. State changes pause in place, not restart loops. */
  html[data-motion="full"] .ambient-motion,
  html[data-motion="full"] [data-ambient-zone] .ambient-motion,
  html[data-motion="full"] [data-ambient-zone].ambient-motion { animation-play-state:paused; }
  html[data-motion="full"][data-ambient-state="running"] [data-ambient-zone][data-ambient-visible="true"] .ambient-motion,
  html[data-motion="full"][data-ambient-state="running"] [data-ambient-zone][data-ambient-visible="true"].ambient-motion { animation-play-state:running; }
  html[data-motion="full"][data-ambient-state="running"] .is-awakening [data-ambient-zone] .ambient-motion { animation-play-state:paused; }
}

@keyframes atlas-stone-float {
  0%,100% { transform:translateY(1px) rotate(-.35deg); }
  50% { transform:translateY(-4px) rotate(.55deg); }
}
@keyframes atlas-stone-shadow {
  0%,100% { transform:scaleX(1); opacity:.45; }
  50% { transform:scaleX(.91); opacity:.31; }
}
@keyframes atlas-engraving-breath {
  0%,100% { opacity:.08; }
  42%,58% { opacity:.64; }
}
@keyframes atlas-starlight {
  0%,100% { transform:rotate(-2deg) scale(.985); opacity:.62; }
  50% { transform:rotate(2deg) scale(1.015); opacity:1; }
}
@keyframes atlas-rune-orbit {
  0%,100% { transform:rotate(-7deg); opacity:.68; }
  50% { transform:rotate(11deg); opacity:1; }
}
@keyframes atlas-sigil-orbit {
  0%,100% { transform:rotate(-4deg); }
  50% { transform:rotate(8deg); }
}
@keyframes atlas-sigil-satellite {
  0%,100% { transform:rotate(-22deg); opacity:.4; }
  50% { transform:rotate(44deg); opacity:.9; }
}
@keyframes atlas-eye-glint {
  0%,27%,81%,100% { opacity:.03; }
  49%,57% { opacity:.68; }
}
@keyframes atlas-compass-seek {
  0%,100% { transform:rotate(-19deg); }
  50% { transform:rotate(23deg); }
}
@keyframes atlas-compass-halo {
  0%,100% { transform:rotate(-12deg); opacity:.65; }
  50% { transform:rotate(22deg); opacity:1; }
}
@keyframes atlas-ley-drift {
  0%,100% { transform:translateY(-20px); opacity:.12; }
  50% { transform:translateY(24px); opacity:.7; }
}
@keyframes atlas-encounter-orbit {
  0%,100% { transform:rotate(calc(var(--encounter-turn,12deg) * -1)); }
  50% { transform:rotate(var(--encounter-turn,12deg)); }
}
@keyframes atlas-encounter-wisp {
  0%,100% { transform:translate(0,0) scale(.98); opacity:var(--encounter-glow-low,.38); }
  50% { transform:translate(var(--encounter-drift-x,6px),var(--encounter-drift-y,-4px)) scale(1.025); opacity:var(--encounter-glow-high,.8); }
}
@keyframes atlas-encounter-particle {
  0%,100% { transform:translate(0,4px); opacity:var(--encounter-glow-low,.25); }
  50% { transform:translate(var(--encounter-drift-x,3px),var(--encounter-drift-y,-10px)); opacity:var(--encounter-glow-high,.9); }
}
@keyframes atlas-encounter-float {
  0%,100% { transform:translate(0,1px) rotate(-.35deg); }
  50% { transform:translate(var(--encounter-drift-x,0px),var(--encounter-drift-y,-5px)) rotate(.5deg); }
}
@keyframes atlas-encounter-glint {
  0%,24%,82%,100% { opacity:var(--encounter-glow-low,.1); }
  48%,56% { opacity:var(--encounter-glow-high,.85); }
}
@keyframes atlas-encounter-breath {
  0%,100% { transform:scale(.985); opacity:var(--encounter-glow-low,.5); }
  50% { transform:scale(1.025); opacity:var(--encounter-glow-high,.9); }
}
@keyframes atlas-encounter-trace {
  0%,100% { opacity:var(--encounter-glow-low,.12); }
  42%,62% { opacity:var(--encounter-glow-high,.65); }
}

/* Never let a matching class in imported material become an animation target. */
html[data-ambient-initialized] :is(.source-content,.guide-content) .ambient-motion { animation:none!important; }
html[data-motion="reduced"] [data-ambient-zone] .ambient-motion,
html[data-ambient-state="reduced"] [data-ambient-zone] .ambient-motion { animation:none!important; }
@media (prefers-reduced-motion:reduce) {
  html [data-ambient-zone] .ambient-motion,
  html .encounter-scene .ambient-motion { animation:none!important; }
}
@media (max-width:1200px) { .ambient-edge-west { left:202px; } .ambient-edge-east { right:6px; } }
@media (max-width:1100px) { .ambient-library-seal { display:none; } }
@media (max-width:980px) { .ambient-edge-west { left:183px; width:15px; } .ambient-edge-east { right:4px; width:15px; } }
@media (max-width:760px) {
  .ambient-edge { top:81px; width:9px; opacity:.5; }
  .ambient-edge-west { left:3px; }
  .ambient-edge-east { right:3px; }
  .topbar .top-links { display:inline-flex; align-items:center; flex-shrink:0; gap:7px; }
  .topbar .search-trigger { min-width:0; }
  .topbar .search-trigger > span { min-width:0; max-width:none; flex:1; }
  .topbar .motion-toggle { display:inline-flex; width:44px; min-width:44px; min-height:44px; padding:6px; }
  .ambient-instrument { width:30px; height:30px; }
}
@media print { .atlas-ambience,.ambient-instrument,.ambient-library-seal { display:none!important; } html [data-ambient-zone] .ambient-motion { animation:none!important; } }
