/* ============================================================
   style.css — Variables CSS, reset, base
   cordiAlban Design System v2.1
   Supporte : data-theme="dark"|"light" + prefers-color-scheme
   ============================================================ */

/* ─────────────────────────────────────────────
   THÈME SOMBRE (défaut)
   ───────────────────────────────────────────── */
:root,
[data-theme="dark"] {
  /* Fonds */
  --bg: #0C0B09;
  --bg-rgb: 12, 11, 9;
  --bg2: #131210;
  --bg3: #1A1814;
  --bg4: #211F1B;

  /* Textes */
  --text: #E8E2D8;
  --text2: #9B9484;
  --text3: #6B6459;

  /* Or (accent principal) */
  --gold: #C8A46E;
  --gold2: #E4C07A;
  --gold3: #8B7345;

  /* Vert Pace */
  --pace: #2D8B46;
  --pace2: #38A856;
  --pace3: #1E6B33;

  /* Grades Info-Score */
  --sa: #2D8B46;
  --sb: #6BAD4B;
  --sc: #D4A017;
  --sd: #D4652A;
  --se: #C42B2B;
  --sn: #6B6459;

  /* Rayons */
  --r: 12px;
  --r2: 8px;

  /* Polices */
  --f1: 'Newsreader', Georgia, serif;
  --f2: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --f3: 'JetBrains Mono', 'Fira Code', monospace;

  /* Largeurs */
  --max-w: 1200px;
  --max-t: 680px;

  /* Transition de thème */
  --tt: 0.3s ease;
}

/* ─────────────────────────────────────────────
   THÈME CLAIR (via attribut data-theme)
   ───────────────────────────────────────────── */
[data-theme="light"] {
  --bg: #F5F0E8;
  --bg-rgb: 245, 240, 232;
  --bg2: #EDE8DE;
  --bg3: #E5DFD3;
  --bg4: #DDD7CA;

  --text: #1A1714;
  --text2: #5A4E42;
  --text3: #8A7D70;

  --gold: #9A6E30;
  --gold2: #B07F3A;
  --gold3: #7A5520;

  --pace: #2D8B46;
  --pace2: #1E6B33;
  --pace3: #38A856;
}

/* Préférence OS clair — appliquée si data-theme absent */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #F5F0E8;
    --bg-rgb: 245, 240, 232;
    --bg2: #EDE8DE;
    --bg3: #E5DFD3;
    --bg4: #DDD7CA;
    --text: #1A1714;
    --text2: #5A4E42;
    --text3: #8A7D70;
    --gold: #9A6E30;
    --gold2: #B07F3A;
    --gold3: #7A5520;
    --pace2: #1E6B33;
    --pace3: #38A856;
  }
}

/* ─────────────────────────────────────────────
   RESET
   ───────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

ul, ol { list-style: none; }

img, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
}

/* ─────────────────────────────────────────────
   BASE CORPS
   ───────────────────────────────────────────── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--f2);
  font-size: clamp(1rem, 1vw + 0.75rem, 1.125rem);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--tt), color var(--tt);
}

/* Grain de fond subtil */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ─────────────────────────────────────────────
   TYPOGRAPHIE DE BASE
   ───────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--f1);
  line-height: 1.18;
  color: var(--text);
}

h1 {
  font-size: clamp(1.8rem, 4vw, 3.5rem);
  font-weight: 300;
  margin-bottom: 1.1rem;
}

h1 em {
  font-style: italic;
  color: var(--gold);
}

h2 {
  font-size: clamp(1.4rem, 3vw, 2.25rem);
  font-weight: 400;
  margin-bottom: 1.2rem;
}

h2 em {
  font-style: italic;
  color: var(--gold);
}

h3 {
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-family: var(--f2);
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 0.5rem;
}

p {
  color: var(--text2);
  max-width: var(--max-t);
  margin-bottom: 0.8rem;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover { color: var(--gold2); }

/* ─────────────────────────────────────────────
   SKIP-TO-CONTENT (accessibilité)
   ───────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.75rem 1.5rem;
  background: var(--gold);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 0 0 var(--r2) var(--r2);
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
  color: var(--bg);
  outline: 2px solid var(--bg);
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────
   FOCUS VISIBLE
   ───────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────
   SÉLECTION
   ───────────────────────────────────────────── */
::selection {
  background: rgba(200, 164, 110, 0.3);
  color: var(--text);
}

[data-theme="light"] ::selection {
  background: rgba(154, 110, 48, 0.25);
}

/* ─────────────────────────────────────────────
   NAV-CONTROLS — toggle thème + hamburger alignés (SPÉC-12)
   ───────────────────────────────────────────── */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.nav-controls .theme-toggle {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
  border: 1px solid rgba(200, 164, 110, .15);
  border-radius: 0.5rem;
  color: var(--gold);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.15s;
}

.nav-controls .theme-toggle:hover {
  background: var(--bg4);
}

.nav-controls .hamburger {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
  border: 1px solid rgba(200, 164, 110, .15);
  border-radius: 0.5rem;
  color: var(--gold);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

/* Sur desktop, cacher le hamburger dans nav-controls */
@media (min-width: 1024px) {
  .nav-controls .hamburger {
    display: none !important;
  }
}

/* ─────────────────────────────────────────────
   SCROLLBAR (WebKit)
   ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb {
  background: var(--gold3);
  border-radius: 3px;
}
