/*
 * Documentation Flexyl (docs.flexyl.me, flexyl.me/doc), mission n° 32.
 * Même langage que le site V4 et l'espace organisateurs : crème ou nuit,
 * violet Flexyl, Satoshi. Lecture d'abord : colonne de texte de 72 caractères,
 * code lisible et copiable, sommaire à gauche sur ordinateur.
 */
:root {
  color-scheme: light;
  --bg: #f5f2ed;
  --card: #ffffff;
  --card-2: #faf8f6;
  --border: rgba(42, 31, 54, 0.11);
  --border-strong: rgba(42, 31, 54, 0.2);
  --text: #241d2c;
  --muted: #5d5564;
  --dim: #6f6876;
  --accent: #6a32cf;
  --primary: #7136d8;
  --primary-hover: #6028c4;
  --tint: rgba(113, 54, 216, 0.08);
  --tint-strong: rgba(113, 54, 216, 0.14);
  --code-bg: #1d1724;
  --code-text: #efe9f7;
  --inline-code: rgba(42, 31, 54, 0.07);
  --soon: #8a5208;
  --soon-bg: rgba(186, 117, 22, 0.13);
  --radius: 14px;
  --radius-sm: 9px;
  --sans: "Satoshi", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: 16px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #100e14;
  --card: #18151e;
  --card-2: #1d1a24;
  --border: rgba(235, 226, 246, 0.1);
  --border-strong: rgba(235, 226, 246, 0.2);
  --text: #f2eef6;
  --muted: #c1bac9;
  --dim: #a59fad;
  --accent: #c9a6f5;
  --primary: #7c3aed;
  --primary-hover: #8b5cf6;
  --tint: rgba(192, 154, 242, 0.1);
  --tint-strong: rgba(192, 154, 242, 0.18);
  --code-bg: #0b0a0e;
  --inline-code: rgba(235, 226, 246, 0.1);
  --soon: #f1c27a;
  --soon-bg: rgba(241, 194, 122, 0.12);
}

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

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(ellipse at 85% -10%, var(--tint-strong), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

img {
  display: block;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

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

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

.skip-link:focus {
  top: 12px;
}

/* ------------------------------------------------------------ en-tête */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.topbar-inner,
.footer-inner,
.layout {
  width: min(100% - 2 * var(--gutter), 1180px);
  margin-inline: auto;
}

.topbar-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.brand-tag {
  padding: 3px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

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

.top-link {
  display: none;
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.top-link:hover {
  color: var(--text);
}

@media (min-width: 640px) {
  .top-link {
    display: inline-flex;
  }
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.i-sun,
:root[data-theme="dark"] .i-moon {
  display: none;
}

:root[data-theme="dark"] .i-sun {
  display: block;
}

@media (max-width: 400px) {
  .brand-tag {
    display: none;
  }
}

/* ------------------------------------------------------------ mise en page */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  padding-block: 24px 64px;
}

.content {
  min-width: 0;
}

.content:focus {
  outline: none;
}

@media (min-width: 960px) {
  .layout:not(.layout--single) {
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 48px;
    padding-top: 40px;
  }
}

.toc {
  display: grid;
  gap: 12px;
  align-content: start;
}

@media (min-width: 960px) {
  .toc {
    position: sticky;
    top: 84px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding-right: 4px;
  }
}

.toc-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.toc-box summary {
  min-height: 46px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
}

.toc-box ul {
  margin: 0;
  padding: 0 8px 10px;
  list-style: none;
}

.toc-box li a {
  display: block;
  padding: 6px 8px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
  text-decoration: none;
}

.toc-box li.lvl-3 a {
  padding-left: 20px;
  font-size: 0.85rem;
}

.toc-box li a:hover,
.toc-box li a[aria-current] {
  background: var(--tint);
  color: var(--text);
}

.toc-box li a[aria-current] {
  font-weight: 700;
}

.search {
  display: block;
  padding: 0 12px 8px;
}

.search input {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}

.no-match {
  margin: 0;
  padding: 0 16px 12px;
  color: var(--dim);
  font-size: 0.85rem;
}

/* ------------------------------------------------------------ boutons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn svg {
  flex: none;
  width: 18px;
  height: 18px;
}

.btn-sm {
  min-height: 40px;
  padding: 0 12px;
  font-size: 0.88rem;
}

.btn-block {
  width: 100%;
  padding-block: 10px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-ghost {
  border-color: var(--border-strong);
  background: var(--card);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--tint);
}

/* ------------------------------------------------------------ texte */

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
}

.prose {
  max-width: 76ch;
}

.prose h1,
.hub h1 {
  margin: 0 0 14px;
  font-size: clamp(1.9rem, 5vw, 2.7rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-wrap: balance;
}

.hub h1 em {
  font-style: normal;
  color: var(--accent);
}

.prose h2 {
  margin: 44px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.prose h3 {
  margin: 30px 0 10px;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.35;
}

.prose h2,
.prose h3 {
  position: relative;
}

.anchor {
  position: absolute;
  left: -1.1em;
  color: var(--dim);
  text-decoration: none;
  opacity: 0;
}

.prose h2:hover .anchor,
.prose h3:hover .anchor {
  opacity: 1;
}

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 14px;
}

.prose ul,
.prose ol {
  padding-left: 22px;
}

.prose li {
  margin: 4px 0;
}

.prose li > ul,
.prose li > ol {
  margin: 4px 0 0;
}

.prose li::marker {
  color: var(--accent);
}

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

.prose blockquote {
  margin: 18px 0;
  padding: 14px 18px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--tint);
}

.lede {
  max-width: 64ch;
  color: var(--muted);
  font-size: 1.08rem;
}

:not(pre) > code {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--inline-code);
  font-family: var(--mono);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

.code {
  position: relative;
  margin: 16px 0;
  border-radius: var(--radius-sm);
  background: var(--code-bg);
}

.code[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 12px;
  left: 16px;
  color: #a69bb4;
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.code pre {
  margin: 0;
  padding: 50px 16px 16px;
  overflow-x: auto;
  color: var(--code-text);
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.6;
}

.code pre:focus-visible {
  outline-offset: -2px;
}

.copy {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 7px;
  background: #2a2333;
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.copy:hover {
  background: #3a3146;
}

.copy.is-done {
  border-color: #7ad9a0;
  color: #b8f0cc;
}

.table {
  margin: 16px 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
}

.table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.table th,
.table td {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.table thead th {
  border-top: 0;
  background: var(--card-2);
  font-size: 0.84rem;
}

.table td:first-child {
  white-space: nowrap;
}

@media (max-width: 600px) {
  .table td:first-child {
    white-space: normal;
  }
}

.skill-callout {
  display: grid;
  gap: 14px;
  margin: 20px 0 8px;
  padding: 18px;
  border: 1px solid var(--tint-strong);
  border-radius: var(--radius);
  background:
    radial-gradient(ellipse at 100% 0%, var(--tint-strong), transparent 60%),
    var(--card);
}

.skill-callout strong {
  display: block;
}

.skill-callout span {
  color: var(--muted);
  font-size: 0.95rem;
}

.skill-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ------------------------------------------------------------ accueil */

.hub {
  max-width: 980px;
  margin-inline: auto;
  padding-top: 16px;
}

.hub-cards {
  display: grid;
  gap: 14px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 760px) {
  .hub-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.hub-card {
  display: grid;
  gap: 8px;
  align-content: start;
  height: 100%;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
}

a.hub-card {
  border-color: var(--tint-strong);
}

a.hub-card:hover {
  border-color: var(--accent);
}

.hub-card > span:not(.hub-icon):not(.hub-more):not(.hub-actions) {
  color: var(--muted);
  font-size: 0.95rem;
}

.hub-card strong {
  font-size: 1.15rem;
}

.hub-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 4px;
  border-radius: 12px;
  background: var(--tint-strong);
  color: var(--accent);
}

.hub-icon svg {
  width: 24px;
  height: 24px;
}

.hub-more {
  margin-top: 6px;
  color: var(--accent);
  font-weight: 700;
}

.hub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.hub-card.is-soon {
  border-style: dashed;
  background: var(--card-2);
}

.hub-card.is-soon .hub-icon {
  background: var(--soon-bg);
  color: var(--soon);
}

.soon {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--soon-bg);
  color: var(--soon);
  font-size: 0.75rem;
  vertical-align: middle;
}

.hub-start {
  margin-top: 36px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.hub-start h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.hub-start ol {
  margin: 0;
  padding-left: 22px;
}

.hub-start li::marker {
  color: var(--accent);
  font-weight: 700;
}

/* ------------------------------------------------------------ pied */

.footer {
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  padding-block: 18px 26px;
  color: var(--muted);
  font-size: 0.88rem;
}
