/* =========================================================
   NOESOR · DENSIDAD DE CONTENIDO
   Divulgación progresiva, colecciones paginadas y tarjetas
   compactas para evitar páginas excesivamente largas.
   ========================================================= */

.noesor-compact-section {
    min-width: 0;
    margin: 14px 0;
}

.noesor-compact-section > summary {
    min-height: 76px;
    padding: 15px 17px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 13px;
    list-style: none;
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: 17px;
    color: var(--text);
    background:
        radial-gradient(circle at 90% 0, rgba(139, 92, 246, .08), transparent 32%),
        linear-gradient(145deg, rgba(17, 35, 59, .9), rgba(7, 18, 33, .96));
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.noesor-compact-section > summary::-webkit-details-marker { display: none; }
.noesor-compact-section > summary::marker { content: ""; }

.noesor-compact-section > summary:hover,
.noesor-compact-section > summary:focus-visible {
    border-color: var(--border-hover);
    background:
        radial-gradient(circle at 90% 0, rgba(139, 92, 246, .13), transparent 35%),
        linear-gradient(145deg, rgba(20, 42, 70, .94), rgba(8, 21, 38, .98));
}

.noesor-compact-section[open] > summary {
    border-color: rgba(96, 165, 250, .34);
    border-radius: 17px 17px 13px 13px;
}

.noesor-compact-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(96, 165, 250, .22);
    border-radius: 11px;
    color: var(--primary-light);
    background: rgba(37, 99, 235, .1);
    font-size: .92rem;
    font-weight: 800;
}

.noesor-compact-heading {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.noesor-compact-heading small {
    color: #a78bfa;
    font-size: .62rem;
    font-weight: 850;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.noesor-compact-heading strong {
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    font-size: .96rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.noesor-compact-heading > span {
    min-width: 0;
    overflow: hidden;
    color: var(--text-muted);
    font-size: .75rem;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.noesor-compact-badge {
    padding: 6px 9px;
    border: 1px solid rgba(139, 92, 246, .25);
    border-radius: 999px;
    color: #ddd6fe;
    background: rgba(139, 92, 246, .1);
    font-size: .68rem;
    font-weight: 800;
    white-space: nowrap;
}

.noesor-compact-chevron {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, .035);
    transition: transform .18s ease, color .18s ease;
}

.noesor-compact-section[open] > summary .noesor-compact-chevron {
    transform: rotate(180deg);
    color: var(--primary-light);
}

.noesor-compact-body {
    min-width: 0;
    margin-top: 10px;
    animation: noesor-compact-enter .2s ease-out both;
}

@keyframes noesor-compact-enter {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.noesor-compact-body > :first-child { margin-top: 0 !important; }
.noesor-compact-body > :last-child { margin-bottom: 0 !important; }

.noesor-collection-footer {
    margin-top: 18px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    color: var(--text-muted);
    background: rgba(7, 17, 31, .56);
}

.noesor-collection-footer > span {
    font-size: .75rem;
    font-weight: 750;
}

.noesor-collection-footer .button {
    min-height: 38px;
    padding: 8px 14px;
}

/* Las descripciones extensas se resumen en las vistas de colección. */
.project-card-main p,
.shared-page .project-card p,
.integration-card p,
.history-card-main p,
.analysis-history-card .analysis-source-name,
.pricing-card > p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

/* Los detalles del análisis se convierten en índices visuales compactos. */
.results-content {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
}

.results-content > .noesor-compact-section {
    margin: 0;
}

.results-content > .noesor-compact-section[open] {
    grid-column: 1 / -1;
}

.analysis-secondary-index,
.analysis-compact-index {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 12px;
    margin-top: 14px;
}

.analysis-secondary-index > .noesor-compact-section,
.analysis-compact-index > .noesor-compact-section {
    margin: 0;
}

.analysis-secondary-index > .noesor-compact-section[open],
.analysis-compact-index > .noesor-compact-section[open] {
    grid-column: 1 / -1;
}

.results-content > .noesor-compact-section:first-child { margin-top: 0; }
.results-content .noesor-compact-body > .result-panel { margin: 0; }
.analysis-read-page .noesor-compact-body > section,
.analysis-read-page .noesor-compact-body > .analysis-read-grid { margin: 0; }

/* Backlog: cada historia despliega sus criterios solo bajo demanda. */
.compact-story-card > summary {
    list-style: none;
    cursor: pointer;
}

.compact-story-card > summary::-webkit-details-marker { display: none; }
.compact-story-card > summary::marker { content: ""; }
.compact-story-card > summary::after {
    content: "⌄";
    margin-left: auto;
    color: var(--text-muted);
    transition: transform .18s ease;
}
.compact-story-card[open] > summary::after { transform: rotate(180deg); }
.compact-story-body { margin-top: 14px; }

/* Exploradores técnicos: solo el objeto elegido despliega sus campos. */
.database-tree-table-disclosure {
    overflow: hidden;
}

.database-tree-table-disclosure > summary {
    padding: 9px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    list-style: none;
    cursor: pointer;
}

.database-tree-table-disclosure > summary::-webkit-details-marker { display: none; }
.database-tree-table-disclosure > summary::marker { content: ""; }
.database-tree-table-disclosure[open] > summary {
    border-bottom: 1px solid var(--border-soft);
}

.relational-table-disclosure > summary {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    list-style: none;
    cursor: pointer;
}

.relational-table-disclosure > summary::-webkit-details-marker { display: none; }
.relational-table-disclosure > summary::marker { content: ""; }
.relational-table-disclosure[open] > summary {
    border-bottom: 1px solid var(--border-soft);
}

@media (max-width: 760px) {
    .results-content,
    .analysis-secondary-index,
    .analysis-compact-index {
        grid-template-columns: 1fr;
    }

    .noesor-compact-section > summary {
        grid-template-columns: auto minmax(0, 1fr) auto;
        min-height: 68px;
        padding: 13px;
    }

    .noesor-compact-badge { display: none; }
    .noesor-compact-heading > span { white-space: normal; }
    .noesor-compact-heading strong { white-space: normal; }

    .noesor-collection-footer {
        align-items: stretch;
        flex-direction: column;
        text-align: center;
    }

    .noesor-collection-footer .button { width: 100%; justify-content: center; }
}
