/* ============================================================
   Platform tour (fr/visite.html, tour.html)
   Each chapter: real Coastal demo captures in a glass frame that stays put
   while short beats scroll by; each beat moves a camera (transform only)
   onto one part of the screen and dims the rest. Driven by js/visite.js.
   ============================================================ */

.page-tour {
  --tour-iris: #5aa7ff;
  --tour-val: #f2a91e;
  --tour-ring: rgba(61, 240, 160, 0.75);
  --tour-dim: rgba(3, 6, 5, 0.66);
  --tour-glass: linear-gradient(150deg, rgba(255,255,255,.085), rgba(255,255,255,.02) 60%);
  --tour-cam: cubic-bezier(.65, 0, .35, 1);
  --tour-ease: cubic-bezier(.2, .8, .2, 1);
  --tour-nav: 88px;
  background:
    radial-gradient(60vw 40vw at 8% -6%, rgba(0,201,107,.12), transparent 70%),
    radial-gradient(40vw 30vw at 104% 18%, rgba(47,143,255,.07), transparent 70%),
    var(--bg);
}

/* style.css sets overflow-x: hidden on html and body, which makes body a scroll container and
   silently disables position: sticky (the frames and the chapter index scrolled away).
   clip stops sideways scrolling without creating a scroll container. */
html:has(body.page-tour), body.page-tour { overflow-x: clip; }

/* ── Hero ── */
.tour-hero { padding: calc(var(--tour-nav) + 72px) 0 40px; }
.tour-hero__eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--green);
}
.tour-hero h1 {
  margin-top: 14px; font-size: clamp(36px, 6vw, 68px); font-weight: 800; letter-spacing: -.045em; line-height: 1.02;
  text-wrap: balance; max-width: 15ch;
}
.tour-hero__sub { margin-top: 18px; max-width: 60ch; color: var(--text-2); font-size: 17px; }
.tour-hero__sub b { color: var(--text); font-weight: 600; }
.tour-hero__cta { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }
.tour-legend { margin-top: 36px; display: flex; gap: 10px; flex-wrap: wrap; }
.tour-legend a {
  display: inline-flex; align-items: center; gap: 10px; padding: 9px 14px 9px 10px; border-radius: 999px;
  border: 1px solid var(--border-2); background: rgba(255,255,255,.03); color: var(--text); font-size: 14px; font-weight: 600;
  transition: background var(--transition), border-color var(--transition);
}
.tour-legend a:hover { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.2); }
.tour-legend img { width: 26px; height: 26px; border-radius: 50%; }
.tour-legend small { color: var(--text-3); font-weight: 500; }

/* ── Chapter index (sticky chips) ── */
.tour-index {
  position: sticky; top: calc(var(--tour-nav) + 10px); z-index: 20; margin: 8px 0 0;
}
.tour-index__inner {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 6px;
  border-radius: 999px; border: 1px solid var(--border-2);
  background: color-mix(in oklch, var(--bg) 70%, transparent);
  backdrop-filter: blur(16px) saturate(150%); -webkit-backdrop-filter: blur(16px) saturate(150%);
}
.tour-index__inner::-webkit-scrollbar { display: none; }
.tour-index a {
  flex: none; padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-2);
  white-space: nowrap; transition: color .3s ease, background .3s ease;
}
.tour-index a:hover { color: var(--text); }
.tour-index a.is-on { color: #04140b; background: linear-gradient(135deg, #19e588, #00b862); }

/* ── Group headers ── */
.tour-group { padding: 96px 0 8px; }
.tour-group__tag {
  display: inline-flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--tour-c, var(--green));
}
.tour-group__tag img { width: 30px; height: 30px; border-radius: 50%; }
.tour-group h2 {
  margin-top: 12px; font-size: clamp(28px, 4vw, 44px); font-weight: 800; letter-spacing: -.035em; line-height: 1.08;
  max-width: 22ch; text-wrap: balance;
}
.tour-group p { margin-top: 12px; color: var(--text-2); max-width: 60ch; }

/* ── Chapter ── */
.tour-ch {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 11fr); gap: 48px; align-items: start;
  padding: 72px 0 24px; scroll-margin-top: calc(var(--tour-nav) + 64px);
}
.tour-ch__head { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.tour-ch__head h3 { font-size: clamp(24px, 3vw, 32px); font-weight: 800; letter-spacing: -.03em; }
.tour-ch__head span { color: var(--text-3); font-size: 14px; }

.tour-beats { list-style: none; padding: 0 0 22vh; margin: 0; }
.tour-beat {
  min-height: 62vh; display: flex; flex-direction: column; justify-content: center; gap: 10px;
  opacity: .32; transition: opacity .5s var(--tour-ease);
}
.tour-beat:first-child { min-height: 44vh; justify-content: flex-start; padding-top: 6vh; }
.tour-beat.is-on { opacity: 1; }
.tour-beat__who {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--tour-c, var(--green));
}
.tour-beat__who img { width: 24px; height: 24px; border-radius: 50%; }
.tour-beat[data-who="iris"] { --tour-c: var(--tour-iris); }
.tour-beat[data-who="val"] { --tour-c: var(--tour-val); }
.tour-beat h4 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; text-wrap: balance; }
.tour-beat p { color: var(--text-2); font-size: 16px; max-width: 46ch; }

/* ── Stage: glass frame holding the camera ── */
.tour-stage {
  position: sticky; top: calc(var(--tour-nav) + 84px);
  border-radius: 22px; padding: 10px; border: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(160deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 40px 90px rgba(0,0,0,.55), 0 0 80px rgba(0,201,107,.06);
}
.tour-stage__bar { display: flex; align-items: center; gap: 7px; padding: 2px 6px 10px; }
.tour-stage__bar i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.16); }
.tour-stage__bar span {
  margin-left: 8px; font-size: 12px; color: var(--text-3); background: rgba(255,255,255,.05); border-radius: 8px;
  padding: 3px 10px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tour-stage__bar b {
  margin-left: auto; flex: none; font-size: 11px; font-weight: 700; color: var(--green); letter-spacing: .04em;
  border: 1px solid color-mix(in oklch, var(--green) 40%, transparent); border-radius: 999px; padding: 2px 9px;
}
.tour-view {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 14px; background: #050806;
  max-width: 100%;
}
.tour-cam {
  /* --ratio = capture height / width (set per chapter in the HTML). */
  position: absolute; left: 0; top: 0; width: 100%; aspect-ratio: 1 / var(--ratio, 0.625);
  /* No will-change: it freezes the layer's raster at 1x and the zoom then stretches a blurry
     bitmap. Without it Chrome re-renders the capture sharp once the camera stops. */
  transform-origin: 0 0;
  transition: transform 1.15s var(--tour-cam);
}
.tour-cam img {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover;
  transition: opacity .6s var(--tour-ease);
}
.tour-cam img[data-variant]:not(.is-on) { opacity: 0; }
/* The spotlight: a box at the region whose wide shadow dims everything else. The spread is
   fixed (it lives inside the zoomed camera): a viewport-sized one times a 2x zoom made Chrome
   paint a texture too large to raster and the whole page went black. 1600px covers any capture. */
.tour-hole {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  border-radius: calc(14px / var(--s, 1));
  box-shadow: 0 0 0 calc(2px / var(--s, 1)) var(--tour-ring), 0 0 0 1600px var(--tour-dim);
  opacity: 0; pointer-events: none;
  transition: left 1.15s var(--tour-cam), top 1.15s var(--tour-cam), width 1.15s var(--tour-cam),
              height 1.15s var(--tour-cam), opacity .55s var(--tour-ease);
}
.tour-hole.is-on { opacity: 1; }

/* Phones (guest portal chapter) */
.tour-phones {
  position: sticky; top: calc(var(--tour-nav) + 84px);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; padding: 8px 4px;
}
.tour-phone {
  border-radius: 34px; padding: 8px; background: #050605; border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 30px 70px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.1);
  transition: transform .9s var(--tour-ease), opacity .6s var(--tour-ease), box-shadow .6s ease;
}
.tour-phone img { display: block; width: 100%; height: auto; border-radius: 27px; }
.tour-phones.has-focus .tour-phone { opacity: .42; transform: scale(.96); }
.tour-phones.has-focus .tour-phone.is-on {
  opacity: 1; transform: translateY(-14px) scale(1.04);
  box-shadow: 0 40px 90px rgba(0,0,0,.65), 0 0 0 1.5px var(--tour-ring), 0 0 60px rgba(0,201,107,.18);
}

/* Entrance: the frame rises once when its chapter first comes into view. */
.tour-ch .tour-stage, .tour-ch .tour-phones { transition: opacity .9s var(--tour-ease), transform 1s var(--tour-ease); }
.js-tour .tour-ch:not(.is-seen) .tour-stage,
.js-tour .tour-ch:not(.is-seen) .tour-phones { opacity: 0; transform: translateY(28px) scale(.985); }

/* ── Closing CTA ── */
.tour-end { padding: 120px 0 140px; text-align: center; }
.tour-end h2 {
  font-size: clamp(30px, 4.6vw, 52px); font-weight: 800; letter-spacing: -.04em; line-height: 1.05;
  max-width: 18ch; margin: 0 auto; text-wrap: balance;
}
.tour-end p { margin: 16px auto 0; max-width: 54ch; color: var(--text-2); }
.tour-end .tour-hero__cta { justify-content: center; }
.tour-note { margin-top: 18px; font-size: 13px; color: var(--text-3); }

/* ── Phones and tablets: frame pinned on top, beats scroll underneath ── */
@media (max-width: 900px) {
  .page-tour { --tour-nav: 76px; }
  /* Flex, not grid: a sticky grid item only sticks inside its own grid area. */
  .tour-ch { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding-top: 56px; }
  .tour-ch__head { margin-bottom: 14px; }
  .tour-stage, .tour-phones { order: 1; top: calc(var(--tour-nav) + 64px); z-index: 5; }
  /* Beats scroll underneath the pinned frame: give it a solid backing, and a solid shadow
     upwards that hides the text passing between the chapter index and the frame. */
  .tour-stage {
    padding: 6px; border-radius: 16px;
    background: linear-gradient(160deg, rgba(255,255,255,.08), rgba(255,255,255,.02)), var(--bg);
    box-shadow: 0 -90px 0 24px var(--bg), 0 24px 40px rgba(0,0,0,.6);
  }
  .tour-phones { box-shadow: 0 -90px 0 24px var(--bg); }
  .tour-stage__bar { display: none; }
  .tour-view { border-radius: 11px; }
  .tour-phones { gap: 8px; background: color-mix(in oklch, var(--bg) 80%, transparent); border-radius: 18px; }
  .tour-phone { border-radius: 20px; padding: 4px; }
  .tour-phone img { border-radius: 16px; }
  .tour-beats { order: 2; padding-bottom: 10vh; }
  .tour-beat, .tour-beat:first-child { min-height: 46vh; justify-content: center; padding-top: 0; }
  .tour-beat h4 { font-size: 19px; }
  .tour-beat p { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .tour-cam, .tour-hole, .tour-cam img, .tour-phone, .tour-beat,
  .tour-ch .tour-stage, .tour-ch .tour-phones { transition: none !important; }
  .js-tour .tour-ch:not(.is-seen) .tour-stage,
  .js-tour .tour-ch:not(.is-seen) .tour-phones { opacity: 1; transform: none; }
}
