html,
body {
    height: 100%;
}

.frontend-hidden-id {
    display: none !important;
}

.person-panel-heading {
    text-align: center;
}

.panel-heading-avatar,
.search-person-avatar {
    overflow: hidden;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #e5ebe7;
    color: #315b4f;
    border: 1px solid #a79d8c;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
}

.panel-heading-avatar {
    width: 116px;
    height: 116px;
    margin: 0 auto 14px;
    font-size: 1.35rem;
}

.panel-heading-avatar img,
.search-person-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.profile-media-block .profile-avatar-row {
    display: none;
}

.profile-media-block .profile-gallery-section {
    margin-top: 0;
}

.topbar-meta .gallery-link {
    display: inline-flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
    line-height: 1.2;
}

.topbar-meta .gallery-link:hover,
.topbar-meta .gallery-link:focus-visible {
    border-color: #292824;
    color: #292824;
    outline: none;
}

.search-results button[data-search-person] {
    grid-template-columns: 34px minmax(0, 1fr);
    column-gap: 9px;
    align-items: center;
}

.search-person-avatar {
    width: 30px;
    height: 30px;
    grid-row: 1 / 3;
    grid-column: 1;
    font-size: 0.62rem;
}

.search-results button[data-search-person] > strong,
.search-results button[data-search-person] > span:not(.search-person-avatar) {
    grid-column: 2;
}

@media (min-width: 761px) {
    html,
    body {
        overflow: hidden;
    }

    .tree-app {
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
    }

    .workspace {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
    }

    .person-panel,
    .tree-stage {
        min-height: 0;
    }

    .tree-stage {
        height: 100%;
    }

    .family-tree {
        height: 100%;
        min-height: 0 !important;
    }

    .legend {
        bottom: max(8px, env(safe-area-inset-bottom));
    }
}

@media (min-width: 761px) and (max-height: 650px) {
    .topbar {
        grid-template-columns: minmax(120px, 0.45fr) minmax(260px, 1fr) minmax(220px, 0.8fr);
        gap: 12px;
        align-items: center;
        padding: 8px 14px;
    }

    .topbar-meta {
        grid-column: auto;
        gap: 6px;
        font-size: 0.7rem;
    }

    .brand-block .eyebrow,
    .search-block > label {
        display: none;
    }

    .brand-block h1 {
        font-size: 1.35rem;
    }

    .search-control input {
        min-height: 36px;
        padding-top: 6px;
        padding-bottom: 6px;
    }

    .status-button {
        padding: 5px 7px;
    }

    .stage-toolbar {
        top: 8px;
        left: 8px;
        right: 8px;
        gap: 6px;
    }

    .view-switch,
    .depth-control,
    .zoom-controls {
        padding: 2px;
    }

    .view-button,
    .tool-button {
        min-height: 30px;
        height: 30px;
    }

    .legend {
        left: 8px;
        bottom: 8px;
        max-width: calc(100% - 16px);
        gap: 6px 10px;
        padding: 5px 8px;
        font-size: 0.62rem;
    }
}

@media (max-width: 760px) {
    html,
    body {
        height: auto;
        overflow: auto;
    }

    .tree-app {
        height: auto;
        min-height: 100dvh;
        overflow: visible;
    }

    .workspace {
        overflow: visible;
    }

    .tree-stage,
    .family-tree {
        height: clamp(420px, 64dvh, 600px);
        min-height: 0 !important;
    }
}
