/* ppuzzl.bar - Glassmorphic Puzzle Gallery */

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

/* Custom Properties */
:root {
    --deep-earth: #2A2820;
    --warm-grey: #5A5848;
    --muted-gold: #8A8068;
    --glass-surface: rgba(240, 235, 225, 0.6);
    --marble-cream: #F4F0E8;
    --puzzle-white: #FAF8F2;
    --vector-line: #6A6050;
    --classical-stone: #D8D0C0;
    --glass-border: rgba(160, 150, 130, 0.2);
    --glass-blur: 16px;
    --border-radius: 10px;
}

/* Typography */
body {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    line-height: 1.85;
    color: var(--warm-grey);
    background-color: var(--marble-cream);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: 'JetBrains Mono', monospace;
    color: var(--deep-earth);
}

/* Marble-Classical Texture Underlayer */
.marble-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(216, 208, 192, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(216, 208, 192, 0.05) 0%, transparent 45%),
        radial-gradient(ellipse at 40% 80%, rgba(216, 208, 192, 0.04) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 15%, rgba(216, 208, 192, 0.05) 0%, transparent 40%),
        radial-gradient(ellipse at 10% 90%, rgba(216, 208, 192, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 10%, rgba(216, 208, 192, 0.04) 0%, transparent 35%),
        radial-gradient(ellipse at 50% 50%, rgba(216, 208, 192, 0.03) 0%, transparent 60%),
        radial-gradient(ellipse at 30% 70%, rgba(250, 248, 242, 0.04) 0%, transparent 40%),
        radial-gradient(ellipse at 80% 40%, rgba(250, 248, 242, 0.03) 0%, transparent 50%);
}

/* Glass Panel Base */
.glass-panel {
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    background: var(--glass-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
}

/* ===========================
   HERO SECTION
   =========================== */
.hero {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    overflow: hidden;
}

.hero-inner {
    max-width: 700px;
    position: relative;
}

.hero-title {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: clamp(2.4rem, 6vw, 4.5rem);
    color: var(--deep-earth);
    letter-spacing: 0.15em;
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateY(20px);
    animation: heroFadeIn 1.2s ease-out 0.3s forwards;
}

.hero-subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.85rem, 1.5vw, 1.1rem);
    color: var(--muted-gold);
    letter-spacing: 0.08em;
    margin-bottom: 2.5rem;
    opacity: 0;
    transform: translateY(15px);
    animation: heroFadeIn 1.2s ease-out 0.6s forwards;
}

.hero-tessellation-wrap {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    opacity: 0;
    animation: heroFadeIn 1.5s ease-out 0.9s forwards;
}

.hero-tessellation-wrap svg {
    width: 100%;
    height: auto;
}

/* Floating puzzle pieces in hero */
.hero-puzzle-piece {
    position: absolute;
    pointer-events: none;
    opacity: 0;
    animation: puzzlePieceFloat 1.8s ease-out forwards;
}

.hero-piece-1 {
    width: 100px;
    top: 10%;
    left: -5%;
    animation-delay: 1.2s;
    animation-duration: 2s;
}

.hero-piece-2 {
    width: 80px;
    top: 15%;
    right: -3%;
    animation-delay: 1.5s;
    animation-duration: 2.2s;
}

.hero-piece-3 {
    width: 65px;
    bottom: 20%;
    left: 5%;
    animation-delay: 1.8s;
    animation-duration: 2.4s;
}

.hero-puzzle-piece svg {
    width: 100%;
    height: auto;
}

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

@keyframes puzzlePieceFloat {
    0% {
        opacity: 0;
        transform: translateY(30px) rotate(-10deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
}

/* Subtle float animation for puzzle pieces after appearing */
.hero-piece-1.animate-float {
    animation: floatSlow 8s ease-in-out infinite;
}

.hero-piece-2.animate-float {
    animation: floatMed 7s ease-in-out infinite;
}

.hero-piece-3.animate-float {
    animation: floatSlow 9s ease-in-out infinite reverse;
}

@keyframes floatSlow {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(2deg); }
}

@keyframes floatMed {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-6px) rotate(-2deg); }
}

/* ===========================
   SOLVE STATS COUNTER SECTION
   =========================== */
.solve-stats {
    position: relative;
    z-index: 1;
    padding: 4rem 2rem 5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
    max-width: 900px;
    margin: 0 auto;
}

.stat-card {
    padding: 2.5rem 1.5rem;
    text-align: center;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.stat-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.stat-number {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    color: var(--deep-earth);
    line-height: 1.2;
    margin-bottom: 0.4rem;
}

.stat-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    color: var(--muted-gold);
    letter-spacing: 0.1em;
    text-transform: lowercase;
}

/* ===========================
   GALLERY SECTION
   =========================== */
.gallery {
    position: relative;
    z-index: 1;
    padding: 3rem 2rem 5rem;
    max-width: 1100px;
    margin: 0 auto;
}

.section-heading {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    color: var(--deep-earth);
    margin-bottom: 2rem;
    letter-spacing: 0.04em;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
}

.gallery-item {
    position: relative;
    padding: 2rem;
    min-height: 260px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out, background 0.3s ease;
}

.gallery-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.gallery-item.span-2 {
    grid-column: span 2;
}

.gallery-item:hover {
    background: rgba(240, 235, 225, 0.78);
}

.gallery-item:hover .item-puzzle-bg svg {
    opacity: 1;
    transform: scale(1.03);
}

/* Puzzle SVG backgrounds */
.item-puzzle-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.item-puzzle-bg svg {
    width: 80%;
    height: 80%;
    opacity: 1;
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
}

/* Item content */
.item-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.item-title {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: clamp(0.95rem, 1.4vw, 1.15rem);
    color: var(--deep-earth);
    margin-bottom: 0.6rem;
    letter-spacing: 0.02em;
}

.item-desc {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.75rem, 0.9vw, 0.85rem);
    color: var(--warm-grey);
    line-height: 1.85;
    margin-bottom: 1.2rem;
    flex-grow: 1;
}

.item-solve {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}

.solve-counter {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: clamp(1.4rem, 2.2vw, 1.8rem);
    color: var(--deep-earth);
}

.solve-unit {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    color: var(--muted-gold);
    letter-spacing: 0.06em;
}

/* Solve bar indicator beneath each gallery item */
.gallery-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: var(--muted-gold);
    opacity: 0.4;
    transition: width 1.2s ease-out 0.3s;
}

.gallery-item.visible::after {
    width: var(--solve-width, 0%);
}

/* ===========================
   ABOUT SECTION
   =========================== */
.about {
    position: relative;
    z-index: 1;
    padding: 4rem 2rem 5rem;
    max-width: 800px;
    margin: 0 auto;
}

.about .section-heading {
    margin-bottom: 1.5rem;
}

.about-inner {
    padding: 3rem;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.about-inner.visible {
    opacity: 1;
    transform: translateY(0);
}

.about-text {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    color: var(--warm-grey);
    line-height: 1.85;
    margin-bottom: 1.4rem;
}

.about-text:last-child {
    margin-bottom: 0;
}

/* ===========================
   FOOTER
   =========================== */
.footer {
    position: relative;
    z-index: 1;
    padding: 3rem 2rem;
    text-align: center;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.footer-brand {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--deep-earth);
    letter-spacing: 0.12em;
}

.footer-divider {
    color: var(--classical-stone);
    font-weight: 300;
}

.footer-tagline {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    color: var(--muted-gold);
    letter-spacing: 0.06em;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 900px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .gallery-item.span-2 {
        grid-column: span 2;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-piece-1 {
        left: 0;
    }

    .hero-piece-2 {
        right: 0;
    }
}

@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-item.span-2 {
        grid-column: span 1;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-title {
        letter-spacing: 0.08em;
    }

    .about-inner {
        padding: 2rem 1.5rem;
    }

    .stat-card {
        padding: 1.8rem 1rem;
    }

    .hero-puzzle-piece {
        display: none;
    }
}
