/* ============================================================
   DESIGN TOKENS — 来源于 DESIGN.md (Notion 风格体系)
   ============================================================ */
:root {
    /* Brand & Primary */
    --color-primary: #3b82f6;
    --color-primary-pressed: #2563eb;
    --color-primary-deep: #1d4ed8;
    --color-on-primary: #ffffff;
    --color-brand-navy: #0a1530;
    --color-brand-navy-deep: #070f24;
    --color-brand-navy-mid: #1a2a52;
    --color-link-blue: #2563eb;
    --color-link-blue-pressed: #1d4ed8;

    /* Accent */
    --color-brand-orange: #dd5b00;
    --color-brand-pink: #ff64c8;
    --color-brand-purple: #60a5fa;
    --color-brand-teal: #2a9d99;
    --color-brand-green: #1aae39;
    --color-brand-yellow: #f5d75e;

    /* Card Tints */
    --color-card-tint-peach: #ffe8d4;
    --color-card-tint-rose: #fde0ec;
    --color-card-tint-mint: #d9f3e1;
    --color-card-tint-lavender: #dbeafe;
    --color-card-tint-sky: #dcecfa;
    --color-card-tint-yellow: #fef7d6;
    --color-card-tint-yellow-bold: #f9e79f;

    /* Surface */
    --color-canvas: #ffffff;
    --color-surface: #f6f5f4;
    --color-surface-soft: #fafaf9;
    --color-hairline: #e5e3df;
    --color-hairline-soft: #ede9e4;
    --color-hairline-strong: #c8c4be;

    /* Text */
    --color-ink-deep: #000000;
    --color-ink: #1a1a1a;
    --color-charcoal: #37352f;
    --color-slate: #5d5b54;
    --color-steel: #787671;
    --color-stone: #a4a097;
    --color-muted: #bbb8b1;
    --color-on-dark: #ffffff;
    --color-on-dark-muted: #a4a097;

    /* Semantic */
    --color-success: #1aae39;
    --color-warning: #dd5b00;
    --color-error: #e03131;

    /* Typography Scale (desktop defaults) */
    --font-family: 'Inter', 'Notion Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, sans-serif;
    --fs-hero-display: 80px;
    --fs-display-lg: 56px;
    --fs-heading-1: 48px;
    --fs-heading-2: 36px;
    --fs-heading-3: 28px;
    --fs-heading-4: 22px;
    --fs-heading-5: 18px;
    --fs-subtitle: 18px;
    --fs-body-md: 16px;
    --fs-body-sm: 14px;
    --fs-caption: 13px;
    --fs-button: 14px;

    /* Spacing */
    --spacing-section-lg: 96px;
    --spacing-section: 64px;
    --spacing-section-sm: 48px;
    --spacing-hero: 120px;
    --spacing-xxxl: 40px;
    --spacing-xxl: 32px;
    --spacing-xl: 24px;
    --spacing-lg: 20px;
    --spacing-md: 16px;
    --spacing-sm: 12px;
    --spacing-xs: 8px;
    --spacing-xxs: 4px;

    /* Rounded */
    --rounded-xs: 4px;
    --rounded-sm: 6px;
    --rounded-md: 8px;
    --rounded-lg: 12px;
    --rounded-xl: 16px;
    --rounded-full: 9999px;

    /* Shadows */
    --shadow-card: rgba(15, 15, 15, 0.08) 0px 4px 12px 0px;
    --shadow-mockup: rgba(15, 15, 15, 0.20) 0px 24px 48px -8px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-family);
    background-color: var(--color-canvas);
    color: var(--color-ink);
    line-height: 1.55;
    font-size: var(--fs-body-md);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--color-link-blue); text-decoration: none; }
a:hover { color: var(--color-link-blue-pressed); }

img { max-width: 100%; height: auto; display: block; }

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--spacing-xxl);
}

/* ============================================================
   BUTTONS — 参照 DESIGN.md button-*
   ============================================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: var(--color-on-primary);
    font-family: var(--font-family);
    font-size: var(--fs-button);
    font-weight: 500;
    line-height: 1.3;
    padding: 10px 18px;
    border: none;
    border-radius: var(--rounded-md);
    cursor: pointer;
    transition: background 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary:hover {
    background: var(--color-primary-pressed);
    color: var(--color-on-primary);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--color-ink);
    font-family: var(--font-family);
    font-size: var(--fs-button);
    font-weight: 500;
    line-height: 1.3;
    padding: 10px 18px;
    border: 1px solid var(--color-hairline-strong);
    border-radius: var(--rounded-md);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--color-ink);
    font-family: var(--font-family);
    font-size: var(--fs-button);
    font-weight: 500;
    line-height: 1.3;
    padding: 8px 12px;
    border: none;
    border-radius: var(--rounded-sm);
    cursor: pointer;
    transition: background 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-ghost:hover { background: var(--color-surface); }

.btn-secondary-on-dark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--color-on-dark);
    font-family: var(--font-family);
    font-size: var(--fs-button);
    font-weight: 500;
    line-height: 1.3;
    padding: 10px 18px;
    border: 1px solid var(--color-on-dark-muted);
    border-radius: var(--rounded-md);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-secondary-on-dark:hover {
    border-color: var(--color-on-dark);
    color: var(--color-on-dark);
    background: rgba(255, 255, 255, 0.06);
}

.btn-lg { padding: 14px 28px; font-size: 16px; }

/* ============================================================
   TOP NAVIGATION
   ============================================================ */
.site-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    height: 64px;
    background: var(--color-canvas);
    border-bottom: 1px solid var(--color-hairline);
    display: flex;
    align-items: center;
}

.site-nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    text-decoration: none;
    color: var(--color-ink);
}

.nav-logo-img { height: 32px; width: auto; }

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--spacing-xxl);
}

.nav-links a {
    font-size: var(--fs-body-sm);
    font-weight: 500;
    color: var(--color-slate);
    text-decoration: none;
    transition: color 0.15s ease;
}

.nav-links a:hover { color: var(--color-ink); }

/* Ensure buttons inside nav-links keep their own colors */
.nav-links .btn-primary { color: var(--color-on-primary); }
.nav-links .btn-primary:hover { color: var(--color-on-primary); }

/* ============================================================
   SESSION STATUS — 登录状态区域
   ============================================================ */
.session-area {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.session-user {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    position: relative;
    user-select: none;
}

.session-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--rounded-full);
    background: var(--color-primary);
    color: var(--color-on-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--fs-body-sm);
}

.session-username {
    font-size: var(--fs-body-sm);
    font-weight: 500;
    color: var(--color-ink);
}

/* User dropdown menu */
.session-user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 160px;
    background: var(--color-canvas);
    border: 1px solid var(--color-hairline);
    border-radius: var(--rounded-md);
    box-shadow: var(--shadow-card);
    z-index: 200;
    overflow: hidden;
}

.session-user-dropdown.open { display: block; }

.session-user-dropdown a,
.session-user-dropdown button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    font-family: var(--font-family);
    font-size: var(--fs-body-sm);
    color: var(--color-charcoal);
    text-align: left;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.1s ease;
    white-space: nowrap;
}

.session-user-dropdown a:hover,
.session-user-dropdown button:hover { background: var(--color-surface); }

.session-user-dropdown .dropdown-divider {
    height: 1px;
    background: var(--color-hairline-soft);
}

.session-user-dropdown .dropdown-logout { color: var(--color-error); }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    background: var(--color-canvas);
    border-top: 1px solid var(--color-hairline);
    padding: var(--spacing-section) var(--spacing-xxl);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--spacing-xxl);
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.footer-brand img { height: 28px; width: auto; }

.footer-tagline {
    font-size: var(--fs-body-sm);
    color: var(--color-steel);
    line-height: 1.5;
}

.footer-col h4 {
    font-size: var(--fs-body-sm);
    font-weight: 600;
    color: var(--color-charcoal);
    margin-bottom: var(--spacing-md);
}

.footer-col ul { list-style: none; }

.footer-col li { margin-bottom: var(--spacing-xs); }

.footer-col a {
    font-size: var(--fs-body-sm);
    color: var(--color-steel);
    text-decoration: none;
    transition: color 0.15s ease;
}

.footer-col a:hover { color: var(--color-ink); }

.footer-bottom {
    border-top: 1px solid var(--color-hairline-soft);
    margin-top: var(--spacing-xxxl);
    padding-top: var(--spacing-xl);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
}

.footer-copyright {
    font-size: var(--fs-body-sm);
    color: var(--color-steel);
}

.footer-icp {
    font-size: var(--fs-body-sm);
    color: var(--color-stone);
}

.footer-icp a {
    color: var(--color-stone);
    text-decoration: none;
}

.footer-icp a:hover { color: var(--color-slate); }

/* ============================================================
   UTILITY
   ============================================================ */
.hidden { display: none !important; }

/* ============================================================
   PAGE CONTENT (policy pages)
   ============================================================ */
.page-content {
    margin-top: 64px;
    padding: var(--spacing-section) var(--spacing-xxl);
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}

.page-content h1 {
    font-size: var(--fs-heading-2);
    font-weight: 600;
    line-height: 1.20;
    letter-spacing: -0.5px;
    color: var(--color-ink);
    margin-bottom: var(--spacing-xs);
}

.page-content .page-updated {
    font-size: var(--fs-body-sm);
    color: var(--color-stone);
    margin-bottom: var(--spacing-xl);
}

/* Tab styles for privacy page */
.policy-tabs {
    display: flex;
    gap: 0;
    margin-bottom: var(--spacing-xl);
    border-bottom: 2px solid var(--color-hairline);
}

.policy-tab-btn {
    padding: 10px 24px;
    border: none;
    background: none;
    font-family: var(--font-family);
    font-size: var(--fs-body-sm);
    font-weight: 600;
    color: var(--color-steel);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.policy-tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.policy-tab-btn:hover:not(.active) {
    color: var(--color-ink);
}

.policy-tab-content { display: none; }
.policy-tab-content.active { display: block; }

/* Policy content styling */
.policy-body {
    font-size: var(--fs-body-sm);
    color: var(--color-slate);
    line-height: 1.8;
    min-height: 600px;
}

.policy-body :where(h2, h3, h4) {
    color: var(--color-ink);
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-sm);
}

.policy-body h2 { font-size: var(--fs-heading-5); font-weight: 600; }
.policy-body h3 { font-size: var(--fs-body-md); font-weight: 600; }

.policy-body p {
    margin-bottom: var(--spacing-sm);
}

.policy-body ul, .policy-body ol {
    margin: var(--spacing-xs) 0 var(--spacing-md) var(--spacing-xl);
}

.policy-body li {
    margin-bottom: var(--spacing-xxs);
}

.policy-loading, .policy-error {
    text-align: center;
    padding: var(--spacing-section);
    color: var(--color-steel);
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-hairline);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: var(--spacing-xs);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 0 var(--spacing-md); }
    .nav-links { gap: var(--spacing-md); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .page-content { padding: var(--spacing-section-sm) var(--spacing-md); }
}

@media (max-width: 480px) {
    .footer-grid { grid-template-columns: 1fr; }
}
