:root {
    --site-shell-width: 1440px;

    /* Premium dark palette */
    --site-bg:               #0b0f19;
    --site-bg-alt:           #131b2e;
    --site-text:             #cbd5e1;
    --site-text-strong:      #f8fafc;
    --site-text-muted:       #94a3b8;
    --site-border:           rgba(255, 255, 255, 0.10);
    --site-accent:           #f97316;
    --site-accent-strong:    #ea580c;
    --site-accent-tint:      rgba(249, 115, 22, 0.12);
    --site-accent-tint-strong: rgba(249, 115, 22, 0.22);
    --site-accent-cyan:      #38bdf8;
    --site-header-bg:        rgba(11, 15, 25, 0.88);
}

[data-theme="light"] {
    --site-bg:               #f8fafc;
    --site-bg-alt:           #ffffff;
    --site-text:             #334155;
    --site-text-strong:      #0f172a;
    --site-text-muted:       #64748b;
    --site-border:           rgba(15, 23, 42, 0.10);
    --site-accent:           #f97316;
    --site-accent-strong:    #ea580c;
    --site-accent-tint:      rgba(249, 115, 22, 0.10);
    --site-accent-tint-strong: rgba(249, 115, 22, 0.18);
    --site-accent-cyan:      #0284c7;
    --site-header-bg:        rgba(248, 250, 252, 0.92);
}


#global-header *,
#global-footer * {
    animation: none !important;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10040;
    background:
        linear-gradient(180deg, rgba(8,8,13,0.94) 0%, rgba(11,11,18,0.90) 100%),
        radial-gradient(ellipse at top right, rgba(249,115,22,0.08) 0%, transparent 55%);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-bottom: 1px solid rgba(255,255,255,0.07);
    box-shadow:
        0 1px 0 rgba(249,115,22,0.18),
        0 8px 32px rgba(0,0,0,0.40);
    isolation: isolate;
    overflow: visible;
}

[data-theme="light"] .site-header {
    background:
        linear-gradient(180deg, rgba(248,248,252,0.96) 0%, rgba(240,240,248,0.92) 100%),
        radial-gradient(ellipse at top right, rgba(249,115,22,0.06) 0%, transparent 55%);
    border-bottom: 1px solid rgba(10,10,30,0.10);
    box-shadow:
        0 1px 0 rgba(249,115,22,0.14),
        0 4px 16px rgba(0,0,0,0.08);
}

.site-header__inner,
.site-footer__inner {
    width: min(var(--site-shell-width), calc(100% - 2rem));
    margin: 0 auto;
}

.site-header__inner {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-block: 0.55rem;
    flex-wrap: wrap;
    overflow: visible;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
    color: var(--site-text-strong);
    text-decoration: none;
    flex-shrink: 0;
    min-width: 0;
}

.site-brand__mark {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    border: 1px solid var(--site-accent);
    background: var(--site-accent);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    box-shadow: 0 4px 10px rgba(249, 115, 22, 0.25);
}

.site-brand__copy {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.site-brand__copy strong {
    color: #ffffff;
    font-size: 1rem;
    line-height: 1.1;
}

.site-brand__copy span {
    color: #8888a8;
    font-size: 0.82rem;
    line-height: 1.2;
}

[data-theme="light"] .site-brand__copy strong { color: var(--site-text-strong); }
[data-theme="light"] .site-brand__copy span   { color: var(--site-text-muted); }

.site-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    flex-wrap: wrap;
    min-width: 0;
    overflow: visible;
}

.site-nav__link,
.site-tools__summary,
.site-tools__trigger {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    border-radius: 999px;
    border: 1px solid var(--site-accent);
    background: var(--site-accent);
    color: #ffffff;
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(249, 115, 22, 0.2);
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.site-nav__link:hover,
.site-tools__summary:hover,
.site-tools__trigger:hover,
.site-nav__link.is-current,
.site-tools__summary.is-current,
.site-tools__trigger.is-current,
.site-tools.is-open .site-tools__trigger {
    background: var(--site-accent-strong);
    border-color: var(--site-accent-strong);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(249, 115, 22, 0.28);
}

.site-tools {
    position: relative;
    overflow: visible;
    z-index: 2;
}

.site-tools.is-open {
    z-index: 10045;
}

.site-tools__trigger {
    appearance: none;
    list-style: none;
    margin-left: 0.5rem;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid var(--site-accent);
    background: #ffffff;
    color: var(--site-accent);
    cursor: pointer;
    transition: all 140ms ease;
}

.theme-toggle:hover {
    background: var(--site-accent-tint);
    border-color: var(--site-accent-strong);
    color: var(--site-accent-strong);
    transform: translateY(-1px);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

[data-theme="light"] .theme-toggle__sun,
[data-theme="dark"] .theme-toggle__moon {
    display: none;
}

.site-tools__menu {
    min-width: 220px;
    max-width: min(280px, calc(100vw - 16px));
    padding: 0.5rem;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(12, 12, 20, 0.96);
    backdrop-filter: blur(28px) saturate(160%);
    -webkit-backdrop-filter: blur(28px) saturate(160%);
    box-shadow:
        0 0 0 1px rgba(249,115,22,0.12),
        0 20px 48px rgba(0,0,0,0.55),
        0 4px 16px rgba(249,115,22,0.10);
    z-index: 10050;
}

[data-theme="light"] .site-tools__menu {
    background: rgba(248, 248, 252, 0.96);
    border-color: rgba(10,10,30,0.10);
    box-shadow:
        0 0 0 1px rgba(249,115,22,0.12),
        0 20px 48px rgba(0,0,0,0.12),
        0 4px 16px rgba(249,115,22,0.08);
}

.site-tools__layer {
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    z-index: 10050;
}

.site-tools__layer[hidden] {
    display: none;
}

.site-tools__group-label {
    margin: 0.55rem 0.8rem 0.2rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--site-accent-strong);
    pointer-events: none;
}

.site-tools__group-label:first-child {
    margin-top: 0.2rem;
}

.site-tools__menu a {
    display: block;
    padding: 0.7rem 0.8rem;
    border-radius: 12px;
    color: #d8d8ee;
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 600;
    transition: background 120ms ease, color 120ms ease;
}

.site-tools__menu a:hover {
    background: rgba(249,115,22,0.14);
    color: #fb923c;
}

.site-tools__menu a.is-current {
    background: var(--site-accent);
    color: #ffffff;
    font-weight: 700;
}

[data-theme="light"] .site-tools__menu a {
    color: var(--site-text);
}

[data-theme="light"] .site-tools__menu a:hover {
    background: var(--site-accent-tint);
    color: var(--site-accent-strong);
}

.site-footer {
    padding: 3rem 0 1.5rem;
    background:
        linear-gradient(180deg, rgba(10,10,18,0.0) 0%, #0a0a12 8%, #08080f 100%),
        radial-gradient(ellipse at bottom left, rgba(249,115,22,0.07) 0%, transparent 50%);
    border-top: 1px solid rgba(255,255,255,0.07);
    box-shadow: inset 0 1px 0 rgba(249,115,22,0.12);
}

.site-footer__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) repeat(5, minmax(0, 1fr));
    gap: 1.5rem;
}

@media (max-width: 1180px) {
    .site-footer__grid {
        grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
    }
    .site-footer__brand { grid-column: 1 / -1; }
}

.site-brand--footer {
    margin-bottom: 1rem;
}

.site-footer__text,
.site-footer__bottom p {
    margin: 0;
    color: #9090b0;
    line-height: 1.7;
}

.site-footer__title {
    margin: 0 0 0.9rem;
    color: #fb923c;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* Footer brand text on dark background */
.site-footer .site-brand__copy strong { color: #ffffff; }
.site-footer .site-brand__copy span   { color: #9090b0; }

.site-footer__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.7rem;
}

.site-footer__list a {
    color: #9090b0;
    text-decoration: none;
    transition: color 140ms ease;
}

.site-footer__list a:hover {
    color: #fb923c;
    text-decoration: underline;
    text-underline-offset: 3px;
}

[data-theme="light"] .site-footer__list a       { color: #c9c9e0; }
[data-theme="light"] .site-footer__list a:hover  { color: #fb923c; }
[data-theme="light"] .site-footer__text,
[data-theme="light"] .site-footer__bottom p,
[data-theme="light"] .site-footer__bottom       { color: #a0a0c0; }

.site-footer__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.2rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    color: #686888;
}

@media (max-width: 980px) {
    .site-header__inner {
        padding: 0.6rem 0;
    }
}

@media (max-width: 840px) {
    .site-footer__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .site-header__inner,
    .site-footer__inner {
        width: min(var(--site-shell-width), calc(100% - 1.25rem));
    }

    .site-nav__link,
    .site-tools__summary,
    .site-tools__trigger {
        font-size: 0.8rem;
        padding: 0 0.75rem;
    }

    .site-footer__grid,
    .site-footer__bottom {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: flex-start;
    }

    #theme-toggle {
        display: none !important;
    }
}

@media (max-width: 560px) {
    .site-header__inner {
        gap: 0.75rem;
        align-items: center;
    }

    .site-brand {
        flex: 1 1 auto;
    }

    .site-brand__mark {
        width: 38px;
        height: 38px;
        border-radius: 12px;
        font-size: 0.86rem;
    }

    .site-brand__copy strong {
        font-size: 0.92rem;
    }

    .site-brand__copy span {
        font-size: 0.76rem;
    }

    .site-nav {
        width: auto;
        justify-content: flex-end;
    }

    .site-tools__trigger {
        min-height: 36px;
        padding-inline: 0.82rem;
    }

    .site-tools__menu {
        max-width: calc(100vw - 12px);
    }
}

@media (max-width: 767px) {
    .site-tools__layer {
        position: fixed;
        top: calc(var(--header-height, 64px) + 8px) !important;
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
    }

    .site-tools__menu {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        padding: 1rem;
        box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    }
    
    .site-tools__menu a {
        padding: 0.9rem 1rem;
        font-size: 1.05rem;
    }
}

/* --- Desktop Navigation --- */
.desktop-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
    margin-right: 0.5rem;
}

.desktop-nav__link {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    color: var(--site-text);
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 140ms ease;
}

.desktop-nav__link:hover,
.desktop-nav__link.is-current {
    color: var(--site-accent);
    background: var(--site-accent-tint);
}

.desktop-nav__link.is-current {
    font-weight: 600;
}

@media (max-width: 960px) {
    .desktop-nav {
        display: none;
    }
}

/* --- Search Trigger Button --- */
.header-search-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 38px;
    padding: 0 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--site-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--site-text-muted);
    font-size: 0.84rem;
    cursor: pointer;
    transition: all 140ms ease;
}

.header-search-btn:hover {
    border-color: var(--site-accent);
    color: var(--site-text-strong);
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .header-search-btn {
    background: rgba(0, 0, 0, 0.04);
}

.header-search-btn__kbd {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.4rem;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 4px;
    background: var(--site-border);
    color: var(--site-text-muted);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

@media (max-width: 640px) {
    .header-search-btn__text,
    .header-search-btn__kbd {
        display: none;
    }
    .header-search-btn {
        padding: 0 0.6rem;
        width: 38px;
        justify-content: center;
    }
}

/* --- Command Palette Search Modal --- */
.search-modal[hidden] {
    display: none !important;
}

.search-modal {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    padding-inline: 1rem;
}

.search-modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.search-modal__box {
    position: relative;
    width: 100%;
    max-width: 640px;
    border-radius: 16px;
    border: 1px solid var(--site-border);
    background: var(--site-bg-alt);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--site-accent-tint-strong);
    overflow: hidden;
    z-index: 1;
    color: var(--site-text);
}

.search-modal__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--site-border);
    background: rgba(255, 255, 255, 0.02);
}

.search-modal__icon {
    color: var(--site-accent);
    flex-shrink: 0;
}

.search-modal__input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--site-text-strong);
    font-size: 1.05rem;
    font-family: inherit;
}

.search-modal__close {
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--site-border);
    background: transparent;
    color: var(--site-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.search-modal__body {
    max-height: 55vh;
    overflow-y: auto;
    padding: 1rem 1.25rem;
}

.search-modal__hint {
    font-size: 0.85rem;
    color: var(--site-text-muted);
    margin-bottom: 0.75rem;
}

.search-modal__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.search-tag-btn {
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--site-border);
    background: var(--site-accent-tint);
    color: var(--site-text);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 140ms ease;
}

.search-tag-btn:hover {
    border-color: var(--site-accent);
    color: var(--site-accent-strong);
}

.search-result-item {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    text-decoration: none;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    transition: all 140ms ease;
}

.search-result-item:hover,
.search-result-item.is-selected {
    background: var(--site-accent-tint);
    border-color: var(--site-accent);
}

.search-result-item__title {
    color: var(--site-text-strong);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.search-result-item__desc {
    color: var(--site-text-muted);
    font-size: 0.82rem;
}

.search-modal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--site-border);
    font-size: 0.78rem;
    color: var(--site-text-muted);
    background: rgba(0, 0, 0, 0.1);
}

.search-modal__footer kbd {
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    border: 1px solid var(--site-border);
    font-family: inherit;
    font-size: 0.72rem;
}

