/* =============================================================================
   GUIDE PLOMBERIE BRUXELLES - CSS OPTIMISÉ
   Design unifié, aucun débordement horizontal
   ============================================================================= */

/* -----------------------------------------------------------------------------
   DESIGN TOKENS
----------------------------------------------------------------------------- */
:root {
  /* Couleurs */
  --bg: #0b1220;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --text: #0b1220;
  --muted: #5a6776;
  --border: #e6ebf2;
  --brand: #0b5ed7;
  --brand-2: #0a58ca;
  --warning-bg: #fff3cd;
  --warning-bd: #ffe69c;
  --ok-bg: #e8f5e9;
  --ok-bd: #c8e6c9;

  /* Dimensions */
  --radius: 14px;
  --shadow: 0 10px 30px rgba(11, 18, 32, 0.08);
  --max: 1050px;
  --reading: 72ch;
  --spacing: 1rem;

  /* Accessibilité */
  --focus: 3px solid rgba(11, 94, 215, 0.35);
  --min-touch: 44px;
}

/* -----------------------------------------------------------------------------
   BASE & RESET - ANTI-DÉBORDEMENT GLOBAL
----------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  min-width: 0; /* Permet la réduction dans flex/grid */
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden; /* Sécurité anti-débordement */
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: #f2f5fa;
  overflow-x: hidden; /* Sécurité anti-débordement */
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* -----------------------------------------------------------------------------
   TYPOGRAPHIE
----------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

h1 {
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

h2 {
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  margin: 1.2rem 0 0.5rem;
}

h3 {
  font-size: clamp(1rem, 2vw, 1.05rem);
  margin: 1rem 0 0.35rem;
}

p {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* -----------------------------------------------------------------------------
   LIENS & FOCUS
----------------------------------------------------------------------------- */
a {
  color: var(--brand);
  text-decoration: none;
  word-break: break-word;
}

a:hover {
  color: var(--brand-2);
  text-decoration: underline;
}

a:focus,
button:focus,
summary:focus,
input:focus,
textarea:focus {
  outline: var(--focus);
  outline-offset: 3px;
}

/* -----------------------------------------------------------------------------
   LAYOUT & CONTAINER - SYSTÈME UNIFIÉ
----------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--max);
  padding-left: 1rem;
  padding-right: 1rem;
  margin-left: auto;
  margin-right: auto;
}

.reading {
  max-width: var(--reading);
}

main {
  padding: 1.25rem 0 2.5rem;
  width: 100%;
  overflow-x: hidden;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--spacing);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

@media (min-width: 980px) {
  .grid {
    grid-template-columns: 1fr 360px;
  }
}

/* -----------------------------------------------------------------------------
   SKIP LINK (ACCESSIBILITÉ)
----------------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 2px solid var(--brand);
  border-radius: 12px;
  z-index: 9999;
  font-weight: bold;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* -----------------------------------------------------------------------------
   HEADER & NAVIGATION
----------------------------------------------------------------------------- */
header.site-header {
  background: var(--bg);
  color: #fff;
  width: 100%;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 0;
  flex-wrap: wrap;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #fff;
  min-height: var(--min-touch);
  flex: 1 1 auto;
  min-width: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

.brand-title {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
  overflow: hidden;
}

.brand-title strong {
  font-weight: 800;
  font-size: clamp(0.9rem, 2vw, 1rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-title span {
  font-size: clamp(0.8rem, 1.8vw, 0.9rem);
  opacity: 0.85;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Navigation Toggle */
.nav-toggle {
  display: none;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  color: #fff;
  min-height: var(--min-touch);
  min-width: var(--min-touch);
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle .bars {
  display: grid;
  gap: 4px;
}

.nav-toggle .bars span {
  width: 18px;
  height: 2px;
  background: #fff;
  display: block;
  border-radius: 2px;
}

/* Navigation principale */
nav.site-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

nav.site-nav a {
  color: #fff;
  text-decoration: none;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  min-height: var(--min-touch);
  display: flex;
  align-items: center;
  transition: background 0.15s ease;
  white-space: nowrap;
}

nav.site-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Navigation mobile */
@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  nav.site-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 70px;
    background: var(--bg);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.75rem 1rem 1rem;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    width: 100%;
  }

  header.site-header.is-open nav.site-nav {
    display: flex;
  }

  nav.site-nav a {
    white-space: normal;
  }
}

/* -----------------------------------------------------------------------------
   CARDS & COMPONENTS - SYSTÈME UNIFIÉ
----------------------------------------------------------------------------- */
.card,
.hero,
.alert,
.callout,
.ok,
.toc,
details {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(0.9rem, 2vw, 1rem);
  box-shadow: var(--shadow);
}

.hero {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1rem, 2.5vw, 1.25rem);
  box-shadow: var(--shadow);
}

.hero p {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

/* -----------------------------------------------------------------------------
   BREADCRUMB
----------------------------------------------------------------------------- */
.breadcrumb {
  font-size: 0.95rem;
  margin: 0.2rem 0 1rem;
  width: 100%;
}

.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  padding: 0;
  margin: 0;
}

.breadcrumb li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.breadcrumb li + li::before {
  content: '›';
  color: var(--muted);
}

/* -----------------------------------------------------------------------------
   TABLE OF CONTENTS
----------------------------------------------------------------------------- */
.toc {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(0.8rem, 2vw, 0.9rem);
}

.toc h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1rem, 2vw, 1.05rem);
}

.toc ul {
  margin: 0;
  padding-left: 1.1rem;
}

.toc li {
  margin: 0.25rem 0;
}

.toc a {
  text-decoration: none;
  word-break: break-word;
}

.toc a:hover {
  text-decoration: underline;
}

/* -----------------------------------------------------------------------------
   CALLOUTS & ALERTS
----------------------------------------------------------------------------- */
.callout,
.alert {
  background: var(--warning-bg);
  border: 1px solid var(--warning-bd);
  border-radius: var(--radius);
  padding: clamp(0.8rem, 2vw, 0.85rem) clamp(0.9rem, 2.5vw, 1rem);
  margin: 1rem 0;
}

.callout.ok,
.ok {
  background: var(--ok-bg);
  border: 1px solid var(--ok-bd);
  border-radius: var(--radius);
  padding: clamp(0.8rem, 2vw, 0.9rem) clamp(0.9rem, 2.5vw, 1rem);
}

.callout strong,
.alert strong {
  font-weight: 900;
}

/* -----------------------------------------------------------------------------
   LISTS
----------------------------------------------------------------------------- */
ul,
ol {
  padding-left: 1.1rem;
  margin: 0.5rem 0;
}

li {
  margin: 0.25rem 0;
}

/* -----------------------------------------------------------------------------
   DETAILS (FAQ)
----------------------------------------------------------------------------- */
details {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  margin: 0.55rem 0;
}

summary {
  cursor: pointer;
  font-weight: 800;
  list-style: none;
  min-height: var(--min-touch);
  display: flex;
  align-items: center;
}

summary::-webkit-details-marker {
  display: none;
}

details[open] summary {
  margin-bottom: 0.4rem;
}

/* -----------------------------------------------------------------------------
   TABLES - SYSTÈME SÉCURISÉ
----------------------------------------------------------------------------- */
.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  margin: 1rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 100%;
}

@media (min-width: 520px) {
  table {
    min-width: 520px;
  }
}

th,
td {
  padding: clamp(0.5rem, 1.5vw, 0.65rem) clamp(0.6rem, 2vw, 0.75rem);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: auto;
}

th {
  background: var(--surface-2);
  font-weight: 900;
  font-size: clamp(0.85rem, 1.8vw, 0.95rem);
}

td {
  font-size: clamp(0.85rem, 1.8vw, 0.95rem);
}

tr:last-child td {
  border-bottom: 0;
}

/* -----------------------------------------------------------------------------
   FOOTER
----------------------------------------------------------------------------- */
footer {
  padding: 2rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.95rem;
  width: 100%;
}

/* -----------------------------------------------------------------------------
   UTILITY CLASSES
----------------------------------------------------------------------------- */
.small {
  font-size: clamp(0.85rem, 1.8vw, 0.95rem);
}

.muted {
  color: var(--muted);
}

.fake-link {
  color: var(--brand);
  text-decoration: underline;
  cursor: default;
}

/* -----------------------------------------------------------------------------
   DOSSIERS (HUB) - DESIGN UNIFIÉ ET SÉCURISÉ
----------------------------------------------------------------------------- */
.dossiers-block {
  width: 100%;
}

.dossiers-block .muted {
  margin-top: 6px;
  margin-bottom: 12px;
}

.dossiers-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(10px, 2vw, 12px);
  margin-top: 10px;
  width: 100%;
}

/* Card principale - Design mobile-first */
.dossier-card {
  display: block;
  position: relative;
  padding: clamp(12px, 2.5vw, 14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-decoration: none;
  color: inherit;
  border-left: 4px solid rgba(13, 110, 253, 0.22);
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.dossier-card:hover {
  transform: translateY(-1px);
  border-color: rgba(13, 110, 253, 0.28);
  background: var(--surface);
  text-decoration: none;
}

.dossier-card:focus-visible {
  outline: 3px solid rgba(13, 110, 253, 0.35);
  outline-offset: 2px;
}

/* Header avec icône et badge */
.dossier-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

/* Icône à gauche */
.dossier-icon {
  display: inline-flex;
  width: clamp(36px, 8vw, 40px);
  height: clamp(36px, 8vw, 40px);
  border-radius: 12px;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  background: rgba(13, 110, 253, 0.1);
  border: 1px solid rgba(13, 110, 253, 0.14);
  flex-shrink: 0;
}

.dossier-icon svg {
  display: block;
  width: clamp(20px, 4vw, 22px);
  height: clamp(20px, 4vw, 22px);
}

/* Badge à droite */
.dossier-badge {
  display: none;
  font-size: clamp(0.7rem, 1.5vw, 0.78rem);
  font-weight: 800;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #f6f7f9;
  color: rgba(0, 0, 0, 0.72);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Statuts badge */
.dossier-card.badge-new .dossier-badge {
  display: inline-flex;
  background: rgba(13, 110, 253, 0.1);
  color: var(--brand);
  border-color: rgba(13, 110, 253, 0.2);
}

.dossier-card.badge-updated .dossier-badge {
  display: inline-flex;
  background: rgba(25, 135, 84, 0.12);
  color: #198754;
  border-color: rgba(25, 135, 84, 0.22);
}

.dossier-card.badge-soon .dossier-badge {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.65);
  border-color: rgba(0, 0, 0, 0.1);
}

/* Contenu */
.dossier-kicker {
  display: inline-flex;
  align-items: center;
  font-size: clamp(0.7rem, 1.5vw, 0.75rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--brand);
  background: rgba(13, 110, 253, 0.1);
  margin-bottom: 6px;
}

.dossier-title {
  display: block;
  font-weight: 900;
  font-size: clamp(1rem, 2.2vw, 1.05rem);
  margin: 6px 0 4px;
  line-height: 1.3;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.dossier-desc {
  display: block;
  font-size: clamp(0.88rem, 2vw, 0.95rem);
  line-height: 1.4;
  color: var(--muted);
  margin: 4px 0 8px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.dossier-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 800;
  font-size: clamp(0.88rem, 2vw, 0.95rem);
  color: var(--brand);
  margin-top: 4px;
}

/* État désactivé */
.dossier-card.is-disabled {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}

.dossier-card.is-disabled .dossier-cta {
  color: rgba(0, 0, 0, 0.55);
}

/* -----------------------------------------------------------------------------
   IMAGES & FIGURES
----------------------------------------------------------------------------- */
.illus {
  margin: 0.8rem 0;
  width: 100%;
}

.illus img {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: block;
  background: #fff;
}

.illus figcaption {
  font-size: clamp(0.85rem, 1.8vw, 0.95rem);
  color: var(--muted);
  margin-top: 0.4rem;
  padding: 0 0.2rem;
}

/* -----------------------------------------------------------------------------
   CTA
----------------------------------------------------------------------------- */
.cta {
  background: var(--bg);
  color: #fff;
  border-radius: var(--radius);
  padding: clamp(1rem, 2.5vw, 1.1rem);
  width: 100%;
}

.cta a {
  color: #fff;
  text-decoration: underline;
}

.cta strong {
  color: #fff;
}