/* 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; }

/* ---------- Public pages: layout and About ---------- */
.pub-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--shell-bg); color: var(--text); font-family: var(--font-ui); }
.pub-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem clamp(1rem, 4vw, 2.5rem); background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.pub-brand { font-family: var(--font-brand); font-weight: 600; font-size: 1.4rem; color: var(--text); text-decoration: none; }
.pub-links { display: flex; align-items: center; gap: 1.1rem; }
.pub-links a:not(.btn) { color: var(--muted); text-decoration: none; font-weight: 500; }
.pub-links a:not(.btn):hover { color: var(--text); }
.pub-main { flex: 1; }
.pub-footer { padding: 1.25rem clamp(1rem, 4vw, 2.5rem); text-align: center; color: var(--muted); border-top: 1px solid var(--border); font-size: .9rem; }
.pub-footer a { color: var(--link); }

.about-hero { max-width: 52rem; margin: 0 auto; padding: clamp(3rem, 9vw, 6rem) 1.25rem; text-align: center; display: grid; gap: 1.1rem; justify-items: center; }
.about-kicker { margin: 0; color: var(--link); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: .8rem; }
.about-hero h1 { font-family: var(--font-brand); font-size: clamp(2.2rem, 6.5vw, 3.8rem); line-height: 1.1; margin: 0; }
.about-lead { max-width: 38rem; margin: 0; color: var(--muted); font-size: 1.15rem; }
.about-actions { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; margin-top: .5rem; }

.about-section { padding: clamp(2.5rem, 7vw, 4.5rem) 1.25rem; }
.about-section > * { max-width: 68rem; margin-left: auto; margin-right: auto; }
.about-alt { background: var(--surface); border-block: 1px solid var(--border); }
.about-section h2 { font-family: var(--font-brand); font-size: clamp(1.6rem, 4vw, 2.2rem); text-align: center; margin-bottom: .4rem; }
.about-sub { text-align: center; color: var(--muted); margin: 0 auto 2rem; max-width: 40rem; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.1rem; margin-top: 2rem; }
.feature { padding: 1.4rem; border: 1px solid var(--border); border-radius: .9rem; background: var(--surface); }
.feature i, .trust-grid i { font-size: 1.6rem; color: var(--accent); }
.feature h3, .trust-grid h3, .steps h3 { font-size: 1.05rem; font-weight: 600; margin: .7rem 0 .35rem; }
.feature p, .trust-grid p, .steps p { margin: 0; color: var(--muted); }

.steps { list-style: none; padding: 0; margin: 2rem auto 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.5rem; }
.steps li { text-align: center; }
.step-no { display: inline-grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--side-bg); color: #fff; font-weight: 700; }

.trust-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1.5rem; margin-top: 2rem; }

.faq { max-width: 44rem; margin: 1.5rem auto 0; display: grid; gap: .6rem; }
.faq details { border: 1px solid var(--border); border-radius: .7rem; padding: .85rem 1.1rem; background: var(--shell-bg); }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: .6rem 0 0; color: var(--muted); }

.cta-band { text-align: center; padding: clamp(3rem, 8vw, 5rem) 1.25rem; background: var(--side-bg); color: #fff; display: grid; gap: .8rem; justify-items: center; }
.cta-band h2 { font-family: var(--font-brand); font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 0; }
.cta-band p { margin: 0; color: var(--side-text); max-width: 34rem; }
.btn-gold { background: var(--accent); color: #1b1500; border: 1px solid transparent; font-weight: 600; }
.btn-gold:hover { filter: brightness(1.08); color: #1b1500; }
@media (max-width: 575px) { .pub-links { gap: .7rem; } }

/* Birthdays & Remembrances */
.celebrate-section { margin-bottom: 2.25rem; }
.celebrate-title { font-family: var(--font-brand); font-size: 1.4rem; margin-bottom: 1rem; }
.celebrate-sub { font-size: 1rem; font-weight: 600; margin: 1.25rem 0 .75rem; color: var(--muted); }
.celebrate-sub i { color: var(--accent); margin-right: .35rem; }
.birthday-name a, .upcoming-list a { color: inherit; text-decoration: none; font-weight: 600; }
.birthday-name a:hover, .upcoming-list a:hover { text-decoration: underline; }
.birthday.is-remembered .birthday-photo { box-shadow: 0 0 0 3px var(--accent); }
.remembrance-note { color: var(--muted); }
.upcoming-list { list-style: none; margin: 0; padding: 0; max-width: 560px; display: grid; gap: .6rem; }
.upcoming-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; padding: .7rem .9rem; border: 1px solid var(--border); border-radius: .7rem; background: var(--surface); }
.upcoming-list i { color: var(--accent); }
