/* ── Atlas de Embriologia — leitor de estágios ─────────────────────────────
   Mesma moldura "quadro emoldurado" do Atlas de Anatomia (av-frame), mas
   aqui a imagem carrega marcadores clicáveis (.ev-hotspot) em vez de
   máscaras de teste — cada estrutura já vem rotulada na própria imagem;
   o marcador só existe pra dar uma área de toque e revelar o painel de
   detalhes (quando/como se forma + função). */
:root {
    --ev-gold: #E8C468;
    --ev-mat: #EFE9DC;
    /* mesma paleta accent-green/gold de css/atlas-viewer.css, família Atlas */
}
[data-theme="light"] { --ev-mat: #F7F3E8; }

.ev-reader {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 900px) {
    .ev-reader { grid-template-columns: 1fr; }
}

.ev-frame {
    background: var(--ev-mat);
    border-radius: 6px;
    padding: 1rem;
    box-shadow:
        0 0 0 1px rgba(232,196,104,0.55),
        0 0 0 6px #0B2B26,
        0 0 0 7px rgba(232,196,104,0.4),
        0 20px 44px rgba(0,0,0,0.35);
}
.ev-stage {
    position: relative;
    width: 100%;
    line-height: 0;
}
.ev-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 3px;
}

.ev-hotspot {
    position: absolute;
    background: transparent;
    border: 1.5px dashed transparent;
    border-radius: 5px;
    cursor: pointer;
    padding: 0;
    transition: background 0.18s, border-color 0.18s;
}
.ev-hotspot:hover,
.ev-hotspot:focus-visible {
    background: rgba(78,204,163,0.14);
    border-color: rgba(78,204,163,0.55);
    outline: none;
}
.ev-hotspot.ev-active {
    background: rgba(78,204,163,0.22);
    border-color: rgba(78,204,163,0.8);
}
.ev-hotspot-dot {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #31A36B;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.85), 0 1px 4px rgba(0,0,0,0.4);
    animation: ev-pulse 2.4s ease-in-out infinite;
}
.ev-hotspot.ev-active .ev-hotspot-dot { background: var(--ev-gold); animation: none; }
@keyframes ev-pulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(255,255,255,0.85), 0 1px 4px rgba(0,0,0,0.4); }
    50% { box-shadow: 0 0 0 4px rgba(78,204,163,0.35), 0 1px 4px rgba(0,0,0,0.4); }
}

/* ── Painel lateral: descrição da página + progresso de estágios ── */
.ev-side {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.ev-page-card {
    background: rgba(var(--rgb-med-dark), 0.5);
    border: 1px solid rgba(var(--rgb-light), 0.12);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.2rem;
}
.ev-page-period {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(78,204,163,0.9);
    background: rgba(78,204,163,0.12);
    border: 1px solid rgba(78,204,163,0.3);
    border-radius: 20px;
    padding: 0.2rem 0.7rem;
    margin-bottom: 0.6rem;
}
.ev-page-title {
    font-family: var(--font-heading);
    font-size: var(--text-lg);
    color: var(--color-lightest);
    margin-bottom: 0.5rem;
}
.ev-page-desc {
    font-size: var(--text-sm);
    line-height: 1.55;
    color: rgba(var(--rgb-light), 0.8);
}
.ev-page-hint {
    margin-top: 0.9rem;
    font-size: var(--text-xs);
    color: rgba(var(--rgb-light), 0.5);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ── Painel de detalhe da estrutura (dentro do ev-side no desktop) ── */
.ev-detail {
    background: rgba(var(--rgb-med-dark), 0.65);
    border: 1px solid rgba(78,204,163,0.35);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.2rem;
    display: none;
}
.ev-detail.show { display: block; }
.ev-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.7rem;
}
.ev-detail-title {
    font-family: var(--font-heading);
    font-size: var(--text-base);
    color: var(--color-lightest);
    font-weight: var(--weight-semibold);
}
.ev-detail-close {
    background: transparent;
    border: none;
    color: rgba(var(--rgb-light), 0.55);
    cursor: pointer;
    padding: 0.15rem;
    line-height: 0;
    flex-shrink: 0;
    transition: color 0.2s;
}
.ev-detail-close:hover { color: var(--color-lightest); }
.ev-detail-block { margin-bottom: 0.8rem; }
.ev-detail-block:last-child { margin-bottom: 0; }
.ev-detail-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ev-gold, #E8C468);
    margin-bottom: 0.2rem;
}
.ev-detail-text {
    font-size: var(--text-sm);
    line-height: 1.55;
    color: rgba(var(--rgb-light), 0.85);
}

/* No mobile o painel de detalhe vira bottom sheet, pra não empurrar a
   imagem pra fora da tela quando o aluno toca numa estrutura. */
@media (max-width: 900px) {
    .ev-detail {
        display: none;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 650;
        border-radius: 16px 16px 0 0;
        max-height: 60vh;
        overflow-y: auto;
        box-shadow: 0 -12px 40px rgba(0,0,0,0.5);
        background: var(--color-dark, #0B2B26);
        border: 1px solid rgba(78,204,163,0.35);
        border-bottom: none;
        padding: 1.2rem 1.3rem calc(1.2rem + env(safe-area-inset-bottom));
    }
    .ev-detail.show { display: block; animation: ev-sheet-in 0.22s ease; }
    .ev-detail-backdrop {
        display: none;
        position: fixed; inset: 0; z-index: 640;
        background: rgba(1,18,17,0.6);
    }
    .ev-detail-backdrop.show { display: block; }
    @keyframes ev-sheet-in {
        from { transform: translateY(16px); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }
}

/* ── Paginação (estágios do desenvolvimento) ── */
.ev-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.1rem;
}
.ev-pager-btn {
    background: rgba(var(--rgb-med-dark), 0.75);
    border: 1px solid rgba(var(--rgb-light), 0.25);
    color: var(--color-lightest);
    border-radius: 50%;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, opacity 0.2s;
}
.ev-pager-btn:hover { background: rgba(78,204,163,0.25); border-color: rgba(78,204,163,0.5); }
.ev-pager-btn:disabled { opacity: 0.35; cursor: default; pointer-events: none; }
.ev-pager-dots {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.ev-pager-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: rgba(var(--rgb-light), 0.25);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, transform 0.2s;
}
.ev-pager-dot.active {
    background: var(--ev-gold, #E8C468);
    transform: scale(1.3);
}

@media (max-width: 560px) {
    .ev-frame { padding: 0.6rem; border-radius: 5px; }
    .ev-hotspot-dot { width: 12px; height: 12px; top: -5px; left: -5px; }
}
