/* Lumen design tokens — v1.0
   Source of truth: Lumen Brand Identity v2.
   Load before any Lumen storefront stylesheet. */

:root {
  /* Ground colours */
  --lum-pitch:        #0B1413;
  --lum-ink:          #12201D;
  --lum-pine:         #0F4C46;
  --lum-pine-hover:   #0C3E39;
  --lum-teal:         #4EC2AE;
  --lum-mist:         #EDF3F1;
  --lum-paper:        #FFFFFF;

  /* Neutrals */
  --lum-grey-900:     #12201D;
  --lum-grey-700:     #31403C;
  --lum-grey-500:     #5C6B67;
  --lum-grey-400:     #8A9995;
  --lum-grey-300:     #C6CFCC;
  --lum-grey-200:     #DDE3E0;
  --lum-grey-100:     #F1F4F3;
  --lum-grey-050:     #F7F8F7;

  /* Status */
  --lum-success:      #2E9E5B;
  --lum-warning:      #D2560F;
  --lum-danger:       #B3321A;
  --lum-info:         #0F4C46;

  /* Accessible text variants — the fills above fail 4.5:1 as body text */
  --lum-warning-text: #A84509;
  --lum-success-text: #1C6E3B;

  /* Type families */
  --lum-font-latin:   "Almarai", system-ui, sans-serif;
  --lum-font-arabic:  "Almarai", system-ui, sans-serif;

  /* Type scale */
  --lum-text-xs:      12.5px;
  --lum-text-sm:      13.5px;
  --lum-text-base:    15px;
  --lum-text-md:      16px;
  --lum-text-lg:      19px;
  --lum-text-xl:      22px;
  --lum-text-2xl:     28px;
  --lum-text-3xl:     34px;
  --lum-text-4xl:     42px;

  /* Weights */
  --lum-weight-regular: 400;
  --lum-weight-medium:  500;
  --lum-weight-semi:    600;

  /* Line heights */
  --lum-leading-tight: 1.12;
  --lum-leading-snug:  1.35;
  --lum-leading-body:  1.7;
  --lum-leading-arabic: 1.95;

  /* Letter-spacing — Latin only; Arabic is never tracked */
  --lum-tracking-display: -0.028em;
  --lum-tracking-wordmark: 0.01em;
  --lum-tracking-eyebrow: 0.14em;

  /* Spacing — 4 px grid */
  --lum-space-1:  4px;
  --lum-space-2:  8px;
  --lum-space-3:  12px;
  --lum-space-4:  16px;
  --lum-space-5:  20px;
  --lum-space-6:  24px;
  --lum-space-8:  32px;
  --lum-space-10: 40px;
  --lum-space-12: 48px;
  --lum-space-16: 64px;

  /* Control heights */
  /* CONTROL HEIGHTS. Note which of these clear the 44px WCAG 2.5.8 target
     floor and which do not: xs and sm DO NOT. They are for controls inside a
     larger hit area — an icon inside a 48px button, a chip inside a row that
     is itself the target — never for the target itself.

     --lum-control-md (48px) is the smallest token you may use as the minimum
     size of something a finger presses. This note exists because the wrong
     one was reached for three times in a single day, each time caught by a
     measurement rather than by reading. */
  --lum-control-xs: 32px;  /* BELOW the 44px target floor */
  --lum-control-sm: 40px;  /* BELOW the 44px target floor */
  --lum-control-md: 48px;
  --lum-control-field: 50px;
  --lum-control-lg: 56px;

  /* Radius and borders */
  /* OWNER-APPROVED DEVIATION FROM BRANDING.md 3 (2026-09-18).
     The handoff specifies 3px controls and "no pills, no other radii". At a
     44px control height 3px reads as square, and the owner asked for a softer,
     modern shape after comparing the buttons against the preset header — which
     is itself a pill from Odoo's boxed-header template, i.e. the header was
     already breaking the same rule.
     Controls are therefore 8px. This is the ONLY value in this file that does
     not match branding/tokens/lumen-tokens.css. Claude Design should reissue
     the token file at 8px so the next handoff does not silently revert it. */
  --lum-radius:        8px;
  /* OWNER-APPROVED DEVIATION FROM BRANDING.md 3 (2026-09-18), second of two.
     Cards were 5px while controls moved to 8px, which inverted the usual
     nesting: the button inside a card was rounder than the card holding it.
     12px restores outer > inner. Claude Design should reissue the token file
     with BOTH this and the 8px control radius, or the next handoff silently
     reverts them. */
  --lum-radius-card:   12px;
  --lum-border:        1px solid var(--lum-grey-300);
  --lum-border-subtle: 1px solid var(--lum-grey-200);
  --lum-border-focus:  2px solid var(--lum-pine);

  /* Layout */
  --lum-container:  1180px;
  --lum-gutter:     28px;
}

/* Direction-aware defaults.
   Arabic sets the family and the looser leading; nothing else changes. */
[dir="rtl"] {
  --lum-font-body: var(--lum-font-arabic);
  --lum-leading-default: var(--lum-leading-arabic);
}
[dir="ltr"], :root {
  --lum-font-body: var(--lum-font-latin);
  --lum-leading-default: var(--lum-leading-body);
}

/* ---------------------------------------------------------------------------
   Surface and action tokens.

   BRANDING §1's dark block introduces four names — surface-1, surface-2,
   action, on-action — that light mode must also answer, or a component written
   once as var(--lum-action) simply has no value in light. Their light values
   are the ones the storefront already uses literally, so nothing changes
   visually; they exist so a rule can be written once instead of twice.

   --lum-well / --lum-well-rule carry §7.6's image-well treatment, which
   BRANDING names in prose but gives no token. Light keeps the values
   product_page.scss already used.
   --------------------------------------------------------------------------- */
:root {
  --lum-surface-1:    var(--lum-paper);
  --lum-surface-2:    var(--lum-paper);
  --lum-action:       var(--lum-pine);
  --lum-action-hover: var(--lum-pine-hover);
  --lum-on-action:    var(--lum-paper);
  --lum-well:         var(--lum-grey-100);
  --lum-well-rule:    var(--lum-grey-200);
  --lum-field-border: var(--lum-grey-300);
  --lum-stock-dot:    var(--lum-success);
  /* Tinted ground for a selected row. Separate from --lum-mist
     because mist is ALSO used as text on pitch (the announcement
     bar), and a token that flips for one role breaks the other. */
  --lum-selected-bg:  var(--lum-mist);
}

/* ---------------------------------------------------------------------------
   Dark mode — design handoff §7.6 / BRANDING §1.

   Two changes carry the whole thing: teal takes the primary action (pine on
   pitch is 2.0:1 and unusable as a filled button; teal with #08201C ink gives
   7.8:1), and elevation is a surface step rather than a shadow, because
   shadows read as smudges on a dark ground.

   THE TWO BLOCKS BELOW MUST STAY IDENTICAL. The first serves an explicit
   choice, the second serves "follow the device" — plain CSS has no way to
   share a declaration block between a selector and a media-scoped selector,
   so they are duplicated, and test_dark_mode.py compares their DECLARATIONS
   on every run rather than trusting anyone to remember. Prose is ignored by
   that comparison, which is why this note lives here rather than inside one
   of the blocks — a comment in one and not the other failed the test once,
   correctly and unhelpfully.

   On --lum-success-text and --lum-warning-text: the status TEXT tokens do not
   flip with the greys and were left behind when dark mode was built.
   #1C6E3B and #A84509 are chosen to read as words on a light page; on the
   dark ground they measure 2.97:1 and 3.13:1, and the product page's
   "Free over £100" was one of them. Same mistake as the homepage hero using a
   flipping grey over a scrim that is dark in both modes — a token is only
   correct against the ground it was picked for. The dark values below measure
   9.02:1 and 8.10:1 on pitch and 7.29:1 and 6.55:1 on the lightest surface.
   --------------------------------------------------------------------------- */
[data-theme="dark"] {
  --lum-paper:        #0B1413;
  --lum-surface-1:    #141F1C;
  --lum-surface-2:    #1B2925;
  --lum-ink:          #EDF3F1;
  --lum-grey-900:     #EDF3F1;
  --lum-grey-700:     #C3D0CC;
  --lum-grey-500:     #9FB0AC;
  --lum-grey-400:     #6E817C;
  --lum-grey-300:     #374843;
  --lum-grey-200:     #22312D;
  --lum-grey-100:     #141F1C;
  --lum-grey-050:     #0F1A17;
  --lum-action:       #4EC2AE;
  --lum-action-hover: color-mix(in srgb, #4EC2AE 86%, #0B1413);
  --lum-on-action:    #08201C;
  --lum-well:         #0F1A17;
  --lum-well-rule:    #22312D;
  --lum-field-border: #374843;
  --lum-selected-bg:  #1B2925;
  --lum-stock-dot:    #4ECB78;
  --lum-success-text: #4ECB78;
  --lum-warning-text: #F0954A;
  --lum-border-focus: 2px solid #4EC2AE;
}

@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --lum-paper:        #0B1413;
    --lum-surface-1:    #141F1C;
    --lum-surface-2:    #1B2925;
      --lum-ink:          #EDF3F1;
    --lum-grey-900:     #EDF3F1;
    --lum-grey-700:     #C3D0CC;
    --lum-grey-500:     #9FB0AC;
    --lum-grey-400:     #6E817C;
    --lum-grey-300:     #374843;
    --lum-grey-200:     #22312D;
    --lum-grey-100:     #141F1C;
    --lum-grey-050:     #0F1A17;
    --lum-action:       #4EC2AE;
    --lum-action-hover: color-mix(in srgb, #4EC2AE 86%, #0B1413);
    --lum-on-action:    #08201C;
    --lum-well:         #0F1A17;
    --lum-well-rule:    #22312D;
    --lum-field-border: #374843;
    --lum-selected-bg:  #1B2925;
    --lum-stock-dot:    #4ECB78;
    --lum-success-text: #4ECB78;
    --lum-warning-text: #F0954A;
    --lum-border-focus: 2px solid #4EC2AE;
  }
}
