/* Homepage-only styles. Not shared with /rewind.
   This file is only ever bundled when app/page.tsx imports it, so these
   rules are scoped to this route by Next.js's per-page CSS splitting even
   though some of them target html/body. That's intentional: this page must
   render identically whether or not app/layout.tsx or app/globals.css ever
   apply a reset, background, or font — this file no longer relies on them. */
/* Font is loaded here with a plain CSS @import (must come before any other
   rule) instead of next/font, so this stylesheet — and therefore this page
   — has no dependency on Next.js's font tooling at all. */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;700;800&display=swap');
@import './confetti-pieces.css';

html,
body {
    margin: 0;
    min-height: 100%;
    background: #3b1b70;
}

.home-page,
.home-page *,
.home-page *::before,
.home-page *::after {
    box-sizing: border-box;
}

.home-page {
    min-height: 100svh;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    color: #fff;
    font-family: 'Noto Sans Thai', Tahoma, 'Leelawadee UI', sans-serif;
    background-color: #3b1b70;
    background-image: url('../../images/rewind/pantip-rewind-background.png');
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    border: 2px solid rgba(255, 255, 255, .16);
}

.home-page::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: .22;
    background: repeating-linear-gradient(120deg, transparent 0 36px, rgba(255, 255, 255, .025) 37px 38px);
}

.home-topbar {
    position: relative;
    z-index: 3;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: min(90%, 1320px);
    margin: 26px auto 0;
}

.home-logo {
    display: block;
    width: 118px;
    height: auto;
    object-fit: contain;
}

.home-year-pill {
    border-radius: 999px;
    padding: 11px 21px;
    color: #604695;
    background: #f1e8ff;
    font-size: 16px;
}

.home-hero {
    position: relative;
    z-index: 2;
    min-height: calc(100svh - 100px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px 100px;
}

.home-anniversary {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #ffe500;
    font-size: 16px;
    margin-bottom: 25px;
}

.home-anniversary span:first-child,
.home-anniversary span:last-child {
    color: #ffd800;
    text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff;
    font-size: 34px;
    line-height: 1;
}

.home-title {
    margin: 0;
    max-width: 1200px;
    font-size: clamp(4rem, 10vw, 7.6rem);
    font-weight: 700;
    line-height: .98;
    letter-spacing: -4px;
}

.home-subtitle {
    font-size: clamp(1.3rem, 2.1vw, 1.7rem);
    margin: 38px 0 60px;
    font-weight: 500;
}

.home-action-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.home-consent {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #f2eaff;
    cursor: pointer;
    margin-top: -8px;
}

.home-consent input {
    position: absolute;
    opacity: 0;
}

.home-checkmark {
    width: 15px;
    height: 15px;
    border: 2px solid #eee7ff;
    border-radius: 2px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.home-consent input:checked+.home-checkmark {
    background: #ffcf2f;
    border-color: #ffcf2f;
    box-shadow: inset 0 0 0 3px #ffcf2f;
}

.home-consent input:checked+.home-checkmark::after {
    content: '✓';
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.home-button {
    min-width: 295px;
    border: 4px solid rgba(225, 205, 250, .35);
    border-radius: 999px;
    padding: 8px 25px;
    margin-top: 8px;
    color: #7e71a5;
    background: #f1e5ff;
    box-shadow: 0 0 0 4px rgba(233, 215, 255, .46), 0 7px 0 rgba(33, 13, 78, .15);
    font-size: 20px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: transform .2s, filter .2s, color .2s, background .2s;
}

.home-button:not(:disabled) {
    color: #24134f;
    background: #ffcb2f;
    border-color: rgba(255, 207, 47, .28);
    animation: home-ripple 1.5s linear infinite;
}

.home-button:not(:disabled):hover {
    transform: translateY(-3px) scale(1.02);
    filter: brightness(1.05);
}

@keyframes home-ripple {
    0% {
        box-shadow: 0 0 0 4px rgba(255, 207, 47, .28), 0 7px 0 rgba(63, 32, 93, .45), 0 0 0 0 rgba(255, 207, 47, .5);
    }

    100% {
        box-shadow: 0 0 0 4px rgba(255, 207, 47, .28), 0 7px 0 rgba(63, 32, 93, .45), 0 0 0 22px rgba(255, 207, 47, 0);
    }
}

.home-button:disabled {
    opacity: .82;
    cursor: not-allowed;
}

.home-arrow {
    font-size: 32px;
    margin-left: 14px;
    vertical-align: -2px;
}

/* Ambient confetti: every piece's left/delay/duration/size comes from the
   nth-child rules in confetti-pieces.css, no per-element inline styles. */
.home-confetti {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.home-confetti-piece {
    position: absolute;
    top: -30px;
    border-radius: 2px;
    animation: home-fall linear infinite;
}

.home-confetti-pink {
    background: #e85f9b;
}

.home-confetti-yellow {
    background: #f4c537;
}

.home-confetti-blue {
    background: #57c8e8;
}

.home-confetti-green {
    background: #66d890;
}

.home-confetti-lavender {
    background: #aa8ce9;
}

.home-confetti-white {
    background: #f4f0fa;
}

@keyframes home-fall {
    0% {
        transform: translate3d(0, -30px, 0) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    100% {
        transform: translate3d(80px, 110vh, 0) rotate(720deg);
        opacity: .9;
    }
}

/* Burst confetti: --burst-x/--burst-y/--force are the only dynamic values
   (click position + press strength), set once on the container. Every
   piece's own delay/duration/spread/rotation comes from its nth-child rule
   in confetti-pieces.css and is scaled from there with calc(). */
.home-confetti-burst {
    position: fixed;
    inset: 0;
    z-index: 20;
    pointer-events: none;
    overflow: hidden;
}

.home-confetti-burst-piece {
    position: absolute;
    left: var(--burst-x);
    top: var(--burst-y);
    width: var(--size);
    height: var(--size);
    margin: -6px 0 0 -6px;
    border-radius: 2px;
    opacity: 0;
    animation-name: home-burst-out;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
    animation-delay: var(--delay);
    animation-duration: calc(var(--dur-base) * (0.8 + var(--force) * 0.35));
}

.home-confetti-burst-piece.home-confetti-round {
    border-radius: 50%;
}

@keyframes home-burst-out {
    0% {
        transform: translate3d(0, 0, 0) rotate(var(--rot));
        opacity: 1;
        animation-timing-function: cubic-bezier(.12, .72, .3, 1);
    }

    38% {
        transform: translate3d(calc(var(--dx-mid-base) * (0.7 + var(--force) * 0.5)), calc(var(--rise-base) * -1 * var(--force)), 0) rotate(calc(var(--rot) + 260deg));
        opacity: 1;
        animation-timing-function: cubic-bezier(.55, 0, .85, .4);
    }

    85% {
        transform: translate3d(calc(var(--dx-end-base) * (0.7 + var(--force) * 0.5)), calc(var(--fall-base) * (0.75 + var(--force) * 0.35)), 0) rotate(calc(var(--rot) + 560deg));
        opacity: 1;
    }

    100% {
        transform: translate3d(calc(var(--dx-end-base) * (0.7 + var(--force) * 0.5)), calc(var(--fall-base) * (0.75 + var(--force) * 0.35) + 60px), 0) rotate(calc(var(--rot) + 620deg));
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-confetti-burst {
        display: none;
    }
}

@media (min-width: 601px) and (max-width: 1024px) {
    .home-topbar {
        width: 88%;
    }

    .home-hero {
        padding: 50px 24px 90px;
    }

    .home-title {
        max-width: 760px;
        font-size: clamp(3.6rem, 9vw, 5.6rem);
        letter-spacing: -3px;
    }

    .home-subtitle {
        font-size: clamp(1.2rem, 2.6vw, 1.5rem);
        margin: 34px 0 52px;
    }

    .home-button {
        min-width: 320px;
        font-size: 19px;
    }
}

@media (max-width: 600px) {
    .home-page {
        min-height: 100svh;
    }

    .home-topbar {
        margin-top: 26px;
        width: 84%;
    }

    .home-hero {
        min-height: calc(100svh - 90px);
        justify-content: flex-start;
        padding-top: 125px;
    }

    .home-title {
        max-width: 360px;
        font-size: clamp(3.2rem, 12vw, 4.6rem);
        letter-spacing: -2px;
        line-height: 1.05;
    }

    .home-subtitle {
        font-size: 18px;
        margin: 40px 0 64px;
    }

    .home-consent {
        font-size: 12px;
    }

    .home-button {
        min-width: 0;
        width: 100%;
        max-width: 300px;
        font-size: 18px;
    }
}

@media (max-width: 380px) {
    .home-topbar {
        width: 92%;
    }

    .home-hero {
        padding: 50px 16px 90px;
        padding-top: 105px;
    }

    .home-title {
        max-width: 290px;
        font-size: clamp(2.5rem, 10vw, 3.5rem);
        letter-spacing: -1.5px;
    }

    .home-subtitle {
        font-size: 14.5px;
        margin: 28px 0 40px;
    }

    .home-consent {
        font-size: 10.5px;
        gap: 8px;
    }

    .home-button {
        max-width: 268px;
        padding: 13px 16px;
        font-size: 15.5px;
        border-width: 5px;
    }

    .home-arrow {
        font-size: 24px;
        margin-left: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-confetti-piece {
        animation: none;
        top: 30%;
        opacity: .7;
    }

    .home-button {
        transition: none;
    }

    .home-button:not(:disabled) {
        animation: none;
    }
}