/* badge.bar - Memphis Design Badge Collection */

:root {
    --felt: #1a1a2e;
    --coral: #ff6b6b;
    --mint: #4ecdc4;
    --yellow: #ffe66d;
    --lilac: #c3aed6;
    --cream: #faf3e0;
    --pink: #ff8fab;
    --gunmetal: #2d3436;
}

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

html {
    overflow-x: hidden;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--felt);
    color: var(--cream);
    overflow-x: hidden;
    line-height: 1.65;
}

.pattern-defs {
    position: absolute;
    width: 0;
    height: 0;
}

/* Canopy Entrance */
.canopy-entrance {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: var(--felt);
}

.memphis-bg {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle 4px, rgba(255, 107, 107, 0.08) 100%, transparent 100%),
        radial-gradient(circle 3px, rgba(78, 205, 196, 0.06) 100%, transparent 100%);
    background-size: 40px 40px, 55px 55px;
    background-position: 0 0, 20px 20px;
}

.diagonal-band {
    position: absolute;
    width: 200%;
    height: 120px;
    transform: rotate(-12deg);
    pointer-events: none;
}

.band-1 {
    top: 35%;
    left: -50%;
    background: repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(255, 230, 109, 0.06) 8px, rgba(255, 230, 109, 0.06) 10px);
}

.band-2 {
    top: 50%;
    left: -50%;
    background: repeating-linear-gradient(-45deg, transparent, transparent 8px, rgba(195, 174, 214, 0.05) 8px, rgba(195, 174, 214, 0.05) 10px);
    transform: rotate(12deg);
}

/* Seal Animation */
.seal-container {
    position: absolute;
    width: 200px;
    height: 200px;
    z-index: 20;
}

.seal-wedge {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--coral);
    clip-path: polygon(50% 50%, 50% 0%, 100% 0%);
    transition: transform 1.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 1s ease;
    border-radius: 50%;
}

.seal-wedge:nth-child(2) { transform: rotate(60deg); }
.seal-wedge:nth-child(3) { transform: rotate(120deg); }
.seal-wedge:nth-child(4) { transform: rotate(180deg); }
.seal-wedge:nth-child(5) { transform: rotate(240deg); }
.seal-wedge:nth-child(6) { transform: rotate(300deg); }

.seal-container.cracked .seal-wedge:nth-child(1) { transform: rotate(0deg) translate(60px, -40px) rotate(30deg); opacity: 0; }
.seal-container.cracked .seal-wedge:nth-child(2) { transform: rotate(60deg) translate(60px, -20px) rotate(-20deg); opacity: 0; }
.seal-container.cracked .seal-wedge:nth-child(3) { transform: rotate(120deg) translate(40px, 40px) rotate(25deg); opacity: 0; }
.seal-container.cracked .seal-wedge:nth-child(4) { transform: rotate(180deg) translate(-50px, 50px) rotate(-15deg); opacity: 0; }
.seal-container.cracked .seal-wedge:nth-child(5) { transform: rotate(240deg) translate(-60px, -10px) rotate(20deg); opacity: 0; }
.seal-container.cracked .seal-wedge:nth-child(6) { transform: rotate(300deg) translate(-30px, -50px) rotate(-30deg); opacity: 0; }

.site-wordmark {
    font-family: 'Bungee', cursive;
    font-size: clamp(3rem, 10vw, 8rem);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--cream);
    position: relative;
    z-index: 10;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.8s ease 1.5s, transform 0.2s ease;
}

.site-wordmark.revealed {
    opacity: 1;
}

.site-wordmark.bounce {
    animation: sealBounce 200ms ease;
}

@keyframes sealBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* First Pin Section */
.first-pin-section {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10vh 5vw;
}

.badge-welcome {
    width: 280px;
}

/* Badge Cards */
.badge-card {
    perspective: 800px;
    transform: rotate(var(--rot, 0deg));
    cursor: pointer;
}

.badge-card:hover {
    animation: wobble 400ms ease;
}

@keyframes wobble {
    0%, 100% { transform: rotate(var(--rot, 0deg)); }
    25% { transform: rotate(calc(var(--rot, 0deg) - 4deg)); }
    75% { transform: rotate(calc(var(--rot, 0deg) + 4deg)); }
}

.badge-sm { width: 160px; }
.badge-md { width: 240px; }
.badge-lg { width: 320px; }

.badge-flip-container {
    position: relative;
    width: 100%;
    padding-bottom: 120%;
    transform-style: preserve-3d;
    transition: transform 0.8s ease;
}

.badge-card:hover .badge-flip-container {
    transform: rotateY(180deg);
}

.badge-front, .badge-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.badge-back {
    transform: rotateY(180deg);
    background: var(--cream);
    border-radius: 12px;
}

.badge-back-text {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1rem;
    color: var(--felt);
    text-align: center;
    line-height: 1.6;
}

/* Badge Shine */
.badge-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(40deg, transparent 30%, rgba(255,255,255,0.2) 45%, transparent 55%);
    pointer-events: none;
    z-index: 5;
    border-radius: 50%;
}

/* Badge Shapes */
.badge-shape {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--border-color, var(--mint));
    padding: 20px;
    position: relative;
    background: var(--felt);
    box-shadow: 2px 2px 0 var(--gunmetal);
}

.circle-badge {
    border-radius: 50%;
    width: 80%;
    aspect-ratio: 1;
}

.circle-scalloped {
    border-radius: 50%;
    width: 80%;
    aspect-ratio: 1;
    clip-path: polygon(50% 0%, 63% 5%, 75% 0%, 82% 12%, 95% 12%, 95% 25%, 100% 38%, 93% 48%, 100% 62%, 93% 72%, 95% 85%, 82% 88%, 75% 100%, 63% 95%, 50% 100%, 37% 95%, 25% 100%, 18% 88%, 5% 85%, 7% 72%, 0% 62%, 7% 48%, 0% 38%, 5% 25%, 5% 12%, 18% 12%, 25% 0%, 37% 5%);
}

.shield-badge {
    clip-path: polygon(50% 100%, 0% 25%, 0% 0%, 100% 0%, 100% 25%);
    width: 80%;
    padding: 25px 20px 40px;
}

.hex-badge {
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    width: 80%;
    aspect-ratio: 0.87;
}

.badge-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
}

.badge-title {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: center;
    color: var(--cream);
}

/* Badge Ribbon */
.badge-ribbon {
    width: 30px;
    height: 20px;
    position: relative;
    margin-top: 8px;
}

.badge-ribbon::before,
.badge-ribbon::after {
    content: '';
    position: absolute;
    top: 0;
    width: 15px;
    height: 20px;
    background: var(--ribbon-color, var(--coral));
}

.badge-ribbon::before {
    left: 0;
    transform: skewX(10deg);
    animation: ribbonSway 3s ease-in-out infinite;
}

.badge-ribbon::after {
    right: 0;
    transform: skewX(-10deg);
    animation: ribbonSway 3s ease-in-out infinite 0.2s;
}

@keyframes ribbonSway {
    0%, 100% { transform: skewX(10deg) rotate(-2deg); }
    50% { transform: skewX(10deg) rotate(2deg); }
}

.badge-serial {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--cream);
    opacity: 0.4;
    margin-top: 10px;
}

/* Pin-back on hover */
.badge-card::after {
    content: '';
    position: absolute;
    top: 10px;
    right: -6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle, #ccc 30%, #999 100%);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: -1;
}

.badge-card:hover::after {
    opacity: 0.6;
}

/* Collection Wall Masonry */
.collection-wall {
    min-height: 260vh;
    padding: 10vh 8vw;
}

.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 30px;
    align-items: start;
}

.masonry-grid .badge-card {
    opacity: 0;
    transform: rotate(var(--rot, 0deg)) rotateY(180deg);
    transition: opacity 0.5s ease, transform 0.8s ease;
}

.masonry-grid .badge-card.flipped-in {
    opacity: 1;
    transform: rotate(var(--rot, 0deg)) rotateY(0deg);
}

/* The Vault / Grand Badge */
.vault-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10vh 5vw;
    perspective: 800px;
}

.grand-badge {
    width: min(80vw, 500px);
    aspect-ratio: 1;
}

.grand-badge-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.1s linear;
}

.grand-front, .grand-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.grand-back {
    transform: rotateY(180deg);
    background: var(--cream);
    flex-direction: column;
    padding: 15%;
    text-align: center;
}

.grand-scallop {
    width: 90%;
    height: 90%;
    background: var(--coral);
    clip-path: polygon(50% 0%, 63% 5%, 75% 0%, 82% 12%, 95% 12%, 95% 25%, 100% 38%, 93% 48%, 100% 62%, 93% 72%, 95% 85%, 82% 88%, 75% 100%, 63% 95%, 50% 100%, 37% 95%, 25% 100%, 18% 88%, 5% 85%, 7% 72%, 0% 62%, 7% 48%, 0% 38%, 5% 25%, 5% 12%, 18% 12%, 25% 0%, 37% 5%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.grand-shield {
    width: 65%;
    height: 65%;
    background: var(--felt);
    border: 3px solid var(--yellow);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.grand-star {
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--yellow);
}

.grand-title {
    font-family: 'Bungee', cursive;
    font-size: clamp(1rem, 3vw, 2rem);
    color: var(--cream);
    letter-spacing: 0.05em;
}

.grand-sub {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--mint);
    letter-spacing: 0.08em;
    margin-top: 4px;
}

.grand-back-text {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--felt);
    line-height: 1.6;
    margin-bottom: 20px;
}

.grand-serial {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--gunmetal);
    letter-spacing: 0.06em;
}

/* Pin Board Footer */
.pin-board-footer {
    position: relative;
    min-height: 40vh;
    padding: 10vh 8vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mini-badges {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.mini-badge {
    position: absolute;
    border: 2px solid;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mini-badge.scattered {
    opacity: 0.6;
}

.footer-content {
    position: relative;
    z-index: 10;
    text-align: center;
}

.footer-text {
    font-family: 'Bungee', cursive;
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: var(--cream);
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}

.footer-meta {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--mint);
    opacity: 0.6;
    letter-spacing: 0.06em;
}

/* Responsive */
@media (max-width: 768px) {
    .masonry-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .badge-lg {
        width: 100%;
    }

    .grand-badge {
        width: 90vw;
    }
}
