/* =============================================================================
   ADEXCLOUD Documentation Center — thème statique, zéro dépendance.
   Clair / sombre via `data-theme` sur <html> (préférence système par défaut).
   Aucune police distante, aucune ressource externe : le site fonctionne
   entièrement hors ligne / derrière le SSO.
   ========================================================================== */

:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f0f3f8;
  --text: #16202c;
  --text-muted: #5a6775;
  --line: #dbe2ea;
  --primary: #0b6bcb;
  --primary-active: #0a58a8;
  --primary-soft: #e6f0fb;
  --code-bg: #f2f5f9;
  --code-border: #dbe2ea;
  --mark: #fff2a8;
  --shadow: 0 1px 2px rgba(16, 30, 48, 0.06), 0 8px 24px rgba(16, 30, 48, 0.06);
  --radius: 10px;
  --sidebar-width: 288px;
  --toc-width: 232px;
}

html[data-theme='dark'] {
  --bg: #0d1218;
  --surface: #141b23;
  --surface-2: #1a232d;
  --text: #e6edf5;
  --text-muted: #9fb0c2;
  --line: #26313d;
  --primary: #58a6ff;
  --primary-active: #82beff;
  --primary-soft: #17263a;
  --code-bg: #101820;
  --code-border: #26313d;
  --mark: #5a4b00;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
}

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

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue',
    Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code,
kbd,
pre {
  font-family: ui-monospace, 'SFMono-Regular', 'JetBrains Mono', Menlo, Consolas, monospace;
  font-size: 0.875em;
}

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

.skip-link {
  position: absolute;
  top: -60px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 0 0 8px 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

/* ------------------------------------------------------------------ En-tête */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 8px 18px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.menu-button {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-active) 100%);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-internal {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 320px;
  max-width: 560px;
  margin-left: auto;
  padding: 0 10px;
  height: 38px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text-muted);
}

.search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.search input::placeholder {
  color: var(--text-muted);
}

.search-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 60;
}

.search-status {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.search-result {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text);
}

.search-result:hover,
.search-result:focus-visible {
  background: var(--surface-2);
  text-decoration: none;
}

.search-result-title {
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.search-result-heading {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.search-result mark {
  background: var(--mark);
  color: inherit;
  padding: 0 1px;
  border-radius: 3px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-link,
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.topbar-link:hover,
.lang-switch:hover {
  text-decoration: none;
  border-color: var(--primary);
  color: var(--primary);
}

.lang-current {
  color: var(--primary);
}

.lang-sep {
  color: var(--text-muted);
}

.lang-other {
  color: var(--text-muted);
}

.theme-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

[data-theme-icon-light] {
  display: none;
}

html[data-theme='dark'] [data-theme-icon-light] {
  display: inline-flex;
}

html[data-theme='dark'] [data-theme-icon-dark] {
  display: none;
}

/* ------------------------------------------------------------------ Layout */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--toc-width);
  gap: 0;
  align-items: start;
  max-width: 1560px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 58px;
  max-height: calc(100vh - 58px);
  overflow-y: auto;
  padding: 18px 14px 40px;
  border-right: 1px solid var(--line);
}

.nav-home {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
}

.nav-home:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.nav-family {
  margin: 0 0 14px;
}

.nav-family-label {
  margin: 0 0 4px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-family ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-doc {
  display: block;
  padding: 6px 10px;
  border-radius: 7px;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.35;
}

.nav-doc:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.nav-doc.is-active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.content {
  min-width: 0;
  padding: 26px 40px 72px;
  outline: none;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.breadcrumb .sep {
  color: var(--text-muted);
  opacity: 0.6;
}

.breadcrumb [aria-current='page'] {
  color: var(--text);
  font-weight: 600;
}

/* ------------------------------------------------------------------ Articles */

.doc-header {
  padding-bottom: 14px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.doc-title {
  margin: 0 0 8px;
  font-size: clamp(26px, 3.2vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.doc-meta {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.doc-body {
  font-size: 15.5px;
  line-height: 1.72;
}

.doc-body h1 {
  margin: 1.6em 0 0.5em;
  font-size: 1.6em;
  line-height: 1.2;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--line);
}

.doc-body h2 {
  margin: 1.8em 0 0.55em;
  font-size: 1.32em;
  line-height: 1.25;
  scroll-margin-top: 74px;
}

.doc-body h3 {
  margin: 1.5em 0 0.4em;
  font-size: 1.12em;
  scroll-margin-top: 74px;
}

.doc-body h4,
.doc-body h5,
.doc-body h6 {
  margin: 1.3em 0 0.35em;
  font-size: 1em;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.doc-body p {
  margin: 0 0 0.95em;
}

.doc-body ul,
.doc-body ol {
  margin: 0 0 1em;
  padding-left: 1.6em;
}

.doc-body li {
  margin: 0.3em 0;
}

.doc-body li > ul,
.doc-body li > ol {
  margin: 0.35em 0 0.5em;
}

.doc-body li[data-doc-task='true'] {
  list-style: none;
  margin-left: -1.4em;
}

.doc-body blockquote {
  margin: 1.1em 0;
  padding: 12px 16px;
  border-left: 3px solid var(--primary);
  background: var(--surface-2);
  border-radius: 0 8px 8px 0;
  color: var(--text);
}

.doc-body blockquote[data-tone='danger'] {
  border-left-color: #d64545;
  background: color-mix(in srgb, #d64545 8%, var(--surface));
}

.doc-body blockquote[data-tone='warning'] {
  border-left-color: #d99a00;
  background: color-mix(in srgb, #d99a00 9%, var(--surface));
}

.doc-body blockquote p:last-child {
  margin-bottom: 0;
}

.doc-body pre {
  margin: 1.1em 0;
  padding: 14px 16px;
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  line-height: 1.55;
}

.doc-body pre code {
  font-size: 13px;
}

.doc-body :not(pre) > code {
  padding: 0.12em 0.38em;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 5px;
  white-space: break-spaces;
}

.doc-body table {
  width: 100%;
  margin: 1.1em 0;
  border-collapse: collapse;
  font-size: 14px;
  display: block;
  overflow-x: auto;
}

.doc-body th,
.doc-body td {
  padding: 8px 12px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.doc-body th {
  background: var(--surface-2);
  font-weight: 700;
}

.doc-body tr:nth-child(even) td {
  background: color-mix(in srgb, var(--surface-2) 45%, transparent);
}

.doc-body img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.doc-body hr {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.doc-body [data-doc-ref] {
  color: var(--text-muted);
  border-bottom: 1px dotted var(--line);
  cursor: help;
}

.doc-body [data-doc-anchor] {
  scroll-margin-top: 76px;
}

.callout {
  margin: 0 0 20px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
}

.callout-warning {
  background: color-mix(in srgb, #d99a00 12%, var(--surface));
  border: 1px solid color-mix(in srgb, #d99a00 40%, var(--line));
}

/* -------------------------------------------------------------------- Sommaire */

.toc {
  position: sticky;
  top: 58px;
  max-height: calc(100vh - 58px);
  overflow-y: auto;
  padding: 24px 18px 40px 4px;
  font-size: 13px;
}

.toc-title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--line);
}

.toc a {
  display: block;
  padding: 4px 0 4px 12px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--text-muted);
  line-height: 1.35;
}

.toc a:hover {
  color: var(--primary);
  text-decoration: none;
  border-left-color: var(--primary);
}

.toc-l3 a {
  padding-left: 24px;
  font-size: 12.5px;
}

/* -------------------------------------------------------------------- Pagination */

.pager {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin: 42px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.pager-link {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 48%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.pager-link:hover {
  border-color: var(--primary);
  text-decoration: none;
}

.pager-next {
  margin-left: auto;
  text-align: right;
}

.pager-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.pager-title {
  font-size: 14px;
  font-weight: 600;
}

/* -------------------------------------------------------------------- Accueil */

.hero {
  padding: 34px 0 30px;
  border-bottom: 1px solid var(--line);
}

.hero-kicker {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(30px, 4.4vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.hero-text {
  max-width: 760px;
  margin: 0 0 14px;
  font-size: 17px;
  color: var(--text-muted);
}

.hero-meta {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.home-section {
  margin: 34px 0 0;
}

.home-section > h2 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

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

.card {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
}

.card ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.card li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
  color: var(--text);
  font-size: 14px;
}

.card li:last-child a {
  border-bottom: 0;
}

.card li a:hover {
  color: var(--primary);
  text-decoration: none;
}

.card li a .icon {
  width: 15px;
  height: 15px;
  opacity: 0.4;
}

/* -------------------------------------------------------------------- Pied */

.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  padding: 18px 26px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
}

.footer a {
  color: var(--text-muted);
}

.footer-sep {
  opacity: 0.5;
}

.footer-internal {
  color: var(--primary);
  font-weight: 600;
}

.back-to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.back-to-top.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* -------------------------------------------------------------------- Responsive */

@media (max-width: 1240px) {
  .layout {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 900px) {
  .menu-button {
    display: inline-flex;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    top: 58px;
    bottom: 0;
    left: 0;
    z-index: 50;
    width: min(86vw, 330px);
    background: var(--surface);
    border-right: 1px solid var(--line);
    transform: translateX(-102%);
    transition: transform 180ms ease;
  }

  body.nav-open .sidebar {
    transform: none;
    box-shadow: var(--shadow);
  }

  .content {
    padding: 18px 18px 60px;
  }

  .brand-sub,
  .topbar-link {
    display: none;
  }

  .search {
    flex: 1 1 auto;
    max-width: none;
    order: 5;
    width: 100%;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .pager {
    flex-direction: column;
  }

  .pager-link {
    max-width: none;
  }

  .pager-next {
    text-align: left;
  }
}

@media print {
  .topbar,
  .sidebar,
  .toc,
  .pager,
  .footer,
  .back-to-top,
  .search {
    display: none !important;
  }

  .layout {
    display: block;
  }

  .content {
    padding: 0;
  }

  body {
    background: #fff;
    color: #000;
  }
}
