/* Page header */
.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.page-title {
    margin: 0;
    font-family: var(--font-brand);
    font-weight: 600;
    font-size: 2rem;
    letter-spacing: -.015em;
}

.page-sub {
    margin: .25rem 0 0;
    min-height: 1.5em;
    color: var(--muted);
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
}

/* Search */
.search-box {
    position: relative;
}

    .search-box i {
        position: absolute;
        left: .85rem;
        top: 50%;
        transform: translateY(-50%);
        color: var(--muted);
        pointer-events: none;
    }

    .search-box input {
        width: 260px;
        max-width: 100%;
        padding: .55rem .9rem .55rem 2.4rem;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--surface);
        color: var(--text);
        font: inherit;
    }

/* Buttons */
.btn-pine, .btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .55rem 1.05rem;
    border: 1px solid transparent;
    border-radius: 10px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.btn-pine {
    background: var(--side-bg);
    color: #fff;
}

    .btn-pine:hover:not(:disabled) {
        filter: brightness(1.15);
    }

    .btn-pine:disabled {
        opacity: .6;
        cursor: default;
    }

.btn-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

    .btn-ghost:hover {
        background: var(--shell-bg);
    }

    .btn-pine:focus-visible, .btn-ghost:focus-visible,
    .search-box input:focus-visible, .input:focus-visible,
    .icon-btn-sm:focus-visible, .notice-close:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }

/* People directory: open tiles, not boxed cards */
.people {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.75rem 1rem;
}

.person {
    text-align: center;
}

.person-link {
    display: block;
    padding: .75rem .5rem;
    border-radius: 16px;
    color: inherit;
    text-decoration: none;
    transition: background-color .15s;
}

    .person-link:hover {
        background: var(--surface);
    }

        .person-link:hover .person-name {
            color: var(--link);
        }

    .person-link:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }

.person-photo {
    display: block;
    width: 112px;
    height: 112px;
    margin: 0 auto;
    object-fit: cover;
    border-radius: 50%;
    background: var(--border);
}

.person-name {
    margin-top: .75rem;
    font-weight: 600;
    line-height: 1.25;
}

.person-nick {
    color: var(--muted);
    font-size: .9rem;
}

.people .skeleton-line {
    margin-left: auto;
    margin-right: auto;
}

/* Gold ring marks members who have passed (same cue as the original page) */
.is-late .person-photo {
    box-shadow: 0 0 0 3px var(--shell-bg), 0 0 0 6px #e0b100;
}

.legend {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: -.5rem 0 1.5rem;
    color: var(--muted);
    font-size: .9rem;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e0b100;
    flex: none;
}

.page-count {
    margin-left: .4rem;
}

    .page-count::before {
        content: "·";
        margin-right: .5rem;
    }

/* Birthdays */
.birthday-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 560px;
}

.birthday {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.birthday-photo {
    width: 84px;
    height: 84px;
    flex: none;
    object-fit: cover;
    border-radius: 50%;
    background: var(--border);
}

.birthday-name {
    font-size: 1.15rem;
    font-weight: 600;
}

.birthday-note {
    margin-top: .25rem;
    color: var(--link);
    font-size: .92rem;
}

/* Loading skeletons */
.skeleton {
    background: var(--border);
    animation: sk-pulse 1.2s ease-in-out infinite;
}

.skeleton-line {
    width: 70%;
    height: 14px;
    margin-top: .75rem;
    border-radius: 6px;
    background: var(--border);
    animation: sk-pulse 1.2s ease-in-out infinite;
}

@keyframes sk-pulse {
    50% {
        opacity: .5;
    }
}

/* Empty / error states */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    padding: 3.5rem 1rem;
    text-align: center;
    color: var(--muted);
}

    .empty-state i {
        font-size: 2.2rem;
        color: var(--link);
    }

    .empty-state p {
        max-width: 420px;
        margin: 0;
    }

/* Notices */
.notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: .7rem 1rem;
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: 10px;
    background: var(--surface);
}

.notice-success {
    border-left-color: #2f9e7a;
}

.notice-error {
    border-left-color: #c0392b;
}

.notice-close {
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

/* Dialog */
.dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1060;
    background: rgba(8, 18, 15, .55);
}

.dialog {
    position: fixed;
    z-index: 1061;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(520px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}

    .dialog > form {
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

.dialog-head, .dialog-foot {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
}

.dialog-head {
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

    .dialog-head h2 {
        margin: 0;
        font-family: var(--font-brand);
        font-size: 1.35rem;
        font-weight: 600;
    }

.dialog-body {
    padding: 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dialog-foot {
    justify-content: flex-end;
    gap: .6rem;
    border-top: 1px solid var(--border);
}

.icon-btn-sm {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

    .icon-btn-sm:hover {
        background: var(--shell-bg);
        color: var(--text);
    }

/* Form fields */
.field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    flex: 1;
    min-width: 0;
}

    .field label {
        font-weight: 600;
        font-size: .92rem;
    }

.optional {
    color: var(--muted);
    font-weight: 400;
}

.field-row {
    display: flex;
    gap: 1rem;
}

.field-hint {
    color: var(--muted);
    font-size: .85rem;
    overflow-wrap: anywhere;
}

.input {
    width: 100%;
    padding: .55rem .75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

@media (max-width: 575.98px) {
    .field-row {
        flex-direction: column;
    }

    .search-box, .search-box input {
        width: 100%;
    }

    .page-actions {
        width: 100%;
    }

    .people {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton, .skeleton-line {
        animation: none;
    }
}

/* Data table (My Family) */
.table-wrap {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    overflow: hidden;
}

.table-scroll {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
}

    .data-table th {
        padding: .8rem 1rem;
        border-bottom: 1px solid var(--border);
        color: var(--muted);
        font-size: .85rem;
        font-weight: 600;
        text-align: left;
        white-space: nowrap;
    }

    .data-table td {
        padding: .75rem 1rem;
        border-bottom: 1px solid var(--border);
        vertical-align: middle;
    }

    .data-table tbody tr:last-child td {
        border-bottom: 0;
    }

    .data-table tbody tr:hover {
        background: var(--shell-bg);
    }

    .data-table .num {
        text-align: right;
        color: var(--muted);
        font-variant-numeric: tabular-nums;
    }

    .data-table .path {
        color: var(--muted);
    }

.member-cell {
    display: flex;
    align-items: center;
    gap: .85rem;
}

.member-photo {
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: 50%;
    object-fit: cover;
    background: var(--border);
}

.member-name {
    font-weight: 600;
}

.row-skeleton {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
}

    .row-skeleton .skeleton-line {
        margin: 0;
    }

/* Member details */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: 1.25rem;
    color: var(--link);
    font-weight: 600;
    text-decoration: none;
}

    .back-link:hover {
        text-decoration: underline;
    }

.profile-head {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.profile-photo {
    width: 112px;
    height: 112px;
    flex: none;
    border-radius: 50%;
    object-fit: cover;
    background: var(--border);
}

.profile-head.is-late .profile-photo {
    box-shadow: 0 0 0 3px var(--shell-bg), 0 0 0 6px #e0b100;
}

.crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    margin-bottom: .5rem;
    color: var(--muted);
    font-size: .92rem;
}

    .crumbs a {
        color: var(--link);
        text-decoration: none;
    }

        .crumbs a:hover {
            text-decoration: underline;
        }

    .crumbs .sep {
        opacity: .5;
    }

    .crumbs [aria-current] {
        color: var(--text);
        font-weight: 600;
    }

.section-title {
    margin: 2rem 0 1rem;
    font-family: var(--font-brand);
    font-size: 1.3rem;
    font-weight: 600;
}

.person-rel {
    color: var(--link);
    font-size: .82rem;
    font-weight: 600;
}

.is-current .person-link {
    background: var(--surface);
    box-shadow: inset 0 0 0 2px var(--accent);
}

/* ---- tree layout (FamilyDetails) ---- */
.tree {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.tree-level, .tree-couple {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    justify-content: center;
    align-items: flex-start;
}

.tree-children {
    gap: 1.5rem;
    align-items: flex-start;
}

.tree-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--bs-border-color);
}

.tree-grandchildren {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.tree-person {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    width: 7rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
}

    .tree-person img {
        width: 4rem;
        height: 4rem;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid var(--bs-border-color);
    }

    .tree-person.is-focus img {
        border-color: #e0a526;
        box-shadow: 0 0 0 3px rgba(224,165,38,.35);
    }

    .tree-person.is-deceased img {
        border-color: #b8860b;
    }

.tree-name {
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.2;
}

.tree-label {
    font-size: .7rem;
    color: var(--bs-secondary-color);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: grid;
    place-items: center;
    z-index: 1050;
    padding: 1rem;
}

    .dialog-backdrop .dialog {
        background: var(--bs-body-bg);
        border-radius: .75rem;
        padding: 1.5rem;
        max-width: 26rem;
        width: 100%;
    }

/* ---- member picker ---- */
.picker {
    position: relative;
}

.picker-list {
    position: absolute;
    z-index: 1040;
    inset-inline: 0;
    margin: .25rem 0 0;
    padding: .25rem;
    list-style: none;
    max-height: 16rem;
    overflow: auto;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
}

    .picker-list button {
        display: block;
        width: 100%;
        text-align: start;
        padding: .4rem .6rem;
        border: 0;
        background: none;
        color: inherit;
        border-radius: .35rem;
    }

        .picker-list button:hover, .picker-list button.is-active {
            background: var(--bs-tertiary-bg);
        }

.picker-empty {
    padding: .5rem .6rem;
    color: var(--bs-secondary-color);
}

/* ---- relationship tree ---- */
.rel-tree {
    list-style: none;
    margin: 0;
    padding-inline-start: 1.5rem;
    border-inline-start: 2px solid var(--bs-border-color);
}

    .rel-tree.rel-root {
        border: 0;
        padding: 0;
    }

    .rel-tree li {
        padding-block: .35rem;
    }

.rel-person {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    padding: .35rem .6rem;
    border-radius: .6rem;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
}

    .rel-person img {
        width: 2.75rem;
        height: 2.75rem;
        border-radius: 50%;
        object-fit: cover;
    }

    .rel-person.is-focus {
        border-color: #e0a526;
        box-shadow: 0 0 0 3px rgba(224,165,38,.35);
    }

/* ---- ancestry chain ---- */
.ancestry-chain {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
}

    .ancestry-chain li {
        display: flex;
        align-items: center;
        gap: 1.5rem;
    }

        .ancestry-chain li:not(:last-child)::after {
            content: "\2192";
            color: var(--bs-secondary-color);
            font-size: 1.25rem;
        }

/* ---- home, pending, privacy ---- */
.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 1rem;
}

.home-card {
    display: grid;
    gap: .15rem;
    padding: 1.1rem 1.2rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .85rem;
    background: var(--bs-body-bg);
    color: inherit;
    text-decoration: none;
}

    .home-card:hover {
        border-color: #e0a526;
        box-shadow: 0 4px 16px rgba(0,0,0,.08);
    }

    .home-card i {
        font-size: 1.5rem;
        color: #e0a526;
    }

    .home-card span {
        font-weight: 600;
    }

    .home-card small {
        color: var(--bs-secondary-color);
    }

.home-hero {
    max-width: 36rem;
    margin: 4rem auto;
    text-align: center;
    display: grid;
    gap: 1rem;
    justify-items: center;
}

    .home-hero h1 {
        font-family: 'Fraunces', serif;
        font-size: clamp(2.2rem, 6vw, 3.2rem);
    }

.empty-state.pending {
    max-width: 32rem;
    margin: 3rem auto;
}

.prose {
    max-width: 42rem;
}

    .prose li {
        margin-bottom: .35rem;
    }

/* Spouse's family card on a spouse's page */
.spouse-family {
    margin-top: 2rem;
}
