/* ===========================================================================
   Loyal Sathi — design tokens
   The single source of truth for colour, type, space, depth and motion.
   Loaded before app.css and admin.css so both panels share one system.

   Everything is self-hosted: no CDN, no build step, no external request.
   =========================================================================== */

/* ------------------------------------------------------------------ type --
   Two variable fonts, subset to latin, served from our own /assets/fonts.
   Devanagari (कथा) falls through to the system stack, which every modern
   phone and desktop covers — bundling a Devanagari face would add ~200 KB.
   font-display:swap so text paints immediately on a slow Nepali connection. */

@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-var.woff2') format('woff2-variations'),
       url('../fonts/inter-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Playfair Display';
  src: url('../fonts/playfair-var.woff2') format('woff2-variations'),
       url('../fonts/playfair-var.woff2') format('woff2');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

/* Montserrat — the wordmark's own typeface, and now the whole product's:
   the public site, both panels, and the customer's stamp card.

   It used to be reserved for the platform's own surfaces on the reasoning that
   a shop's card should wear the shop's identity. In practice that identity is
   carried by the shop's colours, logo and cover photo, and the split just made
   the panel and the card look like two different products to the one person who
   sees both. SIL Open Font License. */
@font-face {
  font-family: 'Montserrat';
  src: url('../fonts/montserrat-var.woff2') format('woff2-variations'),
       url('../fonts/montserrat-var.woff2') format('woff2');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* --- platform theme ---------------------------------------------------
     The same four variables a shop's pages receive inline from theme_vars().
     Defined here so unthemed pages (super admin, marketing) can use them too.
     Must equal LS_THEME_PRESETS['classic'] in includes/theme.php. */
  --main:        #5B2BD9;
  --accent:      #FFB020;
  --on-main:     #FFFFFF;
  --accent-ink:  #8A5A00;

  /* --- brand roles (variable names kept from the navy/gold era) --------- */
  --navy:        #5B2BD9;   /* PRIMARY: buttons, links, active states      */
  --navy-deep:   #4520A8;   /* primary hover/pressed; text on --gold fills */
  --navy-soft:   #7450E6;   /* lighter primary                             */
  --gold:        #FFB020;   /* ACCENT: fills only (halo, progress, badges) */
  --gold-soft:   #FFD98A;
  --gold-ink:    #8A5A00;   /* accent-coloured text on light surfaces      */
  --gold-wash:   #FFF4DB;
  --cream:       #FFFFFF;   /* text on primary                             */
  --ink:         #1A1523;

  /* new */
  --aubergine:    #1D0328;  /* the logo's ground                           */
  --primary-wash: #F1ECFE;  /* selected / active tint                      */
  --focus:        #5B2BD9;  /* focus ring                                  */
  --field-border: #8E8B9C;  /* input borders: 3.3:1 on white               */

  /* --- surfaces --------------------------------------------------------- */
  --bg:          #F6F6F9;
  --surface:     #FFFFFF;
  --surface-2:   #FAFAFC;
  --surface-3:   #EEEEF3;
  --line:        #E4E4EA;
  --line-strong: #CFCFD9;

  /* --- text ------------------------------------------------------------- */
  --text:        #1A1523;
  --text-muted:  #5E5A6B;
  --text-soft:   #6E6B7D;
  --text-on-dark:#FFFFFF;

  /* --- status ----------------------------------------------------------- */
  --ok:          #177245;
  --ok-bg:       #E7F6EC;
  --warn:        #8A5A00;
  --warn-bg:     #FFF4DB;
  --danger:      #B42318;
  --danger-bg:   #FEECEB;
  --info:        #1D5FA8;
  --info-bg:     #E8F1FB;

  /* --- typography: Inter only ------------------------------------------ */
  --font-display: 'Inter', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  --font-body:    'Inter', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  --font-mono:    ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;

  --t-xs:   0.75rem;    /* 12 — meta, badges (was 11)   */
  --t-sm:   0.875rem;   /* 14 — secondary, tables (13)  */
  --t-base: 1rem;       /* 16 — body                    */
  --t-md:   1.125rem;   /* 18 — card titles             */
  --t-lg:   1.25rem;    /* 20 (was 22)                  */
  --t-xl:   1.5rem;     /* 24 — page titles (was 28)    */
  --t-2xl:  2rem;       /* 32 (was 36)                  */
  --t-3xl:  2.75rem;    /* 44 — the stamp count (48)    */

  --lh-tight: 1.2;
  --lh-snug:  1.4;
  --lh-body:  1.6;

  --track-tight: -0.015em;
  --track-wide:   0.01em;   /* was .08em: kills the tracked-out label look everywhere */

  /* --- space (4px base, unchanged) -------------------------------------- */
  --s-1:  0.25rem;
  --s-2:  0.5rem;
  --s-3:  0.75rem;
  --s-4:  1rem;
  --s-5:  1.25rem;
  --s-6:  1.5rem;
  --s-8:  2rem;
  --s-10: 2.5rem;
  --s-12: 3rem;
  --s-16: 4rem;
  --s-20: 5rem;

  /* --- radius: 8 controls, 12 cards, 16/20 large containers ------------- */
  --r-sm:   6px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-xl:   16px;
  --r-2xl:  20px;
  --r-full: 999px;

  /* --- depth: borders do the work; shadows only for floating layers ----- */
  --shadow-xs: 0 1px 2px rgba(26, 21, 35, 0.05);
  --shadow-sm: 0 1px 3px rgba(26, 21, 35, 0.08);
  --shadow-md: 0 6px 16px rgba(26, 21, 35, 0.10);
  --shadow-lg: 0 16px 40px rgba(26, 21, 35, 0.16);
  --shadow-gold: 0 1px 3px rgba(26, 21, 35, 0.08);   /* the gold glow is retired */
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.25);

  /* --- motion (unchanged) ----------------------------------------------- */
  --ease:      cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out:  cubic-bezier(0.33, 1, 0.68, 1);
  --ease-in:   cubic-bezier(0.32, 0, 0.67, 0);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 140ms;
  --dur:      240ms;
  --dur-slow: 420ms;

  /* --- layout ----------------------------------------------------------- */
  --app-max: 480px;
  --admin-max: 1200px;

  --phone-w:      390px;
  --phone-h:      720px;
  --phone-bezel:  10px;
  --phone-radius: 30px;

  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* --- "gradients": deliberately flat ------------------------------------
     ~60 rules across app/admin/site use these as backgrounds. Written as
     one-colour gradients so they stay valid in both `background` and
     `background-image`, and every one of those rules goes flat at once. */
  --grad-navy:  linear-gradient(var(--navy), var(--navy));
  --grad-gold:  linear-gradient(var(--gold), var(--gold));
  --grad-sheen: linear-gradient(transparent, transparent);
}

/* --------------------------------------------------------------- base ---- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--t-base);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02','cv03','cv04','ss01';
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: var(--track-tight);
  margin: 0;
}

/* Numbers that change (stamp counts, totals, PINs) must not reflow as they
   tick, so every numeric display is tabular. */
.num, .tabular { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- a11y ------ */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --------------------------------------------------------------- icons --- */
/* Inline stroke icons from the sprite. Sized in em so they scale with text. */
.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  display: inline-block;
  vertical-align: -0.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 1em;    height: 1em; }
.icon-lg { width: 1.75em; height: 1.75em; }
.icon-xl { width: 2.5em;  height: 2.5em; }
.icon-fill { fill: currentColor; stroke: none; }

/* ------------------------------------------------------------- motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
