/*
 * MyCellar design tokens, following Material 3 (m3.material.io).
 *
 * Colour roles come from one source colour, the wine red #7a1f35 (primary, its container, the
 * tonal surfaces and their containers, outlines). The older names the stylesheets use (--ink,
 * --panel, --accent ...) are kept as aliases of those roles, so every rule follows the roles.
 *
 * Light is the default. Dark applies when the OS prefers dark (unless <html data-theme="light">),
 * or when <html data-theme="dark"> is set. The dark selectors are wrapped in :where() so they carry
 * the same specificity as :root; a stylesheet that imports this file and then sets its own :root
 * values (styles/site.css) still wins by source order.
 *
 * The fridge and rack are appliances and keep their own colours (--cab, --interior ...).
 */
:root {
  color-scheme: light;

  /* ---- Type (Material type scale). One typeface: no serif anywhere (a serif read as AI-made). ---- */
  --display: var(--body);
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* ---- Colour roles ---- */
  --primary: #7a1f35;
  --on-primary: #ffffff;
  --primary-container: #ffd9dd;
  --on-primary-container: #3f0013;
  --secondary-container: #f7dde0;
  --on-secondary-container: #2c1518;
  --tertiary-container: #f8dfc4;      /* the amber of "Choose a wine" */
  --on-tertiary-container: #2b1700;
  --error: #b3261e;
  --on-error: #ffffff;
  --error-container: #f9dedc;
  --on-error-container: #410e0b;

  --surface: #fff8f7;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #fff0f1;
  --surface-container: #fbeaeb;
  --surface-container-high: #f5e4e5;
  --surface-container-highest: #efdedf;
  --on-surface: #22191a;
  --on-surface-variant: #524345;
  --outline: #847374;
  --outline-variant: #d7c1c3;
  --inverse-surface: #382e2f;
  --inverse-on-surface: #feedee;
  --inverse-primary: #ffb2bd;
  --scrim: rgba(0, 0, 0, 0.32);

  /* ---- Drinking-window status ----
     --st-*: the dots and the rings round bottle tops (on the dark fridge, or beside text).
     --st-*-text: the same states as words on a light surface (4.5:1 or more). */
  --st-ready: #3fae6a;
  --st-last: #e0a43a;
  --st-wait: #6f93c9;
  --st-past: #d4524e;
  --st-none: #8a959a;
  --st-ready-ring: rgba(63, 174, 106, 0.15);
  --st-ready-text: #1e7a45;
  --st-last-text: #8a5a00;
  --st-wait-text: #3a5f96;
  --st-past-text: #b3261e;
  --st-none-text: #5d686d;

  /* ---- State layers (Material: hover 8%, focus and pressed 10%) ---- */
  --state-hover: 0.08;
  --state-press: 0.1;

  /* ---- Motion (Material easing and durations) ---- */
  --ease: cubic-bezier(0.2, 0, 0, 1);            /* emphasized */
  --ease-decel: cubic-bezier(0.05, 0.7, 0.1, 1);  /* emphasized decelerate: things arriving */
  --ease-accel: cubic-bezier(0.3, 0, 0.8, 0.15);  /* emphasized accelerate: things leaving */
  --dur-short: 150ms;
  --dur-medium: 300ms;
  --dur-long: 450ms;

  /* ---- Elevation (Material levels 1-3; surfaces are told apart by tone first) ---- */
  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
  --elev-2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
  --elev-3: 0 4px 8px 3px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.3);

  /* ---- Fridge and rack (appliances) ---- */
  --cab: #22282c;
  --cab-edge: #343c41;
  --interior: #0c1114;
  --wire: #a9b4ba;
  --led: #7fc4ff;
}

/* Dark roles (the same source colour). */
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --primary: #ffb2bd;
    --on-primary: #5e1127;
    --primary-container: #7a1f35;
    --on-primary-container: #ffd9dd;
    --secondary-container: #5a3e42;
    --on-secondary-container: #ffd9dd;
    --tertiary-container: #5c4100;
    --on-tertiary-container: #ffddb3;
    --error: #ffb4ab;
    --on-error: #690005;
    --error-container: #93000a;
    --on-error-container: #ffdad6;
    --surface: #1a1112;
    --surface-container-lowest: #140c0d;
    --surface-container-low: #22191a;
    --surface-container: #271d1e;
    --surface-container-high: #322828;
    --surface-container-highest: #3d3233;
    --on-surface: #f0dedf;
    --on-surface-variant: #d7c1c3;
    --outline: #9f8c8e;
    --outline-variant: #524345;
    --inverse-surface: #f0dedf;
    --inverse-on-surface: #382e2f;
    --inverse-primary: #7a1f35;
    --scrim: rgba(0, 0, 0, 0.5);
    --st-ready-text: #7fd6a0;
    --st-last-text: #f3c06a;
    --st-wait-text: #a9c3ec;
    --st-past-text: #ffb4ab;
    --st-none-text: #b9c3c7;
    --cab: #1d1a1b;
    --cab-edge: #2f2a2b;
  }
}
:root:where([data-theme="dark"]) {
  color-scheme: dark;
  --primary: #ffb2bd;
  --on-primary: #5e1127;
  --primary-container: #7a1f35;
  --on-primary-container: #ffd9dd;
  --secondary-container: #5a3e42;
  --on-secondary-container: #ffd9dd;
  --tertiary-container: #5c4100;
  --on-tertiary-container: #ffddb3;
  --error: #ffb4ab;
  --on-error: #690005;
  --error-container: #93000a;
  --on-error-container: #ffdad6;
  --surface: #1a1112;
  --surface-container-lowest: #140c0d;
  --surface-container-low: #22191a;
  --surface-container: #271d1e;
  --surface-container-high: #322828;
  --surface-container-highest: #3d3233;
  --on-surface: #f0dedf;
  --on-surface-variant: #d7c1c3;
  --outline: #9f8c8e;
  --outline-variant: #524345;
  --inverse-surface: #f0dedf;
  --inverse-on-surface: #382e2f;
  --inverse-primary: #7a1f35;
  --scrim: rgba(0, 0, 0, 0.5);
  --st-ready-text: #7fd6a0;
  --st-last-text: #f3c06a;
  --st-wait-text: #a9c3ec;
  --st-past-text: #ffb4ab;
  --st-none-text: #b9c3c7;
  --cab: #1d1a1b;
  --cab-edge: #2f2a2b;
}

/* ---- The older names, as aliases of the roles (both themes follow automatically) ---- */
:root {
  --ground: var(--surface);
  --panel: var(--surface-container-lowest);
  --ink: var(--on-surface);
  --muted: var(--on-surface-variant);
  --line: var(--outline-variant);
  --accent: var(--primary);
  --accent-ink: var(--on-primary);
  --field: var(--surface-container-high);

  --page-glow: transparent;           /* Material surfaces are flat: no glow behind the app */
  --page-top: var(--surface);
  --page-mid: var(--surface);

  --float-bg: var(--surface-container);
  --float-line: transparent;
  --nav-bg: var(--surface-container);
  --nav-line: transparent;
  --nav-active-bg: var(--secondary-container);
  --nav-active-ring: transparent;
  --drawer-bg: var(--surface-container-low);
  --drawer-line: var(--outline-variant);
  --backdrop: var(--scrim);
  --chip-bg: transparent;
  --chip-line: var(--outline);
  --notice-bg: var(--surface-container-high);
  --notice-line: transparent;
  --notice-dot: var(--primary);
  --notice-ring: transparent;
  --dots-bg: var(--surface-container);
  --dots-line: transparent;
  --dot-idle: var(--outline-variant);
  --dot-active: var(--on-surface);
  --auth-card-bg: var(--surface-container-low);
  --toast-bg: var(--inverse-surface);
  --toast-ink: var(--inverse-on-surface);

  --shadow: var(--elev-3);
  --float-shadow: var(--elev-3);
  --nav-shadow: none;
  --drawer-shadow: var(--elev-1);
  --card-shadow: none;
}

/* Corner radius (Material shape scale; the same in both themes). */
:root {
  --r-xs: 4px;     /* extra small: text fields, snackbars, tags */
  --r-sm: 8px;     /* small: chips, menus */
  --r-md: 12px;    /* medium: cards */
  --r-lg: 16px;    /* large: navigation drawer, FAB */
  --r-xl: 28px;    /* extra large: dialogs, bottom sheets, search bar */
  --r-pill: 999px; /* full: buttons, the navigation indicator */
}
