/*
 * Play2Learn — Homepage-only presentation layer.
 * Loaded ONLY by index.html, after theme.css. Scoped to body.home-page / .home-* / .thought-bubble / .tb-*
 * so nothing here can leak into or collide with any other page's styling.
 */

/* ─── Hero ──────────────────────────────────────────────────────────────── */
/* ─── Hero ──────────────────────────────────────────────────────────────── */
body.home-page .home-hero {
    position: relative;
    padding: var(--space-12) 0 0; /* Flush to section bottom */
    overflow: hidden;
    background: linear-gradient(160deg, #f8f7ff 0%, #f3effc 55%, #efeafa 100%);
}

body.home-page .site-footer {
    margin-top: 0;
}

body.home-page .home-hero-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
    align-items: end; /* Sits creator portrait flush on section bottom */
}

/* Text column (right side in RTL) */
body.home-page .home-hero-text {
    text-align: right;
    padding-bottom: var(--space-12);
}

body.home-page .home-hero-title {
    font-family: var(--font-family-heading);
    font-weight: var(--font-weight-bold);
    font-size: clamp(2.75rem, 5vw, 4rem);
    line-height: 1.15;
    color: var(--color-gray-900);
    margin-bottom: var(--space-6);
}

body.home-page .home-hero-title-accent {
    background: linear-gradient(90deg, var(--color-brand-purple), var(--color-brand-purple-light));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

body.home-page .home-hero-intro {
    font-size: var(--font-size-lg);
    line-height: var(--line-height-relaxed);
    color: var(--color-gray-700);
    max-width: 460px;
    margin-right: 0;
    margin-left: auto;
    margin-bottom: var(--space-8);
}

body.home-page .home-hero-cta {
    font-size: var(--font-size-lg);
    padding: var(--space-4) var(--space-8);
    border-radius: var(--radius-full);
}

body.home-page .home-hero-actions {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
    align-items: center;
}

body.home-page .btn-hero-games {
    background: linear-gradient(135deg, #7c3aed, #6d28d9) !important;
    color: #ffffff !important;
    font-size: var(--font-size-lg);
    font-weight: 700;
    padding: var(--space-4) var(--space-8);
    border-radius: var(--radius-full);
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.35);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, filter 0.25s ease;
}

body.home-page .btn-hero-games:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.5);
    filter: brightness(1.15);
}

body.home-page .btn-hero-articles {
    background: linear-gradient(135deg, #dd6b20, #c05621) !important;
    color: #ffffff !important;
    font-size: var(--font-size-lg);
    font-weight: 700;
    padding: var(--space-4) var(--space-8);
    border-radius: var(--radius-full);
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(221, 107, 32, 0.35);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, filter 0.25s ease;
}

body.home-page .btn-hero-articles:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 25px rgba(221, 107, 32, 0.5);
    filter: brightness(1.15);
}

/* ─── Portrait + bubble stage (left side in RTL) ───────────────────────── */
body.home-page .home-hero-stage {
    position: relative;
    width: 100%;
    max-width: 660px;
    height: 520px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

body.home-page .home-hero-portrait {
    display: block;
    max-height: 408px;
    width: auto;
    object-fit: contain;
    object-position: center bottom;
    filter: drop-shadow(0 20px 35px rgba(88, 28, 135, 0.16));
    position: relative;
    z-index: 5;
    margin-bottom: 0;
}

/* ─── Top Thought Bubbles Carousel above Creator Head ───────────────────── */
body.home-page .thought-carousel-wrapper {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 780px;
    max-width: 96vw;
    height: 185px;
    z-index: 4;
    overflow: hidden;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    direction: ltr;
    /* Edge fade gradient mask */
    mask-image: linear-gradient(to right, transparent 0%, black 12%, black 88%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 12%, black 88%, transparent 100%);
}

body.home-page .thought-carousel-wrapper:active {
    cursor: grabbing;
}

body.home-page .thought-carousel-track {
    display: flex;
    direction: ltr;
    gap: 20px;
    padding: 8px 0;
    width: max-content;
    align-items: center;
}

body.home-page .thought-carousel-track.is-animating {
    animation: marqueeScroll 80s linear infinite;
}

body.home-page .thought-carousel-wrapper:hover .thought-carousel-track {
    animation-play-state: paused;
}

@keyframes marqueeScroll {
    0%   { transform: translateX(-50%); }
    100% { transform: translateX(0); }
}



/* Cloud Cards inside Carousel */
body.home-page .tb-cloud {
    display: flex;
    direction: rtl;
    flex-direction: column;
    width: 210px;
    height: 160px;
    flex-shrink: 0;
    background: #ffffff;
    border-radius: 28px;
    box-shadow: 0 12px 30px rgba(109, 40, 217, 0.16), 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 3.5px solid var(--color-brand-purple-light, #8b5cf6);
    position: relative;
    text-decoration: none;
    color: var(--color-gray-900);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

body.home-page .tb-cloud:hover {
    transform: scale(1.05) translateY(-4px);
    border-color: var(--color-brand-purple, #6d28d9);
    box-shadow: 0 20px 42px rgba(109, 40, 217, 0.28), 0 6px 16px rgba(0, 0, 0, 0.08);
}

/* Top: Edge-to-Edge Image Banner (66% height) */
body.home-page .tb-img-banner {
    width: 100%;
    height: 66%;
    overflow: hidden;
    background: #f1f5f9;
    position: relative;
}

body.home-page .tb-img-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

body.home-page .tb-cloud:hover .tb-img-banner img {
    transform: scale(1.06);
}

/* Badge Pill (anchored to bottom right corner of image banner, expands left on hover) */
body.home-page .tb-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    height: 24px;
    min-width: 24px;
    padding: 0 5px;
    border-radius: 12px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    z-index: 3;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    direction: rtl;
}

body.home-page .tb-badge svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

body.home-page .tb-badge-text {
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease, padding 0.3s ease;
    white-space: nowrap;
}

body.home-page .tb-cloud:hover .tb-badge {
    padding: 0 8px 0 6px;
    box-shadow: 0 4px 10px rgba(109, 40, 217, 0.4);
}

body.home-page .tb-cloud:hover .tb-badge-text {
    max-width: 50px;
    opacity: 1;
    padding-left: 2px;
}

/* Bottom: Content Area (34% height) */
body.home-page .tb-content {
    width: 100%;
    height: 34%;
    background: #ffffff;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    position: relative;
    z-index: 2;
    border-top: 1px solid rgba(139, 92, 246, 0.15);
}

body.home-page .tb-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    text-align: center;
    width: 100%;
}

body.home-page .tb-title {
    font-weight: 800;
    font-size: 0.92rem;
    line-height: 1.15;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

body.home-page .tb-subtitle {
    font-size: 0.74rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
    width: 100%;
}

/* Main Thought Trail with 4 dots in an arcing curve towards creator's face */
body.home-page .thought-trail-main {
    position: absolute;
    top: 160px;
    left: 28%;
    pointer-events: none;
    z-index: 3;
}

body.home-page .thought-trail-main .tb-dot {
    display: block;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(109, 40, 217, 0.2);
    border: 2px solid var(--color-brand-purple-light, #8b5cf6);
    position: absolute;
}

body.home-page .thought-trail-main .tb-dot-1 { width: 20px; height: 20px; top: 0; left: 0; }
body.home-page .thought-trail-main .tb-dot-2 { width: 15px; height: 15px; top: 22px; left: 12px; }
body.home-page .thought-trail-main .tb-dot-3 { width: 11px; height: 11px; top: 40px; left: 26px; }
body.home-page .thought-trail-main .tb-dot-4 { width: 7px;  height: 7px;  top: 56px; left: 42px; }

/* Full-width Walking Zavi Sprite Animation & Link */
body.home-page .zavi-walker-link {
    position: absolute;
    bottom: 2px;
    right: -100px;
    height: 75px;
    z-index: 10;
    cursor: pointer;
    text-decoration: none;
    display: block;
    transition: transform 0.2s ease;
}

body.home-page .zavi-walker-link:hover {
    transform: scale(1.1);
}

body.home-page .zavi-walker {
    height: 75px;
    width: auto;
    display: block;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.2));
}

@media (prefers-reduced-motion: no-preference) {
    body.home-page .zavi-walker-link.walking {
        animation: zaviWalkFullScreen 48s linear forwards;
    }
}

@keyframes zaviWalkFullScreen {
    0% {
        right: -100px;
    }
    100% {
        right: calc(100% + 100px);
    }
}






/* Gentle floating animation per slot */
@media (prefers-reduced-motion: no-preference) {
    body.home-page .tb-slot-0 { animation: home-floatA 6s ease-in-out infinite; }
    body.home-page .tb-slot-1 { animation: home-floatB 7.5s ease-in-out infinite 0.4s; }
    body.home-page .tb-slot-2 { animation: home-floatC 5.2s ease-in-out infinite 0.9s; }
    body.home-page .tb-slot-3 { animation: home-floatA 6.8s ease-in-out infinite 1.3s; }
    body.home-page .tb-slot-4 { animation: home-floatB 7s ease-in-out infinite 0.2s; }

    @keyframes home-floatA {
        0%, 100% { transform: translateY(0) rotate(0deg); }
        50%      { transform: translateY(-10px) rotate(-1.5deg); }
    }
    @keyframes home-floatB {
        0%, 100% { transform: translateY(0) rotate(0deg); }
        50%      { transform: translateY(-14px) rotate(1.5deg); }
    }
    @keyframes home-floatC {
        0%, 100% { transform: translateY(0) rotate(0deg); }
        50%      { transform: translateY(-8px) rotate(-1deg); }
    }
}


/* ─── Doodle accents (restrained, decorative) ──────────────────────────── */
body.home-page .home-hero-doodle {
    position: absolute;
    color: var(--color-brand-purple-light);
    opacity: 0.35;
    z-index: 0;
    pointer-events: none;
}

body.home-page .home-hero-doodle svg { width: 100%; height: 100%; display: block; }

body.home-page .doodle-1 { width: 34px; height: 34px; top: 8%;  right: 4%; }
body.home-page .doodle-2 { width: 26px; height: 26px; top: 46%; right: 46%; }
body.home-page .doodle-3 { width: 30px; height: 30px; bottom: 6%; right: 2%; }

/* ─── Featured games section ────────────────────────────────────────────── */
body.home-page .home-games-section .card-image-wrapper {
    height: 260px;
}

body.home-page .home-games-section .card {
    border-radius: var(--radius-lg);
}

/* ─── Featured articles — editorial layout ─────────────────────────────── */
body.home-page .home-articles-editorial {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    grid-template-rows: auto auto;
    gap: var(--space-6);
}

body.home-page .home-articles-editorial .home-article-featured {
    grid-row: 1 / 3;
}

body.home-page .home-articles-editorial .home-article-featured .card-image-wrapper {
    height: 320px;
}

body.home-page .home-articles-editorial .home-article-small .card-image-wrapper {
    height: 150px;
}

@media (max-width: 1024px) {
    body.home-page .home-articles-editorial {
        grid-template-columns: 1fr;
        grid-template-rows: none;
    }
    body.home-page .home-articles-editorial .home-article-featured {
        grid-row: auto;
    }
}

/* ─── Condensed brand-grid strip (relocated) ───────────────────────────── */
body.home-page .home-brand-grid-condensed .brand-box-content {
    padding: var(--space-4) var(--space-5);
}

body.home-page .home-brand-grid-condensed .brand-box-content p {
    margin-bottom: 0;
    font-size: var(--font-size-sm);
    line-height: var(--line-height-normal);
}

/* ─── About teaser ──────────────────────────────────────────────────────── */
body.home-page .home-about-teaser-inner {
    display: flex;
    align-items: center;
    gap: var(--space-10);
    max-width: 800px;
    margin: 0 auto;
}

body.home-page .home-about-photo {
    width: 140px;
    height: 140px;
    border-radius: var(--radius-full);
    object-fit: cover;
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

body.home-page .home-about-text {
    text-align: right;
}

body.home-page .home-about-text .section-title {
    text-align: right;
    margin-bottom: var(--space-3);
}

body.home-page .home-about-text .section-title::after {
    margin: var(--space-4) 0 0;
}

/* ─── Tablet & Mobile (<= 900px) ─────────────────────────────────────────── */
@media (max-width: 900px) {
    body.home-page .btn-contact {
        padding: 5px 12px;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    body.home-page .home-hero {
        padding: var(--space-4) 0 var(--space-10);
    }

    body.home-page .home-hero-inner {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0;
    }

    /* 1. Stage container at TOP (order 1) */
    body.home-page .home-hero-stage {
        order: 1;
        position: relative;
        width: 100%;
        max-width: 100%;
        height: auto;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* Scrolling Carousel items at the VERY TOP */
    body.home-page .thought-carousel-wrapper {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        transform: none;
        width: 100vw;
        max-width: 100vw;
        height: 175px;
        margin: 0 calc(-50vw + 50%);
        order: 1;
    }

    /* Creator Picture BELOW carousel */
    body.home-page .home-hero-portrait {
        order: 2;
        width: 200px;
        height: 200px;
        max-width: 65vw;
        max-height: 65vw;
        border-radius: 50%;
        object-fit: cover;
        object-position: center top;
        box-shadow: 0 12px 30px rgba(109, 40, 217, 0.2);
        margin: var(--space-4) auto var(--space-2);
    }

    body.home-page .thought-trail-main {
        display: none;
    }

    /* 2. Text BELOW picture (order 2 on inner container) */
    body.home-page .home-hero-text {
        order: 2;
        text-align: center;
        width: 100%;
        padding: 0 var(--space-2);
        margin-top: var(--space-2);
    }

    body.home-page .home-hero-title {
        font-size: clamp(1.85rem, 7vw, 2.5rem);
        margin-bottom: var(--space-3);
    }

    body.home-page .home-hero-intro {
        margin-right: auto;
        margin-left: auto;
        font-size: var(--font-size-base);
        max-width: 100%;
        margin-bottom: var(--space-5);
    }

    body.home-page .home-hero-cta,
    body.home-page .home-hero-actions {
        justify-content: center;
        width: 100%;
    }

    body.home-page .home-hero-doodle {
        display: none;
    }

    body.home-page .home-articles-editorial {
        grid-template-columns: 1fr;
    }

    body.home-page .home-articles-editorial .home-article-featured .card-image-wrapper {
        height: 220px;
    }

    body.home-page .home-about-teaser-inner {
        flex-direction: column;
        text-align: center;
        gap: var(--space-4);
    }

    body.home-page .home-about-text .section-title::after {
        right: 0;
        left: 0;
        margin: 0 auto;
    }
}
