/* shell.css — global site chrome (Apple-inspired)
   Scoped via `.al-scope.shell-v2` on header / nav wrappers and
   `.al-scope.shell-footer-v2` on footers. Depends on tokens defined in
   apple-system.css. Safe to load after apple-system.extensions.css.
*/

/* ---------- Root shell ---------- */
.al-scope.shell-v2 {
    --shell-header-height: 64px;
    --shell-header-height-mobile: 56px;
    --shell-max: 1200px;
}

.al-scope.shell-v2 .shell-root {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(0, 113, 227, 0.06), transparent 60%),
        linear-gradient(180deg, var(--ink-025) 0%, var(--ink-000) 220px);
}

.al-scope.shell-v2 .shell-body {
    flex: 1 1 auto;
    padding-top: 0;
    padding-bottom: 0;
}

.al-scope.shell-v2 .public-layout-frame {
    margin: 0;
    padding: 0;
}

/* ---------- Header ---------- */
.al-scope.shell-v2 .shell-header {
    position: sticky;
    top: 0;
    z-index: 1040;
    background: var(--surface-glass);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
    border-bottom: 1px solid var(--hairline);
}

/* Legacy fixed-top variant (replaces Bootstrap's navbar fixed-top) */
.al-scope.shell-v2 .shell-header--fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}

.al-scope.shell-v2 .shell-header__inner {
    max-width: var(--shell-max);
    margin: 0 auto;
    height: var(--shell-header-height);
    padding: 0 var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-5);
}

.al-scope.shell-v2 .shell-brand {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    text-decoration: none;
}

.al-scope.shell-v2 .shell-brand img {
    height: 32px;
    width: auto;
    display: block;
    image-rendering: -webkit-optimize-contrast;
}

/* ---------- Primary nav (desktop) ---------- */
.al-scope.shell-v2 .shell-nav {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0 auto;
    padding: 0;
    list-style: none;
}

.al-scope.shell-v2 .shell-nav__item {
    position: relative;
}

.al-scope.shell-v2 .shell-nav__link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 0;
    font-family: var(--font-text);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.005em;
    color: var(--ink-700);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color var(--dur-2, 180ms) var(--ease-out, ease);
}

.al-scope.shell-v2 .shell-nav__link::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 4px;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: center;
    opacity: 0;
    transition: transform var(--dur-2, 180ms) var(--ease-out, ease), opacity var(--dur-2, 180ms) var(--ease-out, ease);
}

.al-scope.shell-v2 .shell-nav__link:hover,
.al-scope.shell-v2 .shell-nav__link:focus-visible,
.al-scope.shell-v2 .shell-nav__link[aria-expanded="true"] {
    color: var(--ink-900);
    outline: none;
}

.al-scope.shell-v2 .shell-nav__link:hover::after,
.al-scope.shell-v2 .shell-nav__link:focus-visible::after,
.al-scope.shell-v2 .shell-nav__link[aria-expanded="true"]::after {
    transform: scaleX(1);
    opacity: 1;
}

.al-scope.shell-v2 .shell-nav__caret {
    font-size: 10px;
    opacity: 0.6;
}

/* ---------- Dropdown panel ---------- */
.al-scope.shell-v2 .shell-dropdown {
    min-width: 260px;
    padding: 10px;
    margin-top: 10px;
    background: var(--surface-raised);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

.al-scope.shell-v2 .shell-nav__item.is-open > .shell-dropdown {
    display: block;
}

.al-scope.shell-v2 .shell-dropdown .dropdown-item {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    font-family: var(--font-text);
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-800);
    text-decoration: none;
    transition: background var(--dur-2, 180ms) var(--ease-out, ease), color var(--dur-2, 180ms) var(--ease-out, ease);
}

.al-scope.shell-v2 .shell-dropdown .dropdown-item:hover,
.al-scope.shell-v2 .shell-dropdown .dropdown-item:focus-visible,
.al-scope.shell-v2 .shell-dropdown .dropdown-item.active {
    background: var(--surface-sunken);
    color: var(--ink-900);
    outline: none;
}

/* ---------- Actions / CTAs ---------- */
.al-scope.shell-v2 .shell-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-left: auto;
}

/* Dropdowns are driven by Bootstrap JS click toggle (data-bs-toggle="dropdown").
   No CSS hover/focus-within fallback — click-only prevents the panel from
   vanishing as the pointer moves toward it. */

.al-scope.shell-v2 .shell-actions__advisor {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.al-scope.shell-v2 .shell-actions__advisor-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent-500, #0071e3) 14%, transparent);
    color: var(--accent-600, #0054c4);
}

@media (max-width: 860px) {
    .al-scope.shell-v2 .shell-actions__advisor {
        display: none;
    }
}

.al-scope.shell-v2 .shell-actions .al-button {
    height: 36px;
    padding: 0 16px;
    font-size: 14px;
}

/* ---------- Mobile toggler ---------- */
.al-scope.shell-v2 .shell-toggler {
    display: none;
    margin-left: auto;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--ink-900);
    border: 1px solid var(--hairline-strong);
    border-radius: 12px;
    cursor: pointer;
}

.al-scope.shell-v2 .shell-toggler:focus-visible {
    outline: 2px solid var(--accent-500);
    outline-offset: 2px;
}

/* ---------- Mobile drawer ---------- */
.al-scope.shell-v2 .shell-drawer {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(88vw, 360px);
    background: var(--surface-raised);
    border-left: 1px solid var(--hairline);
    box-shadow: var(--shadow-xl);
    z-index: 1060;
    transform: translateX(100%);
    transition: transform var(--dur-3, 260ms) var(--ease-out, ease);
    display: flex;
    flex-direction: column;
    padding: var(--space-5);
    gap: var(--space-4);
    overflow-y: auto;
}

.al-scope.shell-v2 .shell-drawer[data-open="true"] {
    transform: translateX(0);
}

.al-scope.shell-v2 .shell-drawer__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 1050;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-3, 260ms) var(--ease-out, ease);
}

.al-scope.shell-v2 .shell-drawer__backdrop[data-open="true"] {
    opacity: 1;
    pointer-events: auto;
}

.al-scope.shell-v2 .shell-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.al-scope.shell-v2 .shell-drawer__close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--hairline);
    background: var(--surface-sunken);
    color: var(--ink-800);
    cursor: pointer;
}

.al-scope.shell-v2 .shell-drawer__section {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.al-scope.shell-v2 .shell-drawer__label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-500);
    padding: 8px 8px 4px;
}

.al-scope.shell-v2 .shell-drawer__link {
    display: block;
    padding: 12px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    color: var(--ink-800);
    text-decoration: none;
}

.al-scope.shell-v2 .shell-drawer__link:hover {
    background: var(--surface-sunken);
    color: var(--ink-900);
}

.al-scope.shell-v2 .shell-drawer__cta {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.al-scope.shell-v2 .shell-drawer__cta .al-button {
    width: 100%;
    justify-content: center;
}

/* ---------- PublicUserMenu compact pill ---------- */
.al-scope.shell-v2 .public-user-menu {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.al-scope.shell-v2 .public-user-menu__copy {
    display: none;
}

@media (min-width: 1100px) {
    .al-scope.shell-v2 .public-user-menu__copy {
        display: flex;
        flex-direction: column;
        line-height: 1.1;
    }
}

.al-scope.shell-v2 .public-user-menu__login,
.al-scope.shell-v2 .public-user-menu__logout {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 16px;
    border-radius: var(--radius-pill);
    font-family: var(--font-text);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--hairline-strong);
    background: transparent;
    color: var(--ink-900);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--dur-2, 180ms) var(--ease-out, ease);
}

.al-scope.shell-v2 .public-user-menu__login:hover,
.al-scope.shell-v2 .public-user-menu__logout:hover {
    background: var(--surface-sunken);
    color: var(--ink-900);
}

/* ---------- Breakpoints ---------- */
@media (max-width: 991.98px) {
    .al-scope.shell-v2 .shell-header__inner {
        height: var(--shell-header-height-mobile);
        padding: 0 var(--space-4);
        gap: var(--space-3);
    }

    .al-scope.shell-v2 .shell-nav,
    .al-scope.shell-v2 .shell-actions {
        display: none;
    }

    .al-scope.shell-v2 .shell-toggler {
        display: inline-flex;
    }
}

@media (max-width: 640px) {
    .al-scope.shell-v2 .shell-drawer__cta .al-button {
        width: 100%;
    }
}

/* Motion preference */
@media (prefers-reduced-motion: reduce) {

    .al-scope.shell-v2 .shell-drawer,
    .al-scope.shell-v2 .shell-drawer__backdrop,
    .al-scope.shell-v2 .shell-nav__link::after {
        transition: none;
    }
}

/* ---------- Footer v2 ---------- */
.al-scope.shell-footer-v2 {
    background: var(--ink-900);
    color: var(--ink-300);
    margin-top: var(--space-8);
}

.al-scope.shell-footer-v2 .shell-footer__inner {
    max-width: var(--shell-max, 1200px);
    margin: 0 auto;
    padding: var(--space-7) var(--space-5) var(--space-5);
}

.al-scope.shell-footer-v2 .shell-footer__grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: var(--space-6);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.al-scope.shell-footer-v2 .shell-footer__brand img {
    height: 30px;
    width: auto;
    margin-bottom: var(--space-3);
}

.al-scope.shell-footer-v2 .shell-footer__mission {
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink-300);
    max-width: 320px;
}

.al-scope.shell-footer-v2 .shell-footer__col-title {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #ffffff;
    margin: 0 0 var(--space-3);
}

.al-scope.shell-footer-v2 .shell-footer__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.al-scope.shell-footer-v2 .shell-footer__list a {
    color: var(--ink-300);
    font-size: 14px;
    text-decoration: none;
    transition: color var(--dur-2, 180ms) var(--ease-out, ease);
}

.al-scope.shell-footer-v2 .shell-footer__list a:hover,
.al-scope.shell-footer-v2 .shell-footer__list a:focus-visible {
    color: #ffffff;
    outline: none;
}

.al-scope.shell-footer-v2 .shell-footer__bottom {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    padding-top: var(--space-5);
    font-size: 12px;
    line-height: 1.6;
    color: #8e8e93;
}

.al-scope.shell-footer-v2 .shell-footer__legal p {
    margin: 0 0 6px;
    max-width: 760px;
}

.al-scope.shell-footer-v2 .shell-footer__legal a {
    color: #d2d2d7;
    text-decoration: none;
}

.al-scope.shell-footer-v2 .shell-footer__legal a:hover {
    color: #ffffff;
}

.al-scope.shell-footer-v2 .shell-footer__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    white-space: nowrap;
}

.al-scope.shell-footer-v2 .shell-footer__social {
    display: flex;
    gap: 12px;
}

.al-scope.shell-footer-v2 .shell-footer__social a {
    color: #d2d2d7;
    font-size: 16px;
    text-decoration: none;
}

.al-scope.shell-footer-v2 .shell-footer__social a:hover {
    color: #ffffff;
}

@media (max-width: 768px) {
    .al-scope.shell-footer-v2 .shell-footer__grid {
        grid-template-columns: 1fr 1fr;
    }

    .al-scope.shell-footer-v2 .shell-footer__bottom {
        flex-direction: column;
    }

    .al-scope.shell-footer-v2 .shell-footer__meta {
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .al-scope.shell-footer-v2 .shell-footer__grid {
        grid-template-columns: 1fr;
        gap: var(--space-5);
    }
}

/* ---------- Error / NotFound centred empty state ---------- */
.al-scope.shell-v2 .shell-empty {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-7) var(--space-5);
}

.al-scope.shell-v2 .shell-empty__inner {
    max-width: 520px;
    text-align: center;
}

.al-scope.shell-v2 .shell-empty__eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-600);
    margin-bottom: var(--space-3);
}

.al-scope.shell-v2 .shell-empty h1 {
    font-family: var(--font-display);
    font-size: clamp(32px, 5vw, 44px);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink-900);
    margin: 0 0 var(--space-3);
}

.al-scope.shell-v2 .shell-empty p {
    font-size: 17px;
    line-height: 1.5;
    color: var(--ink-600);
    margin: 0 0 var(--space-5);
}

.al-scope.shell-v2 .shell-empty__actions {
    display: inline-flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    justify-content: center;
}

@media (max-width: 640px) {
    .al-scope.shell-v2 .shell-empty__actions .al-button {
        width: 100%;
    }
}
