/* Night Relay Labs: the moving parts (home hero, mission read-out, Panora walkthrough, gallery).
   Loads after site.css. Everything here is readable with motion off (prefers-reduced-motion) or without JS. */

/* ---------- hero: the relay ---------- */
.hero2 { position: relative; overflow: hidden; display: flex; align-items: center;
  min-height: min(880px, calc(100svh - 68px)); padding: 48px 0 110px;
  background: radial-gradient(55% 60% at 78% 30%, rgba(255, 180, 143, .07), transparent 70%),
              radial-gradient(45% 45% at 8% 92%, rgba(111, 227, 191, .06), transparent 70%),
              linear-gradient(180deg, #071a1d 0%, #061518 100%); }
.sky2 { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.hero2 .wrap { position: relative; z-index: 1; }
.hero2-grid { display: grid; grid-template-columns: 1.3fr .7fr; gap: clamp(24px, 4vw, 64px); align-items: center; }
.hero2-copy { min-width: 0; }
.hero2 h1 { font-size: clamp(42px, 6.3vw, 86px); }
.relay { justify-self: center; width: min(100%, 420px); aspect-ratio: 1;
  transform: translateY(calc(var(--hp, 0) * 70px)) scale(calc(1 - var(--hp, 0) * .1)); opacity: calc(1 - var(--hp, 0) * .7);
  will-change: transform; }
.relay svg { width: 100%; height: 100%; display: block; overflow: visible; }
.relay .beam { stroke: #2c5357; stroke-width: .35; stroke-dasharray: .8 1.6; stroke-linecap: round; fill: none; }
.relay .halo { transform-box: fill-box; transform-origin: center; }
.relay .h1 { animation: flare1 6s ease-in-out infinite; }
.relay .h2 { animation: flare2 6s ease-in-out infinite; }
.relay .h3 { animation: flare3 6s ease-in-out infinite; }
@keyframes flare1 { 0%, 2% { opacity: .35; transform: scale(1); } 7% { opacity: 1; transform: scale(1.3); } 20%, 100% { opacity: .35; transform: scale(1); } }
@keyframes flare2 { 0%, 22% { opacity: .3; transform: scale(1); } 29% { opacity: 1; transform: scale(1.28); } 44%, 100% { opacity: .3; transform: scale(1); } }
@keyframes flare3 { 0%, 55% { opacity: .5; transform: scale(1); } 63% { opacity: 1; transform: scale(1.16); } 84%, 100% { opacity: .5; transform: scale(1); } }

.stagger .w { display: inline-block; opacity: 0; transform: translateY(.32em); animation: rise .9s cubic-bezier(.2, .7, .2, 1) forwards; }
.stagger > .w:first-child { animation-delay: .05s; }
.stagger > .w:nth-child(2) { animation-delay: .14s; }
.stagger .quiet .w:first-child { animation-delay: .28s; }
.stagger .quiet .w:last-child { animation-delay: .38s; }
.hero2 .eyebrow, .hero2 .lede, .hero2 .btns { opacity: 0; animation: rise .9s cubic-bezier(.2, .7, .2, 1) forwards; }
.hero2 .eyebrow { animation-delay: 0s; }
.hero2 .lede { animation-delay: .5s; }
.hero2 .btns { animation-delay: .62s; }
@keyframes rise { from { opacity: 0; transform: translateY(.32em); } to { opacity: 1; transform: none; } }
.hero2 .lede, .hero2 .btns, .hero2 .eyebrow { transform: none; }

@media (max-width: 860px) {
  .hero2 { min-height: 0; padding: 28px 0 96px; }
  .hero2-grid { grid-template-columns: 1fr; gap: 8px; }
  .relay { order: -1; width: min(62vw, 260px); justify-self: start; margin-left: -10px; }
}

/* ---------- mission: a sentence that lights up as you read ---------- */
.mission2 { border-top: 1px solid var(--line); }
.mission2 h2 { max-width: 16em; }
.readout { margin: 36px 0 0; max-width: 30ch; font: 600 clamp(26px, 3.3vw, 44px)/1.22 var(--display); letter-spacing: -.022em; color: var(--ink); }
/* unlit words stay readable: 3.7:1 on the night, above the 3:1 WCAG minimum for large text */
.js-readout .readout .wd { color: #557977; transition: color .45s ease; }
.js-readout .readout .wd.lit { color: var(--ink); }
.lights3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: clamp(56px, 8vw, 96px); }
.lightcard { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; padding: 28px 26px 26px; background: linear-gradient(180deg, var(--card), var(--bg-2)); }
.lightcard .dot { display: block; width: var(--s); height: var(--s); border-radius: 50%; background: var(--c); box-shadow: 0 0 22px color-mix(in srgb, var(--c) 55%, transparent);
  /* the three dots differ in size; this keeps the headings on one line across the cards */
  margin: calc(19px - var(--s)) 0 22px; }
.lightcard h3 { margin: 0 0 8px; }
.lightcard p { margin: 0; color: var(--muted); font-size: 16px; }
@media (max-width: 860px) { .lights3 { grid-template-columns: 1fr; } }

/* soft light that follows the pointer on cards (set by motion.js) */
.lightcard::before, .file::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(236, 246, 244, .07), transparent 65%); }
.lightcard:hover::before, .file:hover::after { opacity: 1; }
.file .art { animation: drift 22s ease-in-out infinite alternate; }
@keyframes drift { from { transform: scale(1.15) translate(0, 0); } to { transform: scale(1.22) translate(-3%, 2.5%); } }

/* ---------- Panora walkthrough: the phone changes as you read ---------- */
.story { padding-top: clamp(40px, 6vw, 80px); }
.story-card { position: relative; border-radius: 34px; border: 1px solid #2a4a38; color: #f3ead8;
  background: radial-gradient(70% 50% at 85% 0%, #4f8467 0%, transparent 60%), linear-gradient(170deg, #2c573f 0%, #183326 55%, #10241b 100%);
  padding: clamp(36px, 6vw, 80px) clamp(24px, 5vw, 72px) clamp(24px, 4vw, 48px); }
.story-head .eyebrow { color: #f2d49a; }
.story-head h2 { color: #fbf5e9; max-width: 12em; }
.story-head .app-badge span { color: #f3ead8; }
.story-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 96px); margin-top: 8px; }
.story-steps { min-width: 0; }
.step { min-height: 72vh; display: flex; flex-direction: column; justify-content: center; padding: 40px 0; opacity: .32; transition: opacity .5s ease; }
.step.on, .no-js .step { opacity: 1; }
.step .num { font: 600 13px/1 var(--body); letter-spacing: .16em; text-transform: uppercase; color: #f2d49a; margin: 0 0 14px; }
.step h3 { font-size: clamp(28px, 3vw, 40px); line-height: 1.08; letter-spacing: -.03em; color: #fbf5e9; margin: 0 0 14px; }
.step p { color: #dfe8de; font-size: 18px; max-width: 26em; margin: 0; }
.step .btns { margin-top: 30px; }
.story .btn.primary { background: #f3ead8; color: #16301f; border-color: #f3ead8; }
.story .btn.primary:hover { background: #fffaf0; }
.story .btn { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .2); color: #f3ead8; }
.step-shot { display: none; }
.story-phone { position: sticky; top: calc(50vh - 330px); align-self: start; display: grid; justify-items: center; gap: 22px; padding: 40px 0; }
.story-phone .phone { width: 300px; }
.story-phone .shot { position: absolute; top: 11px; left: 11px; width: calc(100% - 22px); height: calc(100% - 22px); opacity: 0; transform: scale(1.025); transition: opacity .6s ease, transform .8s cubic-bezier(.2, .7, .2, 1); }
.story-phone .shot.on { opacity: 1; transform: none; }
.story-dots { display: flex; gap: 8px; }
.story-dots i { display: block; width: 7px; height: 7px; border-radius: 99px; background: rgba(243, 234, 216, .3); transition: width .4s, background .4s; }
.story-dots i.on { width: 22px; background: #f3ead8; }
@media (max-height: 760px) { .story-phone { top: 20px; } .story-phone .phone { width: 260px; } }
@media (max-width: 900px) {
  .story-grid { grid-template-columns: 1fr; }
  .story-phone { display: none; }
  .step { min-height: 0; opacity: 1; padding: 36px 0; border-top: 1px solid rgba(243, 234, 216, .12); }
  .step:first-child { border-top: 0; }
  .step-shot { display: block; width: 220px; margin: 0 0 26px; }
}

/* ---------- Panora page: the closer look, light or dark ---------- */
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); margin-top: 26px; }
.seg button { cursor: pointer; border: 0; background: transparent; color: var(--muted); font: 600 14px/1 var(--body); padding: 10px 18px; border-radius: 999px; transition: background .25s, color .25s; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.gallery { display: flex; gap: 26px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 8px 24px 26px; margin: 44px -24px 0; scrollbar-width: thin; scrollbar-color: #2c5357 transparent; }
.gallery figure { margin: 0; flex: none; scroll-snap-align: center; text-align: center; }
.gallery .phone { width: 240px; }
.gallery .phone img { transition: opacity .35s ease; }
.gallery.swapping .phone img { opacity: .15; }
.gallery figcaption { margin-top: 16px; font: 600 15px var(--display); color: var(--ink); }
.gallery figcaption span { display: block; font: 400 14px/1.4 var(--body); color: var(--muted); margin-top: 4px; max-width: 220px; margin-left: auto; margin-right: auto; }
@media (max-width: 520px) { .gallery { margin: 36px -16px 0; padding: 8px 16px 22px; } .gallery .phone { width: 210px; } }

/* hero phones on the Panora page spread a little as you scroll (motion.js sets --sp) */
.fan .f2 { transform: translateX(calc(-104% - var(--sp, 0) * 30px)) rotate(calc(-8deg - var(--sp, 0) * 4deg)); }
.fan .f3 { transform: translateX(calc(4% + var(--sp, 0) * 30px)) rotate(calc(8deg + var(--sp, 0) * 4deg)); }

/* ---------- motion off ---------- */
@media (prefers-reduced-motion: reduce) {
  .stagger .w, .hero2 .eyebrow, .hero2 .lede, .hero2 .btns { animation: none; opacity: 1; transform: none; }
  .relay { transform: none; opacity: 1; }
  .relay .halo, .file .art { animation: none; }
  .relay .spark { display: none; }
  .step { opacity: 1; }
  .story-phone .shot { transition: none; }
  .js-readout .readout .wd { color: var(--ink); transition: none; }
  .fan .f2 { transform: translateX(-104%) rotate(-8deg); }
  .fan .f3 { transform: translateX(4%) rotate(8deg); }
}
