/* ============================================
   Top Header — Logo (left) + nav cluster (right)
   ============================================
   Layout was previously centered logo with back button top-left and
   outlet name absolute right. Reorganized so the brand mark anchors
   left (universal convention) and navigation context lives on the
   right (semantic + thumb-friendlier for right-handers). */

.top-header {
    position: relative;
    z-index: 50;
    background: var(--color-bg);
    box-shadow: rgb(51 48 48 / 20%) 0px 8px 24px;
}

.top-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-sm) var(--space-md);
    height: 70px;
}

/* ─── Logo (anchored left) ────────────────────────────────────────
   `min-width: 0` lets the logo column shrink when a long outlet name
   needs space on the right. `max-width` is a defensive ceiling so an
   oversized logo (e.g. wide horizontal wordmark) can't push the
   right cluster off-screen on narrow viewports. */
.top-header__logo {
    display: inline-flex;
    align-items: center;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 60%;
    text-decoration: none;
}

/* Explicit `height` (not just max-height) so SVG logos without an
   intrinsic width/height attribute still get sized — otherwise the
   browser renders them at 0×0 and the logo disappears from the bar
   while the DOM element stays present. `width: auto + max-width`
   keeps the aspect ratio + caps very wide wordmarks. */
.top-header__logo-img {
    height: 56px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
}

body.theme-light .top-header__logo-img { filter: none; }
body:not(.theme-light) .top-header__logo-img { filter: brightness(1.1); }

.top-header__logo-text {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-header-fg, var(--color-text));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Right cluster (outlet name + divider + back + cart) ────────
   Inline flex row, gap-driven. Each child can disappear independently
   and the rest re-flow cleanly. */
.top-header__right {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
    min-width: 0;
}

/* Outlet name — wraps to 2 lines for long names, right-aligned so it
   reads as the trailing context before the divider/back action. */
.top-header__outlet-name {
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.01em;
    color: var(--color-header-fg, var(--color-text));
    text-align: right;
    max-width: 50vw;
    /* Two-line clamp guards against "The Club Restaurant" eating the
       whole header on narrow viewports. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

/* Hairline divider between outlet name and back button.
   Rendered only when BOTH are present (see header.php logic) so the
   cluster reads as "context | action" instead of two unrelated items.
   `color-text-muted` is intentionally bolder than `color-border` —
   the divider needs to actually communicate separation, not whisper
   it. Height matches the back button's tighter footprint. */
.top-header__divider {
    display: inline-block;
    width: 1px;
    height: 24px;
    background: var(--color-text-muted);
    opacity: 0.35;
    flex-shrink: 0;
}

/* Back button — 36×36 visual footprint with a generous tap area via
   padding (touch-action). Compact so it doesn't crowd a long outlet
   name on narrow viewports; still well within iOS/Android tap-area
   guidelines because the surrounding flex gap adds breathing room.
   Edge-swipe gesture remains the primary back-navigation mechanism. */
.top-header__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 36px;
    border-radius: var(--radius-full);
    color: var(--color-header-fg, var(--color-text));
    transition: background var(--transition-fast), transform 100ms ease;
    flex-shrink: 0;
}

body.theme-light .top-header__back {
    background: rgb(0 0 0 / 0%);
}
body.theme-light .top-header__back:hover,
body.theme-light .top-header__back:active {
    background: rgb(0 0 0 / 5%);
}
body:not(.theme-light) .top-header__back {
    background: var(--color-bg-glass-strong);
}
body:not(.theme-light) .top-header__back:hover,
body:not(.theme-light) .top-header__back:active {
    background: var(--color-bg-glass);
}

.top-header__back:active {
    transform: scale(0.92);
}
