/* Product roles — Keys To Rent Mini App.
 * Composes css/variables.css (generated from tokens/tokens.json). Aliases only:
 * this file must stay free of color literals (CI: hex_free). New raw values go to
 * tokens.json first, then get a role here.
 *
 * Feature code uses the ROLE names below (--bg-*, --fg-*, --line-*, --accent-*, --status-*),
 * not the palette names (--color-acid-lime). Palette names are for this file only.
 */

:root {
  color-scheme: dark;

  /* ——— Elevation (dark-first, lighter = closer) ——— */
  --elevation-0: var(--color-deep-black);      /* page canvas, behind everything */
  --elevation-1: var(--color-graphite);        /* cards, sheets, bottom nav, inputs */
  --elevation-2: var(--color-graphite-raised); /* pressed rows, nested panels */
  --elevation-3: var(--color-graphite-high);   /* skeleton shimmer, idle-hover */

  /* ——— Backgrounds ——— */
  --bg-app: var(--elevation-0);
  --bg-card: var(--elevation-1);
  --bg-card-pressed: var(--elevation-2);
  --bg-input: var(--elevation-1);
  --bg-selected: var(--color-lime-wash);

  /* ——— Foreground (text + icons). Sizes are --text-*; colors are --fg-*. ——— */
  --fg-primary: var(--color-soft-white);
  --fg-secondary: var(--color-mist);
  --fg-muted: var(--color-stone);
  --fg-disabled: var(--color-ash);
  --fg-on-accent: var(--color-deep-black);   /* ONLY text color allowed on lime */
  --fg-accent: var(--color-acid-lime);       /* links, selected labels, key numbers */

  /* ——— Lines ——— */
  --line-subtle: var(--color-line);            /* dividers, card borders */
  --line-control: var(--color-line-strong);    /* inputs, outline buttons (3:1) */

  /* ——— Accent (Acid Lime) ——— */
  --accent: var(--color-acid-lime);
  --accent-hover: var(--color-lime-hover);
  --accent-pressed: var(--color-lime-pressed);
  --accent-wash: var(--color-lime-wash);
  --focus-ring: var(--color-acid-lime);

  /* ——— Launch energy light (decorative Living Key scene only; never text, fills or status) ——— */
  --accent-energy-core: var(--color-energy-core);
  --accent-energy-bright: var(--color-energy-bright);
  --accent-energy-highlight: var(--color-energy-highlight);
  --accent-energy-deep: var(--color-energy-deep);

  /* ——— Status (never lime; always paired with icon + label) ——— */
  --status-danger: var(--semantic-danger);
  --status-danger-bg: var(--surface-danger);
  --status-danger-border: var(--surface-danger-border);
  --status-success: var(--semantic-success);
  --status-success-bg: var(--surface-success);
  --status-success-border: var(--surface-success-border);
  --status-warning: var(--semantic-warning);
  --status-warning-bg: var(--surface-warning);
  --status-warning-border: var(--surface-warning-border);
  --status-info: var(--semantic-info);
  --status-info-bg: var(--surface-info);
  --status-info-border: var(--surface-info-border);

  /* ——— Type roles ——— */
  --type-heading: var(--font-unbounded);
  --type-body: var(--font-manrope);

  /* ——— Text hierarchy (reference 2026-10-28; see product/REFERENCE.md) ———
   * L1 screen title  → .screen-title / .ma-title (Unbounded 28/700)
   * L2 section title → headings between blocks and hero-card titles
   * L3 item title    → card rows, form labels, FAQ questions
   * Meta             → captions under titles, times, hints */
  --font-section-title: var(--font-weight-bold) var(--text-subheading)/var(--leading-subheading) var(--type-body);
  --font-item-title: var(--font-weight-bold) var(--text-body)/var(--leading-subheading) var(--type-body);
  --font-meta: var(--font-weight-regular) var(--text-body-sm)/var(--leading-body-sm) var(--type-body);

  /* ——— Telegram viewport + safe areas (Bot API 8.0 vars, env() fallback) ——— */
  --safe-top: max(var(--tg-safe-area-inset-top, 0px), env(safe-area-inset-top, 0px));
  --safe-bottom: max(var(--tg-safe-area-inset-bottom, 0px), env(safe-area-inset-bottom, 0px));
  --content-safe-top: var(--tg-content-safe-area-inset-top, 0px);
  /* Fullscreen: content starts below the device inset AND Telegram's own buttons. */
  --chrome-safe-top: calc(var(--safe-top) + var(--content-safe-top));
  --viewport-height: var(--tg-viewport-stable-height, 100dvh);

  /* ——— Status → product mapping ———
   * payment failed / declined     → danger
   * subscription expiring / trial → warning
   * payment ok / filters saved    → success
   * tips, "how it works"          → info
   * selected filter / active tab  → accent (NOT a status)
   */
}
