/* =============================================
   karmabadge.com — Styles
   Generative Retro-Futuristic Bento Layout
   ============================================= */

/* --- CSS Custom Properties --- */
:root {
    --deep-void: #0D0B12;
    --recessed-panel: #16121E;
    --border-frame: #2A1F3D;
    --text-primary: #F0E6D3;
    --text-secondary: #9B8EC4;
    --accent-warm: #E8B84B;
    --accent-cool: #6B5CE7;
    --ripple-glow: #FF6B4A;
    --success-state: #4AE8A0;
    --grid-gap: 6px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--deep-void);
    color: var(--text-primary);
    font-family: 'Recursive', monospace, sans-serif;
    font-variation-settings: 'MONO' 1, 'CASL' 0, 'wght' 400, 'slnt' 0;
    font-size: clamp(0.85rem, 1vw + 0.3rem, 1.05rem);
    line-height: 1.75;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- SVG Filter (Hidden) --- */
.grain-svg {
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* --- Scroll Progress Bar --- */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-cool), var(--ripple-glow), var(--accent-warm));
    z-index: 1000;
    transition: width 0.1s linear;
}

/* --- Site Watermark --- */
.site-watermark {
    position: fixed;
    top: 12px;
    left: 16px;
    font-family: 'Recursive', monospace;
    font-variation-settings: 'MONO' 1, 'CASL' 0, 'wght' 400, 'slnt' 0;
    font-size: 11px;
    letter-spacing: 0.14em;
    color: var(--text-primary);
    opacity: 0.4;
    z-index: 999;
    text-transform: uppercase;
}

/* --- Click Ripple Canvas --- */
.ripple-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 998;
}

/* --- Bento Grid --- */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--grid-gap);
    padding: 40px var(--grid-gap) var(--grid-gap);
    max-width: 1400px;
    margin: 0 auto;
    min-height: 200vh;
}

/* --- Base Bento Cell --- */
.bento-cell {
    position: relative;
    border: 2px solid var(--border-frame);
    background-color: var(--deep-void);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bento-cell.activated {
    opacity: 1;
}

/* --- Scan Lines Overlay --- */
.scan-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 2px,
        var(--deep-void) 2px,
        var(--deep-void) 3px
    );
    opacity: 0.03;
    pointer-events: none;
    z-index: 5;
}

/* --- Cell Grain Overlay --- */
.cell-grain {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    pointer-events: none;
    z-index: 4;
    opacity: 0.08;
}

[data-grain="fine"] .cell-grain {
    filter: url(#grain-fine);
    opacity: 0.06;
}

[data-grain="coarse"] .cell-grain {
    filter: url(#grain-coarse);
    opacity: 0.12;
}

/* --- Hero Cell --- */
.hero-cell {
    grid-column: span 3;
    grid-row: span 2;
    min-height: 400px;
    background: linear-gradient(180deg, var(--deep-void) 0%, var(--recessed-panel) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-title {
    position: relative;
    z-index: 3;
    text-align: center;
}

.hero-title h1 {
    font-family: 'Recursive', sans-serif;
    font-variation-settings: 'MONO' 0.5, 'CASL' 0.8, 'wght' 900, 'slnt' -4;
    font-size: clamp(2.8rem, 6vw + 0.5rem, 5.5rem);
    color: var(--text-primary);
    letter-spacing: 0.02em;
    line-height: 1.1;
}

.hero-title h1 span {
    display: inline-block;
    animation: breathe 8s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% {
        font-variation-settings: 'MONO' 0.5, 'CASL' 0.6, 'wght' 900, 'slnt' -4;
    }
    50% {
        font-variation-settings: 'MONO' 0.5, 'CASL' 1.0, 'wght' 900, 'slnt' -4;
    }
}

/* --- Corner Registration Marks --- */
.corner-mark {
    position: absolute;
    width: 8px;
    height: 8px;
    z-index: 6;
}

.corner-mark::before,
.corner-mark::after {
    content: '';
    position: absolute;
    background-color: var(--border-frame);
}

.corner-mark::before {
    width: 8px;
    height: 1px;
}

.corner-mark::after {
    width: 1px;
    height: 8px;
}

.corner-mark.top-left {
    top: 6px;
    left: 6px;
}
.corner-mark.top-left::before { top: 0; left: 0; }
.corner-mark.top-left::after { top: 0; left: 0; }

.corner-mark.top-right {
    top: 6px;
    right: 6px;
}
.corner-mark.top-right::before { top: 0; right: 0; }
.corner-mark.top-right::after { top: 0; right: 0; }

.corner-mark.bottom-left {
    bottom: 6px;
    left: 6px;
}
.corner-mark.bottom-left::before { bottom: 0; left: 0; }
.corner-mark.bottom-left::after { bottom: 0; left: 0; }

.corner-mark.bottom-right {
    bottom: 6px;
    right: 6px;
}
.corner-mark.bottom-right::before { bottom: 0; right: 0; }
.corner-mark.bottom-right::after { bottom: 0; right: 0; }

/* --- Generative Canvas --- */
.gen-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* --- Stat Cells --- */
.stat-cell {
    grid-column: span 1;
    grid-row: span 1;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 12px;
    background-color: var(--recessed-panel);
}

.stat-label {
    font-family: 'Recursive', monospace;
    font-variation-settings: 'MONO' 1, 'CASL' 0, 'wght' 700, 'slnt' 0;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-warm);
    margin-bottom: 8px;
}

.stat-value {
    font-family: 'Recursive', monospace;
    font-variation-settings: 'MONO' 1, 'CASL' 0, 'wght' 900, 'slnt' 0;
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    color: var(--text-primary);
    text-shadow: 0 0 12px rgba(106, 92, 231, 0.3);
    letter-spacing: 0.05em;
}

/* --- Story Cells --- */
.story-cell {
    grid-column: span 2;
    grid-row: span 1;
    min-height: 140px;
    padding: 28px 24px;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, var(--recessed-panel), var(--deep-void));
}

.story-text {
    font-family: 'Recursive', monospace;
    font-variation-settings: 'MONO' 1, 'CASL' 0, 'wght' 400, 'slnt' 0;
    font-size: clamp(0.85rem, 1vw + 0.3rem, 1.05rem);
    line-height: 1.75;
    color: var(--text-secondary);
}

.wide-story {
    grid-column: span 3;
}

/* --- Pattern Cells --- */
.pattern-cell {
    grid-column: span 1;
    grid-row: span 2;
    min-height: 260px;
    background-color: var(--deep-void);
}

.ripple-cell {
    grid-column: span 2;
    grid-row: span 1;
    min-height: 200px;
}

.constellation-cell {
    grid-column: span 2;
    grid-row: span 1;
    min-height: 200px;
}

/* --- Badge Showcase Cell --- */
.badge-showcase-cell {
    grid-column: span 2;
    grid-row: span 2;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--deep-void) 0%, var(--recessed-panel) 50%, var(--deep-void) 100%);
}

.badge-container {
    text-align: center;
    position: relative;
    z-index: 3;
    transform: scale(0.95);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.badge-showcase-cell.activated .badge-container {
    transform: scale(1);
}

.badge-ring {
    width: 120px;
    height: 120px;
    border: 2px solid var(--accent-cool);
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: badgeRotate 20s linear infinite;
    box-shadow: 0 0 20px rgba(107, 92, 231, 0.2), inset 0 0 20px rgba(107, 92, 231, 0.1);
}

.badge-icon {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 80px;
}

.dot-matrix-badge {
    width: 80px;
    height: 80px;
}

@keyframes badgeRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.badge-name {
    font-family: 'Recursive', monospace;
    font-variation-settings: 'MONO' 1, 'CASL' 0, 'wght' 700, 'slnt' 0;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-warm);
    margin-top: 12px;
}

.badge-desc {
    font-family: 'Recursive', monospace;
    font-variation-settings: 'MONO' 1, 'CASL' 0, 'wght' 400, 'slnt' 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.7;
    margin-top: 6px;
    max-width: 200px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Small Stat Cells --- */
.small-stat {
    grid-column: span 1;
    min-height: 100px;
}

.small-stat .stat-value {
    font-size: clamp(1.4rem, 2vw, 2rem);
}

/* --- Grain Animation --- */
@keyframes grainShift {
    0% { transform: translate(0, 0); }
    50% { transform: translate(-3%, -3%); }
    100% { transform: translate(0, 0); }
}

.cell-grain {
    animation: grainShift 2s steps(1) infinite;
}

/* --- Cell Activation Animations --- */
.stat-cell {
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.stat-cell.activated {
    transform: translateY(0);
}

.story-cell {
    transform: translateX(-20px);
    transition: opacity 0.3s ease, transform 0.4s ease;
}

.story-cell.activated {
    transform: translateX(0);
}

.pattern-cell {
    transition: opacity 0.5s ease;
}

.badge-showcase-cell {
    transition: opacity 0.5s ease;
}

/* --- Responsive: Tablet --- */
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 36px var(--grid-gap) var(--grid-gap);
    }

    .hero-cell {
        grid-column: span 2;
        grid-row: span 1;
        min-height: 300px;
    }

    .story-cell,
    .wide-story {
        grid-column: span 2;
    }

    .pattern-cell,
    .ripple-cell,
    .constellation-cell {
        grid-column: span 1;
        grid-row: span 1;
        min-height: 200px;
    }

    .badge-showcase-cell {
        grid-column: span 2;
        grid-row: span 1;
        min-height: 260px;
    }

    .stat-cell,
    .small-stat {
        grid-column: span 1;
    }

    .hero-title h1 {
        font-size: clamp(2rem, 5vw + 0.3rem, 3.5rem);
    }
}

/* --- Responsive: Mobile --- */
@media (max-width: 480px) {
    .bento-grid {
        grid-template-columns: 1fr;
        padding: 32px var(--grid-gap) var(--grid-gap);
    }

    .hero-cell,
    .story-cell,
    .wide-story,
    .pattern-cell,
    .ripple-cell,
    .constellation-cell,
    .badge-showcase-cell,
    .stat-cell,
    .small-stat {
        grid-column: span 1;
        grid-row: span 1;
    }

    .hero-cell {
        min-height: 260px;
    }

    .pattern-cell {
        min-height: 180px;
    }

    .badge-showcase-cell {
        min-height: 240px;
    }

    .hero-title h1 {
        font-size: clamp(1.8rem, 8vw, 3rem);
    }
}
