/* =========================================================
   INSIGNIAS REALES DE CREDLY
========================================================= */

.badges-section-description {
    max-width: 590px;
    margin-top: 19px;

    color: var(--text-secondary);

    font-size: 0.88rem;
    line-height: 1.75;
}

.badges-open-button {
    appearance: none;

    border: 0;

    font: inherit;
    cursor: pointer;
}

.badges-featured-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.badge-card-real {
    position: relative;

    display: flex;
    align-items: stretch;
    flex-direction: column;

    min-width: 0;
    min-height: 340px;
    padding: 22px;

    overflow: hidden;

    color: var(--text);
    background:
        linear-gradient(
            155deg,
            var(--surface-solid),
            color-mix(
                in srgb,
                var(--accent-soft) 28%,
                var(--surface-solid)
            )
        );

    text-align: left;
    text-decoration: none;

    isolation: isolate;
}

.badge-card-real::before {
    content: "";

    position: absolute;
    z-index: -1;
    top: -90px;
    right: -90px;

    width: 210px;
    height: 210px;

    border-radius: 50%;

    background: var(--accent-soft);
    filter: blur(12px);

    opacity: 0.7;
}

.badge-image-frame {
    display: grid;
    place-items: center;

    width: 100%;
    min-height: 185px;
    padding: 10px;
    margin-bottom: 20px;

    border: 1px solid color-mix(
        in srgb,
        var(--border) 78%,
        transparent
    );
    border-radius: 19px;

    background:
        radial-gradient(
            circle at 50% 44%,
            color-mix(
                in srgb,
                var(--accent-soft) 42%,
                transparent
            ),
            transparent 72%
        ),
        color-mix(
            in srgb,
            var(--surface-soft) 88%,
            transparent
        );
}

.badge-image {
    display: block;

    width: 150px;
    height: 150px;

    object-fit: contain;

    filter: drop-shadow(
        0 14px 20px rgba(0, 0, 0, 0.12)
    );

    transition:
        transform 280ms cubic-bezier(.22,1,.36,1);
}

.badge-card-real:hover .badge-image {
    transform: scale(1.045);
}

.badge-card-content {
    display: flex;
    align-items: flex-start;
    flex: 1;
    flex-direction: column;

    min-width: 0;
}

.badge-issuer {
    margin-bottom: 8px;

    color: var(--accent);

    font-size: 0.63rem;
    font-weight: 780;
    line-height: 1.35;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.badge-card-real h3 {
    margin: 0;

    font-size: 0.96rem;
    line-height: 1.35;
    letter-spacing: -0.025em;
}

.badge-distinction {
    display: inline-flex;
    align-items: center;

    min-height: 26px;
    padding: 5px 10px;
    margin-top: 14px;

    border: 1px solid var(--border);
    border-radius: 999px;

    color: var(--text-secondary);
    background: var(--surface-soft);

    font-size: 0.61rem;
    font-weight: 720;
}

.badge-link-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;

    width: 100%;
    margin-top: auto;
    padding-top: 18px;

    color: var(--text-secondary);

    font-size: 0.67rem;
    font-weight: 700;
}

.badge-link-hint > span:last-child {
    color: var(--accent);
}

/* =========================================================
   DIÁLOGO CON LAS 28 INSIGNIAS
========================================================= */

body.badges-dialog-open {
    overflow: hidden;
}

.badges-dialog {
    width: min(calc(100% - 28px), 1180px);
    height: min(90vh, 880px);
    max-width: none;
    max-height: none;
    padding: 0;
    overflow: hidden;

    border: 1px solid var(--border);
    border-radius: 30px;

    color: var(--text);
    background: var(--surface-solid);

    box-shadow:
        0 50px 160px rgba(0, 0, 0, 0.35);
}

.badges-dialog::backdrop {
    background: rgba(8, 9, 13, 0.7);

    backdrop-filter: blur(13px);
    -webkit-backdrop-filter: blur(13px);
}

.badges-dialog-layout {
    position: relative;

    height: 100%;
    padding:
        clamp(28px, 4vw, 46px)
        clamp(20px, 4vw, 46px);

    overflow-y: auto;
    overscroll-behavior: contain;

    scrollbar-width: none;
}

.badges-dialog-layout::-webkit-scrollbar {
    display: none;
}

.badges-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 30px;

    padding-right: 64px;
}

.badges-dialog-header h2 {
    margin-top: 8px;

    font-size: clamp(2.5rem, 6vw, 4.7rem);
    line-height: 0.96;
    letter-spacing: -0.065em;
}

.badges-dialog-description {
    max-width: 620px;
    margin-top: 16px;

    color: var(--text-secondary);

    font-size: 0.88rem;
    line-height: 1.75;
}

.badges-dialog-close {
    position: fixed;
    top: max(28px, calc(5vh + 8px));
    right: max(
        28px,
        calc((100vw - min(1180px, calc(100vw - 28px))) / 2 + 22px)
    );

    z-index: 20;
}

.badges-dialog-count {
    display: inline-flex;
    align-items: center;

    min-height: 31px;
    padding: 6px 12px;
    margin: 28px 0 20px;

    border: 1px solid var(--border);
    border-radius: 999px;

    color: var(--text-secondary);
    background: var(--surface-soft);

    font-size: 0.66rem;
    font-weight: 720;
}

.badges-all-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;

    padding-bottom: 6px;
}

.badges-all-grid .badge-card-real {
    min-height: 292px;
    padding: 18px;

    box-shadow: none;
}

.badges-all-grid .badge-image-frame {
    min-height: 150px;
    margin-bottom: 16px;
}

.badges-all-grid .badge-image {
    width: 122px;
    height: 122px;
}

.badges-all-grid .badge-card-real h3 {
    font-size: 0.84rem;
}

.badges-all-grid .badge-issuer {
    font-size: 0.57rem;
}

/* =========================================================
   RESPONSIVE DE INSIGNIAS
========================================================= */

@media (max-width: 1020px) {
    .badges-featured-grid,
    .badges-all-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 780px) {
    .badges-featured-grid,
    .badges-all-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .badge-card-real {
        min-height: 320px;
    }

    .badges-dialog {
        width: calc(100% - 16px);
        height: calc(100vh - 16px);

        border-radius: 22px;
    }

    .badges-dialog-close {
        top: 22px;
        right: 22px;
    }
}

@media (max-width: 520px) {
    .badges-featured-grid {
        grid-template-columns: 1fr;
    }

    .badges-all-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .badge-card-real {
        min-height: 0;
    }

    .badge-image-frame {
        min-height: 180px;
    }

    .badges-all-grid .badge-card-real {
        min-height: 250px;
        padding: 13px;
        border-radius: 18px;
    }

    .badges-all-grid .badge-image-frame {
        min-height: 116px;
        padding: 5px;
        border-radius: 14px;
    }

    .badges-all-grid .badge-image {
        width: 94px;
        height: 94px;
    }

    .badges-all-grid .badge-card-real h3 {
        font-size: 0.72rem;
    }

    .badges-all-grid .badge-distinction {
        padding: 4px 7px;
        font-size: 0.52rem;
    }

    .badges-dialog-layout {
        padding: 26px 14px 30px;
    }

    .badges-dialog-header {
        padding-right: 48px;
    }

    .badges-dialog-header h2 {
        font-size: clamp(2.4rem, 13vw, 3.6rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    .badge-image {
        transition: none;
    }
}
/* =========================================================
   LAYOUT DEL ENCABEZADO DE INSIGNIAS
   El espaciado entre líneas se hereda de styles.css.
========================================================= */

.badges-section-heading {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(28px, 4vw, 56px);
}

.badges-section-heading > div {
    min-width: 0;
}

.badges-section-heading h2 {
    width: 100%;
    max-width: 860px;

    font-size: clamp(3rem, 5.1vw, 5.2rem);
}

.badges-section-heading .badges-section-description {
    max-width: 690px;
    margin-top: 24px;
}

.badges-section-heading .badges-open-button {
    justify-self: end;

    white-space: nowrap;
}

@media (min-width: 1080px) {
    .badges-section-heading .heading-main,
    .badges-section-heading .heading-accent {
        white-space: nowrap;
    }
}

@media (max-width: 1079px) {
    .badges-section-heading {
        grid-template-columns: 1fr;
        align-items: start;
        gap: 24px;
    }

    .badges-section-heading .badges-open-button {
        justify-self: start;
    }

    .badges-section-heading .heading-main,
    .badges-section-heading .heading-accent {
        white-space: normal;
    }
}

@media (max-width: 640px) {
    .badges-section-heading h2 {
        max-width: 100%;

        font-size: clamp(2.7rem, 12vw, 3.8rem);
    }

    .badges-section-heading .badges-section-description {
        margin-top: 19px;
    }
}
