/* ============================================
   PERCOLATE LANDING PAGE
   Deep Navy Glassmorphism Theme
   ============================================ */

/* CSS Custom Properties */
:root {
    --bg-primary: #0a1628;
    --bg-secondary: #132442;
    --text-main: rgba(255, 255, 255, 0.95);
    --text-muted: rgba(255, 255, 255, 0.6);
    --accent: #00A8FF;
    --accent-hover: #33bbff;
    --accent-glow: rgba(0, 168, 255, 0.4);

    /* Game colors for animations */
    --game-red: #FF4757;
    --game-green: #2ED573;
    --game-blue: #1E90FF;
    --game-yellow: #FFD93D;
    --game-purple: #9B59B6;
    --game-orange: #FF9F43;

    /* Glassmorphism */
    --glass-bg: rgba(20, 30, 48, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);

    /* Layout */
    --max-width: 1200px;
    --section-padding: 100px 24px;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    background-image: radial-gradient(circle at 50% 0%, var(--bg-secondary) 0%, var(--bg-primary) 70%);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   ANIMATED BACKGROUND
   ============================================ */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.hex-grid {
    position: absolute;
    width: 100%;
    height: 100%;
}

.hex {
    position: absolute;
    width: 80px;
    height: 92px;
    background: var(--game-blue);
    opacity: 0.08;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    animation: float 20s ease-in-out infinite;
}

.hex-1 {
    left: 5%;
    top: 10%;
    background: var(--game-red);
    animation-delay: 0s;
    width: 60px;
    height: 69px;
}

.hex-2 {
    left: 85%;
    top: 15%;
    background: var(--game-green);
    animation-delay: -3s;
    width: 100px;
    height: 115px;
}

.hex-3 {
    left: 20%;
    top: 60%;
    background: var(--game-yellow);
    animation-delay: -6s;
    width: 70px;
    height: 81px;
}

.hex-4 {
    left: 70%;
    top: 45%;
    background: var(--game-purple);
    animation-delay: -9s;
    width: 90px;
    height: 104px;
}

.hex-5 {
    left: 45%;
    top: 80%;
    background: var(--game-orange);
    animation-delay: -12s;
    width: 50px;
    height: 58px;
}

.hex-6 {
    left: 90%;
    top: 70%;
    background: var(--game-blue);
    animation-delay: -15s;
    width: 65px;
    height: 75px;
}

.hex-7 {
    left: 10%;
    top: 85%;
    background: var(--game-red);
    animation-delay: -2s;
    width: 55px;
    height: 63px;
}

.hex-8 {
    left: 60%;
    top: 5%;
    background: var(--game-green);
    animation-delay: -8s;
    width: 75px;
    height: 87px;
}

.hex-9 {
    left: 30%;
    top: 30%;
    background: var(--game-purple);
    animation-delay: -11s;
    width: 45px;
    height: 52px;
}

.hex-10 {
    left: 75%;
    top: 85%;
    background: var(--game-yellow);
    animation-delay: -4s;
    width: 85px;
    height: 98px;
}

.hex-11 {
    left: 50%;
    top: 50%;
    background: var(--game-orange);
    animation-delay: -7s;
    width: 40px;
    height: 46px;
}

.hex-12 {
    left: 15%;
    top: 40%;
    background: var(--game-blue);
    animation-delay: -14s;
    width: 95px;
    height: 110px;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.06;
    }

    25% {
        transform: translateY(-30px) rotate(5deg);
        opacity: 0.12;
    }

    50% {
        transform: translateY(-15px) rotate(-3deg);
        opacity: 0.08;
    }

    75% {
        transform: translateY(-40px) rotate(8deg);
        opacity: 0.1;
    }
}

/* ============================================
   NAVIGATION
   ============================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    background: rgba(10, 22, 40, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo-icon {
    font-size: 1.8rem;
}

.logo-icon-img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

.logo-icon-img-small {
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.logo-text {
    background: linear-gradient(135deg, var(--accent) 0%, #00d4ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--text-main);
}

.btn-play {
    background: var(--accent) !important;
    color: white !important;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600 !important;
    transition: all 0.2s !important;
}

.btn-play:hover {
    background: var(--accent-hover) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 60px;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 120px 24px 60px;
    position: relative;
    z-index: 1;
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
}

.title-line {
    display: block;
    color: var(--text-main);
}

.title-gradient {
    display: block;
    background: linear-gradient(90deg,
            var(--game-red) 0%,
            var(--game-orange) 20%,
            var(--game-yellow) 40%,
            var(--game-green) 60%,
            var(--game-blue) 80%,
            var(--game-purple) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 5s ease infinite;
}

@keyframes gradient-shift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 480px;
    line-height: 1.7;
}

.hero-cta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 28px;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #0090e0 100%);
    color: white;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-ghost {
    background: transparent;
    color: var(--accent);
    padding: 8px 16px;
}

.btn-ghost:hover {
    color: var(--accent-hover);
}

.btn-icon {
    font-size: 0.9rem;
}

/* Hero Store Buttons */
.store-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    border-radius: 14px;
    text-decoration: none;
    color: white;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.apple-btn {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-color: rgba(255, 255, 255, 0.15);
}

.google-btn {
    background: linear-gradient(135deg, #0a1628 0%, #1a2a4a 100%);
    border-color: rgba(255, 255, 255, 0.15);
}

.store-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.25);
}

.store-icon {
    width: 28px;
    height: 28px;
}

.store-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.store-label {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.store-name {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Hero Stats */
.hero-stats {
    display: flex;
    gap: 40px;
    margin-top: 20px;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Hero Visual - Phone Mockup */
.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.phone-mockup {
    width: 280px;
    height: 560px;
    background: #1a1a2e;
    border-radius: 40px;
    padding: 12px;
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.1),
        0 25px 60px rgba(0, 0, 0, 0.5),
        0 0 100px var(--accent-glow);
    position: relative;
    animation: phone-float 6s ease-in-out infinite;
}

@keyframes phone-float {

    0%,
    100% {
        transform: translateY(0px) rotate(2deg);
    }

    50% {
        transform: translateY(-20px) rotate(-1deg);
    }
}

.phone-screen {
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    border-radius: 28px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Hexagonal Demo Grid in Phone */
.hex-demo-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 20px;
}

.hex-row {
    display: flex;
    gap: 2px;
    margin-top: -10px;
    /* Overlap rows for proper hex interlocking */
}

.hex-row:first-child {
    margin-top: 0;
}

.hex-row.odd {
    margin-left: 20px;
    /* Half hex width for offset */
}

.hex-cell {
    width: 36px;
    height: 40px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    position: relative;
    transition: background-color 0.2s ease;
}

/* Base colors for non-flooding cells - use game colors */
.hex-cell[data-color="2"] {
    background: var(--game-green);
}

.hex-cell[data-color="3"] {
    background: var(--game-blue);
}

.hex-cell[data-color="4"] {
    background: var(--game-yellow);
}

.hex-cell[data-color="5"] {
    background: var(--game-purple);
}

.hex-cell[data-color="6"] {
    background: var(--game-orange);
}

/* 3D effect shadow layer */
.hex-cell::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: inherit;
    filter: brightness(0.7);
    z-index: -1;
    transform: scale(1.08);
}

/* Glossy highlight */
.hex-cell::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 8px;
    width: 12px;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: rotate(-20deg);
}

/* ============================================
   SCRIPTED ANIMATION STATES
   ============================================ */

/* Base transitions */
.hex-cell {
    /* Existing properties are fine, just ensuring transition is set */
    transition: background-color 0.4s ease, transform 0.3s ease;
}

/* Color States */
.bg-red {
    background: var(--game-red);
}

.bg-green {
    background: var(--game-green);
}

.bg-blue {
    background: var(--game-blue);
}

.bg-yellow {
    background: var(--game-yellow);
}

.bg-purple {
    background: var(--game-purple);
}

.bg-orange {
    background: var(--game-orange);
}

/* Pop Animation for when a cell changes color */
.pop {
    animation: pop-effect 0.4s ease-out forwards;
}

@keyframes pop-effect {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    50% {
        transform: scale(1.15);
        filter: brightness(1.2);
    }

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

/* ============================================
   CONFETTI ANIMATION
   ============================================ */
.confetti-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 10;
}

.confetti {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--game-yellow);
    top: -10px;
    opacity: 0;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(500px) rotate(720deg);
        opacity: 0;
    }
}


/* ============================================
   FEATURES SECTION
   ============================================ */
.features {
    padding: var(--section-padding);
    max-width: var(--max-width);
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.section-header p {
    font-size: 1.125rem;
    color: var(--text-muted);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.feature-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 32px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.feature-card:hover {
    transform: translateY(-8px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    display: block;
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.feature-card p {
    color: var(--text-muted);
    line-height: 1.7;
}

/* ============================================
   HOW TO PLAY SECTION
   ============================================ */
.how-to-play {
    padding: var(--section-padding);
    background: linear-gradient(180deg, transparent 0%, rgba(0, 168, 255, 0.03) 50%, transparent 100%);
    position: relative;
    z-index: 1;
}

.steps-container {
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.step {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.step-number {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent) 0%, #0090e0 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    box-shadow: 0 8px 20px var(--accent-glow);
}

.step-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.step-content p {
    color: var(--text-muted);
    line-height: 1.7;
}

/* ============================================
   DOWNLOAD SECTION
   ============================================ */
.download {
    padding: var(--section-padding);
    position: relative;
    z-index: 1;
}

.download-content {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.download-content h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.download-content>p {
    font-size: 1.125rem;
    color: var(--text-muted);
    margin-bottom: 40px;
}

.store-badges {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.store-badge {
    display: flex;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 12px 24px;
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.store-badge:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.badge-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.apple-icon,
.play-icon {
    width: 28px;
    height: 28px;
}

.badge-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.badge-small {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-large {
    font-size: 1.1rem;
    font-weight: 600;
}

.web-play {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    padding: 40px 24px;
    border-top: 1px solid var(--glass-border);
    position: relative;
    z-index: 1;
}

.footer-content {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 600;
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--text-main);
}

.copyright {
    color: var(--text-muted);
    font-size: 0.85rem;
    opacity: 0.7;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        padding-top: 100px;
        min-height: auto;
    }

    .hero-content {
        align-items: center;
    }

    .hero-subtitle {
        max-width: 100%;
    }

    .hero-cta {
        justify-content: center;
    }

    .hero-stats {
        justify-content: center;
    }

    .hero-visual {
        order: -1;
        margin-bottom: 20px;
    }

    .phone-mockup {
        width: 220px;
        height: 440px;
        border-radius: 32px;
        padding: 10px;
    }

    .phone-screen {
        border-radius: 22px;
    }

    .demo-cell {
        width: 32px;
        height: 32px;
        border-radius: 6px;
    }
}

@media (max-width: 600px) {
    .navbar {
        padding: 12px 16px;
    }

    .nav-links a:not(.btn-play) {
        display: none;
    }

    .section-header h2 {
        font-size: 2rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .store-badges {
        flex-direction: column;
        align-items: center;
    }

    .store-badge {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }

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

    .hero-stats {
        gap: 24px;
    }

    :root {
        --section-padding: 60px 16px;
    }
}

/* Animation for scroll reveal (optional JS enhancement) */
@media (prefers-reduced-motion: no-preference) {

    .feature-card,
    .step {
        opacity: 1;
        transform: translateY(0);
    }
}