/* geo-public.css — the session-less IpQuery.Info public pages
   (ip-query-info/pages/GeoPublicShell.cpp). The page reuses the app's
   Bootstrap 3 navbar markup, so yw-theme.css styles the bar exactly as it
   does in the Wt app; this file only adds what the app gets from Wt widgets:
   the Docs/Tools dropdowns (plain <details>, no script) and the narrow-screen
   layout of the bar. Colours come from the yw-theme tokens, so light and dark
   themes both follow the visitor's saved preference. */

/* Dropdown trigger: looks like the bar's pill links. */
.gp-nav .gp-dd { position: relative; }
.gp-nav .gp-dd > details > summary {
    list-style: none;
    cursor: pointer;
    color: var(--nav-muted);
    padding: 9px 14px;
    margin: 16px 3px;
    border-radius: 8px;
    font-size: .95rem;
    font-weight: 500;
    line-height: 1.25;
    white-space: nowrap;
}
.gp-nav .gp-dd > details > summary::-webkit-details-marker { display: none; }
.gp-nav .gp-dd > details > summary::after {
    content: "";
    display: inline-block;
    margin-left: .4em;
    vertical-align: .15em;
    border-top: .3em solid currentColor;
    border-left: .3em solid transparent;
    border-right: .3em solid transparent;
}
.gp-nav .gp-dd > details > summary:hover,
.gp-nav .gp-dd > details > summary:focus-visible,
.gp-nav .gp-dd > details[open] > summary {
    color: var(--nav-fg);
    background: var(--nav-hover);
}
.gp-nav .gp-dd > details > summary:focus-visible {
    outline: 2px solid var(--accent-ink);
    outline-offset: 2px;
}

.gp-dd__menu {
    position: absolute;
    top: calc(100% - 10px);
    left: 0;
    z-index: 1000;
    min-width: 13rem;
    margin: 0;
    padding: .4rem 0;
    list-style: none;
    background: var(--surface, #fff);
    border: 1px solid var(--surface-border, rgba(0,0,0,.15));
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,.16);
}
.gp-dd--right .gp-dd__menu { left: auto; right: 0; }
/* A closed <details> keeps its content's layout box in current Chrome; take
   the menu out of layout entirely until it is opened. */
.gp-dd > details:not([open]) > .gp-dd__menu { display: none; }
.gp-dd__menu a {
    display: block;
    padding: .5rem 1rem;
    color: var(--text, #222);
    font-size: .95rem;
    text-decoration: none;
    white-space: nowrap;
}
.gp-dd__menu a:hover,
.gp-dd__menu a:focus-visible {
    background: var(--accent-tint);
    color: var(--nav-fg);
}

/* Narrow screens: brand on its own row, links wrap underneath instead of the
   Wt app's collapsed hamburger (which needs the Wt runtime). */
@media (max-width: 767px) {
    .gp-app .navbar.navbar-default > .container-fluid { padding: 0 16px; }
    .gp-app .navbar-default .navbar-collapse {
        display: flex !important;
        flex-wrap: wrap;
        padding: 0 0 8px;
        border-top: 0 !important;
        box-shadow: none !important;
    }
    .gp-app .navbar-default .navbar-nav {
        display: flex;
        flex-wrap: wrap;
        margin: 0;
    }
    /* yw-theme gives each collapsed-menu item the full row (the Wt hamburger
       layout); here the items sit side by side and wrap. */
    .gp-app .navbar-default .navbar-nav > li {
        width: auto;
        flex: 0 0 auto;
    }
    .gp-app .navbar-default .navbar-nav > li > a,
    .gp-nav .gp-dd > details > summary {
        margin: 2px;
        padding: 8px 12px;
    }
    /* Menus span the bar (16px gutters) instead of hanging off their trigger,
       so the right-hand ones never run past the screen edge. */
    .gp-app .navbar.navbar-default { position: relative; }
    .gp-nav .gp-dd { position: static; }
    .gp-dd__menu,
    .gp-dd--right .gp-dd__menu {
        top: 100%;
        left: 16px;
        right: 16px;
        min-width: 0;
    }
}
