/*
 * BerriesCloud Foundation: proposed design tokens.
 * Source: berries-cloud.com "Blueberry night" theme (web/src/berries-cloud.com/assets/theme-blueberry.css).
 * Roles: berry = primary action, indigo = selection, links and focus, night = brand surfaces.
 *
 * Variants: html[data-theme] picks the variant, html[data-mode] (light | dark) carries the shared mode rules.
 *   Light: light (Blueberry), light-paper (neutral white), light-berry (warm rose)
 *   Dark:  dark-night (indigo), dark-slate (cool dark gray), dark-graphite (neutral gray), dark-carbon (black)
 * Text rule for light themes: secondary text stays at 7:1 or more on its background, no light gray on gray.
 */

/* ---------- Light: Blueberry (default) ---------- */
:root {
  color-scheme: light;

  /* Brand */
  --brand-berry: #c63164;
  --brand-berry-hover: #a8274f;
  --brand-berry-soft: #f7e4ea;
  --brand-berry-ink: #8f2548;
  --brand-indigo: #3d3a8f;
  --brand-indigo-2: #6c66d4;
  --brand-indigo-deep: #2a2870;
  --brand-indigo-soft: #e8e7fa;
  --brand-lilac: #c9c4ff;
  --brand-night: linear-gradient(150deg, #13163a 0%, #22265c 55%, #37307f 100%);

  /* Surfaces */
  --bg: #f8f8fc;
  --surface: #ffffff;
  --surface-alt: #f4f5fa;
  --surface-sunken: #eeeff9;
  --sidebar-bg: #f0f1f9;

  /* Text: darker than the first draft for contrast */
  --ink: #0f1226;
  --ink-2: #393e55;
  --ink-3: #585c73;
  --on-brand: #ffffff;

  /* Lines */
  --line: #d9dcea;
  --line-2: #e9ebf3;
  --line-strong: #868896; /* input borders: 3:1 or more (WCAG 1.4.11) */

  /* Semantic */
  --action: var(--brand-berry);
  --action-hover: var(--brand-berry-hover);
  --selected-bg: var(--brand-indigo-soft);
  --selected-ink: var(--brand-indigo-deep);
  --link: var(--brand-indigo);
  --focus: var(--brand-indigo-2);
  --aside-title: var(--brand-indigo-deep);
  --progress-fill: linear-gradient(90deg, var(--brand-berry), #d9547f);
  --page-band: none;
  --page-glow: none;

  /* Status */
  --ok: #176a31;      --ok-bg: #e1f3e6;
  --warn: #7a4f00;    --warn-bg: #fdf0d2;
  --fail: #a61f15;    --fail-bg: #fde5e3;
  --info: var(--brand-indigo); --info-bg: var(--brand-indigo-soft);
  --neutral: #353a50; --neutral-bg: #e6e8f1;

  /* Type */
  --font: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-lg: 18px;
  --fs-xl: 24px;
  --fs-2xl: 30px;

  /* Spacing (4px base) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

  /* Radius, shadow */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-pill: 999px;
  --shadow-card: 0 1px 2px rgba(22, 26, 46, .05), 0 8px 24px -18px rgba(34, 38, 92, .35);
  --shadow-pop: 0 18px 40px -20px rgba(19, 22, 58, .45);
}

/* ---------- Light: Paper (neutral white, near-black text) ---------- */
:root[data-theme="light-paper"] {
  --bg: #f4f4f6;
  --surface: #ffffff;
  --surface-alt: #f7f7f8;
  --surface-sunken: #ededf0;
  --sidebar-bg: #ffffff;
  --ink: #0b0b10;
  --ink-2: #33333d;
  --ink-3: #50505b;
  --line: #dadade0;
  --line-2: #eaeaed;
  --neutral: #33333d; --neutral-bg: #e9e9ed;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .05), 0 8px 24px -20px rgba(0, 0, 0, .25);
}

/* ---------- Light: Paper 2 (Paper with a tinted sidebar like Blueberry) ---------- */
:root[data-theme="light-paper-2"] {
  --bg: #f6f6f8;
  --surface: #ffffff;
  --surface-alt: #f7f7f9;
  --surface-sunken: #eceef4;
  --sidebar-bg: #e9ebf3;
  --ink: #0b0b10;
  --ink-2: #32343f;
  --ink-3: #4e505c;
  --line: #d8dae2;
  --line-2: #e8e9ee;
  --selected-bg: #dcdbf5;
  --neutral: #32343f; --neutral-bg: #e7e8ee;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .05), 0 8px 24px -20px rgba(0, 0, 0, .25);
}

/* ---------- Light: Berry (warm rose tint, berry selection) ---------- */
:root[data-theme="light-berry"] {
  --bg: #fff8f9;
  --surface: #ffffff;
  --surface-alt: #fdf3f6;
  --surface-sunken: #fcebf0;
  --sidebar-bg: #fcebf0;
  --ink: #1a1015;
  --ink-2: #47353d;
  --ink-3: #65525a;
  --line: #ecd5dd;
  --line-2: #f6e6ec;
  --selected-bg: #f5d9e3;
  --selected-ink: #7d1f3f;
  --link: #a8274f;
  --focus: #c63164;
  --aside-title: #7d1f3f;
  --neutral: #47353d; --neutral-bg: #f1e4e9;
  --shadow-card: 0 1px 2px rgba(60, 20, 35, .05), 0 8px 24px -18px rgba(120, 30, 70, .3);
}

/* ---------- Dark: shared rules for every dark variant ---------- */
:root[data-mode="dark"] {
  color-scheme: dark;
  --brand-berry: #e0507f;
  --brand-berry-hover: #ec6b95;
  --brand-berry-soft: #3a1a2b;
  --brand-berry-ink: #ffb3cb;
  --brand-indigo: #a9a4ff;
  --brand-indigo-soft: #2a2b5c;
  --brand-indigo-deep: #d9d6ff;
  --focus: #c9c4ff;
  --aside-title: var(--brand-lilac);
  --line-strong: #6a7080;

  --ok: #7ed79a;      --ok-bg: #173a27;
  --warn: #f3c56b;    --warn-bg: #3a2e12;
  --fail: #ff9d93;    --fail-bg: #3f1a1d;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -18px rgba(0, 0, 0, .7);
  --shadow-pop: 0 18px 40px -16px rgba(0, 0, 0, .8);
}

/* Dark 1: Night (indigo, matches berries-cloud.com) */
:root[data-theme="dark-night"] {
  --bg: #0f1130;
  --surface: #171a3d;
  --surface-alt: #1d2049;
  --surface-sunken: #13163a;
  --sidebar-bg: #13163a;
  --ink: #eceeff;
  --ink-2: #b9bcd8;
  --ink-3: #8f93b6;
  --line: #2c3061;
  --line-2: #23264f;
  --neutral: #c3c6e0; --neutral-bg: #262a55;
}

/* Dark 2: Slate (cool dark gray, a hint of blue) */
:root[data-theme="dark-slate"] {
  --brand-night: linear-gradient(150deg, #0c0e12 0%, #161922 55%, #22213a 100%);
  --brand-indigo-soft: #262840;
  --bg: #121418;
  --surface: #1a1d23;
  --surface-alt: #20242b;
  --surface-sunken: #16191e;
  --sidebar-bg: #0e1013;
  --ink: #eef0f4;
  --ink-2: #bcc1cc;
  --ink-3: #9198a6;
  --line: #2d3139;
  --line-2: #24272e;
  --selected-bg: #262840;
  --selected-ink: #dedcff;
  --neutral: #c5cad4; --neutral-bg: #2a2e36;
}

/*
 * Slate family: Slate surfaces, the website blue comes back in one place each.
 *   slate-nav   : night gradient sidebar
 *   slate-band  : night gradient band behind the page header
 *   slate-glow  : soft indigo glow in the page corner
 *   dusk        : surfaces halfway between Slate and Night
 */
:root[data-theme="dark-slate-nav"],
:root[data-theme="dark-slate-band"],
:root[data-theme="dark-slate-glow"] {
  --brand-indigo-soft: #2a2b55;
  --bg: #121418;
  --surface: #1a1d23;
  --surface-alt: #20242b;
  --surface-sunken: #16191e;
  --sidebar-bg: #0e1013;
  --ink: #eef0f4;
  --ink-2: #bcc1cc;
  --ink-3: #9198a6;
  --line: #2d3139;
  --line-2: #24272e;
  --selected-bg: #2a2b55;
  --selected-ink: #dedcff;
  --neutral: #c5cad4; --neutral-bg: #2a2e36;
}
:root[data-theme="dark-slate-nav"] {
  --sidebar-bg: linear-gradient(170deg, #13163a 0%, #1c1f4c 55%, #2c2868 100%);
  --sidebar-line: transparent;
  --selected-bg: rgba(201, 196, 255, .16);
  --selected-ink: #ffffff;
}
:root[data-theme="dark-slate-band"] {
  --page-band: linear-gradient(180deg, rgba(18, 20, 24, 0) 35%, #121418 100%),
               linear-gradient(150deg, #13163a 0%, #22265c 55%, #37307f 100%);
}
:root[data-theme="dark-slate-glow"] {
  --page-glow: radial-gradient(900px 600px at 100% 0%, rgba(108, 102, 212, .22), rgba(108, 102, 212, 0) 70%),
               radial-gradient(700px 500px at 0% 100%, rgba(61, 58, 143, .25), rgba(61, 58, 143, 0) 70%);
}
:root[data-theme="dark-dusk"] {
  --brand-night: linear-gradient(150deg, #0d0f1c 0%, #181b33 55%, #2a2758 100%);
  --brand-indigo-soft: #2a2b55;
  --bg: #111320;
  --surface: #191b2b;
  --surface-alt: #1f2234;
  --surface-sunken: #151726;
  --sidebar-bg: #0d0f1a;
  --ink: #eeeff8;
  --ink-2: #babdd0;
  --ink-3: #9094ab;
  --line: #2b2e44;
  --line-2: #222438;
  --selected-bg: #2a2b55;
  --selected-ink: #dedcff;
  --neutral: #c4c7dc; --neutral-bg: #272a40;
}

/* Dark 3: Graphite (neutral gray, berry selection, no blue) */
:root[data-theme="dark-graphite"] {
  --brand-night: linear-gradient(150deg, #0c0c0d 0%, #19171a 55%, #2a1c24 100%);
  --bg: #141415;
  --surface: #1c1c1f;
  --surface-alt: #232327;
  --surface-sunken: #18181a;
  --sidebar-bg: #0f0f10;
  --ink: #f3f3f4;
  --ink-2: #c2c2c7;
  --ink-3: #96969d;
  --line: #2f2f34;
  --line-2: #262629;
  --selected-bg: #3a1f2b;
  --selected-ink: #ffc9da;
  --link: #ff9cbc;
  --focus: #ff9cbc;
  --aside-title: #ffc9da;
  --info: #c9c4ff; --info-bg: #2a2838;
  --neutral: #c8c8cd; --neutral-bg: #2b2b30;
}

/* Dark 4: Carbon (true black, for OLED and low light) */
:root[data-theme="dark-carbon"] {
  --brand-night: linear-gradient(150deg, #000000 0%, #0d0b0d 55%, #1c1018 100%);
  --bg: #000000;
  --surface: #0f0f10;
  --surface-alt: #161617;
  --surface-sunken: #0a0a0b;
  --sidebar-bg: #000000;
  --ink: #fafafa;
  --ink-2: #c8c8cc;
  --ink-3: #9a9aa0;
  --line: #262628;
  --line-2: #1b1b1d;
  --selected-bg: #222225;
  --selected-ink: #ffffff;
  --link: #c9c4ff;
  --info: #c9c4ff; --info-bg: #1f1d2e;
  --neutral: #cfcfd4; --neutral-bg: #222225;
}
