:root {
  --navy: #19314a;
  --navy-1: #1b3d61;
  --ink: #19314a;
  --grey-0: #4d4d4d;
  --grey-1: #898989;
  --grey-2: #dddddd;
  --grey-3: #fafafa;
  --white: #ffffff;
  --line: #e8ebef;
  --line-soft: #f0f2f5;
  --accent: #d72660; /* fushia-1 */
  --bg-soft: #f7f8fa;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius: 2px;
  --radius-sm: 2px;
  --sidebar-w: 264px;
  --transition: 140ms ease;
  --toc-w: 220px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--white);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  color: var(--navy);
  padding: 4px 8px 20px;
}
.sidebar__brand:hover { text-decoration: none; }

.nav-group { margin-bottom: 22px; }
.nav-group__title {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey-1);
  margin: 0 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--grey-0);
  transition: background var(--transition), color var(--transition);
}
.nav-item:hover { background: var(--bg-soft); text-decoration: none; color: var(--navy); }
.nav-item.is-active { background: #eef4fb; color: var(--navy-1); font-weight: 600; }
.nav-item.is-soon { color: var(--grey-1); cursor: default; }
.nav-item.is-soon:hover { background: transparent; color: var(--grey-1); }
.nav-item em {
  font-style: normal;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--grey-1);
  background: var(--line-soft);
  padding: 2px 6px;
  border-radius: 2px;
}

/* ---------- Content ---------- */
.content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(8px);
}
.crumbs { font-size: 0.875rem; color: var(--grey-1); display: flex; gap: 8px; align-items: center; }
.crumbs strong { color: var(--navy); }
.crumbs__sep { color: var(--grey-2); }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar__menu { display: none; }

.segmented {
  display: inline-flex;
  gap: 3px;
  background: var(--white);
  border: 1.5px solid var(--navy);
  border-radius: 2px;
  padding: 3px;
}
.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 8px 18px;
  border-radius: 2px;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.segmented button:hover { background: var(--bg-soft); }
.segmented button.is-active {
  background: var(--navy);
  color: var(--white);
}
.brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.brand-dot--yespark { background: #d72660; }
.brand-dot--zenpark { background: #366d56; }
.segmented button.is-active .brand-dot { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.6); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.8125rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.btn--primary { background: var(--navy); color: var(--white); }
.btn--primary:hover { background: var(--navy-1); text-decoration: none; }
.btn--ghost { background: var(--white); color: var(--navy); border-color: var(--line); }
.btn--ghost:hover { background: var(--bg-soft); text-decoration: none; }

.icon-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  color: var(--grey-0);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}
.icon-btn:hover { background: var(--bg-soft); }

.main { padding: 32px; max-width: 1100px; width: 100%; }

.page-intro { margin-bottom: 26px; }
.eyebrow {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--grey-1);
  margin-bottom: 8px;
}
.page-intro h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 3.5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--navy);
}
.lead { margin: 0; max-width: 720px; color: var(--grey-0); font-size: 0.9375rem; }
.lead strong { font-family: var(--font-mono); font-size: 0.85em; }

/* ---------- Dev banner ---------- */
.dev-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  margin-bottom: 32px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.dev-banner__label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--navy);
  margin-right: 4px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 2px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--grey-0);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.chip:hover { border-color: var(--accent); color: var(--navy); text-decoration: none; }

/* ---------- Palette ---------- */
.ds-section { margin-bottom: 40px; }
.ds-section__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.ds-section__badge {
  display: inline-block;
  background: var(--navy);
  color: var(--white);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
}
.ds-group { margin-bottom: 22px; }
.ds-group__title { margin: 0 0 12px; font-size: 0.9375rem; font-weight: 600; color: var(--navy); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}

.color-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.color-card:hover { border-color: var(--grey-2); box-shadow: 0 6px 18px rgba(25, 49, 74, 0.1); transform: translateY(-2px); }

.color-card__swatch {
  height: 96px;
  cursor: pointer;
  border-bottom: 1px solid rgba(25, 49, 74, 0.06);
  position: relative;
}
.color-card__swatch::after {
  content: "Copier";
  position: absolute;
  right: 8px;
  bottom: 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--white);
  background: rgba(25, 49, 74, 0.55);
  padding: 2px 8px;
  border-radius: 2px;
  opacity: 0;
  transition: opacity var(--transition);
}
.color-card__swatch:hover::after { opacity: 1; }

.color-card__body { padding: 10px 12px 12px; }
.color-card__token { font-size: 0.8125rem; font-weight: 700; color: var(--navy); }
.color-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}
.color-card__hex {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--grey-1);
  text-transform: uppercase;
}
.color-card__code {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--grey-0);
  padding: 2px 7px;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.color-card__code:hover { border-color: var(--accent); color: var(--navy); }
.color-card.is-muted { opacity: 0.45; }

/* Snippet déplié sous une couleur (pleine largeur dans la grille) */
.card-code { grid-column: 1 / -1; margin: 4px 0 10px; max-width: 640px; }
.card-code__label { font-family: var(--font-mono); font-size: 0.75rem; color: var(--grey-1); margin-bottom: 6px; }
.color-card__code.is-open { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(25, 49, 74, 0.42); backdrop-filter: blur(2px); }
.modal__panel {
  position: relative;
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow: auto;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(25, 49, 74, 0.28);
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--white);
}
.modal__head h2 { margin: 0; font-size: 1.0625rem; color: var(--navy); }
.modal__body { padding: 18px 20px 22px; }

/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tabs button {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 2px;
  padding: 6px 13px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--grey-0);
  cursor: pointer;
}
.tabs button.is-active { background: var(--navy); color: var(--white); border-color: var(--navy); }

.code-block { position: relative; margin: 0 0 8px; }
.code-block pre {
  margin: 0;
  padding: 14px 16px;
  background: #0f2338;
  color: #e6eef7;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
}
.code-block__copy {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.code-block__copy:hover { background: rgba(255, 255, 255, 0.26); }

.export-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.export-row:last-child { border-bottom: 0; }
.export-row__name { font-weight: 600; color: var(--navy); font-size: 0.875rem; }
.export-row__file { font-family: var(--font-mono); font-size: 0.75rem; color: var(--grey-1); }
.export-row__actions { display: flex; gap: 8px; }
.mini-btn {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 6px;
  padding: 5px 11px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--grey-0);
  cursor: pointer;
}
.mini-btn:hover { border-color: var(--accent); color: var(--navy); }
.modal__section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey-1);
  margin: 18px 0 4px;
}
.modal__section-title:first-child { margin-top: 0; }

.figma-note { color: var(--grey-1); font-size: 0.8125rem; margin-top: 8px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  background: var(--navy);
  color: var(--white);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 2px;
  box-shadow: 0 8px 24px rgba(25, 49, 74, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 200;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform var(--transition);
    box-shadow: 0 12px 40px rgba(25, 49, 74, 0.18);
  }
  .sidebar.is-open { transform: translateX(0); }
  .topbar__menu { display: inline-flex; }
  .main { padding: 22px 18px; }
  .topbar { padding: 10px 16px; }
}

/* ============ Polices self-hostées (RGPD : pas de CDN tiers) ============ */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 300; font-display: swap; src: url("/fonts/ibm-plex-sans-300.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-sans-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/ibm-plex-sans-600.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 300; font-display: swap; src: url("/fonts/inter-300.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/inter-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/inter-600.woff2") format("woff2"); }
@font-face { font-family: "Young Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/young-serif-400.woff2") format("woff2"); }

/* ============ Page Typographie ============ */
.main-with-toc { display: flex; gap: 32px; align-items: flex-start; }
.main-with-toc .main { flex: 1 1 auto; min-width: 0; max-width: 820px; }
.toc { position: sticky; top: 72px; width: var(--toc-w); flex: 0 0 var(--toc-w); padding: 40px 24px 0 0; }
.toc__title { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--grey-1); margin: 0 0 10px; }
.toc a { display: block; padding: 5px 0 5px 12px; font-size: 0.8125rem; color: var(--grey-0); text-decoration: none; border-left: 2px solid var(--line); }
.toc a:hover { color: var(--navy); border-left-color: var(--accent); }

.doc-section { margin-bottom: 44px; scroll-margin-top: 72px; }
.doc-section__title { font-size: 1.375rem; font-weight: 800; color: var(--navy); margin: 0 0 8px; letter-spacing: -0.01em; }
.doc-section__intro { color: var(--grey-0); margin: 0 0 20px; max-width: 640px; }

.font-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.font-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.font-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.font-card__role { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--grey-1); }
.font-card__name { margin: 2px 0 0; font-size: 1.125rem; color: var(--navy); }
.font-card__weights { display: flex; flex-direction: column; gap: 2px; text-align: right; font-size: 0.72rem; color: var(--grey-1); }
.font-card__specimen { padding: 14px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); margin: 12px 0; }
.font-card__aa { font-size: 52px; line-height: 1; color: var(--navy); }
.font-card__pangram { margin-top: 10px; color: var(--grey-0); font-size: 1rem; }
.font-card__note { font-size: 0.78rem; color: #8a3c0c; background: #fef4ef; border: 1px solid #fbe5d6; padding: 8px 10px; border-radius: var(--radius); margin: 0 0 12px; }

.type-row { padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.type-row__top { display: flex; align-items: baseline; gap: 24px; }
.type-row__specimen { flex: 1 1 auto; min-width: 0; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-row__code { margin-top: 12px; max-width: 620px; }
.code-toggle.is-open { border-color: var(--accent); color: var(--navy); }
.lang-tabs { display: flex; gap: 2px; }
.lang-tab { border: 0; background: transparent; color: #8fb0cf; font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; padding: 3px 9px; cursor: pointer; border-radius: 2px; }
.lang-tab:hover { color: #fff; }
.lang-tab.is-active { background: rgba(255, 255, 255, 0.16); color: #fff; }
.type-row__meta { flex: 0 0 190px; display: flex; flex-direction: column; gap: 7px; align-items: flex-start; }
.type-row__cls { font-family: var(--font-mono); font-size: 0.75rem; color: var(--accent); background: var(--bg-soft); padding: 2px 6px; border-radius: 2px; }
.type-row__specs { display: flex; flex-direction: column; gap: 2px; font-family: var(--font-mono); font-size: 0.72rem; color: var(--grey-1); }
.type-row__specs em { font-style: normal; color: var(--grey-2); }

.ds-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; max-width: 560px; }
.ds-table th, .ds-table td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.ds-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--grey-1); font-weight: 700; }
.ds-table td { color: var(--grey-0); }

.modal-note { font-size: 0.85rem; color: var(--grey-0); margin: 0 0 14px; }
.modal-note code { font-family: var(--font-mono); background: var(--bg-soft); padding: 1px 5px; border-radius: 2px; font-size: 0.85em; }

/* Blocs de code à en-tête (langage + copier) */
.code-block__head { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; background: #0b1b2c; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.code-block__lang { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #8fb0cf; }
.code-block__head .code-block__copy { position: static; background: rgba(255, 255, 255, 0.14); color: #fff; border: 0; border-radius: 2px; padding: 4px 10px; font-size: 0.72rem; font-weight: 600; cursor: pointer; }
.code-block__head .code-block__copy:hover { background: rgba(255, 255, 255, 0.26); }

@media (max-width: 900px) {
  .main-with-toc { flex-direction: column; }
  .toc { display: none; }
  .type-row__top { flex-direction: column; gap: 10px; }
  .type-row__specimen { white-space: normal; }
  .type-row__meta { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; }
}
