/* ==========================================================================
   BCDF Immersive Web — shared layer  (prefix: im-)
   --------------------------------------------------------------------------
   The page structure every cinematic BrooksCorp site shares: a fixed WebGL
   stage behind a scrolling editorial column, chapter navigation, the custom
   cursor, magnetic controls and the reveal utilities. Reads BCDF tokens only;
   a brand supplies its theme (nala.css, bazari.css …) and its own scene.

   Modes (set on <html> by immersive.js):
     .im-motion   full experience (WebGL + scrub + reveals)
     .im-lite     poster + CSS reveals (reduced-motion, no WebGL, low power)
     .im-fine     fine pointer present → custom cursor + magnetic controls
   ========================================================================== */

:root {
  --im-col: 1120px;           /* editorial column */
  --im-panel: 560px;          /* one thought per panel */
  --im-gutter: clamp(20px, 5vw, 64px);
  --im-nav-h: 72px;
  --im-ease-out: cubic-bezier(.22, 1, .36, 1);     /* "settle" — arrivals */
  --im-ease-in-out: cubic-bezier(.65, 0, .35, 1);   /* camera & section moves */
  --im-dur-1: 240ms; --im-dur-2: 480ms; --im-dur-3: 900ms;
  --im-ink: var(--bc-brand-600);
  --im-paper: var(--bc-grey-50);
  --im-scrim: color-mix(in srgb, var(--im-paper) 78%, transparent);
}

html { scroll-behavior: auto; }
.im-body { margin: 0; background: var(--im-paper); color: var(--im-ink); font-family: var(--bc-font-body);
  -webkit-font-smoothing: antialiased; overflow-x: clip; }
.im-fine .im-body { cursor: none; }
.im-fine .im-body a, .im-fine .im-body button, .im-fine .im-body input, .im-fine .im-body label { cursor: none; }

/* ---- Stage: the WebGL canvas lives behind everything ---------------------- */
.im-stage { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.im-stage canvas { display: block; width: 100%; height: 100%; }
.im-poster { position: absolute; inset: 0; display: none; }
.im-poster svg { position: absolute; right: 2%; top: 8%; width: 52%; height: 84%; }
@media (max-width: 900px) { .im-poster svg { right: -10%; top: 30%; width: 80%; height: 60%; opacity: .55; } }
.im-lite .im-poster { display: block; }
.im-lite .im-stage canvas { display: none; }

/* ---- Content column --------------------------------------------------------- */
.im-content { position: relative; z-index: 1; }
.im-section { position: relative; min-height: 100svh; display: grid; align-items: center;
  padding: calc(var(--im-nav-h) + var(--bc-s-10)) var(--im-gutter) var(--bc-s-12); }
.im-section--short { min-height: 60svh; }
.im-section--end { min-height: 100svh; align-items: end; }
.im-inner { width: min(100%, var(--im-col)); margin: 0 auto; }
.im-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--bc-s-6); align-items: center; }
.im-grid > * { min-width: 0; }
.im-span-5 { grid-column: span 5; } .im-span-6 { grid-column: span 6; } .im-span-7 { grid-column: span 7; }
.im-start-7 { grid-column: 7 / span 6; } .im-start-8 { grid-column: 8 / span 5; }

/* The panel: the only surface text sits on. Slight scrim so type never fights the scene. */
.im-panel { max-width: var(--im-panel); }
.im-panel--scrim { padding: var(--bc-s-8); border-radius: var(--bc-r-lg); background: var(--im-scrim);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 0 0 1px color-mix(in srgb, var(--im-ink) 8%, transparent); }
.im-panel--right { margin-left: auto; }

/* ---- Editorial type --------------------------------------------------------- */
.im-eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: .75rem; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--bc-text-muted); margin-bottom: var(--bc-s-5); }
.im-eyebrow::before { content: ""; width: 24px; height: 1px; background: currentColor; opacity: .6; }
.im-display { font-family: var(--bc-font-display); font-weight: 700; letter-spacing: -.025em; line-height: .98;
  font-size: clamp(2.75rem, 7.2vw, 6.25rem); margin: 0 0 var(--bc-s-6); color: var(--im-ink); text-wrap: balance; }
.im-display em { font-style: normal; color: var(--bc-accent-500); }
.im-h2 { font-family: var(--bc-font-display); font-weight: 700; letter-spacing: -.02em; line-height: 1.04;
  font-size: clamp(2rem, 4.2vw, 3.5rem); margin: 0 0 var(--bc-s-5); text-wrap: balance; }
.im-lead { font-size: clamp(1.0625rem, 1.4vw, 1.25rem); line-height: 1.55; color: var(--bc-text-body); margin: 0 0 var(--bc-s-7); max-width: 46ch; }
.im-body-text { font-size: 1rem; line-height: 1.65; color: var(--bc-text-body); max-width: 52ch; }
.im-figure { font-family: var(--bc-font-display); font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.im-caption { font-size: .8125rem; color: var(--bc-text-muted); line-height: 1.5; }
.im-caption a { color: inherit; }

/* ---- Navigation ------------------------------------------------------------- */
.im-nav { position: fixed; top: 0; left: 0; right: 0; z-index: 20; height: var(--im-nav-h); display: flex; align-items: center;
  padding: 0 var(--im-gutter); transition: background var(--im-dur-2) var(--im-ease-out), box-shadow var(--im-dur-2); }
.im-nav.is-solid { background: var(--im-scrim); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--im-ink) 8%, transparent); }
.im-nav__inner { width: min(100%, var(--im-col)); margin: 0 auto; display: flex; align-items: center; gap: var(--bc-s-8); }
.im-nav__brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--im-ink); font-family: var(--bc-font-display); font-weight: 700; }
.im-nav__brand img, .im-nav__brand svg { height: 28px; width: auto; display: block; }
.im-nav__links { display: flex; gap: var(--bc-s-6); margin-left: auto; }
.im-nav__link { font-size: .9375rem; font-weight: 500; color: var(--im-ink); text-decoration: none; opacity: .78; position: relative; padding: 6px 0; }
.im-nav__link::after { content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 2px; background: var(--bc-accent-500); transition: right var(--im-dur-1) var(--im-ease-out); }
.im-nav__link:hover, .im-nav__link.is-active { opacity: 1; } .im-nav__link:hover::after, .im-nav__link.is-active::after { right: 0; }
.im-nav__cta { margin-left: var(--bc-s-2); }
.im-nav__menu { display: none; width: 44px; height: 44px; border: 0; background: transparent; color: var(--im-ink); border-radius: 10px; margin-left: auto; place-items: center; cursor: pointer; }
.im-nav__menu svg { width: 22px; height: 22px; }
@media (max-width: 760px) {
  .im-nav__links { display: none; }
  .im-nav__menu { display: grid; }
  .im-nav__cta { display: none; }
  .im-nav__links.is-open { display: grid; position: fixed; left: 0; right: 0; top: var(--im-nav-h); padding: var(--bc-s-5) var(--im-gutter) var(--bc-s-7); gap: var(--bc-s-2);
    background: var(--im-paper); box-shadow: 0 24px 40px -24px color-mix(in srgb, var(--im-ink) 40%, transparent), 0 1px 0 color-mix(in srgb, var(--im-ink) 8%, transparent); }
  .im-nav__links.is-open .im-nav__link { font-size: 1.125rem; padding: 12px 0; opacity: 1; }
  .im-nav__links.is-open .im-nav__link::after { display: none; }
  .im-nav.is-open { background: var(--im-paper); }
}

/* Chapter rail — left edge, desktop only; tells you where you are in the story */
.im-chapters { position: fixed; left: 22px; top: 50%; transform: translateY(-50%); z-index: 20; display: grid; gap: 14px; }
.im-chapters a { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--im-ink); opacity: .45; font-size: .6875rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.im-chapters a::before { content: ""; width: 18px; height: 1px; background: currentColor; transition: width var(--im-dur-1) var(--im-ease-out); }
.im-chapters a span { opacity: 0; transform: translateX(-6px); transition: opacity var(--im-dur-1), transform var(--im-dur-1) var(--im-ease-out); }
.im-chapters a.is-active { opacity: 1; } .im-chapters a.is-active::before { width: 34px; }
.im-chapters a:hover span, .im-chapters a.is-active span { opacity: 1; transform: none; }
@media (max-width: 1100px) { .im-chapters { display: none; } }

/* ---- Buttons: BCDF .bc-btn plus the magnetic wrapper ------------------------ */
.im-magnetic { display: inline-block; will-change: transform; }
.im-magnetic > * { display: inline-flex; will-change: transform; }
.im-actions { display: flex; flex-wrap: wrap; gap: var(--bc-s-4); align-items: center; }
.im-btn-note { font-size: .8125rem; color: var(--bc-text-muted); }

/* ---- Cards & lists ------------------------------------------------------------ */
.im-cards { display: grid; gap: var(--bc-s-5); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.im-card { padding: var(--bc-s-7); border-radius: var(--bc-r-lg); background: var(--bc-bg-surface);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--im-ink) 8%, transparent); transition: transform var(--im-dur-2) var(--im-ease-out), box-shadow var(--im-dur-2) var(--im-ease-out); }
.im-card:hover { transform: translateY(-4px); box-shadow: 0 0 0 1px color-mix(in srgb, var(--im-ink) 12%, transparent), 0 18px 40px -20px color-mix(in srgb, var(--im-ink) 35%, transparent); }
.im-card__n { font-family: var(--bc-font-display); font-size: .8125rem; font-weight: 700; letter-spacing: .1em; color: var(--bc-accent-500); margin-bottom: var(--bc-s-4); }
.im-card h3 { font-family: var(--bc-font-display); font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; margin: 0 0 var(--bc-s-3); line-height: 1.2; }
.im-card p { margin: 0; font-size: .9375rem; line-height: 1.55; color: var(--bc-text-body); }
.im-steps { counter-reset: step; display: grid; gap: var(--bc-s-6); }
.im-step { display: grid; grid-template-columns: 56px 1fr; gap: var(--bc-s-5); align-items: start; }
.im-step__n { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-family: var(--bc-font-display); font-weight: 700;
  background: var(--bc-bg-surface); box-shadow: 0 0 0 1px color-mix(in srgb, var(--im-ink) 12%, transparent); }
.im-step.is-active .im-step__n { background: var(--bc-accent-500); color: var(--bc-text-inverse); box-shadow: none; }
.im-step h3 { margin: 6px 0 4px; font-family: var(--bc-font-display); font-size: 1.125rem; font-weight: 700; }
.im-step p { margin: 0; color: var(--bc-text-body); font-size: .9375rem; line-height: 1.55; }
.im-kv { display: grid; grid-template-columns: 1fr auto; gap: 10px 24px; font-size: .9375rem; }
.im-kv dt { color: var(--bc-text-body); } .im-kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.im-kv .is-total { padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--im-ink) 14%, transparent); font-weight: 700; }
.im-trust { display: flex; flex-wrap: wrap; gap: var(--bc-s-4) var(--bc-s-8); align-items: center; font-size: .8125rem; color: var(--bc-text-muted); }
.im-trust b { color: var(--im-ink); font-weight: 600; }
.im-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: var(--bc-warning-bg, #FDF2E1); color: var(--bc-warning-fg, #8A5A00); border: 1px dashed currentColor; }

/* ---- FAQ ------------------------------------------------------------------------ */
.im-faq { display: grid; gap: 0; border-top: 1px solid color-mix(in srgb, var(--im-ink) 12%, transparent); }
.im-faq details { border-bottom: 1px solid color-mix(in srgb, var(--im-ink) 12%, transparent); }
.im-faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 16px; padding: 18px 0; font-weight: 600; font-size: 1.0625rem; }
.im-faq summary::-webkit-details-marker { display: none; }
.im-faq summary::after { content: "+"; font-family: var(--bc-font-display); font-size: 1.25rem; color: var(--bc-accent-500); transition: transform var(--im-dur-1) var(--im-ease-out); }
.im-faq details[open] summary::after { transform: rotate(45deg); }
.im-faq p { margin: 0 0 18px; color: var(--bc-text-body); line-height: 1.6; max-width: 60ch; }

/* ---- Footer ------------------------------------------------------------------- */
.im-footer { position: relative; z-index: 1; padding: var(--bc-s-10) var(--im-gutter) var(--bc-s-8); background: var(--im-ink); color: rgba(255,255,255,.72); font-size: .875rem; }
.im-footer__inner { width: min(100%, var(--im-col)); margin: 0 auto; display: grid; gap: var(--bc-s-8); grid-template-columns: 2fr 1fr 1fr; }
.im-footer a { color: #fff; text-decoration: none; opacity: .85; } .im-footer a:hover { opacity: 1; text-decoration: underline; }
.im-footer h4 { color: #fff; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 12px; }
.im-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.im-footer__legal { grid-column: 1 / -1; padding-top: var(--bc-s-6); border-top: 1px solid rgba(255,255,255,.12); font-size: .75rem; line-height: 1.6; color: rgba(255,255,255,.55); }
@media (max-width: 760px) { .im-footer__inner { grid-template-columns: 1fr; } }

/* ---- Cursor ------------------------------------------------------------------- */
.im-cursor { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  background: var(--bc-accent-500); mix-blend-mode: multiply; transition: transform var(--im-dur-1) var(--im-ease-out), opacity var(--im-dur-1); opacity: 0; }
.im-cursor__ring { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--bc-accent-500) 70%, transparent); transition: transform var(--im-dur-2) var(--im-ease-out), opacity var(--im-dur-1), border-color var(--im-dur-1); opacity: 0; }
.im-fine .im-cursor, .im-fine .im-cursor__ring { opacity: 1; }
.im-cursor.is-hover { transform: scale(.5); } .im-cursor__ring.is-hover { transform: scale(1.6); border-color: var(--bc-accent-500); }
.im-cursor.is-down { transform: scale(1.4); }
.im-cursor__ring[data-label]::after { content: attr(data-label); position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--im-ink); white-space: nowrap; }
@media (hover: none), (pointer: coarse) { .im-cursor, .im-cursor__ring { display: none; } }

/* ---- Reveals: hidden only when the motion runtime is in charge ----------------- */
.im-motion [data-reveal] { opacity: 0; transform: translateY(28px); }
.im-motion [data-reveal="fade"], .im-motion [data-reveal="lines"] { transform: none; }
.im-motion [data-reveal="lines"] .im-line { display: block; overflow: hidden; }
.im-motion [data-reveal="lines"] .im-line > span { display: block; transform: translateY(110%); }
.im-lite [data-reveal] { opacity: 1; transform: none; animation: im-fade var(--im-dur-3) var(--im-ease-out) both; }
@keyframes im-fade { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---- Loading veil ------------------------------------------------------------- */
.im-veil { position: fixed; inset: 0; z-index: 50; background: var(--im-paper); display: grid; place-items: center; transition: opacity var(--im-dur-2) var(--im-ease-out), visibility var(--im-dur-2); }
.im-veil.is-done { opacity: 0; visibility: hidden; }
.im-veil__mark { width: 56px; height: 56px; opacity: .9; }
.im-veil__bar { position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: var(--bc-accent-500); transition: width var(--im-dur-2) var(--im-ease-out); }

/* ---- Scroll cue ---------------------------------------------------------------- */
.im-cue { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); display: grid; justify-items: center; gap: 8px; font-size: .6875rem; letter-spacing: .14em; text-transform: uppercase; color: var(--bc-text-muted); }
.im-cue i { width: 1px; height: 36px; background: currentColor; display: block; transform-origin: top; animation: im-cue 1.8s var(--im-ease-in-out) infinite; }
@keyframes im-cue { 0% { transform: scaleY(0); } 40% { transform: scaleY(1); transform-origin: top; } 41% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }
.im-lite .im-cue i { animation: none; }

/* ---- Skip link & focus --------------------------------------------------------- */
.im-skip { position: absolute; left: 16px; top: -48px; z-index: 200; padding: 10px 14px; background: var(--im-ink); color: #fff; border-radius: 8px; text-decoration: none; }
.im-skip:focus { top: 16px; }
.im-body :focus-visible { outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--bc-accent-500) 45%, transparent); border-radius: 8px; }

/* ---- Responsive ------------------------------------------------------------------ */
@media (max-width: 900px) {
  /* Small screens: every copy block sits on a scrim (the hero included) and the
     scene becomes a soft backdrop — the words stay first, the world stays present. */
  .im-panel--scrim-mobile { padding: var(--bc-s-6); border-radius: var(--bc-r-lg); background: var(--im-scrim);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 0 0 1px color-mix(in srgb, var(--im-ink) 8%, transparent); }
  .im-stage canvas { opacity: .62; }
  .im-grid { grid-template-columns: 1fr; }
  .im-span-5, .im-span-6, .im-span-7, .im-start-7, .im-start-8 { grid-column: 1 / -1; }
  .im-panel--right { margin-left: 0; }
  .im-section { padding-top: calc(var(--im-nav-h) + var(--bc-s-8)); padding-bottom: var(--bc-s-10); }
}
@media (prefers-reduced-motion: reduce) {
  .im-card, .im-nav__link::after, .im-cursor, .im-cursor__ring { transition: none; }
  .im-cue i { animation: none; }
}
