/* ── Account menu for the public pages ─────────────────────
   The landing, the GEDCOM viewer, the blog and a shared tree are each their own
   standalone document with its own stylesheet, so the signed-in corner of their
   headers lives here and is linked by all of them. Light only on purpose: these
   pages are light whatever the app theme is.

   Metrics follow the app's own user menu (site.css .user-menu*) so the same
   person recognises their avatar and dropdown on both sides of the sign-in. */

.pubnav-account { position: relative; display: flex; align-items: center; gap: 0.5rem; }

.pubnav-trigger {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.4rem 0.2rem 0.2rem;
    background: none;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    color: #495057;
    line-height: 1.5;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.pubnav-trigger:hover,
.pubnav-trigger[aria-expanded="true"] {
    background: #f1f3f5;
    border-color: #dee2e6;
    color: #212529;
}

.pubnav-avatar-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #dee2e6;
    display: block;
}

/* The fallback when there is no picture: the initial on a plain disc, which reads
   better at 28 px than a generic person glyph and still says whose account it is. */
.pubnav-avatar-letter {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #212529;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 28px;
    text-align: center;
    display: block;
    flex: none;
    text-transform: uppercase;
}

/* display:block above would otherwise beat the attribute */
.pubnav-avatar-img[hidden], .pubnav-avatar-letter[hidden] { display: none; }

.pubnav-chevron { opacity: 0.6; flex: none; }

.pubnav-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    padding: 0.4rem 0;
    z-index: 400;
}

.pubnav-menu.open { display: block; }

.pubnav-who { padding: 0.5rem 0.9rem 0.6rem; }

.pubnav-who-name {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #212529;
    line-height: 1.3;
}

.pubnav-who-email {
    display: block;
    font-size: 0.78rem;
    color: #868e96;
    line-height: 1.3;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 240px;
}

.pubnav-item,
.pubnav-menu a.pubnav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.45rem 0.9rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    color: #495057;
    text-align: left;
    text-decoration: none;
    transition: background 0.1s, color 0.1s;
}

.pubnav-item:hover,
.pubnav-menu a.pubnav-item:hover {
    background: #f8f9fa;
    color: #212529;
    text-decoration: none;
}

.pubnav-item--danger { color: #dc3545; }
.pubnav-item--danger:hover { background: #fff5f5; color: #c82333; }

.pubnav-divider { height: 1px; background: #dee2e6; margin: 0.4rem 0; }

/* The name beside the avatar is the first thing to drop on a phone; the picture
   and the menu stay, so the account is still reachable. */
.pubnav-name { max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 575px) {
    .pubnav-name, .pubnav-chevron { display: none; }
    .pubnav-trigger { padding: 0.2rem; }
}

/* The way back into the app. Metrics match the dark button it replaces in both
   headers — bootstrap .btn-sm.btn-dark on the landing, .gv-nav-btn-dark on the
   viewer and the blog — so nothing moves when a signed-in person loads the page. */
.pubnav-btn-dark,
a.pubnav-btn-dark {
    display: inline-block;
    text-align: center;
    vertical-align: middle;
    background: #212529;
    border: 1px solid #212529;
    border-radius: 6px;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.5;
    color: #ffffff;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out;
}

.pubnav-btn-dark:hover,
a.pubnav-btn-dark:hover {
    background: #424649;
    border-color: #373b3e;
    color: #ffffff;
    text-decoration: none;
}
