/* 荔枝云 design tokens (DESIGN.md §7.2–7.4; sources of each value: DESIGN.md §7.9). The ONLY file in this theme that may contain colour literals.
   tests/js/lychee-tokens.test.mjs compares every value with the DESIGN.md tables and checks WCAG contrast;
   the two dark blocks below (manual data-theme and the system preference) must stay identical. */
:root {
  color-scheme: light;
  --ly-bg: #F6F7F9;
  --ly-surface: #FFFFFF;
  --ly-surface-2: #F1F3F5;
  --ly-border: #E3E6EA;
  --ly-border-strong: #8A93A0;
  --ly-text: #1A1D23;
  --ly-text-2: #5B6370;
  --ly-text-3: #636B78;
  --ly-primary: var(--ly-primary-custom, #C2255C);
  --ly-primary-hover: #A61E4D;
  --ly-primary-soft: #FCE8EF;
  --ly-primary-soft-text: #A61E4D;
  --ly-on-primary: #FFFFFF;
  --ly-leaf: #0B7A5E;
  --ly-leaf-soft: #E3F6EF;
  --ly-leaf-soft-text: #0B6B53;
  --ly-warning: #A8500A;
  --ly-warning-soft: #FFF1DC;
  --ly-warning-soft-text: #8F4308;
  --ly-danger: #C92A2A;
  --ly-danger-soft: #FDEAEA;
  --ly-danger-soft-text: #A61E1E;
  --ly-info: #1D5FCC;
  --ly-info-soft: #E7F0FF;
  --ly-info-soft-text: #1A52B0;
  --ly-hero-from: #C2255C;
  --ly-hero-to: #C2410C;
  --ly-on-hero: #FFFFFF;
  /* chart series (F190): fixed order, validated with the dataviz checker */
  --ly-chart-1: #BE123C;
  --ly-chart-2: #2563EB;
  --ly-chart-3: #B45309;
  --ly-scrim: rgb(0 0 0 / .5);
  /* QR codes stay black on white in both schemes (scanners need the contrast) */
  --ly-qr-dark: #000000;
  --ly-qr-light: #FFFFFF;
  --ly-confetti-1: #C2255C;
  --ly-confetti-2: #F783AC;
  --ly-confetti-3: #0B7A5E;
  --ly-confetti-4: #4FD1A9;
  --ly-confetti-5: #F59F00;
  --ly-confetti-6: #4C6EF5;

  --ly-font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --ly-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ly-text-display: 700 30px/36px var(--ly-font);
  --ly-text-h1: 600 30px/38px var(--ly-font);
  --ly-text-h2: 600 18px/26px var(--ly-font);
  --ly-text-body: 400 14px/22px var(--ly-font);
  --ly-text-small: 400 13px/20px var(--ly-font);
  --ly-text-caption: 500 12px/18px var(--ly-font);

  --ly-space-1: 4px;
  --ly-space-2: 8px;
  --ly-space-3: 12px;
  --ly-space-4: 16px;
  --ly-space-5: 20px;
  --ly-space-6: 24px;
  --ly-space-7: 32px;
  --ly-space-8: 40px;
  --ly-space-9: 48px;
  --ly-space-10: 64px;

  --ly-radius-sm: 4px;
  --ly-radius: 6px;
  --ly-radius-lg: 12px;
  --ly-radius-full: 999px;

  --ly-shadow-1: 0 4px 10px rgb(16 24 40 / .05);
  --ly-shadow-2: 0 8px 12px rgb(16 24 40 / .10);
  --ly-shadow-3: 0 24px 48px rgb(16 24 40 / .18);

  --ly-dur-fast: 150ms;
  --ly-dur: 200ms;
  --ly-ease: cubic-bezier(.4, 0, .2, 1);
  --ly-dur-card: 320ms;
  --ly-ease-card: cubic-bezier(.21, .79, .32, .92);
  /* Phase 5 loading states (DESIGN.md §16.2). Skeleton shimmer and route fade are the reference site's measured values. */
  --ly-skeleton-delay: 100ms;
  --ly-skeleton-dur: 1.4s;
  --ly-skeleton-ease: ease;
  --ly-route-dur: 150ms;
  --ly-route-ease: ease-in;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ly-bg: #0F1114;
  --ly-surface: #171A1F;
  --ly-surface-2: #1F232A;
  --ly-border: #2B3039;
  --ly-border-strong: #6B7482;
  --ly-text: #E8EAED;
  --ly-text-2: #A6ADB8;
  --ly-text-3: #8D95A1;
  --ly-primary: var(--ly-primary-custom, #F783AC);
  --ly-primary-hover: #FAA2C1;
  --ly-primary-soft: #3A1422;
  --ly-primary-soft-text: #FAA2C1;
  --ly-on-primary: #2A0714;
  --ly-leaf: #4FD1A9;
  --ly-warning: #F5B454;
  --ly-danger: #FF8787;
  --ly-info: #7FB0FF;
  --ly-leaf-soft: #10261F;
  --ly-leaf-soft-text: #4FD1A9;
  --ly-warning-soft: #2E2210;
  --ly-warning-soft-text: #F5B454;
  --ly-danger-soft: #3A1A1A;
  --ly-danger-soft-text: #FF8787;
  --ly-info-soft: #14233D;
  --ly-chart-1: #F43F5E;
  --ly-chart-2: #3B82F6;
  --ly-chart-3: #D97706;
  --ly-info-soft-text: #7FB0FF;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ly-bg: #0F1114;
    --ly-surface: #171A1F;
    --ly-surface-2: #1F232A;
    --ly-border: #2B3039;
    --ly-border-strong: #6B7482;
    --ly-text: #E8EAED;
    --ly-text-2: #A6ADB8;
    --ly-text-3: #8D95A1;
    --ly-primary: var(--ly-primary-custom, #F783AC);
    --ly-primary-hover: #FAA2C1;
    --ly-primary-soft: #3A1422;
    --ly-primary-soft-text: #FAA2C1;
    --ly-on-primary: #2A0714;
    --ly-leaf: #4FD1A9;
    --ly-warning: #F5B454;
    --ly-danger: #FF8787;
    --ly-info: #7FB0FF;
    --ly-leaf-soft: #10261F;
    --ly-leaf-soft-text: #4FD1A9;
    --ly-warning-soft: #2E2210;
    --ly-warning-soft-text: #F5B454;
    --ly-danger-soft: #3A1A1A;
    --ly-danger-soft-text: #FF8787;
    --ly-info-soft: #14233D;
    --ly-chart-1: #F43F5E;
    --ly-chart-2: #3B82F6;
    --ly-chart-3: #D97706;
    --ly-info-soft-text: #7FB0FF;
  }
}

@media (max-width: 767px) {
  :root { --ly-control-font: 16px; }
}

/* F130: primary colour set in the theme settings. The template puts data-primary="custom" on <html> plus
   --ly-primary-custom and --ly-on-primary-custom (white / black, whichever contrasts more); hover and soft shades
   are derived here. Dark mode lightens the custom colour and puts dark text on it. */
:root[data-primary="custom"] {
  --ly-primary-hover: color-mix(in srgb, var(--ly-primary-custom) 82%, black);
  --ly-primary-soft: color-mix(in srgb, var(--ly-primary-custom) 12%, white);
  --ly-primary-soft-text: color-mix(in srgb, var(--ly-primary-custom) 70%, black);
  --ly-on-primary: var(--ly-on-primary-custom, white);
  --ly-hero-from: color-mix(in srgb, var(--ly-primary-custom) 90%, black);
  --ly-hero-to: color-mix(in srgb, var(--ly-primary-custom) 55%, black);
}
:root[data-primary="custom"][data-theme="dark"] {
  --ly-primary: color-mix(in srgb, var(--ly-primary-custom) 55%, white);
  --ly-primary-hover: color-mix(in srgb, var(--ly-primary-custom) 40%, white);
  --ly-primary-soft: color-mix(in srgb, var(--ly-primary-custom) 24%, var(--ly-surface));
  --ly-primary-soft-text: color-mix(in srgb, var(--ly-primary-custom) 40%, white);
  --ly-on-primary: var(--ly-bg);
}
@media (prefers-color-scheme: dark) {
  :root[data-primary="custom"]:not([data-theme="light"]) {
    --ly-primary: color-mix(in srgb, var(--ly-primary-custom) 55%, white);
    --ly-primary-hover: color-mix(in srgb, var(--ly-primary-custom) 40%, white);
    --ly-primary-soft: color-mix(in srgb, var(--ly-primary-custom) 24%, var(--ly-surface));
    --ly-primary-soft-text: color-mix(in srgb, var(--ly-primary-custom) 40%, white);
    --ly-on-primary: var(--ly-bg);
  }
}
