/* ══════════════════════════════════════════════════════════════
   COMPUTER EXPLODE — full-page scroll background (staging)

   A photoreal tower PC, rendered as two Higgsfield clips and sliced to
   JPG frames, painted to one fixed canvas. Page scroll position picks
   the frame: top of page = assembled, footer = fully exploded.

   The page goes dark for its whole length, so these rules flip the
   palette tokens and replace every opaque section fill with translucent
   glass. Anything that used var(--text) as a BACKGROUND (stats bar,
   footer) is pinned explicitly, because --text turns light here.
   ══════════════════════════════════════════════════════════════ */

body.explode {
    --bg: #0d110f;
    --bg-2: #121714;
    --bg-3: #171d19;
    --text: #f0f0ed;
    --text-muted: rgba(240, 240, 237, 0.72);
    --text-subtle: rgba(240, 240, 237, 0.55);
    --border: rgba(240, 240, 237, 0.12);
    --border-hover: rgba(240, 240, 237, 0.26);
    --grid-color: rgba(240, 240, 237, 0.035);
    --glass: rgba(11, 15, 13, 0.88);
    --glass-strong: rgba(11, 15, 13, 0.95);
    background: #0d110f;
}

/* ── THE CANVAS ── */
.pc-stage {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: #0d110f center / cover no-repeat;
}
.pc-stage canvas { display: block; width: 100%; height: 100%; }
/* Legibility scrim. Heavier at the edges where copy sits, light in the
   middle so the machine still reads. */
.pc-stage::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 65% at 50% 50%, rgba(8, 11, 9, 0.15), rgba(8, 11, 9, 0.62) 100%),
        linear-gradient(rgba(8, 11, 9, 0.18), rgba(8, 11, 9, 0.18));
}
/* ── STILL VARIANT (privacy, terms, 404) ── one feathered image of the
   finished-site laptop, parked right of the hero copy. No canvas, no JS. */
.pc-stage.still { background: #0d110f; }
.pc-stage.still::after {
    background: linear-gradient(90deg, rgba(8, 11, 9, 0.8) 0%, rgba(8, 11, 9, 0.35) 50%, rgba(8, 11, 9, 0.15) 100%);
}
.pc-still {
    position: absolute;
    /* long titles ("Page Not Found") reach ~64% across, so the laptop,
       the middle ~70% of this box, has to start right of that */
    width: min(46vw, 82vh);
    aspect-ratio: 1;
    right: -6vw;
    top: 52%;
    transform: translateY(-50%);
    background: url(/assets/laptop/still.jpg) center / cover no-repeat;
    -webkit-mask-image: radial-gradient(closest-side, #000 58%, transparent 100%);
            mask-image: radial-gradient(closest-side, #000 58%, transparent 100%);
    opacity: 0.6;
}
@media (max-width: 999px), (max-aspect-ratio: 13/10) {
    .pc-still { width: 115vw; right: -7.5vw; top: auto; bottom: -12vh; transform: none; opacity: 0.4; }
}

/* body::before grid sits above the canvas but below content */
body.explode::before { z-index: 1; }

body.explode main,
body.explode footer,
body.explode nav { position: relative; z-index: 2; }
body.explode nav { position: fixed; z-index: 100; }

/* ── SPLIT HERO ──────────────────────────────────────────────────
   The computer owns the centre column; the copy parts around it.

   --hs-gap is the width of that empty column. The canvas is cover-fit,
   so on 16:9-or-wider screens the tower is ~36vw wide, and on narrower
   ones it grows with height instead (0.64 x vh) — max() tracks both.

   --s (0..1) is written onto .hero by explode.js: 0 = assembled copy,
   1 = fully scattered. Every letter carries its own --dx/--dy/--rot/--d
   (direction, spin, stagger delay), so one custom property animates the
   whole headline.
   ───────────────────────────────────────────────────────────── */
body.explode .hero { background: transparent; --s: 0; }
body.explode .hero::after { display: none; }
/* Shade the two text columns, not the machine */
body.explode .hero::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(90deg,
        rgba(8, 11, 9, 0.78) 0%, rgba(8, 11, 9, 0.40) 26%, rgba(8, 11, 9, 0) 36%,
        rgba(8, 11, 9, 0) 64%, rgba(8, 11, 9, 0.40) 74%, rgba(8, 11, 9, 0.78) 100%);
}

body.explode .hs-grid {
    --hs-gap: max(35vw, 63vh);
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 64px 48px 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--hs-gap) minmax(0, 1fr);
    grid-template-areas:
        "eye  .  ."
        "hl   .  hr"
        "sub  .  cta";
    align-content: center;
    row-gap: 28px;
}
/* Home page laptop: ~38% of the frame wide closed, ~43% with the layers
   out, so it needs a wider column than the tower (16:9 frame, cover-fit:
   0.41 x 16/9 = 0.73 x vh on narrower screens). */
body.explode.laptop .hs-grid { --hs-gap: max(42vw, 73vh); }
body.explode .hs-h1 { display: contents; }
body.explode .hs-half {
    font-family: 'Syne', sans-serif;
    /* explode.js sets --hs-fs so the widest word fits its column */
    font-size: var(--hs-fs, clamp(40px, min(3.6vw, 9vh), 96px));
    font-weight: 800;
    line-height: 0.92;
    letter-spacing: -0.02em;
    color: var(--hero-text);
    text-shadow: 0 2px 28px rgba(0, 0, 0, 0.55);
}
/* one word per line, each hugging the machine */
body.explode .hs-half .w { display: block; white-space: nowrap; }
body.explode .hs-l   { grid-area: hl;  text-align: right; padding-right: 2vw; }
body.explode .hs-r   { grid-area: hr;  text-align: left;  padding-left: 2vw; }
body.explode .hs-half em { font-style: normal; color: var(--accent-bright); }

body.explode .hs-eyebrow { grid-area: eye; justify-content: flex-end; margin: 0; padding-right: 2vw; }
body.explode .hs-sub {
    grid-area: sub;
    margin: 0 0 0 auto;
    padding-right: 2vw;
    max-width: 340px;
    text-align: right;
    font-size: 15.5px;
    text-shadow: 0 1px 14px rgba(0, 0, 0, 0.7);
}
body.explode .hs-cta { grid-area: cta; justify-content: flex-start; align-self: start; padding-left: 2vw; }

/* ── the scatter ── */
body.explode .hs-grid .ch {
    display: inline-block;
    /* per-letter progress: waits for its delay, then runs to 1 */
    --t: clamp(0, (var(--s) - var(--d, 0)) / (1 - var(--d, 0)), 1);
    transform:
        translate3d(calc(var(--t) * var(--dx, 0) * 1vw), calc(var(--t) * var(--dy, 0) * 1vh), 0)
        rotate(calc(var(--t) * var(--rot, 0) * 1deg))
        scale(calc(1 + var(--t) * var(--sc, 0)));
    opacity: calc(1 - var(--t) * var(--t) * 1.15);
    filter: blur(calc(var(--t) * var(--t) * 6px));
    will-change: transform;
}
/* supporting copy moves as a block, not per letter */
body.explode .hs-eyebrow,
body.explode .hs-sub,
body.explode .hs-cta {
    transform: translate3d(calc(var(--s) * var(--side, -1) * 9vw), 0, 0);
    opacity: calc(1 - var(--s) * 1.6);
}
body.explode .hs-eyebrow, body.explode .hs-sub { --side: -1; }
body.explode .hs-cta { --side: 1; }
body.explode .hero.hs-gone .hs-cta { pointer-events: none; }

/* ── NARROW / PORTRAIT ── the tower fills the middle of the screen, so
   the split turns vertical: first half above it, second half below, and
   the scatter blows up and down instead of left and right. */
@media (max-width: 999px), (max-aspect-ratio: 13/9) {
    body.explode .hero::before {
        background: linear-gradient(180deg,
            rgba(8, 11, 9, 0.80) 0%, rgba(8, 11, 9, 0.35) 30%, rgba(8, 11, 9, 0) 40%,
            rgba(8, 11, 9, 0) 55%, rgba(8, 11, 9, 0.45) 68%, rgba(8, 11, 9, 0.85) 100%);
    }
    body.explode .hs-grid {
        height: 100%;
        padding: 88px 24px 40px;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto 1fr auto auto auto;
        grid-template-areas: "eye" "hl" "." "hr" "sub" "cta";
        align-content: stretch;
        row-gap: 14px;
        text-align: center;
    }
    body.explode .hs-half { font-size: clamp(38px, 11vw, 72px); }
    body.explode .hs-half .w { display: inline; }
    body.explode .hs-l, body.explode .hs-r { text-align: center; padding: 0; }
    body.explode .hs-eyebrow { justify-content: center; padding: 0; }
    body.explode .hs-sub { margin: 0 auto; padding: 0; text-align: center; font-size: 14.5px; }
    body.explode .hs-cta { justify-content: center; padding: 0; }
    body.explode .hs-eyebrow,
    body.explode .hs-sub,
    body.explode .hs-cta { transform: translate3d(0, calc(var(--s) * var(--side, -1) * 6vh), 0); }
    body.explode .hs-sub { --side: 1; }
}

/* ── STATS ── */
body.explode .stats-bar   { background: var(--glass); }
body.explode .stats-inner { background: rgba(255, 255, 255, 0.06); }
body.explode .stat-item   { background: transparent; }

/* ── VIEWING BANDS ── empty runway where nothing covers the machine,
   so the explode is actually seen instead of happening behind cards */
.pc-band {
    position: relative;
    z-index: 2;
    height: 70vh;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 24px 6vh;
}
.pc-band p {
    font-family: 'Space Mono', monospace;
    font-size: clamp(11px, 1.3vw, 13px);
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(240, 240, 237, 0.62);
    text-align: center;
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.8);
}

/* ── SECTIONS → glass ── */
body.explode #services,
body.explode #pricing,
body.explode #portfolio,
body.explode #contact { background: transparent; border-top: 0; }

body.explode .section-header {
    background: var(--glass);
    padding: 28px 32px;
    border: 1px solid var(--border);
}
body.explode .services-grid,
body.explode .pricing-grid { background: var(--border); }
body.explode .service-card,
body.explode .price-card,
body.explode .portfolio-item,
body.explode .contact-form,
body.explode .contact-info,
body.explode .pricing-footnote,
body.explode .portfolio-cta { background: var(--glass-strong); }
body.explode .contact-info { padding: 36px; border: 1px solid var(--border); }
body.explode .pricing-footnote,
body.explode .portfolio-cta { padding: 28px 32px; border: 1px solid var(--border); }

body.explode .service-card:hover,
body.explode .portfolio-item:hover { background: rgba(16, 30, 23, 0.9); }
body.explode .price-card.featured  { background: rgba(14, 34, 25, 0.9); }

body.explode .form-control       { background: rgba(255, 255, 255, 0.04); }
body.explode .form-control:focus { background: rgba(255, 255, 255, 0.08); }
body.explode select.form-control option { background: #121714; color: #f0f0ed; }

/* ── INNER PAGES (AI Apps) ── the breadcrumb takes the eyebrow slot,
   the prose column sits on one glass panel, and the CTA band (which
   uses var(--text) as a fill, light here) is pinned dark. */
body.explode .breadcrumb.hs-eyebrow { margin: 0; }
body.explode .breadcrumb.hs-eyebrow ol { justify-content: flex-end; }
body.explode .pc-prose { background: transparent; }
body.explode .pc-prose .section-inner {
    max-width: 960px;
    background: var(--glass-strong);
    border: 1px solid var(--border);
}
body.explode .step { background: rgba(255, 255, 255, 0.02); }
body.explode .related-card { background: rgba(255, 255, 255, 0.03); }
body.explode .related-card:hover { background: rgba(16, 30, 23, 0.9); }
body.explode .cta-band { background: var(--glass-strong); border-top: 1px solid var(--border); }
@media (max-width: 999px), (max-aspect-ratio: 13/9) {
    body.explode .breadcrumb.hs-eyebrow ol { justify-content: center; }
}
@media (max-width: 900px) {
    body.explode .pc-prose .section-inner { padding: 56px 20px; }
}

/* Inline links outside .prose (form note, step copy, callouts) had no
   colour rule and fell back to the browser's dark blue: unreadable here. */
body.explode main p a:not([class]),
body.explode main li a:not([class]) { color: #3ee0a8; }

/* ── FOOTER ── */
body.explode footer { background: var(--glass-strong); }

@media (max-width: 900px) {
    .pc-band { height: 55vh; }
    body.explode .section-header { padding: 22px 20px; }
}
