/* ============================================================
   CINEMATIC ENGINE — Reusable cinematic page system
   All styles are driven by CSS custom properties set per-project.
   ============================================================ */

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--ce-bg-primary, #1e40af);
    font-family: var(--ce-font, "Lato", -apple-system, BlinkMacSystemFont, sans-serif);
    color: var(--ce-text, #fff);
}

/* === CHAPTER SYSTEM === */
.ce-chapter {
    position: absolute;
    inset: 0;
    opacity: 1;
    visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.ce-chapter.active {
    visibility: visible;
    pointer-events: auto;
    z-index: 3;
}

.ce-chapter-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

.ce-chapter-content {
    position: relative;
    z-index: 10;
    max-width: 1000px;
    padding: 2rem;
    max-height: 90vh;
    overflow-y: auto;
    margin-top: -8vh;
}

/* === LAYOUTS (data-layout attribute) === */

/* center-stack: centered headline + text (default) */
.ce-chapter[data-layout="center-stack"] .ce-chapter-content,
.ce-chapter:not([data-layout]) .ce-chapter-content {
    text-align: center;
}

/* split: 50/50 grid, text + image/visual */
.ce-chapter[data-layout="split"] .ce-chapter-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    max-width: 1200px;
    text-align: left;
}

.ce-chapter[data-layout="split"] .ce-split-media {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ce-chapter[data-layout="split"] .ce-split-media img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
}

/* text-left: left-aligned content */
.ce-chapter[data-layout="text-left"] .ce-chapter-content {
    text-align: left;
    max-width: 800px;
    margin-left: 10%;
    margin-right: auto;
}

/* stat-moment: big number + label */
.ce-chapter[data-layout="stat-moment"] .ce-chapter-content {
    text-align: center;
}

.ce-chapter[data-layout="stat-moment"] .ce-stat-number {
    font-size: clamp(4rem, 12vw, 10rem);
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(135deg, var(--ce-accent, #38bdf8), var(--ce-accent-glow, #a5f3fc));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.ce-chapter[data-layout="stat-moment"] .ce-stat-label {
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--ce-text-dim, rgba(255,255,255,0.7));
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* quote: large italic text + attribution */
.ce-chapter[data-layout="quote"] .ce-chapter-content {
    text-align: center;
    max-width: 900px;
}

.ce-chapter[data-layout="quote"] .ce-quote-text {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-style: italic;
    line-height: 1.6;
    color: var(--ce-text, #fff);
    margin-bottom: 2rem;
}

.ce-chapter[data-layout="quote"] .ce-quote-attr {
    font-size: 0.875rem;
    color: var(--ce-text-dim, rgba(255,255,255,0.5));
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* grid-features: 2-3 column feature grid */
.ce-chapter[data-layout="grid-features"] .ce-chapter-content {
    max-width: 1100px;
    text-align: center;
}

.ce-chapter[data-layout="grid-features"] .ce-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    text-align: left;
}

.ce-feature-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 0.75rem;
    padding: 2rem;
    transition: all 0.4s ease;
}

.ce-feature-card:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
}

.ce-feature-card .ce-feature-num {
    font-size: 2rem;
    font-weight: 900;
    color: var(--ce-accent, #38bdf8);
    opacity: 0.5;
    margin-bottom: 1rem;
}

.ce-feature-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 0.6rem;
    color: var(--ce-text, #fff);
}

.ce-feature-card p {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--ce-text-dim, rgba(255,255,255,0.7));
}

/* stacked-list: vertical items with stagger */
.ce-chapter[data-layout="stacked-list"] .ce-chapter-content {
    text-align: left;
    max-width: 800px;
}

.ce-stacked-item {
    padding: 1.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    gap: 1.5rem;
    align-items: baseline;
}

.ce-stacked-item:last-child { border-bottom: none; }

.ce-stacked-num {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--ce-accent, #38bdf8);
    opacity: 0.5;
    min-width: 2rem;
}

.ce-stacked-text h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: var(--ce-text, #fff);
}

.ce-stacked-text p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--ce-text-dim, rgba(255,255,255,0.7));
}

/* full-bleed: content over full background image */
.ce-chapter[data-layout="full-bleed"] .ce-chapter-content {
    text-align: center;
    max-width: 900px;
}

.ce-chapter[data-layout="full-bleed"] .ce-chapter-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}


/* === BACKGROUND EFFECTS === */

/* Animated gradient variants */
.ce-gradient {
    position: absolute;
    inset: 0;
    background-size: 400% 100%;
    animation: ce-ambientH 20s ease-in-out infinite;
}

.ce-gradient[data-variant="deep"] {
    background: linear-gradient(90deg,
        var(--ce-bg-primary, #1e40af) 0%,
        var(--ce-bg-secondary, #2563eb) 25%,
        color-mix(in srgb, var(--ce-bg-secondary, #2563eb), var(--ce-accent, #3b82f6) 30%) 50%,
        var(--ce-bg-secondary, #2563eb) 75%,
        var(--ce-bg-primary, #1e40af) 100%);
    background-size: 400% 100%;
}

.ce-gradient[data-variant="midnight"] {
    background: linear-gradient(90deg,
        var(--ce-bg-primary, #1e40af) 0%,
        var(--ce-bg-secondary, #2563eb) 30%,
        color-mix(in srgb, var(--ce-bg-secondary, #2563eb), var(--ce-accent, #3b82f6) 40%) 50%,
        var(--ce-bg-secondary, #2563eb) 70%,
        var(--ce-bg-primary, #1e40af) 100%);
    background-size: 400% 100%;
    animation: ce-ambientH 22s ease-in-out infinite reverse;
}

.ce-gradient[data-variant="aurora"] {
    background: linear-gradient(90deg,
        var(--ce-bg-primary, #1d4ed8) 0%,
        var(--ce-bg-secondary, #2563eb) 25%,
        var(--ce-accent, #0891b2) 50%,
        var(--ce-bg-secondary, #2563eb) 75%,
        var(--ce-bg-primary, #1d4ed8) 100%);
    background-size: 400% 100%;
    animation: ce-ambientH 18s ease-in-out infinite;
}

.ce-gradient[data-variant="hope"] {
    background: linear-gradient(90deg,
        var(--ce-bg-primary, #1e40af) 0%,
        var(--ce-bg-secondary, #3b82f6) 30%,
        var(--ce-accent-glow, #60a5fa) 50%,
        var(--ce-bg-secondary, #3b82f6) 70%,
        var(--ce-bg-primary, #1e40af) 100%);
    background-size: 400% 100%;
    animation: ce-ambientH 22s ease-in-out infinite reverse;
}

.ce-gradient[data-variant="final"] {
    background: linear-gradient(90deg,
        var(--ce-bg-secondary, #2563eb) 0%,
        color-mix(in srgb, var(--ce-bg-secondary, #2563eb), var(--ce-accent, #3b82f6) 50%) 25%,
        var(--ce-accent-glow, #60a5fa) 50%,
        color-mix(in srgb, var(--ce-bg-secondary, #2563eb), var(--ce-accent, #3b82f6) 50%) 75%,
        var(--ce-bg-secondary, #2563eb) 100%);
    background-size: 400% 100%;
    animation: ce-ambientH 25s ease-in-out infinite;
}

@keyframes ce-ambientH {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Glow orbs */
.ce-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    pointer-events: none;
    animation: ce-pulseOrb 4s ease-in-out infinite;
}

.ce-orb[data-color="accent"]  { background: var(--ce-accent, #3b82f6); }
.ce-orb[data-color="glow"]    { background: var(--ce-accent-glow, #0ea5e9); }
.ce-orb[data-color="primary"] { background: var(--ce-bg-secondary, #2563eb); }
.ce-orb[data-color="alt"]     { background: var(--ce-orb-alt, #6366f1); }

.ce-orb[data-parallax="slow"]   { --parallax-strength: 0.02; }
.ce-orb[data-parallax="medium"] { --parallax-strength: 0.04; }
.ce-orb[data-parallax="fast"]   { --parallax-strength: 0.06; }

.ce-orb.ce-delay-1 { animation-delay: 1s; }
.ce-orb.ce-delay-2 { animation-delay: 2s; }
.ce-orb.ce-delay-3 { animation-delay: 3s; }

.ce-orb.ce-float {
    animation: ce-floatGlow 8s ease-in-out infinite, ce-pulseOrb 4s ease-in-out infinite;
}

@keyframes ce-pulseOrb {
    0%, 100% { transform: scale(1); opacity: 0.35; }
    50% { transform: scale(1.15); opacity: 0.5; }
}

@keyframes ce-floatGlow {
    0%, 100% { transform: translateY(0) translateX(0); }
    25% { transform: translateY(-20px) translateX(10px); }
    50% { transform: translateY(-10px) translateX(-15px); }
    75% { transform: translateY(-25px) translateX(5px); }
}

.ce-orb.ce-float-h {
    animation: ce-floatHorizontal 10s ease-in-out infinite, ce-pulseOrb 4s ease-in-out infinite;
}

@keyframes ce-floatHorizontal {
    0%, 100% { transform: translateX(0) translateY(0); }
    25% { transform: translateX(40px) translateY(-8px); }
    50% { transform: translateX(-30px) translateY(5px); }
    75% { transform: translateX(25px) translateY(-5px); }
}

/* Morphing blobs */
.ce-blob {
    position: absolute;
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    filter: blur(60px);
    opacity: 0.25;
    pointer-events: none;
    animation: ce-morphBlob 15s ease-in-out infinite;
}

.ce-blob[data-variant="1"] {
    background: linear-gradient(135deg, var(--ce-accent, #38bdf8), var(--ce-orb-alt, #818cf8));
    animation-delay: 0s;
}

.ce-blob[data-variant="2"] {
    background: linear-gradient(135deg, var(--ce-accent-glow, #22d3ee), var(--ce-accent, #38bdf8));
    animation-delay: -5s;
}

.ce-blob[data-variant="3"] {
    background: linear-gradient(135deg, var(--ce-orb-alt, #818cf8), var(--ce-blob-alt, #c084fc));
    animation-delay: -10s;
}

@keyframes ce-morphBlob {
    0%, 100% {
        border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
        transform: rotate(0deg) scale(1);
    }
    25% {
        border-radius: 70% 30% 50% 50% / 30% 30% 70% 70%;
        transform: rotate(90deg) scale(1.1);
    }
    50% {
        border-radius: 50% 60% 30% 60% / 70% 40% 50% 40%;
        transform: rotate(180deg) scale(0.95);
    }
    75% {
        border-radius: 30% 50% 70% 40% / 50% 60% 30% 60%;
        transform: rotate(270deg) scale(1.05);
    }
}

/* Grain overlay */
.ce-grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Vignette */
.ce-vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.3) 100%);
}

/* Full-bleed background image with Ken Burns */
.ce-bg-image {
    position: absolute;
    inset: -5%;
    width: 110%;
    height: 110%;
    background-size: cover;
    background-position: center;
    opacity: var(--ce-img-opacity, 1);
    mix-blend-mode: var(--ce-img-blend, normal);
    animation: ce-kenBurns 10s ease-in-out infinite alternate;
}

.ce-bg-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0,0,0, var(--ce-img-darken, 0.45));
}

@keyframes ce-kenBurns {
    0%   { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.15) translate(-2%, -1.5%); }
}


/* === TEXT ANIMATIONS === */

/* Fade up */
.ce-fade-up { opacity: 0; }
.ce-chapter.active .ce-fade-up {
    animation: ce-fadeUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.ce-fade-up-d1 { opacity: 0; }
.ce-chapter.active .ce-fade-up-d1 {
    animation: ce-fadeUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.8s forwards;
}

.ce-fade-up-d2 { opacity: 0; }
.ce-chapter.active .ce-fade-up-d2 {
    animation: ce-fadeUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 1.1s forwards;
}

.ce-fade-up-d3 { opacity: 0; }
.ce-chapter.active .ce-fade-up-d3 {
    animation: ce-fadeUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 1.4s forwards;
}

.ce-fade-up-d4 { opacity: 0; }
.ce-chapter.active .ce-fade-up-d4 {
    animation: ce-fadeUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 1.7s forwards;
}

.ce-fade-up-d5 { opacity: 0; }
.ce-chapter.active .ce-fade-up-d5 {
    animation: ce-fadeUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 2.0s forwards;
}

@keyframes ce-fadeUp {
    from { opacity: 0; transform: translateY(25px); filter: blur(4px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* Headline zoom + breathe */
.ce-headline-zoom {
    transform: scale(0.95);
    opacity: 0;
}

.ce-chapter.active .ce-headline-zoom {
    animation: ce-headlineZoom 1s cubic-bezier(0.4, 0, 0.2, 1) forwards,
               ce-breathe 5s ease-in-out 1.2s infinite;
}

@keyframes ce-headlineZoom {
    from { opacity: 0; transform: scale(0.92); filter: blur(6px); }
    to { opacity: 1; transform: scale(1); filter: blur(0); }
}

@keyframes ce-breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.015); }
}

/* Word reveal (JS splits text, applies per-word delay) */
.ce-word {
    display: inline;
    opacity: 0;
}

.ce-chapter.active .ce-word {
    animation: ce-wordReveal 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes ce-wordReveal {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Stagger children */
.ce-stagger > * {
    opacity: 0;
}

.ce-chapter.active .ce-stagger > * {
    animation: ce-fadeUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.ce-chapter.active .ce-stagger > *:nth-child(1) { animation-delay: 0.2s; }
.ce-chapter.active .ce-stagger > *:nth-child(2) { animation-delay: 0.35s; }
.ce-chapter.active .ce-stagger > *:nth-child(3) { animation-delay: 0.5s; }
.ce-chapter.active .ce-stagger > *:nth-child(4) { animation-delay: 0.65s; }
.ce-chapter.active .ce-stagger > *:nth-child(5) { animation-delay: 0.8s; }
.ce-chapter.active .ce-stagger > *:nth-child(6) { animation-delay: 0.95s; }

/* Gradient text (for accent headlines) */
.ce-gradient-text {
    background: linear-gradient(135deg, var(--ce-accent, #38bdf8), var(--ce-accent-glow, #a5f3fc), var(--ce-accent, #7dd3fc), var(--ce-accent, #38bdf8));
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ce-chapter.active .ce-gradient-text {
    animation: ce-headlineZoom 1s cubic-bezier(0.4, 0, 0.2, 1) forwards,
               ce-gradientFlow 8s ease-in-out infinite 1s;
}

@keyframes ce-gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}


/* === TYPOGRAPHY === */

.ce-headline {
    font-size: clamp(2.5rem, 4.5vw, 4rem);
    font-weight: 900;
    color: var(--ce-text, #fff);
    line-height: 1.15;
    margin-bottom: 1.5rem;
}

.ce-subheadline {
    font-size: clamp(2.2rem, 4vw, 3.25rem);
    font-weight: 900;
    line-height: 1.15;
    margin-bottom: 1.5rem;
    color: var(--ce-text, #fff);
}

.ce-text {
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    color: var(--ce-text-dim, rgba(255,255,255,0.8));
    line-height: 1.5;
    max-width: 800px;
    margin: 0 auto;
}

.ce-text + .ce-text { margin-top: 0.25rem; }

.ce-text em {
    color: var(--ce-accent-glow, #7dd3fc);
    font-style: italic;
}

.ce-highlight {
    color: var(--ce-accent, #38bdf8);
    text-shadow: 0 0 30px transparent;
}
.ce-chapter.active .ce-highlight {
    animation: ce-highlightGlow 3s ease-in-out 1.5s infinite alternate;
}
.ce-highlight-bright { color: var(--ce-accent-glow, #7dd3fc); }

@keyframes ce-highlightGlow {
    0%   { text-shadow: 0 0 20px transparent; }
    100% { text-shadow: 0 0 25px var(--ce-accent, #38bdf8); }
}

.ce-hint {
    color: rgba(255,255,255,0.4);
    font-size: 0.875rem;
    margin-top: 2rem;
}

.ce-hint-desktop { display: inline; }
.ce-hint-mobile { display: none; }
.ce-mobile-break { display: none; }
.ce-desktop-break { display: block; }


/* === UI CHROME === */

/* Progress bar */
.ce-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--ce-accent, #3b82f6), var(--ce-accent-glow, #06b6d4), var(--ce-accent, #38bdf8));
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    box-shadow: 0 0 20px color-mix(in srgb, var(--ce-accent, #38bdf8), transparent 50%);
}

/* Chapter dots */
.ce-dots {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 100;
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.75rem 0.5rem;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
}

.ce-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    padding: 0;
}

.ce-dot:hover { background: rgba(255,255,255,0.5); transform: scale(1.2); }
.ce-dot.active {
    background: var(--ce-accent, #38bdf8);
    box-shadow: 0 0 12px color-mix(in srgb, var(--ce-accent, #38bdf8), transparent 40%);
    transform: scale(1.3);
}

/* Navigation arrows */
.ce-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    color: rgba(255,255,255,0.7);
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
}

.ce-arrow:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(-50%) scale(1.08);
    border-color: rgba(255,255,255,0.25);
    color: white;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.ce-arrow-prev { left: 2rem; }
.ce-arrow-next { right: 5rem; }
.ce-arrow.disabled { opacity: 0.15; pointer-events: none; }

/* Chapter counter */
.ce-counter {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.4);
    font-size: 0.875rem;
    letter-spacing: 0.2em;
    z-index: 100;
}

/* Logo */
.ce-logo {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
}

.ce-logo img { height: 32px; width: auto; }

/* Close button */
.ce-close {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 100;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
}

.ce-close:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.25);
    color: white;
    transform: scale(1.05);
}

/* Mobile navigation */
.ce-mobile-nav {
    display: none;
    position: fixed;
    bottom: 1.5rem;
    right: 0.75rem;
    gap: 0.5rem;
    z-index: 100;
}

.ce-mobile-nav button {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50%;
    color: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.ce-mobile-nav button:active {
    background: rgba(255,255,255,0.2);
    transform: scale(0.95);
}

.ce-mobile-nav button.disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* Custom cursor */
.ce-cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    border: 2px solid color-mix(in srgb, var(--ce-accent, #38bdf8), transparent 40%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: width 0.15s ease-out, height 0.15s ease-out, border-color 0.3s ease;
    mix-blend-mode: difference;
}

.ce-cursor-dot {
    position: fixed;
    width: 6px;
    height: 6px;
    background: var(--ce-accent, #38bdf8);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
}

.ce-cursor.hovering {
    width: 36px;
    height: 36px;
    border-color: color-mix(in srgb, var(--ce-cta-bg, #fef08a), transparent 20%);
}

.ce-cursor.clicking {
    width: 16px;
    height: 16px;
}

@media (hover: none), (max-width: 1024px) {
    .ce-cursor, .ce-cursor-dot { display: none; }
    body, a, button { cursor: auto !important; }
}


/* === CTA PATTERNS === */

.ce-cta-glow {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, var(--ce-cta-bg, #fef08a) 0%, color-mix(in srgb, var(--ce-cta-bg, #fef08a), #000 10%) 100%);
    color: var(--ce-cta-text, #1e3a8a);
    padding: 1.25rem 2.5rem;
    border-radius: 9999px;
    font-size: 1.125rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 2.5rem;
    box-shadow: 0 10px 40px color-mix(in srgb, var(--ce-cta-bg, #fef08a), transparent 60%);
    animation: ce-ctaGlow 3s ease-in-out infinite;
}

@keyframes ce-ctaGlow {
    0%, 100% { box-shadow: 0 10px 40px color-mix(in srgb, var(--ce-cta-bg, #fef08a), transparent 60%); }
    50% { box-shadow: 0 15px 60px color-mix(in srgb, var(--ce-cta-bg, #fef08a), transparent 40%); }
}

.ce-cta-glow:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 60px color-mix(in srgb, var(--ce-cta-bg, #fef08a), transparent 40%);
    animation: none;
}

.ce-cta-glow svg { transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.ce-cta-glow:hover svg { transform: translateX(6px); }

/* Dual CTA */
.ce-cta-dual {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2.5rem;
}

.ce-cta-dual .ce-cta-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 2.5rem;
    border-radius: 9999px;
    font-size: 1.125rem;
    font-weight: 600;
    text-decoration: none;
    color: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.4s ease;
}

.ce-cta-dual .ce-cta-secondary:hover {
    border-color: rgba(255,255,255,0.4);
    color: #fff;
    transform: translateY(-2px);
}


/* === PRELOADER === */

.ce-preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--ce-bg-primary, #1e40af);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s;
}

.ce-preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.ce-preloader-logo {
    width: 140px;
    margin-bottom: 2rem;
    opacity: 0;
    animation: ce-preloaderFadeIn 0.6s ease forwards;
}

.ce-preloader-logo img {
    width: 100%;
    height: auto;
}

.ce-preloader-bar {
    width: 160px;
    height: 2px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    overflow: hidden;
    opacity: 0;
    animation: ce-preloaderFadeIn 0.6s ease 0.2s forwards;
}

.ce-preloader-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--ce-accent, #38bdf8), var(--ce-accent-glow, #a5f3fc));
    border-radius: 2px;
    animation: ce-preloaderProgress 1.5s cubic-bezier(0.4, 0, 0.2, 1) 0.4s forwards;
}

.ce-preloader-text {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    opacity: 0;
    animation: ce-preloaderFadeIn 0.6s ease 0.3s forwards;
}

@keyframes ce-preloaderFadeIn {
    to { opacity: 1; }
}

@keyframes ce-preloaderProgress {
    to { width: 100%; }
}


/* === DEMO MODAL === */

.ce-demo-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 2rem;
}

.ce-demo-modal-box {
    background: linear-gradient(135deg, color-mix(in srgb, var(--ce-bg-primary, #1e3a8a), #000 10%), var(--ce-bg-primary, #1e40af));
    border: 1px solid color-mix(in srgb, var(--ce-accent, #38bdf8), transparent 70%);
    max-width: 520px;
    width: 100%;
    padding: 3rem;
    text-align: center;
    position: relative;
    border-radius: 1rem;
}

.ce-demo-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    transition: color 0.3s ease;
}

.ce-demo-modal-close:hover { color: white; }

.ce-demo-modal-label {
    font-size: 0.6rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--ce-accent, #38bdf8);
    margin-bottom: 1.5rem;
}

.ce-demo-modal-title {
    font-size: 1.8rem;
    font-weight: 900;
    color: white;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.ce-demo-modal-title span { color: var(--ce-accent, #38bdf8); }

.ce-demo-modal-text {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    line-height: 1.8;
    margin-bottom: 2rem;
}

.ce-demo-modal-cta {
    display: inline-block;
    background: linear-gradient(135deg, var(--ce-cta-bg, #fef08a) 0%, color-mix(in srgb, var(--ce-cta-bg, #fef08a), #000 10%) 100%);
    color: var(--ce-cta-text, #1e3a8a);
    padding: 1rem 2rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px color-mix(in srgb, var(--ce-cta-bg, #fef08a), transparent 70%);
}

.ce-demo-modal-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px color-mix(in srgb, var(--ce-cta-bg, #fef08a), transparent 50%);
}


/* === RESPONSIVE === */

/* Large desktop */
@media (min-width: 1400px) {
    .ce-text { font-size: 1.6rem; max-width: 900px; }
    .ce-chapter-content { max-width: 1100px; }
}

/* Tablet */
@media (max-width: 1024px) {
    .ce-text { font-size: 1.2rem; }
    .ce-chapter-content { padding-top: 5rem; }
    .ce-arrow { display: none; }
    .ce-counter { display: none; }
    .ce-mobile-nav { display: flex; }

    /* Split layout stacks on tablet */
    .ce-chapter[data-layout="split"] .ce-chapter-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .ce-chapter[data-layout="text-left"] .ce-chapter-content {
        margin-left: auto;
        text-align: center;
    }
}

/* Mobile */
@media (max-width: 768px) {
    html, body {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }

    .ce-chapter {
        overflow: hidden;
        contain: layout style paint;
    }

    .ce-dots { right: 0.75rem; gap: 0.3rem; padding: 0.5rem 0.35rem; }
    .ce-dot { width: 6px; height: 6px; }

    .ce-chapter-content {
        padding: 1.5rem 3rem 1.5rem 1.5rem;
        padding-top: 4rem;
        margin-top: -2vh;
        max-height: calc(100vh - 6rem);
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .ce-chapter-content::-webkit-scrollbar {
        display: none;
    }

    .ce-logo { font-size: 0.9rem; }
    .ce-logo img { height: 28px; }
    .ce-close { width: 40px; height: 40px; }

    .ce-headline { font-size: 2rem; }
    .ce-subheadline { font-size: 1.6rem; }

    .ce-text {
        font-size: 1.05rem;
        line-height: 1.6;
        max-width: calc(100% - 2rem);
        will-change: opacity;
        backface-visibility: hidden;
        transform: translateZ(0);
    }

    .ce-text br {
        display: none;
    }

    .ce-cta-glow { padding: 1rem 2rem; font-size: 1rem; }

    .ce-hint-desktop { display: none; }
    .ce-hint-mobile { display: inline; }
    .ce-mobile-break { display: block; }

    /* GPU-optimized animations */
    .ce-fade-up, .ce-fade-up-d1, .ce-fade-up-d2, .ce-fade-up-d3 {
        will-change: opacity;
        backface-visibility: hidden;
        transform: translateZ(0);
    }
    .ce-word {
        will-change: opacity;
        backface-visibility: hidden;
    }
    .ce-headline-zoom, .ce-gradient-text {
        will-change: opacity;
        backface-visibility: hidden;
        transform: translateZ(0);
    }

    /* Scale down effects for performance */
    .ce-blob { transform: scale(0.5); opacity: 0.15; }
    .ce-orb { transform: scale(0.6); opacity: 0.25; }
}

/* Small phone */
@media (max-width: 480px) {
    .ce-chapter-content {
        padding: 3.5rem 3rem 1rem 1rem;
        margin-top: 0;
        max-width: calc(100% - 2.5rem);
        max-height: calc(100vh - 5rem);
    }

    .ce-headline { font-size: 1.85rem; }
    .ce-subheadline { font-size: 1.5rem; }
    .ce-text { font-size: 1rem; max-width: calc(100% - 1rem); }
    .ce-logo img { height: 24px; }
    .ce-counter { font-size: 0.75rem; }
    .ce-blob { display: none; }

    .ce-chapter[data-layout="stat-moment"] .ce-stat-number {
        font-size: clamp(3rem, 10vw, 6rem);
    }

    .ce-features-grid {
        grid-template-columns: 1fr;
    }
}

/* Very small phone */
@media (max-width: 380px) {
    .ce-chapter-content {
        padding: 3rem 2.5rem 0.75rem 0.75rem;
        max-width: calc(100% - 2rem);
        max-height: calc(100vh - 4.5rem);
    }
    .ce-headline { font-size: 1.65rem; margin-bottom: 1.5rem; }
    .ce-subheadline { font-size: 1.4rem; margin-bottom: 1.5rem; }
    .ce-text { font-size: 0.95rem; }
    .ce-cta-glow { padding: 0.875rem 1.5rem; font-size: 0.95rem; }
    .ce-mobile-nav button { width: 36px; height: 36px; }
    .ce-desktop-break { display: none; }
}
