/* ===================================
   CSS RESET & BASE STYLES
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===================================
   LOADING SCREEN
   =================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #33F7F7 0%, #E0F6FF 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.loaded {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
}

.loading-gif {
    width: 300px;
    height: auto;
    margin: 0 auto 20px;
    display: block;
}

.loading-text {
    font-family: 'Comic Relief', cursive, sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #FF1493;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

:root {
    /* Brand Colors */
    --color-pink: #FF69B4;
    --color-pink-light: #FFB6D9;
    --color-purple: #9B59D6;
    --color-purple-dark: #6B3FA0;
    --color-yellow: #FFD700;
    --color-yellow-light: #FFEB3B;
    --color-green: #7FFF00;
    --color-blue: #00BFFF;
    --color-cyan: #00E5FF;

    /* Neutral Colors */
    --color-white: #FFFFFF;
    --color-black: #000000;
    --color-gray-light: #F5F5F5;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-xxl: 4rem;

    /* Typography */
    --font-family: "Comic Relief", "Comic Sans", system-ui, cursive;
    --font-size-base: 16px;
    --font-size-sm: 14px;
    --font-size-md: 18px;
    --font-size-lg: 20px;
    --font-size-xl: 22px;
    --font-size-xxl: 32px;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--color-black);
    background-color: var(--color-white);
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===================================
   HEADER / TOP SECTION
   =================================== */
.hero-section {
    position: relative;
    min-height: 60vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(180deg, #33F7F7 0%, #E0F6FF 100%);
    padding-top: 20px;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Decorative clouds for wide screens - Left side */
.hero-background::before {
    content: '';
    position: absolute;
    bottom: 15%;
    left: -5%;
    width: 200px;
    height: 80px;
    background: rgb(255, 255, 255);
    border-radius: 50%;
    box-shadow:
        80px 20px 0 30px rgb(255, 255, 255),
        40px -10px 0 20px rgb(255, 255, 255),
        120px 0px 0 25px rgb(255, 255, 255),
        160px -30px 0 35px rgb(255, 255, 255),
        300px -60px 0 85px rgb(255, 255, 255);
    z-index: 0;
    pointer-events: none;
    display: none;
    /* Hidden by default */
}

/* Decorative clouds for wide screens - Right side */
.hero-background::after {
    content: '';
    position: absolute;
    bottom: 20%;
    right: -5%;
    width: 180px;
    height: 70px;
    background: rgb(255, 255, 255);
    border-radius: 50%;
    box-shadow:
        0px 15px 0 25px rgb(255, 255, 255),
        35px -8px 0 18px rgb(255, 255, 255),
        110px 5px 0 22px rgb(255, 255, 255),
        140px 25px 0 30px rgb(255, 255, 255),
        -230px 0px 0 80px rgb(255, 255, 255);
    z-index: 0;
    pointer-events: none;
    display: none;
    /* Hidden by default */
}

/* Show clouds only on wide screens (desktop) */
@media (min-width: 1024px) {

    .hero-background::before,
    .hero-background::after {
        display: block;
    }
}

.bg-rays {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.hero-content {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: var(--spacing-sm) var(--spacing-lg);
    width: 100%;
    max-width: 1200px;
}

.logo {
    width: 80%;
    max-width: 400px;
    animation: bounceIn 1s ease-out;
    margin-bottom: 0;
}

.hero-main {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    width: 100%;
    position: relative;
    margin-top: -50px;
}

.hero-characters {
    width: 90%;
    max-width: 500px;
    animation: slideUp 0.8s ease-out 0.2s both;
}

.social-buttons {
    display: flex;
    flex-direction: row;
    gap: var(--spacing-lg);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.social-btn {
    transition: transform var(--transition-fast);
    display: block;
    flex-shrink: 0;
}

.social-btn:hover {
    transform: scale(1.1);
}

.social-btn img {
    height: 40px;
    width: auto;
    display: block;
    object-fit: contain;
}

/* YouTube button - normal position */
.social-btn-youtube img {
    width: auto;
}

/* TikTok button - no offset on mobile */
.social-btn-tiktok {
    margin-left: 0;
}

/* Instagram button - normal position */
.social-btn-instagram img {
    width: auto;
}

/* ===================================
   ABOUT SECTION
   =================================== */
.about-section {
    position: relative;
    padding: var(--spacing-xl) 0;
    background-color: var(--color-white);
    margin-top: -100px;
    z-index: 2;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 calc(100% - 15vw));
    padding-bottom: 10vw;
}

.about-container {
    position: relative;
    max-width: 800px;
    margin: 8% auto 8%;
}

.about-bg {
    width: 100%;
    height: auto;
}

.about-star {
    position: absolute;
    z-index: 2;
    animation: float 3s ease-in-out infinite;
}

.star-1 {
    top: 5%;
    left: 0;
    width: 60px;
    animation-delay: 0s;
}

.star-2 {
    bottom: 10%;
    left: 4%;
    width: 50px;
    animation-delay: 1s;
}

.star-3 {
    top: -50px;
    right: 47%;
    width: 70px;
    animation-delay: 0.5s;
}

.star-4 {
    bottom: 20%;
    right: 5%;
    width: 55px;
    animation-delay: 1.5s;
}

.star-5 {
    top: 40%;
    left: -5%;
    width: 45px;
    animation-delay: 0.8s;
}

.star-6 {
    bottom: -5%;
    left: 30%;
    width: 65px;
    animation-delay: 2s;
}

.star-7 {
    top: 47%;
    right: -2%;
    width: 40px;
    animation-delay: 1.2s;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

.about-seal {
    display: none;
}

.about-content {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    text-align: center;
    color: #793299;
}

.about-content p {
    font-size: var(--font-size-base);
    margin-bottom: var(--spacing-xs);
    line-height: 1.3;
}

/* ===================================
   CHARACTERS SECTION
   =================================== */
.main-content-wrapper {
    position: relative;
    background: linear-gradient(180deg, #E371FF 0%, #00EFFF 100%);
    margin-top: -20vw;
    padding-top: 25vw;
}

.characters-section {
    position: relative;
    padding: 0 var(--spacing-sm) 80px;
    background: transparent;
}

#characters {
    padding-top: var(--spacing-lg);
    /* Reduced from xl to pull content up */
}

.characters-header {
    text-align: center;
    margin-bottom: -3rem;
    /* Reduced to pull TV up */
    position: relative;
    z-index: 2;
}

.section-title {
    width: 90%;
    max-width: 750px;
    margin: 0 auto;
}

.carousel-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    max-width: 1000px;
    margin: 0 auto;
    padding-bottom: 80px;
}

.carousel-track {
    position: relative;
    width: 100%;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.character-card {
    grid-area: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0.5s;
    z-index: 1;
}

.character-card.active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

.character-image {
    width: 100%;
    max-width: 400px;
}

.character-text {
    max-width: 600px;
    text-align: justify;
    color: #000066;
    padding: 0 var(--spacing-md);
}

.character-text p {
    font-size: 18px;
    line-height: 1.6;
}

.carousel-btn {
    flex-shrink: 0;
    transition: transform var(--transition-fast);
    position: absolute;
    bottom: 10px;
    z-index: 10;
}

.carousel-btn.prev {
    left: calc(50% - 60px);
}

.carousel-btn.next {
    right: calc(50% - 60px);
}

.carousel-btn:hover {
    transform: scale(1.1);
}

.carousel-btn img {
    width: 35px;
    height: auto;
}

.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-lg);
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.indicator.active {
    background-color: var(--color-white);
}

/* ===================================
   VIDEO SECTION
   =================================== */
.videos-section {
    position: relative;
    padding: var(--spacing-xl) var(--spacing-md);
    background-color: #00EFFF;
}

.videos-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.videos-header h2 {
    font-size: var(--font-size-xxl);
    font-weight: bold;
    color: var(--color-white);
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
}

.video-carousel-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    max-width: 1000px;
    margin: 0 auto;
    padding-bottom: 80px;
}

.video-carousel-container .carousel-btn {
    position: absolute;
    bottom: 15px;
    z-index: 10;
    transform: none;
    /* Reset hover scale glitch if needed, or keep hover */
}

.video-carousel-container .carousel-btn.prev {
    left: calc(50% - 60px);
    right: auto;
}

.video-carousel-container .carousel-btn.next {
    right: calc(50% - 60px);
    left: auto;
}

.video-carousel-container .carousel-btn:hover {
    transform: scale(1.1);
}

.tv-frame-wrapper {
    position: relative;
    width: 100%;
    max-width: 700px;
}

.tv-frame-wrapper::after {
    content: "";
    position: absolute;
    bottom: -18%;
    /* Moved down to sit under the feet */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    /* Slightly narrower to match perspective */
    height: 15%;
    background-color: #ff6299;
    border-radius: 50%;
    z-index: 5;
}

.tv-frame-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    pointer-events: none;
    z-index: 10;
    object-fit: contain;
}

.tv-frame-placeholder {
    position: relative;
    padding: 24% 8% 8% 12%;
}

.tv-screen {
    position: relative;
    background-color: var(--color-black);
    overflow: hidden;
}

.video-track {
    position: relative;
    width: 100%;
}

.video-slide {
    display: none;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.video-slide.active {
    display: block;
    opacity: 1;
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 57.25%;
    /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Hide all video controls except play/pause */
.video-container video::-webkit-media-controls-timeline,
.video-container video::-webkit-media-controls-current-time-display,
.video-container video::-webkit-media-controls-time-remaining-display,
.video-container video::-webkit-media-controls-volume-slider,
.video-container video::-webkit-media-controls-mute-button,
.video-container video::-webkit-media-controls-fullscreen-button {
    display: none;
}

/* For Firefox */
.video-container video::-moz-media-controls-timeline,
.video-container video::-moz-media-controls-current-time-display,
.video-container video::-moz-media-controls-time-remaining-display,
.video-container video::-moz-media-controls-volume-slider,
.video-container video::-moz-media-controls-mute-button,
.video-container video::-moz-media-controls-fullscreen-button {
    display: none;
}

.manual-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: 2px solid #fff;
    opacity: 1;
    visibility: visible;
}

.manual-play-btn:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: translate(-50%, -50%) scale(1.1);
}

.manual-play-btn.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.tv-frame-note {
    text-align: center;
    margin-top: var(--spacing-sm);
    color: rgba(255, 255, 255, 0.6);
    font-size: var(--font-size-sm);
    font-style: italic;
}

/* ===================================
   FOOTER
   =================================== */
.footer {
    text-align: center;
    padding: var(--spacing-lg) var(--spacing-md);
    background-color: #ff6299;
    color: var(--color-white);
    font-size: var(--font-size-sm);
    position: relative;
    margin-top: 0;
    /* Removed margin to prevent white gap */
}

.footer::before {
    content: "";
    position: absolute;
    top: -40px;
    left: 0;
    width: 100%;
    height: 41px;
    /* Slight overlap */
    background: radial-gradient(circle at 20px 45px, #ff6299 20px, transparent 21px);
    background-size: 40px 41px;
    background-repeat: repeat-x;
    z-index: 1;
}

.footer p {
    position: relative;
    z-index: 2;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* ===================================
   ANIMATIONS
   =================================== */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

/* Tablet (481px - 768px) */
@media (min-width: 481px) {
    .about-section {
        padding: var(--spacing-xl) var(--spacing-md);
    }

    .characters-section {
        padding: 0 var(--spacing-md) var(--spacing-xl);
    }

    .carousel-btn {
        position: static;
        bottom: auto;
    }

    .carousel-btn.prev,
    .carousel-btn.next {
        left: auto;
        right: auto;
    }

    .character-text p {
        font-size: var(--font-size-base);
    }

    .hero-section {
        align-items: center;
        padding-top: 0;
        min-height: 85vh;
    }

    .hero-content {
        padding: var(--spacing-sm);
        overflow: visible;
    }

    :root {
        --font-size-base: 18px;
        --font-size-xl: 28px;
        --font-size-xxl: 36px;
    }

    .logo {
        max-width: 80%;
    }

    .hero-characters {
        max-width: 60%;
        flex: 1;
        object-fit: contain;
    }

    .hero-main {
        flex-direction: row;
        margin-top: -60px;
        width: 100%;
        justify-content: center;
        gap: var(--spacing-xs);
        align-items: flex-end;
    }

    .social-buttons {
        flex-direction: column;
        gap: 5px;
        align-items: flex-start;
        justify-content: flex-end;
        flex-shrink: 0;
        margin-left: var(--spacing-xs);
        margin-bottom: var(--spacing-md);
    }

    .social-btn-tiktok {
        margin-left: var(--spacing-md);
    }

    .social-btn img {
        height: 40px;
    }

    .about-content {
        top: 60%;
        text-align: center;
        width: 55%;
    }

    .about-content p {
        font-size: var(--font-size-xl);
        margin-bottom: var(--spacing-sm);
        line-height: 1.2;
    }

    .character-image {
        max-width: 500px;
    }

    .carousel-btn img {
        width: 60px;
    }

    .characters-header {
        position: relative;
        top: -120px;
        margin-bottom: -100px;
        z-index: 5;
    }

    .tape-header {
        margin-bottom: 30%;
    }
}

/* Desktop (769px+) */
@media (min-width: 769px) {
    :root {
        --font-size-base: 20px;
        --font-size-xl: 32px;
        --font-size-xxl: 42px;
    }

    .hero-section {
        min-height: 90vh;
    }

    .logo {
        max-width: 600px;
    }

    .hero-characters {
        max-width: 65%;
        flex: 1;
        object-fit: contain;
    }

    .hero-main {
        flex-direction: row;
        margin-top: -120px;
        width: 100%;
        justify-content: center;
        gap: var(--spacing-sm);
        align-items: flex-end;
    }

    .social-buttons {
        flex-direction: column;
        gap: var(--spacing-xs);
        align-items: flex-start;
        justify-content: flex-end;
        flex-shrink: 0;
        margin-left: var(--spacing-sm);
        margin-bottom: var(--spacing-lg);
    }

    .social-btn img {
        height: 50px;
    }

    .about-section {
        margin-top: -150px;
        padding-bottom: 9vw;
    }

    .main-content-wrapper {
        margin-top: -30vw;
        padding-top: 40vw;
    }

    .characters-section {
        margin-top: 0;
        padding-top: 0;
    }

    .characters-header {
        top: -25vw;
        margin-bottom: -31vw;
        position: relative;
        z-index: 5;
        transform: rotate(-2deg);
    }

    .about-seal {
        display: block;
        position: absolute;
        top: 5%;
        right: -7%;
        left: auto;
        width: 256px;
        z-index: 2;
        transform: rotate(15deg);
    }

    .character-image {
        max-width: 600px;
    }

    .carousel-btn img {
        width: 70px;
    }

    .carousel-container {
        padding-bottom: 130px;
    }

    .carousel-container .carousel-btn.prev {
        left: calc(50% - 130px);
    }

    .carousel-container .carousel-btn.next {
        right: calc(50% - 130px);
    }

    .indicator {
        width: 14px;
        height: 14px;
    }

    .video-carousel-container {
        padding-bottom: 130px;
    }

    .video-carousel-container .carousel-btn.prev {
        left: calc(50% - 130px);
    }

    .video-carousel-container .carousel-btn.next {
        right: calc(50% - 130px);
    }

    .tape-header {
        margin-bottom: 8%;
    }
}


/* ===================================
   TAPE PLAYER VIDEO SECTION
   =================================== */
.tape-section {
    position: relative;
    padding: var(--spacing-xxl) var(--spacing-md);
    background-color: transparent;
    text-align: center;
    margin-top: 50px;
}

.tape-header {
    margin-bottom: 30%;
}

.tape-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    /* Aspect ratio preservation could be handled here if needed */
}

/* Layering logic:
   - Reels: z-index 5
   - Tape Body: z-index 10
   - Player Frame: z-index 20
   - Screen (Video): z-index 15 (Between Body and Frame? Or Frame is a border?)
     - User request: "video_tape em cima do video_player... z-index de tal maneira que fique em um plano a baixo"
     - User Request 2: "Reels behind Tape"
     - User Request 3: "Reels show top half" -> Clip?
     
   Let's verify sizing. Usually these images are designed to stack perfectly if width=100%.
*/

.player-main {
    display: block;
    width: 100%;
    height: auto;
    position: relative;
    z-index: 20;
    /* Topmost frame */
    pointer-events: none;
}

.tape-body {
    position: absolute;
    top: -18%;
    /* Moved up from 5% */
    /* Adjustment needed based on image registration */
    left: 14%;
    width: 72%;
    z-index: 10;
    pointer-events: none;
}

.reels-container {
    position: absolute;
    top: -10%;
    /* Moved up from 6% */
    /* Align with tape holes */
    left: 13%;
    width: 74%;
    height: 26%;
    /* Clip bottom half */
    z-index: 11;
    pointer-events: none;
    overflow: hidden;
    /* "apenas a metade superior deles fiquem visiveis" */
}

.reel-box {
    position: absolute;
    width: 18%;
    /* Size of reel relative to tape width */
    top: 15%;
    /* Centers of reels */
}

.reel-box.left {
    left: 21%;
}

.reel-box.right {
    right: 21%;
}

.reel {
    width: 100%;
    height: auto;
    display: block;
    /* Animation state controlled by JS class */
}

.reel.spinning {
    animation: spin 3s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(-360deg);
    }

    /* Rotate counter-clockwise like typical tape feed? Or clockwise? */
}

/* Screen Positioning */
.player-screen {
    position: absolute;
    top: 8.5%;
    /* Adjust based on tape_player.png window */
    left: 6%;
    width: 89%;
    height: 48%;
    background-color: #000;
    z-index: 25;
    /* Needs to be clickeable, so actually on TOP of frame if transparent? */
    /* Or if Frame has a hole, Frame is z-20, Screen is z-15? */
    /* If Screen is z-15, clicks might be blocked by Frame z-20. Frame has pointer-events: none. Ok. */
    /* Let's try z-index: 15 to be 'inside', relying on pointer-events:none on frame. */
    z-index: 15;
}

.video-carousel {
    width: 100%;
    height: 100%;
    position: relative;
}

.tape-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.tape-video.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 30;
}

.tape-video iframe {
    width: 100%;
    height: 100%;
}

/* Controls */
.player-controls {
    position: absolute;
    bottom: 17%;
    left: 23.5%;
    width: 56%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 30;
}

.player-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 26%;
    /* Button size */
    transition: transform 0.1s;
}

.player-btn img {
    width: 100%;
    height: auto;
}

.player-btn:active {
    /* transform: scale(0.95); Removed as per user request to use image swap instead */
    transform: none;
}

/* ===================================
   MOBILE FIXES
   =================================== */
@media (max-width: 480px) {
    .about-content p {
        font-size: 14px;
        text-align: center;
        line-height: 1.4;
    }
}

/* ===================================
   DESKTOP OVERRIDES (Fix Cascade)
   =================================== */
@media (min-width: 769px) {
    .tape-header {
        margin-bottom: 8%;
    }
}