/* ==========================================================
   BIENVENU — Stylesheet pour les pages légales
   ========================================================== */

:root {
  --cream: #f5efe6;
  --cream-warm: #ede4d3;
  --ivory: #faf6ef;
  --paper: #fcfaf5;
  --terracotta: #c8593a;
  --terracotta-deep: #a04428;
  --olive: #4a5d3a;
  --olive-deep: #2f3d24;
  --olive-soft: #6b7d5b;
  --charcoal: #2a2520;
  --charcoal-soft: #4a4338;
  --sand: #d9c9a9;
  --rose: #e8b4a0;
  --success: #4f8a5c;
  --success-bg: #e9f1ea;
  --info: #3a5a8a;
  --info-bg: #e9eef5;
  --warn: #c87a14;
  --warn-bg: #fdf3e8;
  --shadow-sm: 0 2px 8px rgba(42, 37, 32, 0.05);
  --shadow-md: 0 8px 24px rgba(42, 37, 32, 0.08);
  --shadow-lg: 0 30px 80px rgba(42, 37, 32, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Manrope', system-ui, sans-serif;
  color: var(--charcoal);
  background: var(--paper);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ==================== NAV ==================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252, 250, 245, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(42, 37, 32, 0.06);
}

.nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.brand-mark {
  width: 36px; height: 36px; background: var(--ivory); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden; padding: 4px;
  border: 1px solid var(--cream-warm); box-shadow: 0 2px 8px rgba(42,37,32,.12);
  transform: rotate(-6deg);
}
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand-name {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.brand-name .dot { color: var(--terracotta); }

.nav-back {
  font-size: 13px;
  font-weight: 500;
  color: var(--charcoal-soft);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}
.nav-back:hover { color: var(--charcoal); }
.nav-back svg { transition: transform 0.15s; }
.nav-back:hover svg { transform: translateX(-2px); }

/* ==================== LAYOUT ==================== */
.page {
  position: relative;
  padding: 60px 32px 100px;
  background:
    radial-gradient(ellipse 600px 400px at 80% 0%, rgba(232, 180, 160, 0.25) 0%, transparent 60%),
    radial-gradient(ellipse 500px 400px at 0% 100%, rgba(217, 201, 169, 0.3) 0%, transparent 60%),
    var(--paper);
  min-height: calc(100vh - 64px);
}

.layout {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 60px;
  align-items: flex-start;
}

/* ==================== TOC SIDEBAR ==================== */
.toc {
  position: sticky;
  top: 100px;
  align-self: start;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  padding-right: 12px;
}

.toc-label {
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--terracotta);
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--cream-warm);
}

.toc-list {
  list-style: none;
  padding: 0;
}
.toc-list li {
  margin-bottom: 4px;
}
.toc-list a {
  display: block;
  padding: 6px 10px;
  border-left: 2px solid transparent;
  margin-left: -10px;
  font-size: 13px;
  color: var(--charcoal-soft);
  text-decoration: none;
  line-height: 1.4;
  transition: all 0.15s;
  border-radius: 0 6px 6px 0;
}
.toc-list a:hover {
  background: var(--cream);
  color: var(--charcoal);
  border-left-color: var(--sand);
}
.toc-list a.active {
  background: var(--cream);
  color: var(--terracotta);
  border-left-color: var(--terracotta);
  font-weight: 600;
}

/* ==================== ARTICLE ==================== */
.article {
  max-width: 720px;
  background: var(--ivory);
  border: 1px solid var(--cream-warm);
  border-radius: 18px;
  padding: 48px 56px;
  box-shadow: var(--shadow-sm);
}

.article-header {
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--cream-warm);
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--terracotta);
  font-weight: 700;
  margin-bottom: 16px;
}

.article h1 {
  font-family: 'Fraunces', serif;
  font-size: 44px;
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}
.article h1 .italic {
  font-style: italic;
  color: var(--terracotta);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--charcoal-soft);
}
.article-meta .last-update {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.article-meta .last-update::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
}
.article-meta .version {
  padding: 3px 10px;
  background: var(--cream);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* ==================== CONTENT TYPOGRAPHY ==================== */
.content h2 {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-top: 48px;
  margin-bottom: 16px;
  color: var(--charcoal);
  scroll-margin-top: 100px;
}
.content h2:first-child { margin-top: 0; }
.content h2 .italic { font-style: italic; }

.content h3 {
  font-family: 'Fraunces', serif;
  font-size: 19px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-top: 28px;
  margin-bottom: 10px;
  color: var(--charcoal);
}

.content h4 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-top: 20px;
  margin-bottom: 8px;
  color: var(--charcoal);
}

.content p {
  margin-bottom: 18px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--charcoal);
}

.content strong {
  font-weight: 600;
  color: var(--charcoal);
}

.content em {
  font-style: italic;
}

.content a {
  color: var(--terracotta);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  transition: color 0.15s;
}
.content a:hover {
  color: var(--terracotta-deep);
}

/* Lists */
.content ul, .content ol {
  margin-bottom: 18px;
  padding-left: 0;
  list-style: none;
}

.content ul li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 8px;
  line-height: 1.65;
}
.content ul li::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 12px;
  width: 6px;
  height: 6px;
  background: var(--terracotta);
  border-radius: 50%;
}

.content ol {
  counter-reset: list;
}
.content ol li {
  position: relative;
  padding-left: 32px;
  margin-bottom: 10px;
  counter-increment: list;
  line-height: 1.65;
}
.content ol li::before {
  content: counter(list);
  position: absolute;
  left: 0;
  top: 1px;
  width: 22px;
  height: 22px;
  background: var(--cream);
  color: var(--terracotta);
  border-radius: 50%;
  font-family: 'Fraunces', serif;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==================== TABLES ==================== */
.content table {
  width: 100%;
  margin: 24px 0;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--paper);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--cream-warm);
}

.content table thead {
  background: var(--cream);
}

.content table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--olive-deep);
  border-bottom: 1px solid var(--cream-warm);
}

.content table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--cream-warm);
  vertical-align: top;
  line-height: 1.5;
}

.content table tr:last-child td {
  border-bottom: none;
}

.content table tr:hover td {
  background: rgba(245, 239, 230, 0.5);
}

/* ==================== CALLOUTS ==================== */
.callout {
  margin: 28px 0;
  padding: 22px 26px;
  border-radius: 14px;
  border-left: 3px solid var(--terracotta);
  background: var(--cream);
}

.callout.summary {
  background: linear-gradient(135deg, #2f3d24 0%, #1f2a16 100%);
  color: var(--ivory);
  border-left: none;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.callout.summary::after {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(200, 89, 58, 0.25) 0%, transparent 70%);
  border-radius: 50%;
}

.callout.summary .callout-title {
  color: var(--rose);
}

.callout.summary p,
.callout.summary li {
  color: var(--ivory);
  position: relative;
  z-index: 1;
}

.callout.summary strong {
  color: #FFB088;
}

.callout.summary ul li::before {
  background: var(--rose);
}

.callout.summary a {
  color: var(--rose);
}

.callout.warn {
  background: var(--warn-bg);
  border-left-color: var(--warn);
}

.callout.info {
  background: var(--info-bg);
  border-left-color: var(--info);
}

.callout-title {
  font-family: 'Fraunces', serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  color: var(--terracotta);
  display: flex;
  align-items: center;
  gap: 8px;
}

.callout p:last-child { margin-bottom: 0; }

/* ==================== ARTICLE FOOTER ==================== */
.article-footer {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--cream-warm);
  font-size: 13px;
  color: var(--charcoal-soft);
  font-style: italic;
  font-family: 'Fraunces', serif;
  text-align: center;
}

/* ==================== RELATED LINKS ==================== */
.related-docs {
  max-width: 1180px;
  margin: 60px auto 0;
  padding: 0 32px;
}

.related-title {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-bottom: 20px;
  text-align: center;
}
.related-title .italic { font-style: italic; }

.related-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.related-card {
  display: block;
  padding: 18px 20px;
  background: var(--ivory);
  border: 1px solid var(--cream-warm);
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.related-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--sand);
}

.related-card.current {
  background: var(--cream);
  border-color: var(--terracotta);
}

.related-card .related-eyebrow {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--olive);
  opacity: 0.7;
  font-weight: 700;
  margin-bottom: 4px;
}

.related-card .related-name {
  font-family: 'Fraunces', serif;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.related-card.current .related-name {
  color: var(--terracotta);
}

/* ==================== FOOTER ==================== */
footer {
  background: var(--charcoal);
  color: var(--ivory);
  padding: 40px 0;
  margin-top: 80px;
}

.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(250, 246, 239, 0.6);
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  color: rgba(250, 246, 239, 0.85);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--ivory); }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .toc {
    position: static;
    max-height: none;
    padding-right: 0;
    background: var(--ivory);
    border: 1px solid var(--cream-warm);
    border-radius: 14px;
    padding: 20px 24px;
  }

  .article {
    padding: 32px 28px;
  }

  .article h1 { font-size: 32px; }
  .content h2 { font-size: 22px; }

  .related-grid {
    grid-template-columns: 1fr 1fr;
  }

  .nav-inner { padding: 14px 20px; }
  .page { padding: 32px 16px 60px; }
  .footer-inner { padding: 0 20px; flex-direction: column; text-align: center; }
}

@media (max-width: 500px) {
  .related-grid { grid-template-columns: 1fr; }
}

/* ==================== PRINT ==================== */
@media print {
  body { background: white; font-size: 12px; }
  .nav, .toc, .related-docs, footer { display: none; }
  .page { padding: 0; background: white; }
  .layout { display: block; }
  .article {
    max-width: none;
    border: none;
    box-shadow: none;
    padding: 0;
    background: white;
  }
  .article h1 { font-size: 28px; }
  .content h2 { font-size: 18px; page-break-after: avoid; }
  .content h3 { page-break-after: avoid; }
  .content table { page-break-inside: avoid; }
  .callout {
    background: white;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
  .callout.summary { background: white; color: black; }
  .callout.summary p, .callout.summary li, .callout.summary strong { color: black; }
  a { color: var(--charcoal); text-decoration: none; border-bottom: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 10px; color: #666; }
}
