/* ==========================================================================
   BrightShift credential wallet
   Public badge pages: the earned-badge grid and the single-badge detail view.
   Design language: a refined digital credential wallet. Deep atmospheric navy
   canvas, light floating cards, an engraved-serif for the credential name, a
   sturdy grotesque for the interface. Each badge gets a stable color tint
   derived from its name so a grid of many badges stays scannable at a glance.
   ========================================================================== */

:root {
    --ink: #1b2233;
    --ink-soft: #59617a;
    --ink-faint: #8a91a6;
    --hairline: rgba(27, 34, 51, 0.10);
    --surface: #fdfdff;
    --surface-2: #f4f6fb;
    --gold: #b0894a;
    --gold-soft: #f3ead7;
    --shadow-card: 0 1px 2px rgba(16, 23, 44, 0.06), 0 12px 30px -14px rgba(16, 23, 44, 0.28);
    --shadow-lift: 0 2px 4px rgba(16, 23, 44, 0.08), 0 22px 44px -18px rgba(16, 23, 44, 0.40);
    --radius: 16px;
    --font-ui: "Archivo", "Segoe UI", system-ui, sans-serif;
    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
}

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

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-ui);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    min-height: 100vh;
    background-color: #202b40;
    background-image:
        radial-gradient(1100px 620px at 78% -8%, #3d5075 0%, rgba(61, 80, 117, 0) 60%),
        radial-gradient(900px 560px at 8% 108%, #2a3856 0%, rgba(42, 56, 86, 0) 62%),
        linear-gradient(168deg, #26324b 0%, #1a2338 100%);
    background-attachment: fixed;
}

/* Embedded (iframe) surface: no backdrop or header chrome — the cards float
   directly on the host page. */
body.embed {
    min-height: 0;
    background: transparent;
}

    body.embed .wallet {
        padding: 12px 12px 16px;
    }

a { color: inherit; text-decoration: none; }

/* --- per-badge color tints (stable, derived from badge name) ------------- */
.t0 { --tint: #0f766e; --tint-soft: #e4f1ef; }
.t1 { --tint: #4f46e5; --tint-soft: #eae9fb; }
.t2 { --tint: #b45309; --tint-soft: #f9ecdd; }
.t3 { --tint: #be123c; --tint-soft: #fbe6ec; }
.t4 { --tint: #15803d; --tint-soft: #e4f1e8; }
.t5 { --tint: #1d4ed8; --tint-soft: #e6ecfb; }
.t6 { --tint: #7c3aed; --tint-soft: #f0e8fc; }
.t7 { --tint: #0e7490; --tint-soft: #e1eff4; }

/* --- shared: the square badge artwork ----------------------------------- */
/* Badge images are self-contained squares (white ground, framed) so they read
   as artwork, not icons — show them large and uncropped, no circular mask. */
.badge-art {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    flex: none;
}

    .badge-art img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        display: block;
    }

/* --- shared: icon-only share row ---------------------------------------- */
.share-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.share-btn {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--hairline);
    border-radius: 9px;
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    position: relative;
    transition: color .15s ease, border-color .15s ease, background .15s ease, transform .12s ease;
}

    .share-btn:hover {
        color: var(--tint, var(--ink));
        border-color: var(--tint, var(--ink-soft));
        background: var(--tint-soft, var(--surface-2));
        transform: translateY(-1px);
    }

    .share-btn:focus-visible {
        outline: 2px solid var(--tint, var(--gold));
        outline-offset: 2px;
    }

    .share-btn.copied::after {
        content: "Copied";
        position: absolute;
        bottom: calc(100% + 8px);
        left: 50%;
        transform: translateX(-50%);
        background: var(--ink);
        color: #fff;
        font-size: 11px;
        font-weight: 600;
        letter-spacing: .02em;
        padding: 4px 8px;
        border-radius: 6px;
        white-space: nowrap;
        pointer-events: none;
    }

/* ==========================================================================
   Listing: the badge wallet grid
   ========================================================================== */
.wallet {
    max-width: 940px;
    margin: 0 auto;
    padding: 56px 24px 72px;
}

.wallet-head {
    display: flex;
    align-items: baseline;
    gap: 14px;
    margin: 0 0 28px 2px;
    color: #eef1f8;
}

    .wallet-head h1 {
        font-family: var(--font-display);
        font-weight: 600;
        font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.4rem);
        letter-spacing: -0.01em;
        margin: 0;
    }

    .wallet-head .count {
        font-size: 0.82rem;
        font-weight: 600;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: #aeb8d0;
        padding: 4px 10px;
        border: 1px solid rgba(255, 255, 255, 0.16);
        border-radius: 999px;
    }

.badge-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

@media (max-width: 720px) {
    .badge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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

.badge-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    animation: card-in .5s cubic-bezier(.2, .7, .2, 1) both;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

.badge-face {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 22px 16px 16px;
    flex: 1 1 auto;
    transition: transform .18s ease;
}

    .badge-card:hover { box-shadow: var(--shadow-lift); }
    .badge-card:hover .badge-face { transform: translateY(-2px); }

    .badge-face .badge-art {
        margin-bottom: 16px;
    }

.badge-title {
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--ink);
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.badge-earned {
    margin-top: auto;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--ink-soft);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .badge-earned i { color: var(--ink-faint); font-size: 0.72rem; }
    .badge-earned.is-expired,
    .badge-earned.is-expired i { color: #c0392b; }

.badge-card .share-row {
    justify-content: center;
    padding: 12px 16px;
    border-top: 1px solid var(--hairline);
    background: var(--surface-2);
}

.wallet-empty {
    max-width: 520px;
    margin: 80px auto;
    text-align: center;
    color: #dfe4f0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius);
    padding: 44px 28px;
}

    .wallet-empty i { font-size: 2rem; color: #9aa4c0; margin-bottom: 12px; display: block; }

/* ==========================================================================
   Detail: the single credential
   ========================================================================== */
.credential {
    max-width: 720px;
    margin: 56px auto 72px;
    background: var(--surface);
    border-radius: 22px;
    box-shadow: var(--shadow-lift);
    overflow: hidden;
}

.credential-band {
    height: 6px;
    background: linear-gradient(90deg, var(--tint, var(--gold)), color-mix(in srgb, var(--tint, var(--gold)) 45%, #fff));
}

.credential-body { padding: 36px 40px 40px; }

.credential-top {
    display: flex;
    gap: 28px;
    align-items: center;
}

    .credential-top .badge-art {
        width: 168px;
        border-radius: 12px;
    }

.credential-meta { min-width: 0; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 10px;
}

    .eyebrow i { font-size: 0.85rem; }

.credential h1 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem);
    line-height: 1.1;
    letter-spacing: -0.015em;
    color: var(--ink);
    margin: 0 0 8px;
}

.credential .holder {
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
}

.credential-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    margin: 22px 0 0;
    padding: 18px 0 0;
    border-top: 1px solid var(--hairline);
}

.date-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

    .date-item .label {
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--ink-faint);
    }

    .date-item .value {
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--ink);
    }

    .date-item .value .expired {
        color: #c0392b;
        font-weight: 700;
        margin-left: 4px;
    }

.credential-desc {
    margin: 22px 0 0;
    color: var(--ink-soft);
    font-size: 0.96rem;
    line-height: 1.65;
}

    .credential-desc p { margin: 0 0 0.8em; }

.credential-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 26px 0 0;
    padding: 20px 0 0;
    border-top: 1px solid var(--hairline);
}

    .credential-actions .actions-label {
        font-size: 0.8rem;
        font-weight: 600;
        color: var(--ink-faint);
    }

@media (max-width: 560px) {
    .credential-body { padding: 28px 22px 30px; }
    .credential-top { flex-direction: column; text-align: center; align-items: center; gap: 18px; }
    .credential-dates { justify-content: center; }
    .credential-actions { flex-direction: column; align-items: stretch; }
    .credential-actions .share-row { justify-content: center; }
}
