/*
 * Design tokens da Avotech Automação
 *
 * Três camadas, cada uma consumindo só a anterior:
 *   1. Primitivos   valores brutos (paleta, escalas). Não use direto nos componentes.
 *   2. Semânticos   intenção de uso (fundo, texto, ação). Trocam por tema (.theme-inverse).
 *   3. Componentes  decisões de componentes (botão, campo, card), apontando para semânticos.
 *
 * styles.css só referencia tokens semânticos e de componente.
 * Contrastes (WCAG): texto muted 5.5:1 sobre --steel-50; faint 4.6:1 sobre --steel-100; branco sobre --green-600 5.0:1;
 * branco sobre --blue-700 11.6:1; --blue-500 sobre branco 6.2:1; muted invertido 7.0:1 sobre --blue-950.
 */

/* 1. PRIMITIVOS ---------------------------------------------------------- */
:root {
  /* Steel: neutro levemente azulado, base de toda a interface */
  --steel-0: #ffffff;
  --steel-50: #f6f7f9;
  --steel-100: #edf0f3;
  --steel-200: #e2e6eb;
  --steel-300: #cbd2da;
  --steel-400: #9aa5b4;
  --steel-500: #737e8f;
  --steel-550: #636d80;
  --steel-600: #5b6576;
  --steel-700: #3a4352;
  --steel-800: #1f2735;
  --steel-900: #111a2b;
  --steel-950: #0b1220;
  --steel-1000: #070c16;

  /* Azul Avotech: --blue-700 é o azul do logotipo; o cinza do logo é --brand-gray */
  --blue-50: #eef4fa;
  --blue-100: #dbe7f4;
  --blue-200: #b6cde7;
  --blue-300: #84aad3;
  --blue-400: #4f82bc;
  --blue-500: #2563a6;
  --blue-600: #164c88;
  --blue-700: #0e3a65;
  --blue-800: #0b2e51;
  --blue-900: #0a2440;
  --blue-950: #061a2f;
  --blue-1000: #04111f;
  --brand-gray: #717579;

  /* Verde: WhatsApp e confirmações */
  --green-50: #eaf7ef;
  --green-600: #15803d;
  --green-700: #116b33;
  --green-800: #0f5a2c;

  /* Vermelho: erros */
  --red-50: #fdf0ef;
  --red-600: #b42318;

  /* Tipografia */
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --weight-light: 300;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Escala de tipo fluida: celular (375px) → desktop (1280px).
     Razão ~1.2 no celular e ~1.25 no desktop; títulos contidos, texto confortável. */
  --size-xs: 0.8125rem;                                     /* 13 */
  --size-sm: 0.9375rem;                                     /* 15 */
  --size-md: 1.0625rem;                                     /* 17 */
  --size-lg: clamp(1.125rem, 1.08rem + 0.2vw, 1.1875rem);   /* 18 → 19 */
  --size-xl: clamp(1.1875rem, 1.12rem + 0.3vw, 1.3125rem);  /* 19 → 21 */
  --size-2xl: clamp(1.375rem, 1.24rem + 0.6vw, 1.625rem);   /* 22 → 26 */
  --size-3xl: clamp(1.625rem, 1.38rem + 1.05vw, 2.125rem);  /* 26 → 34 */
  --size-4xl: clamp(1.875rem, 1.5rem + 1.6vw, 2.625rem);    /* 30 → 42 */
  --size-display: clamp(2.375rem, 1.72rem + 2.8vw, 3.875rem); /* 38 → 62 */

  --leading-display: 1.04;
  --leading-heading: 1.12;
  --leading-snug: 1.3;
  --leading-body: 1.65;
  --tracking-display: -0.04em;
  --tracking-heading: -0.03em;
  --tracking-snug: -0.015em;
  --measure: 62ch;
  --tracking-mono: 0.02em;

  /* Espaçamento: base 4px */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 1.75rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-14: 3.5rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Ritmo vertical fluido: seções respiram mais que blocos, blocos mais que elementos */
  --space-section: clamp(6rem, 10.5vw, 9.5rem);       /* 96 → 152 */
  --space-section-head: clamp(3rem, 5vw, 4.5rem);     /* 48 → 72 */
  --space-block: clamp(4rem, 7.5vw, 6.5rem);          /* 64 → 104 */
  --space-columns: clamp(3rem, 7vw, 6.5rem);

  /* Raios */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 18px;
  --radius-full: 999px;

  /* Sombras: tingidas de steel, nunca preto puro */
  --shadow-xs: 0 1px 2px rgb(11 18 32 / 0.05);
  --shadow-sm: 0 1px 2px rgb(11 18 32 / 0.05), 0 2px 6px -2px rgb(11 18 32 / 0.08);
  --shadow-md: 0 12px 32px -12px rgb(11 18 32 / 0.25);
  --shadow-lg: 0 32px 64px -24px rgb(11 18 32 / 0.45);

  /* Movimento (princípios de Emil Kowalski): ease-out forte para entrar/sair,
     ease-in-out para mover na tela, ease simples para cor/hover. UI abaixo de 300ms. */
  --duration-press: 160ms;
  --duration-fast: 150ms;
  --duration-base: 220ms;
  --duration-slow: 420ms;
  --duration-entrance: 700ms;   /* só na entrada do hero, uma vez por visita */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  /* Camadas */
  --z-header: 50;
  --z-float: 60;
  --z-skip: 100;

  /* Layout */
  --container-max: 1200px;
  --gutter: clamp(20px, 5vw, 48px);
  --header-h: 72px;
  --tap-min: 44px;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-press: 0ms;
    --duration-base: 0ms;
    --duration-slow: 0ms;
  }
}

/* 2. SEMÂNTICOS ---------------------------------------------------------- */
:root,
.theme-light {
  --color-bg: var(--steel-0);
  --color-bg-subtle: var(--steel-50);
  --color-bg-muted: var(--steel-100);
  --color-surface: var(--steel-0);
  --color-text-strong: var(--steel-950);
  --color-text: var(--steel-700);
  --color-text-muted: var(--steel-600);
  --color-text-faint: var(--steel-550);
  --color-border: var(--steel-200);
  --color-border-strong: var(--steel-300);

  --color-brand: var(--blue-700);
  --color-accent: var(--blue-500);
  --color-accent-strong: var(--blue-500);
  --color-action-primary: var(--blue-700);
  --color-action-primary-hover: var(--blue-600);
  --color-on-action-primary: var(--steel-0);
  --color-action-secondary: var(--steel-950);
  --color-action-secondary-hover: var(--steel-800);
  --color-on-action-secondary: var(--steel-0);
  --color-action-whatsapp: var(--green-600);
  --color-action-whatsapp-hover: var(--green-700);
  --color-on-action-whatsapp: var(--steel-0);

  --color-focus-ring: var(--blue-500);
  --color-danger: var(--red-600);
  --color-danger-bg: var(--red-50);
  --color-success: var(--green-800);
  --color-success-bg: var(--green-50);

  --color-overlay: var(--blue-950);
}

/* Seções escuras: os mesmos nomes, valores invertidos */
.theme-inverse {
  --color-bg: var(--blue-950);
  --color-bg-deep: var(--blue-1000);
  --color-bg-subtle: var(--blue-900);
  --color-bg-muted: var(--blue-800);
  --color-surface: var(--blue-900);
  --color-text-strong: var(--steel-0);
  --color-text: var(--steel-300);
  --color-text-muted: var(--steel-400);
  --color-text-faint: var(--steel-500);
  --color-border: color-mix(in oklab, var(--steel-0) 10%, transparent);
  --color-border-strong: color-mix(in oklab, var(--steel-0) 22%, transparent);
  --color-accent: var(--blue-300);
  --color-accent-strong: var(--blue-300);
  --color-focus-ring: var(--blue-300);
  --color-action-primary: var(--steel-0);
  --color-action-primary-hover: var(--blue-100);
  --color-on-action-primary: var(--blue-700);

  --color-action-secondary: var(--steel-0);
  --color-action-secondary-hover: var(--steel-100);
  --color-on-action-secondary: var(--steel-950);
}

/* 3. COMPONENTES --------------------------------------------------------- */
:root {
  --btn-height: 46px;
  --btn-height-lg: 54px;
  --btn-padding-x: 1.25rem;
  --btn-padding-x-lg: 1.6rem;
  --btn-radius: var(--radius-md);
  --btn-weight: var(--weight-semibold);

  --field-height: 48px;
  --field-radius: var(--radius-md);
  --field-bg: var(--color-bg-subtle);
  --field-border: var(--color-border);
  --field-border-focus: var(--color-text-strong);
  --field-border-invalid: var(--color-danger);

  --card-radius: var(--radius-lg);
  --card-padding: clamp(var(--space-6), 2.5vw, var(--space-8));
  --media-radius: var(--radius-lg);
  --panel-radius: var(--radius-xl);
  --panel-padding: clamp(var(--space-7), 4.5vw, var(--space-14));

  --link-underline: var(--color-accent);
  --link-underline-thickness: 2px;
}
