/*
 * Structural chrome for the public site (templates/public/layout.html): the sticky topbar, page
 * scaffolding and the footer. The design tokens, the reset and the page transitions live in
 * public/base.css, which every public page loads first -- including the ones without this chrome --
 * so this file only owns the shell.
 *
 * Content primitives (hero, cards, feature grids, steps, ...) live in the per-page stylesheets.
 */

/* Topbar */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    height: 100px;
    /* The body is a flex column, and a flex item may be shrunk below its declared height whenever
       the column is short of room; the bar keeps its height regardless. */
    flex: none;
}

.topbar__inner {
    max-width: 1232px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.topbar__brand {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    text-decoration: none;
    color: var(--text);
    flex: none;
}

.topbar__brand img {
    /*
    width: 28px;
    height: 28px;
     */
    width: auto;
    height: 56px;
}

.topbar__brand span {
    font-family: var(--display);
    /*

    font-size: 1.15rem;
     */
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    /* The bar centres every item on its line box, which leaves the baseline (ascent - descent) / 2
       below the box centre -- an offset that grows with the font size, so the wordmark ends up
       sitting lower than the smaller nav labels. Lift it by that difference (~2px at these sizes)
       to put the wordmark and the nav labels on one baseline. */
    position: relative;
    top: -0.08em;
}

.topbar__content__right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1.75rem;
    min-width: 0;
}

.topbar__nav {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    /* No clipping here: the dropdown of an expandable item hangs out of the nav box. Narrow
       viewports fold the whole nav into the menu panel instead (the media query at the bottom). */
    overflow: visible;
}

.topbar__link {
    position: relative;
    padding: 0.35rem 0.1rem;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.topbar__link:hover {
    color: var(--text);
}

/* Navigation.items always lists "Login" last; give it CTA weight without templating a special case. */
.topbar__nav > .topbar__link:last-child {
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    color: var(--text);
    background: var(--raise);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.topbar__nav > .topbar__link:last-child:hover {
    border-color: var(--accent-solid);
    background: var(--accent-soft);
    color: var(--text);
}

/* Expandable items (NavigationItem.children): the trigger stays a plain link, the panel opens on
   hover and on keyboard focus anywhere inside the group. */

.topbar__group {
    position: relative;
    display: flex;
    align-items: center;
}

.topbar__group__trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.topbar__caret {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transition: transform 0.15s ease;
}

.topbar__group:hover .topbar__caret,
.topbar__group:focus-within .topbar__caret {
    transform: rotate(180deg);
}

.topbar__dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    z-index: 60;
    min-width: 190px;
    margin-top: 0.6rem;
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    background: var(--panel);
    border-radius: var(--r);
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

/* Bridges the gap under the trigger so the pointer can travel into the panel without closing it. */
.topbar__dropdown::before {
    content: "";
    position: absolute;
    top: -0.6rem;
    left: 0;
    right: 0;
    height: 0.6rem;
}

.topbar__group:hover .topbar__dropdown,
.topbar__group:focus-within .topbar__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.topbar__dropdown__link {
    padding: 0.5rem 0.7rem;
    border-radius: 8px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.topbar__dropdown__link:hover {
    color: var(--text);
    background: var(--raise);
}

.topbar__icons {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: none;
}

.topbar__icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    color: var(--text-dim);
    border: 1px solid transparent;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.topbar__icon svg {
    width: 25px;
    height: 25px;
    fill: currentColor;
}

.topbar__icon:hover {
    color: var(--text);
    background: var(--raise);
    border-color: var(--edge);
}

/* Over the home page's video the grey is lost in the picture: a label or icon standing on it goes to
   plain white for as long as it does. public_home.js sets the classes. After the rules above, which
   it would otherwise tie with and lose to. */
.topbar__link--on-video,
.topbar__icon--on-video {
    color: #FFFFFF;
}

/* A dropdown opened over the video lets it through rather than laying a dark panel across it, and
   its entries go white like the bar's own labels, with a white wash for the one under the pointer
   in place of the raised grey that is meant for the panel. */
.topbar__dropdown--on-video {
    background: transparent;
}

.topbar__dropdown--on-video .topbar__dropdown__link {
    color: #FFFFFF;
}

.topbar__dropdown--on-video .topbar__dropdown__link:hover {
    background: rgb(255 255 255 / 0.14);
}

/* The menu button that stands in for the nav on a narrow screen; hidden until the query below. */
.topbar__menu {
    display: none;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-left: auto;
    margin-right: -10px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--text);
    cursor: pointer;
}

.topbar__menu svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
}

.topbar__menu__close,
.topbar--open .topbar__menu__open {
    display: none;
}

.topbar--open .topbar__menu__close {
    display: inline;
}

/*
 * A phone: the four links and the wordmark do not fit on one line, so the nav and the icons fold
 * into a panel that drops under the bar when the menu button is pressed (js/public_nav.js). The
 * dropdown of an expandable item is laid out open in there, indented under its trigger, since a
 * touch screen has no hover to open it with.
 */
@media (max-width: 760px) {
    .topbar {
        height: 64px;
    }

    .topbar__inner {
        padding: 0 1rem;
    }

    .topbar__brand img {
        height: 40px;
    }

    .topbar__brand span {
        font-size: 1.3rem;
    }

    .topbar__menu {
        display: grid;
    }

    .topbar__content__right {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 0.5rem 1rem 1rem;
        background: var(--panel);
        border-bottom: 1px solid var(--edge);
        max-height: calc(100vh - 64px);
        overflow-y: auto;
    }

    .topbar--open .topbar__content__right {
        display: flex;
    }

    /* The bar blurs what is under it; with the panel open it is the panel's solid colour instead,
       so the two read as one sheet. */
    .topbar--open {
        background: var(--panel);
    }

    .topbar__nav {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .topbar__link {
        display: flex;
        align-items: center;
        min-height: 48px;
        padding: 0 0.25rem;
        font-size: 1.15rem;
    }

    .topbar__group {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar__caret {
        display: none;
    }

    .topbar__dropdown,
    .topbar__dropdown--on-video {
        position: static;
        min-width: 0;
        margin: 0 0 0.25rem;
        padding: 0 0 0 1rem;
        opacity: 1;
        visibility: visible;
        transform: none;
        background: none;
    }

    .topbar__dropdown::before {
        display: none;
    }

    .topbar__dropdown__link {
        display: flex;
        align-items: center;
        min-height: 44px;
        font-size: 1.05rem;
    }

    /* Login keeps its call-to-action look, as a full-width button at the foot of the list. */
    .topbar__nav > .topbar__link:last-child {
        justify-content: center;
        margin-top: 0.5rem;
        padding: 0 1rem;
        border-radius: var(--r);
    }

    .topbar__icons {
        justify-content: center;
        gap: 1rem;
        padding-top: 0.25rem;
    }

    .topbar__icon {
        width: 44px;
        height: 44px;
    }
}

/* Page scaffolding */

.main-content {
    flex: 1;
    width: 100%;
}

/* Footer */

.site-footer {
    border-top: 1px solid var(--edge);
    margin-top: 4rem;
}

.site-footer__inner {
    max-width: 1232px;
    padding: 2rem 1.5rem;
    color: var(--dim);
    font-size: var(--font-size-small);
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.site-footer__links {
    display: flex;
    gap: 1.5rem;
}

.site-footer__links a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.15s ease;
}

.site-footer__links a:hover {
    color: var(--text);
}
