/* =============================================================================
   maattaam v2 — design tokens (Phase 1). Documented in docs/DESIGN.md.
   Brand hues come ONLY from docs/BRAND.md: purple #4B3EC4, orange #F57E20, accent #FF5722.
   Everything else is a tint/shade of those hues, a neutral, or a semantic colour.
   ============================================================================= */

/* ---- Fonts (self-hosted WOFF2, OFL-1.1; see fonts/LICENSE-*.txt) ---------- */
@font-face {
  font-family: "Poppins";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/poppins-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Poppins";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/poppins-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Malayalam subset; also supplies the ₹ sign (U+20B9), which Poppins' latin subset lacks. */
@font-face {
  font-family: "Noto Sans Malayalam";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/noto-sans-malayalam-malayalam-400.woff2") format("woff2");
  unicode-range: U+0307, U+0323, U+0951-0952, U+0964-0965, U+0D00-0D7F, U+1CDA, U+1CF2, U+200C-200D, U+20B9, U+25CC, U+A830-A832;
}
@font-face {
  font-family: "Noto Sans Malayalam";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/noto-sans-malayalam-malayalam-600.woff2") format("woff2");
  unicode-range: U+0307, U+0323, U+0951-0952, U+0964-0965, U+0D00-0D7F, U+1CDA, U+1CF2, U+200C-200D, U+20B9, U+25CC, U+A830-A832;
}

:root {
  /* ---- Brand (exact, from BRAND.md) ------------------------------------- */
  --brand-primary: #4B3EC4;      /* purple: 7.54:1 on white — OK as text, links, primary fills */
  --brand-secondary: #F57E20;    /* orange: 2.66:1 on white — FILLS ONLY (with ink text, 5.93:1) */
  --brand-accent: #FF5722;       /* CTA hover: fills only (with ink text, 4.99:1) */

  /* ---- Purple scale (same hue as --brand-primary) ------------------------ */
  --purple-50:  #F4F4FB;
  --purple-100: #E6E5F6;
  --purple-200: #CCC8EE;
  --purple-300: #A8A1E2;
  --purple-400: #8076D5;
  --purple-500: #4B3EC4;   /* = brand */
  --purple-600: #3F34AA;   /* hover/pressed on primary fills; 9.20:1 white text */
  --purple-700: #352B8E;
  --purple-800: #2B2373;
  --purple-900: #201B57;

  /* ---- Orange scale (same hue as --brand-secondary) ---------------------- */
  --orange-50:  #FEF7F1;
  --orange-100: #FCEBDE;
  --orange-200: #FCD7BB;
  --orange-300: #FABB8A;
  --orange-400: #F79C54;
  --orange-500: #F57E20;   /* = brand */
  --orange-600: #E46A0A;
  --orange-700: #BF5909;   /* 4.52:1 on white — large text only */
  --orange-800: #9A4807;   /* 6.36:1 on white — use for ORANGE TEXT */
  --orange-900: #753605;

  /* ---- Neutrals ----------------------------------------------------------- */
  --ink:        #1F2328;   /* primary text, 15.8:1 */
  --gray-700:   #3D434B;   /* secondary text, 10.0:1 */
  --gray-600:   #5B636E;   /* muted text, 6.08:1 */
  --gray-500:   #6B7280;   /* meta text (time, location), 4.83:1 — smallest allowed for text */
  --gray-400:   #8A929C;   /* placeholders/disabled icons only (3.15:1, not body text) */
  --gray-300:   #D0D5DC;   /* input borders */
  --gray-200:   #E4E7EB;   /* dividers, card borders */
  --gray-100:   #F1F3F5;   /* subtle fills */
  --gray-50:    #F7F7FA;   /* page background */
  --white:      #FFFFFF;

  /* ---- Semantic (all ≥ 5.3:1 on white as text) ------------------------- */
  --success-700: #13795B; --success-50: #E8F5F0;
  --warning-700: #9A5B00; --warning-50: #FFF6E5;
  --error-700:   #C62828; --error-50:   #FDECEC;
  --info-700:    #1565C0; --info-50:    #E9F1FB;

  /* ---- Roles (use these in components) ----------------------------------- */
  --color-bg: var(--gray-50);
  --color-surface: var(--white);
  --color-surface-muted: var(--gray-100);
  --color-text: var(--ink);
  --color-text-secondary: var(--gray-700);
  --color-text-muted: var(--gray-500);
  --color-border: var(--gray-200);
  --color-border-strong: var(--gray-300);
  --color-link: var(--purple-500);
  --color-link-hover: var(--purple-700);
  --color-focus: var(--purple-500);
  --color-price: var(--ink);
  --color-sell: var(--brand-secondary);       /* SELL button fill */
  --color-sell-hover: var(--brand-accent);
  --color-on-sell: var(--ink);                /* text on orange */

  /* ---- Typography --------------------------------------------------------- */
  --font-sans: "Poppins", "Noto Sans Malayalam", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --weight-regular: 400;
  --weight-semibold: 600;
  /* fluid-ish scale: mobile → desktop */
  --text-xs:  0.75rem;   /* 12px — badges, captions */
  --text-sm:  0.875rem;  /* 14px — meta, help text */
  --text-base: 1rem;     /* 16px — body, inputs (≥16px prevents iOS zoom) */
  --text-md:  1.125rem;  /* 18px — card price, lead */
  --text-lg:  1.25rem;   /* 20px — h3 */
  --text-xl:  clamp(1.375rem, 1.2rem + 0.8vw, 1.625rem);  /* h2 */
  --text-2xl: clamp(1.625rem, 1.35rem + 1.3vw, 2.125rem); /* h1 */
  --text-3xl: clamp(1.875rem, 1.4rem + 2.2vw, 2.75rem);   /* hero */
  --leading-tight: 1.25;
  --leading-normal: 1.55;
  --leading-malayalam: 1.75;   /* applied via :lang(ml) — Malayalam needs more line height */

  /* ---- Spacing (4px base) ------------------------------------------------- */
  --space-0: 0;
  --space-1: 0.25rem;  /* 4 */
  --space-2: 0.5rem;   /* 8 */
  --space-3: 0.75rem;  /* 12 */
  --space-4: 1rem;     /* 16 */
  --space-5: 1.25rem;  /* 20 */
  --space-6: 1.5rem;   /* 24 */
  --space-8: 2rem;     /* 32 */
  --space-10: 2.5rem;  /* 40 */
  --space-12: 3rem;    /* 48 */
  --space-16: 4rem;    /* 64 */
  --container-max: 1240px;
  --gutter: clamp(1rem, 0.6rem + 1.6vw, 1.5rem);

  /* ---- Radii -------------------------------------------------------------- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* ---- Shadows (ink-based, subtle) --------------------------------------- */
  --shadow-xs: 0 1px 2px rgba(31, 35, 40, 0.06);
  --shadow-sm: 0 1px 3px rgba(31, 35, 40, 0.08), 0 1px 2px rgba(31, 35, 40, 0.04);
  --shadow-md: 0 4px 12px rgba(31, 35, 40, 0.08), 0 2px 4px rgba(31, 35, 40, 0.04);
  --shadow-lg: 0 12px 32px rgba(31, 35, 40, 0.14), 0 4px 8px rgba(31, 35, 40, 0.06);
  --shadow-focus: 0 0 0 3px rgba(75, 62, 196, 0.35);

  /* ---- Layers ------------------------------------------------------------- */
  --z-base: 0;
  --z-raised: 10;      /* cards on hover, sticky bars inside content */
  --z-header: 100;     /* sticky header */
  --z-bottomnav: 110;  /* mobile bottom nav */
  --z-dropdown: 200;   /* menus, popovers */
  --z-overlay: 300;    /* dialog backdrop */
  --z-modal: 310;      /* dialogs, bottom sheets */
  --z-toast: 400;      /* toasts above everything */
  --z-skiplink: 500;

  /* ---- Layout / safe areas ----------------------------------------------- */
  --header-h: 64px;
  --header-h-mobile: 112px;   /* logo row + search row */
  --bottomnav-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --tap: 44px;                /* minimum touch target */

  /* ---- Motion ------------------------------------------------------------- */
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 320ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Breakpoints (mobile-first, min-width; CSS custom properties can't be used in media queries):
   sm 480px · md 768px · lg 1024px · xl 1280px — see docs/DESIGN.md */

@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur-base: 0ms; --dur-slow: 0ms; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
