/* Shared public topbar: landing, search, runner-gallery preview, organizers.
   One nav everywhere - links in the panel, login/globe/cart in the tray.
   Below 640px the links collapse behind a hamburger; the tray stays put. */
.topbar { background: #f2f2f2; display: flex; align-items: center; padding: 12px 28px; position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08); }
.topbar .logo { display: inline-flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.topbar .logo .logo-img { height: 75px; width: auto; display: block; }
.topbar nav { display: flex; align-items: center; margin-left: auto; }
.topbar nav a { color: #334155; text-decoration: none; margin-left: 26px; font-size: 15px; font-weight: 600; padding-bottom: 4px; white-space: nowrap; }
.topbar nav a:hover { color: #2563eb; }
.topbar nav a.active { color: #2563eb; border-bottom: 2px solid #2563eb; }
/* Action tray, visually grouped apart from the links. */
.topbar .tray { display: flex; align-items: center; gap: 6px; margin-left: 22px; padding-left: 18px; border-left: 1px solid #e2e8f0; }
.topbar .tray .icon-link { display: inline-flex; align-items: center; color: #334155; position: relative; }
/* Small divider grouping the language flags apart from the action icons. */
.topbar .tray .tray-sep { width: 1px; align-self: stretch; background: #e2e8f0; margin: 2px 8px; }
.topbar .tray .icon-link:hover { color: #2563eb; }
.topbar .tray .icon-link svg { width: 22px; height: 22px; display: block; }
/* Compact language menu: one globe button (~52px) instead of three inline
   flags (~110px), so the tray fits a 360px viewport in a single row. */
.topbar .lang-menu { position: relative; }
.topbar .lang-menu .lang-current { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: #334155; border-radius: 8px; padding: 4px; list-style: none; }
.topbar .lang-menu .lang-current::-webkit-details-marker { display: none; }
.topbar .lang-menu .lang-current::marker { content: ""; }
.topbar .lang-menu .lang-current:hover { color: #2563eb; }
.topbar .lang-menu .lang-current svg { width: 22px; height: 22px; display: block; }
.topbar .lang-menu .lang-current .lang-chevron { width: 14px; height: 14px; }
.topbar .lang-menu .lang-current .lang-code { font-size: 12px; font-weight: 700; }
.topbar .lang-menu .lang-list { position: absolute; right: 0; top: calc(100% + 8px); min-width: 160px; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); padding: 4px; z-index: 200; }
.topbar .lang-menu .lang-list a { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; color: #334155; text-decoration: none; font-size: 14px; font-weight: 600; white-space: nowrap; }
.topbar .lang-menu .lang-list a:hover { background: #eff6ff; color: #2563eb; }
.topbar .lang-menu .lang-list a.active { color: #2563eb; }
.topbar .lang-menu .lang-list a .lang-check { display: none; margin-left: auto; font-weight: 800; }
.topbar .lang-menu .lang-list a.active .lang-check { display: inline; }
.cart-badge { position: absolute; top: -7px; right: -9px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #2563eb; color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.cart-badge[hidden] { display: none; }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; color: #0f172a; padding: 6px; }
.nav-toggle svg { width: 26px; height: 26px; display: block; }
@media (max-width: 640px) {
    /* Single row on narrow phones: the bar never wraps (nowrap); the
       image logo steps down to 28px while the tray (globe + cart + login
       + hamburger) keeps its size. */
    .topbar { flex-wrap: nowrap; padding: 10px 16px; gap: 8px; }
    .topbar .logo .logo-img { height: 28px; }
    .topbar nav { margin-left: 0; }
    .topbar .tray { border-left: none; padding-left: 0; margin-left: auto; gap: 4px; flex-shrink: 0; }
    .topbar .tray .tray-sep { margin: 2px 4px; }
    /* Hamburger panel: an overlay sliding down BELOW the bar, never an
       in-flow flex item (a width:100%/order:3 item inside the nowrap row
       blew the whole header apart when opened). The bar row stays put. */
    .topbar nav { display: flex; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; padding: 6px 16px 10px; background: #f2f2f2; box-shadow: 0 8px 16px rgba(0, 0, 0, 0.10); z-index: 150; visibility: hidden; opacity: 0; transform: translateY(-8px); pointer-events: none; transition: opacity 180ms ease-out, transform 180ms ease-out, visibility 180ms; }
    .topbar nav.open { visibility: visible; opacity: 1; transform: none; pointer-events: auto; }
    .topbar nav a { margin-left: 0; padding: 10px 4px; border-bottom: 1px solid #e2e8f0; }
    .topbar nav a:last-child { border-bottom: none; }
    .nav-toggle { display: inline-flex; align-items: center; }
}
@media (prefers-reduced-motion: reduce) {
    .topbar nav { transition: none; }
}
