/* ========================================
   mybadge.page — Leather Vault HUD
   ======================================== */

:root {
    --bg-primary: #0f0b07;
    --bg-secondary: #1a1209;
    --bg-tertiary: #2a1f14;
    --text-primary: #f0e6d3;
    --text-secondary: #c4b89a;
    --text-muted: #8b7e6a;
    --accent-rose: #ff2d6f;
    --accent-cyan: #00e5ff;
    --accent-lime: #c6ff00;
    --accent-amber: #ffab00;
    --grain-overlay: #1a1a1a;
}

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

html {
    background: #000000;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow: hidden;
}

/* Layer 0: Leather Background */
#leather-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0;
    transition: opacity 800ms ease;
    background:
        radial-gradient(ellipse at 30% 40%, #2a1f14 0%, #1a1209 50%, #0f0b07 100%),
        repeating-linear-gradient(45deg, #2a1f14, #2a1f14 1px, #1a1209 1px, #1a1209 2px),
        repeating-linear-gradient(-45deg, #1a1209, #1a1209 1px, #2a1f14 1px, #2a1f14 3px),
        repeating-radial-gradient(circle at 50% 50%, transparent 0px, transparent 2px, rgba(42,31,20,0.3) 2px, rgba(42,31,20,0.3) 3px);
    background-blend-mode: multiply, overlay, overlay, normal;
}
#leather-bg.visible { opacity: 1; }

/* Film Grain */
#grain-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    mix-blend-mode: overlay;
    opacity: 0.08;
}
#grain-overlay svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Vignette */
#vignette {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(15,11,7,0.6) 100%);
}

/* Scan Lines */
#scan-lines {
    position: fixed;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(255,255,255,0.03) 3px,
        rgba(255,255,255,0.03) 4px
    );
}

/* HUD Frame */
#hud-frame {
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
}

.hud-corner {
    position: absolute;
    width: 80px;
    height: 80px;
    opacity: 0;
    animation: hud-pulse 4s ease-in-out infinite;
}
.hud-corner path {
    stroke-dasharray: 160;
    stroke-dashoffset: 160;
}
.hud-corner.animate path {
    animation: draw-bracket 500ms ease-out forwards;
}
.hud-corner-tl { top: 20px; left: 20px; }
.hud-corner-tr { top: 20px; right: 20px; }
.hud-corner-bl { bottom: 20px; left: 20px; }
.hud-corner-br { bottom: 20px; right: 20px; }

@keyframes hud-pulse {
    0%, 100% { opacity: 0.12; }
    50% { opacity: 0.25; }
}

@keyframes draw-bracket {
    to { stroke-dashoffset: 0; }
}

.hud-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    opacity: 0;
    transition: opacity 400ms ease;
}
.hud-crosshair.visible { opacity: 0.15; }
.hud-crosshair line { stroke: var(--accent-rose); }

.hud-readout {
    position: absolute;
    font-family: 'Space Grotesk', monospace;
    font-weight: 500;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent-rose);
    opacity: 0;
    transition: opacity 600ms ease;
}
.hud-readout.visible { opacity: 0.4; }
.hud-readout-tl { top: 28px; left: 110px; }
.hud-readout-br { bottom: 28px; right: 110px; }

/* Scan Sweep */
#scan-sweep {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-rose);
    opacity: 0;
    z-index: 101;
    pointer-events: none;
    transform: translateY(-100%);
}
#scan-sweep.active {
    opacity: 0.6;
    animation: sweep-down 300ms linear forwards;
}
@keyframes sweep-down {
    from { transform: translateY(0); }
    to { transform: translateY(100vh); }
}

/* Floating Particles */
#particle-field {
    position: fixed;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    transition: opacity 500ms ease;
}
#particle-field.visible { opacity: 1; }

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: var(--accent-rose);
    opacity: 0.15;
    transition: transform 200ms ease-out;
}

/* Scroll Container */
#scroll-container {
    position: relative;
    z-index: 10;
    height: 100vh;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

/* Snap Sections */
.snap-section {
    height: 100vh;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 80px 40px;
    position: relative;
}

/* Hero */
.hero-content {
    text-align: center;
}

.hero-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.08em;
    color: var(--text-primary);
    text-shadow: 0 0 40px rgba(255, 45, 111, 0.3);
    min-height: 1.2em;
}

.hero-title .letter {
    display: inline-block;
    opacity: 0;
}
.hero-title .letter.visible {
    opacity: 1;
    color: var(--text-primary);
    transition: color 400ms ease;
}
.hero-title .letter.glow {
    color: var(--accent-rose);
    text-shadow: 0 0 20px rgba(255, 45, 111, 0.8);
}

.hero-subtitle {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(0.75rem, 1.5vw, 1rem);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--accent-rose);
    opacity: 0;
    transition: opacity 600ms ease;
    margin-top: 1.5rem;
}
.hero-subtitle.visible { opacity: 0.5; }

/* Section Headers */
.section-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 50px;
    width: 100%;
    max-width: 1100px;
    opacity: 0;
    transition: opacity 400ms ease;
}
.section-header.visible { opacity: 1; }

.section-header h2 {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    color: #e8dcc8;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.section-header-line {
    flex: 1;
    height: 1px;
    background: var(--accent-rose);
    opacity: 0.3;
    transform: scaleX(0);
    transition: transform 400ms ease;
}
.section-header-line.left { transform-origin: right; }
.section-header-line.right { transform-origin: left; }
.section-header.visible .section-header-line { transform: scaleX(1); }

/* Badge Constellation Grid */
.badge-constellation {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(4, minmax(80px, 1fr));
    gap: 24px;
    width: 100%;
    max-width: 1100px;
    flex: 1;
    align-content: center;
}

/* Badge Card */
.badge-card {
    background: rgba(26, 18, 9, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 45, 111, 0.2);
    padding: 24px;
    position: relative;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 300ms ease, transform 300ms ease, border-color 200ms ease, box-shadow 200ms ease;
    overflow: hidden;
    animation: float-card 8s cubic-bezier(0.37, 0, 0.63, 1) infinite;
    animation-play-state: running;
}
.badge-card.visible {
    opacity: 1;
    transform: scale(1);
}
.badge-card:hover {
    border-color: rgba(255, 45, 111, 0.8);
    box-shadow: 0 0 40px rgba(255, 45, 111, 0.2);
    animation-play-state: paused;
    transform: scale(1.03);
}

@keyframes float-card {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* Badge accent bar */
.badge-accent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
}
[data-accent="rose"] .badge-accent { background: var(--accent-rose); }
[data-accent="cyan"] .badge-accent { background: var(--accent-cyan); }
[data-accent="lime"] .badge-accent { background: var(--accent-lime); }
[data-accent="amber"] .badge-accent { background: var(--accent-amber); }

/* Badge sigil */
.badge-sigil-wrap {
    width: 60px;
    height: 60px;
    margin-bottom: 16px;
}
.badge-sigil {
    width: 100%;
    height: 100%;
    animation: rotate-sigil 120s linear infinite;
}
[data-accent="rose"] .badge-sigil * { stroke: var(--accent-rose); }
[data-accent="cyan"] .badge-sigil * { stroke: var(--accent-cyan); }
[data-accent="lime"] .badge-sigil * { stroke: var(--accent-lime); }
[data-accent="amber"] .badge-sigil * { stroke: var(--accent-amber); }

.badge-card:hover .badge-sigil {
    animation-duration: 30s;
}

@keyframes rotate-sigil {
    to { transform: rotate(360deg); }
}

.badge-name {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: #e8dcc8;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}

.badge-desc {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(0.85rem, 1.4vw, 1.05rem);
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
}

.badge-meta {
    display: flex;
    justify-content: space-between;
    font-family: 'Space Grotesk', monospace;
    font-weight: 500;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(139, 126, 106, 0.2);
    transform: translateY(10px);
    opacity: 0;
    transition: transform 200ms ease, opacity 200ms ease;
}
.badge-card:hover .badge-meta {
    transform: translateY(0);
    opacity: 1;
}

/* Mobile */
@media (max-width: 768px) {
    .badge-constellation {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    .badge-card {
        width: 100%;
        max-width: 340px;
        margin: 0 auto;
    }
    .hud-crosshair { display: none; }
    .hud-readout { display: none; }
    .snap-section { padding: 60px 20px; }
    .badge-meta {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 769px) and (max-width: 1199px) {
    .badge-constellation {
        grid-template-columns: repeat(6, 1fr);
    }
    .badge-card {
        grid-column: span 3 !important;
        grid-row: auto !important;
    }
}
