/* ─────────────────────────────────────────────────────────────────────────────
 * Design tokens (plan B7.1) — the only place a raw colour, radius, space or
 * shadow value is allowed to appear. Everything else references these.
 *
 * Two levels on purpose:
 *   1. `--colors-*` / `--fonts-*` / … arrive from the active theme via /theme.css
 *      (editable in the admin 主题 screen).
 *   2. `--color-*`, `--radius-*`, `--space-*` are the semantic aliases the
 *      components use, each with an inline fallback so the site still renders if
 *      /theme.css fails.
 * ───────────────────────────────────────────────────────────────────────────── */
:root {
  /* Brand palette — quiet-luxe medical: brushed champagne gold on warm porcelain */
  --brand: var(--colors-brand, #A8843E);
  --brand-strong: var(--colors-brand_strong, #836229);
  --brand-soft: var(--colors-brand_soft, #E4D3AE);
  --accent: var(--colors-accent, #241E19);
  --accent-2: #2E2720;
  /* Page ground is white so the champagne gold and the serif type carry the
     "quiet luxury" tone; warmth is rationed — `--porcelain` appears only as the
     alternating section band and the reading sheet (see layout.css/detail.css). */
  --bg: var(--colors-bg, #FFFFFF);
  --surface: var(--colors-surface, #FAFAF8);
  /* the "warm porcelain" beat between white and the deep ink sections. Kept a
     touch deeper than the old #F7F4ED so adjacent modules read as clearly
     distinct bands (white ↔ porcelain) instead of one near-white void. */
  --porcelain: #ECE4D2;
  --text: var(--colors-text, #2C2620);
  --text-muted: var(--colors-text_muted, #6B6157);
  --border: var(--colors-border, rgba(168, 132, 62, 0.20));
  --header-bg: var(--colors-header_bg, #FFFFFF);
  --footer-bg: var(--colors-footer_bg, #16120E);

  /* semantic aliases used across components */
  --gold: var(--colors-brand, #A8843E);
  --gold-strong: var(--colors-brand_strong, #836229);
  --gold-soft: var(--colors-brand_soft, #E4D3AE);
  --ink: var(--colors-accent, #241E19);
  --rose: #CDA99B;
  /* 0.08 instead of 0.10: on a white ground the heavier rule read as a grid */
  --line: rgba(27, 23, 20, 0.08);

  /* colour roles */
  --color-gold: var(--colors-brand, #A8843E);
  --color-gold-strong: var(--colors-brand_strong, #836229);
  --color-gold-soft: var(--colors-brand_soft, #E4D3AE);
  --color-ink: var(--colors-accent, #241E19);
  --color-bg: var(--colors-bg, #FFFFFF);
  --color-surface: var(--colors-surface, #FAFAF8);
  --color-text: var(--colors-text, #2C2620);
  --color-text-muted: var(--colors-text_muted, #6B6157);
  --color-header-bg: var(--colors-header_bg, #FFFFFF);
  /* deep section ground for the 亮—暗 narrative rhythm (B7.4) */
  --surface-dark: var(--colors-surface_dark, #2A241E);
  --surface-dark-2: #241C15;
  --color-on-dark: #F6EFE2;
  --color-on-dark-muted: rgba(246, 239, 226, 0.72);
  --color-on-dark-line: rgba(228, 211, 174, 0.20);

  /* type */
  --font-display: 'Cormorant Garamond', var(--fonts-heading, 'Noto Serif SC'), serif;
  --font-heading: 'Cormorant Garamond', 'Noto Serif SC', var(--fonts-heading, serif);
  --font-body: 'Inter', 'Noto Sans SC', var(--fonts-body, sans-serif);

  /* type scale — the whole site picks from these, nothing is ad-hoc */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: clamp(1.35rem, 2.2vw, 1.75rem);
  --text-2xl: clamp(1.8rem, 3.4vw, 2.6rem);
  --text-3xl: clamp(2.2rem, 4.8vw, 3.6rem);
  /* section headlines — larger than --text-2xl so a left-aligned CJK title
     still reads as an editorial statement rather than a paragraph lead */
  --text-display: clamp(2rem, 3.8vw, 3rem);
  --text-hero: clamp(3.5rem, 9vw, 8rem);
  --leading-tight: 1.04;
  --leading-snug: 1.2;
  --leading-body: 1.85;

  /* radius / shadow */
  --radius: var(--radius-md, 8px);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;
  --shadow-card: var(--shadow-card, 0 18px 40px rgba(27, 23, 20, 0.08));
  --shadow-soft: 0 8px 26px rgba(27, 23, 20, 0.06);
  --shadow-float: 0 28px 60px rgba(27, 23, 20, 0.14);

  /* spacing scale */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-7: 32px; --space-8: 40px;
  --space-10: 56px; --space-12: 72px; --space-14: 96px; --space-16: 128px;

  /* measure */
  /* three widths only: listing/grid, detail/form, full-bleed visual */
  --container: var(--spacing-container, 1280px);
  --container-narrow: var(--spacing-container_narrow, 960px);
  --container-wide: var(--spacing-container_wide, 1440px);
  /* Trimmed from the old clamp(96px,10vw,200px): the 200px ceiling produced
     ~300px gaps between modules that read as dead space. The new ceiling keeps
     the airy luxury rhythm without the void. */
  --section-y: var(--spacing-section_y, clamp(88px, 9vw, 168px));
  --reading-width: 68ch;
  --gutter: clamp(20px, 4vw, 48px);
  --header-h: 76px;
  --header-h-compact: 60px;

  /* gradients & motion */
  --gold-gradient: linear-gradient(135deg, #A8843E, #E4D3AE);
  --gold-gradient-strong: linear-gradient(135deg, #836229, #C9AB7C);
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-lux: cubic-bezier(0.16, 1, 0.3, 1);
  --reveal-duration: 900ms;
  --reveal-distance: 26px;
}

/* ─── Dark mode (plan B7.12) ───────────────────────────────────────────────────
 * Section-level tonality is the normal case (`.section--dark`); the document-wide
 * switch below is wired for a future toggle and costs nothing to keep.
 */
[data-theme="dark"] {
  --bg: #12100E;
  --surface: #1B1713;
  --color-bg: #12100E;
  --color-surface: #1B1713;
  --text: #EFE7D9;
  --color-text: #EFE7D9;
  --text-muted: #A99C8B;
  --color-text-muted: #A99C8B;
  --line: rgba(228, 211, 174, 0.14);
  --border: rgba(228, 211, 174, 0.22);
  --header-bg: rgba(18, 16, 14, 0.86);
  --shadow-card: 0 18px 40px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 8px 26px rgba(0, 0, 0, 0.35);
  --shadow-float: 0 28px 60px rgba(0, 0, 0, 0.55);
}
