/* ==========================================================================
   Home page welcome screen (assets/js/sky-intro.js): a telescope on a tripod facing the visitor, against the Milky Way
   and a mountain horizon. The front of the tube is a lens with the logo and the name on the glass; the call to action
   sits beside it (wide screens) or under it (tall screens). Shown only while <html data-intro="on">.
   The colours are fixed (it is always a night sky): white or near-white text on a near-black sky (AAA).
   One gradient (cyan, indigo, violet) runs through the logo, the letters, the rings and the button.
   ========================================================================== */
.sky-intro { display: none; }
html[data-intro="on"] .sky-intro {
  display: block; position: fixed; inset: 0; z-index: 3000; overflow: hidden; color: #f8fafc;
  background:
    radial-gradient(ellipse 60% 44% at 50% 92%, rgba(255, 150, 110, 0.14), transparent 70%),
    radial-gradient(ellipse 54% 46% at 40% 36%, rgba(60, 70, 190, 0.16), transparent 70%),
    radial-gradient(ellipse 70% 60% at 10% 90%, rgba(110, 40, 140, 0.20), transparent 70%),
    radial-gradient(ellipse 60% 60% at 92% 8%, rgba(20, 110, 150, 0.22), transparent 70%),
    #03050d;
}
html[data-intro="on"], html[data-intro="on"] body { overflow: hidden; }

.intro-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.intro-milkyway { position: absolute; inset: -25%; pointer-events: none; transform: rotate(-24deg);
  background: linear-gradient(90deg, transparent 26%, rgba(99, 102, 241, 0.07) 38%, rgba(192, 132, 252, 0.11) 48%, rgba(255, 190, 150, 0.07) 54%, rgba(34, 211, 238, 0.06) 62%, transparent 74%);
  filter: blur(18px); animation: milky 80s ease-in-out infinite alternate; }
@keyframes milky { from { transform: rotate(-24deg) translateX(-4%); } to { transform: rotate(-20deg) translateX(4%); } }
.intro-glow { position: absolute; left: -10%; right: -10%; bottom: 0; height: 46vh; pointer-events: none;
  background: radial-gradient(ellipse 60% 70% at 50% 100%, rgba(255, 140, 100, 0.34), rgba(192, 132, 252, 0.2) 40%, transparent 72%); }
.intro-ground { position: absolute; left: 0; bottom: 0; width: 100%; height: 30vh; display: block; pointer-events: none; transform-origin: 50% 0; transition: opacity 1.2s ease 0.2s, transform 1.8s cubic-bezier(0.6, 0, 0.8, 0.4); }

/* the stage: telescope and call to action */
.intro-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: clamp(0px, 1vw, 20px); }
.intro-scope {
  --W: min(82vh, 52vw, 700px);
  position: relative; flex: none; width: var(--W); aspect-ratio: 600 / 760; margin: -2vh 0 -8vh;
  transform-origin: 50% 68.4%; transition: transform 2.2s cubic-bezier(0.6, 0, 0.85, 0.4), opacity 0.7s ease 1.05s; will-change: transform;
  animation: scope-in 2.2s cubic-bezier(0.2, 0.7, 0.2, 1) 0.1s backwards;
}
@keyframes scope-in { from { opacity: 0; transform: translateY(26px) scale(0.97); } }
.intro-scope-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 0 22px rgba(80, 90, 220, 0.28)); }
.intro-ticks { transform-origin: 0 0; animation: intro-turn 120s linear infinite; }
.intro-ticks-slow { transform-origin: 0 0; animation: intro-turn 200s linear infinite reverse; }
@keyframes intro-turn { to { transform: rotate(360deg); } }
.intro-ring { stroke-dasharray: 1; stroke-dashoffset: 0; animation: ring-draw 2.6s cubic-bezier(0.3, 0.6, 0.2, 1) 0.4s backwards; }
@keyframes ring-draw { from { stroke-dashoffset: 1; opacity: 0.2; } }
.intro-disc { position: absolute; left: 50%; top: 68.4%; width: 0; height: 0; }

/* the name, above the call to action */
.intro-text { display: flex; flex-direction: column; align-items: center; text-align: center; margin: 0 0 clamp(18px, 3.4vh, 34px); transition: opacity 0.8s ease, transform 1.2s ease; }
.intro-emblem { width: clamp(44px, 7vmin, 68px); height: clamp(44px, 7vmin, 68px); margin: 0 0 10px; flex: none;
  filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.55)); transition: transform 1.4s ease, filter 1.2s ease;
  animation: emblem-in 2s cubic-bezier(0.2, 0.7, 0.2, 1) 0.9s backwards, emblem-glow 6s ease-in-out 3s infinite alternate; }
@keyframes emblem-in { from { opacity: 0; transform: scale(0.78); filter: blur(10px) drop-shadow(0 0 0 transparent); } }
@keyframes emblem-glow { from { filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.35)); } to { filter: drop-shadow(0 0 22px rgba(192, 132, 252, 0.7)); } }
.intro-title { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(2.4rem, 6.4vmin, 4rem); line-height: 1.04; letter-spacing: 0.03em; }
.intro-title .gradient-text {
  display: inline-block; background: linear-gradient(135deg, #67e8f9, #a5b4fc 55%, #e0b3ff);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; text-shadow: none; filter: drop-shadow(0 0 10px rgba(129,140,248,0.55));
  animation: title-wipe 1.8s cubic-bezier(0.3, 0.6, 0.2, 1) 1.7s backwards;
}
@keyframes title-wipe { from { clip-path: inset(-20% 100% -20% 0); opacity: 0; } to { clip-path: inset(-20% -5% -20% -5%); opacity: 1; } }
.intro-aero { margin: 8px 0 0; font: 500 0.82rem/1.3 var(--font-mono); letter-spacing: 0.6em; text-indent: 0.6em; text-transform: uppercase; color: #e6eaff; animation: intro-fade 1.6s ease-out 2.5s backwards; }
.intro-eyebrow { margin: 6px 0 0; font: 500 0.68rem/1.3 var(--font-mono); letter-spacing: 0.24em; text-transform: uppercase; color: #b9c4ff; animation: intro-fade 1.6s ease-out 2.5s backwards; }
@keyframes intro-fade { from { opacity: 0; transform: translateY(10px); } }

/* the call to action */
.intro-cta { flex: none; width: min(36vw, 400px); text-align: center; transition: opacity 0.7s ease, transform 1s ease; }
.intro-phrase { margin: 0 0 18px; font: italic 400 clamp(1.5rem, 3.2vmin, 2.2rem)/1.25 var(--font-body); color: #f1f5f9; letter-spacing: 0.01em; animation: intro-fade 1.6s ease-out 3s backwards; }
.intro-phrase small { display: block; margin-top: 6px; font-size: 0.6em; font-style: normal; letter-spacing: 0.05em; color: #cbd5e1; }
.intro-ignite {
  position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 12px; padding: 0; border: 0; background: none; cursor: pointer; color: #e8ecff;
  animation: intro-fade 1.6s ease-out 3.4s backwards;
}
.ig-core {
  position: relative; z-index: 1; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; color: #e8ecff; border: 1.5px solid transparent;
  background: radial-gradient(circle at 50% 38%, rgba(20, 24, 70, 0.92), rgba(6, 8, 24, 0.95)) padding-box, linear-gradient(135deg, #22d3ee, #6366f1 55%, #c084fc) border-box;
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.5), inset 0 0 18px rgba(99, 102, 241, 0.3); transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.ig-core svg { width: 32px; height: 32px; filter: drop-shadow(0 0 6px #818cf8); animation: ig-spin 18s linear infinite; }
@keyframes ig-spin { to { transform: rotate(360deg); } }
.ig-ripple { position: absolute; top: 0; left: 50%; width: 76px; height: 76px; margin-left: -38px; border-radius: 50%; border: 1.5px solid rgba(129, 140, 248, 0.6); pointer-events: none; animation: ig-ripple 3.4s ease-out infinite; }
.ig-ripple--2 { animation-delay: 1.7s; }
@keyframes ig-ripple { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(2.6); opacity: 0; } }
.ig-label { font: 600 0.86rem/1 var(--font-mono); letter-spacing: 0.4em; text-indent: 0.4em; text-transform: uppercase; color: #d6dcff; }
.intro-ignite:hover .ig-core { transform: scale(1.1); box-shadow: 0 0 52px rgba(129, 140, 248, 0.8), inset 0 0 22px rgba(129, 140, 248, 0.45); }
.intro-ignite:hover .ig-core svg { animation-duration: 4s; }
.intro-ignite:focus-visible { outline: none; }
.intro-ignite:focus-visible .ig-core { outline: 2px solid #ffffff; outline-offset: 5px; }
.intro-ignite:disabled { cursor: default; }
.intro-skip { display: block; margin: 16px auto 0; padding: 8px 14px; background: none; border: 0; cursor: pointer; font: 500 0.78rem/1 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: #c9d1ff; text-decoration: underline; text-underline-offset: 4px; animation: intro-fade 1.6s ease-out 3.8s backwards; }
.intro-skip:hover { color: #ffffff; }
.intro-skip:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }

/* the speaker */
.intro-sound { position: absolute; top: 18px; right: 18px; z-index: 2; width: 46px; height: 46px; border-radius: 50%; padding: 0; cursor: pointer; color: #d6dcff;
  display: inline-flex; align-items: center; justify-content: center; border: 1px solid rgba(129, 140, 248, 0.5); background: rgba(8, 10, 24, 0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: box-shadow 0.3s, border-color 0.3s; animation: intro-fade 1.6s ease-out 3.2s backwards; }
.intro-sound:hover { box-shadow: 0 0 18px rgba(129, 140, 248, 0.6); border-color: #a5b4fc; }
.intro-sound:focus-visible { outline: 2px solid #ffffff; outline-offset: 3px; }
.intro-sound svg { width: 22px; height: 22px; }
.intro-sound .waves { opacity: 0.25; transition: opacity 0.3s; }
.intro-sound.is-on .waves { opacity: 1; animation: waves-pulse 3.2s ease-in-out infinite; }

/* ignition: the camera rushes into the lens, the text lets go, a flash, then the sky opens */
.sky-intro.is-igniting .intro-scope { animation: scope-dive 2s linear forwards; }
/* into the telescope: a short breath back, then the camera glides straight into the lens, faster and faster,
   while the glass lights up from inside; the light becomes the flash and the warp carries on beyond it */
@keyframes scope-dive {
  0% { transform: scale(1); opacity: 1; animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1); }
  14% { transform: scale(0.96); opacity: 1; animation-timing-function: cubic-bezier(0.5, 0, 0.9, 0.6); }
  62% { transform: scale(4.2); opacity: 1; animation-timing-function: cubic-bezier(0.6, 0, 1, 0.7); }
  88% { transform: scale(18); opacity: 1; }
  100% { transform: scale(34); opacity: 0; }
}
.sky-intro.is-igniting .intro-scope-svg { filter: drop-shadow(0 0 34px rgba(129, 140, 248, 0.6)); transition: filter 1s ease; }
.sky-intro.is-igniting .intro-flash { animation: lens-glow 1.15s cubic-bezier(0.5, 0, 0.9, 0.6) forwards; }
@keyframes lens-glow { from { opacity: 0; transform: scale(0.02); } to { opacity: 0.85; transform: scale(0.3); } }
.sky-intro.is-igniting .intro-milkyway { transform: rotate(-24deg) scale(1.18); transition: transform 2.2s cubic-bezier(0.6, 0, 0.8, 0.4); animation: none; }
.sky-intro.is-igniting .intro-emblem { transform: scale(1.3); filter: drop-shadow(0 0 60px rgba(210, 220, 255, 0.95)); animation: none; }
.sky-intro.is-igniting .intro-cta { opacity: 0; transform: translateY(24px); }
.sky-intro.is-igniting .intro-ground { opacity: 0; transform: translateY(14vh) scale(1.15); }
.sky-intro.is-igniting .intro-glow { opacity: 0; transition: opacity 1.4s ease 0.3s; }
.intro-flash { position: absolute; left: var(--cx, 38%); top: var(--cy, 40%); width: 130vmax; height: 130vmax; margin: -65vmax 0 0 -65vmax; border-radius: 50%; opacity: 0; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.97) 0%, rgba(160, 190, 255, 0.6) 18%, rgba(120, 90, 255, 0.2) 42%, transparent 66%); }
.sky-intro.is-flash .intro-flash { animation: intro-flash 1.5s ease-out forwards; }
@keyframes intro-flash { 0% { opacity: 0.85; transform: scale(0.3); } 30% { opacity: 1; transform: scale(0.7); } 100% { opacity: 0; transform: scale(1.6); } }
.sky-intro.is-leaving { opacity: 0; transition: opacity 1.2s ease; pointer-events: none; }

/* tall screens: the telescope on top, the call to action under it */
@media (max-aspect-ratio: 23/20) {
  .intro-stage { flex-direction: column; justify-content: flex-start; gap: 0; padding-top: 2vh; }
  .intro-scope { --W: min(100vw, 44vh, 600px); margin: 0; -webkit-mask-image: linear-gradient(#000 78%, transparent 92%); mask-image: linear-gradient(#000 78%, transparent 92%); }
  .intro-cta { width: min(92vw, 520px); margin-top: -1vh; position: relative; z-index: 2; }
  .intro-text { margin-bottom: 12px; }
  .intro-emblem { width: 36px; height: 36px; margin-bottom: 4px; }
  .intro-title { font-size: clamp(2.1rem, 5vh, 3rem); }
  .intro-phrase { margin-bottom: 14px; }
  .intro-ground { height: 24vh; }
}
@media (max-width: 700px) {
  .intro-eyebrow { display: none; }
  .ig-core, .ig-ripple { width: 68px; height: 68px; }
  .ig-ripple { margin-left: -34px; }
}
/* short, wide screens (a phone on its side) */
@media (max-height: 520px) and (min-aspect-ratio: 23/20) {
  .intro-scope { --W: min(104vh, 46vw); margin: -6vh 0 -12vh; }
  .intro-cta { width: min(38vw, 320px); }
  .intro-eyebrow { display: none; }
  .intro-phrase { font-size: 1.25rem; margin-bottom: 8px; }
  .intro-text { margin-bottom: 8px; }
  .intro-emblem { width: 30px; height: 30px; margin-bottom: 4px; }
  .intro-title { font-size: 1.9rem; }
  .intro-aero { font-size: 0.7rem; margin-top: 4px; }
  .intro-phrase small { display: none; }
  .ig-core, .ig-ripple { width: 54px; height: 54px; }
  .ig-ripple { margin-left: -27px; }
  .ig-core svg { width: 24px; height: 24px; }
  .intro-ignite { gap: 6px; }
  .intro-skip { margin-top: 4px; padding: 4px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .intro-ticks, .intro-ticks-slow, .intro-ring, .intro-scope, .intro-emblem, .intro-title .gradient-text, .intro-aero, .intro-eyebrow, .intro-phrase, .intro-ignite, .intro-skip, .intro-sound,
  .ig-core svg, .ig-ripple, .intro-milkyway { animation: none; }
  .ig-ripple { display: none; }
  .sky-intro.is-igniting .intro-scope { animation: none; opacity: 0; transition: opacity 0.6s ease; }
  .sky-intro.is-igniting .intro-ground, .sky-intro.is-igniting .intro-milkyway { transform: none; }
  .sky-intro.is-flash .intro-flash { animation: none; }
}
@media print { .sky-intro { display: none !important; } }
