/* Site header, footer, and other shell chrome shared across every page. */

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid var(--border);
    background: rgba(28, 32, 41, 0.85);
    backdrop-filter: blur(10px);
}

.header-bar {
    height: 3.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}


.header-logo {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    overflow: visible;
}

.header-logo img,
.header-logo__img {
    display: block;
    width: clamp(1.75rem, 3.2vw, 2.25rem);
    height: auto;
    flex-shrink: 0;
    transform-origin: center;
    transition: transform 0.25s ease, filter 0.25s ease;
}

.header-logo .text-dispatch {
    position: relative;
    display: inline-block;
    white-space: nowrap;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.header-logo:hover img,
.header-logo:focus-visible img {
    animation: logo-signal 0.7s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 0.35rem var(--primary)) drop-shadow(0 0 0.7rem var(--primary));
}

.header-logo:hover .text-dispatch,
.header-logo:focus-visible .text-dispatch {
    animation: wordmark-impact 0.45s ease-out both;
    color: var(--foreground);
}

.header-logo .text-dispatch::after {
    position: absolute;
    top: 50%;
    left: -0.6rem;
    width: 0.5rem;
    height: 1px;
    content: '';
    opacity: 0;
    background: var(--signal);
    box-shadow: 0 0 0.4rem var(--signal);
}

.header-logo:hover .text-dispatch::after,
.header-logo:focus-visible .text-dispatch::after {
    animation: tracer-pass 0.45s ease-out both;
}

@keyframes logo-signal {
    from {
        transform: translateY(0) rotate(0deg) scale(1);
    }

    to {
        transform: translateY(-0.15rem) rotate(-5deg) scale(1.12);
    }
}

@keyframes wordmark-impact {

    0%,
    62% {
        transform: translateX(0);
    }

    70% {
        transform: translateX(0.16rem);
        text-shadow: -0.18rem 0 var(--primary), 0 0 0.55rem var(--signal);
    }

    82% {
        transform: translateX(-0.08rem);
    }

    100% {
        transform: translateX(0);
        text-shadow: 0 0 0.25rem rgba(217, 154, 78, 0.55);
    }
}

@keyframes tracer-pass {

    0%,
    55% {
        transform: translateX(0) scaleX(0);
        opacity: 0;
    }

    70% {
        transform: translateX(2.5rem) scaleX(5);
        opacity: 1;
    }

    100% {
        transform: translateX(5rem) scaleX(0);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {

    .header-logo img,
    .header-logo .text-dispatch {
        transition: none;
    }

    .header-logo:hover img,
    .header-logo:focus-visible img {
        animation: none;
        transform: scale(1.06);
    }

    .header-logo:hover .text-dispatch,
    .header-logo:focus-visible .text-dispatch,
    .header-logo:hover .text-dispatch::after,
    .header-logo:focus-visible .text-dispatch::after {
        animation: none;
    }
}


.header-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 39;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0.125rem;
    border-bottom: 1px solid var(--border);
    background: var(--card);
    padding: 0.5rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.header-nav.is-open {
    display: flex;
}

@media (min-width: 768px) {
    .header-nav {
        position: static;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0.25rem;
        border-bottom: none;
        background: transparent;
        padding: 0;
        box-shadow: none;
    }
}

.header-nav a {
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
    transition: color 0.15s ease;
}

@media (min-width: 768px) {
    .header-nav a {
        padding: 0.375rem 0.625rem;
    }
}

.header-nav a:hover,
.header-nav a[aria-current='page'] {
    color: var(--foreground);
}

.header-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--foreground);
}

.header-nav-toggle svg {
    width: 1.125rem;
    height: 1.125rem;
}

@media (min-width: 768px) {
    .header-nav-toggle {
        display: none;
    }
}

.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-with-account {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-account {
    position: relative;
}

.header-avatar-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 2rem;
    padding: 0 0.375rem 0 0;
    border: none;
    background: transparent;
    color: var(--foreground);
}

.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    background: var(--secondary);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    border-radius: 50%;
    overflow: hidden;
}

.header-username {
    display: none;
    font-size: 0.8125rem;
    white-space: nowrap;
}

@media (min-width: 640px) {
    .header-username {
        display: inline;
    }
}

.header-chevron {
    display: none;
    width: 0.875rem;
    height: 0.875rem;
    color: var(--muted-foreground);
}

@media (min-width: 640px) {
    .header-chevron {
        display: inline-flex;
    }
}

.account-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 50;
    width: 13rem;
    border: 1px solid var(--border);
    background: var(--popover, var(--card));
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    display: none;
    flex-direction: column;
    padding: 0.375rem;
}

.account-menu.is-open {
    display: flex;
}

.account-menu__label {
    padding: 0.5rem 0.625rem;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.account-menu__label span:last-child {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--muted-foreground);
}

.account-menu hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0.25rem 0;
}

.account-menu button,
.account-menu a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.625rem;
    font-size: 0.875rem;
    background: transparent;
    border: none;
    text-align: left;
}

.account-menu button:hover,
.account-menu a:hover {
    background: var(--secondary);
}

.account-menu svg {
    width: 1rem;
    height: 1rem;
    color: var(--muted-foreground);
}

#site-footer {
    border-top: 1px solid var(--border);
}

.site-footer__inner {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-block: 2rem;
}

@media (min-width: 768px) {
    .site-footer__inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.site-footer__brand {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.site-footer__brand-mark {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.site-footer__brand-mark span.mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--primary);
    color: var(--primary-foreground);
}

.site-footer__brand-mark span.mark svg {
    width: 0.875rem;
    height: 0.875rem;
}

.site-footer__brand-mark span.wordmark {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.site-footer__blurb {
    max-width: 24rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.site-footer__nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
}

.site-footer__nav a {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    transition: color 0.15s ease;
}

.site-footer__nav a:hover {
    color: var(--foreground);
}

.site-footer__build {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted-foreground);
}