/* Patch 143 — the single structural contract for the persistent upper shell. */
.t-upper-shell {
    width: 100%;
    max-width: none;
    min-width: 0;
}

.t-upper-shell__header {
    width: 100% !important;
    min-height: 43px !important;
    height: 43px !important;
}

.t-upper-shell__navigation,
.t-upper-shell__navigation-scroll {
    width: 100%;
    max-width: none;
    margin: 0 !important;
}

.t-upper-shell__navigation-scroll {
    overflow-x: auto;
    overflow-y: hidden;
}

.t-upper-shell__navigation-frame {
    position: relative !important;
    width: 100% !important;
    min-width: 1080px !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: auto !important;
    margin: 0 !important;
    background: none !important;
    overflow: hidden !important;
    isolation: isolate;
}

.t-upper-shell__navigation-image {
    position: relative;
    z-index: 0;
    display: block;
    width: 100%;
    height: auto;
    max-width: none;
    object-fit: contain;
    object-position: center;
    user-select: none;
    pointer-events: none;
}

.t-upper-shell__hitbox-layer {
    position: absolute !important;
    inset: 0 !important;
    z-index: 4 !important;
    display: grid !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none !important;
}

.t-upper-shell__hitbox-layer > .category-hit {
    min-width: 0 !important;
    height: 100% !important;
    pointer-events: auto !important;
}

.t-upper-shell--preview .t-upper-shell__hitbox {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    border-left: 1px solid transparent;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    pointer-events: none !important;
}

.t-upper-shell--preview .t-upper-shell__hitbox:last-child {
    border-right: 1px solid transparent;
}

.t-upper-shell__hitbox-label {
    position: absolute;
    left: 50%;
    bottom: 8px;
    translate: -50% 0;
    padding: 3px 6px;
    border-radius: 999px;
    background: rgba(25, 49, 29, .82);
    color: #efffed;
    font-size: clamp(.45rem, .7vw, .72rem);
    white-space: nowrap;
    opacity: 0;
}

.t-upper-shell--preview .t-upper-shell__hitbox-layer.is-debug-visible .t-upper-shell__hitbox {
    border-left-color: rgba(226, 255, 224, .82);
    background: rgba(77, 180, 92, .08);
    box-shadow: inset 0 0 18px rgba(96, 255, 112, .35);
}

.t-upper-shell--preview .t-upper-shell__hitbox-layer.is-debug-visible .t-upper-shell__hitbox:last-child {
    border-right-color: rgba(226, 255, 224, .82);
}

.t-upper-shell--preview .t-upper-shell__hitbox-layer.is-debug-visible .t-upper-shell__hitbox-label {
    opacity: 1;
    box-shadow: 0 0 12px rgba(109, 255, 122, .8);
}

.t-upper-shell__childbar {
    width: 100%;
    min-height: 60px;
}

.t-upper-shell__child-items {
    min-width: 0;
    overflow-x: auto;
}

.t-upper-shell__childbar-empty {
    display: grid;
    min-height: 60px;
    place-items: center;
    padding: 10px 18px;
    border-top: 1px solid rgba(128, 101, 47, .28);
    background: rgba(244, 236, 217, .88);
    color: #6f624f;
    font-size: .86rem;
    text-align: center;
}

.t-upper-shell__preview-header-content {
    display: grid !important;
    grid-template-columns: 41px minmax(0, 1fr) max-content !important;
    align-items: center !important;
}

.t-upper-shell__preview-emblem {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    background: rgba(122, 44, 36, .88);
    color: #fff9e9;
    font-family: Georgia, serif;
    font-weight: 700;
}

.t-upper-shell__preview-utilities,
.t-upper-shell__preview-profile {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.t-upper-shell__preview-utilities span,
.t-upper-shell__preview-profile span {
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(74, 70, 62, .72);
    color: white;
    font-size: 9px;
}

.t-upper-shell__preview-profile {
    justify-content: flex-end;
}

.atelier-shell-assembly {
    width: 100% !important;
    max-width: none !important;
    overflow-x: auto;
}

.atelier-shell-assembly > .t-upper-shell {
    width: 100% !important;
    min-width: 0;
}

@media (max-width: 700px) {
    .t-upper-shell__header {
        min-height: 48px !important;
        height: 48px !important;
    }

    .t-upper-shell__navigation-frame {
        min-width: 1080px !important;
    }

    .t-upper-shell__childbar {
        min-height: 83px;
    }
}

/* PATCH 202 — navigation artwork is cropped inside a stable shell frame. */
.t-upper-shell__navigation-frame {
    aspect-ratio: 1920 / 230 !important;
    height: auto !important;
    overflow: hidden !important;
}
.t-upper-shell__navigation-image {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: fill !important;
    object-position: center;
}


/* Patch 3r0: published Header Studio hitboxes are real absolute links.
   Legacy category-grid rules use !important and otherwise override the
   database-backed hitbox geometry, leaving the artwork visible but inert. */
.t-upper-shell--production .t-upper-shell__hitbox-layer {
    pointer-events: none !important;
}

.t-upper-shell--production .t-upper-shell__hitbox-layer > a.category-hit {
    position: absolute !important;
    display: block !important;
    min-width: 1px !important;
    min-height: 1px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    background: transparent !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    grid-column: auto !important;
    grid-row: auto !important;
}

.t-upper-shell--production .t-upper-shell__navigation-image {
    pointer-events: none !important;
}

/* PATCH 333 — Header Studio is now the authoritative production shell.
   Geometry comes from the published global-shell record, while every live
   navigation anchor receives explicit absolute hitbox coordinates. */
.t-upper-shell__header {
    min-height: var(--t-shell-header-height, 43px) !important;
    height: var(--t-shell-header-height, 43px) !important;
}

.t-upper-shell__navigation-frame {
    aspect-ratio: var(--t-shell-nav-aspect, 1920 / 230) !important;
}

.t-upper-shell__childbar {
    min-height: var(--t-shell-child-height, 60px) !important;
}

.t-upper-shell--production .t-upper-shell__hitbox-layer > a.category-hit {
    inset: auto !important;
    max-width: none !important;
    max-height: none !important;
}

.t-upper-shell__header > .app-header__ribbon {
    min-height: 100% !important;
    height: 100% !important;
}

/* Published Header Studio geometry is authoritative for every shell layer. */
.t-upper-shell--production[style*="--t-shell-layout-aspect"] {
    position: relative;
    aspect-ratio: var(--t-shell-layout-aspect);
}

.t-upper-shell--production[style*="--t-shell-layout-aspect"] > .t-upper-shell__navigation,
.t-upper-shell--production[style*="--t-shell-layout-aspect"] .t-upper-shell__navigation-scroll {
    position: static !important;
    overflow: visible !important;
}

.t-upper-shell--production[style*="--t-shell-layout-aspect"] .t-upper-shell__navigation-frame {
    margin: 0 !important;
}
