/*
 * Smartio design tokens: the ONE list of colours, text sizes, spacing, corners,
 * shadows and motion. Every shared part (assets/css/smartio-ui.css, the product
 * card) reads only these. A colour or size typed anywhere else is a bug.
 *
 * Names start with --ui- so they never collide with the older per-page
 * variables (--primary, --text-mid, ...) that pages still define for themselves.
 * Phase 3 moves each page onto these names.
 *
 * Breakpoints (CSS cannot read variables inside @media, so they are fixed here):
 *   phone  <= 480px   small tablet <= 768px   tablet <= 1100px   wide >= 1320px
 */

:root {
  /* Brand */
  --ui-navy:        #0d4877;  /* main buttons, links, prices. Stays navy in dark mode */
  --ui-navy-dark:   #092f50;  /* hover on navy */
  --ui-navy-light:  #1a6099;
  --ui-teal:        #7bd0ca;  /* accent fills only; too light for text on white */
  --ui-teal-ink:    #2a7590;  /* teal you can read as text on white */
  --ui-sky:         #61afcc;
  --ui-wa:          #25d366;  /* WhatsApp brand green: icon and fills with dark text */
  --ui-wa-ink:      #0e7a66;  /* WhatsApp green that white text can sit on */
  --ui-wa-ink-dark: #0b6455;  /* hover on it */

  /* Status */
  --ui-sale:        #dc2626;
  --ui-success:     #15803d;
  --ui-success-text:#15803d;  /* success words on a pale fill */
  --ui-success-bg:  #e8f6ee;
  --ui-warn:        #8a5300;
  --ui-warn-bg:     #fef3c7;
  --ui-warn-line:   #fcd34d;
  --ui-error:       #b91c1c;
  --ui-error-bg:    #fdecec;
  --ui-info-bg:     #e7f0f8;  /* "in progress" order status chip */
  --ui-info-text:   #0d4877;
  --ui-best:        #b45309;  /* Best seller badge */
  --ui-muted-fill:  #64748b;  /* Out of stock badge */
  --ui-star:        #f59e0b;  /* rating stars */
  --ui-best-from:   #f59e0b;  /* Best seller badge gradient */
  --ui-best-to:     #d97706;
  --ui-best-glow:   rgba(245, 158, 11, .3);
  --ui-low-text:    #92400e;  /* "Only 2 left" badge on a product picture */
  --ui-low-fill:    #fef3c7;
  --ui-low-line:    #fcd34d;
  --ui-on-dark:     #ffffff;  /* text on navy, sale red and other dark fills */

  /* Surfaces and text (light) */
  --ui-bg:          #f4f6f9;
  --ui-surface:     #ffffff;
  --ui-surface-2:   #f8fafc;
  --ui-text:        #111827;
  --ui-text-mid:    #556b85;
  --ui-text-soft:   #5c6878;  /* the lightest text allowed: 5.6:1 on white */
  --ui-line:        #e8edf3;
  --ui-line-strong: #d0d9e4;
  --ui-link:        var(--ui-navy);
  --ui-focus:       var(--ui-navy);
  --ui-focus-ring:  rgba(13, 72, 119, .15);

  /* Type: one family, nine sizes, three weights */
  --ui-font:        'D-DIN Exp', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ui-fs-xs:   12px;
  --ui-fs-sm:   13px;
  --ui-fs-base: 15px;
  --ui-fs-md:   16px;
  --ui-fs-lg:   18px;
  --ui-fs-xl:   20px;
  --ui-fs-2xl:  24px;
  --ui-fs-3xl:  30px;
  --ui-fs-4xl:  38px;
  --ui-fw-regular: 400;
  --ui-fw-semi:    600;
  --ui-fw-bold:    700;
  --ui-lh-tight:   1.2;
  --ui-lh:         1.5;

  /* Spacing: 4px steps up to 24, then larger jumps */
  --ui-sp-1:  4px;
  --ui-sp-2:  8px;
  --ui-sp-3:  12px;
  --ui-sp-4:  16px;
  --ui-sp-5:  20px;
  --ui-sp-6:  24px;
  --ui-sp-8:  32px;
  --ui-sp-10: 40px;
  --ui-sp-14: 56px;
  --ui-sp-18: 72px;

  /* Corners: buttons and fields 8, cards 16, chips round */
  --ui-r-sm:   6px;
  --ui-r:      8px;
  --ui-r-md:   12px;
  --ui-r-lg:   16px;
  --ui-r-pill: 9999px;

  /* Shadows: three, all navy-tinted */
  --ui-shadow-sm: 0 2px 8px rgba(13, 72, 119, .08);
  --ui-shadow:    0 4px 16px rgba(13, 72, 119, .10);
  --ui-shadow-lg: 0 8px 32px rgba(13, 72, 119, .14);

  /* Layout */
  --ui-max:  1320px;
  --ui-pad:  40px;
  --ui-tap:  44px;   /* smallest tap target */

  /* Motion */
  --ui-fast: 150ms;
  --ui-slow: 250ms;
}

@media (max-width: 1100px) { :root { --ui-pad: 24px; } }
@media (max-width: 768px)  { :root { --ui-pad: 16px; } }

/* Dark: the system setting, unless the visitor picked light with the moon button */
@media (prefers-color-scheme: dark) {
  html:not(.theme-light) {
    --ui-bg:          #0f1722;
    --ui-surface:     #18222f;
    --ui-surface-2:   #1d2937;
    --ui-text:        #e9eef5;
    --ui-text-mid:    #9fb0c4;
    --ui-text-soft:   #8597ad;
    --ui-line:        #243245;
    --ui-line-strong: #2e3f55;
    --ui-link:        #7bd0ca;
    --ui-focus:       #7bd0ca;
    --ui-teal-ink:    #7bd0ca;
    --ui-success-bg:  rgba(21, 128, 61, .18);
    --ui-success-text:#6ee7a0;
    --ui-error:       #f87171;
    --ui-warn:        #f2c46b;
    --ui-warn-bg:     rgba(245, 158, 11, .14);
    --ui-warn-line:   rgba(245, 158, 11, .45);
    --ui-error-bg:    rgba(185, 28, 28, .18);
    --ui-info-bg:     rgba(123, 208, 202, .14);
    --ui-info-text:   #7bd0ca;
    --ui-shadow-sm:   0 2px 8px rgba(0, 0, 0, .35);
    --ui-shadow:      0 4px 16px rgba(0, 0, 0, .40);
    --ui-shadow-lg:   0 8px 32px rgba(0, 0, 0, .45);
  }
}
/* Dark picked with the moon button */
html.theme-dark {
  --ui-bg:          #0f1722;
  --ui-surface:     #18222f;
  --ui-surface-2:   #1d2937;
  --ui-text:        #e9eef5;
  --ui-text-mid:    #9fb0c4;
  --ui-text-soft:   #8597ad;
  --ui-line:        #243245;
  --ui-line-strong: #2e3f55;
  --ui-link:        #7bd0ca;
  --ui-focus:       #7bd0ca;
  --ui-teal-ink:    #7bd0ca;
  --ui-success-bg:  rgba(21, 128, 61, .18);
  --ui-success-text:#6ee7a0;
  --ui-error:       #f87171;
  --ui-warn:        #f2c46b;
  --ui-warn-bg:     rgba(245, 158, 11, .14);
  --ui-warn-line:   rgba(245, 158, 11, .45);
  --ui-error-bg:    rgba(185, 28, 28, .18);
  --ui-info-bg:     rgba(123, 208, 202, .14);
  --ui-info-text:   #7bd0ca;
  --ui-shadow-sm:   0 2px 8px rgba(0, 0, 0, .35);
  --ui-shadow:      0 4px 16px rgba(0, 0, 0, .40);
  --ui-shadow-lg:   0 8px 32px rgba(0, 0, 0, .45);
}

@media (prefers-reduced-motion: reduce) {
  :root { --ui-fast: 0ms; --ui-slow: 0ms; }
}

/* Text for screen readers only (e.g. "Regular price" before a crossed-out price) */
.screen-reader-text{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;} /* rules-ok: must beat any page style to stay hidden */
