/* ==========================================================================
   Wheel Story — immersive scroll hero + Parts & Oil section (Auto)
   ========================================================================== */
:root {
    --ws-ember: #ff7a2f;
    --ws-ember-deep: #ff4a12;
    --ws-blue: #3b7dd8;
}

/* global.css sets overflow-x:hidden on html AND body, which turns body into a scroll
   container and kills position:sticky. `clip` hides the overflow without that side effect. */
html, body { overflow-x: clip; }

.wheel-story {
    position: relative;
    height: 520vh;
    height: 520lvh; /* large viewport: stays constant while a mobile browser toolbar collapses */
    background: #000;
}

.ws-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100lvh;
    background: #000;
    overflow: hidden;
    isolation: isolate;
}

.ws-sticky canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

#wheelCanvas {
    background: #000 url('../assets/auto-scroll/poster.webp') center / cover no-repeat;
}

/* ---------- chapters ---------- */
.ws-chapter {
    position: absolute;
    z-index: 5;
    left: 6%;
    top: 62%;
    max-width: min(440px, 25vw); /* wheel's left tyre edge sits at ~32% of the width */
    margin-top: -190px;
    opacity: 0;
    visibility: hidden;
    will-change: opacity, transform;
}

/* last chapter: the wheel rests in the right third, so the copy moves to the left-centre
   and is unmasked from its right edge (nearest the wheel) towards the left (--rev set by JS) */
.ws-chapter[data-reveal] {
    top: auto;
    max-width: min(520px, 36vw);
    /* padding holds the backdrop inside the border box, so the reveal mask does not clip it hard */
    padding: 48px 64px;
    margin-left: -64px;
    --rev: -18%;
    -webkit-mask-image: linear-gradient(to left, #000 var(--rev, 0%), transparent calc(var(--rev, 0%) + 18%));
    mask-image: linear-gradient(to left, #000 var(--rev, 0%), transparent calc(var(--rev, 0%) + 18%));
}

#hero.ws-chapter { opacity: 1; visibility: visible; }

/* reveal chapter: the padding already carries the backdrop, so it must not stick out of the masked box */
.ws-chapter[data-reveal]::before { inset: 0; }

/* chapters 2-4 sit low so the copy lies under the fire band, not over it */
.ws-chapter:not(#hero) { top: auto; bottom: 7vh; margin-top: 0; }

/* local soft dark backdrop behind each text block (the rest of the frame stays pure black) */
.ws-chapter { isolation: isolate; }
.ws-chapter::before {
    content: '';
    position: absolute;
    inset: -48px -64px;
    z-index: -1;
    background: radial-gradient(closest-side, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.6) 60%, transparent);
    pointer-events: none;
}

.ws-chapter .eyebrow {
    color: var(--ws-ember);
}

.ws-chapter h1,
.ws-chapter h2 {
    font-size: clamp(2rem, 3.4vw, 3.2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.04;
    margin: 0 0 1.25rem;
    color: #fff;
    text-wrap: balance;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9), 0 4px 28px rgba(0, 0, 0, 0.85), 0 0 60px rgba(0, 0, 0, 0.7);
}

.ws-chapter h1 em,
.ws-chapter h2 em {
    font-style: normal;
    background: linear-gradient(100deg, #ffd29a 0%, var(--ws-ember) 45%, var(--ws-ember-deep) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none; /* a shadow would show through the transparent fill */
}

.ws-chapter p {
    font-size: 1.05rem;
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.88);
    max-width: 500px;
    margin: 0 0 1.75rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 2px 18px rgba(0, 0, 0, 0.9), 0 0 36px rgba(0, 0, 0, 0.7);
}

.ws-chapter .hero-ctas { justify-content: flex-start; }

.ws-points {
    list-style: none;
    margin: 0 0 1.75rem;
    padding: 0;
    display: grid;
    gap: 0.7rem;
}

.ws-points li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 2px 18px rgba(0, 0, 0, 0.9);
}

.ws-points li i {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--ws-ember);
    background: rgba(255, 122, 47, 0.12);
    border: 1px solid rgba(255, 122, 47, 0.35);
}

/* ---------- chrome ---------- */
.ws-progress {
    position: absolute;
    z-index: 6;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
}

.ws-progress i {
    display: block;
    height: 100%;
    transform-origin: 0 50%;
    transform: scaleX(0);
    background: linear-gradient(90deg, var(--ws-ember-deep), var(--ws-ember), #ffd29a);
}

.ws-hint {
    position: absolute;
    z-index: 6;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-size: 0.68rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.ws-hint::after {
    content: '';
    width: 1px;
    height: 38px;
    background: linear-gradient(var(--ws-ember), transparent);
    animation: ws-hint 1.8s ease-in-out infinite;
    transform-origin: top;
}

@keyframes ws-hint {
    0%   { transform: scaleY(0); }
    50%  { transform: scaleY(1); }
    100% { transform: scaleY(0); transform-origin: bottom; }
}

.ws-loader {
    position: absolute;
    z-index: 7;
    right: 24px;
    top: 90px;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.45);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: opacity 0.6s ease;
}

.ws-loader::before {
    content: '';
    width: 64px;
    height: 2px;
    background: linear-gradient(90deg, var(--ws-ember) var(--p, 0%), rgba(255, 255, 255, 0.15) var(--p, 0%));
}

.ws-loader.is-done { opacity: 0; pointer-events: none; }

/* ---------- reduced motion / no JS: static poster + stacked copy ---------- */
.wheel-story:not(.ws-js) { height: auto; }
.wheel-story:not(.ws-js) .ws-sticky,
.wheel-story.ws-static .ws-sticky {
    position: relative;
    height: auto;
    min-height: 100vh;
    padding: 140px 8% 80px;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    justify-content: center;
}

.wheel-story.ws-static { height: auto; }

.wheel-story:not(.ws-js) .ws-chapter,
.wheel-story.ws-static .ws-chapter {
    position: relative;
    left: auto;
    top: auto;
    margin-top: 0;
    opacity: 1;
    visibility: visible;
}

.wheel-story:not(.ws-js) canvas,
.wheel-story.ws-static canvas { display: none; }

.wheel-story:not(.ws-js) .ws-sticky,
.wheel-story.ws-static .ws-sticky {
    background: #000 url('../assets/auto-scroll/poster.webp') center / cover no-repeat;
}

.wheel-story:not(.ws-js) .ws-hint,
.wheel-story.ws-static .ws-hint,
.wheel-story:not(.ws-js) .ws-progress,
.wheel-story.ws-static .ws-progress,
.wheel-story:not(.ws-js) .ws-loader,
.wheel-story.ws-static .ws-loader { display: none; }

.wheel-story:not(.ws-js) .ws-chapter::before,
.wheel-story.ws-static .ws-chapter::before { display: none; }

.wheel-story:not(.ws-js) .ws-chapter[data-reveal],
.wheel-story.ws-static .ws-chapter[data-reveal] {
    padding: 0;
    margin-left: 0;
    -webkit-mask-image: none;
    mask-image: none;
    max-width: 440px;
}

@media (max-width: 768px) {
    .wheel-story { height: 460vh; height: 460lvh; }
    .ws-chapter {
        left: 24px;
        right: 24px;
        top: auto;
        bottom: 12vh;
        margin-top: 0;
        max-width: none;
    }
    .ws-chapter[data-reveal] { top: auto; max-width: none; left: 0; right: 0; padding: 44px 24px; margin-left: 0; }
    .ws-chapter:not(#hero) { bottom: 12vh; }
    .ws-chapter::before {
        inset: -44px -24px;
        background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.78) 22%, rgba(0, 0, 0, 0.78) 80%, transparent);
    }
    .ws-chapter[data-reveal]::before { inset: 0; }
    .ws-chapter h1, .ws-chapter h2 { font-size: clamp(2rem, 9vw, 2.8rem); }
    .ws-chapter p { font-size: 0.95rem; margin-bottom: 1.25rem; }
    .ws-chapter .hero-ctas { flex-direction: column; align-items: stretch; }
    .ws-hint { display: none; }
    .ws-loader { top: 76px; right: 16px; }
}

/* ---------- phones (portrait): poster + copy layout ----------
   The portrait frames (v_####) carry the wheel in the upper ~55% of the screen; all copy lives in the
   empty black bottom ~40%. */
@media (max-aspect-ratio: 1/1) {
    #wheelCanvas {
        background: #000 url('../assets/auto-scroll/vposter.webp') center 40% / 100% auto no-repeat;
    }
    .wheel-story:not(.ws-js) .ws-sticky,
    .wheel-story.ws-static .ws-sticky {
        background: #000 url('../assets/auto-scroll/vposter.webp') center top / 100% auto no-repeat;
    }
}

@media (max-width: 768px) and (orientation: portrait) {
    .wheel-story .ws-chapter,
    .wheel-story .ws-chapter:not(#hero) {
        top: auto;
        bottom: calc(4vh);
        bottom: calc(env(safe-area-inset-bottom, 0px) + 4lvh);
        left: 20px;
        right: 20px;
        max-width: none;
        margin: 0;
    }
    .wheel-story .ws-chapter[data-reveal] {
        left: 0;
        right: 0;
        padding: 20px;
        bottom: calc(4vh - 20px);
        bottom: calc(env(safe-area-inset-bottom, 0px) + 4lvh - 20px);
    }
    .ws-chapter::before {
        inset: -22px -20px -12px;
        background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.6) 30%, rgba(0, 0, 0, 0.6) 85%, transparent);
    }
    .ws-chapter[data-reveal]::before { inset: 0; }
    .ws-chapter .eyebrow { font-size: 0.62rem; letter-spacing: 0.2em; margin-bottom: 0.5rem; }
    .ws-chapter h1, .ws-chapter h2 {
        font-size: clamp(1.55rem, 6.6vw, 2.1rem);
        line-height: 1.08;
        margin: 0 0 0.6rem;
    }
    .ws-chapter p {
        font-size: 0.86rem;
        line-height: 1.5;
        margin: 0 0 0.8rem;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 4;
        line-clamp: 4;
        overflow: hidden;
    }
    .ws-points { gap: 0.5rem; margin: 0 0 0.4rem; }
    .ws-points li { font-size: 0.86rem; gap: 0.5rem; }
    .ws-points li i { width: 28px; height: 28px; font-size: 0.7rem; flex: none; }
    .ws-chapter .hero-ctas { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
    .ws-chapter .hero-ctas .btn { padding: 0.7rem 1rem; font-size: 0.72rem; width: auto; flex: 1 1 auto; text-align: center; }
    .ws-progress { bottom: 0; }

    .wheel-story .ws-chapter:not(#hero) { bottom: calc(env(safe-area-inset-bottom, 0px) + 4lvh); }
    .wheel-story .ws-chapter[data-reveal] { bottom: calc(env(safe-area-inset-bottom, 0px) + 4lvh - 20px); }

    /* reduced motion / no JS: poster on top, stacked copy below the wheel */
    .wheel-story:not(.ws-js) .ws-sticky,
    .wheel-story.ws-static .ws-sticky { padding: 100vw 24px 56px; gap: 2rem; justify-content: flex-start; min-height: 0; }
    .wheel-story:not(.ws-js) #hero.ws-chapter,
    .wheel-story.ws-static #hero.ws-chapter,
    .wheel-story:not(.ws-js) .ws-chapter:not(#hero),
    .wheel-story.ws-static .ws-chapter:not(#hero),
    .wheel-story:not(.ws-js) .ws-chapter[data-reveal],
    .wheel-story.ws-static .ws-chapter[data-reveal] { left: auto; right: auto; bottom: auto; }
    .wheel-story:not(.ws-js) .ws-chapter:not(#hero), .wheel-story.ws-static .ws-chapter:not(#hero) { padding: 0; }
    .wheel-story:not(.ws-js) .ws-chapter p,
    .wheel-story.ws-static .ws-chapter p { display: block; -webkit-line-clamp: unset; line-clamp: unset; }
}

/* short phones (e.g. 360x640): tighter copy so it stays under the wheel */
@media (max-width: 768px) and (orientation: portrait) and (max-height: 700px) {
    .ws-chapter .eyebrow { font-size: 0.58rem; letter-spacing: 0.12em; margin-bottom: 0.35rem; }
    .ws-chapter h1, .ws-chapter h2 { font-size: clamp(1.45rem, 6.2vw, 1.7rem); margin-bottom: 0.45rem; }
    .ws-chapter p { font-size: 0.8rem; line-height: 1.42; margin-bottom: 0.6rem; -webkit-line-clamp: 3; line-clamp: 3; }
    .ws-points { gap: 0.35rem; }
    .ws-points li i { width: 24px; height: 24px; }
    .ws-chapter .hero-ctas .btn { padding: 0.55rem 0.8rem; font-size: 0.68rem; }
    .ws-chapter[data-reveal] p { -webkit-line-clamp: 2; line-clamp: 2; }
    .wheel-story:not(.ws-js) .ws-chapter p, .wheel-story.ws-static .ws-chapter p,
    .wheel-story:not(.ws-js) .ws-chapter[data-reveal] p, .wheel-story.ws-static .ws-chapter[data-reveal] p { display: block; -webkit-line-clamp: unset; line-clamp: unset; }
}

/* ==========================================================================
   Parts & Oil section
   ========================================================================== */
.parts-section {
    position: relative;
    padding: 110px 8%;
    background:
        radial-gradient(60% 50% at 85% 0%, rgba(255, 122, 47, 0.1), transparent 70%),
        #0b0b0d;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.parts-section .section-head { max-width: 1200px; margin: 0 auto 3.25rem; }
.parts-section .section-head .eyebrow { color: var(--ws-ember); }
.parts-section .section-head p { max-width: 620px; }

.parts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    max-width: 1200px;
    margin: 0 auto;
}

.part-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, #18181c 0%, #101013 100%);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    padding: 2rem 1.75rem 1.75rem;
    transition: transform 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.part-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(90% 60% at 50% 0%, rgba(255, 122, 47, 0.14), transparent 70%);
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.part-card:hover {
    transform: translateY(-6px);
    border-color: rgba(255, 122, 47, 0.4);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5), 0 0 40px rgba(255, 90, 20, 0.08);
}

.part-card:hover::before { opacity: 1; }

.part-card .icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--ws-ember);
    background: rgba(255, 122, 47, 0.1);
    border: 1px solid rgba(255, 122, 47, 0.25);
    margin-bottom: 1.4rem;
}

.part-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.6rem;
}

.part-card p {
    font-size: 0.9rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.55);
    margin: 0 0 1.25rem;
}

.part-card ul {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    display: grid;
    gap: 0.5rem;
}

.part-card li {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.72);
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
}

.part-card li::before {
    content: '';
    flex: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ws-ember);
    transform: translateY(-1px);
}

.part-card .part-link {
    margin-top: auto;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ws-ember);
    text-decoration: none;
}

.part-card .part-link:hover { color: #ffd29a; }

.parts-note {
    max-width: 1200px;
    margin: 2.25rem auto 0;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.4);
}

@media (max-width: 768px) {
    .parts-section { padding: 70px 24px; }
}

@media (prefers-reduced-motion: reduce) {
    .ws-hint::after { animation: none; }
    .part-card, .part-card::before { transition: none; }
}
