/* ==========================================================================
   WeRefund — Section documentation
   Hub · article · référence d'API · changelog
   --------------------------------------------------------------------------
   🔴 EN BLANC, comme tout le site (D4). La référence dont ce gabarit s'inspire
   est sombre ; ce n'est pas ce qui a été retenu. Les surfaces techniques —
   blocs de code — gardent un fond sombre, parce qu'un éditeur l'est : c'est
   une convention de lecture, pas un thème.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Sous-navigation de la doc
   -------------------------------------------------------------------------- */

.subnav {
  position: sticky;
  top: 0;
  z-index: 90;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-hair);
}
.subnav__inner { display: flex; align-items: center; gap: 26px; height: 54px; }
.subnav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  color: var(--ink-muted);
  font-size: var(--fs-xs);
  font-weight: 500;
  transition: color var(--dur) var(--ease);
}
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { color: var(--ink); }
.subnav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

/* --------------------------------------------------------------------------
   Hub
   -------------------------------------------------------------------------- */

.docs-hero { display: grid; justify-items: center; text-align: center; padding-block: clamp(52px, 6vw, 88px) clamp(40px, 5vw, 64px); }
.docs-hero h1 { margin-top: 26px; max-width: 18ch; }
.docs-hero .lede { margin-top: 20px; max-width: 46ch; }
.docs-shortcuts { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 26px; color: var(--ink-muted); font-size: var(--fs-2xs); }
.docs-shortcuts a {
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink-body);
  font-weight: 500;
  transition: background-color var(--dur) var(--ease);
}
.docs-shortcuts a:hover { background: var(--surface-3); }

.docs-sec { padding-block: clamp(34px, 4vw, 56px); }
.docs-sec h2 { font-size: var(--fs-h3); }
.docs-sec > * + .docs-grid { margin-top: 30px; }

.docs-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.docs-card {
  display: flex;
  flex-direction: column;
  padding: 22px;
  border-radius: var(--r-xl);
  background: var(--bg);
  border: 1px solid var(--line-soft);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.docs-card:hover { transform: translateY(-4px); box-shadow: var(--sh-lg); }
.docs-card__art {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  border: 1px solid var(--line-hair);
}
.docs-card__art svg { width: 128px; height: 128px; color: var(--ink-faint); }
.docs-card h3 { margin-top: 22px; font-size: var(--fs-lg); }
.docs-card p { margin-top: 8px; color: var(--ink-muted); font-size: var(--fs-xs); }
.docs-card .link-arrow { margin-top: 18px; }

.docs-support { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.docs-support__card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 22px 24px;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  border: 1px solid var(--line-hair);
}
.docs-support__card i { display: grid; place-items: center; width: 46px; height: 46px; border-radius: var(--r-pill); background: var(--bg); color: var(--ink-body); box-shadow: var(--sh-sm); }
.docs-support__card i svg { width: 20px; height: 20px; }
.docs-support__card b { display: block; color: var(--ink); font-size: var(--fs-sm); }
.docs-support__card p { margin-top: 3px; color: var(--ink-muted); font-size: var(--fs-2xs); }

/* --------------------------------------------------------------------------
   Article de documentation
   -------------------------------------------------------------------------- */

.doc-layout {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr) 240px;
  gap: 0;
  align-items: start;
}
.doc-side {
  position: sticky;
  top: calc(var(--nav-h) + 54px);
  max-height: calc(100vh - var(--nav-h) - 70px);
  overflow-y: auto;
  padding: 32px 26px 40px 0;
  border-right: 1px solid var(--line-hair);
}
.doc-side::-webkit-scrollbar { width: 6px; }
.doc-side::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }

.doc-group + .doc-group { margin-top: 26px; }
.doc-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 0;
  color: var(--ink);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: -.012em;
}
.doc-group__head svg { width: 13px; height: 13px; color: var(--ink-faint); transition: transform var(--dur) var(--ease); }
.doc-group__head[aria-expanded="false"] svg { transform: rotate(-90deg); }
.doc-group__list { display: grid; gap: 1px; margin-top: 10px; border-left: 1.5px solid var(--line); }
.doc-group__head[aria-expanded="false"] + .doc-group__list { display: none; }
.doc-group__list a {
  display: grid;
  /* Rico, 19/09 : la pastille fait 46 px de large au minimum ; à 20 px elle passait sous le libellé. */
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-left: -1.5px;
  border-left: 1.5px solid transparent;
  color: var(--ink-muted);
  font-size: var(--fs-xs);
  line-height: 1.35;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.doc-group__list a svg { width: 15px; height: 15px; color: var(--ink-faint); }
.doc-group__list a:hover { color: var(--ink); }
.doc-group__list a[aria-current="page"] { color: var(--accent-ink); border-left-color: var(--accent); font-weight: 500; }
.doc-group__list a[aria-current="page"] svg { color: var(--accent-ink); }

.doc-main { padding: 32px 44px 64px; min-width: 0; }
.doc-kicker { color: var(--ink-muted); font-size: var(--fs-xs); }
.doc-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: start; margin-top: 10px; }
.doc-head h1 { font-size: clamp(1.875rem, 1.4rem + 1.6vw, 2.5rem); }
.doc-head + p { margin-top: 16px; color: var(--ink-soft); font-size: var(--fs-md); max-width: 54ch; }
.doc-copy { display: inline-flex; align-items: center; }
.doc-copy button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding-inline: 16px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-body);
  font-size: var(--fs-xs);
  font-weight: 500;
}
.doc-copy button:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.doc-copy button:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; border-left: 0; padding-inline: 11px; }
.doc-copy button:hover { background: var(--surface-1); }
.doc-copy svg { width: 15px; height: 15px; }

.doc-rule { height: 1px; margin: 34px 0; background: var(--line-hair); }

/* Table de matières de droite */
.doc-toc {
  position: sticky;
  top: calc(var(--nav-h) + 78px);
  max-height: calc(100vh - var(--nav-h) - 96px);
  overflow-y: auto;
  padding: 32px 0 40px;
}

/* --------------------------------------------------------------------------
   Corps technique : tableaux, encadrés, code
   -------------------------------------------------------------------------- */

.doc-table-wrap { overflow-x: auto; margin-top: 24px; border-radius: var(--r-md); border: 1px solid var(--line); }
.doc-table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: var(--fs-xs); }
.doc-table th, .doc-table td { padding: 14px 18px; text-align: left; }
.doc-table thead th { background: var(--surface-1); color: var(--ink); font-weight: 600; }
.doc-table tbody tr { border-top: 1px solid var(--line-hair); }
.doc-table td { color: var(--ink-soft); }
.doc-table td:first-child { color: var(--ink); font-weight: 500; }

.note {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 13px;
  margin-top: 24px;
  padding: 16px 18px;
  border-radius: var(--r-md);
  font-size: var(--fs-xs);
  line-height: 1.6;
}
.note svg { width: 18px; height: 18px; margin-top: 2px; }
.note--info { background: var(--surface-1); border: 1px solid var(--line); color: var(--ink-body); }
.note--info svg { color: var(--ink-muted); }
.note--warn { background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--ink-body); }
.note--warn svg { color: var(--warn); }
.note b { color: var(--ink); }

/* Bloc de code — fond sombre assumé : c'est la convention d'un éditeur, pas
   un thème de page. Le contraste du texte y est calculé pour ce fond-là. */
.code {
  margin-top: 24px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid #23262E;
  background: #14161B;
}
.code__bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid #23262E;
}
.code__tabs { display: flex; align-items: center; gap: 4px; }
.code__tab {
  padding: 7px 13px;
  border-radius: var(--r-sm);
  color: #8A93A6;
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.code__tab:hover { color: #D7DCE5; }
.code__tab[aria-selected="true"],
.code__tab.is-current { background: #232732; color: #FFFFFF; }
.code__copy { margin-left: auto; display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r-sm); color: #8A93A6; }
.code__copy:hover { background: #232732; color: #FFFFFF; }
.code__copy svg { width: 15px; height: 15px; }
.code pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.75;
  color: #D7DCE5;
}
.code pre[hidden] { display: none; }
/* Zone defilante atteignable au clavier : le contour se dessine DEDANS, le bloc
   coupe ce qui depasse (overflow hidden). */
.code pre:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 0; }
.code .k { color: var(--accent); }   /* mot-clé   */
.code .s { color: #7EE0A2; }   /* chaîne    */
.code .n { color: #FFC978; }   /* nombre    */
.code .c { color: #6B7486; }   /* commentaire */
.code .p { color: #79C0FF; }   /* propriété */

.doc-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  margin-top: 52px;
  padding: 22px 26px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  color: var(--ink-body);
  font-size: var(--fs-xs);
}
.doc-foot a { display: inline-flex; align-items: center; gap: 9px; font-weight: 500; }
.doc-foot a:hover { color: var(--ink); }
.doc-foot svg { width: 13px; height: 13px; color: var(--ink-faint); }
.doc-foot .sep { width: 1px; height: 20px; background: var(--line); }

/* --------------------------------------------------------------------------
   Référence d'API
   -------------------------------------------------------------------------- */

.method {
  display: inline-grid;
  place-items: center;
  min-width: 46px;
  height: 20px;
  padding-inline: 7px;
  border-radius: var(--r-xs);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .04em;
}
.method--get    { background: rgba(22, 163, 74, .13);  color: var(--ok); }
.method--post   { background: var(--accent-soft);  color: var(--accent-ink); }
.method--patch  { background: rgba(217, 119, 6, .15);  color: var(--warn); }
.method--delete { background: rgba(220, 38, 38, .12);  color: var(--risk); }

.api-layout { display: grid; grid-template-columns: 268px minmax(0, 1fr) minmax(0, .82fr); align-items: start; }
.api-main { padding: 32px 40px 64px; min-width: 0; }
.api-code { position: sticky; top: calc(var(--nav-h) + 78px); padding: 32px 0 40px; display: grid; gap: 18px; }

.endpoint {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 26px;
  padding: 12px 12px 12px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg);
}
.endpoint code { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink); overflow-x: auto; }
/* Rico, 19/09 : le bouton de copie reprend le gris habituel des boutons discrets, plus le vert ni le rouge. */
.endpoint .copy {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-soft);
  transition: background-color var(--dur, .2s) var(--ease, ease), color var(--dur, .2s) var(--ease, ease);
}
.endpoint .copy:hover { background: var(--surface-3); color: var(--ink); }
.endpoint .copy svg { width: 16px; height: 16px; }

.param { padding-block: 22px; border-top: 1px solid var(--line-hair); }
.param__head { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.param__head b { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink); font-weight: 500; }
.param__type { color: var(--ink-muted); font-size: var(--fs-2xs); }
.param__req {
  padding: 3px 8px;
  border-radius: var(--r-xs);
  background: var(--risk-soft);
  color: var(--risk);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.param__opt { background: var(--surface-2); color: var(--ink-muted); }
.param p { margin-top: 10px; color: var(--ink-soft); font-size: var(--fs-xs); line-height: 1.6; }

.resp__tabs { display: flex; gap: 4px; padding: 8px 10px; border-bottom: 1px solid #23262E; }

/* --------------------------------------------------------------------------
   Changelog
   -------------------------------------------------------------------------- */

.log-entry {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 60px);
  padding-block: clamp(34px, 4vw, 56px);
  border-top: 1px solid var(--line-hair);
}
.log-entry:first-of-type { border-top: 0; }
.log-meta { position: sticky; top: calc(var(--nav-h) + 78px); align-self: start; }
.log-date {
  display: inline-flex;
  padding: 8px 15px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: var(--fs-xs);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.log-tags { display: grid; gap: 8px; margin-top: 18px; }
.log-tags span { color: var(--ink-muted); font-size: var(--fs-xs); }
.log-body h2 { font-size: var(--fs-h3); }
.log-body h2:not(:first-child) { margin-top: 44px; }
.log-body ul { margin-top: 18px; display: grid; gap: 11px; }
.log-body li {
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr);
  gap: 14px;
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  line-height: 1.6;
}
.log-body li::before {
  content: "";
  width: 5px; height: 5px;
  margin-top: 9px;
  border-radius: var(--r-pill);
  background: var(--ink-faint);
}
.log-body code, .log-body kbd {
  padding: 2px 7px;
  border-radius: var(--r-xs);
  background: var(--surface-2);
  border: 1px solid var(--line-hair);
  font-family: var(--font-mono);
  font-size: .84em;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Adaptatif
   -------------------------------------------------------------------------- */

@media (max-width: 1240px) {
  .doc-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .doc-toc { display: none; }
  .api-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .api-code { position: static; grid-column: 2; padding-top: 0; }
}

@media (max-width: 980px) {
  .doc-layout, .api-layout { grid-template-columns: 1fr; }
  .doc-side {
    position: static;
    max-height: none;
    padding: 20px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line-hair);
  }
  .doc-main, .api-main { padding-inline: 0; }
  .api-code { grid-column: 1; }
  .docs-grid { grid-template-columns: 1fr; }
  .docs-support { grid-template-columns: 1fr; }
  .log-entry { grid-template-columns: 1fr; gap: 20px; }
  .log-meta { position: static; }
}

@media (max-width: 760px) {
  .doc-head { grid-template-columns: 1fr; }
  .subnav__inner { gap: 18px; overflow-x: auto; }
}

/* --------------------------------------------------------------------------
   Plateforme annoncée, pas encore branchée (Shopify, 15/09) : grisée dans la
   documentation seulement, avec la mention « Coming soon ». Ailleurs sur le
   site, Shopify se présente comme les autres plateformes.
   -------------------------------------------------------------------------- */
.doc-soon { color: var(--ink-faint); white-space: nowrap; }
/* inline, pas inline-block : une boîte atomique ouvre une coupure de ligne
   après elle, et la virgule qui suit tombait seule au début de la ligne. */
.doc-soon small {
  display: inline;
  margin-left: 3px;
  padding: 0 7px;
  border: 1px solid var(--line-hair);
  border-radius: 999px;
  color: var(--ink-faint);
  font-size: .78em;
  font-weight: 500;
  line-height: 1.6;
  vertical-align: 1px;
  white-space: nowrap;
}
