/* navbar.css — the navbar: a dark bar across the top of every signed-in page, always
   visible. It takes --nav-h, so pages sized by .app-h / var(--app-h) (components.css)
   fit under it. Three columns: the CEG mark, the menus (centered on the window), and
   who is signed in on the right. Each group of pages is a menu (navbar.js opens it); the
   current page's link, or its group, is underlined. Below the z-50 slide-over panels
   and z-[60] modals. */
:root:has(#navbar) {
    --nav-h: 48px;
}
body:has(#navbar) {
    padding-top: var(--nav-h);
}

.navbar {
    position: fixed;
    z-index: 40;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-h, 48px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: stretch;
    padding: 0 12px;
    color: #cbd5e1;
    font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
    background: #0f172a; /* slate-900 */
    border-bottom: 1px solid #1e293b;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
}

/* The CEG mark: each letter in its own white box, a little apart (not a link). */
.navbar-logo {
    grid-column: 1;
    justify-self: start;
    align-self: center;
    display: flex;
    gap: 3px;
    user-select: none;
}
.navbar-logo span {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    color: #13294b; /* dark navy */
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 17px;
    font-weight: 700;
    line-height: 1;
    background: #fff;
    border-radius: 2px;
}

.navbar-menu {
    grid-column: 2;
    min-width: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.navbar-tab {
    position: relative;
    flex: none;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 14px;
    color: #cbd5e1; /* slate-300 */
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: color 0.15s, background-color 0.15s;
}
.navbar-tab::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 0;
    height: 2px;
    background: transparent;
}
.navbar-tab:hover,
.navbar-group-btn[aria-expanded="true"] {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}
.navbar-tab[aria-current] {
    color: #fff;
    font-weight: 600;
}
.navbar-tab[aria-current]::after {
    background: #0ea5e9; /* sky-500 */
}
.navbar-caret {
    opacity: 0.7;
    transition: transform 0.15s;
}
.navbar-group-btn[aria-expanded="true"] .navbar-caret {
    transform: rotate(180deg);
}

/* ---- a group's menu ----------------------------------------------------- */
.navbar-group {
    position: relative;
    display: flex;
}
.navbar-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 250px;
    padding: 6px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.22);
}
.navbar-dropdown[hidden] {
    display: none;
}
.navbar-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 8px 10px;
    border-radius: 7px;
    text-decoration: none;
}
.navbar-item:hover,
.navbar-item:focus-visible {
    background: #f1f5f9;
    outline: none;
}
.navbar-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
}
.navbar-item-blurb {
    font-size: 12px;
    color: #64748b;
}
.navbar-item[aria-current="page"] {
    background: #f0f9ff;
}
.navbar-item[aria-current="page"] .navbar-item-title {
    color: #0369a1;
}

/* ---- who is signed in --------------------------------------------------- */
.navbar-user {
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 4px;
    padding-left: 12px;
    border-left: 1px solid #1e293b;
}
.navbar-person {
    max-width: 200px;
    overflow: hidden;
    padding: 4px 8px;
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-decoration: none;
    border-radius: 6px;
}
.navbar-logout {
    padding: 4px 10px;
    color: #94a3b8;
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    background: transparent;
    border: 1px solid #334155;
    border-radius: 6px;
    cursor: pointer;
}
.navbar-corner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 6px;
    padding: 4px 10px;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
}
.navbar-corner:hover,
.navbar-corner[aria-current="page"] {
    color: #fff;
    background: #1e293b;
}
.navbar-person:hover,
.navbar-logout:hover {
    color: #fff;
}
.navbar-logout:hover {
    border-color: #64748b;
}

.navbar a:focus-visible,
.navbar button:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: -3px;
    border-radius: 6px;
}

@media (max-width: 767px) {
    .navbar {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }
    .navbar-logo span {
        width: 20px;
        height: 20px;
        font-size: 14px;
    }
    .navbar-tab {
        padding: 0 10px;
    }
    .navbar-menu {
        overflow-x: auto;
        scrollbar-width: none;
    }
    .navbar-person,
    .navbar-corner span {
        display: none;
    }
}

/* ---- session.js: the warning before a session times out ---------------- */
.session-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.45);
}
.session-dialog {
    width: 100%;
    max-width: 400px;
    padding: 22px 22px 18px;
    font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.3);
}
.session-title {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
}
.session-text {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: #334155;
}
.session-text b {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    color: #0f172a;
}
.session-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}
.session-btn {
    padding: 8px 14px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
}
.session-btn[hidden] {
    display: none;
}
.session-btn-primary {
    color: #fff;
    background: #0f172a;
    border-color: #0f172a;
}
.session-btn:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: 2px;
}
