/* ─────────────────────────────────────────────
   Brainrot Cubed — landing page
   Palette mirrors the app (lib/game/constants.dart)
   ───────────────────────────────────────────── */

:root {
    --bg: #1B0F3D;
    --bg-2: #341A66;
    --bg-3: #6E2BA0;
    --card: #2A2150;
    --board: #1A1530;
    --gold: #FFC857;
    --yellow: #FFD23F;
    --lime: #9BE84A;
    --cyan: #46C8FF;
    --pink: #FF5FB0;
    --ink: #1A0D36;
    --text: #ffffff;
    --muted: rgba(255, 255, 255, .72);
    --line: rgba(255, 255, 255, .12);
    --radius: 18px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    scroll-padding-top: 80px;
}

body {
    font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 400;
    color: var(--text);
    /* Fixed attachment keeps one continuous gradient behind the whole page,
       however tall it gets. */
    background: var(--bg-2) linear-gradient(170deg, var(--bg) 0%, var(--bg-2) 48%, var(--bg-3) 100%) fixed;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }

/* Dotted overlay, masked to fade at the edges — lifted from the store art */
.bg-dots {
    position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .16;
    background-image: radial-gradient(rgba(255, 255, 255, .9) 1.4px, transparent 2px);
    background-size: 42px 42px;
    -webkit-mask-image: radial-gradient(130% 90% at 50% 40%, #000 25%, transparent 78%);
    mask-image: radial-gradient(130% 90% at 50% 40%, #000 25%, transparent 78%);
}

main { position: relative; z-index: 1; }

/* Blurred colour blobs */
.glow {
    position: absolute; border-radius: 50%; filter: blur(80px);
    pointer-events: none; z-index: 0;
}
.g1 { width: 420px; height: 420px; left: -140px; top: -120px; background: #B14FFF; opacity: .45; }
.g2 { width: 380px; height: 380px; right: -120px; bottom: -140px; background: #5E3CFF; opacity: .4; }
.g3 { width: 460px; height: 460px; left: 50%; top: -60px; transform: translateX(-50%); background: #9A44D6; opacity: .3; }

/* ── Headings ── */
h1, h2, h3, .logo span, .step-n {
    font-family: 'Luckiest Guy', 'Fredoka', cursive;
    font-weight: 400;
    letter-spacing: .5px;
    line-height: 1.02;
}

h1 {
    font-size: clamp(2.6rem, 10vw, 6.5rem);
    overflow-wrap: break-word;
    transform: skewX(-5deg);
    text-shadow:
        -3px -3px 0 var(--ink), 3px -3px 0 var(--ink),
        -3px 3px 0 var(--ink), 3px 3px 0 var(--ink),
        0 4px 0 var(--ink), 0 14px 24px rgba(0, 0, 0, .6);
    margin-bottom: 1.1rem;
}
h1 .y { color: var(--yellow); }

h2 {
    font-size: clamp(1.9rem, 5.2vw, 3.1rem);
    text-align: center;
    text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink), 0 8px 18px rgba(0, 0, 0, .5);
    margin-bottom: .6rem;
}

/* ── Header ── */
.header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
    height: 64px;
    padding: 0 clamp(1rem, 4vw, 2.5rem);
    padding-top: env(safe-area-inset-top, 0px);
    background: rgba(27, 15, 61, .78);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    transition: box-shadow .25s ease, border-color .25s ease;
    border-bottom: 1px solid transparent;
}
.header.scrolled {
    border-bottom-color: var(--line);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
}

.logo { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.logo img { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; }
.logo span {
    font-size: 1.15rem; white-space: nowrap;
    text-shadow: -1.5px -1.5px 0 var(--ink), 1.5px -1.5px 0 var(--ink), -1.5px 1.5px 0 var(--ink), 1.5px 1.5px 0 var(--ink);
}
.logo em { color: var(--yellow); font-style: normal; }

.btn-top {
    flex-shrink: 0;
    font-weight: 600; font-size: .9rem;
    padding: .55rem 1.25rem;
    border-radius: 999px;
    color: var(--ink);
    background: var(--gold);
    box-shadow: 0 4px 0 #c9922f, 0 8px 18px rgba(0, 0, 0, .35);
    transition: transform .15s ease, box-shadow .15s ease;
}
.btn-top:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #c9922f, 0 12px 22px rgba(0, 0, 0, .4); }
.btn-top:active { transform: translateY(2px); box-shadow: 0 2px 0 #c9922f; }

/* ── Hero ── */
.hero {
    position: relative;
    padding: calc(64px + clamp(2.5rem, 8vw, 6rem)) clamp(1.25rem, 4vw, 3rem) clamp(3rem, 7vw, 6rem);
    overflow: hidden;
}
.hero-inner {
    position: relative; z-index: 2;
    max-width: 1180px; margin: 0 auto;
    display: grid; grid-template-columns: 1.05fr .95fr;
    gap: clamp(1.5rem, 4vw, 3rem); align-items: center;
}

.kicker {
    font-weight: 600; font-size: clamp(.8rem, 1.8vw, 1rem);
    letter-spacing: 4px; text-transform: uppercase;
    color: #E9D6FF; margin-bottom: .7rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .6);
}

.lead {
    font-size: clamp(1rem, 2.1vw, 1.2rem);
    color: var(--muted); max-width: min(34ch, 100%);
    margin-bottom: 1.8rem;
}

.hero-copy { min-width: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: .7rem; margin-bottom: 1.4rem; max-width: 100%; }

.store-btn {
    display: flex; align-items: center; gap: .65rem;
    padding: .7rem 1.2rem;
    min-height: 56px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid var(--line);
    transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.store-btn:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .28);
}
.store-btn svg { width: 26px; height: 26px; flex-shrink: 0; }
.store-btn .t { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.store-btn .t small { font-size: .62rem; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.store-btn .t strong { font-size: .98rem; font-weight: 600; }
.store-btn.web { background: var(--gold); color: var(--ink); border-color: transparent; }
.store-btn.web .t small { color: rgba(26, 13, 54, .75); }
.store-btn.web:hover { background: #ffd472; }

.hero-tags { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; }
.hero-tags li {
    font-size: .82rem; font-weight: 500;
    padding: .3rem .85rem; border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid var(--line);
    color: var(--muted);
}

/* Hero art */
.hero-art {
    position: relative;
    display: grid; place-items: center;
    max-width: 100%;
    /* The floats sit at negative offsets. Clipping them to a box leaves a
       visible edge, so keep them inside the element's own bounds instead
       (see .f1–.f4) and let the layout stay unclipped. */
    padding: clamp(10px, 4vw, 26px);
}
.cube {
    width: min(100%, 460px);
    filter: drop-shadow(0 26px 44px rgba(0, 0, 0, .55));
    animation: bob 6s ease-in-out infinite;
}
.float {
    position: absolute; width: clamp(70px, 12vw, 120px);
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .5));
    animation: bob 5s ease-in-out infinite;
}
.f1 { top: 0; left: 0; transform: rotate(-14deg); animation-delay: -.6s; }
.f2 { bottom: 2%; left: 0; transform: rotate(10deg); animation-delay: -1.8s; }
.f3 { top: 3%; right: 0; transform: rotate(14deg); animation-delay: -3s; }
.f4 { bottom: 0; right: 2%; transform: rotate(-10deg); animation-delay: -4.2s; }

@keyframes bob {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -14px; }
}

/* ── Generic section ── */
.section {
    position: relative;
    max-width: 1140px; margin: 0 auto;
    padding: clamp(3rem, 7vw, 5.5rem) clamp(1.25rem, 4vw, 3rem);
}
.sub {
    text-align: center; color: var(--muted);
    max-width: 56ch; margin: 0 auto clamp(2rem, 4vw, 3rem);
    font-size: clamp(.95rem, 2vw, 1.08rem);
}

.reveal { opacity: 0; transform: translateY(26px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ── Steps ── */
.steps {
    list-style: none;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
}
.steps li {
    position: relative;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2.2rem 1.4rem 1.5rem;
    text-align: center;
}
.step-n {
    position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
    width: 44px; height: 44px; display: grid; place-items: center;
    font-size: 1.4rem; color: var(--ink);
    background: var(--gold); border-radius: 50%;
    box-shadow: 0 4px 0 #c9922f;
}
.steps h3 { font-size: 1.3rem; margin-bottom: .4rem; }
.steps p { color: var(--muted); font-size: .95rem; }

/* ── Characters ── */
.tap-hint {
    display: inline-flex; align-items: center; gap: .3rem;
    color: var(--gold); font-weight: 600; white-space: nowrap;
}
.tap-hint svg { width: 15px; height: 15px; }

.char-grid {
    display: grid;
    /* minmax(0,…) — a plain 1fr floors at the button's min-content width,
       which overflows the row on narrow screens. */
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: clamp(.5rem, 1.4vw, .9rem);
}
.char {
    -webkit-appearance: none; appearance: none;
    min-width: 0;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 16px;
    aspect-ratio: 1;
    padding: 10%;
    cursor: pointer;
    display: grid; place-items: center;
    background: hsl(var(--hue) 55% 55% / .88);
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .22), 0 6px 14px rgba(0, 0, 0, .3);
    transition: transform .18s ease, box-shadow .18s ease;
}
.char img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.char:hover { transform: translateY(-4px) scale(1.04); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .22), 0 12px 22px rgba(0, 0, 0, .42); }
.char:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.char.pop { animation: pop .34s ease; }

@keyframes pop {
    0% { transform: scale(1); }
    45% { transform: scale(1.16) rotate(-4deg); }
    100% { transform: scale(1); }
}

.char-note { text-align: center; color: var(--muted); font-size: .92rem; margin-top: 1.6rem; }

/* ── Features ── */
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.feat {
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.6rem 1.4rem;
    transition: transform .2s ease, border-color .2s ease;
}
.feat:hover { transform: translateY(-4px); border-color: rgba(255, 255, 255, .26); }
.feat .ic { font-size: 1.9rem; line-height: 1; margin-bottom: .7rem; }
.feat h3 { font-size: 1.22rem; margin-bottom: .35rem; }
.feat p { color: var(--muted); font-size: .95rem; }

/* ── Screenshots ── */
.shots { display: flex; justify-content: center; gap: clamp(1rem, 3vw, 2rem); }
.phone {
    width: clamp(180px, 24vw, 260px);
    border-radius: 28px;
    padding: 8px;
    background: #0d0820;
    border: 2px solid rgba(255, 255, 255, .16);
    box-shadow: 0 20px 44px rgba(0, 0, 0, .5);
    transition: transform .25s ease;
}
.phone:hover { transform: translateY(-8px); }
.phone img { border-radius: 20px; }

/* ── Download ── */
.download { text-align: center; overflow: hidden; }
.dl-mascot {
    width: clamp(110px, 18vw, 170px);
    margin: 0 auto 1rem;
    filter: drop-shadow(0 14px 24px rgba(0, 0, 0, .5));
    animation: bob 5s ease-in-out infinite;
}
.dl-grid {
    position: relative; z-index: 2;
    display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem;
}

/* ── Footer ── */
.footer {
    position: relative; z-index: 1;
    border-top: 1px solid var(--line);
    padding: 2rem clamp(1.25rem, 4vw, 3rem);
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: .8rem;
    color: var(--muted); font-size: .88rem;
}
.footer-links { display: flex; gap: 1.4rem; }
.footer-links a { transition: color .2s ease; }
.footer-links a:hover { color: var(--gold); }

/* ─── Responsive ─── */
@media (max-width: 1024px) {
    .hero { padding-bottom: clamp(1.5rem, 5vw, 3rem); }
    .hero-inner { grid-template-columns: 1fr; text-align: center; }
    .hero-copy { display: flex; flex-direction: column; align-items: center; order: 2; }
    .hero-art { order: 1; margin-bottom: .5rem; }
    .lead { max-width: 46ch; }
    .btn-row, .hero-tags { justify-content: center; }
    .cube { width: min(78%, 380px); }
    .char-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .feat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    h1 { transform: none; }
    .steps { grid-template-columns: 1fr; gap: 1.8rem; }
    .char-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .feat-grid { grid-template-columns: 1fr; }
    /* Keep one character per side so the cube stays visually balanced;
       drop the second of each pair to avoid crowding. */
    .f2, .f4 { display: none; }

    /* Edge-to-edge scroll-snap carousel */
    .shots {
        justify-content: flex-start;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding: .5rem clamp(1.25rem, 4vw, 3rem);
        margin: 0 calc(-1 * clamp(1.25rem, 4vw, 3rem));
        scrollbar-width: none;
    }
    .shots::-webkit-scrollbar { display: none; }
    .phone { flex: 0 0 auto; width: 210px; scroll-snap-align: center; }

    .footer { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
    .btn-row { flex-direction: column; width: 100%; max-width: 330px; }
    .store-btn { justify-content: flex-start; width: 100%; }
    .dl-grid { flex-direction: column; align-items: stretch; max-width: 330px; margin: 0 auto; }
    .char-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .logo span { font-size: 1rem; }
    .btn-top { font-size: .82rem; padding: .5rem 1rem; }
    .hero-tags li { font-size: .75rem; }
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .cube, .float, .dl-mascot { animation: none; }
    .reveal { opacity: 1; transform: none; transition: none; }
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── FAQ ── */
.faq { max-width: 760px; margin: 0 auto; display: grid; gap: .75rem; }
.faq details {
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0 1.2rem;
    transition: border-color .2s ease;
}
.faq details[open] { border-color: rgba(255, 255, 255, .24); }
.faq summary {
    cursor: pointer;
    list-style: none;
    padding: 1rem 2rem 1rem 0;
    font-weight: 600;
    font-size: 1.02rem;
    position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: '+';
    position: absolute; right: 0; top: 50%; transform: translateY(-50%);
    font-size: 1.5rem; line-height: 1; color: var(--gold);
    transition: transform .2s ease;
}
.faq details[open] summary::after { content: '−'; }
.faq p { color: var(--muted); padding: 0 0 1.1rem; font-size: .96rem; }
