/* ════════════════════════════════
   ÁRBOL FAMILIAR — estilos propios
════════════════════════════════ */

.arbol-page {
    min-height: 100vh;
    padding: 0 0 6rem;
    position: relative;
    background:
        radial-gradient(ellipse 90% 60% at 50% 10%, #3d2010 0%, #1a0a08 55%, #0d0503 100%);
    overflow-x: hidden;
}

.arbol-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.arbol-page::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: repeating-linear-gradient(-45deg,
            transparent 0px, transparent 80px,
            rgba(212, 175, 55, 0.012) 80px, rgba(212, 175, 55, 0.012) 81px);
    pointer-events: none;
    z-index: 0;
}

/* ── Cabecera ── */
.arbol-header {
    text-align: center;
    padding: 5.5rem 2rem 2.5rem;
    position: relative;
    z-index: 2;
}

.arbol-eyebrow {
    font-family: 'DM Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.5em;
    text-transform: uppercase;
    color: var(--gold);
    display: block;
    margin-bottom: 1rem;
    opacity: 0;
    animation: fadeUp 0.8s ease forwards 0.2s;
}

.arbol-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.2rem, 7vw, 4.5rem);
    font-weight: 400;
    color: var(--sepia-light);
    line-height: 1.1;
    opacity: 0;
    animation: fadeUp 0.9s ease forwards 0.4s;
}

.arbol-title em {
    color: var(--rose);
    font-style: italic;
}

.arbol-divider {
    width: 60px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--gold), transparent);
    margin: 1.8rem auto 0;
    opacity: 0;
    animation: fadeUp 0.8s ease forwards 0.7s;
}

/* ════════════════════════════════
   ÁRBOL — layout SVG-like con CSS Grid
════════════════════════════════ */
.arbol-wrap {
    position: relative;
    z-index: 2;
    max-width: 560px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ── Generación ── */
.gen {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    position: relative;
}

/* ── Conectores verticales ── */
.conector-v {
    width: 2px;
    background: linear-gradient(to bottom, rgba(212, 175, 55, 0.65), rgba(212, 175, 55, 0.15));
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.conector-v--dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--rose);
    box-shadow: 0 0 10px rgba(200, 86, 106, 0.6);
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* ── Conector horizontal entre abuelos maternos ── */
.conector-h {
    height: 2px;
    background: linear-gradient(to right, rgba(212, 175, 55, 0.4), rgba(212, 175, 55, 0.6), rgba(212, 175, 55, 0.4));
    width: 20px;
    flex-shrink: 0;
    /* Alineado al centro exacto del círculo de 68px: margin-top = 34px (borde sup del nodo) */
    align-self: flex-start;
    margin-top: 34px;
}

/* ── Conector boda (Aita ↔ Ama) ── */
.boda-conector {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-shrink: 0;
    /* Alinear verticalmente al centro del círculo de Aita (68px) → 34px - altura_propia/2 */
    margin-top: 14px;
}

.boda-linea {
    width: 100px;
    height: 2px;
    background: linear-gradient(to right, rgba(212, 175, 55, 0.3), rgba(200, 86, 106, 0.5), rgba(212, 175, 55, 0.3));
}

.boda-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(200, 86, 106, 0.08);
    border: 1px solid rgba(200, 86, 106, 0.28);
    border-radius: 20px;
    padding: 3px 9px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.65rem;
    font-style: italic;
    letter-spacing: 0.06em;
    color: rgb(255 142 162 / 80%);
    white-space: nowrap;
}

/* ════════════════════════════════
   NODOS
════════════════════════════════ */
.nodo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    position: relative;
    padding: 0 8px;
    -webkit-tap-highlight-color: transparent;
}

/* Foto / avatar */
.nodo-foto {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: 2px solid rgba(196, 164, 124, 0.3);
    overflow: hidden;
    background: #2a1008;
    position: relative;
    transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s cubic-bezier(0.34, 1.3, 0.64, 1);
    box-shadow: 0 0 0 1px rgba(196, 164, 124, 0.08), 0 4px 18px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

.nodo:hover .nodo-foto,
.nodo:focus .nodo-foto {
    border-color: var(--rose);
    box-shadow:
        0 0 0 2px rgba(200, 86, 106, 0.22),
        0 0 18px rgba(200, 86, 106, 0.18),
        0 6px 24px rgba(0, 0, 0, 0.5);
    transform: translateY(-3px) scale(1.04);
}

.nodo-foto img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(0.2) brightness(0.9);
    transition: filter 0.3s;
}

.nodo:hover .nodo-foto img {
    filter: sepia(0) brightness(1);
}

/* Inicial — placeholder */
.nodo-inicial {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Playfair Display', serif;
    font-size: 1.65rem;
    font-style: italic;
    color: var(--rose);
    text-shadow: 0 0 18px rgba(200, 86, 106, 0.35);
    line-height: 1;
}

.nodo-nombre {
    font-family: 'Playfair Display', serif;
    font-size: 0.72rem;
    color: var(--sepia-light);
    text-align: center;
    line-height: 1.3;
    max-width: 76px;
    letter-spacing: 0.01em;
    min-height: 2em;
}

.nodo-rol {
    font-family: 'DM Mono', monospace;
    font-size: 0.5rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(196, 164, 124, 0.45);
    text-align: center;
    max-width: 80px;
    min-height: 1.2em;
}

/* ── Ama — protagonista ── */
.nodo--ama .nodo-foto {
    width: 90px;
    height: 90px;
    border-color: var(--rose);
    box-shadow:
        0 0 0 2px rgba(200, 86, 106, 0.18),
        0 0 28px rgba(200, 86, 106, 0.18),
        0 6px 28px rgba(0, 0, 0, 0.6);
    animation: amaGlow 3s ease-in-out infinite;
}

.nodo--ama .nodo-inicial {
    font-size: 2.1rem;
}

.nodo--ama:hover .nodo-foto {
    box-shadow:
        0 0 0 3px rgba(200, 86, 106, 0.38),
        0 0 40px rgba(200, 86, 106, 0.28),
        0 10px 32px rgba(0, 0, 0, 0.6);
    transform: translateY(-4px) scale(1.04);
}

.nodo--ama .nodo-nombre {
    font-size: 0.9rem;
    color: var(--rose);
    max-width: 90px;
}

.nodo--ama .boda-conector {
    padding-bottom: 50px;
    /* ajuste para el nodo más alto */
}

@keyframes amaGlow {

    0%,
    100% {
        box-shadow: 0 0 0 2px rgba(200, 86, 106, 0.18), 0 0 20px rgba(200, 86, 106, 0.14), 0 6px 28px rgba(0, 0, 0, 0.6);
    }

    50% {
        box-shadow: 0 0 0 2px rgba(200, 86, 106, 0.38), 0 0 38px rgba(200, 86, 106, 0.28), 0 6px 28px rgba(0, 0, 0, 0.6);
    }
}

/* ── Endika ── */
.nodo--endika .nodo-foto {
    border-color: var(--gold);
    box-shadow: 0 0 0 1px rgba(216, 161, 60, 0.12), 0 4px 18px rgba(0, 0, 0, 0.5);
}

.nodo--endika:hover .nodo-foto {
    border-color: var(--gold);
    box-shadow:
        0 0 0 2px rgba(216, 161, 60, 0.28),
        0 0 18px rgba(216, 161, 60, 0.18),
        0 6px 22px rgba(0, 0, 0, 0.5);
}

.nodo--endika .nodo-nombre {
    color: var(--sepia-light);
}

.nodo--endika .nodo-inicial {
    color: var(--gold);
}

/* ════════════════════════════════
   LAYOUT ESPECÍFICO DE GENERACIONES
   Gen 1: Antonia | Anselmo — Tere
════════════════════════════════ */

/* Lado paterno e.g. sólo Antonia */
.gen1-paterno {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Lado materno: dos nodos con conector horizontal entre ellos */
.gen1-materno {
    display: flex;
    align-items: flex-start;  /* alineamos por el top para que conector-h con margin-top centre */
    gap: 0;
}

/* ════════════════════════════════
   MODAL
════════════════════════════════ */
.arbol-modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(13, 5, 3, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.arbol-modal-bg.show {
    opacity: 1;
    pointer-events: all;
}

.arbol-modal {
    background: radial-gradient(ellipse 80% 60% at 50% 30%, #3d2010 0%, #1a0a08 70%, #0d0503 100%);
    border: 1px solid rgba(196, 164, 124, 0.22);
    border-radius: 20px;
    padding: 2.5rem 2rem 2rem;
    max-width: 320px;
    width: 100%;
    text-align: center;
    transform: scale(0.85) translateY(20px);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow:
        0 0 30px rgba(200, 86, 106, 0.1),
        0 0 60px rgba(216, 161, 60, 0.05),
        0 30px 80px rgba(0, 0, 0, 0.7);
    position: relative;
}

.arbol-modal-bg.show .arbol-modal {
    transform: scale(1) translateY(0);
}

.arbol-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(196, 164, 124, 0.28);
    background: rgba(20, 8, 5, 0.8);
    color: rgba(196, 164, 124, 0.7);
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s;
}

.arbol-modal-close:hover {
    color: var(--rose);
    border-color: rgba(200, 86, 106, 0.5);
    transform: rotate(90deg) scale(1.1);
}

.arbol-modal-foto {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 2px solid rgba(196, 164, 124, 0.28);
    overflow: hidden;
    margin: 0 auto 1.2rem;
    background: #2e1209;
    position: relative;
}

.arbol-modal-foto img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(0.2);
}

.arbol-modal-foto .nodo-inicial {
    font-size: 2.2rem;
}

.arbol-modal h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--sepia-light);
    margin-bottom: 0.3rem;
}

.arbol-modal .modal-rol {
    font-family: 'DM Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--gold);
    display: block;
    margin-bottom: 1.2rem;
}

.arbol-modal-rule {
    width: 40px;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(196, 164, 124, 0.4), transparent);
    margin: 0 auto 1.2rem;
}

.arbol-modal .modal-frase {
    font-family: 'Playfair Display', serif;
    font-size: 0.92rem;
    font-style: italic;
    color: rgba(196, 164, 124, 0.72);
    line-height: 1.7;
}

/* ── Animaciones entrada ── */
.gen-1 {
    opacity: 0;
    animation: fadeUp 0.7s ease forwards 0.3s;
}

.gen-2 {
    opacity: 0;
    animation: fadeUp 0.7s ease forwards 0.55s;
}

.gen-3 {
    opacity: 0;
    animation: fadeUp 0.7s ease forwards 0.8s;
}

.gen-4 {
    opacity: 0;
    animation: fadeUp 0.7s ease forwards 1.05s;
}

.gen-5 {
    opacity: 0;
    animation: fadeUp 0.7s ease forwards 1.3s;
}

.arbol-footer-note {
    text-align: center;
    margin-top: 2rem;
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.82rem;
    font-style: italic;
    color: rgba(196, 164, 124, 0.32);
    letter-spacing: 0.08em;
    position: relative;
    z-index: 2;
    padding: 0 2rem;
}

/* ════════════════════════════════
   GEN 2 extendida: Tía Auro + Aita + [boda] + Ama
   Layout: [Auro — Aita] [💍casados] [Ama]
════════════════════════════════ */

/* Wrapper que agrupa Tía Auro + conector fraternal + Aita */
.gen2-paterno {
    display: flex;
    align-items: flex-start;
    gap: 0;
}

/* Conector horizontal fraternal (Auro ↔ Aita) */
.conector-h-fraternal {
    height: 2px;
    background: linear-gradient(to right, rgba(196, 164, 124, 0.3), rgba(196, 164, 124, 0.5), rgba(196, 164, 124, 0.3));
    width: 18px;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 34px; /* mitad del círculo 68px */
}

/* Tía Auro: estilo más tenue que los protagonistas */
.nodo--tia .nodo-foto {
    border-color: rgba(196, 164, 124, 0.25);
}
.nodo--tia:hover .nodo-foto {
    border-color: rgba(196, 164, 124, 0.6);
    box-shadow:
        0 0 0 2px rgba(196, 164, 124, 0.15),
        0 0 16px rgba(196, 164, 124, 0.12),
        0 6px 22px rgba(0, 0, 0, 0.5);
}
.nodo--tia .nodo-inicial {
    color: rgba(196, 164, 124, 0.7);
    text-shadow: none;
}
.nodo--tia .nodo-nombre {
    color: rgba(196, 164, 124, 0.7);
}

/* Desktop (como lo tienes ahora) */
/* Desktop */
.conector-materno {
    transform: translateX(-42px);
}

/* 📱 Móvil */
@media (max-width: 480px) {
    .conector-materno {
        transform: translateX(26px);
    }
}

/* Desktop */
.materno-wrap {
    transform: translateX(-42px);
}

/* 📱 Móvil */
@media (max-width: 480px) {
    .materno-wrap {
        transform: translateX(-5px);
    }
}

/* Desktop (no tocar) */
.conector-antonia {
    transform: translateX(0px);
}

/* 📱 Móvil */
@media (max-width: 480px) {
    .conector-antonia {
        transform: translateX(10px);
    }
}