/* ============================================================
   橘子云 · OrangeCloud — Design Tokens
   Grounded in Apple Human Interface Guidelines
   (color.md, typography.md, layout.md, motion.md, materials.md)
   ============================================================ */

:root {
  color-scheme: light;

  /* ---------- Brand primitives (from the orange mark) ---------- */
  --brand-500: #F68A1E;
  --brand-600: #E0740A;
  --brand-700: #A85200;
  --brand-100: #FFF1E0;
  --brand-leaf: #4E8F3D;
  --brand-sky: #0A84FF;

  /* ---------- Apple system colors (light) ---------- */
  --sys-red: #FF3B30;
  --sys-orange: #FF9500;
  --sys-yellow: #FFCC00;
  --sys-green: #34C759;
  --sys-mint: #00C7BE;
  --sys-teal: #30B0C7;
  --sys-cyan: #32ADE6;
  --sys-blue: #007AFF;
  --sys-indigo: #5856D6;
  --sys-purple: #AF52DE;
  --sys-pink: #FF2D55;
  --sys-brown: #A2845E;
  --sys-gray: #8E8E93;

  /* iOS system gray scale, light */
  --gray-2: #AEAEB2;
  --gray-3: #C7C7CC;
  --gray-4: #D1D1D6;
  --gray-5: #E5E5EA;
  --gray-6: #F2F2F7;

  /* ---------- Semantic surface & content ---------- */
  --bg: #FFFFFF;
  --bg-elevated: #FFFFFF;
  --bg-sunken: #F5F5F7;
  --bg-sunken-2: #FAFAFC;
  --bg-inverse: #1C1C1E;

  --label: #1D1D1F;
  --label-2: #515154;      /* 7.6:1 on white */
  --label-3: #6E6E73;      /* 5.07:1 on white */
  --label-4: #75757A;      /* 4.58:1 on white — placeholders and tertiary chrome */
  --red-text: #B3261E;     /* 6.54:1 on white — error copy */
  --danger-solid: #D32F2F; /* 4.98:1 with white text */
  --green-text: #1D7A38;   /* 5.39:1 on white — success copy */
  --label-on-dark: #FFFFFF;

  --separator: rgba(60, 60, 67, 0.16);
  --separator-strong: rgba(60, 60, 67, 0.29);

  --fill-1: rgba(120, 120, 128, 0.06);
  --fill-2: rgba(120, 120, 128, 0.12);
  --fill-3: rgba(120, 120, 128, 0.20);
  --fill-4: rgba(120, 120, 128, 0.32);

  --tint: #0071E3;                 /* primary action blue */
  --tint-hover: #0062C4;
  --tint-soft: rgba(0, 113, 227, 0.10);
  --tint-label: #0066CC;           /* tinted text, 5.5:1 on white */

  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --glass-border: rgba(255, 255, 255, 0.7);
  --card: #FFFFFF;
  --card-border: rgba(0, 0, 0, 0.06);
  --scrim: rgba(0, 0, 0, 0.36);

  /* ---------- Elevation (soft, layered — no single hard shadow) ---------- */
  --shadow-1: 0 1px 1px rgba(16, 24, 40, 0.03), 0 2px 6px rgba(16, 24, 40, 0.05);
  --shadow-2: 0 2px 4px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.07);
  --shadow-3: 0 4px 8px rgba(16, 24, 40, 0.04), 0 20px 48px rgba(16, 24, 40, 0.10);
  --shadow-4: 0 8px 16px rgba(16, 24, 40, 0.06), 0 40px 80px rgba(16, 24, 40, 0.14);
  --shadow-fruit: 0 24px 48px -16px rgba(214, 108, 12, 0.42), 0 48px 96px -32px rgba(214, 108, 12, 0.28);
  --ring: 0 0 0 3px color-mix(in srgb, var(--tint) 45%, transparent);

  /* ---------- Radii ---------- */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --r-2xl: 34px;
  --r-3xl: 44px;
  --r-pill: 999px;

  /* ---------- Spacing (4pt base, 8pt rhythm) ---------- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px;
  --s-9: 48px; --s-10: 64px; --s-11: 80px; --s-12: 104px; --s-13: 136px;

  /* ---------- Type ---------- */
  --font-text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "HarmonyOS Sans SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "Segoe UI Variable Display", "Segoe UI", "PingFang SC", "HarmonyOS Sans SC",
    "Microsoft YaHei", "Noto Sans SC", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    "Cascadia Mono", "Liberation Mono", monospace;

  /* Display scale — fluid, tracking tightens as size grows (typography.md) */
  --t-hero: clamp(2.6rem, 7.2vw, 6rem);
  --t-display: clamp(2rem, 4.4vw, 3.5rem);
  --t-title-1: clamp(2rem, 3.2vw, 2.5rem);
  --t-title-2: 1.75rem;
  --t-title-3: 1.375rem;
  --t-headline: 1.0625rem;
  --t-body: 1.0625rem;
  --t-callout: 1rem;
  --t-subhead: 0.9375rem;
  --t-footnote: 0.8125rem;
  --t-caption-1: 0.75rem;
  --t-caption-2: 0.6875rem;

  --track-hero: -0.032em;
  --track-display: -0.024em;
  --track-title: -0.018em;
  --track-body: -0.011em;

  --lh-tight: 1.06;
  --lh-display: 1.1;
  --lh-title: 1.22;
  --lh-body: 1.62;

  /* ---------- Layout ---------- */
  --page-max: 1180px;
  --page-gutter: clamp(20px, 5vw, 48px);
  --nav-h: 56px;
  --section-y: clamp(64px, 9vw, 128px);

  /* ---------- Motion (motion.md: brief, purposeful, cancellable) ---------- */
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --dur-4: 480ms;
  --dur-5: 720ms;
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-spring: cubic-bezier(0.34, 1.42, 0.44, 1);
  --ease-apple: cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* ---------- Dark appearance (dark-mode.md: dimmer surfaces, brighter text,
   not a naive inversion) ---------- */
[data-theme="dark"] {
  color-scheme: dark;

  --sys-red: #FF453A;
  --sys-orange: #FF9F0A;
  --sys-yellow: #FFD60A;
  --sys-green: #30D158;
  --sys-mint: #63E6E2;
  --sys-teal: #40CBE0;
  --sys-cyan: #64D2FF;
  --sys-blue: #0A84FF;
  --sys-indigo: #5E5CE6;
  --sys-purple: #BF5AF2;
  --sys-pink: #FF375F;
  --sys-brown: #AC8E68;

  --gray-2: #636366;
  --gray-3: #48484A;
  --gray-4: #3A3A3C;
  --gray-5: #2C2C2E;
  --gray-6: #1C1C1E;

  --brand-500: #FF9F2E;
  --brand-600: #F68A1E;
  --brand-700: #FFB55C;
  --brand-100: rgba(255, 159, 46, 0.14);
  --brand-leaf: #6FBF5A;
  --brand-sky: #64D2FF;

  --bg: #000000;
  --bg-elevated: #1C1C1E;
  --bg-sunken: #0B0B0D;
  --bg-sunken-2: #141416;
  --bg-inverse: #F5F5F7;

  --label: #F5F5F7;
  --label-2: #C7C7CC;
  --label-3: #A1A1A6;
  --label-4: #8E8E93;
  --red-text: #FF6B63;     /* 7.54:1 on black */
  --danger-solid: #CC3A2C; /* 4.99:1 with white text */
  --green-text: #4ADE80;   /* 12.05:1 on black */
  --label-on-dark: #FFFFFF;

  --separator: rgba(255, 255, 255, 0.14);
  --separator-strong: rgba(255, 255, 255, 0.26);

  --fill-1: rgba(120, 120, 128, 0.16);
  --fill-2: rgba(120, 120, 128, 0.24);
  --fill-3: rgba(120, 120, 128, 0.32);
  --fill-4: rgba(120, 120, 128, 0.46);

  --tint: #0A6CFF;              /* white text reaches 4.56:1 */
  --tint-hover: #2E86FF;
  --tint-soft: rgba(10, 108, 255, 0.20);
  --tint-label: #4DA6FF;

  --glass: rgba(28, 28, 30, 0.66);
  --glass-strong: rgba(28, 28, 30, 0.84);
  --glass-border: rgba(255, 255, 255, 0.1);
  --card: #1C1C1E;
  --card-border: rgba(255, 255, 255, 0.1);
  --scrim: rgba(0, 0, 0, 0.6);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.55);
  --shadow-3: 0 12px 32px rgba(0, 0, 0, 0.6);
  --shadow-4: 0 32px 72px rgba(0, 0, 0, 0.7);
  --shadow-fruit: 0 24px 56px -16px rgba(0, 0, 0, 0.75), 0 0 96px -24px rgba(255, 159, 46, 0.35);
}
