.page-references {
    width: 100%;
    padding-bottom: clamp(60px, 10vw, 120px);
}

.references__inner {
    width: min(90%, 1900px);
    margin: 0 auto;
    display: grid;
    gap: clamp(32px, 6vw, 48px);
}

.references-panel {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: clamp(24px, 4vw, 40px);
    align-items: start;
}

.references-panel--single {
    grid-template-columns: minmax(0, 1fr);
}

.references-panel__cards {
    display: grid;
    gap: 14px;
}

.reference-card {
    width: 100%;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 20px;
    background: #ffffff;
    padding: 20px 22px;
    text-align: left;
    display: grid;
    gap: 8px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.05);
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
    cursor: pointer;
}

.reference-card:hover,
.reference-card:focus-visible {
    border-color: rgba(0, 91, 150, 0.3);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
    outline: none;
}

.reference-card.is-active {
    border-color: rgba(0, 91, 150, 0.45);
    box-shadow: 0 20px 48px rgba(0, 91, 150, 0.14);
}

.reference-card__title {
    font-size: clamp(1rem, 2vw, 1.15rem);
    font-weight: 600;
    line-height: 1.3;
    color: #111827;
}

.reference-card__description {
    font-size: 0.95rem;
    line-height: 1.55;
    color: #4b5563;
}

.references-panel__content {
    min-width: 0;
}

.references-panel__content--full {
    grid-column: 1 / -1;
}

.reference-content {
    border-radius: 28px;
    background: #ffffff;
    padding: clamp(24px, 4vw, 40px);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.reference-content__header {
    display: grid;
    gap: 10px;
    margin-bottom: 24px;
}

.reference-content__title {
    margin: 0;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    line-height: 1.05;
    color: #111827;
}

.reference-content__description {
    margin: 0;
    max-width: 72ch;
    font-size: 1rem;
    line-height: 1.7;
    color: #4b5563;
}

.reference-content__body {
    min-width: 0;
    color: #1f2937;
    line-height: 1.7;
}

.reference-content__body > :first-child {
    margin-top: 0;
}

.reference-content__body > :last-child {
    margin-bottom: 0;
}

.reference-content__body h1,
.reference-content__body h2,
.reference-content__body h3,
.reference-content__body h4,
.reference-content__body h5,
.reference-content__body h6 {
    margin: 1.5em 0 0.6em;
    color: #111827;
    line-height: 1.2;
}

.reference-content__body p,
.reference-content__body ul,
.reference-content__body ol,
.reference-content__body table,
.reference-content__body blockquote {
    margin: 0 0 1.1em;
}

.reference-content__body ul,
.reference-content__body ol {
    padding-left: 1.3rem;
}

.reference-content__body strong,
.reference-content__body b {
    color: #111827;
}

.reference-content__body a {
    color: #005b96;
}

/* Scroll wrapper simulado con overflow en el propio table */
.reference-content__body table {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    border-collapse: collapse;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 10px;
    font-size: 0.9rem;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

/* Título centrado antes de la tabla (ej. <p><strong>TÍTULO</strong></p>) */
.reference-content__body table caption {
    caption-side: top;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #1f2937;
    padding: 10px 14px 8px;
}

/* Encabezados con color primario de marca */
.reference-content__body th {
    background: var(--color-primary);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 12px 16px;
    text-align: center;
    vertical-align: middle;
    border: 1px solid rgba(255, 255, 255, 0.15);
    white-space: nowrap;
}

/* Celdas de cuerpo */
.reference-content__body td {
    padding: 10px 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    vertical-align: middle;
    color: #374151;
    font-size: 0.88rem;
    line-height: 1.5;
}

/* Filas alternas para legibilidad */
.reference-content__body tbody tr:nth-child(even) td {
    background-color: #f9fafb;
}

/* Hover sutil en filas */
.reference-content__body tbody tr:hover td {
    background-color: rgba(179, 47, 65, 0.04);
}

/* Texto en negrita que actúa como título de tabla (ej. <p><strong>TÍTULO</strong></p>) */
.reference-content__body p:has(> strong:only-child),
.reference-content__body p:has(> b:only-child) {
    text-align: center;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #1f2937;
    margin-bottom: 10px;
}

.references-empty {
    padding: 28px 32px;
    border-radius: 24px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.05);
    color: #6b7280;
}

@media (max-width: 960px) {
    .references-panel {
        grid-template-columns: 1fr;
    }

    .references-panel__cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .reference-card {
        padding: 18px;
        border-radius: 18px;
    }

    .reference-content {
        padding: 20px;
        border-radius: 22px;
    }

    .reference-content__body table {
        font-size: 0.82rem;
    }

    .reference-content__body th {
        font-size: 0.72rem;
        padding: 10px 12px;
    }

    .reference-content__body td {
        font-size: 0.82rem;
        padding: 8px 12px;
    }
}

@media (min-width: 1025px) and (max-width: 1440px) and (max-height: 780px) {
    .page-references {
        padding-bottom: 72px;
    }

    .references__inner {
        gap: 32px;
    }

    .references-panel {
        gap: 28px;
    }

    .reference-card {
        padding: 18px 20px;
        border-radius: 18px;
    }

    .reference-card__title {
        font-size: 1.05rem;
    }

    .reference-card__description {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .reference-content {
        padding: 28px;
        border-radius: 22px;
    }

    .reference-content__header {
        margin-bottom: 20px;
    }

    .reference-content__title {
        font-size: 2.1rem;
    }

    .reference-content__description,
    .reference-content__body {
        font-size: 0.96rem;
        line-height: 1.6;
    }
}
