/* ============================================================
   CTS Catálogo — Design tokens
   Fonte única para cores, espaçamentos, tipografia, sombras,
   motion e camadas (z-index). Carregado primeiro.

   Fontes da marca (DM Sans + Univers Next Pro) declaradas via
   @font-face em base.css. Inter mantido como fallback web.
   ============================================================ */

:root {
  /* Brand */
  --color-brand-50: #fff7f1;
  --color-brand-100: #ffe7d7;
  --color-brand-200: #FFCBB1;
  --color-brand-400: #FE9A6F;
  --color-brand-500: #fd6919;
  --color-brand-500-highlight: #fd7f32; /* topo de gradiente brand */
  --color-brand-600: #d65208;
  --color-brand-700: #f05c0f;           /* base de gradiente brand (hover) */

  /* Neutrals (warm) */
  --color-neutral-0: #ffffff;
  --color-neutral-50: #faf8f5;
  --color-neutral-100: #f4f1ec;
  --color-neutral-200: #e8e0d7;
  --color-neutral-300: #d5c8bc;
  --color-neutral-600: #65564B;
  --color-neutral-700: #433831;
  --color-neutral-900: #1f1814;

  /* Semantic */
  --color-success-600: #168A4B;
  --color-success-50: #E9F8EF;
  --color-danger-600: #C62828;
  --color-danger-100: #ffcdd2;
  --color-danger-50: #FDECEC;
  --color-warning-700: #B54708;
  --color-warning-50: #FFF4E5;
  --color-info-600: #1D4ED8;
  --color-info-50: #EAF2FF;

  /* Typography */
  --font-ui: 'DM Sans', 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-display: 'Univers Next Pro', 'DM Sans', 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;

  /* Primary action color — referência única para todos os elementos interativos */
  --color-primary: var(--color-brand-500);
  --color-primary-dark: var(--color-brand-600);
  --color-primary-light: var(--color-brand-400);
  --color-primary-subtle: var(--color-brand-50);
  --focus-ring-color: rgba(253, 105, 25, 0.22);
  --focus-ring: 0 0 0 3px var(--focus-ring-color);

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;

  --lh-tight: 1.25;
  --lh-snug: 1.4;
  --lh-base: 1.6;
  --lh-copy-sm: 1.58;
  --lh-copy-md: 1.68;

  /* Letter-spacing (optical refinement) */
  --letter-tight: -0.02em;
  --letter-display: -0.01em;
  --letter-label: 0.06em;
  --letter-caps: 0.12em;

  --fw-300: 300;
  --fw-400: 400;
  --fw-500: 500;
  --fw-600: 600;
  --fw-700: 700;

  /* Surfaces */
  --surface-body: linear-gradient(180deg, #faf8f5 0%, #f3efe9 100%);
  --surface-1: #ffffff;
  --surface-2: #fbfaf8;
  --surface-3: #f2ede6;

  /* Text */
  --text-primary: #4a3f38;
  --text-secondary: #6b5e54;
  --text-muted: #7e7069;
  --text-light: #9a8d84;
  --text-accent: var(--color-brand-600);

  /* Borders */
  --border-strong: rgba(67, 56, 49, 0.14);
  --border-subtle: rgba(67, 56, 49, 0.08);
  --border-accent: rgba(253, 105, 25, 0.24);

  /* Radius — escala base */
  --radius-xs: 10px;
  --radius-sm: 14px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 30px;
  --radius-full: 9999px;

  /* Radius — semânticos (usar estes em componentes) */
  --radius-control: 12px;     /* inputs, selects, botões */
  --radius-card: 18px;        /* cards de produto, máquina, painéis */
  --radius-modal: 24px;       /* modais e drawers */
  --radius-pill: 9999px;      /* tags, badges, status pills */

  /* Shadows — escala base */
  --shadow-1: 0 2px 10px rgba(31, 24, 20, 0.05);
  --shadow-2: 0 12px 30px rgba(31, 24, 20, 0.07);
  --shadow-3: 0 20px 48px rgba(31, 24, 20, 0.10);
  --shadow-hover: 0 20px 25px -5px rgba(31, 24, 20, 0.10), 0 8px 10px -6px rgba(31, 24, 20, 0.04);
  --shadow-surface: 0 6px 20px rgba(31, 24, 20, 0.05);
  --shadow-elevated: 0 28px 60px rgba(31, 24, 20, 0.12);
  --shadow-modal: 0 32px 90px rgba(31, 24, 20, 0.18);

  /* Shadows — semânticos canônicos para cards (usar estes) */
  --shadow-card: 0 12px 26px -20px rgba(31, 24, 20, 0.24), 0 4px 12px -10px rgba(31, 24, 20, 0.10);
  --shadow-card-hover: 0 22px 38px -24px rgba(31, 24, 20, 0.28), 0 10px 22px -20px rgba(31, 24, 20, 0.16);
  --shadow-card-active: 0 12px 22px -20px rgba(31, 24, 20, 0.22), 0 4px 10px -10px rgba(31, 24, 20, 0.10);

  /* Rings — anéis de foco e destaque brand */
  --ring-brand: 0 0 0 1px rgba(253, 105, 25, 0.16);
  --ring-brand-strong: 0 0 0 3px rgba(253, 105, 25, 0.22);

  /* Motion (microinteractions) */
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-emphasized: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --dur-1: 120ms;
  --dur-2: 180ms;
  --dur-3: 260ms;
  --dur-4: 320ms;
  --transition-fast: var(--dur-1) var(--ease-standard);
  --transition-normal: var(--dur-2) var(--ease-standard);
  --transition-slow: var(--dur-3) var(--ease-emphasized);
  --transition-bounce: var(--dur-2) var(--ease-bounce);

  /* Microinteraction scale/feedback */
  --scale-press: 0.97;
  --scale-hover: 1.02;
  --lift-hover: -4px;
  --lift-active: -2px;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --mobile-gutter: clamp(0.9rem, 4vw, 1.15rem);
  --touch-target-min: 44px;

  /* Layout */
  --content-max: 1440px;

  /* ============================================================
     Z-index scale — hierarquia documentada das camadas.
     Ordem (baixo → alto):
       base       0    fluxo normal
       elevated  10    sticky tabs admin, modal nav arrows
       floating 900    fab buttons (back-to-top, whatsapp)
       sidebar 1000    sidebar do catálogo
       overlay 1050    sidebar-overlay (escurecimento)
       modal   1100    admin modal (peça/máquina/taxonomia)
       modal-premium 1200  catalog product modal
       loading 9000    loading-overlay
       toast  11000    notificações
       menu-toggle 11001  botão flutuante de menu mobile
     ============================================================ */
  --z-base: 0;
  --z-elevated: 10;
  --z-floating: 900;
  --z-sidebar: 1000;
  --z-overlay: 1050;
  --z-modal: 1100;
  --z-modal-premium: 1200;
  --z-loading: 9000;
  --z-toast: 11000;
  --z-menu-toggle: 11001;

  /* Back-compat aliases */
  --brand-orange: var(--color-brand-500);
  --brand-orange-light: var(--color-brand-400);
  --brand-orange-dark: var(--color-brand-600);

  --off-white: var(--color-neutral-100);
  --warm-neutral: var(--color-neutral-300);
  --warm-neutral-light: var(--color-neutral-200);

  --accent-color: #8C7D72;
  --accent-muted: #B0A49B;
  --accent-strip: var(--color-neutral-100);

  --background-body: var(--surface-body);
  --surface-white: var(--surface-1);
  --surface-sidebar: var(--surface-1);
  --surface-hover: var(--surface-3);
  --surface-card: var(--surface-1);

  --border-color: var(--border-strong);

  --shadow-sm: var(--shadow-1);
  --shadow-md: var(--shadow-2);
  --shadow-lg: var(--shadow-3);

  /* Text overlay (contrast for text on images) */
  --overlay-gradient: linear-gradient(to top, rgb(28 20 16 / 0.72) 0%, rgb(28 20 16 / 0.40) 45%, rgb(28 20 16 / 0.15) 75%, transparent 100%);
  --overlay-gradient-hover: linear-gradient(to top, rgb(28 20 16 / 0.85) 0%, rgb(28 20 16 / 0.50) 50%, rgb(28 20 16 / 0.20) 75%, transparent 100%);
  --text-shadow-overlay: 0 1px 3px rgb(28 20 16 / 0.50), 0 2px 6px rgb(28 20 16 / 0.35);
  --text-shadow-overlay-strong: 0 2px 4px rgb(28 20 16 / 0.60), 0 4px 8px rgb(28 20 16 / 0.40);
  --text-overlay-color: #ffffff;

  /* Admin tokens */
  --admin-primary: var(--color-brand-500);
  --admin-primary-dark: var(--color-brand-600);
  --admin-bg: #f7f4ef;
  --admin-surface: #ffffff;
  --admin-surface-2: #fbfaf8;
  --admin-border: rgba(67, 56, 49, 0.12);
  --admin-text: var(--text-primary);
  --admin-text-muted: var(--text-muted);
  --admin-error: var(--color-danger-600);
  --admin-success: var(--color-success-600);
  --admin-accent-text: var(--text-accent);
  --admin-form-gap: 1.1rem;
}
