/* ============================================================
   base.css : tokens, reset, typographie
   Le site est une application : fond de bureau dégradé,
   fenêtre flottante, barre latérale, panneau de contenu.
   Victor Brenin, 2026
   ============================================================ */

/* ---------- 1. Tokens ---------- */

:root {
  color-scheme: light;

  /* Fond de bureau */
  --wall-1: #d69a85;
  --wall-2: #ddaebc;
  --wall-3: #a6b2dc;
  --wall-4: #96b9dd;
  --wall-base: #cdc6ce;

  /* Survol et onglet actif posés sur le dégradé de la barre latérale */
  --side-hover: rgba(255, 255, 255, 0.4);
  --side-active: rgba(255, 255, 255, 0.78);
  --side-field: rgba(255, 255, 255, 0.52);

  /* Surfaces de l'application */
  --surface: #ffffff;
  --surface-2: #f1f0f3;
  --surface-3: #e8e7ec;

  /* Encre : assumée, pas délavée */
  --ink: #131316;
  --ink-2: #3c3c44;
  --ink-3: #6b6b73;
  --ink-4: #93939c;

  /* Accent : l'encre. La couleur reste sur le fond de bureau. */
  --accent: #1c1c1e;
  --accent-ink: #ffffff;
  --accent-soft: rgba(28, 28, 30, 0.055);
  --accent-line: rgba(28, 28, 30, 0.14);

  /* Orbe de marque */
  --orb: conic-gradient(from 200deg, #7c93e8, #b3a7e4, #e8b9a4, #9fc0e6, #7c93e8);

  /* Mise en avant : le dégradé du fond de bureau, dilué.
     Sert pour les survols, les onglets actifs et les éléments sélectionnés. */
  --tint-soft: linear-gradient(105deg,
    color-mix(in srgb, var(--wall-1) 17%, transparent) 0%,
    color-mix(in srgb, var(--wall-2) 14%, transparent) 36%,
    color-mix(in srgb, var(--wall-3) 17%, transparent) 72%,
    color-mix(in srgb, var(--wall-4) 16%, transparent) 100%);
  --tint: linear-gradient(105deg,
    color-mix(in srgb, var(--wall-1) 34%, transparent) 0%,
    color-mix(in srgb, var(--wall-2) 27%, transparent) 36%,
    color-mix(in srgb, var(--wall-3) 34%, transparent) 72%,
    color-mix(in srgb, var(--wall-4) 31%, transparent) 100%);
  --tint-strong: linear-gradient(105deg,
    color-mix(in srgb, var(--wall-1) 58%, transparent) 0%,
    color-mix(in srgb, var(--wall-2) 48%, transparent) 36%,
    color-mix(in srgb, var(--wall-3) 58%, transparent) 72%,
    color-mix(in srgb, var(--wall-4) 54%, transparent) 100%);

  /* Seul signal chromatique */
  --live: #34a06a;

  /* Filets */
  --hairline: rgba(23, 23, 26, 0.105);
  --hairline-soft: rgba(23, 23, 26, 0.06);
  --brd: rgba(23, 23, 26, 0.15);

  /* Ombres */
  --shadow-xs: 0 1px 1px rgba(28, 28, 30, 0.04);
  --shadow-sm: 0 1px 2px rgba(28, 28, 30, 0.06);
  --shadow-md: 0 1px 2px rgba(28, 28, 30, 0.05), 0 6px 16px -8px rgba(28, 28, 30, 0.14);
  --shadow-lg: 0 1px 2px rgba(28, 28, 30, 0.05), 0 12px 30px -10px rgba(28, 28, 30, 0.18);

  /* Rayons */
  --r-xs: 5px;
  --r-sm: 7px;
  --r-md: 9px;
  --r-lg: 11px;
  --r-xl: 13px;
  --r-full: 999px;

  /* Rythme : resserré */
  --gap: 12px;
  --pad: clamp(16px, 2.2vw, 28px);
  --block: clamp(20px, 2.6vw, 32px);

  --side-w: 232px;
  --bar-h: 46px;

  /* Typo */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  /* New York sur Apple, Georgia ailleurs : aucune police à télécharger */
  --font-display: ui-serif, "New York", "Iowan Old Style", Georgia, "Times New Roman", serif;

  /* Courbes */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.5, 1);
  --t-fast: 0.14s;
  --t: 0.26s;
}

[data-theme="dark"] {
  color-scheme: dark;

  --wall-1: #5c403a;
  --wall-2: #48374a;
  --wall-3: #354364;
  --wall-4: #2c4762;
  --wall-base: #262530;

  --side-hover: rgba(255, 255, 255, 0.06);
  --side-active: rgba(255, 255, 255, 0.13);
  --side-field: rgba(255, 255, 255, 0.07);

  --surface: #1a1a1d;
  --surface-2: #212126;
  --surface-3: #2a2a30;

  --ink: #f7f7fa;
  --ink-2: #c2c2ca;
  --ink-3: #97979f;
  --ink-4: #70707a;

  --accent: #f2f2f5;
  --accent-ink: #1a1a1d;
  --accent-soft: rgba(242, 242, 245, 0.08);
  --accent-line: rgba(242, 242, 245, 0.18);

  --live: #43b47e;

  /* Sur fond sombre le dégradé doit être bien plus dosé pour rester lisible */
  --tint-soft: linear-gradient(105deg,
    color-mix(in srgb, var(--wall-1) 34%, transparent) 0%,
    color-mix(in srgb, var(--wall-2) 30%, transparent) 36%,
    color-mix(in srgb, var(--wall-3) 36%, transparent) 72%,
    color-mix(in srgb, var(--wall-4) 34%, transparent) 100%);
  --tint: linear-gradient(105deg,
    color-mix(in srgb, var(--wall-1) 66%, transparent) 0%,
    color-mix(in srgb, var(--wall-2) 58%, transparent) 36%,
    color-mix(in srgb, var(--wall-3) 68%, transparent) 72%,
    color-mix(in srgb, var(--wall-4) 64%, transparent) 100%);
  --tint-strong: linear-gradient(105deg,
    var(--wall-1) 0%, var(--wall-2) 36%, var(--wall-3) 72%, var(--wall-4) 100%);

  --hairline: rgba(255, 255, 255, 0.1);
  --hairline-soft: rgba(255, 255, 255, 0.055);
  --brd: rgba(255, 255, 255, 0.155);

  --shadow-xs: 0 1px 1px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 20px -10px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 36px -12px rgba(0, 0, 0, 0.7);
}

/* ---------- 2. Reset ---------- */

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

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.58;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 0;
  background: var(--wall-base);
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}

img, svg, video, canvas { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; -webkit-user-select: none; user-select: none; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

::selection { background: var(--ink); color: var(--surface); }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }

/* Barres de défilement internes, discrètes */
.scroller::-webkit-scrollbar { width: 10px; height: 10px; }
.scroller::-webkit-scrollbar-track { background: transparent; }
.scroller::-webkit-scrollbar-thumb {
  background: var(--ink-4);
  border-radius: var(--r-full);
  border: 3px solid transparent;
  background-clip: content-box;
}
.scroller::-webkit-scrollbar-thumb:hover { background: var(--ink-3); background-clip: content-box; }
.scroller { scrollbar-width: thin; scrollbar-color: var(--ink-4) transparent; }

/* Texture très légère sur le fond de bureau */
.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.3;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}
[data-theme="dark"] .grain { opacity: 0.14; mix-blend-mode: overlay; }

/* ---------- 3. Typographie ---------- */

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.026em;
  text-wrap: balance;
}

/* Les titres passent en serif, le corps et l'interface restent en sans */
.display, .h1, .h2, .h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.022em;
}

.display {
  font-size: clamp(2rem, 3.6vw, 3.05rem);
  line-height: 1.04;
  letter-spacing: -0.028em;
}
.h1 { font-size: clamp(1.7rem, 2.9vw, 2.3rem); }
.h2 { font-size: clamp(1.36rem, 2.1vw, 1.72rem); }
.h3 { font-size: clamp(1.08rem, 1.55vw, 1.26rem); }
.h4 { font-size: 1.02rem; letter-spacing: -0.018em; font-weight: 600; }

.lead {
  font-size: clamp(0.95rem, 1.15vw, 1.06rem);
  line-height: 1.56;
  color: var(--ink-2);
  letter-spacing: -0.012em;
  text-wrap: pretty;
}

.body-2 { font-size: 0.925rem; color: var(--ink-2); line-height: 1.62; }
.small { font-size: 0.835rem; color: var(--ink-3); line-height: 1.55; }

.mono {
  font-family: var(--font-mono);
  font-size: 0.685rem;
  letter-spacing: 0.085em;
  text-transform: uppercase;
  font-weight: 500;
}

.soft-text { color: var(--ink-3); }
.dim { color: var(--ink-3); }

/* ---------- 4. Utilitaires de disposition ---------- */

.stack { display: flex; flex-direction: column; }
.stack-4 { gap: 14px; }

.row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

/* Espacement entre blocs : appliqué à tous les frères d'une vue,
   plutôt que de dépendre d'une classe posée sur les deux voisins. */
.viewpanel > * + * { margin-top: var(--block); }


/* En-tête de bloc, compact */
.head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
/* Le bloc occupe la largeur disponible, sinon c'est le paragraphe,
   plus étroit, qui dicterait la largeur du titre. Seul le paragraphe
   garde ensuite une mesure lisible. */
.head-text { flex: 1 1 auto; min-width: 0; max-width: none; }
.head-text .lead { max-width: 1080px; }
.head h2 { margin-top: 8px; }
.head .lead { margin-top: 6px; }

/* Ligne de métadonnées : la respiration éditoriale sous un titre */
.meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px dotted var(--ink-4);
  font-family: var(--font-mono);
  font-size: 0.645rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.meta-line b { color: var(--ink-2); font-weight: 600; }
.meta-line .sep { color: var(--ink-4); }

/* ---------- 5. Panneaux ---------- */

.panel {
  position: relative;
  background: var(--surface);
}

.panel-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 0 9px;
  margin-bottom: 18px;
  border-bottom: 1px dotted var(--ink-4);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-2);
}
.panel-bar svg { width: 12px; height: 12px; flex: none; }
/* Le libellé est un titre de niveau 2 : il doit garder l'allure de la barre. */
.pb-title { font: inherit; letter-spacing: inherit; color: inherit; margin: 0; }
.panel-bar .spacer { margin-left: auto; }

.panel-body { padding: 0; }

/* Grille à filets */
.tiles { display: grid; gap: clamp(20px, 2.6vw, 34px) clamp(22px, 3vw, 44px); }
.tiles-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1100px) { .tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .tiles-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .tiles-2, .tiles-3, .tiles-4 { grid-template-columns: minmax(0, 1fr); }
}

.tile { padding: 0; }
.tile h3, .tile h4 { transition: color var(--t-fast) var(--ease); }
.tile h3, .tile h4 { margin-bottom: 5px; }
.tile p { font-size: 0.9rem; color: var(--ink-2); line-height: 1.6; }

.ic-box {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: var(--r-xs);
  background-color: var(--surface-2);
  background-image: var(--tint-soft);
  border: 1px solid var(--hairline);
  color: var(--ink-2);
  flex: none;
}
.ic-box svg { width: 13px; height: 13px; }
.tile .ic-box { margin-bottom: 11px; }

.idx {
  font-family: var(--font-mono);
  font-size: 0.645rem;
  letter-spacing: 0.085em;
  color: var(--ink-4);
  display: block;
  margin-bottom: 8px;
}

/* ---------- 6. Boutons ---------- */

.btn {
  --btn-h: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--btn-h);
  padding-inline: 13px;
  border-radius: var(--r-sm);
  font-size: 0.865rem;
  font-weight: 500;
  letter-spacing: -0.008em;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              opacity var(--t-fast) var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 14px; height: 14px; flex: none; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
}
.btn-primary:hover { opacity: 0.85; }

.btn-glass {
  background: var(--surface);
  border: 1px solid var(--brd);
  box-shadow: var(--shadow-xs);
  color: var(--ink);
}
.btn-glass:hover { background-image: var(--tint-soft); }


.btn-lg { --btn-h: 40px; padding-inline: 17px; font-size: 0.915rem; }
.btn-sm { --btn-h: 29px; padding-inline: 10px; font-size: 0.805rem; }

.btn .arrow { transition: transform var(--t) var(--ease-spring); }
.btn:hover .arrow { transform: translateX(2px); }

/* ---------- 7. Pastilles ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding-inline: 9px;
  border-radius: var(--r-xs);
  background-color: var(--surface-2);
  background-image: var(--tint-soft);
  border: 1px solid var(--hairline);
  font-size: 0.765rem;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
}
.pill-accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--ink); }

.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--live);
  flex: none;
}
.dot-live { animation: pulse 2.6s var(--ease) infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 40%, transparent); }
  60% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--live) 0%, transparent); }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 0.645rem;
  letter-spacing: 0.095em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.eyebrow::before { content: ""; width: 12px; height: 1px; background: var(--ink-4); flex: none; }

/* ---------- 8. Apparition ---------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  transition-delay: var(--d, 0ms);
}
[data-reveal].in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}

/* ---------- 9. Divers ---------- */

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.center { text-align: center; }
.full { width: 100%; }

@media (max-width: 720px) { .hide-sm { display: none !important; } }
