/*
 * Login and Register in the navbar of the four public pages - find-tutors,
 * exams, videos and view-tutor, which anyone may read (acting asks for an
 * account).
 *
 * The markup and the script that shows the pair only to a visitor who is
 * signed out are in each page's navbar (#nav-auth, #login-btn, #register-btn).
 * From 1023px down the menu button takes over, and its panel has its own pair
 * (#mobile-auth-section).
 *
 * Login is filled and Register outlined, as on the homepage. Colours are the
 * theme's and the palette's (css/root/theme.css, color-palettes.css): never
 * write one in here.
 */

.nav-auth {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-shrink: 0;
}

/* The page's script hides the pair with the `hidden` attribute, and an author
   display beats the attribute's own display: none. profile-system.js hides
   the buttons with the `hidden` class (and an inline display). */
.nav-auth[hidden],
.nav-auth .hidden {
    display: none !important;
}

.nav-auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 38px;
    padding: 0 16px;
    border: 2px solid var(--button-bg);
    border-radius: 999px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .2s ease;
}

.nav-auth-btn:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.nav-auth-btn:focus-visible {
    outline: 2px solid var(--button-bg);
    outline-offset: 2px;
}

.nav-auth-login,
.nav-auth-login:visited {
    background: var(--button-bg);
    color: var(--button-text);
}

.nav-auth-login:hover {
    background: var(--button-hover);
    border-color: var(--button-hover);
    color: var(--button-text);
}

/* The label in the text colour, not the brand's: a light palette's brand
   colour is too faint to read on the bar. */
.nav-auth-register,
.nav-auth-register:visited {
    background: transparent;
    color: var(--text);
}

.nav-auth-register:hover {
    background: rgba(var(--primary-rgb), .12);
    color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
    .nav-auth-btn { transition: none; }
    .nav-auth-btn:hover { transform: none; }
}

/* The menu button's panel has its own pair below 1024px. */
@media (max-width: 1023px) {
    .nav-auth { display: none !important; }
}

@media print {
    .nav-auth { display: none !important; }
}

/* ======================================================================
   Room for the pair
   A search, five or six links, the bell and the theme switch already shared
   one row, with nothing to spare at 1024px: find-tutors' profile ran off the
   screen signed in, and the videos page's links broke onto two lines. These
   take back what the row wasted, and drop the decoration first - never a
   link, never a control. exams.css had already done this for the exams page
   (no 2rem gaps, the emoji only from 1600px, the badge and the profile name
   gone below 1280px), so the exams rules below only add to it.
   ====================================================================== */

/* find-tutors (the navbar holding .nav-search-wrapper) and videos, below
   1440px: the 2rem gaps and the 1rem margins either side of the search were
   108px of nothing; the emoji beside each link only where there is room for
   them. The pages are paired in :is(), which is forgiving: a browser without
   :has() drops that half alone, where a plain selector list would lose the
   whole rule. */
@media (min-width: 1024px) and (max-width: 1439px) {
    :is(.navbar:has(.nav-search-wrapper), .videos-body .navbar) .nav-container {
        gap: .75rem;
    }

    :is(.navbar .nav-search-wrapper, .videos-body .navbar .nav-container > .flex-1) {
        flex: 1 1 auto;
        min-width: 0;
        margin-left: 0;
        margin-right: 0;
    }

    :is(.navbar:has(.nav-search-wrapper), .videos-body .navbar) .desktop-nav-items .nav-icon {
        display: none;
    }

    .navbar .desktop-nav-items .nav-link {
        white-space: nowrap;
    }
}

/* 1024-1279: the links closer together, the brand without its badge, the
   profile without its name (as on exams), and a smaller pair. */
@media (min-width: 1024px) and (max-width: 1279px) {
    :is(.navbar:has(.nav-search-wrapper), .videos-body .navbar) .desktop-nav-items .nav-link {
        padding-left: .45rem;
        padding-right: .45rem;
    }

    :is(.navbar:has(.nav-search-wrapper), .videos-body .navbar) .nav-brand .logo-badge {
        display: none;
    }

    :is(.navbar:has(.nav-search-wrapper), .videos-body .navbar) #profile-dropdown-toggle .profile-name {
        display: none;
    }

    .nav-auth {
        gap: .3rem;
    }

    .nav-auth-btn {
        height: 34px;
        padding: 0 12px;
        font-size: 14px;
    }

    /* exams has six links. On top of exams.css's own (no emoji, no badge, no
       profile name below 1280px): the links a little closer, and, for a
       visitor signed out, no bell - all it can do for them is ask them to
       sign in, which Login beside it does. */
    .exams-body .navbar .desktop-nav-items .nav-link {
        padding-left: .35rem;
        padding-right: .35rem;
    }

    .exams-body #nav-auth:not([hidden]) ~ [data-notifications-bell] {
        display: none;
    }
}
