/* ==========================================================================
   WeekendWay — feuille de style partagée des pages juridiques (CGU, CGV,
   Politique de confidentialité, CGP, Sécurité des paiements).
   Palette alignée sur l'app (lib/core/constants/colors.dart) :
   navy #02153F, or #AC8103, fond #FAFAFA, bordures #E4E8F0.
   ========================================================================== */

:root {
  --navy: #02153f;
  --navy-2: #051a4a;
  --navy-deep: #01102e;
  --gold: #ac8103;
  --gold-light: #d9a61c;
  --bg: #fafafa;
  --card: #ffffff;
  --border: #e4e8f0;
  --text: #3c4759;
  --text-muted: #8a93a5;
  --ink: #02153f;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(2, 21, 63, 0.07);
  --shadow-sm: 0 2px 10px rgba(2, 21, 63, 0.06);
  --max-w: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ---------- Topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 17px;
  color: var(--navy);
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13.5px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--navy);
}

.btn-ghost:hover {
  background: #f1f3f8;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #fff;
  box-shadow: 0 6px 18px rgba(172, 129, 3, 0.28);
}

/* ---------- Hero ---------- */

.hero {
  background: radial-gradient(120% 160% at 15% 0%, #0a2560 0%, var(--navy) 45%, var(--navy-deep) 100%);
  color: #fff;
  padding: 64px 24px 84px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 85% 20%, rgba(172, 129, 3, 0.25), transparent 40%),
    radial-gradient(circle at 10% 90%, rgba(172, 129, 3, 0.12), transparent 45%);
  pointer-events: none;
}

.hero-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  position: relative;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-light);
  background: rgba(172, 129, 3, 0.16);
  border: 1px solid rgba(217, 166, 28, 0.35);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(28px, 4.2vw, 44px);
  font-weight: 800;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
  max-width: 720px;
}

.hero p {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.72);
  max-width: 620px;
  margin: 0 0 22px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 7px 13px;
  border-radius: 999px;
}

.doc-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
}

.doc-switch a {
  font-size: 13px;
  font-weight: 600;
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.75);
}

.doc-switch a.active {
  background: #fff;
  color: var(--navy);
  border-color: #fff;
}

.doc-switch a:not(.active):hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

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

.layout {
  max-width: var(--max-w);
  margin: -46px auto 0;
  padding: 0 24px 80px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 32px;
  position: relative;
  z-index: 2;
}

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

/* ---------- TOC ---------- */

.toc-wrap {
  position: sticky;
  top: 84px;
  align-self: start;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}

.toc-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}

.toc-card h4 {
  margin: 4px 6px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

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

.toc-group {
  margin-bottom: 4px;
}

.toc-group-title {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 10px 10px 4px;
}

.toc-card a {
  display: block;
  font-size: 13.5px;
  color: var(--text);
  padding: 7px 10px;
  border-radius: 9px;
  transition: background 0.15s ease, color 0.15s ease;
}

.toc-card a:hover {
  background: #f1f3f8;
}

.toc-card a.active {
  background: rgba(172, 129, 3, 0.12);
  color: var(--gold);
  font-weight: 700;
}

/* Mobile TOC toggle */

.toc-toggle {
  display: none;
}

@media (max-width: 900px) {
  .toc-wrap {
    position: static;
    max-height: none;
  }
  .toc-card {
    display: none;
  }
  .toc-card.open {
    display: block;
  }
  .toc-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 14px 16px;
    font-weight: 700;
    font-size: 14px;
    color: var(--navy);
    cursor: pointer;
    margin-bottom: 10px;
  }
  .toc-toggle svg {
    transition: transform 0.2s ease;
  }
  .toc-toggle.open svg {
    transform: rotate(180deg);
  }
}

/* ---------- Content ---------- */

.content-intro {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 26px 28px;
  margin-bottom: 22px;
}

.content-intro p {
  margin: 0;
  font-size: 15px;
  color: var(--text);
}

.titre-block {
  margin: 40px 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.titre-block:first-of-type {
  margin-top: 6px;
}

.titre-badge {
  flex-shrink: 0;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--navy);
  padding: 6px 12px;
  border-radius: 999px;
}

.titre-block h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

article.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px 26px;
  margin-bottom: 16px;
  scroll-margin-top: 90px;
}

article.card .card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.num-badge {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  color: var(--gold);
  background: rgba(172, 129, 3, 0.1);
  border: 1px solid rgba(172, 129, 3, 0.25);
}

article.card h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
}

article.card p {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--text);
}

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

article.card ul {
  margin: 0 0 12px;
  padding-left: 20px;
}

article.card ul:last-child {
  margin-bottom: 0;
}

article.card li {
  margin-bottom: 6px;
  font-size: 15px;
  color: var(--text);
}

article.card strong {
  color: var(--ink);
}

.def-term {
  display: inline-block;
  font-weight: 800;
  color: var(--navy);
  background: #f1f3f8;
  border-radius: 8px;
  padding: 2px 8px;
  margin: 2px 6px 8px 0;
  font-size: 13.5px;
}

.tbd {
  display: inline-block;
  color: var(--gold);
  background: rgba(172, 129, 3, 0.1);
  border: 1px dashed rgba(172, 129, 3, 0.45);
  border-radius: 6px;
  padding: 0 6px;
  font-style: normal;
  font-weight: 600;
  font-size: 0.94em;
}

/* ---------- Footer of the legal doc ---------- */

.legal-footer {
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 30px 24px 40px;
}

.legal-footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.legal-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.legal-footer-links a:hover {
  color: var(--navy);
}

.legal-footer-copy {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ---------- Back to top ---------- */

.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(2, 21, 63, 0.32);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 50;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ---------- Print ---------- */

@media print {
  .topbar,
  .toc-wrap,
  .back-to-top,
  .hero .doc-switch {
    display: none !important;
  }
  .layout {
    grid-template-columns: 1fr;
  }
}
