/* ==========================================================================
   Atelier · 工具站设计系统 v1
   暖象牙纸感 + 古金 + 衬线数字；浅色/深色双主题，跟随系统并可手动记忆
   ========================================================================== */

:root {
    color-scheme: light;

    --paper: #fbf8f3;
    --paper-2: #f5efe6;
    --card: #ffffff;
    --card-2: #fdfaf5;

    --ink: #1b1814;
    --ink-2: #544c43;
    --ink-3: #8a8074;

    --line: #e6dccd;
    --line-strong: #d3c4ae;

    --gold: #8f6b3e;
    --gold-2: #c9a268;
    --gold-soft: #f2e7d6;
    --rose: #a9676b;
    --ok: #2f6b57;
    --warn: #95610f;
    --err: #a83e34;

    --cert-bg: #1b1814;
    --cert-ink: #f8f2e8;
    --cert-dim: #b9ab97;
    --cert-line: rgba(248, 242, 232, 0.16);

    --shadow-sm: 0 1px 2px rgba(40, 32, 24, 0.06);
    --shadow-md: 0 10px 28px -14px rgba(40, 32, 24, 0.24);
    --shadow-lg: 0 32px 70px -38px rgba(40, 32, 24, 0.42);

    --r-xs: 6px;
    --r-sm: 10px;
    --r-md: 16px;
    --r-lg: 24px;

    --font-display: Georgia, "Times New Roman", "Songti SC", "Noto Serif SC", SimSun, serif;
    --font-body: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    --font-num: Georgia, "Times New Roman", "Songti SC", serif;

    --maxw: 1160px;
    --head-h: 64px;
}

[data-theme="dark"] {
    color-scheme: dark;

    --paper: #12100d;
    --paper-2: #191612;
    --card: #1f1a15;
    --card-2: #262019;

    --ink: #f4ede3;
    --ink-2: #c2b7a8;
    --ink-3: #8d8374;

    --line: #372f26;
    --line-strong: #4b3e31;

    --gold: #d9b27c;
    --gold-2: #b78c55;
    --gold-soft: #34291b;
    --rose: #d08c90;
    --ok: #6fbf9b;
    --warn: #e0a85a;
    --err: #e8827a;

    --cert-bg: #241f19;
    --cert-ink: #f6efe4;
    --cert-dim: #a4977f;
    --cert-line: rgba(217, 178, 124, 0.26);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 12px 30px -16px rgba(0, 0, 0, 0.75);
    --shadow-lg: 0 34px 72px -40px rgba(0, 0, 0, 0.9);
}

/* ---------- reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--head-h) + 18px);
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.28;
    letter-spacing: -0.005em;
    color: var(--ink);
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
table { border-collapse: collapse; width: 100%; }
[hidden] { display: none !important; }

::selection {
    background: var(--gold-soft);
    color: var(--ink);
}

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ---------- 版式 ---------- */
.atl-wrap {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 24px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold);
}

.eyebrow::before {
    content: "";
    width: 22px;
    height: 1px;
    background: currentColor;
    opacity: 0.55;
}

.lede {
    color: var(--ink-2);
    font-size: 17px;
    line-height: 1.85;
    max-width: 62ch;
}

.prose p {
    margin: 0 0 18px;
    color: var(--ink-2);
    line-height: 1.95;
}

.prose p:last-child { margin-bottom: 0; }

.prose strong,
.prose b {
    color: var(--ink);
    font-weight: 600;
}

.hl {
    background: linear-gradient(transparent 64%, var(--gold-soft) 64%);
    padding: 0 1px;
    color: var(--ink);
    font-weight: 600;
}

.num {
    font-family: var(--font-num);
    font-variant-numeric: tabular-nums lining-nums;
    letter-spacing: 0.01em;
}

/* ---------- 顶栏 ---------- */
.atl-head {
    position: sticky;
    top: 0;
    z-index: 60;
    height: var(--head-h);
    background: color-mix(in srgb, var(--paper) 82%, transparent);
    border-bottom: 1px solid var(--line);
    backdrop-filter: saturate(1.4) blur(14px);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
    .atl-head { background: var(--paper); }
}

.atl-head-in {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 28px;
}

.brand {
    display: inline-flex;
    align-items: baseline;
    gap: 9px;
    flex-shrink: 0;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.brand-tag {
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--gold);
    border-left: 1px solid var(--line-strong);
    padding-left: 9px;
    transform: translateY(-1px);
}

.atl-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
}

.atl-nav a {
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 14px;
    color: var(--ink-2);
    transition: color 0.18s ease, background-color 0.18s ease;
}

.atl-nav a:hover { color: var(--ink); background: var(--paper-2); }
.atl-nav a.is-active { color: var(--ink); background: var(--gold-soft); }

.head-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.head-link {
    font-size: 14px;
    color: var(--ink-2);
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    transition: border-color 0.18s ease, color 0.18s ease;
    white-space: nowrap;
}

.head-link:hover { color: var(--ink); border-color: var(--line-strong); }

/* ---------- 主题切换 ---------- */
.theme-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
}

.theme-switch button {
    display: grid;
    place-items: center;
    width: 30px;
    height: 26px;
    border-radius: 999px;
    color: var(--ink-3);
    transition: color 0.18s ease, background-color 0.18s ease;
}

.theme-switch button:hover { color: var(--ink); }

.theme-switch button[aria-pressed="true"] {
    background: var(--gold-soft);
    color: var(--gold);
}

.theme-switch svg { width: 15px; height: 15px; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 20px;
    border-radius: var(--r-sm);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
    transition: transform 0.14s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
    white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--ink);
    color: var(--paper);
}

.btn-primary:hover { background: var(--gold); color: #fff; }

[data-theme="dark"] .btn-primary {
    background: var(--gold);
    color: #1b1814;
}

[data-theme="dark"] .btn-primary:hover { background: var(--gold-2); }

.btn-gold {
    background: var(--gold);
    color: #fff;
}

.btn-gold:hover { background: var(--ink); }

[data-theme="dark"] .btn-gold { color: #1b1814; }

.btn-ghost {
    border-color: var(--line-strong);
    color: var(--ink-2);
    background: transparent;
}

.btn-ghost:hover { color: var(--ink); border-color: var(--ink-3); }

.btn-sm { height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn-block { width: 100%; }

/* ---------- 卡片 / 区块 ---------- */
.section {
    padding: 72px 0;
    border-top: 1px solid var(--line);
}

.section-alt { background: var(--paper-2); }

.sec-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 30px;
}

.sec-head h2 {
    font-size: clamp(24px, 1.15rem + 1.1vw, 33px);
    margin-top: 10px;
}

.sec-head p {
    color: var(--ink-3);
    font-size: 14.5px;
    line-height: 1.8;
    max-width: 44ch;
    text-align: right;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
}

/* ---------- 表单 ---------- */
.field-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 9px;
}

.input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    background: var(--card);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    color: var(--ink);
    font-size: 16px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.input::placeholder { color: var(--ink-3); opacity: 0.75; }

.input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 16%, transparent);
}

.input.is-error { border-color: var(--err); }

textarea.input {
    height: auto;
    min-height: 150px;
    padding: 12px 14px;
    line-height: 1.85;
    resize: vertical;
}

select.input {
    appearance: none;
    padding-right: 36px;
    background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
    background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

.seg {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
}

.seg button {
    padding: 7px 13px;
    border-radius: 7px;
    font-size: 13.5px;
    color: var(--ink-3);
    transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
    white-space: nowrap;
}

.seg button:hover { color: var(--ink-2); }

.seg button[aria-selected="true"],
.seg button.is-active {
    background: var(--card);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.hint {
    font-size: 13px;
    line-height: 1.7;
    color: var(--ink-3);
}

.hint.is-error { color: var(--err); }
.hint.is-ok { color: var(--ok); }

/* ---------- 页脚 ---------- */
.atl-foot {
    border-top: 1px solid var(--line);
    padding: 44px 0 56px;
    background: var(--paper-2);
}

.foot-in {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    align-items: flex-start;
    justify-content: space-between;
}

.foot-brand {
    font-family: var(--font-display);
    font-size: 17px;
    margin-bottom: 8px;
}

.foot-note {
    font-size: 13px;
    color: var(--ink-3);
    line-height: 1.85;
    max-width: 46ch;
}

.foot-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    font-size: 13.5px;
    color: var(--ink-2);
}

.foot-links a:hover { color: var(--gold); }

.to-top {
    position: fixed;
    right: 22px;
    bottom: 26px;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: var(--card);
    border: 1px solid var(--line-strong);
    color: var(--ink-2);
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 50;
}

.to-top.is-on { opacity: 1; pointer-events: auto; transform: none; }
.to-top:hover { color: var(--gold); border-color: var(--gold); }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
    .atl-nav { display: none; }
    .sec-head { flex-direction: column; align-items: flex-start; gap: 12px; }
    .sec-head p { text-align: left; max-width: 60ch; }
}

@media (max-width: 720px) {
    body { font-size: 15.5px; }
    .atl-wrap { padding: 0 18px; }
    .section { padding: 52px 0; }
    .brand-tag { display: none; }
    .head-link { display: none; }
    .lede { font-size: 16px; }
    .to-top {
        width: 38px;
        height: 38px;
        right: 14px;
        bottom: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

/* ---------- 打印 ---------- */
@media print {
    .atl-head, .atl-foot, .to-top, .theme-switch { display: none !important; }
    body { background: #fff; color: #000; }
    .section { padding: 18px 0; border-top: 1px solid #ccc; }
    a { text-decoration: underline; }
}
