/* css/atlas.css · "The Atlas Method": the supplied Atlas artwork as a cinematic centrepiece.
   js/components/atlas.js writes --ap (0→1 scroll progress) on #atlas, adds .in to #atlasArt when it enters
   the viewport, and .is-on to the active principle. Everything is visible by default, so no JS or
   prefers-reduced-motion shows the finished, static composition. */

.atlas {
  --ap: .5;
  position: relative; color: var(--marble); padding: 0 !important; overflow: clip;
  background:
    radial-gradient(60% 50% at 72% 42%, rgba(26, 38, 58, .9), transparent 70%),
    linear-gradient(180deg, #101214, #0b0c0e);
}
.atlas::before { display: none !important; }
.atlas-stage {
  position: relative; display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: clamp(24px, 5vw, 80px); align-items: center; min-height: 100svh;
  padding: calc(var(--nav-h) + 24px) var(--pad) 40px;
}

/* ── copy ── */
.atlas-copy { position: relative; z-index: 2; max-width: 520px; }
.atlas-copy .eyebrow { color: var(--gold); }
.atlas-copy .section-h2 { margin-bottom: 32px; }
.atlas-copy em { font-style: italic; color: var(--gold); }
.atlas-steps { list-style: none; margin: 0 0 32px; padding: 0; display: grid; gap: 10px; }
.atlas-step { position: relative; padding: 16px 18px 16px 64px; border-left: 1px solid var(--rule-dk); }
.as-n { position: absolute; left: 18px; top: 14px; font: italic 500 1.5rem var(--display); color: var(--gold); }
.atlas-step h3 { font: 500 1.4rem var(--display); margin: 0 0 4px; }
.atlas-step p { margin: 0; color: var(--muted-dk); font-size: .98rem; max-width: 40ch; }
.atlas-step { transition: opacity .6s var(--ease), border-color .6s, background-color .6s; }
.atlas-step.is-on { border-left-color: var(--gold); background: linear-gradient(90deg, rgba(198, 161, 91, .1), transparent); }

/* ── artwork ── */
.atlas-art { position: relative; display: grid; place-items: center; }
.atlas-glow {
  position: absolute; width: min(96%, 760px); aspect-ratio: 1; top: 42%; left: 50%; translate: -50% -50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(46, 70, 112, .55), rgba(198, 161, 91, .10) 58%, transparent 100%);
  filter: blur(10px); animation: atGlow 9s ease-in-out infinite;
}
.atlas-frame {
  --ar: 2 / 3; --sx: 49.7%; --sy: 24.5%;
  position: relative; margin: 0; aspect-ratio: var(--ar);
  height: min(calc(100svh - var(--nav-h) - 64px), 860px); max-width: 100%;
}
/* thin gold double rule that follows the arch */
.atlas-frame::before, .atlas-frame::after { content: ""; position: absolute; pointer-events: none; border: 1px solid rgba(198, 161, 91, .5); border-radius: 50% 50% 2px 2px / 34% 34% 2px 2px; }
.atlas-frame::before { inset: 0; z-index: 3; }
.atlas-frame::after { inset: -10px; border-color: rgba(198, 161, 91, .2); border-radius: 50% 50% 4px 4px / 35% 35% 4px 4px; }
.af-inner { position: absolute; inset: 0; overflow: hidden; border-radius: 50% 50% 2px 2px / 34% 34% 2px 2px; background: #060912; isolation: isolate; box-shadow: 0 40px 120px -30px rgba(0, 0, 0, .9), 0 0 0 1px rgba(0, 0, 0, .6); }

.af-bg, .af-sphere { position: absolute; inset: 0; display: block; }
.af-bg img, .af-sphere img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; will-change: transform; transform-origin: 50% 40%; }
.af-bg img { transform: translate3d(0, calc((var(--ap) - .5) * -16px), 0) scale(calc(1.02 + var(--ap) * .045)); }
/* the celestial sphere: the same artwork, feather-masked to the upper sphere, drifting at a slightly different rate */
.af-sphere {
  -webkit-mask-image: radial-gradient(ellipse 25.5% 17% at var(--sx) var(--sy), #000 62%, transparent 100%);
          mask-image: radial-gradient(ellipse 25.5% 17% at var(--sx) var(--sy), #000 62%, transparent 100%);
}
.af-sphere img { transform: translate3d(calc((var(--ap) - .5) * 12px), calc((var(--ap) - .5) * 20px), 0) scale(calc(1.034 + var(--ap) * .045)); }
.in .af-sphere { animation: atDrift 16s ease-in-out infinite; }

/* gold shimmer: a slow sweep along the laurel arch + twinkling glints on the sun, capitals and crown */
.af-sheen {
  position: absolute; left: 0; top: 0; width: 100%; height: 29%; pointer-events: none; mix-blend-mode: screen; opacity: .55;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 224, 150, .5) 50%, transparent 62%) 160% 0 / 260% 100% no-repeat;
  -webkit-mask-image: radial-gradient(ellipse 42% 100% at 50% 100%, transparent 72%, #000 76%, #000 98%, transparent 100%);
          mask-image: radial-gradient(ellipse 42% 100% at 50% 100%, transparent 72%, #000 76%, #000 98%, transparent 100%);
}
.in .af-sheen { animation: atSheen 7.5s ease-in-out 1.2s infinite; }
.af-glints { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; }
.af-glints i { position: absolute; left: var(--x); top: var(--y); width: var(--s); height: var(--s); translate: -50% -50%; opacity: 0;
  background:
    radial-gradient(closest-side, rgba(255, 232, 170, .95), rgba(255, 214, 130, .25) 40%, transparent 70%),
    linear-gradient(90deg, transparent 8%, rgba(255, 236, 190, .9) 50%, transparent 92%) center / 100% 1px no-repeat,
    linear-gradient(0deg, transparent 8%, rgba(255, 236, 190, .9) 50%, transparent 92%) center / 1px 100% no-repeat; }
.in .af-glints i { animation: atGlint 5.4s ease-in-out var(--d) infinite; }
.af-vignette { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 70px 24px rgba(8, 10, 14, .55), inset 0 -90px 90px -40px rgba(8, 10, 14, .6); }

/* reveal: arch opens upwards, the artwork settles in. Only hidden once scroll.js sets html.motion. */
.motion .atlas-art:not(.in) .af-inner { clip-path: inset(100% 0 0 0); }
.motion .atlas-art:not(.in) .af-bg img { transform: scale(1.14); }
.motion .atlas-art:not(.in) .atlas-frame::before, .motion .atlas-art:not(.in) .atlas-frame::after { opacity: 0; }
.motion .atlas-art:not(.in) .atlas-glow { opacity: 0; }
.motion .atlas-art .af-inner { transition: clip-path 1.5s cubic-bezier(.2, .7, .1, 1); }
.motion .atlas-art .atlas-frame::before, .motion .atlas-art .atlas-frame::after { transition: opacity 1.2s var(--ease) .6s; }
.motion .atlas-art .atlas-glow { transition: opacity 1.6s var(--ease) .3s; }
.motion .atlas-art .af-bg img { transition: transform 1.8s cubic-bezier(.2, .7, .1, 1); }
.motion .atlas-art.in .af-bg img { transition: none; }   /* once revealed, scroll drives the transform directly */

@keyframes atGlow { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }
@keyframes atDrift { 0%, 100% { translate: 0 0; } 50% { translate: 2px -3px; } }
@keyframes atSheen { 0% { background-position: 160% 0; } 55%, 100% { background-position: -60% 0; } }
@keyframes atGlint { 0%, 100% { opacity: 0; scale: .5; } 45% { opacity: .95; scale: 1; } 70% { opacity: 0; scale: .7; } }

/* ── rail + pinned story (desktop; atlas.js adds .atlas-pinned) ── */
.atlas-rail { position: absolute; right: calc(var(--pad) * .4); top: 20%; bottom: 20%; width: 2px; background: var(--rule-dk); display: none; }
.atlas-rail span { position: absolute; inset: 0; background: var(--gold); transform-origin: 0 0; transform: scaleY(var(--ap, 1)); }
.atlas-pinned { height: 240vh; }
.atlas-pinned .atlas-stage { position: sticky; top: 0; height: 100svh; min-height: 0; padding-bottom: 24px; overflow: hidden; }
.atlas-pinned .atlas-rail { display: block; }
.atlas-pinned .atlas-step:not(.is-on) { opacity: .38; }

/* ── mobile / tablet: artwork first, copy beneath, normal flow ── */
@media (max-width: 900px) {
  .atlas-stage { grid-template-columns: 1fr; align-content: start; gap: 28px; padding-top: calc(var(--nav-h) + 20px); padding-bottom: 56px; }
  .atlas-art { order: -1; }
  .atlas-frame { height: auto; width: min(100%, 460px); }
  .atlas-glow { width: 120%; }
  .atlas-copy { max-width: 560px; margin-inline: auto; }
  .atlas-copy .section-h2 { font-size: clamp(1.9rem, 8vw, 2.8rem); margin-bottom: 20px; }
  .atlas-step { padding: 12px 0 12px 52px; }
  .as-n { left: 12px; top: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .atlas-glow, .in .af-sphere, .in .af-sheen, .in .af-glints i { animation: none; }
  .af-glints i { opacity: 0; }
  .af-bg img, .af-sphere img { transform: scale(1.03); }
}

/* ghost button on the dark stage */
.atlas .btn-g { color: var(--marble); border-color: rgba(198, 161, 91, .55); }
.atlas .btn-g:hover, .atlas .btn-g:focus-visible { background: var(--gold); color: #111; border-color: var(--gold); }
