/**
 * GMod4Life BaseWars — Wiki Règlement « Code des pirates »
 * Documentation type GitBook, thème One Piece (tokens : theme.css)
 */

.docs-body {
  min-height: 100vh;
}

.docs-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: calc(100vh - var(--nav-h, 66px));
  max-width: 1400px;
  margin: 0 auto;
}

/* ---------- Bouton menu (mobile) ---------- */
.docs-sidebar-toggle {
  display: none;
  position: sticky;
  top: calc(var(--nav-h, 66px) + 8px);
  z-index: 5;
  margin: 12px 16px 0;
  height: 42px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hover);
  background: var(--glass-strong);
  color: var(--gold2);
  font-weight: 800;
  font-size: 0.86rem;
  box-shadow: var(--shadow);
}

/* ---------- Sidebar (sommaire) ---------- */
.docs-sidebar {
  border-right: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 22px 14px 40px;
  position: sticky;
  top: var(--nav-h, 66px);
  height: calc(100vh - var(--nav-h, 66px));
  overflow: auto;
}

.docs-sidebar-head {
  padding: 0 8px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.docs-brand {
  display: block;
  text-decoration: none;
  color: inherit;
  margin-bottom: 14px;
}
.docs-brand-kicker {
  display: block;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}
.docs-brand strong {
  font-family: var(--brand);
  font-size: 1.45rem;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--gold2);
  text-shadow: 0 2px 0 #7a5410, 0 4px 14px rgba(0, 0, 0, 0.5);
}

.docs-search input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f4b942' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 12px center / 16px 16px no-repeat,
    rgba(0, 0, 0, 0.28);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.docs-search input::placeholder { color: var(--text3); }
.docs-search input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

.docs-nav-label {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text3);
  margin: 0 8px 8px;
}

.docs-nav {
  display: grid;
  gap: 2px;
}

.docs-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text2);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  border-left: 2px solid transparent;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.docs-nav-emoji {
  flex: 0 0 auto;
  font-size: 1.05rem;
  line-height: 1;
  width: 1.4em;
  text-align: center;
}
.docs-nav-text {
  flex: 1;
  min-width: 0;
}
a.docs-nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.docs-nav-link.is-active {
  color: var(--gold2);
  background: var(--gold-soft);
  border-left-color: var(--gold);
}
.docs-nav-link.is-disabled {
  opacity: 0.5;
  cursor: default;
}
.docs-nav-link em {
  font-style: normal;
  font-size: 0.66rem;
  color: var(--accent2);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-left: auto;
}

.docs-title-emoji {
  margin-right: 0.35em;
}
.docs-page-emoji {
  display: block;
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: 4px;
}

/* ---------- Zone principale ---------- */
.docs-main {
  min-width: 0;
  padding: 32px 32px 90px;
}

.docs-article-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 32px;
  align-items: start;
  max-width: 1020px;
}

/* Article : carte sombre à liseré or, ambiance parchemin discrète */
.docs-article {
  position: relative;
  padding: 30px 34px 34px;
  border-radius: var(--radius);
  background:
    radial-gradient(ellipse 60% 40% at 100% 0%, var(--gold-soft), transparent 55%),
    var(--glass);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  box-shadow: var(--shadow);
}
.docs-article::before {
  /* filet intérieur façon parchemin */
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px dashed var(--border);
  border-radius: calc(var(--radius) - 6px);
  pointer-events: none;
}

.docs-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text3);
  margin-bottom: 18px;
}
.docs-breadcrumb a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 700;
}
.docs-breadcrumb a:hover { color: var(--gold2); text-decoration: underline; text-underline-offset: 3px; }

.docs-article-head h1 {
  font-family: var(--display);
  font-size: clamp(1.7rem, 3.5vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 12px;
  color: var(--text);
}
.docs-lead {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text2);
  margin: 0 0 12px;
  max-width: 60ch;
}
.docs-meta {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text3);
  margin: 0 0 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.docs-kicker {
  margin: 0 0 8px;
}

/* ---------- Prose lisible ---------- */
.docs-prose {
  position: relative;
  font-size: 1.02rem;
  line-height: 1.8;
  color: var(--text2);
  max-width: 70ch;
}
.docs-prose h1,
.docs-prose h2,
.docs-prose h3,
.docs-prose h4 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  scroll-margin-top: calc(var(--nav-h, 66px) + 24px);
  line-height: 1.25;
}
.docs-prose h1 { font-size: 1.55rem; margin: 1.8em 0 0.6em; }
.docs-prose h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.28rem;
  margin: 2em 0 0.65em;
  padding-top: 0.6em;
  border-top: 1px solid var(--border);
}
.docs-prose h2::before {
  content: '';
  flex: 0 0 auto;
  width: 6px;
  height: 1.1em;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--gold2), var(--gold));
  box-shadow: 0 0 10px var(--gold-glow);
}
.docs-prose h2:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.docs-prose h3 { font-size: 1.08rem; margin: 1.5em 0 0.5em; color: var(--gold2); }
.docs-prose h4 { font-size: 0.98rem; margin: 1.3em 0 0.4em; }
.docs-prose p { margin: 0 0 1.05em; }
.docs-prose ul,
.docs-prose ol {
  margin: 0 0 1.1em;
  padding-left: 1.4em;
}
.docs-prose li { margin: 0.4em 0; }
.docs-prose li::marker { color: var(--gold); font-weight: 700; }
.docs-prose a { color: var(--gold2); text-decoration: underline; text-underline-offset: 3px; }
.docs-prose a:hover { color: var(--gold); }
.docs-prose strong { color: var(--text); font-weight: 700; }
.docs-prose blockquote {
  margin: 1.2em 0;
  padding: 14px 18px;
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--gold-soft);
  color: var(--text2);
}
.docs-prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 1em 0;
  border: 1px solid var(--border);
}
.docs-prose hr {
  border: 0;
  height: 6px;
  margin: 1.8em 0;
  border-radius: 3px;
  background: repeating-linear-gradient(-45deg, #c99a44 0 6px, #a97a2c 6px 12px);
  opacity: 0.45;
}
.docs-prose .ql-align-center { text-align: center; }
.docs-prose .ql-align-right { text-align: right; }
.docs-prose .ql-align-justify { text-align: justify; }
.docs-prose .ql-align-left { text-align: left; }

.docs-prose code,
.wiki-editor .ql-editor code {
  font-family: ui-monospace, 'JetBrains Mono', Consolas, monospace;
  font-size: 0.88em;
  padding: 0.12em 0.45em;
  border-radius: 6px;
  background: var(--gold-soft);
  border: 1px solid var(--border);
  color: var(--gold2);
}
.docs-prose pre,
.wiki-editor .ql-editor pre {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  color: var(--text);
  overflow-x: auto;
  margin: 1em 0;
}
.docs-prose pre code { background: transparent; border: 0; padding: 0; color: inherit; }

/* ---------- Encadrés wiki (callouts) ---------- */
.docs-prose .wiki-callout,
.wiki-editor .wiki-callout {
  position: relative;
  margin: 1.25em 0;
  padding: 14px 16px 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  border-left: 4px solid var(--sea);
  background: var(--sea-soft);
  color: var(--text2);
}
.docs-prose .wiki-callout--info,
.wiki-editor .wiki-callout--info {
  border-left-color: var(--sea);
  background: var(--sea-soft);
}
.docs-prose .wiki-callout--tip,
.wiki-editor .wiki-callout--tip {
  border-left-color: var(--sea);
  background: var(--sea-soft);
}
.docs-prose .wiki-callout--warn,
.wiki-editor .wiki-callout--warn {
  border-left-color: var(--gold);
  background: var(--gold-soft);
}
.docs-prose .wiki-callout--danger,
.wiki-editor .wiki-callout--danger {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}
.docs-prose .wiki-callout--success,
.wiki-editor .wiki-callout--success {
  border-left-color: var(--success);
  background: rgba(45, 212, 160, 0.12);
}
.docs-prose .wiki-callout strong,
.wiki-editor .wiki-callout strong { color: var(--text); }
.docs-prose .wiki-callout p:last-child,
.wiki-editor .wiki-callout p:last-child { margin-bottom: 0; }

/* Emojis / stickers wiki */
.docs-prose img.wiki-emoji-img,
.wiki-editor .ql-editor img.wiki-emoji-img,
.rich-content img.wiki-emoji-img {
  display: inline-block;
  width: 1.35em;
  height: 1.35em;
  vertical-align: -0.25em;
  margin: 0 0.1em;
  border: 0;
  border-radius: 0;
  cursor: default;
}
.docs-prose img.wiki-sticker-img,
.wiki-editor .ql-editor img.wiki-sticker-img,
.rich-content img.wiki-sticker-img {
  display: block;
  max-width: min(280px, 100%);
  height: auto;
  margin: 0.8em 0;
  border-radius: var(--radius-sm);
}

/* ---------- Outline droite (sur cette page) ---------- */
.docs-outline {
  position: sticky;
  top: calc(var(--nav-h, 66px) + 24px);
  padding-left: 8px;
}
.docs-outline-label {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 10px;
}
.docs-outline-nav {
  display: grid;
  gap: 2px;
  border-left: 1px solid var(--border-hover);
}
.docs-outline-link {
  display: block;
  padding: 5px 0 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text3);
  text-decoration: none;
  line-height: 1.35;
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: color var(--ease), border-color var(--ease);
}
.docs-outline-link:hover {
  color: var(--gold2);
  border-left-color: var(--gold);
}
.docs-outline-link.level-3 {
  padding-left: 22px;
  font-size: 0.74rem;
  font-weight: 500;
}

/* ---------- Pager (chapitre précédent / suivant) ---------- */
.docs-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.docs-pager-link {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(12, 21, 38, 0.6);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--ease), background var(--ease), transform var(--ease);
}
.docs-pager-link:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
  transform: translateY(-2px);
}
.docs-pager-link span {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}
.docs-pager-link strong {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.35;
}
.docs-pager-next { text-align: right; }

/* ---------- Hub (accueil du règlement + recherche) ---------- */
.docs-hub {
  max-width: 900px;
  margin: 0 auto;
}
.docs-hub-head {
  margin-bottom: 32px;
}
.docs-hub-head h1 {
  font-family: var(--brand);
  font-size: clamp(2.3rem, 5.5vw, 3.6rem);
  letter-spacing: 0.02em;
  line-height: 1;
  margin: 0;
  color: var(--gold2);
  text-shadow: 0 2px 0 #9a6a10, 0 4px 0 #6d4a0b, 0 8px 22px rgba(0, 0, 0, 0.55);
}
.docs-hub-head .docs-lead { margin: 0; }

.docs-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.docs-page-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 20px 18px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--glass);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform var(--ease), border-color var(--ease), box-shadow var(--ease);
}
.docs-page-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--gold), var(--sea));
  opacity: 0;
  transition: opacity var(--ease);
}
a.docs-page-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}
a.docs-page-card:hover::before { opacity: 0.8; }
.docs-page-card strong {
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.35;
}
.docs-page-card span {
  font-size: 0.88rem;
  color: var(--text2);
  line-height: 1.45;
}
.docs-page-card.is-disabled {
  opacity: 0.55;
}
.docs-soon {
  color: var(--accent2) !important;
  font-weight: 800;
  font-size: 0.72rem !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- États vides ---------- */
.docs-empty,
.docs-empty-inline {
  padding: 48px 20px;
  text-align: center;
  color: var(--text2);
}
.docs-empty {
  max-width: 560px;
  margin: 40px auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--glass);
  box-shadow: var(--shadow);
}
.docs-empty h1 {
  font-family: var(--brand);
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1;
  color: var(--gold2);
  text-shadow: 0 2px 0 #9a6a10, 0 4px 0 #6d4a0b, 0 8px 22px rgba(0, 0, 0, 0.55);
  margin: 6px 0 12px;
}
.docs-empty p { margin: 0 0 22px; }
.docs-empty-inline {
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius);
  color: var(--text3);
  grid-column: 1 / -1;
}

.docs-backdrop {
  display: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .docs-article-wrap {
    grid-template-columns: 1fr;
  }
  .docs-outline { display: none; }
}

@media (max-width: 900px) {
  .docs-shell {
    grid-template-columns: 1fr;
  }
  .docs-sidebar-toggle { display: inline-flex; align-items: center; gap: 8px; }
  .docs-sidebar {
    position: fixed;
    left: 0;
    top: var(--nav-h, 66px);
    bottom: 0;
    width: min(310px, 88vw);
    height: auto;
    z-index: 40;
    background: var(--glass-strong);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 20px 0 40px rgba(0, 0, 0, 0.45);
  }
  body.docs-nav-open .docs-sidebar {
    transform: translateX(0);
  }
  body.docs-nav-open .docs-backdrop {
    display: block;
    position: fixed;
    inset: var(--nav-h, 66px) 0 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    z-index: 35;
  }
  .docs-main { padding: 16px 16px 64px; }
  .docs-article { padding: 22px 18px 26px; }
  .docs-pager { grid-template-columns: 1fr; }
  .docs-pager-next { text-align: left; }
}
