/**
 * AJPDAS shared Header + Footer shell
 * Loaded once for every frontend page.
 */
:root {
    --pri: #1557BF;
    --prit: #EAF1FD;
    --navy: #0B1F4A;
    --acc: #F58220;
    --bg: #F5F7FA;
    --card: #FFFFFF;
    --tx: #0F172A;
    --mut: #5B6577;
    --bd: #E3E8F0;
    --ok: #047857;
    --okb: #ECFDF5;
    --chip: #EEF2F8;
    --shell-font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --shell-r-btn: 10px;
    --shell-r-card: 14px;
    --shell-header-h: 68px;
    --shell-max: 1200px;
    --shell-pad: 16px;
    --shell-focus: 0 0 0 3px rgba(245, 130, 32, 0.55);
    --shell-z: 400;
}

@media (min-width: 768px) {
    :root { --shell-pad: 24px; }
}

@media (prefers-color-scheme: dark) {
    :root {
        --pri: #3B82F6;
        --navy: #07122C;
        --acc: #FB923C;
        --bg: #0B1220;
        --card: #111827;
        --tx: #F8FAFC;
        --mut: #94A3B8;
        --bd: #1F2937;
        --ok: #34D399;
    }
}

/* ---------- Focus: kill default black ring; brand ring on keyboard ---------- */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
summary:focus,
[role="button"]:focus {
    outline: none;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible {
    outline: none;
    box-shadow: var(--shell-focus);
}

/* ---------- Base shell helpers ---------- */
.shell-skip {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: calc(var(--shell-z) + 20);
    background: var(--acc);
    color: #fff;
    font: 600 0.9rem/1 var(--shell-font);
    padding: 12px 16px;
    border-radius: var(--shell-r-btn);
}
.shell-skip:focus {
    left: 12px;
    top: 12px;
    outline: none;
    box-shadow: var(--shell-focus);
}

.shell-wrap {
    width: 100%;
    max-width: var(--shell-max);
    margin: 0 auto;
    padding-left: var(--shell-pad);
    padding-right: var(--shell-pad);
}

.shell-header,
.shell-header *,
.shell-drawer,
.shell-drawer *,
.shell-footer,
.shell-footer *,
.shell-bottom {
    font-family: var(--shell-font);
    box-sizing: border-box;
}

.shell-header a:focus-visible,
.shell-header button:focus-visible,
.shell-drawer a:focus-visible,
.shell-drawer button:focus-visible,
.shell-footer a:focus-visible,
.shell-footer button:focus-visible,
.shell-bottom a:focus-visible {
    outline: none;
    box-shadow: var(--shell-focus);
}

/* ---------- Header ---------- */
.shell-header {
    position: sticky;
    top: 0;
    z-index: var(--shell-z);
    height: var(--shell-header-h);
    background: var(--card);
    border-bottom: 1px solid var(--bd);
    color: var(--tx);
    width: 100%;
}

.shell-header__inner {
    height: var(--shell-header-h);
    display: flex;
    align-items: center;
    gap: 16px;
}

.shell-logo {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    text-decoration: none;
    min-height: 44px;
}
.shell-logo img {
    display: block;
    height: 36px;
    width: auto;
    max-width: 148px;
}

/* Wordmark: AJP + orange DAS (reference HTML) */
.shell-brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    min-height: 44px;
    flex: 0 0 auto;
}
.shell-brand__word {
    font-family: var(--shell-font);
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1;
    color: var(--pri);
}
.shell-brand__accent {
    color: var(--acc);
    font-style: normal;
}
.shell-brand--sm .shell-brand__word { font-size: 20px; }
.shell-brand--md .shell-brand__word { font-size: 23px; }
.shell-brand--lg .shell-brand__word { font-size: 26px; }
.shell-brand--dark .shell-brand__word {
    color: #fff;
}
.shell-brand--dark .shell-brand__accent {
    color: var(--acc);
}

.shell-nav {
    display: none;
    flex: 1 1 auto;
    justify-content: center;
    min-width: 0;
}
.shell-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 24px;
}
.shell-nav__link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0;
    color: var(--mut);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--shell-r-btn);
    white-space: nowrap;
}
.shell-nav__link:hover {
    color: var(--pri);
}
.shell-nav__link[aria-current="page"] {
    color: var(--pri);
    font-weight: 600;
}

.shell-mega {
    position: relative;
}
.shell-mega__panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: min(720px, calc(100vw - 48px));
    background: var(--card);
    border: 1px solid var(--bd);
    border-radius: var(--shell-r-card);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 5;
}
.shell-mega.is-open .shell-mega__panel,
.shell-mega:focus-within .shell-mega__panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
@media (hover: hover) and (pointer: fine) {
    .shell-mega:hover .shell-mega__panel {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
}
.shell-mega__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.shell-mega__head span {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--mut);
}
.shell-mega__head a {
    color: var(--pri);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}
.shell-mega__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.shell-mega__item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 8px 10px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--tx);
    border: 1px solid transparent;
}
.shell-mega__item:hover {
    background: var(--bg);
    border-color: var(--bd);
    color: var(--pri);
}
.shell-mega__item img {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 8px;
    flex: 0 0 auto;
    background: var(--bg);
}
.shell-mega__item span {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.3;
}

.shell-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-left: auto;
    flex: 0 0 auto;
}

.shell-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    min-height: 44px;
    padding: 0 20px;
    border-radius: var(--shell-r-btn);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border: 1.5px solid transparent;
    cursor: pointer;
    background: transparent;
    color: var(--tx);
    white-space: nowrap;
}
.shell-btn--outline {
    border-color: var(--bd);
    background: var(--card);
    color: var(--tx);
}
.shell-btn--outline:hover {
    border-color: var(--pri);
    color: var(--pri);
}
.shell-btn--acc,
a.shell-btn--acc,
button.shell-btn--acc {
    background: var(--acc);
    border-color: var(--acc);
    color: #1A1000 !important;
    font-weight: 700;
}
.shell-btn--acc:hover,
a.shell-btn--acc:hover {
    filter: brightness(1.05);
    color: #1A1000 !important;
}
.shell-btn--acc .fa { color: #1A1000 !important; }
.shell-btn--pri,
a.shell-btn--pri,
button.shell-btn--pri {
    background: var(--pri);
    border-color: var(--pri);
    color: #fff !important;
}
.shell-btn--pri:hover,
a.shell-btn--pri:hover {
    color: #fff !important;
}
.shell-btn--pri .fa { color: #fff !important; }
.shell-btn--ghost {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.28);
    color: #fff;
}
.shell-btn--sell,
.shell-btn--login {
    display: none;
    color: var(--navy);
    font-weight: 600;
}

.shell-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--shell-r-btn);
    border: 1px solid var(--bd);
    background: var(--card);
    color: var(--tx);
    cursor: pointer;
}
.shell-menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    position: relative;
}
.shell-menu-toggle span::before,
.shell-menu-toggle span::after {
    content: '';
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    background: currentColor;
}
.shell-menu-toggle span::before { top: -6px; }
.shell-menu-toggle span::after { top: 6px; }

.shell-account {
    position: relative;
}
.shell-account__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 220px;
    background: var(--card);
    border: 1px solid var(--bd);
    border-radius: var(--shell-r-card);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
    padding: 8px;
    display: none;
    z-index: 6;
}
.shell-account.is-open .shell-account__panel {
    display: grid;
    gap: 2px;
}
.shell-account__panel a,
.shell-account__panel button {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 12px;
    border: 0;
    background: transparent;
    color: var(--tx);
    text-decoration: none;
    font: 500 0.875rem/1.2 var(--shell-font);
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    width: 100%;
}
.shell-account__panel a:hover,
.shell-account__panel button:hover {
    background: var(--bg);
    color: var(--pri);
}

/* ---------- Drawer ---------- */
.shell-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 31, 74, 0.48);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: calc(var(--shell-z) + 5);
}
.shell-overlay.is-open {
    opacity: 1;
    visibility: visible;
}
.shell-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(360px, 100vw);
    height: 100%;
    background: var(--card);
    color: var(--tx);
    z-index: calc(var(--shell-z) + 6);
    transform: translateX(100%);
    transition: transform 0.22s ease;
    display: flex;
    flex-direction: column;
    overflow: auto;
}
.shell-drawer.is-open {
    transform: translateX(0);
}
.shell-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: var(--shell-header-h);
    padding: 12px 16px;
    border-bottom: 1px solid var(--bd);
}
.shell-drawer__close {
    width: 44px;
    height: 44px;
    border-radius: var(--shell-r-btn);
    border: 1px solid var(--bd);
    background: var(--card);
    color: var(--tx);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}
.shell-drawer__body {
    padding: 12px 16px 28px;
    display: grid;
    gap: 8px;
}
.shell-drawer__link {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 12px;
    border-radius: 10px;
    color: var(--tx);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
}
.shell-drawer__link:hover,
.shell-drawer__link[aria-current="page"] {
    background: var(--bg);
    color: var(--pri);
    font-weight: 600;
}
.shell-drawer__label {
    margin: 12px 4px 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mut);
}
.shell-drawer__cats {
    display: grid;
    gap: 4px;
}
.shell-drawer__cat {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 10px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--tx);
}
.shell-drawer__cat img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
}
.shell-drawer__cat:hover {
    background: var(--bg);
    color: var(--pri);
}
.shell-drawer__actions {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

/* ---------- Sticky bottom (phones) ---------- */
.shell-bottom {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: calc(var(--shell-z) - 10);
    background: var(--card);
    border-top: 1px solid var(--bd);
    grid-template-columns: repeat(3, 1fr);
    min-height: 48px;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.shell-bottom a {
    display: grid;
    place-items: center;
    gap: 2px;
    min-height: 48px;
    padding: 8px 4px;
    color: var(--tx);
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 600;
}
.shell-bottom a:hover,
.shell-bottom a[aria-current="page"] {
    color: var(--pri);
}
.shell-bottom svg {
    width: 18px;
    height: 18px;
}

body.has-shell-bottom {
    padding-bottom: 0;
}

/* ---------- Footer (matches reference HTML) ---------- */
/* clip (not hidden) so sticky header still works against the viewport */
html {
    overflow-x: clip;
    max-width: 100%;
}
body {
    max-width: 100%;
}
footer.shell-footer,
footer.shell-company-footer,
.shell-footer,
.shell-company-footer {
    display: block;
    width: calc(100% + var(--scroll-lock-pad, 0px));
    max-width: none;
    margin-left: 0;
    margin-right: calc(0px - var(--scroll-lock-pad, 0px));
    box-sizing: border-box;
    background: var(--navy);
    border-top: 0;
}
/* When scroll is locked, body pad would show white — fill it with the same page bg */
body.is-scroll-locked {
    background-clip: border-box;
}
.shell-footer {
    color: #B8C4E0;
    padding: 44px 0 28px;
    margin-top: 0;
    font-size: 14px;
}
#main-content {
    padding-bottom: 0;
}

/* One horizontal rhythm: page content follows the same 1200px shell as the header. */
#main-content .container,
#main-content .container-1740,
#main-content .container-1800 {
    width: 100%;
    max-width: var(--shell-max);
}
#main-content .mu-w,
#main-content .pl-w {
    max-width: var(--shell-max);
    padding-left: var(--shell-pad);
    padding-right: var(--shell-pad);
}
.shell-footer a {
    color: #B8C4E0;
    text-decoration: none;
}
.shell-footer a:hover {
    color: #fff;
}
.shell-footer__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
}
.shell-footer__logo {
    display: inline-flex;
    margin-bottom: 10px;
}
.shell-footer__logo .shell-brand--dark .shell-brand__word {
    color: #fff;
}
.shell-footer__lead {
    margin: 0;
    color: #B8C4E0;
    line-height: 1.65;
    font-size: 14px;
    max-width: 34ch;
}
.shell-footer__title {
    margin: 0 0 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
    border: 0;
    padding: 0;
}
.shell-footer__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0;
}
.shell-footer__list a,
.shell-footer__hours {
    display: block;
    padding: 4px 0;
    font-size: 14px;
    color: #B8C4E0;
    min-height: 0;
    line-height: 1.5;
}
.shell-footer__list a:hover {
    color: #fff;
}
.shell-footer__bottom {
    border-top: 1px solid #1E2F5C;
    margin-top: 28px;
    padding-top: 18px;
}
.shell-footer__copy {
    margin: 0;
    color: #B8C4E0;
    font-size: 14px;
}
.shell-footer__sponsored {
    border-top: 1px solid #1E2F5C;
    margin-top: 28px;
    padding-top: 18px;
}
.shell-footer__sponsored-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.shell-footer__sponsored-head p {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(184, 196, 224, 0.7);
}
.shell-footer__sponsored-head span {
    font-size: 0.75rem;
    color: rgba(184, 196, 224, 0.5);
}
.shell-footer__sponsored-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.shell-footer__sponsored-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: #B8C4E0;
    font-size: 0.84rem;
}
.shell-footer__sponsored-item:hover {
    color: #fff;
}
.shell-footer__sponsored-item img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: cover;
}

.shell-company-footer {
    background: var(--navy);
    color: rgba(255, 255, 255, 0.8);
    padding: 20px 0;
}
.shell-company-footer .shell-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    justify-content: space-between;
    align-items: center;
}

/* ---------- Breakpoints ---------- */
@media (max-width: 999.98px) {
    .shell-bottom { display: grid; }
    body.has-shell-bottom {
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
    }
    .shell-footer {
        padding-bottom: calc(28px + 56px + env(safe-area-inset-bottom, 0px));
    }
    /* Legacy marketplace sticky bar styles must not stack padding */
    .mp-bottom,
    .global-sticky-actions,
    .scroll-tools,
    .mp-sticky-quote { display: none !important; }
}

@media (min-width: 640px) {
    .shell-btn--sell,
    .shell-btn--login { display: inline-flex; }
}

@media (min-width: 768px) {
    .shell-footer__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 28px;
    }
}

@media (min-width: 1000px) {
    .shell-nav { display: flex; }
    .shell-menu-toggle { display: none; }
    .shell-bottom { display: none; }
    body.has-shell-bottom { padding-bottom: 0; }
    .shell-btn--sell,
    .shell-btn--login { display: inline-flex; }
    .shell-footer__grid {
        grid-template-columns: 1.4fr 1fr 1fr 1fr;
        gap: 28px;
    }
}
