/* ============================================================
   BADGE SYSTEM — badges.css
   ============================================================ */

/* ── Badge Showcase Modal ─────────────────────────────────── */

.badge-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.badge-modal.hidden { display: none; }

.badge-modal-content {
    background: #fffff4;
    border-radius: 12px;
    width: min(660px, 100%);
    max-height: 88vh;
    overflow-y: auto;
    padding: 28px 24px 24px;
    position: relative;
    border-top: 6px solid #c53030;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.badge-modal-header {
    text-align: center;
    margin-bottom: 20px;
    padding-right: 28px;
}

.badge-modal-header h2 {
    font-family: 'American Typewriter', 'Courier New', monospace;
    font-size: 22px;
    color: #1a202c;
    margin: 0 0 4px;
}

.badge-count-summary {
    color: #718096;
    font-size: 13px;
    margin: 0;
    font-family: 'American Typewriter', 'Courier New', monospace;
}

/* ── Category sections ────────────────────────────────────── */

.badge-category { margin-bottom: 24px; }

.badge-category-title {
    font-family: 'American Typewriter', 'Courier New', monospace;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #718096;
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ── Badge grid ───────────────────────────────────────────── */

.badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}

/* Base card */
.badge-card {
    text-align: center;
    position: relative;
    transition: transform 0.15s;
    padding: 0 2px 8px;
}

.badge-card.earned:hover {
    transform: translateY(-3px);
}

/* Unearned card — gray shape, no gradient revealed */
.badge-card.unearned {
    opacity: 0.5;
}

/* ── SVG badge shape ───────────────────────────────────────── */

/* Aspect-ratio wrapper — height tracks the SVG's natural proportions */
.badge-shape-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 403.74 / 441.1;
    margin: 0 auto 6px;
}

/* Gradient fill + white frosted overlay, both clipped to the badge silhouette */
.badge-shape-mask,
.badge-shape-overlay {
    position: absolute;
    inset: 0;
    -webkit-mask-image: url(badge-shape.svg);
    mask-image: url(badge-shape.svg);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.badge-shape-mask {
    background: var(--badge-gradient, linear-gradient(135deg, #9ca3af, #d1d5db, #9ca3af));
}

.badge-shape-overlay {
    background: rgba(255, 255, 255, 0.60);
}

/* Emoji + name centered inside the badge shape */
.badge-shape-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 20px;
}

.badge-card-emoji {
    font-size: 24px;
    line-height: 1;
    display: block;
    margin-bottom: 4px;
}

.badge-card-name {
    font-family: 'American Typewriter', 'Courier New', monospace;
    font-size: 10px;
    font-weight: bold;
    color: #1a202c;
    line-height: 1.25;
    padding: 0 10%;
}

/* Description sits below the shape */
.badge-card-desc {
    font-size: 9px;
    color: #4a5568;
    line-height: 1.3;
}


/* ── Toast container ──────────────────────────────────────── */
#badge-toast-container {
    position: fixed;
    top: 72px;
    right: 16px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

/* ── Individual toast ─────────────────────────────────────── */
.badge-toast {
    background: #1a202c;
    color: #fffff4;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 210px;
    max-width: 270px;
    /* border-left color and box-shadow set inline per badge */
    border-left: 4px solid #f6ad55;
    opacity: 0;
    transform: translateX(24px);
    transition: opacity 0.28s ease, transform 0.28s ease;
    pointer-events: auto;
}

.badge-toast--visible {
    opacity: 1;
    transform: translateX(0);
}

.badge-toast-emoji {
    font-size: 26px;
    flex-shrink: 0;
}

.badge-toast-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: bold;
    margin-bottom: 2px;
    /* color set inline per badge */
}

.badge-toast-name {
    font-family: 'American Typewriter', 'Courier New', monospace;
    font-size: 13px;
    font-weight: bold;
    color: #fffff4;
    line-height: 1.3;
}

/* ── Mobile tweaks ────────────────────────────────────────── */
@media (max-width: 480px) {
    .badge-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }
    .badge-card-emoji { font-size: 20px; }

    #badge-toast-container {
        top: auto;
        bottom: 80px;
        right: 12px;
        left: 12px;
        align-items: flex-end;
    }
    .badge-toast { min-width: unset; max-width: 100%; width: 100%; }
}
