/* ========== RESET & ROOT ========== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --c-primary-bg: #0A1128;
    --c-primary-accent: #00E878;
    --c-secondary-accent: #FF6B35;
    --c-section-bg-1: #1A3A3A;
    --c-section-bg-2: #5C1A3C;
    --c-section-bg-3: #2D1B4E;
    --c-bg-light: #F5F7FA;
    --c-text-light: #E8ECF1;
    --c-text-dark: #0A1128;
    --c-text-muted: #8896A5;
    --c-border: #ffffff26;
    --c-border-strong: #ffffff4d;
    --font-headline: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-serif: "Noto Serif SC", "Songti SC", serif;
    --font-body: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    --font-data: "Roboto Mono", "SFMono-Regular", Consolas, monospace;
    --space-1: 0.5rem;
    --space-2: 1rem;
    --space-3: 2rem;
    --space-4: 4rem;
    --space-5: 7rem;
    --header-offset: 0px;
    --focus-outline: 3px solid var(--c-primary-accent);
    --shadow-panel: 0 12px 0 #00000040;
}

/* ========== BASE ========== */
html {
    scroll-behavior: smooth;
    background-color: var(--c-primary-bg);
}

body {
    font-family: var(--font-body);
    line-height: 1.75;
    color: var(--c-text-light);
    background-color: var(--c-primary-bg);
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3 {
    font-family: var(--font-headline);
    line-height: 1.2;
}

p {
    margin-bottom: var(--space-2);
}

a {
    color: var(--c-primary-accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

a:hover {
    border-bottom-color: var(--c-primary-accent);
    color: var(--c-primary-accent);
}

:focus-visible {
    outline: var(--focus-outline);
    outline-offset: 3px;
}

.mono-data {
    font-family: var(--font-data);
    letter-spacing: 0.02em;
}

/* ========== SKIP LINK ========== */
.site-skip-link {
    position: fixed;
    top: -100px;
    left: var(--space-2);
    z-index: 3000;
    background: var(--c-secondary-accent);
    color: var(--c-text-dark);
    font-weight: 700;
    padding: var(--space-2) var(--space-3);
    border: 0;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 6px 0 #00000066;
    transition: top 0.2s ease;
    text-decoration: none;
}

.site-skip-link:focus {
    top: 0;
}

/* ========== HEADER ========== */
.site-header {
    position: relative;
    background-color: var(--c-primary-bg);
    border-bottom: 4px solid var(--c-primary-accent);
    z-index: 1000;
}

/* 状态条 */
.status-bar {
    background: #00000066;
    border-bottom: 1px solid var(--c-border);
    font-size: 0.8rem;
    color: var(--c-text-muted);
}

.status-bar__inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0.4rem var(--space-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

.status-bar__item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.status-bar__item--ticker {
    flex: 1;
    overflow: hidden;
    text-align: center;
    justify-content: center;
}

.status-bar__item--note {
    color: var(--c-primary-accent);
    font-weight: 600;
}

.status-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--c-primary-accent);
    box-shadow: 0 0 8px var(--c-primary-accent);
    animation: pulse-dot 2s ease-in-out infinite alternate;
    flex-shrink: 0;
}

.status-dot--small {
    width: 7px;
    height: 7px;
}

@keyframes pulse-dot {
    0% { opacity: 0.6; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1.1); }
}

.status-ticker {
    display: inline-block;
    white-space: nowrap;
    animation: ticker-scroll 38s linear infinite;
    color: var(--c-text-light);
}

@keyframes ticker-scroll {
    0% { transform: translateX(15%); }
    100% { transform: translateX(-60%); }
}

/* 品牌区 */
.masthead {
    border-bottom: 1px solid var(--c-border);
    background-color: var(--c-primary-bg);
}

.masthead__inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: var(--space-2) var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    border: 0;
    flex-shrink: 0;
}

.brand:hover {
    border-bottom: 0;
}

.brand-mark {
    width: 32px;
    height: 32px;
    background: var(--c-secondary-accent);
    clip-path: polygon(0 0, 85% 0, 100% 50%, 85% 100%, 0 100%);
    box-shadow: 0 0 15px #FF6B3580;
    position: relative;
    flex-shrink: 0;
}

.brand-mark::after {
    content: "";
    position: absolute;
    inset: 4px;
    background: var(--c-primary-bg);
    clip-path: polygon(0 0, 75% 0, 90% 50%, 75% 100%, 0 100%);
}

.brand-text {
    font-family: var(--font-headline);
    font-weight: 900;
    font-size: 2.5rem;
    line-height: 1;
    color: var(--c-text-light);
    letter-spacing: 0.02em;
}

.masthead__tagline {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--c-text-muted);
    letter-spacing: 0.1em;
    border-left: 3px solid var(--c-secondary-accent);
    padding-left: var(--space-2);
}

.masthead__code {
    margin-left: auto;
    color: var(--c-text-muted);
    font-size: 0.75rem;
    border: 1px solid var(--c-border);
    padding: 0.25rem 0.7rem;
    letter-spacing: 0.05em;
}

/* 主导航 */
.nav-toggle {
    display: none;
    border: 0;
    background: var(--c-primary-accent);
    color: var(--c-text-dark);
    font-weight: 700;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.95rem;
    width: 100%;
    text-align: left;
    align-items: center;
    gap: 8px;
    position: relative;
}

.nav-toggle__text {
    font-weight: 700;
}

.nav-toggle__line {
    display: block;
    width: 24px;
    height: 3px;
    background: var(--c-text-dark);
    margin-bottom: 4px;
}

.nav-toggle__line:last-child {
    margin-bottom: 0;
}

.primary-nav {
    background: #00000033;
    border-bottom: 1px solid var(--c-border);
}

.nav-list {
    list-style: none;
    display: flex;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 var(--space-3);
}

.nav-item {
    position: relative;
}

.nav-item__link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.8rem 1.1rem;
    color: var(--c-text-light);
    font-weight: 600;
    border: 0;
    border-bottom: 3px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.nav-item__link:hover {
    background: #ffffff12;
    border-bottom-color: var(--c-primary-accent);
    color: var(--c-primary-accent);
}

.nav-item__link[aria-current="page"] {
    background: var(--c-primary-accent);
    color: var(--c-text-dark);
    border-bottom-color: var(--c-secondary-accent);
}

.nav-item__link[aria-current="page"]:hover {
    color: var(--c-text-dark);
    border-bottom-color: var(--c-secondary-accent);
}

.nav-item__index {
    font-size: 0.7rem;
    color: var(--c-text-muted);
}

.nav-item__link[aria-current="page"] .nav-item__index {
    color: #00000088;
}

/* ========== FOOTER ========== */
.site-footer {
    background-color: var(--c-section-bg-3);
    color: var(--c-text-light);
    margin-top: var(--space-5);
    border-top: 6px solid var(--c-primary-accent);
    position: relative;
}

.site-footer::before {
    content: "";
    display: block;
    height: 4px;
    background: repeating-linear-gradient(135deg, var(--c-primary-accent) 0 12px, transparent 12px 20px);
    opacity: 0.6;
}

.site-footer__inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: var(--space-4) var(--space-3) var(--space-2);
}

.footer__grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
    gap: var(--space-4);
}

.footer__brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    border: 0;
}

.footer__brand-link:hover {
    border: 0;
}

.footer__brand-mark {
    width: 26px;
    height: 26px;
    background: var(--c-secondary-accent);
    clip-path: polygon(0 0, 85% 0, 100% 50%, 85% 100%, 0 100%);
    box-shadow: 0 0 10px #FF6B3580;
}

.footer__brand-name {
    font-family: var(--font-headline);
    font-weight: 900;
    font-size: 1.8rem;
    color: var(--c-text-light);
    letter-spacing: 0.02em;
}

.footer__slogan {
    color: var(--c-primary-accent);
    letter-spacing: 0.1em;
    margin: var(--space-1) 0 var(--space-2);
    font-weight: 600;
}

.footer__trust {
    font-size: 0.85rem;
    color: var(--c-text-muted);
    max-width: 340px;
}

.footer__heading {
    color: var(--c-text-light);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: var(--space-2);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--c-secondary-accent);
    display: inline-block;
    letter-spacing: 0.08em;
}

.footer__links,
.footer__contact {
    list-style: none;
}

.footer__links li,
.footer__contact li {
    margin-bottom: 0.5rem;
}

.footer__links a,
.footer__contact a {
    color: var(--c-text-light);
    transition: color 0.2s ease, padding-left 0.2s ease;
}

.footer__links a:hover,
.footer__contact a:hover {
    color: var(--c-primary-accent);
    padding-left: 4px;
    border-bottom-color: transparent;
}

.footer__contact li {
    font-size: 0.9rem;
    color: var(--c-text-muted);
}

.footer__note {
    font-size: 0.8rem;
    color: var(--c-text-muted);
    line-height: 1.65;
    margin-top: var(--space-2);
    border-left: 3px solid var(--c-secondary-accent);
    padding-left: var(--space-2);
}

.footer__bottom-line {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
    border-top: 1px solid var(--c-border);
    margin-top: var(--space-4);
    padding-top: var(--space-2);
    font-size: 0.8rem;
    color: var(--c-text-muted);
}

.footer__copyright {
    margin: 0;
}

.footer__icp {
    border: 1px solid var(--c-border);
    padding: 0.2rem 0.6rem;
}

.footer__state {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--c-primary-accent);
    margin: 0;
}

/* ========== 通用组件 ========== */
/* 章节大编号 */
.section-symbol {
    font-family: var(--font-data);
    font-size: 4.5rem;
    font-weight: 700;
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 2px var(--c-primary-accent);
    display: block;
    margin-bottom: var(--space-2);
}

.section-symbol--orange {
    -webkit-text-stroke: 2px var(--c-secondary-accent);
}

/* 数据标签 */
.data-chip {
    display: inline-block;
    background: var(--c-primary-accent);
    color: var(--c-text-dark);
    font-family: var(--font-data);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.2rem 0.7rem;
    border: 0;
    letter-spacing: 0.04em;
}

.data-chip--alert {
    background: var(--c-secondary-accent);
    color: var(--c-text-dark);
}

/* 面板框 */
.panel-frame {
    border: 4px solid var(--c-border-strong);
    background: #00000040;
    padding: var(--space-3);
    box-shadow: var(--shadow-panel);
    position: relative;
}

.panel-frame::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 56px;
    height: 6px;
    background: var(--c-secondary-accent);
}

.panel-frame--light {
    background: var(--c-bg-light);
    color: var(--c-text-dark);
    border-color: #0A1128;
}

/* 主题筛选按钮 */
.topic-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: var(--space-3);
}

.topic-tabs button {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    background: #ffffff12;
    border: 2px solid var(--c-border-strong);
    color: var(--c-text-light);
    padding: 0.5rem 1.2rem;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.topic-tabs button:hover {
    border-color: var(--c-primary-accent);
    color: var(--c-primary-accent);
}

.topic-tabs button.is-active {
    background: var(--c-primary-accent);
    border-color: var(--c-primary-accent);
    color: var(--c-text-dark);
    font-weight: 700;
}

.topic-tabs button[aria-pressed="true"] {
    background: var(--c-primary-accent);
    border-color: var(--c-primary-accent);
    color: var(--c-text-dark);
    font-weight: 700;
}

/* 滚动进度条 */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 5px;
    background: var(--c-primary-accent);
    width: 0%;
    z-index: 5000;
    box-shadow: 0 0 12px var(--c-primary-accent);
    pointer-events: none;
}

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .footer__grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-3);
    }

    .masthead__code {
        display: none;
    }

    .status-bar__item--note {
        display: none;
    }
}

@media (max-width: 768px) {
    :root {
        --space-4: 2.5rem;
        --space-5: 4rem;
    }

    /* 状态条精简 */
    .status-bar__inner {
        padding: 0.3rem var(--space-2);
    }

    .status-bar__item--ticker {
        justify-content: flex-start;
    }

    /* 品牌区简易化 */
    .masthead__inner {
        padding: var(--space-1) var(--space-2);
        flex-wrap: wrap;
    }

    .brand-text {
        font-size: 1.8rem;
    }

    .masthead__tagline {
        font-size: 0.7rem;
        display: none;
    }

    /* 导航切换按钮 */
    .nav-toggle {
        display: flex;
        border: 0;
        border-radius: 0;
        padding: 12px 16px;
        background: var(--c-secondary-accent);
    }

    .nav-toggle[aria-expanded="true"] .nav-toggle__line:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .nav-toggle[aria-expanded="true"] .nav-toggle__line:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle[aria-expanded="true"] .nav-toggle__line:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* 移动导航面板 */
    .primary-nav {
        display: none;
        border-top: 2px solid var(--c-secondary-accent);
    }

    .primary-nav[data-open] {
        display: block;
    }

    .nav-list {
        flex-direction: column;
        padding: 0.5rem 0;
    }

    .nav-item__link {
        padding: 0.9rem 1.5rem;
        border-left: 4px solid transparent;
        border-bottom: 1px solid var(--c-border);
    }

    .nav-item__link:hover {
        border-left-color: var(--c-primary-accent);
        border-bottom-color: var(--c-border);
    }

    .nav-item__link[aria-current="page"] {
        border-left-color: var(--c-secondary-accent);
        background: var(--c-primary-accent);
    }

    /* 页脚调整 */
    .site-footer__inner {
        padding: var(--space-4) var(--space-2) var(--space-2);
    }

    .footer__grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .footer__bottom-line {
        flex-direction: column;
        align-items: flex-start;
    }

    .scroll-progress {
        height: 4px;
    }
}

@media (max-width: 480px) {
    .status-bar__item--ticker {
        display: none;
    }

    .brand-mark {
        width: 26px;
        height: 26px;
    }

    .brand-text {
        font-size: 1.5rem;
    }
}

/* ========== 動效与无障碍 ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
