/*
 * Design system partagé : portfolio + blog (bbrbbr.fr)
 * Inspiré de Material 3 Expressive : couleurs saturées, grandes formes arrondies,
 * typographie marquée, animations « ressort ».
 *
 * Servi sur /blog/theme.css. Les couleurs utilisent light-dark() : elles suivent
 * color-scheme (automatique par défaut, forcé par data-theme="light|dark" sur <html>).
 *
 * Palette : indigo (primaire), vert sapin (secondaire), jaune (accent),
 *           violet foncé (surfaces fortes : bandeaux, héros, pied de page).
 * Contrastes vérifiés WCAG AA pour chaque paire texte/fond ci-dessous.
 */
/* Police Google Sans Flex, hébergée sur le site (licence SIL OFL 1.1, voir /blog/fonts/OFL.txt).
   Sous-ensembles « latin » (français) et « latin-ext » ; les autres caractères utilisent la police de secours. */
@font-face {
  font-family: 'Google Sans Flex';
  font-style: normal;
  font-weight: 400 900;
  font-stretch: 100%;
  font-display: swap;
  src: url(/blog/fonts/google-sans-flex-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Google Sans Flex';
  font-style: normal;
  font-weight: 400 900;
  font-stretch: 100%;
  font-display: swap;
  src: url(/blog/fonts/google-sans-flex-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  color-scheme: light dark;

  --font: 'Google Sans Flex', 'Google Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Surfaces */
  --md-surface:          light-dark(#FBF8FF, #140B24);
  --md-surface-card:     light-dark(#FFFFFF, #1B1030);
  --md-surface-low:      light-dark(#F4EFFD, #1F1438);
  --md-surface-high:     light-dark(#EAE3F8, #2A1C45);
  --md-surface-highest:  light-dark(#E1D8F2, #352558);
  --md-on-surface:       light-dark(#1C1630, #EDE6FA);
  --md-on-surface-var:   light-dark(#5E5673, #B8AECF);
  --md-outline:          light-dark(#8A819F, #7F7596);
  --md-outline-var:      light-dark(#D5CEE6, #3E3158);

  /* Indigo : primaire */
  --md-primary:              light-dark(#4A3AE0, #BDB4FF);
  --md-on-primary:           light-dark(#FFFFFF, #25106E);
  --md-primary-container:    light-dark(#E4DFFF, #3A2AB8);
  --md-on-primary-container: light-dark(#1B0C73, #E4DFFF);

  /* Indigo fixe (identique en clair et en sombre) : formes décoratives sur fond violet */
  --md-indigo: #4A3AE0;

  /* Vert sapin : secondaire */
  --md-secondary:              light-dark(#1F5B46, #96D9B6);
  --md-on-secondary:           light-dark(#FFFFFF, #003826);
  --md-secondary-container:    light-dark(#C3EBD6, #0F4D3A);
  --md-on-secondary-container: light-dark(#00241A, #C3EBD6);

  /* Jaune : tertiaire / accent */
  --md-yellow:                #FFD43B;
  --md-on-yellow:             #2A2000;
  --md-tertiary-container:    light-dark(#FFEA8A, #4A3B00);
  --md-on-tertiary-container: light-dark(#3A2D00, #FFEA8A);

  /* Violet foncé : surface forte (héros, bandeaux) */
  --md-purple:           light-dark(#2A0F55, #35176B);
  --md-on-purple:        #F3ECFF;
  --md-on-purple-muted:  #CBBFE8;

  /* Formes */
  --shape-sm: 12px;
  --shape-md: 20px;
  --shape-lg: 28px;
  --shape-xl: 40px;
  --shape-2xl: 56px;
  --shape-pill: 999px;

  /* Mouvement : ressort léger (léger dépassement) + courbe « emphasized » */
  --spring: cubic-bezier(0.34, 1.45, 0.64, 1);
  --emphasized: cubic-bezier(0.2, 0, 0, 1);

  /* Élévation teintée de violet */
  --elev-1: 0 1px 2px rgba(42, 15, 85, .12), 0 2px 8px rgba(42, 15, 85, .08);
  --elev-2: 0 10px 30px rgba(42, 15, 85, .18);

  /* Noms historiques utilisés par le portfolio : alias vers la nouvelle palette */
  --bg: var(--md-surface);
  --bg-card: var(--md-surface-card);
  --text: var(--md-on-surface);
  --text-muted: var(--md-on-surface-var);
  --accent: var(--md-primary);
  --accent-light: var(--md-primary-container);
  --border: var(--md-outline-var);
  --highlight: var(--md-primary);
  --radius: var(--shape-lg);
  --transition: 0.5s var(--spring);
}
:root[data-theme='light'] { color-scheme: light; }
:root[data-theme='dark'] { color-scheme: dark; }

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--md-surface);
  color: var(--md-on-surface);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--md-yellow); color: var(--md-on-yellow); }
:focus-visible { outline: 3px solid var(--md-primary); outline-offset: 3px; }

/* ── Bouton jour / nuit (commun aux deux sites) : l'icône montre le thème vers lequel on bascule ── */
.theme-toggle {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--md-surface-high); color: var(--md-on-surface);
  transition: border-radius .5s var(--spring), transform .5s var(--spring), background .3s, color .3s;
}
.theme-toggle:hover { border-radius: var(--shape-md); background: var(--md-primary-container); color: var(--md-on-primary-container); }
.theme-toggle:active { transform: scale(.92); }
.theme-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle .sun { display: block; }
  :root:not([data-theme='light']) .theme-toggle .moon { display: none; }
}
:root[data-theme='dark'] .theme-toggle .sun { display: block; }
:root[data-theme='dark'] .theme-toggle .moon { display: none; }

/* ── Interrupteur Portfolio / Blog (commun aux deux sites) ── */
.mode-switch {
  position: fixed; z-index: 200; top: 12px; left: 168px;
  display: inline-grid; grid-template-columns: 1fr 1fr;
  padding: 4px; border-radius: var(--shape-pill);
  background: var(--md-surface-high);
  box-shadow: var(--elev-1);
  font: 700 .8rem/1 var(--font); letter-spacing: .06em; text-transform: uppercase;
}
.mode-switch::before {
  content: ''; position: absolute; top: 4px; bottom: 4px; left: 4px;
  width: calc(50% - 4px); border-radius: var(--shape-pill);
  background: var(--md-primary);
  transition: transform .5s var(--spring);
}
.mode-switch[data-active='blog']::before { transform: translateX(100%); }
.mode-switch a {
  position: relative; z-index: 1; min-width: 8rem; padding: 12px 0; text-align: center;
  text-decoration: none; color: var(--md-on-surface-var); transition: color .3s;
}
.mode-switch[data-active='site'] a[data-mode='site'],
.mode-switch[data-active='blog'] a[data-mode='blog'] { color: var(--md-on-primary); }
/* Écrans étroits : pastille flottante en bas, à portée de pouce */
@media (max-width: 1100px) {
  .mode-switch {
    top: auto; bottom: max(16px, env(safe-area-inset-bottom));
    left: 50%; transform: translateX(-50%);
    box-shadow: var(--elev-2);
  }
  body { padding-bottom: 92px; }
}
@media (prefers-reduced-motion: reduce) {
  .mode-switch::before, .mode-switch a { transition: none; }
}
@view-transition { navigation: auto; }
