:root {
    color-scheme: light;
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background: #f6f7f8;
    color: #1f2933;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
    background:
        linear-gradient(
            180deg,
            #eef3f1 0,
            #f6f7f8 260px
        );
}

a {
    color: #145c4a;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover {
    color: #0d4436;
}

.page-shell {
    width: min(920px, calc(100% - 32px));
    margin: 0 auto;
    padding: 56px 0 36px;
}

.site-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 28px;
}

.eyebrow {
    margin: 0 0 7px;
    color: #65746f;
    font-size: 0.77rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    color: #16231f;
}

h1 {
    max-width: 680px;
    font-size: clamp(2rem, 5vw, 3.4rem);
    line-height: 1.03;
    letter-spacing: -0.035em;
}

h2 {
    font-size: 1.2rem;
    letter-spacing: -0.01em;
}

.person-context {
    margin: 10px 0 0;
    color: #697772;
    font-size: 0.9rem;
    font-weight: 650;
}

.generation-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 7px 11px;
    border: 1px solid #c6d8d2;
    border-radius: 999px;
    background: #e9f2ef;
    color: #21594b;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-muted {
    border-color: #d5d9dd;
    background: #f1f2f3;
    color: #66717a;
}

.card {
    margin-top: 16px;
    padding: 24px;
    border: 1px solid #dfe4e2;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow:
        0 1px 2px rgba(28, 42, 37, 0.03),
        0 8px 24px rgba(28, 42, 37, 0.035);
}

.section-heading {
    margin-bottom: 18px;
}

.section-heading-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.relationship-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.relationship {
    min-height: 90px;
    padding: 16px;
    border: 1px solid #e3e7e5;
    border-radius: 13px;
    background: #fbfcfc;
}

.relationship-wide {
    min-height: auto;
}

.relationship-label {
    display: block;
    margin-bottom: 8px;
    color: #73807b;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.relationship a,
.relationship > span:not(.relationship-label):not(.detail-note) {
    font-size: 1rem;
    font-weight: 650;
}

.detail-note {
    display: block;
    margin-top: 6px;
    color: #75817d;
    font-size: 0.82rem;
}

.not-recorded,
.empty-state {
    color: #7b8582;
}

.stack {
    display: grid;
    gap: 10px;
}

.count {
    display: inline-grid;
    min-width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 999px;
    background: #eef2f0;
    color: #50605a;
    font-size: 0.85rem;
    font-weight: 750;
}

.children-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.children-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 16px;
    border: 1px solid #e4e8e6;
    border-radius: 12px;
    background: #fbfcfc;
    font-weight: 650;
    text-decoration: none;
}

.children-list a:hover {
    border-color: #bcd1c9;
    background: #f5faf8;
}

.child-generation {
    color: #7a8581;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.page-footer {
    padding: 24px 4px 0;
    color: #7b8582;
    font-size: 0.78rem;
    line-height: 1.5;
}

.page-footer p {
    margin: 0;
}

@media (max-width: 680px) {
    .page-shell {
        width: min(100% - 22px, 920px);
        padding-top: 34px;
    }

    .site-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .generation-group {
        justify-content: flex-start;
    }

    .relationship-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 19px;
        border-radius: 15px;
    }

    .children-list a {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }
}

/* Public Person ↔ Tree navigation */
.person-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.tree-action {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 9px 15px;
    border: 1px solid #1f654f;
    border-radius: 11px;
    background: #1f654f;
    color: #fff;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 780;
    line-height: 1.2;
    text-decoration: none;
    box-shadow:
        0 2px 8px rgba(27, 81, 64, 0.10);
}

.tree-action:hover,
.tree-action:focus-visible {
    outline: none;
    background: #174f3e;
    border-color: #174f3e;
}

@media (max-width: 700px) {
    .person-actions {
        width: 100%;
        justify-content: stretch;
    }

    .tree-action {
        width: 100%;
        min-height: 46px;
    }
}

/* Canonical FamilyUnit detail presentation */
.family-unit-stack {
    display: grid;
    gap: 14px;
}

.family-unit-card {
    padding: 18px;
    border: 1px solid #dbe5e1;
    border-radius: 14px;
    background: #fafcfb;
}

.family-unit-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.family-unit-kicker {
    margin: 0 0 4px;
    color: #71807a;
    font-size: 0.69rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.family-unit-heading h3 {
    margin: 0;
    color: #1b332b;
    font-size: 1rem;
    line-height: 1.25;
}

.family-child-count {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    padding: 5px 9px;
    border-radius: 999px;
    background: #eaf3ef;
    color: #315f50;
    font-size: 0.7rem;
    font-weight: 750;
    white-space: nowrap;
}

.family-child-count-muted {
    min-width: 28px;
    padding-inline: 7px;
    background: #eef2f0;
    color: #5e6d67;
}

.family-other-parent {
    padding: 14px 15px;
    border: 1px solid #e2e8e5;
    border-radius: 12px;
    background: #fff;
}

.family-other-parent > a,
.family-other-parent > span:not(.detail-note) {
    font-size: 0.98rem;
    font-weight: 680;
}

.family-children-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 18px 2px 9px;
    color: #5f6d68;
    font-size: 0.76rem;
    font-weight: 760;
}

.family-children-list {
    counter-reset: family-child;
}

.family-children-list li {
    counter-increment: family-child;
}

.family-children-list a::before {
    content: counter(family-child) ".";
    flex: 0 0 auto;
    color: #82908a;
    font-size: 0.72rem;
    font-weight: 750;
}

.family-children-list a > span:first-of-type {
    margin-right: auto;
}

.family-empty-state {
    margin: 0;
    padding: 12px 2px 2px;
}

.legacy-family-block + .legacy-family-block {
    margin-top: 20px;
}

@media (max-width: 680px) {
    .family-unit-card {
        padding: 15px;
    }

    .family-unit-heading {
        align-items: center;
    }

    .family-children-list a {
        display: grid;
        grid-template-columns: auto 1fr;
        column-gap: 9px;
    }

    .family-children-list .child-generation {
        grid-column: 2;
    }
}

/* Public Person sharing */
.person-share-action {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 9px 15px;
    border: 1px solid #cedbd5;
    border-radius: 11px;
    background: #fff;
    color: #255b49;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 780;
    line-height: 1.2;
    cursor: pointer;
}

.person-share-action:hover,
.person-share-action:focus-visible {
    outline: none;
    border-color: #8db0a2;
    background: #edf6f1;
}

.person-share-feedback {
    align-self: center;
    color: #64736d;
    font-size: 0.7rem;
    font-weight: 700;
}

@media (max-width: 700px) {
    .person-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .tree-action,
    .person-share-action {
        width: 100%;
        min-height: 46px;
    }

    .person-share-feedback {
        grid-column: 1 / -1;
        text-align: center;
    }
}

/* Interactive contrast and focus-state fixes - 2026-10-05 */

/*
 * The tree action is rendered as a green button-like link. Keep its text
 * white in every link state so visited/hover styling cannot reduce
 * readability.
 */
.tree-action,
.tree-action:visited,
.tree-action:hover,
.tree-action:focus-visible {
    color: #ffffff;
}

/*
 * Provide a strong visible keyboard focus indicator on the public Person
 * page without depending on hover.
 */
.tree-action:focus-visible,
.person-share-action:focus-visible,
.relationship a:focus-visible {
    outline: 3px solid #17372d;
    outline-offset: 3px;
}


/* Keep profile navigation aligned and spaced at every width. */
.person-actions { display: flex; align-items: stretch; flex-wrap: wrap; gap: 10px; }
.person-actions .tree-action, .person-actions .person-share-action { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; min-height: 46px; margin: 0; font: inherit; font-weight: 700; line-height: 1.3; text-align: center; }
@media (max-width: 700px) {
    .person-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: 100%; }
}

/* V1 review pass - 2026-10-13: make the suggestion entry point a clear,
   touch-sized secondary button. */
.suggest-update-link {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    padding: 9px 16px;
    border: 1px solid #1f654f;
    border-radius: 11px;
    background: #fff;
    color: #1f654f;
    font-weight: 750;
    text-decoration: none;
}

.suggest-update-link:hover,
.suggest-update-link:focus-visible {
    background: #edf6f1;
    color: #0d4436;
}

.suggest-update-link:focus-visible {
    outline: 3px solid #8cc7b4;
    outline-offset: 2px;
}

/* Parent recorded by name only (not a separate person in the tree). */
.external-parent-name {
    color: #1f2933;
    font-weight: 700;
}

/* JOGWAD-UI-20261014: Person and family names always display uppercase. */
.site-header h1,
.relationship a,
.external-parent-name,
.family-other-parent a,
.family-other-parent > span:not(.detail-note):not(.not-recorded),
.children-list a span:first-child {
    text-transform: uppercase;
}
