.family-banner {
    background:
        linear-gradient(120deg, rgba(6, 18, 40, 0.94), rgba(20, 48, 95, 0.88)),
        radial-gradient(circle at 20% 30%, rgba(201, 162, 39, 0.25), transparent 45%),
        url("../images/hero-temple.svg") center/cover;
}

.family-tree-section {
    background:
        radial-gradient(circle at top, rgba(201, 162, 39, 0.08), transparent 40%),
        linear-gradient(180deg, #fbf7ef, #f1e8d4);
}

.family-stat-card,
.family-filters,
.family-tree-shell,
.family-root-card,
.member-mini-card,
.relation-box,
.profile-card {
    background: var(--ivory);
    border: 1px solid rgba(201, 162, 39, 0.35);
}

.family-stat-card {
    text-align: center;
    padding: 1.25rem;
    border-top: 4px solid var(--gold);
}

.family-stat-card .label {
    font-family: var(--font-ui);
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.family-stat-card .value {
    font-family: var(--font-display);
    color: var(--navy);
    font-size: 2rem;
}

.family-filters {
    padding: 1.25rem;
    margin-top: 1.5rem;
}

.family-tree-shell {
    margin-top: 1.5rem;
    overflow: hidden;
}

.family-tree-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.9rem 1rem;
    background: linear-gradient(90deg, var(--navy-deep), var(--navy-mid));
    color: #f7f1e3;
    border-bottom: 2px solid var(--gold);
}

.family-tree-toolbar .small {
    color: #d7e0f0;
}

#familyTreeChart {
    height: min(72vh, 760px);
    width: 100%;
    background:
        linear-gradient(rgba(11, 28, 61, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(11, 28, 61, 0.03) 1px, transparent 1px),
        #fffdf8;
    background-size: 28px 28px;
}

.family-root-card {
    display: block;
    text-align: center;
    padding: 1.25rem 1rem;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-top: 4px solid var(--gold);
    height: 100%;
}

.family-root-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    color: inherit;
}

.family-root-card .avatar {
    width: 84px;
    height: 84px;
    margin: 0 auto 0.75rem;
    border-radius: 50%;
    border: 3px solid var(--gold);
    overflow: hidden;
    display: grid;
    place-items: center;
    background: var(--navy);
    color: var(--gold-light);
    font-size: 1.6rem;
}

.family-root-card .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.family-root-card h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--navy);
    margin-bottom: 0.2rem;
}

.generation-title {
    font-family: var(--font-display);
    color: var(--navy);
    font-size: 1.2rem;
    margin-bottom: 0.85rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid rgba(201, 162, 39, 0.45);
}

.generation-title span {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--gold-dark);
    font-weight: 600;
}

.member-mini-card {
    display: block;
    padding: 0.85rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.member-mini-card:hover {
    border-color: var(--gold);
    transform: translateY(-2px);
    color: inherit;
}

.member-mini-card .name {
    font-weight: 600;
    color: var(--navy);
}

.mini-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    overflow: hidden;
    display: grid;
    place-items: center;
    background: var(--navy);
    color: var(--gold-light);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.mini-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-photo {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 4px solid var(--gold);
    overflow: hidden;
    background: var(--navy);
}

.profile-photo img,
.profile-photo .placeholder {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-photo .placeholder {
    display: grid;
    place-items: center;
    color: var(--gold-light);
    font-size: 3rem;
}

.profile-details li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid rgba(201, 162, 39, 0.2);
    font-family: var(--font-ui);
}

.profile-details li span {
    color: var(--muted);
}

.relation-box {
    padding: 1rem;
    height: 100%;
    border-top: 3px solid var(--gold);
}

.relation-box .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gold-dark);
    margin-bottom: 0.35rem;
    font-family: var(--font-ui);
}

@media (max-width: 767.98px) {
    #familyTreeChart {
        height: 520px;
    }
}
