/* ===========================================
   KSP | hero/hero.css — hero option A / B / C + chooser
   (loaded after style.css; reuses its tokens)
   =========================================== */

/* ── Shared hero shell ── */
.hx {
    position: relative;
    height: 100svh;
    min-height: 640px;
    overflow: hidden;
    isolation: isolate;
}
.hx canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
.hx-ui { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.hx-ui a, .hx-ui button, .hx-ui .pe { pointer-events: auto; }
.hx-inner { position: relative; height: 100%; max-width: var(--maxw); margin: 0 auto; padding: calc(var(--header-h) + 24px) var(--gutter) 0; }
.hx-fallback { position: absolute; inset: 0; z-index: 0; background: url("../images/hero.webp") center/cover; opacity: .2; transition: opacity 1.2s; }
.webgl-ready .hx-fallback { opacity: 0; }

.hx-kicker { display: inline-flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 600; letter-spacing: .24em; text-transform: uppercase; color: var(--accent-2); }
.hx-kicker i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 14px var(--accent-2); animation: pulse 2s infinite; }
.hx-title { font-size: clamp(42px, 6.4vw, 96px); font-weight: 800; line-height: 1.04; letter-spacing: -.035em; margin: 22px 0 22px; }
.hx-title .line { display: block; overflow: hidden; padding-bottom: .06em; }
.hx-title .line > span { display: inline-block; transform: translateY(110%); transition: transform 1.2s var(--ease); }
.hx-title.in .line > span { transform: none; }
.hx-title .line:nth-child(2) > span { transition-delay: .12s; }
.hx-title .line:nth-child(3) > span { transition-delay: .24s; }
.hx-sub { font-size: clamp(15px, 1.25vw, 18px); color: var(--muted); max-width: 30em; line-height: 1.8; }
.hx-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.fade-up { opacity: 0; transform: translateY(24px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.in .fade-up, .fade-up.in { opacity: 1; transform: none; }
.fade-up.d1 { transition-delay: .3s; } .fade-up.d2 { transition-delay: .45s; } .fade-up.d3 { transition-delay: .6s; } .fade-up.d4 { transition-delay: .8s; }

/* glass stat strip */
.hx-stats {
    position: absolute; left: var(--gutter); right: var(--gutter); bottom: 28px;
    max-width: calc(var(--maxw) - 2 * var(--gutter)); margin: 0 auto;
    display: grid; grid-template-columns: repeat(4, 1fr);
    border: 1px solid var(--line-2); border-radius: 18px;
    background: rgba(8, 13, 24, .45);
    backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
    overflow: hidden;
}
.hx-stat { padding: 18px 24px; border-right: 1px solid var(--line); }
.hx-stat:last-child { border-right: 0; }
.hx-stat b { display: block; font-size: clamp(22px, 2.2vw, 32px); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.hx-stat b small { font-size: .5em; color: var(--accent-2); margin-left: 3px; font-weight: 600; }
.hx-stat span { font-size: 12.5px; color: var(--muted); }

/* callouts (projected from 3D) */
.callout-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.callout-lines polyline { fill: none; stroke: rgba(111, 211, 255, .7); stroke-width: 1; transition: opacity .4s; }
.callout-lines circle { fill: var(--accent-2); filter: drop-shadow(0 0 6px var(--accent-2)); transition: opacity .4s; }
.callout {
    position: absolute; left: 0; top: 0;
    padding: 9px 14px; border-radius: 10px;
    background: rgba(6, 10, 20, .62); border: 1px solid rgba(111, 211, 255, .3);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    font-size: 12px; color: var(--muted); white-space: nowrap;
    transition: opacity .4s; will-change: transform;
}
.callout b { display: block; color: #fff; font-size: 13px; letter-spacing: .06em; }
.callout .mono { color: var(--accent-2); }

/* scroll progress rail */
.hx-rail { position: absolute; right: var(--gutter); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 12px; font-size: 10.5px; letter-spacing: .3em; color: var(--dim); writing-mode: vertical-rl; }
.hx-rail .bar { width: 2px; height: 120px; background: var(--line-2); position: relative; overflow: hidden; border-radius: 2px; }
.hx-rail .bar i { position: absolute; left: 0; top: 0; width: 100%; height: 0; background: linear-gradient(var(--accent-2), var(--accent)); }

/* ── Option A — Studio cutaway ── */
.hx-a {
    background:
        radial-gradient(ellipse 55% 60% at 68% 52%, rgba(47, 143, 255, .2), transparent 70%),
        radial-gradient(ellipse 120% 70% at 50% 120%, rgba(111, 211, 255, .08), transparent 60%),
        linear-gradient(180deg, #04060b 0%, #070c16 60%, #05080f 100%);
}
.hx-a .hx-copy { position: relative; top: 50%; transform: translateY(-58%); max-width: 600px; }
.hx-a .hx-title .grad { background: linear-gradient(100deg, #fff 0%, #cfe6ff 40%, var(--accent-2) 70%, var(--accent) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ── Option B — Blueprint scan ── */
.hx-b {
    background:
        radial-gradient(ellipse 50% 60% at 66% 50%, rgba(47, 143, 255, .22), transparent 70%),
        #061226;
}
.hx-b::before {
    content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background-image:
        linear-gradient(rgba(111, 211, 255, .09) 1px, transparent 1px),
        linear-gradient(90deg, rgba(111, 211, 255, .09) 1px, transparent 1px),
        linear-gradient(rgba(111, 211, 255, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(111, 211, 255, .04) 1px, transparent 1px);
    background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
    mask-image: radial-gradient(ellipse 80% 80% at 60% 50%, #000 30%, transparent 85%);
}
.hx-b canvas { cursor: grab; }
.hx-b canvas:active { cursor: grabbing; }
.hx-b .hx-copy { position: relative; top: 50%; transform: translateY(-55%); max-width: 470px; }
.hx-b .hx-title { font-size: clamp(38px, 5.2vw, 78px); }
.drawing-frame { position: absolute; inset: calc(var(--header-h) + 8px) 18px 18px; border: 1px solid rgba(111, 211, 255, .18); pointer-events: none; z-index: 1; }
.drawing-frame::before, .drawing-frame::after { content: ""; position: absolute; width: 18px; height: 18px; border-color: var(--accent-2); border-style: solid; }
.drawing-frame::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.drawing-frame::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }
.title-block {
    position: absolute; right: 18px; bottom: 18px; z-index: 2;
    display: grid; grid-template-columns: auto auto; font-size: 11px; color: var(--muted);
    border-left: 1px solid rgba(111, 211, 255, .25); border-top: 1px solid rgba(111, 211, 255, .25);
    background: rgba(6, 18, 38, .7);
}
.title-block div { padding: 7px 14px; border-right: 1px solid rgba(111, 211, 255, .15); border-bottom: 1px solid rgba(111, 211, 255, .15); }
.title-block b { color: #fff; font-weight: 600; margin-left: 8px; }
.part-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 30px; }
.part-tab {
    position: relative; overflow: hidden;
    padding: 10px 16px; border-radius: 10px;
    border: 1px solid rgba(111, 211, 255, .25); background: rgba(6, 18, 38, .6);
    color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .06em; cursor: pointer;
    transition: color .3s, border-color .3s, background .3s;
}
.part-tab:hover { color: #fff; border-color: var(--accent-2); }
.part-tab.active { color: #fff; border-color: var(--accent); background: rgba(47, 143, 255, .22); }
.part-tab .prog { position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: var(--accent-2); }
.spec-card {
    margin-top: 22px; padding: 20px 22px; border-radius: 14px;
    border: 1px solid rgba(111, 211, 255, .2); background: rgba(6, 18, 38, .55);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    max-width: 420px;
}
.spec-card .sc-cat { font-size: 11px; letter-spacing: .2em; color: var(--accent-2); text-transform: uppercase; }
.spec-card h3 { font-size: 22px; margin: 4px 0 8px; }
.spec-card p { font-size: 14px; color: var(--muted); line-height: 1.7; }
.spec-card dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin-top: 14px; font-size: 13px; }
.spec-card dt { color: var(--dim); }
.spec-card dd { color: #fff; }
.spec-swap { transition: opacity .35s, transform .35s var(--ease); }
.spec-swap.out { opacity: 0; transform: translateY(8px); }
.drag-hint { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); font-size: 12px; color: var(--dim); letter-spacing: .14em; display: flex; gap: 10px; align-items: center; }
.drag-hint svg { width: 18px; height: 18px; color: var(--accent-2); }

/* ── Option C — Particle forge ── */
.hx-c { background: radial-gradient(ellipse 70% 70% at 50% 50%, #0a1428 0%, #03050a 70%); }
.hx-c .hx-copy { position: absolute; left: var(--gutter); bottom: 120px; max-width: 560px; }
.hx-c .hx-title { font-size: clamp(40px, 5.8vw, 88px); }
.forge-caption { position: absolute; right: var(--gutter); top: 50%; transform: translateY(-50%); text-align: right; }
.forge-caption .fc-no { font-size: 12px; color: var(--accent-2); letter-spacing: .3em; }
.forge-caption .fc-name { font-size: clamp(30px, 3.6vw, 54px); font-weight: 800; letter-spacing: .02em; line-height: 1.05; margin: 8px 0; }
.forge-caption .fc-desc { font-size: 14px; color: var(--muted); }
.forge-caption .swap { transition: opacity .5s, transform .6s var(--ease), filter .5s; }
.forge-caption .swap.out { opacity: 0; transform: translateY(14px); filter: blur(6px); }
.forge-dots { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.forge-dot { width: 34px; height: 3px; border-radius: 3px; background: var(--line-2); border: 0; cursor: pointer; position: relative; overflow: hidden; padding: 0; }
.forge-dot i { position: absolute; inset: 0; width: 0; background: var(--accent-2); }
.forge-dot.done i { width: 100%; }
.hx-c .hx-stats { grid-template-columns: repeat(4, 1fr); }

/* ── Option switcher (fixed) ── */
.opt-switch {
    position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 300;
    display: flex; align-items: center; gap: 4px;
    padding: 6px; border-radius: 999px;
    background: rgba(10, 16, 28, .82); border: 1px solid var(--line-2);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .9);
    font-size: 13px;
}
.opt-switch span { padding: 0 10px 0 12px; color: var(--dim); white-space: nowrap; }
.opt-switch a { padding: 8px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; transition: background .3s, color .3s; white-space: nowrap; }
.opt-switch a:hover { color: #fff; background: var(--surface-2); }
.opt-switch a.on { background: var(--accent); color: #fff; }

/* ── Chooser page ── */
.chooser { padding: calc(var(--header-h) + 60px) 0 120px; }
.chooser-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 50px; }
.opt-card { position: relative; border-radius: 22px; overflow: hidden; border: 1px solid var(--line-2); background: var(--bg-2); display: flex; flex-direction: column; }
.opt-card .shot { aspect-ratio: 16 / 10; overflow: hidden; background: #000; }
.opt-card .shot img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.opt-card:hover .shot img { transform: scale(1.05); }
.opt-card .body { padding: 24px 24px 26px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.opt-card .tag { font-size: 12px; color: var(--accent-2); letter-spacing: .2em; font-weight: 600; }
.opt-card h3 { font-size: 24px; }
.opt-card p { color: var(--muted); font-size: 14.5px; }
.opt-card ul { margin: 6px 0 10px; display: grid; gap: 6px; }
.opt-card li { font-size: 13.5px; color: var(--muted); padding-left: 16px; position: relative; }
.opt-card li::before { content: ""; position: absolute; left: 0; top: .7em; width: 7px; height: 1px; background: var(--accent-2); }
.opt-card .btn { margin-top: auto; align-self: flex-start; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .hx { min-height: 600px; }
    .hx-a .hx-copy, .hx-b .hx-copy { top: auto; transform: none; position: absolute; left: var(--gutter); right: var(--gutter); bottom: 150px; }
    .hx-title { margin: 14px 0 14px; }
    .hx-stats { grid-template-columns: repeat(2, 1fr); bottom: 76px; }
    .hx-stat { padding: 10px 14px; }
    .hx-stat:nth-child(2) { border-right: 0; }
    .hx-stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
    .hx-a .hx-stats, .hx-c .hx-stats { display: none; }
    .hx-rail, .callout, .callout-lines, .title-block { display: none; }
    .hx-b .hx-copy { bottom: 90px; }
    .hx-b .hx-sub { display: none; }
    .spec-card { display: none; }
    .drawing-frame { inset: calc(var(--header-h) + 4px) 8px 8px; }
    .hx-c .hx-copy { bottom: 96px; }
    .forge-caption { top: calc(var(--header-h) + 26px); transform: none; right: var(--gutter); }
    .forge-caption .fc-desc { display: none; }
    .chooser-grid { grid-template-columns: 1fr; }
    .drag-hint { display: none; }
    .opt-switch { bottom: 12px; font-size: 12px; }
    .opt-switch span { display: none; }
}
@media (max-width: 560px) {
    .hx-a .hx-copy { bottom: 92px; }
    .hx-actions .btn { flex: 1; justify-content: center; padding: 13px 18px; }
}
.forge-dot i { transition: width .8s var(--ease); }
.hx-c .scroll-hint { bottom: 70px; }

/* pinned hero (option A): the exploded view plays while the hero holds */
.hx-pin { position: relative; height: 210vh; }
.hx-pin > .hx { position: sticky; top: 0; }
.hx-a .hx-copy { transition: opacity .2s linear; }
@media (max-width: 900px) { .hx-pin { height: 170vh; } }
/* option C composition: copy bottom-left, caption bottom-right, form centre-right */
.forge-caption { top: auto; bottom: 120px; transform: none; }
@media (max-width: 900px) { .forge-caption { top: calc(var(--header-h) + 22px); bottom: auto; } }
@media (max-width: 900px) {
    .hx-c .hx-copy { right: var(--gutter); }
    .hx-c .scroll-hint { display: none; }
}

/* option C: copy drifts up and fades as the particles blow apart (--hp is set by hero-c.js) */
.hx-c .hx-copy { transform: translate3d(0, calc(var(--hp, 0) * -48px), 0); opacity: calc(1 - var(--hp, 0) * 1.25); will-change: transform, opacity; }
.hx-c .scroll-hint { opacity: calc(1 - var(--hp, 0) * 3); }
@media (prefers-reduced-motion: reduce) { .hx-c .hx-copy { transform: none; opacity: 1; } }

/* mobile: dark scrim behind the copy so text never fights the particles */
@media (max-width: 900px) {
    .hx-c .hx-copy::before {
        content: ""; position: absolute; z-index: -1; pointer-events: none;
        left: calc(var(--gutter) * -1); right: calc(var(--gutter) * -1); top: -90px; bottom: -110px;
        background: linear-gradient(180deg, rgba(3, 5, 10, 0), rgba(3, 5, 10, .82) 38%, rgba(3, 5, 10, .94));
    }
    .hx-c .hx-title { font-size: clamp(34px, 9.5vw, 52px); }
    .hx-c .hx-sub { font-size: 14px; line-height: 1.65; color: #aab6c9; }
    .forge-caption .fc-name { font-size: 24px; }
}

/* mobile: shape caption becomes a slim single row under the header, clear of the particles */
@media (max-width: 900px) {
    .forge-caption {
        left: var(--gutter); right: var(--gutter); top: calc(var(--header-h) + 8px); bottom: auto;
        text-align: left; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    }
    .forge-caption .swap { display: flex; align-items: baseline; gap: 10px; }
    .forge-caption .fc-no { font-size: 11px; letter-spacing: .2em; }
    .forge-caption .fc-name { font-size: 15px; letter-spacing: .08em; margin: 0; }
    .forge-dots { margin-top: 0; }
    .forge-dot { width: 22px; }
}
