/**
 * site.css — 全站主样式（首页 / 年度 data / 历史上的今天 today）
 * 视觉：交易台账（ledger）— 墨色纸面 + 琥珀刻度线，图表优先
 * 字体：fonts.css（Syne / Noto Sans SC / DM Mono）
 */

/* ========== 设计令牌 ========== */
:root {
    --ink: #12181f;
    --ink-soft: #2a3441;
    --paper: #f2f5f8;
    --panel: #ffffff;
    --rule: #d5dce3;
    --amber: #c9a227;
    --amber-dim: #a8841c;
    --teal: #0f766e;
    --rose: #be123c;
    --muted: #5c6b7a;
    --focus: #1d4ed8;
    --max: 1120px;
    --nav-h: 56px;
    --font-display: "Syne", "Noto Sans SC", sans-serif;
    --font-body: "Noto Sans SC", sans-serif;
    --font-mono: "DM Mono", ui-monospace, monospace;
    --ease: 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* ========== 基础重置 ========== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(1200px 480px at 8% -10%, rgba(201, 162, 39, 0.12), transparent 55%),
        radial-gradient(900px 420px at 100% 0%, rgba(15, 118, 110, 0.08), transparent 50%),
        var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

a {
    color: var(--teal);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover {
    color: var(--amber-dim);
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

/* ========== 顶栏导航（header.php） ========== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-h);
    background: rgba(18, 24, 31, 0.94);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(201, 162, 39, 0.35);
}

.site-header__inner {
    max-width: var(--max);
    height: 100%;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.site-logo {
    display: inline-flex;
    align-items: center;
    color: #fff;
    text-decoration: none;
    flex-shrink: 0;
    min-height: 44px;
}

.site-logo:hover {
    color: #fff;
}

.site-logo__word {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.site-logo__word span {
    color: var(--amber);
    font-weight: 600;
    margin-left: 6px;
    font-size: 13px;
    letter-spacing: 0.04em;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    list-style: none;
    padding: 0;
}

/* 币种切换：BTC / 以太坊 / BNB */
.site-nav__coins {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-right: 6px;
    padding-right: 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.site-nav__coins a {
    /* 与右侧导航同一套字号/字重，不再用等宽字体 */
    padding: 0 12px;
}

.site-nav__coins a.is-active {
    color: var(--amber);
    background: rgba(201, 162, 39, 0.12);
}

.site-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-size: 14px;
    border-radius: 4px;
    transition: color var(--ease), background var(--ease);
}

.site-nav a:hover,
.site-nav a.is-active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.site-nav__more {
    position: relative;
}

.site-nav__panel {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 168px;
    padding: 8px;
    background: var(--ink);
    border: 1px solid rgba(201, 162, 39, 0.35);
    border-radius: 6px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.site-nav__more:hover .site-nav__panel,
.site-nav__more:focus-within .site-nav__panel {
    display: grid;
    gap: 2px;
}

.site-nav__panel a {
    min-height: 40px;
    width: 100%;
}

.site-nav-toggle {
    display: none;
    margin-left: auto;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    padding: 0;
}

.site-nav-toggle__bars {
    display: block;
    width: 18px;
    height: 2px;
    margin: 0 auto;
    background: currentColor;
    box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}

/* ========== 主布局 ========== */
.site-main {
    max-width: var(--max);
    margin: 0 auto;
    padding: 20px 16px 12px;
}

/* 页面标题区：居中 + 琥珀刻度线 */
.page-hero {
    margin-bottom: 18px;
    text-align: center;
    animation: rise-in 0.55s var(--ease) both;
}

.page-hero__eyebrow {
    margin: 0 0 6px;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    font-family: var(--font-mono);
}

.page-hero__title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.45rem, 3.2vw, 2rem);
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.page-hero__sub {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
}

/* 签名：琥珀账本刻度线（居中） */
.ledger-rule {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0;
    height: 18px;
    margin: 14px auto 0;
    max-width: 420px;
    border-bottom: 2px solid var(--amber);
    overflow: hidden;
}

.ledger-rule i {
    display: block;
    width: 1px;
    margin-right: 7px;
    background: var(--amber);
    opacity: 0.55;
    flex-shrink: 0;
}

.ledger-rule i:nth-child(5n) {
    height: 14px;
    opacity: 1;
    width: 2px;
}

.ledger-rule i:not(:nth-child(5n)) {
    height: 7px;
}

/* ========== 行情胶带（高低价 / 涨跌幅） ========== */
.tape {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    background: var(--rule);
    border: 1px solid var(--rule);
    margin-bottom: 16px;
    animation: rise-in 0.6s var(--ease) 0.06s both;
}

/* 年度页仅 3 格，避免空出第 4 列 */
.tape--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tape__cell {
    background: var(--panel);
    padding: 14px 16px;
    min-width: 0;
}

.tape__label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--muted);
}

.tape__badge {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--teal);
    border: 1px solid rgba(15, 118, 110, 0.35);
    padding: 2px 6px;
    border-radius: 2px;
}

.tape__body {
    font-size: 13px;
    color: var(--ink-soft);
}

.tape__row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 8px;
    margin-bottom: 4px;
}

.tape__row:last-child {
    margin-bottom: 0;
}

.tape__k {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
    min-width: 1.2em;
}

.tape__v {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 14px;
    color: var(--ink);
}

.tape__cny,
.tape__date {
    font-size: 12px;
    color: var(--muted);
}

/* live.js 注入的实时价 HTML */
.tape__body .jia11 {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 600;
    color: var(--ink);
}

.tape__body .fd11 {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
    margin-left: 6px;
}

.tape__body .xin11 {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted);
}

.tape__body .gao11 {
    font-family: var(--font-mono);
    color: var(--ink-soft);
}

.tape__body font[color="#f00"],
.tape__body font[color="#F00"] {
    color: var(--rose) !important;
}

.tape__body font[color="#008000"] {
    color: var(--teal) !important;
}

/* 阶段涨幅条 */
.perf {
    margin-bottom: 16px;
    border: 1px solid var(--rule);
    background: var(--panel);
    animation: rise-in 0.6s var(--ease) 0.1s both;
}

.perf__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--rule);
}

.perf__head h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.perf__link {
    font-size: 12px;
    color: var(--amber-dim);
    text-decoration: none;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.perf__grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0;
}

.perf__item {
    padding: 14px 10px;
    text-align: center;
    border-right: 1px solid var(--rule);
}

.perf__item:last-child {
    border-right: 0;
}

.perf__item-label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}

.perf__item-val {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 400;
}

.perf__item-val.is-up {
    color: var(--teal);
}

.perf__item-val.is-down {
    color: var(--rose);
}

.perf__item-val.is-special {
    color: var(--amber-dim);
}

/* 交易所推荐：精简一行链接，非大卡片 */
.exchanges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 16px;
    padding: 12px 16px;
    border: 1px dashed var(--rule);
    background: rgba(255, 255, 255, 0.65);
    animation: rise-in 0.6s var(--ease) 0.14s both;
}

.exchanges__label {
    font-size: 13px;
    color: var(--muted);
}

.exchanges__links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ex-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--ink);
    background: var(--ink);
    color: #fff;
    font-size: 13px;
    text-decoration: none;
    transition: background var(--ease), color var(--ease), border-color var(--ease);
}

.ex-btn:hover {
    background: var(--amber);
    border-color: var(--amber);
    color: var(--ink);
}

.ex-btn--ghost {
    background: transparent;
    color: var(--ink);
}

.ex-btn--ghost:hover {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

/* ========== 图表区 ========== */
.chart-panel {
    margin-bottom: 20px;
    border: 1px solid var(--rule);
    background: var(--panel);
    animation: rise-in 0.65s var(--ease) 0.12s both;
}

.chart-panel__inner {
    position: relative;
    min-height: 460px;
    padding: 8px 4px 4px;
}

/* 加载层盖在图表上，勿与 #container 共用同一节点（否则 Highcharts 高度会变成 0） */
.chart-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--muted);
    background: var(--panel);
}

.chart-loading.is-hidden,
.chart-loading[hidden] {
    display: none !important;
}

.chart-loading__spin {
    width: 28px;
    height: 28px;
    border: 2px solid var(--rule);
    border-top-color: var(--amber);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.chart-loading__text {
    font-size: 14px;
}

#container {
    height: 460px;
    width: 100%;
}

/* ========== 年份选择 / 表格 / 概况 ========== */
.block {
    margin-bottom: 20px;
    border: 1px solid var(--rule);
    background: var(--panel);
}

.block__head {
    padding: 14px 16px;
    border-bottom: 1px solid var(--rule);
}

.block__head h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.block__body {
    padding: 16px;
}

.year-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
}

.year-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    min-width: 64px;
    padding: 0 10px;
    border: 1px solid var(--rule);
    background: var(--paper);
    color: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: 12px;
    text-decoration: none;
    transition: border-color var(--ease), background var(--ease), color var(--ease);
}

.year-pill:hover,
.year-pill.is-active {
    border-color: var(--amber);
    background: rgba(201, 162, 39, 0.12);
    color: var(--ink);
}

.price-table-wrap {
    overflow-x: auto;
}

.price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.price-table th,
.price-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid var(--rule);
    white-space: nowrap;
}

.price-table th {
    font-weight: 600;
    font-size: 12px;
    color: var(--muted);
    background: var(--paper);
    position: sticky;
    top: 0;
}

.price-table td {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-soft);
}

.price-table tbody tr:hover td {
    background: rgba(201, 162, 39, 0.06);
}

.price-table a {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.price-table a:hover {
    border-bottom-color: var(--amber);
    color: var(--amber-dim);
}

/* 概况：直接展示 */
.intro-block__body {
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.75;
}

.intro-block__body td,
.intro-block__body p {
    display: block;
}

/* ========== 页脚 ========== */
.site-footer {
    margin-top: 8px;
    padding: 16px 12px 8px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    border-top: 1px solid var(--rule);
    line-height: 1.7;
}

.site-footer a {
    color: var(--amber-dim);
    text-decoration: none;
    font-weight: 600;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* ========== 动效 ========== */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* ========== Pad 768–1024 ========== */
@media (max-width: 1024px) {
    .tape,
    .tape--3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .perf__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .perf__item:nth-child(4) {
        border-right: 0;
    }

    .perf__item:nth-child(n + 5) {
        border-top: 1px solid var(--rule);
    }
}

/* ========== 手机 <768 ========== */
@media (max-width: 767px) {
    .site-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .site-nav {
        display: none;
        position: absolute;
        top: var(--nav-h);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin: 0;
        padding: 8px;
        background: var(--ink);
        border-bottom: 1px solid rgba(201, 162, 39, 0.35);
    }

    .site-header.is-open .site-nav {
        display: flex;
    }

    .site-nav__coins {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        margin: 0 0 4px;
        padding: 4px 0 8px;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    }

    .site-nav a {
        width: 100%;
        justify-content: flex-start;
    }

    .site-nav__coins a {
        width: auto;
        flex: 1;
        justify-content: center;
        min-width: 0;
    }

    .site-nav__panel {
        position: static;
        display: grid;
        min-width: 0;
        border: 0;
        box-shadow: none;
        background: transparent;
        padding: 0 0 0 12px;
    }

    .site-logo__word {
        font-size: 13px;
    }

    .site-logo__word span {
        display: none; /* 窄屏只留中文站名，避免顶栏挤爆 */
    }

    .site-main {
        padding: 14px 12px 8px;
    }

    .tape,
    .tape--3 {
        grid-template-columns: 1fr;
    }

    .perf__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .perf__item {
        border-right: 0;
        border-bottom: 1px solid var(--rule);
    }

    .perf__item:nth-child(odd) {
        border-right: 1px solid var(--rule);
    }

    .perf__item:nth-child(n + 5) {
        border-top: 0;
    }

    .chart-panel__inner {
        min-height: 360px;
    }

    #container {
        height: 360px;
    }

    .hide-sm {
        display: none !important;
    }

    .year-pill {
        min-width: 56px;
        font-size: 11px;
    }
}
