/* TCF Express Canada — Design Tokens — "Institutional Editorial"
   Palette: Canadian Blue + Deep Ink + rare Warm Amber + Cream
   Typography: Geist everywhere (display / body / UI / data) — one clean grotesque
   Source of truth: DESIGN.md
*/

:root {
  /* Fonts */
  /* Single clean sans for everything — titles/numbers no longer use a serif. */
  --font-display: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body:    'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Brand */
  --color-ink:            #12243B;  /* deep ink — headings, depth */
  --color-primary:        #1B4F8A;
  --color-primary-hover:  #163F70;
  --color-primary-light:  #2563EB;
  --color-primary-50:     #EFF6FF;
  --color-primary-100:    #DBEAFE;

  /* Accent (amber) — USE RARELY: key CTA, success, progress milestones */
  --color-accent:         #D97706;
  --color-accent-hover:   #B45309;
  --color-accent-light:   #FEF3C7;
  --color-accent-50:      #FFFBEB;

  /* Surfaces */
  --color-bg:             #FDFCF8;
  --color-surface:        #FFFFFF;
  --color-surface-warm:   #FAF8F4;
  --color-muted-bg:       #F1EFE9;

  /* Text */
  --color-text:           #1E293B;
  --color-text-secondary: #475569;
  --color-text-muted:     #94A3B8;

  /* Borders */
  --color-border:         #E7E1D6;
  --color-border-strong:  #CBD5E1;

  /* Feedback */
  --color-success:        #16A34A;
  --color-success-bg:     #F0FDF4;  /* (50) lightest fill */
  --color-success-100:    #DCFCE7;  /* answered/correct fill */
  --color-success-200:    #BBF7D0;  /* success border */
  --color-success-300:    #86EFAC;  /* success border strong */
  --color-success-700:    #166534;  /* success text on light fill */
  --color-error:          #DC2626;
  --color-error-bg:       #FEF2F2;  /* (50) lightest fill */
  --color-error-100:      #FEE2E2;  /* error hover fill */
  --color-error-200:      #FECACA;  /* error border */
  --color-error-700:      #991B1B;  /* error text on light fill */
  --color-warning:        #D97706;
  --color-warning-bg:     #FFFBEB;

  /* Spacing scale (8pt grid) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;
  --sp-24: 96px;

  /* Radius — tightened for institutional precision (see DESIGN.md) */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px 0 rgb(0 0 0 / .06), 0 1px 2px -1px rgb(0 0 0 / .06);
  --shadow-md:  0 4px 12px -2px rgb(0 0 0 / .08), 0 2px 6px -2px rgb(0 0 0 / .06);
  --shadow-lg:  0 10px 30px -4px rgb(0 0 0 / .10), 0 4px 10px -4px rgb(0 0 0 / .06);
  --shadow-warm: 0 8px 24px -4px rgb(27 79 138 / .12);

  /* Transitions */
  --transition-fast:   150ms ease-out;
  --transition-base:   250ms ease-out;
  --transition-slow:   350ms ease-out;

  /* Z-index scale */
  --z-base:    0;
  --z-above:   10;
  --z-nav:     40;
  --z-overlay: 100;
  --z-modal:   200;
  --z-toast:   300;
}

/* ── Base reset & globals ────────────────────────────────────────────── */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  margin: 0;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  font-optical-sizing: auto;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--color-ink);
}

/* Tabular numbers — scores, NCLC, %, timers (see DESIGN.md) */
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* Eyebrow / kicker label */
.eyebrow {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--color-accent-hover);
}

/* ── Utility classes ─────────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--sp-4);
}
@media (min-width: 768px)  { .container { padding-inline: var(--sp-6); } }
@media (min-width: 1200px) { .container { padding-inline: var(--sp-8); } }

/* ── Breakpoints (échelle cible — voir DESIGN.md § Layout) ────────────────
   @media n'accepte pas var() : ces valeurs sont des CONSTANTES documentées.
     sm 560px · md 768px · lg 980px · xl 1200px
   Dette : des seuils dispersés (720/760/820/880/940) traînent dans les
   templates — à réaligner sur cette échelle lors d'un passage dédié. */

/* Grilles réutilisables — tout composite grille réutilisé ≥ 2× migre ici. */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-4);
}
.grid-split {                 /* hero éditorial asymétrique */
  display: grid;
  grid-template-columns: 1fr; /* mobile : empilé */
  gap: var(--sp-12);
  align-items: center;
}
@media (min-width: 980px) {   /* lg */
  .grid-split { grid-template-columns: 1.05fr .95fr; gap: var(--sp-16); }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-family: 'Geist', sans-serif;
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast),
              box-shadow var(--transition-fast), opacity var(--transition-fast);
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 3px solid var(--color-primary-light);
  outline-offset: 3px;
}
.btn:active { transform: scale(.98); }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 8px -2px rgb(27 79 138 / .30);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 4px 16px -4px rgb(27 79 138 / .40);
}

.btn-accent {
  background: var(--color-accent);
  color: #fff;
  box-shadow: 0 2px 8px -2px rgb(217 119 6 / .35);
}
.btn-accent:hover {
  background: var(--color-accent-hover);
  box-shadow: 0 4px 16px -4px rgb(217 119 6 / .45);
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-border);
}
.btn-ghost:hover {
  background: var(--color-primary-50);
  border-color: var(--color-primary-light);
}

.btn-google {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}
.btn-google:hover {
  background: var(--color-muted-bg);
  box-shadow: var(--shadow-md);
}

.btn-lg {
  padding: .9375rem 2rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}
.btn-sm {
  padding: .5rem 1rem;
  font-size: .875rem;
}

/* Loading state */
.btn[data-loading="true"] {
  opacity: .7;
  pointer-events: none;
}

/* Input base */
.input {
  width: 100%;
  padding: .75rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: 'Geist', sans-serif;
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input:focus {
  outline: none;
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px rgb(37 99 235 / .12);
}
.input::placeholder { color: var(--color-text-muted); }
.input.error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgb(220 38 38 / .10);
}

.label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: var(--sp-2);
}

.field-error {
  font-size: .8125rem;
  color: var(--color-error);
  margin-top: var(--sp-1);
}

/* Card */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-warm {
  background: var(--color-surface-warm);
  border-color: var(--color-border);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: .25rem .75rem;
  border-radius: var(--radius-full);
  font-size: .8125rem;
  font-weight: 500;
}
.badge-blue  { background: var(--color-primary-50);  color: var(--color-primary); }
.badge-amber { background: var(--color-accent-50);   color: var(--color-accent-hover); }
.badge-green { background: var(--color-success-bg);  color: var(--color-success); }

/* Section padding */
.section { padding-block: var(--sp-20); }
@media (max-width: 768px) { .section { padding-block: var(--sp-12); } }

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  color: var(--color-text-muted);
  font-size: .875rem;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--color-muted-bg) 25%, #ece9e1 50%, var(--color-muted-bg) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-wave {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

/* Focus ring utility */
.focus-ring:focus-visible {
  outline: 3px solid var(--color-primary-light);
  outline-offset: 2px;
}

/* Scroll reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .5s ease-out, transform .5s ease-out;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
