/* Organism: sección tesis + grafo embebido */

.ca-thesis {
    padding: var(--sp-8) var(--sp-6) var(--sp-6);
    max-width: 1280px;
    margin: 0 auto;
    border-top: 1px solid var(--border);
}

/* ── v3: prosa contenida + instrumento full-bleed ── */

.ca-thesis--v3 {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--border);
}

.ca-thesis--v3 .ca-thesis__prose {
    max-width: 1280px;
    margin: 0 auto;
    padding: var(--sp-8) var(--sp-6) var(--sp-4);
}

.ca-thesis--v3 .ca-thesis__prose--footer {
    padding-top: var(--sp-4);
    padding-bottom: var(--sp-8);
}

.ca-thesis--v3 .ca-thesis__instrument {
    width: 100%;
    max-width: none;
    margin: 0;
}

.ca-thesis--v3 .ca-thesis__mount {
    border-radius: 0;
    width: 100%;
    min-height: clamp(420px, 75vh, 820px);
}

.ca-thesis__formula {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
    margin-bottom: var(--sp-4);
}

.ca-thesis__formula-expr {
    color: var(--etica);
    font-size: 14px;
    margin-left: var(--sp-2);
}

.ca-thesis__mount {
    position: relative;
    min-height: 480px;
    border-radius: var(--r-lg);
    overflow: hidden;
    background: var(--s1);
}

.ca-thesis__mount.is-loading .ca-thesis__skeleton {
    display: flex;
}

.ca-thesis__skeleton {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 480px;
    gap: var(--sp-4);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 12px;
}

.ca-thesis__skeleton-bar {
    width: 48px;
    height: 48px;
    border: 2px solid var(--border);
    border-top-color: var(--etica);
    border-radius: 50%;
    animation: ca-spin 0.8s linear infinite;
}

@keyframes ca-spin {
    to { transform: rotate(360deg); }
}

.ca-thesis__status {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--dim);
    margin-top: var(--sp-3);
    min-height: 1.2em;
}

.ca-thesis__cta {
    margin-top: var(--sp-4);
    font-size: 14px;
}

.ca-thesis__cta a {
    color: var(--etica);
}

/* Grafo embebido — override fullscreen graph.css */

#graph-mode-section.ca-graph--embedded {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 72vh;
    max-height: 85vh;
    overflow: hidden;
    background: var(--color-bg, #0d0d0d);
    border-radius: var(--r-lg);
}

#graph-mode-section.ca-graph--embedded.ca-graph--v3 {
    width: 100%;
    min-width: 100%;
    min-height: clamp(420px, 75vh, 820px);
    max-height: none;
    border-radius: 0;
    border-top: 1px solid var(--color-border, #2e2e2e);
    border-bottom: 1px solid var(--color-border, #2e2e2e);
}

#graph-mode-section.ca-graph--v3 .ca-toolbar {
    width: 100%;
    padding-left: clamp(var(--sp-4), 3vw, var(--sp-8));
    padding-right: clamp(var(--sp-4), 3vw, var(--sp-8));
}

#graph-mode-section.ca-graph--embedded .ca-graph-area {
    flex: 1;
    min-height: 0;
    width: 100%;
}

#graph-mode-section.ca-graph--v3 .ca-graph-area {
    min-height: clamp(360px, 68vh, 760px);
    width: 100%;
}

#graph-mode-section.ca-graph--embedded .ca-graph-canvas {
    min-height: 420px;
}

#graph-mode-section.ca-graph--v3 .ca-graph-canvas {
    flex: 1;
    min-height: 0;
    width: 100%;
}

@media (min-width: 1024px) {
    #graph-mode-section.ca-graph--v3 .ca-toolbar__row--filters {
        flex-wrap: nowrap;
    }

    #graph-mode-section.ca-graph--v3 .ca-toolbar__row--field .ca-field-filter {
        flex-wrap: nowrap;
    }
}

@media (max-width: 768px) {
    .ca-thesis {
        padding: var(--sp-6) var(--sp-4);
    }

    .ca-thesis--v3 .ca-thesis__prose,
    .ca-thesis--v3 .ca-thesis__prose--footer {
        padding-left: var(--sp-4);
        padding-right: var(--sp-4);
    }

    .ca-thesis--v3 .ca-thesis__mount {
        min-height: 65vh;
    }

    #graph-mode-section.ca-graph--embedded {
        min-height: 65vh;
        max-height: none;
    }

    #graph-mode-section.ca-graph--embedded.ca-graph--v3 {
        min-height: 65vh;
    }

    #graph-mode-section.ca-graph--embedded .ca-toolbar {
        flex-wrap: wrap;
        gap: var(--sp-2);
    }
}