/* The account menu (account-menu.js), for the viewer and the account area: both pages' tokens (viewer.css,
   account.css), so it follows their light and dark themes. Where it sits is each page's own business. */

.account-menu { position: relative; flex: none; }

.account-menu-button {
    display: flex; align-items: center; gap: 8px;
    max-width: 260px;
    padding: 4px 8px 4px 4px;
    font: inherit; font-size: 13px; font-weight: 500;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
}
.account-menu-button:hover, .account-menu.open .account-menu-button { background: var(--surface-2); border-color: var(--accent-line); }
.account-menu-button:focus-visible, .account-menu-item:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.account-menu-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-button > svg {
    flex: none; width: 14px; height: 14px;
    fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    color: var(--text-faint);
    transition: transform .15s;
}
.account-menu.open .account-menu-button > svg { transform: rotate(180deg); }

.account-avatar {
    flex: none;
    display: grid; place-items: center;
    width: 28px; height: 28px;
    overflow: hidden;
    font-size: 13px; font-weight: 700; line-height: 1; letter-spacing: 0;
    color: var(--accent-text);
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    border-radius: 50%;
    user-select: none;
}
.account-avatar.large { width: 40px; height: 40px; font-size: 17px; }
.account-avatar.picture { background: var(--surface-2); border-color: var(--border); }
.account-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }

.account-menu-panel {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 20;
    width: 288px; max-width: calc(100vw - 24px);
    padding: 6px;
    text-align: left;
    color: var(--text);
    background: var(--solid);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--pop, var(--lift));
}

.account-menu-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; }
.account-menu-names { min-width: 0; }
.account-menu-name { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.account-menu-email { font-size: 12.5px; color: var(--text-dim); overflow-wrap: anywhere; }

.account-menu-facts {
    display: grid; gap: 4px;
    margin: 0 4px 6px; padding: 10px 6px;
    font-size: 13px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.account-menu-facts > div { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; }
.account-menu-facts dt {
    font-family: var(--mono); font-size: 10.5px; line-height: 19.5px;
    letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--text-faint);
}
.account-menu-facts dd { margin: 0; overflow-wrap: anywhere; }
.account-menu-facts dd.quiet { color: var(--text-faint); }

.account-menu-actions { display: flex; flex-direction: column; gap: 1px; }
.account-menu-actions hr { margin: 4px 6px; border: 0; border-top: 1px solid var(--border); }

.account-menu-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 8px 10px;
    font: inherit; font-size: 13.5px;
    color: var(--text);
    text-align: left; text-decoration: none;
    background: none;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}
.account-menu-item:hover { background: var(--surface-2); }
.account-menu-item > span { flex: 1; }
.account-menu-item svg {
    flex: none; width: 16px; height: 16px;
    fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
    color: var(--text-dim);
}
.account-menu-item svg.account-menu-external { width: 13px; height: 13px; color: var(--text-faint); }
.account-menu-sign-out, .account-menu-sign-out svg { color: var(--danger); }

@media (pointer: coarse) {
    .account-menu-item { padding: 11px 10px; }
}

/* Narrow: the initial (or picture) alone */
@media (max-width: 760px) {
    .account-menu-button { padding: 4px; gap: 4px; }
    .account-menu-label, .account-menu-button > svg { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .account-menu-button > svg { transition: none; }
}
