/* =====================================================================
   Pangea Player — v3.1 ("can be prettier" pass): product-demo hero,
   living aurora, bento features, refined loader. Loaded after pangea-v3.css.
   ===================================================================== */

/* Wider stage on the home page */
body.pangea-v3.page-home .page-main {
    max-width: 1160px;
    flex-basis: 1160px;
}

/* Living aurora on the band */
body.pangea-v3::after {
    content: '';
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: var(--pg-band-height);
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(28% 34% at 22% 26%, rgba(56, 189, 248, 0.22), transparent 70%),
        radial-gradient(30% 36% at 78% 40%, rgba(167, 139, 250, 0.26), transparent 70%);
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 70%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, #000 70%, transparent 100%);
    animation: pg-aurora 18s ease-in-out infinite alternate;
}

/* Faint grid behind the hero */
body.pangea-v3.page-home .page-outer::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 640px;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(60% 70% at 50% 30%, #000 0%, transparent 75%);
    mask-image: radial-gradient(60% 70% at 50% 30%, #000 0%, transparent 75%);
}

@keyframes pg-aurora {
    0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.85; }
    50% { transform: translate3d(3%, 2%, 0) scale(1.05); opacity: 1; }
    100% { transform: translate3d(-3%, -1%, 0) scale(1.02); opacity: 0.9; }
}

/* ---------- Hero: copy + live product demo ---------- */
body.pangea-v3 .hero-grid {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    align-items: center;
    gap: 40px;
}

body.pangea-v3.page-home .hero-header {
    padding: 56px 8px 44px;
    text-align: start;
}

body.pangea-v3.page-home .hero-title {
    margin-inline: 0;
    max-width: 14ch;
    font-size: clamp(2.2rem, 4.6vw, 3.7rem);
}

body.pangea-v3.page-home .hero-sub {
    margin-inline: 0;
    max-width: 46ch;
}

body.pangea-v3.page-home .hero-chips {
    justify-content: flex-start;
}

body.pangea-v3 .hero-demo {
    position: relative;
    padding: 18px 10px;
}

body.pangea-v3 .demo-window {
    border-radius: 18px;
    overflow: hidden;
    background: #0b1022;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow:
        0 30px 70px rgba(0, 0, 0, 0.55),
        0 0 80px rgba(99, 102, 241, 0.25);
    transform: perspective(1400px) rotateY(-6deg) rotateX(2deg);
}

body.pangea-v3.ui-ltr .demo-window {
    transform: perspective(1400px) rotateY(6deg) rotateX(2deg);
}

body.pangea-v3 .demo-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    direction: ltr;
}

body.pangea-v3 .demo-dots {
    display: inline-flex;
    gap: 6px;
}

body.pangea-v3 .demo-dots i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff5f57;
}

body.pangea-v3 .demo-dots i:nth-child(2) { background: #febc2e; }
body.pangea-v3 .demo-dots i:nth-child(3) { background: #28c840; }

body.pangea-v3 .demo-url {
    flex: 1;
    font-size: 0.78rem;
    color: #9aa6c8;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    padding: 4px 12px;
}

body.pangea-v3 .demo-screen {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

body.pangea-v3 .demo-scene {
    position: absolute;
    inset: -10%;
    background:
        radial-gradient(35% 45% at 30% 40%, rgba(251, 146, 60, 0.55), transparent 70%),
        radial-gradient(40% 50% at 70% 55%, rgba(56, 189, 248, 0.45), transparent 70%),
        radial-gradient(30% 35% at 55% 20%, rgba(244, 114, 182, 0.35), transparent 70%),
        linear-gradient(160deg, #1b2347 0%, #0c1129 60%, #05070f 100%);
    animation: pg-scene 14s ease-in-out infinite alternate;
}

@keyframes pg-scene {
    from { transform: scale(1) translate3d(0, 0, 0); }
    to { transform: scale(1.12) translate3d(-3%, 2%, 0); }
}

body.pangea-v3 .demo-live {
    position: absolute;
    top: 12px;
    inset-inline-start: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: #e6ecff;
    font-size: 0.75rem;
    font-weight: 600;
}

body.pangea-v3 .demo-live i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #f43f5e;
    animation: pg-pulse 1.6s ease-in-out infinite;
}

@keyframes pg-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.6); }
    50% { box-shadow: 0 0 0 6px rgba(244, 63, 94, 0); }
}

body.pangea-v3 .demo-cue {
    position: absolute;
    inset-inline: 8%;
    bottom: 13%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    transition: opacity 0.35s var(--pg-ease), transform 0.35s var(--pg-ease);
}

body.pangea-v3 .demo-cue.is-swapping {
    opacity: 0;
    transform: translateY(6px);
}

body.pangea-v3 .demo-src {
    direction: ltr;
    font-size: clamp(0.7rem, 1vw, 0.8rem);
    color: rgba(255, 255, 255, 0.75);
    background: rgba(0, 0, 0, 0.35);
    border-radius: 6px;
    padding: 2px 8px;
}

body.pangea-v3 .demo-he {
    direction: rtl;
    font-weight: 700;
    font-size: clamp(0.95rem, 1.6vw, 1.2rem);
    color: #fff;
    background: rgba(0, 0, 0, 0.72);
    border-radius: 8px;
    padding: 5px 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

body.pangea-v3 .demo-progress {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.12);
}

body.pangea-v3 .demo-progress span {
    display: block;
    height: 100%;
    width: 38%;
    background: linear-gradient(90deg, #38bdf8, #818cf8);
    animation: pg-progress 16s linear infinite;
}

@keyframes pg-progress {
    from { width: 8%; }
    to { width: 92%; }
}

body.pangea-v3 .demo-float {
    position: absolute;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--pg-text);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 14px 30px rgba(5, 11, 34, 0.35);
    animation: pg-float 6s ease-in-out infinite;
}

body.pangea-v3 .demo-float svg {
    width: 18px;
    height: 18px;
    padding: 3px;
    border-radius: 6px;
    color: #fff;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    flex: 0 0 auto;
}

body.pangea-v3 .demo-float-1 {
    top: 0;
    inset-inline-end: -8px;
}

body.pangea-v3 .demo-float-2 {
    bottom: 2px;
    inset-inline-start: -14px;
    animation-delay: -3s;
}

body.pangea-v3 .demo-float-2 svg {
    background: var(--pg-gradient);
}

@keyframes pg-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* ---------- Loader card polish ---------- */
body.pangea-v3 .input-box {
    background: linear-gradient(180deg, #fbfcff 0%, #f5f8ff 100%);
    border: 1px solid #e1e8f7;
}

body.pangea-v3 .input-box-upload {
    border: 2px dashed #cdd8f0;
    background: #fbfcff;
}

body.pangea-v3 .input-box-upload:hover,
body.pangea-v3 .drop-zone.dragover,
body.pangea-v3 .drop-zone.drag-over {
    border-color: #818cf8;
    background: #f5f6ff;
}

body.pangea-v3 .input-box-icon {
    border-radius: 16px;
    color: #fff;
    background: var(--pg-gradient);
    box-shadow: 0 10px 22px rgba(79, 70, 229, 0.3);
}

body.pangea-v3 .input-box-icon-upload {
    background: linear-gradient(135deg, #7c3aed, #c026d3);
    box-shadow: 0 10px 22px rgba(124, 58, 237, 0.28);
}

body.pangea-v3 .input-box-label {
    font-weight: 700;
    color: var(--pg-text);
}

/* ---------- Bento features ---------- */
body.pangea-v3 .features.bento {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(150px, auto);
}

body.pangea-v3 .bento .feature-hero {
    grid-column: span 2;
    grid-row: span 2;
    background:
        radial-gradient(80% 60% at 100% 0%, rgba(124, 58, 237, 0.1), transparent 60%),
        radial-gradient(70% 60% at 0% 100%, rgba(37, 99, 235, 0.1), transparent 60%),
        #fff;
    display: flex;
    flex-direction: column;
}

body.pangea-v3 .bento .feature-hero h3 {
    font-size: 1.35rem;
}

/* The 6th card closes the grid as a full-width strip instead of an orphan */
body.pangea-v3 .bento .feature:last-child {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 16px;
    align-items: center;
}

body.pangea-v3 .bento .feature:last-child .feature-icon {
    grid-row: span 2;
    margin-bottom: 0;
}

body.pangea-v3 .bento .feature:last-child h3 {
    align-self: end;
}

body.pangea-v3 .bento .feature:last-child p {
    align-self: start;
}

body.pangea-v3 .polish-demo {
    margin-top: auto;
    padding-top: 18px;
    display: grid;
    gap: 8px;
}

body.pangea-v3 .polish-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.98rem;
    border: 1px solid var(--pg-border);
    background: #fff;
}

body.pangea-v3 .polish-src {
    color: #475069;
    font-weight: 500;
    background: #f6f8fc;
}

body.pangea-v3 .polish-bad span:last-child {
    color: #9a3412;
    text-decoration: line-through;
    text-decoration-color: rgba(220, 38, 38, 0.55);
}

body.pangea-v3 .polish-good {
    border-color: #a7f3d0;
    background: #f0fdf7;
    color: #065f46;
}

body.pangea-v3 .polish-tag {
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    background: #fee2e2;
    color: #991b1b;
}

body.pangea-v3 .polish-good .polish-tag {
    background: #d1fae5;
    color: #065f46;
}

body.pangea-v3 .step {
    transition: transform 0.25s var(--pg-ease), box-shadow 0.25s var(--pg-ease);
}

body.pangea-v3 .step:hover {
    transform: translateY(-3px);
}

/* Section titles: gradient accent bar */
body.pangea-v3 .landing-h2::after {
    content: '';
    display: block;
    width: 56px;
    height: 4px;
    margin: 14px auto 0;
    border-radius: 999px;
    background: var(--pg-gradient);
}

@media (prefers-reduced-motion: reduce) {
    body.pangea-v3::after,
    body.pangea-v3 .demo-scene,
    body.pangea-v3 .demo-float,
    body.pangea-v3 .demo-live i,
    body.pangea-v3 .demo-progress span {
        animation: none;
    }
    body.pangea-v3 .step:hover {
        transform: none;
    }
}

@media (max-width: 1020px) {
    body.pangea-v3 .hero-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    body.pangea-v3.page-home .hero-header {
        text-align: center;
    }
    body.pangea-v3.page-home .hero-title,
    body.pangea-v3.page-home .hero-sub {
        margin-inline: auto;
    }
    body.pangea-v3.page-home .hero-chips {
        justify-content: center;
    }
    body.pangea-v3 .hero-demo {
        max-width: 560px;
        width: 100%;
        margin: 0 auto;
    }
    body.pangea-v3 .demo-window,
    body.pangea-v3.ui-ltr .demo-window {
        transform: none;
    }
    body.pangea-v3.page-home {
        --pg-band-height: 1040px;
    }
    body.pangea-v3 .features.bento {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    body.pangea-v3 .hero-demo {
        display: none;
    }
    body.pangea-v3.page-home {
        --pg-band-height: 600px;
    }
    body.pangea-v3 .features.bento {
        grid-template-columns: 1fr;
    }
    body.pangea-v3 .bento .feature-hero {
        grid-column: auto;
        grid-row: auto;
    }
}
