/**
 * HORLOGIS — Design System Tokens
 * Phase PREMIUM HARDENING
 * "L'atelier numérique de la supply chain horlogère suisse"
 */

:root {
  /* ── Couleurs fondamentales ── */
  --h-night:     #07111f;    /* Fond profond */
  --h-navy:      #10243d;    /* Navy principal */
  --h-navy-mid:  #1a3050;    /* Navy intermédiaire */
  --h-navy-light:#243a5e;    /* Navy clair */

  /* Or — discret, jamais criard */
  --h-gold:      #c9a84c;
  --h-gold-soft: #e4d39a;
  --h-gold-dim:  rgba(201,168,76,0.35);
  --h-gold-bg:   rgba(201,168,76,0.06);

  /* Neutres */
  --h-steel:     #9aa4b2;    /* Acier — texte secondaire */
  --h-cream:     #f5f0e6;    /* Ivoire — texte principal */
  --h-muted:     rgba(245,240,230,0.38);

  /* Sémantiques */
  --h-success:   #4caf87;
  --h-success-bg:rgba(76,175,135,0.08);
  --h-danger:    #d96b6b;
  --h-danger-bg: rgba(217,107,107,0.08);
  --h-warning:   #c9a84c;

  /* Bordures */
  --h-border:    rgba(255,255,255,0.07);
  --h-border-md: rgba(255,255,255,0.11);
  --h-border-gold: rgba(201,168,76,0.25);

  /* ── Typographie ── */
  --h-font-serif: 'Cormorant Garamond', Georgia, serif;
  --h-font-mono:  'Rajdhani', 'DIN Condensed', sans-serif;   /* Labels, KPIs */
  --h-font-body:  'Raleway', system-ui, sans-serif;

  /* Tailles */
  --h-text-xs:   10px;
  --h-text-sm:   12px;
  --h-text-base: 14px;
  --h-text-lg:   16px;
  --h-text-xl:   20px;
  --h-text-2xl:  26px;
  --h-text-3xl:  34px;

  /* ── Espacement ── */
  --h-space-1:  4px;
  --h-space-2:  8px;
  --h-space-3:  12px;
  --h-space-4:  16px;
  --h-space-5:  20px;
  --h-space-6:  24px;
  --h-space-8:  32px;
  --h-space-10: 40px;

  /* ── Rayons ── */
  --h-radius-sm:  4px;
  --h-radius-md:  8px;
  --h-radius-lg:  12px;
  --h-radius-xl:  20px;
  --h-radius-full:999px;

  /* ── Ombres ── */
  --h-shadow-sm:   0 2px 8px rgba(0,0,0,0.25);
  --h-shadow-md:   0 8px 24px rgba(0,0,0,0.32);
  --h-shadow-lg:   0 18px 48px rgba(0,0,0,0.40);
  --h-shadow-card: 0 4px 20px rgba(0,0,0,0.22);

  /* ── Transitions ── */
  --h-transition:     all 0.18s ease;
  --h-transition-md:  all 0.28s cubic-bezier(0.4,0,0.2,1);
  --h-transition-slow:all 0.42s cubic-bezier(0.4,0,0.2,1);

  /* ── Accessibilité ── */
  --h-focus-ring: 0 0 0 2px rgba(201,168,76,0.5);
}

/* ─── RESET FOCUS ACCESSIBLE ─── */
*:focus-visible {
  outline: none;
  box-shadow: var(--h-focus-ring) !important;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--h-gold-dim);
  outline-offset: 2px;
}

/* ─── SKIP NAVIGATION (accessibilité clavier) ─── */
.h-skip-nav {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--h-gold);
  color: var(--h-navy);
  padding: 8px 16px;
  font-family: var(--h-font-mono);
  font-size: var(--h-text-sm);
  font-weight: 700;
  letter-spacing: 1px;
  text-decoration: none;
  z-index: 99999;
  transition: top 0.2s;
}
.h-skip-nav:focus { top: 0; }

/* ─── BUTTONS ─── */
.h-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--h-space-2);
  padding: var(--h-space-2) var(--h-space-5);
  font-family: var(--h-font-mono);
  font-size: var(--h-text-xs);
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border-radius: var(--h-radius-sm);
  cursor: pointer;
  transition: var(--h-transition);
  border: 1px solid transparent;
  white-space: nowrap;
}
.h-btn:active { transform: scale(0.97); }
.h-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Primary — or */
.h-btn-primary {
  background: linear-gradient(135deg, rgba(201,168,76,0.18), rgba(201,168,76,0.08));
  border-color: var(--h-gold-dim);
  color: var(--h-gold);
}
.h-btn-primary:hover {
  background: linear-gradient(135deg, rgba(201,168,76,0.28), rgba(201,168,76,0.14));
  border-color: var(--h-gold);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(201,168,76,0.15);
}

/* Ghost */
.h-btn-ghost {
  background: transparent;
  border-color: var(--h-border-md);
  color: var(--h-steel);
}
.h-btn-ghost:hover {
  border-color: var(--h-border-gold);
  color: var(--h-cream);
}

/* Danger */
.h-btn-danger {
  background: var(--h-danger-bg);
  border-color: rgba(217,107,107,0.3);
  color: var(--h-danger);
}

/* ─── CARDS ─── */
.h-card {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--h-border);
  border-radius: var(--h-radius-md);
  padding: var(--h-space-4);
  transition: var(--h-transition);
}
.h-card-hover:hover {
  border-color: var(--h-border-gold);
  background: var(--h-gold-bg);
  transform: translateY(-1px);
  box-shadow: var(--h-shadow-card);
}
.h-card-active {
  border-color: var(--h-gold-dim);
  background: var(--h-gold-bg);
}

/* ─── BADGES ─── */
.h-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--h-space-1);
  padding: 3px 10px;
  font-family: var(--h-font-mono);
  font-size: var(--h-text-xs);
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  border-radius: var(--h-radius-sm);
  border: 1px solid;
}
.h-badge-gold    { color: var(--h-gold);    background: var(--h-gold-bg);    border-color: var(--h-gold-dim); }
.h-badge-success { color: var(--h-success); background: var(--h-success-bg); border-color: rgba(76,175,135,0.25); }
.h-badge-danger  { color: var(--h-danger);  background: var(--h-danger-bg);  border-color: rgba(217,107,107,0.25); }
.h-badge-muted   { color: var(--h-steel);   background: rgba(255,255,255,0.03); border-color: var(--h-border); }

/* ─── KPIs ─── */
.h-kpi {
  padding: var(--h-space-4);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--h-border);
  border-radius: var(--h-radius-md);
  text-align: center;
}
.h-kpi-value {
  font-family: var(--h-font-mono);
  font-size: var(--h-text-3xl);
  font-weight: 700;
  color: var(--h-gold);
  line-height: 1;
}
.h-kpi-label {
  font-family: var(--h-font-mono);
  font-size: var(--h-text-xs);
  color: var(--h-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-top: var(--h-space-1);
}

/* ─── SECTION HEADER ─── */
.h-section-header {
  display: flex;
  align-items: center;
  gap: var(--h-space-2);
  margin-bottom: var(--h-space-3);
}
.h-section-bar {
  width: 3px;
  height: 16px;
  background: var(--h-gold);
  border-radius: 2px;
  flex-shrink: 0;
}
.h-section-bar-green { background: var(--h-success); }
.h-section-title {
  font-family: var(--h-font-mono);
  font-size: var(--h-text-xs);
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--h-muted);
}
.h-section-title-gold { color: var(--h-gold); }

/* ─── EMPTY STATES ─── */
.h-empty {
  text-align: center;
  padding: var(--h-space-8) var(--h-space-5);
  color: var(--h-muted);
}
.h-empty-icon {
  font-size: 28px;
  opacity: 0.6;
  margin-bottom: var(--h-space-3);
}
.h-empty-title {
  font-family: var(--h-font-serif);
  font-size: var(--h-text-lg);
  color: var(--h-cream);
  margin-bottom: var(--h-space-2);
  font-weight: 300;
}
.h-empty-sub {
  font-size: var(--h-text-sm);
  color: var(--h-steel);
  line-height: 1.6;
  margin-bottom: var(--h-space-4);
}

/* ─── DIVIDER ─── */
.h-divider {
  border: none;
  border-top: 1px solid var(--h-border);
  margin: var(--h-space-4) 0;
}
.h-divider-gold { border-top-color: var(--h-gold-dim); }

/* ─── TIMELINE ─── */
.h-timeline {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding: var(--h-space-2) 0;
  scrollbar-width: thin;
  scrollbar-color: var(--h-border) transparent;
}
.h-timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
  position: relative;
}
.h-timeline-connector {
  position: absolute;
  top: 12px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--h-border);
}
.h-timeline-connector.done { background: var(--h-gold-dim); }
.h-timeline-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--h-border);
  background: rgba(255,255,255,0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  position: relative;
  z-index: 1;
  margin-bottom: var(--h-space-1);
  transition: var(--h-transition);
}
.h-timeline-dot.done    { border-color: var(--h-gold-dim); background: rgba(201,168,76,0.1); }
.h-timeline-dot.active  { border-color: var(--h-gold); background: var(--h-gold); }
.h-timeline-dot.active span { color: var(--h-navy); }
.h-timeline-label {
  font-family: var(--h-font-mono);
  font-size: 9px;
  color: var(--h-muted);
  text-align: center;
  line-height: 1.2;
  max-width: 55px;
  letter-spacing: 0.3px;
}
.h-timeline-label.active { color: var(--h-cream); }
.h-timeline-label.done   { color: rgba(201,168,76,0.6); }

/* ─── MODAL OVERLAY ─── */
.h-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7,17,31,0.85);
  backdrop-filter: blur(6px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: h-modal-bg-in 0.2s ease;
}
@keyframes h-modal-bg-in { from { opacity:0; } to { opacity:1; } }
.h-modal {
  background: var(--h-navy-mid);
  border: 1px solid var(--h-border-md);
  border-radius: var(--h-radius-lg);
  padding: var(--h-space-8);
  max-width: 480px;
  width: 90%;
  box-shadow: var(--h-shadow-lg);
  animation: h-modal-in 0.25s cubic-bezier(0.34,1.1,0.64,1);
}
@keyframes h-modal-in { from { opacity:0; transform:scale(0.95); } to { opacity:1; transform:scale(1); } }
.h-modal-title {
  font-family: var(--h-font-serif);
  font-size: var(--h-text-2xl);
  font-weight: 300;
  color: var(--h-cream);
  margin-bottom: var(--h-space-1);
}
.h-modal-subtitle {
  font-size: var(--h-text-sm);
  color: var(--h-steel);
  margin-bottom: var(--h-space-6);
}

/* ─── FORMS ─── */
.h-input {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--h-border-md);
  border-radius: var(--h-radius-sm);
  padding: 10px 14px;
  color: var(--h-cream);
  font-family: var(--h-font-body);
  font-size: var(--h-text-base);
  transition: var(--h-transition);
  box-sizing: border-box;
}
.h-input:focus {
  border-color: var(--h-gold-dim);
  box-shadow: var(--h-focus-ring);
  outline: none;
  background: rgba(255,255,255,0.05);
}
.h-input::placeholder { color: var(--h-muted); }
.h-label {
  display: block;
  font-family: var(--h-font-mono);
  font-size: var(--h-text-xs);
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--h-steel);
  margin-bottom: var(--h-space-2);
}

/* ─── DEMO BANNER ─── */
.h-demo-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99998;
  background: linear-gradient(90deg, rgba(201,168,76,0.15), rgba(201,168,76,0.08));
  border-bottom: 1px solid var(--h-gold-dim);
  padding: 6px var(--h-space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--h-font-mono);
  font-size: var(--h-text-xs);
  letter-spacing: 1.5px;
  color: var(--h-gold);
}
.h-demo-banner-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--h-gold);
  animation: h-pulse 2s ease-in-out infinite;
  margin-right: var(--h-space-2);
}
@keyframes h-pulse {
  0%, 100% { opacity:1; }
  50%       { opacity:0.3; }
}

/* ─── UTILITAIRES ─── */
.h-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}
.h-flex-center { display:flex; align-items:center; justify-content:center; }
.h-flex-between { display:flex; align-items:center; justify-content:space-between; }
.h-grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:var(--h-space-3); }
.h-grid-3 { display:grid; grid-template-columns:repeat(3,1fr); gap:var(--h-space-3); }

/* ─── ACCESSIBILITÉ ARIA VISIBLE ─── */
[aria-disabled="true"] { opacity:0.4; cursor:not-allowed; pointer-events:none; }
[aria-busy="true"] { opacity:0.7; }
[aria-invalid="true"] input,
input[aria-invalid="true"] {
  border-color: var(--h-danger) !important;
}
