/* ==========================================================================
   CONTEXT PRODUCT PAGE - 13-INCH IPAD PRO 3D STAGE & UNIFIED SCROLL
   Inherits centralized design tokens from css/design-tokens.css
   ========================================================================== */

/* --- 1. 13-INCH IPAD PRO (M4, LANDSCAPE) 3D STAND-UP STAGE & HARDWARE FRAME --- */
.ipad-pro-3d-stage {
    position: relative;
    width: 100%;
    max-width: var(--ipad-stage-max-w);
    margin: 0 auto;
    perspective: 1300px;
    perspective-origin: 50% 62%;
}

/* Once the 3D stand-up finishes, flatten perspective so video & Retina image never blur */
.ipad-pro-3d-stage.is-upright {
    perspective: none;
}

.ipad-pro-ground-shadow {
    position: absolute;
    left: 50%;
    bottom: -14px;
    width: 88%;
    height: 36px;
    border-radius: 50%;
    background: var(--ipad-ground-shadow);
    transform: translateX(-50%) translateY(-48px) scaleX(0.98) scaleY(3.4);
    filter: blur(22px);
    opacity: 0.55;
    transition:
        transform 1.4s var(--ease-out-expo),
        opacity 1.4s var(--ease-out-expo),
        filter 1.4s var(--ease-out-expo);
    pointer-events: none;
    z-index: var(--z-base);
}

.ipad-pro-3d-stage.is-standing .ipad-pro-ground-shadow {
    transform: translateX(-50%) translateY(0) scaleX(0.92) scaleY(1);
    filter: blur(14px);
    opacity: 0.68;
}

.ipad-pro-13-frame {
    position: relative;
    z-index: var(--z-elevated);
    width: 100%;
    padding: 2.5px;
    border-radius: calc(var(--ipad-outer-radius) + 2.5px);
    background: var(--ipad-chassis-gradient);
    box-shadow:
        0 14px 32px -8px rgba(var(--rgb-black), 0.22),
        inset 0 1px 0 rgba(var(--rgb-white), 0.28);
    box-sizing: border-box;
    transform-style: preserve-3d;
    transform-origin: 50% 93%;
    transform: translateY(-10px) rotateX(76deg) scale(0.94);
    transition:
        transform 1.4s var(--ease-out-expo),
        box-shadow 1.4s var(--ease-out-expo);
}

.ipad-pro-3d-stage.is-standing .ipad-pro-13-frame {
    transform: translateY(0) rotateX(0deg) scale(1);
    box-shadow:
        0 28px 60px -12px rgba(var(--rgb-black), 0.28),
        0 12px 24px -8px rgba(var(--rgb-black), 0.16),
        inset 0 1px 0 rgba(var(--rgb-white), 0.28);
}

.ipad-pro-3d-stage.is-upright .ipad-pro-13-frame {
    transform-style: flat;
    transform: none;
}

/* Physical Front-Bottom Anodized Chassis Edge Visible While Lying Flat */
.ipad-pro-bottom-thickness {
    position: absolute;
    left: 4%;
    right: 4%;
    bottom: -7px;
    height: 9px;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    background: var(--ipad-edge-gradient);
    box-shadow: inset 0 -1px 0 rgba(var(--rgb-white), 0.16);
    transform-origin: top center;
    transform: rotateX(-76deg) scaleY(1);
    opacity: 0.95;
    transition:
        transform 1.4s var(--ease-out-expo),
        opacity 1.1s ease;
    pointer-events: none;
}

.ipad-pro-3d-stage.is-standing .ipad-pro-bottom-thickness {
    transform: rotateX(0deg) scaleY(0.15);
    opacity: 0;
}

.ipad-pro-13-bezel {
    position: relative;
    background-color: var(--ipad-bezel-surface);
    padding: var(--ipad-bezel);
    border-radius: var(--ipad-outer-radius);
    box-shadow: inset 0 0 0 1px rgba(var(--rgb-white), 0.06);
    box-sizing: border-box;
}

/* Landscape TrueDepth Camera System (Centered on Top Long Edge) */
.ipad-pro-camera-cluster {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    height: var(--ipad-bezel);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    pointer-events: none;
    z-index: var(--z-overlay);
}

.ipad-pro-lens {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ipad-lens-gradient);
    box-shadow:
        inset 0 0 1px rgba(var(--rgb-white), 0.35),
        0 0 0 1px rgba(var(--rgb-white), 0.07);
}

.ipad-pro-sensor {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--ds-bg-card);
    box-shadow: inset 0 0 1px rgba(var(--rgb-white), 0.15);
}

.ipad-pro-sensor.ipad-pro-mic {
    width: 3px;
    height: 3px;
    background-color: var(--ds-bg-titanium);
}

/* Subtle Hardware Buttons (Landscape Top-Left & Left Edge) */
.ipad-pro-btn {
    position: absolute;
    background: var(--ipad-btn-gradient-h);
    border-radius: var(--radius-hairline);
    pointer-events: none;
}

.ipad-pro-btn-vol-up {
    top: -2px;
    left: 54px;
    width: 24px;
    height: 2px;
}

.ipad-pro-btn-vol-down {
    top: -2px;
    left: 84px;
    width: 24px;
    height: 2px;
}

.ipad-pro-btn-top {
    top: 48px;
    left: -2px;
    width: 2px;
    height: 28px;
    background: var(--ipad-btn-gradient-v);
}

.ipad-pro-13-screen {
    position: relative;
    width: 100%;
    aspect-ratio: 1376 / 1032;
    border-radius: var(--ipad-screen-radius);
    overflow: hidden;
    background-color: var(--ds-bg-dark);
    box-shadow: 0 0 0 1px rgba(var(--rgb-white), 0.08);
}

/* Skyward Glass Reflection Sweep while Lying Flat -> Clears as iPad Stands Up */
.ipad-pro-sky-reflection {
    position: absolute;
    inset: 0;
    background: var(--ipad-sky-reflection);
    opacity: 0.9;
    transform: translateY(0);
    transition:
        opacity 1.35s var(--ease-out-expo),
        transform 1.35s var(--ease-out-expo);
    pointer-events: none;
    z-index: var(--z-elevated);
}

.ipad-pro-3d-stage.is-standing .ipad-pro-sky-reflection {
    opacity: 0;
    transform: translateY(28%);
}

@media (prefers-reduced-motion: reduce) {
    .ipad-pro-13-frame,
    .ipad-pro-ground-shadow,
    .ipad-pro-bottom-thickness,
    .ipad-pro-sky-reflection {
        transition: none !important;
        transform: none !important;
    }

    .ipad-pro-bottom-thickness,
    .ipad-pro-sky-reflection {
        opacity: 0 !important;
    }
}

.bento-interface-video {
    width: 100%;
    height: 100%;
    aspect-ratio: 1376 / 1032;
    display: block;
    object-fit: cover;
    margin: 0;
    border-radius: 0;
}

.bento-interface-end-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: var(--z-base);
}

.bento-interface-end-image.is-visible {
    opacity: 1;
}

/* --- 2. UNIFIED SCROLL EXPERIENCE: "FAST, SIMPLE, & INTUITIVE" -> "LESS TAPS, MORE SELF-EXPRESSION" --- */
.section-interface-speed {
    overflow: visible;
    overflow-anchor: none;
    padding: clamp(28px, 4vh, 52px) 0;
}

.interface-speed-scroll-track {
    position: relative;
    width: 100%;
    height: 520vh;
}

.interface-speed-sticky {
    position: sticky;
    top: var(--fluent-subnav-h, 52px);
    height: calc(100vh - var(--fluent-subnav-h, 52px));
    height: calc(100dvh - var(--fluent-subnav-h, 52px));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(8px, 1.2vh, 16px) 0;
    box-sizing: border-box;
    z-index: var(--z-elevated);
}

.interface-speed-bento {
    --unified-header-min-h: clamp(68px, 9.5vh, 92px);
    --unified-header-mb: clamp(14px, 2.2vh, 26px);
    width: 100%;
    max-width: var(--container-max-bento);
    margin: 0 auto;
    padding: clamp(20px, 2.8vh, 34px) clamp(24px, 3.5vw, 48px) !important;
    overflow: hidden;
    position: relative;
}

/* Header Swap Stage ("Fast, simple, & intuitive" -> "Fewer taps, more self-expression") */
.unified-header-stage {
    position: relative;
    min-height: var(--unified-header-min-h);
    margin-bottom: var(--unified-header-mb);
    z-index: var(--z-stage-header);
}

.header-fast-intuitive {
    position: relative;
    z-index: var(--z-elevated);
}

.header-less-taps {
    position: absolute;
    top: calc(-1 * (var(--unified-header-min-h) + var(--unified-header-mb)));
    left: 0;
    max-width: 780px;
    text-align: left;
    opacity: 0;
    transform: translateY(18px);
    pointer-events: none;
    z-index: var(--z-stage-header);
}

.header-less-taps .context-headline {
    margin: 0 0 8px 0;
    font-size: var(--type-headline-secondary);
    line-height: var(--leading-tight);
}

.header-less-taps .context-subhead {
    margin: 0;
    font-size: var(--type-subhead);
    max-width: 520px;
}

/* Unified Diagram Stage: Left Inputs + Right/Left Moving Live iPad Pro + Right Output */
.unified-ipad-diagram {
    position: relative;
    width: 100%;
    max-width: 1180px;
    height: clamp(340px, 48vh, 440px);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Decorative Gradient Ribbons SVG */
.io-ribbons-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: var(--z-base);
}

.io-ribbon-path {
    opacity: 0;
}

/* Left Column: 4 Input Callout Cards (Displayed while iPad is on the Right) */
.io-callouts-left {
    position: absolute;
    left: 8px;
    top: 10px;
    bottom: 10px;
    width: 365px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: var(--z-controls);
    pointer-events: none;
}

/* Right Column: 1 Output Callout Card (Displayed after iPad moves to the Left) */
.io-callouts-right {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    width: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-controls);
    pointer-events: none;
}

.io-callout-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    text-align: left;
    opacity: 0;
    transform: translate(-20px, 0);
}

.io-callout-card.io-callout-output {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    transform: translate(22px, 0);
}

.io-callout-icon {
    width: 46px;
    height: 46px;
    min-width: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.io-callout-icon svg {
    width: 100%;
    height: 100%;
}

.io-callout-icon.io-icon-output {
    width: 82px;
    height: 48px;
}

.io-callout-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.io-callout-eyebrow {
    font-size: var(--type-micro);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-wider);
    text-transform: uppercase;
    color: var(--ds-text-eyebrow-dark);
}

.io-callout-title {
    font-family: var(--font-heading);
    font-size: clamp(18px, 1.5vw, 20px);
    font-weight: var(--weight-semibold);
    line-height: var(--leading-snug);
    letter-spacing: var(--tracking-subtle);
    color: var(--ds-text-dark);
    margin: 0;
}

.io-callout-output .io-callout-title {
    font-size: var(--type-card-headline);
}

.io-callout-output .io-callout-desc {
    font-size: var(--type-body);
}

.io-callout-desc {
    font-size: var(--text-btn);
    line-height: var(--leading-subhead);
    color: var(--ds-text-secondary-dark);
    margin: 2px 0 0 0;
}

/* iPad Pro Mover Wrapper */
.ipad-pro-mover {
    position: relative;
    width: 100%;
    max-width: min(var(--ipad-mover-max-w), 60vh);
    z-index: var(--z-overlay);
    transform-origin: center center;
}

.ipad-pro-mover .ipad-pro-3d-stage {
    margin: 0 auto;
    max-width: min(var(--ipad-mover-max-w), 60vh);
}

@media (max-width: 1024px) {
    .section-interface-speed {
        padding: var(--fluent-section-spacing) var(--container-gutter);
    }

    .interface-speed-bento {
        padding: clamp(28px, 4vw, 44px) clamp(20px, 3vw, 36px) !important;
    }

    .interface-speed-scroll-track {
        height: auto;
    }

    .interface-speed-sticky {
        position: relative;
        top: 0;
        height: auto;
        padding: 0;
    }

    .unified-header-stage {
        min-height: 0;
        margin-bottom: 24px;
    }

    .header-less-taps {
        position: relative;
        top: auto;
        left: auto;
        opacity: 1 !important;
        transform: none !important;
        max-width: var(--container-max-xs);
        margin: 20px auto 0;
        padding-top: 20px;
        border-top: 1px solid var(--ds-border-light);
        width: 100%;
        text-align: center;
        pointer-events: auto;
    }

    .header-less-taps .context-headline {
        font-size: clamp(1.5rem, 3.8vw, 2.2rem);
        margin-bottom: 8px;
    }

    .header-less-taps .context-subhead {
        font-size: var(--text-base);
        line-height: var(--leading-normal);
        margin: 0 auto;
    }

    .unified-ipad-diagram {
        height: auto;
        flex-direction: column;
        gap: 24px;
    }

    .io-ribbons-svg {
        display: none;
    }

    .ipad-pro-mover {
        transform: none !important;
        max-width: min(var(--ipad-mover-max-w), 52vh);
    }

    .ipad-pro-mover .ipad-pro-3d-stage {
        max-width: min(var(--ipad-mover-max-w), 52vh);
    }

    .io-callouts-left {
        position: relative;
        left: auto;
        top: auto;
        bottom: auto;
        width: 100%;
        max-width: 680px;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
        pointer-events: auto;
    }

    .io-callouts-right {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        width: 100%;
        max-width: 440px;
        padding-top: 24px;
        pointer-events: auto;
    }

    .io-callouts-right::before {
        content: "";
        position: absolute;
        top: -4px;
        left: 50%;
        transform: translateX(-50%);
        width: 2px;
        height: 22px;
        border-radius: 2px;
        background: linear-gradient(
            180deg,
            var(--ribbon-context-end) 0%,
            var(--ribbon-out-1) 100%
        );
        opacity: 0.75;
    }

    .io-callout-card,
    .io-callout-card.io-callout-output {
        opacity: 1 !important;
        transform: none !important;
        background: rgba(var(--rgb-white), 0.88);
        padding: 18px 20px;
        border-radius: var(--radius-card);
        border: 1px solid var(--ds-border-light);
        box-shadow: 0 8px 24px rgba(var(--rgb-black), 0.04);
    }

    .io-callout-card.io-callout-output {
        width: 100%;
        box-sizing: border-box;
        background: var(--ds-bg-white);
        border-color: rgba(var(--ds-blue-rgb), 0.22);
        box-shadow: 0 12px 32px rgba(var(--ds-blue-rgb), 0.08);
    }
}

@media (max-width: 640px) {
    .interface-speed-bento {
        padding: 24px 18px !important;
    }

    .unified-header-stage {
        margin-bottom: 18px;
    }

    .header-less-taps {
        margin: 16px auto 0;
        padding-top: 16px;
    }

    .unified-ipad-diagram {
        gap: 18px;
    }

    .ipad-pro-mover,
    .ipad-pro-mover .ipad-pro-3d-stage {
        max-width: 100%;
    }

    .io-callouts-left {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .io-callout-card,
    .io-callout-card.io-callout-output {
        padding: 16px 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .interface-speed-scroll-track {
        height: auto;
    }

    .interface-speed-sticky {
        position: relative;
        top: 0;
        height: auto;
    }

    .header-less-taps {
        position: relative;
        top: auto;
        left: auto;
        opacity: 1 !important;
        transform: none !important;
        margin-top: 24px;
        pointer-events: auto;
    }

    .io-callout-card,
    .io-ribbon-path {
        opacity: 1 !important;
        transform: none !important;
    }
}
