/* =========================================================
   Le Labo du Yeti — Documentation CSS
   Inspiré de Stripe Docs / Tailwind Docs / Laravel Docs
   ========================================================= */

/* -----------------------------
   Design Tokens
   ----------------------------- */
:root {
  /* Couleurs primaires */
  --primary: #F58220;
  --primary-hover: #d96d10;
  --navy: #0F1B3D;

  /* Gradient header */
  --gradient: linear-gradient(180deg, #0A1547 0%, #131F5E 30%, #2A2B97 70%, #4A3FB8 100%);

  /* Backgrounds */
  --bg: #ffffff;
  --bg-section: #f8fafc;
  --bg-code: #0F1B3D;
  --bg-code-inline: #f1f5f9;

  /* Texte */
  --text-primary: #0F1B3D;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  /* Bordures */
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  /* États */
  --state-success: #16a34a;
  --state-success-bg: #f0fdf4;
  --state-warning: #d97706;
  --state-warning-bg: #fffbeb;
  --state-error: #dc2626;
  --state-error-bg: #fef2f2;
  --state-info: #2563eb;
  --state-info-bg: #eff6ff;

  /* Élévations & rayons */
  --shadow-sm: 0 1px 2px 0 rgba(15, 27, 61, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 27, 61, 0.08), 0 2px 4px -2px rgba(15, 27, 61, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 27, 61, 0.1), 0 4px 6px -4px rgba(15, 27, 61, 0.05);
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;

  /* Layout */
  --sidebar-w: 260px;
  --toc-w: 200px;
  --header-h: 64px;
  --content-max: 880px;

  /* Typographie */
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* -----------------------------
   Reset + Base
   ----------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* -----------------------------
   Header (topbar)
   ----------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--gradient);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  box-shadow: var(--shadow-md);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-inverse);
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
}
.topbar-logo:hover {
  text-decoration: none;
  color: var(--text-inverse);
}
.topbar-logo img {
  height: 32px;
  width: auto;
}
.topbar-logo .version-pill {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  letter-spacing: 0.02em;
}

.topbar-search {
  flex: 1;
  max-width: 520px;
  position: relative;
}
.topbar-search input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 38px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-inverse);
  font-size: 14px;
  outline: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.topbar-search input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}
.topbar-search input:focus {
  background: rgba(255, 255, 255, 0.18);
  border-color: var(--primary);
}
.topbar-search::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.7)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat center;
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 420px;
  overflow-y: auto;
  display: none;
  z-index: 200;
}
.search-results.open {
  display: block;
}
.search-result-item {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}
.search-result-item:last-child {
  border-bottom: none;
}
.search-result-item:hover {
  background: var(--bg-section);
  text-decoration: none;
}
.search-result-item .sr-title {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}
.search-result-item .sr-section {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}
.search-empty {
  padding: 16px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
}
.topbar-nav a {
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  font-weight: 500;
}
.topbar-nav a:hover {
  color: #fff;
  text-decoration: none;
}

.sidebar-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-inverse);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
}
.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}
.sidebar-toggle svg {
  width: 22px;
  height: 22px;
}

/* -----------------------------
   Sidebar
   ----------------------------- */
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--header-h));
  background: var(--bg-section);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 24px 0;
  z-index: 50;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
}

.sidebar-home {
  display: block;
  padding: 8px 20px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  color: var(--text-primary);
}
.sidebar-home:hover {
  text-decoration: none;
  color: var(--text-primary);
}
.sidebar-home strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.sidebar-home .sidebar-subtitle {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-section {
  margin-bottom: 16px;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 8px 20px 6px;
}

.sidebar-nav a:not(.sidebar-home) {
  display: block;
  padding: 6px 20px 6px 24px;
  font-size: 13px;
  color: var(--text-secondary);
  border-left: 3px solid transparent;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.sidebar-nav a:not(.sidebar-home):hover {
  background: rgba(245, 130, 32, 0.06);
  color: var(--text-primary);
  text-decoration: none;
}
.sidebar-nav a.active {
  color: var(--primary);
  background: rgba(245, 130, 32, 0.08);
  border-left-color: var(--primary);
  font-weight: 600;
}

/* -----------------------------
   Main content
   ----------------------------- */
.content {
  margin-left: var(--sidebar-w);
  padding: 40px 48px 80px;
  max-width: calc(var(--sidebar-w) + var(--content-max) + var(--toc-w) + 96px);
}

@media (min-width: 1280px) {
  .content {
    padding-right: calc(var(--toc-w) + 48px);
  }
}

.breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.breadcrumb a {
  color: var(--text-secondary);
}
.breadcrumb a:hover {
  color: var(--primary);
}
.breadcrumb .sep {
  margin: 0 6px;
  color: var(--text-muted);
}

article {
  max-width: var(--content-max);
}

article h1 {
  font-size: 36px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-primary);
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}

article h2 {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  margin: 48px 0 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  letter-spacing: -0.01em;
}

article h3 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
  margin: 32px 0 12px;
}

article h4 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  margin: 24px 0 8px;
}

article p {
  margin: 0 0 16px;
  color: var(--text-secondary);
}

article ul,
article ol {
  padding-left: 24px;
  margin: 0 0 16px;
  color: var(--text-secondary);
}
article ul li,
article ol li {
  margin-bottom: 6px;
}

article strong {
  color: var(--text-primary);
  font-weight: 600;
}

article blockquote {
  border-left: 4px solid var(--border-strong);
  margin: 16px 0;
  padding: 8px 16px;
  color: var(--text-secondary);
  background: var(--bg-section);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* Code */
article code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-code-inline);
  color: var(--text-primary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

article pre {
  position: relative;
  background: var(--bg-code);
  color: #e2e8f0;
  padding: 16px 18px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 16px 0;
  font-size: 13.5px;
  line-height: 1.65;
}
article pre code {
  background: transparent;
  border: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-sans);
  padding: 4px 10px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}
article pre:hover .copy-btn {
  opacity: 1;
}
.copy-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}
.copy-btn.copied {
  background: var(--state-success);
  color: #fff;
  border-color: var(--state-success);
  opacity: 1;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
article thead {
  background: var(--bg-section);
}
article th {
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
article td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}
article tbody tr:last-child td {
  border-bottom: none;
}
article tbody tr:hover {
  background: var(--bg-section);
}

/* -----------------------------
   Components utilitaires
   ----------------------------- */

/* Alerts */
.alert {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border-left: 4px solid var(--state-info);
  background: var(--state-info-bg);
  margin: 16px 0;
  color: var(--text-primary);
}
.alert::before {
  content: "i";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--state-info);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  font-family: serif;
  font-style: italic;
}
.alert.alert-success {
  border-left-color: var(--state-success);
  background: var(--state-success-bg);
}
.alert.alert-success::before {
  background: var(--state-success);
  content: "\2713";
  font-style: normal;
  font-family: var(--font-sans);
}
.alert.alert-warning {
  border-left-color: var(--state-warning);
  background: var(--state-warning-bg);
}
.alert.alert-warning::before {
  background: var(--state-warning);
  content: "!";
  font-style: normal;
  font-family: var(--font-sans);
}
.alert.alert-error {
  border-left-color: var(--state-error);
  background: var(--state-error-bg);
}
.alert.alert-error::before {
  background: var(--state-error);
  content: "\00D7";
  font-style: normal;
  font-family: var(--font-sans);
}
.alert .alert-content {
  flex: 1;
}
.alert .alert-title {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}
.alert p:last-child {
  margin-bottom: 0;
}

/* Callouts */
.callout {
  border: 1px solid var(--border);
  background: var(--bg-section);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 16px 0;
}
.callout > :first-child {
  margin-top: 0;
}
.callout > :last-child {
  margin-bottom: 0;
}

/* Pills */
.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-section);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.pill.pill-brand { background: rgba(245, 130, 32, 0.12); color: var(--primary); border-color: rgba(245, 130, 32, 0.3); }
.pill.pill-webmaster { background: rgba(37, 99, 235, 0.1); color: var(--state-info); border-color: rgba(37, 99, 235, 0.25); }
.pill.pill-client { background: rgba(22, 163, 74, 0.1); color: var(--state-success); border-color: rgba(22, 163, 74, 0.25); }
.pill.pill-admin { background: rgba(220, 38, 38, 0.1); color: var(--state-error); border-color: rgba(220, 38, 38, 0.25); }

/* Badges méthode API */
.badge-method {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  color: #fff;
  text-transform: uppercase;
  margin-right: 6px;
  min-width: 56px;
  text-align: center;
}
.badge-method.get { background: var(--state-success); }
.badge-method.post { background: var(--primary); }
.badge-method.put { background: var(--state-info); }
.badge-method.patch { background: #7c3aed; }
.badge-method.delete { background: var(--state-error); }

/* Grid cards (hubs) */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.card {
  display: block;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-primary);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.card:hover {
  text-decoration: none;
  color: var(--text-primary);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-title {
  display: block;
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 6px;
  color: var(--text-primary);
}
.card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Page nav (prev/next) */
.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  max-width: var(--content-max);
}
.page-nav a {
  flex: 1;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  background: var(--bg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.page-nav a:hover {
  text-decoration: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.page-nav a.next {
  text-align: right;
}
.page-nav .label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.page-nav .title {
  display: block;
  font-weight: 600;
  color: var(--primary);
}

/* -----------------------------
   TOC droite
   ----------------------------- */
.toc {
  position: fixed;
  top: calc(var(--header-h) + 40px);
  right: 24px;
  width: var(--toc-w);
  max-height: calc(100vh - var(--header-h) - 80px);
  overflow-y: auto;
  font-size: 13px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
  display: none;
}
@media (min-width: 1280px) {
  .toc {
    display: block;
  }
}
.toc-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc li {
  margin: 0;
}
.toc a {
  display: block;
  padding: 4px 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
  border-left: 2px solid transparent;
  padding-left: 10px;
  margin-left: -12px;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.toc a:hover {
  color: var(--primary);
  text-decoration: none;
}
.toc a.active {
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
.toc .toc-h3 {
  padding-left: 22px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.toc .toc-h3.active {
  color: var(--primary);
}

/* -----------------------------
   Footer
   ----------------------------- */
.docs-footer {
  margin-left: var(--sidebar-w);
  padding: 24px 48px 40px;
  border-top: 1px solid var(--border);
  background: var(--bg-section);
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.docs-footer a {
  color: var(--text-secondary);
}
.docs-footer a:hover {
  color: var(--primary);
}

/* -----------------------------
   Hub homepage (index.html)
   ----------------------------- */
.hero {
  padding: 24px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.hero h1 {
  margin-bottom: 8px;
}
.hero p {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 680px;
}

/* -----------------------------
   Responsive
   ----------------------------- */
@media (max-width: 1024px) {
  :root {
    --sidebar-w: 0px;
  }
  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .sidebar {
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .content {
    margin-left: 0;
    padding: 32px 24px 80px;
  }
  .docs-footer {
    margin-left: 0;
    padding: 24px;
  }
  .topbar-nav a {
    display: none;
  }
  .topbar-nav .topbar-nav-keep {
    display: inline;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 0 14px;
    gap: 10px;
  }
  .topbar-logo .version-pill {
    display: none;
  }
  .topbar-search {
    max-width: none;
  }
  article h1 {
    font-size: 28px;
  }
  article h2 {
    font-size: 22px;
  }
  article h3 {
    font-size: 18px;
  }
  .content {
    padding: 24px 16px 64px;
  }
  .page-nav {
    flex-direction: column;
  }
}

/* -----------------------------
   Mobile overlay
   ----------------------------- */
.sidebar-overlay {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  background: rgba(15, 27, 61, 0.5);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.sidebar-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* -----------------------------
   Print
   ----------------------------- */
@media print {
  .no-print,
  .topbar,
  .sidebar,
  .toc,
  .docs-footer,
  .sidebar-toggle,
  .copy-btn {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
  .content {
    margin: 0;
    padding: 0;
    max-width: 100%;
  }
  article {
    max-width: 100%;
  }
  article h1,
  article h2,
  article h3 {
    color: var(--navy);
    page-break-after: avoid;
  }
  article pre {
    background: #f4f4f4;
    color: #000;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
  article code {
    background: #f4f4f4;
    color: #000;
    border-color: #ccc;
  }
  a {
    color: var(--navy);
    text-decoration: underline;
  }
  .alert,
  .callout {
    border: 1px solid #ccc;
    background: #fafafa;
    color: #000;
  }
  .page-nav {
    display: none;
  }
}
