/* ================================================================
   BRA Camisetas — Carnaval (Slides 3-4-5)
   Mobile-first · CSS Custom Properties · Responsive Breakpoints
   ================================================================ */

/* ─── Design Tokens ─── */
:root {
    /* Colors */
    --color-primary: #0081cc;
    --color-text: #000000;
    --color-bg: #ffffff;
    --color-dot-inactive: #808080;
    --color-dot-active: #000000;
    --color-dot-disabled: #808080;
    --color-dot-completed: #808080;
    --color-btn-back-bg: #f0f0f0;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;

    /* Safe-areas */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    /* Layout */
    --header-height: 3.5rem;
    --pagination-offset: 1rem;
    --footer-height: 4.5rem;
    --gutter: clamp(1rem, 5vw, 2.5rem);

    /* Slide count — 3 slides neste HTML */
    --slide-count: 3;

    /* Typography */
    --font-family: 'Arial', 'Helvetica Neue', sans-serif;
    --fs-title: clamp(1.15rem, 4.5vw, 1.75rem);
    --fs-subtitle: clamp(0.85rem, 3.2vw, 1.15rem);
    --fs-skip: clamp(0.85rem, 3vw, 1.1rem);

    /* Transitions */
    --ease-slide: cubic-bezier(0.25, 0.8, 0.25, 1);
    --duration-slide: 0.35s;
    --duration-fast: 0.2s;

    /* Tuning */
    --illustration-gap: 2vh;
}

/* ─── Reset ─── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* ─── Base ─── */
html {
    height: 100%;
    height: 100dvh;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    position: fixed;
    inset: 0;
    line-height: 1.4;
}

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

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

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

/* ─── Slider Architecture ─── */
#app-slider {
    display: flex;
    width: calc(100vw * var(--slide-count));
    height: 100%;
    height: 100dvh;
    transition: transform var(--duration-slide) var(--ease-slide);
    transform: translateX(0);
    position: relative;
    z-index: 10;
}

.slide {
    width: 100vw;
    height: 100%;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* ─── App Container ─── */
.app-container {
    width: 100%;
    height: 100%;
    padding-top: calc(var(--header-height) + var(--pagination-offset) + var(--safe-top) + 3.5rem);
    padding-bottom: calc(var(--footer-height) + var(--safe-bottom) + 1.5rem);
    padding-inline: var(--gutter);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    gap: 0;
}

/* ─── Header ─── */
.header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: calc(0.625rem + var(--safe-top)) var(--gutter) 0;
    z-index: 50;
    height: var(--header-height);
}

.logo {
    width: clamp(7rem, 35vw, 11.25rem);
    height: auto;
    max-height: calc(var(--header-height) - 0.5rem);
    object-fit: contain;
}

.skip-link,
.home-icon-btn {
    position: absolute;
    right: var(--gutter);
    top: 50%;
    transform: translateY(-50%);
}

.skip-link {
    color: var(--color-primary);
    text-decoration: none;
    font-size: var(--fs-skip);
    font-weight: 500;
    padding: var(--space-xs) var(--space-sm);
    border-radius: 0.375rem;
    transition: opacity var(--duration-fast);
}

.home-icon-btn {
    padding: var(--space-xs);
    border-radius: 0.375rem;
}

.home-icon {
    width: auto;
    height: clamp(1.5rem, 5vmin, 2.25rem);
}

/* ─── Pagination — CSS Dots ─── */
.pagination {
    position: absolute;
    top: calc(var(--header-height) + var(--safe-top) + var(--pagination-offset));
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
}

.dots {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.dot {
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
    border: none;
    padding: 0;
    background-color: var(--color-dot-inactive);
    transition: background-color var(--duration-fast), transform var(--duration-fast);
    cursor: pointer;
    position: relative;
}

.dot::before {
    content: '';
    position: absolute;
    inset: -0.875rem;
}

.dot--active {
    background-color: var(--color-dot-active);
    transform: scale(1.25);
}

.dot--completed {
    background-color: var(--color-dot-completed);
}

.dot--disabled {
    background-color: var(--color-dot-disabled);
    cursor: default;
}

/* ─── Typography ─── */
.main-title {
    font-size: var(--fs-title);
    text-align: center;
    line-height: 1.25;
    width: 100%;
    flex-shrink: 0;
    z-index: 10;
    font-weight: 700;
}

.sub-title {
    font-size: var(--fs-subtitle);
    text-align: center;
    font-weight: 400;
    flex-shrink: 0;
    z-index: 10;
    line-height: 1.35;
    max-width: 90%;
}

/* ─── Illustration Container ─── */
.illustration-container {
    width: 100%;
    margin-top: var(--illustration-gap);
    flex: 1;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* ─── Parallax Scene ─── */
.parallax-scene {
    position: relative;
    overflow: hidden;
    aspect-ratio: 750.74 / 718.38;
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    flex: 0 1 auto;
    align-self: center;
}

.parallax-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    will-change: transform;
    transform: translate3d(0, 0, 0);
    transition: transform 0.12s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.parallax-scene.swiping .parallax-layer {
    transition: none;
}

.parallax-layer:first-child {
    position: relative;
}

/* ─── Parallax Rocket ─── */
.parallax-rocket {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    pointer-events: none;
    z-index: 10;
}

.parallax-layer--top {
    z-index: 20;
}

/* ─── Footer ─── */
.footer {
    position: absolute;
    bottom: calc(0.9375rem + var(--safe-bottom));
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-inline: var(--gutter);
    z-index: 20;
    min-height: var(--footer-height);
}

.footer.footer-center {
    justify-content: center;
}

.actions-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* ─── Buttons ─── */
.back-button {
    background-color: var(--color-btn-back-bg);
    border-radius: 0.75rem;
    color: var(--color-primary);
    padding: clamp(0.5rem, 2.5vmin, 0.875rem) clamp(1rem, 4vmin, 1.75rem);
    font-size: clamp(0.85rem, 3vmin, 1.1rem);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--duration-fast), transform var(--duration-fast);
    min-height: 2.75rem;
}

.next-button {
    transition: opacity var(--duration-fast) ease, transform var(--duration-fast) ease;
    padding: var(--space-xs);
    min-height: 2.75rem;
    min-width: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.next-button img {
    height: clamp(2.5rem, 9vmin, 3.75rem);
    width: auto;
}

.iniciar-btn-img {
    height: auto;
    width: 100%;
    max-width: 25rem;
    max-height: clamp(3rem, 10vmin, 5rem);
    object-fit: contain;
}

.back-button:active,
.next-button:active {
    opacity: 0.7;
    transform: scale(0.96);
}

/* ─── Hidden ─── */
[hidden] {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ================================================================
   RESPONSIVE BREAKPOINTS
   ================================================================ */

@media (max-width: 374px) {
    :root {
        --header-height: 3rem;
        --fs-title: clamp(1rem, 5vw, 1.25rem);
        --fs-subtitle: clamp(0.75rem, 3.5vw, 0.95rem);
        --illustration-gap: 1vh;
    }

    .app-container {
        padding-top: calc(var(--header-height) + var(--pagination-offset) + var(--safe-top) + 2.5rem);
        padding-bottom: calc(var(--footer-height) + var(--safe-bottom) + 1rem);
    }

    .logo {
        width: clamp(5.5rem, 30vw, 8rem);
    }
}

@media (min-width: 375px) and (max-width: 479px) {
    :root {
        --illustration-gap: 2vh;
    }
}

@media (min-width: 480px) {
    :root {
        --fs-title: clamp(1.25rem, 3.5vw, 1.75rem);
        --fs-subtitle: clamp(0.9rem, 2.5vw, 1.15rem);
        --illustration-gap: 2.5vh;
    }
}

@media (min-width: 768px) {
    :root {
        --header-height: 4rem;
        --footer-height: 5rem;
        --fs-title: clamp(1.5rem, 3vw, 2rem);
        --fs-subtitle: clamp(1rem, 2vw, 1.35rem);
        --illustration-gap: 3vh;
    }

    .app-container {
        max-width: 40rem;
        margin-inline: auto;
    }

    .logo {
        width: clamp(8rem, 15vw, 11rem);
    }
}

@media (min-width: 1024px) {
    :root {
        --fs-title: clamp(1.5rem, 2.5vw, 2.25rem);
        --fs-subtitle: clamp(1rem, 1.5vw, 1.25rem);
    }

    .app-container {
        max-width: 36rem;
    }
}

@media (min-width: 1440px) {
    .app-container {
        max-width: 32rem;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    :root {
        --header-height: 2.5rem;
        --footer-height: 3.5rem;
        --pagination-offset: 0.5rem;
        --fs-title: clamp(0.9rem, 3vh, 1.25rem);
        --fs-subtitle: clamp(0.75rem, 2.5vh, 1rem);
        --illustration-gap: 1vh;
    }

    .app-container {
        padding-top: calc(var(--header-height) + var(--pagination-offset) + var(--safe-top) + 2rem);
        padding-bottom: calc(var(--footer-height) + var(--safe-bottom) + 0.5rem);
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: var(--space-sm);
    }

    .main-title {
        width: 100%;
        flex-basis: 100%;
    }

    .illustration-container {
        flex: 1;
        max-width: 50%;
        margin-top: 0;
    }

    .sub-title {
        flex: 1;
        max-width: 45%;
        text-align: left;
    }

    .logo {
        max-height: 2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    #app-slider {
        transition-duration: 0.01ms;
    }

    .back-button,
    .next-button,
    .skip-link {
        transition: none;
    }
}

@media (forced-colors: active) {
    .back-button {
        border: 1px solid ButtonText;
    }

    .next-button img,
    .logo {
        forced-color-adjust: none;
    }
}
