/* =========================================================
   VÉLO TUNNEL QUÉBEC — Feuille de styles
   Site multi-pages — épuré et informatif
   ========================================================= */

:root {
  --bg:          #faf8f4;
  --bg-alt:      #f1ede4;
  --ink:         #1a1f1c;
  --ink-soft:    #4a524d;
  --ink-mute:    #7a8079;
  --rule:        #d9d3c5;
  --accent:      #1f5135;
  --accent-soft: #2e6e4a;
  --accent-pale: #e6efe9;
  --warn:        #a83a1f;

  --font-serif:  'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-sans:   'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --maxw:        1100px;
  --gutter:      clamp(1.25rem, 4vw, 2.5rem);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ===== Typographie ===== */

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-variation-settings: "opsz" 32, "SOFT" 30;
  color: var(--ink);
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 400; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); font-weight: 500; }
h3 { font-size: clamp(1.2rem, 2vw, 1.4rem); font-weight: 600; }
h4 { font-size: 1.05rem; font-weight: 600; }

p { margin: 0 0 1em; color: var(--ink-soft); }
p strong { color: var(--ink); font-weight: 600; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s;
}
a:hover { color: var(--accent-soft); }

ul, ol {
  padding-left: 1.2em;
  margin: 0 0 1em;
  color: var(--ink-soft);
}
li { margin-bottom: 0.4em; }

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 3rem 0;
}

/* ===== Navigation ===== */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 248, 244, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}

.nav-inner {
  max-width: none;
  margin: 0;
  padding: 0.9rem var(--gutter);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav-brand { margin-right: auto; }      /* push everything else to the right */
.nav-links { order: 1; }
.nav-lang-group { order: 2; }
.nav-toggle { order: 3; }

.nav-lang-group {
  display: grid;
  grid-template-columns: repeat(5, auto);
  gap: 0.3rem;
  flex-shrink: 0;
  width: max-content;
}

.nav-brand {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.nav-brand span { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 1.3rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
}
.nav-links a {
  color: var(--ink-soft);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}
.nav-links a:hover { color: var(--accent); }
.nav-links a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 500;
}
.nav-links a.nav-lang {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 2px;
  line-height: 0;
  display: inline-flex;
}
.nav-links a.nav-lang img {
  width: 24px;
  height: 16px;
  display: block;
  object-fit: cover;
  border-radius: 2px;
}
.nav-links a.nav-lang:hover {
  border-color: var(--accent);
}
.nav-links a.nav-lang.nav-lang-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

/* ----- Two-level dropdown ----- */
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
}
.nav-item > a.has-sub::after {
  content: "\25BE";          /* ▾ */
  font-size: 0.7em;
  margin-left: 0.28rem;
  opacity: 0.55;
}
.nav-sub {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 210px;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 0.5rem 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.10);
  z-index: 60;
}
.nav-item:hover > .nav-sub,
.nav-item:focus-within > .nav-sub { display: flex; }
.nav-sub a {
  padding: 0.45rem 1.1rem;
  border-bottom: none;
  white-space: nowrap;
}
.nav-sub a:hover { color: var(--accent); }
.nav-sub a.active {
  color: var(--accent);
  border-bottom-color: transparent;
  font-weight: 600;
}
.nav-links a.trail { color: var(--accent); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.4rem 0.7rem;
  font: inherit;
  cursor: pointer;
  color: var(--ink);
}

@media (max-width: 1000px) {
  /* La marque et le bouton Menu tiennent seuls sur la 1re ligne ;
     les drapeaux de langue passent sur leur propre ligne en dessous. */
  .nav-inner { flex-wrap: wrap; row-gap: 0.7rem; }
  .nav-toggle { order: 0; }
  .nav-lang-group { order: 2; width: 100%; flex-wrap: wrap; justify-content: flex-start; }

  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    flex-direction: column;
    flex-wrap: nowrap;
    padding: 1rem var(--gutter);
    gap: 0.8rem;
    border-bottom: 1px solid var(--rule);
    /* Menu plus haut que l.ecran : on le rend defilable. */
    max-height: calc(100vh - 100%);
    max-height: calc(100dvh - 100%);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .nav-toggle { display: block; }

  /* Dropdowns expand inline on mobile */
  .nav-item {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }
  .nav-item > a.has-sub::after { display: none; }
  .nav-sub {
    display: flex;
    position: static;
    min-width: 0;
    background: none;
    border: none;
    border-left: 2px solid var(--rule);
    border-radius: 0;
    box-shadow: none;
    gap: 0.6rem;
    margin: 0.5rem 0 0.2rem;
    padding: 0 0 0 0.9rem;
  }
  .nav-sub a { padding: 0; }
}

/* ===== Layout ===== */

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

section, main {
  padding: 3.5rem 0;
}

.page-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1rem;
}

.page-header h1 { margin-bottom: 0.6rem; }

.section-eyebrow {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.8rem;
}

/* ===== Breadcrumb ===== */
.breadcrumb .container {
  padding-top: 1.1rem;
  padding-bottom: 0;
}
.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  letter-spacing: 0.01em;
}
.breadcrumb li {
  display: flex;
  align-items: center;
}
.breadcrumb a {
  color: var(--ink-mute);
  text-decoration: none;
}
.breadcrumb a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.breadcrumb [aria-current="page"] {
  color: var(--ink-soft);
  font-weight: 600;
}
.breadcrumb .sep {
  margin: 0 0.5rem;
  color: var(--rule);
}

.lead {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(1.15rem, 2vw, 1.35rem);
  line-height: 1.5;
  color: var(--ink-soft);
  margin-bottom: 2rem;
  max-width: 60ch;
}

.section-intro {
  max-width: 65ch;
  margin-bottom: 2.5rem;
}

/* ===== Hero (page d'accueil seulement) ===== */

.hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--rule);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: center;
}
@media (min-width: 880px) {
  .hero-grid { grid-template-columns: 1.1fr 1fr; gap: 3rem; }
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
  font-weight: 300;
}

.hero-sub {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  color: var(--ink-soft);
  margin-bottom: 1.8rem;
  line-height: 1.45;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  border-top: 1px solid var(--rule);
  padding-top: 1.5rem;
}
.hero-stats .stat-num {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--accent);
  line-height: 1;
  display: block;
}
.hero-stats .stat-lbl {
  font-size: 0.8rem;
  color: var(--ink-mute);
  margin-top: 0.4rem;
  display: block;
}

.hero-image img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

/* ===== Pitch (cartes 3 colonnes) ===== */

.pitch {
  background: var(--bg-alt);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.pitch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem 2rem;
  margin-top: 1.5rem;
}
.pitch-item {
  border-left: 2px solid var(--accent);
  padding-left: 1rem;
}
.pitch-item h4 {
  margin: 0 0 0.3rem;
  color: var(--accent);
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.05rem;
}
.pitch-item p {
  font-size: 0.93rem;
  margin: 0;
}

/* ===== Figures ===== */

figure {
  margin: 2rem 0;
}
figure img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
  border: 1px solid var(--rule);
}
figcaption {
  font-size: 0.85rem;
  color: var(--ink-mute);
  margin-top: 0.6rem;
  font-style: italic;
  text-align: center;
}

/* ===== Layout 2 colonnes ===== */

.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: center;
}
@media (min-width: 880px) {
  .split { grid-template-columns: 1fr 1fr; gap: 3.5rem; }
}
.split.reverse > :first-child {
  order: 2;
}
@media (max-width: 879px) {
  .split.reverse > :first-child { order: 0; }
}

.split img {
  width: 100%;
  border-radius: 4px;
}

/* ===== Grille des avantages ===== */

.benefits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem 2.5rem;
  margin-top: 2rem;
}
.benefit h3 {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 500;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.5rem;
}
.benefit h3 .icon {
  font-size: 1.05rem;
}
.benefit ul {
  list-style: none;
  padding: 0;
  font-size: 0.94rem;
}
.benefit li {
  padding-left: 1rem;
  position: relative;
  margin-bottom: 0.5rem;
  line-height: 1.5;
}
.benefit li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
}

/* ===== Encadrés ===== */

.callout {
  background: var(--accent-pale);
  border-left: 3px solid var(--accent);
  padding: 1.5rem 1.8rem;
  margin: 2rem 0;
  border-radius: 0 4px 4px 0;
}
.callout p { color: var(--ink); margin-bottom: 0; }
.callout strong { color: var(--accent); }

.callout-dark {
  background: var(--ink);
  color: var(--bg);
  padding: 2rem 2rem;
  border-radius: 4px;
  margin: 2rem 0;
}
.callout-dark p { color: var(--bg); }
.callout-dark strong { color: #c8d8ce; }
.callout-dark .big {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.2;
  margin-bottom: 0.5rem;
  color: var(--bg);
  font-weight: 400;
}

/* ===== Tableaux ===== */

.table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--rule);
  border-radius: 4px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
th, td {
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--rule);
}
th {
  background: var(--bg-alt);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }
td strong { color: var(--accent); }

/* ===== Cartes / Règles ===== */

.rules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}
.rule-card {
  border: 1px solid var(--rule);
  background: var(--bg);
  padding: 1.4rem 1.4rem 1.2rem;
  border-radius: 4px;
}
.rule-card .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.6rem;
}
.rule-card .big {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.15;
  margin-bottom: 0.4rem;
  color: var(--ink);
}
.rule-card p {
  font-size: 0.9rem;
  margin: 0;
}

a.rule-card {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.15s, transform 0.15s;
}
a.rule-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ===== Permis / interdits ===== */

.permits {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin: 2rem 0;
}
@media (min-width: 720px) {
  .permits { grid-template-columns: 1fr 1fr; }
}
.permit-col {
  padding: 1.4rem 1.6rem;
  border-radius: 4px;
}
.permit-col.allow {
  background: var(--accent-pale);
  border: 1px solid #b5cdbd;
}
.permit-col.deny {
  background: #faeae5;
  border: 1px solid #e3c8c0;
}
.permit-col h4 {
  margin-top: 0;
  margin-bottom: 0.8rem;
  font-family: var(--font-serif);
  font-size: 1.15rem;
}
.permit-col.allow h4 { color: var(--accent); }
.permit-col.deny h4 { color: var(--warn); }
.permit-col ul {
  margin: 0;
  list-style: none;
  padding: 0;
  font-size: 0.94rem;
}
.permit-col li {
  padding: 0.3rem 0;
  border-bottom: 1px dashed rgba(0,0,0,0.08);
}
.permit-col li:last-child { border-bottom: 0; }

/* ===== Boutons ===== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.3rem;
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
  border-radius: 3px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.15s;
}
.btn:hover {
  background: var(--accent-soft);
  color: var(--bg);
}
.btn svg { width: 16px; height: 16px; }

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-outline:hover {
  background: var(--accent);
  color: var(--bg);
}

/* ===== Pagination / navigation entre pages ===== */

.page-nav {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 3rem 0 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
@media (min-width: 720px) {
  .page-nav { grid-template-columns: 1fr 1fr; }
}
.page-nav-card {
  display: block;
  padding: 1.1rem 1.3rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
  background: var(--bg);
  transition: border-color 0.15s, background 0.15s;
}
.page-nav-card:hover {
  border-color: var(--accent);
  background: var(--accent-pale);
  color: inherit;
}
.page-nav-card .pn-dir {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  margin-bottom: 0.3rem;
}
.page-nav-card .pn-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--ink);
  font-weight: 500;
}
.page-nav-card.next { text-align: right; }

/* ===== Voir aussi ===== */

.see-also {
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1.5rem 1.8rem;
  margin: 2.5rem 0;
}
.see-also h4 {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.8rem;
}
.see-also-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}
@media (min-width: 600px) {
  .see-also-grid { grid-template-columns: 1fr 1fr; }
}
.see-also a {
  display: block;
  padding: 0.6rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.93rem;
}
.see-also a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== Footer ===== */

footer {
  background: var(--ink);
  color: #c8c5be;
  padding: 3.5rem 0 2rem;
  margin-top: 4rem;
}
footer .container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
@media (min-width: 720px) {
  footer .container { grid-template-columns: 2fr 1fr 1fr; }
}
footer h4 {
  color: var(--bg);
  font-family: var(--font-serif);
  font-size: 1.1rem;
  margin-bottom: 0.6rem;
  font-weight: 500;
}
footer p, footer a {
  color: #c8c5be;
  font-size: 0.92rem;
}
footer a {
  text-decoration: none;
  display: block;
  margin-bottom: 0.4rem;
}
footer a:hover { color: var(--bg); }

footer .legal {
  border-top: 1px solid #2c322e;
  padding-top: 1.5rem;
  margin-top: 2rem;
  font-size: 0.82rem;
  color: var(--ink-mute);
  text-align: center;
}

/* ===== Icône réseau social du pied de page ===== */
footer .legal .footer-social {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0 auto 1.1rem;
  border-radius: 50%;
  background: #1877F2;
  color: #fff;
  transition: background 0.2s ease, color 0.2s ease;
}
footer .legal .footer-social:hover {
  background: #0d65d9;
  color: #fff;
}
footer .legal .footer-social svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  display: block;
}
/* ===== Bannière site (site-banner) — voir banner.js / banner.json ===== */
.site-banner {
  margin: 1.1rem var(--gutter) 0;
  border: 2px solid var(--warn);
  border-radius: 6px;
  padding: 0.8rem 1.25rem;
  background: var(--bg);
}
.site-banner p {
  margin: 0;
  text-align: center;
  color: var(--warn);
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.45;
}
.site-banner a {
  color: var(--warn);
  text-decoration: underline;
}
/* ===== Bloc « Sources principales » ===== */
.sources { font-size: 0.82rem; color: var(--ink-mute); border-top: 1px solid var(--rule); padding-top: 1.2rem; margin-top: 2.5rem; }
.sources strong { color: var(--ink-soft); }
.sources a { color: inherit; text-decoration: underline; }

/* ----- Sous-menu de 3e niveau (flyout latéral) ----- */
.nav-sub .nav-item { width: 100%; }
.nav-sub .nav-item > a.has-sub { display: flex; flex: 1 1 auto; justify-content: space-between; align-items: center; }
.nav-sub .nav-item > a.has-sub::after { content: "\25B8"; margin-left: 0.6rem; opacity: 0.55; }
.nav-sub .nav-sub { top: -0.5rem; left: 100%; }

/* ----- Réseaux sociaux : deux icônes côte à côte + icône X ----- */
footer .legal .footer-social { display: inline-flex; margin: 0 0.3rem 1.1rem; vertical-align: middle; }
footer .legal .footer-social-x { background: #000; }
footer .legal .footer-social-x:hover { background: #333; }

/* ----- Sous-navigation de section (bureau) : rappelle les liens de la section
   sous le fil d'Ariane, car le menu déroulant se referme au moindre écart. ----- */
.section-subnav { display: none; }
@media (min-width: 1001px) {
  .section-subnav { display: block; border-bottom: 1px solid var(--rule); }
  .section-subnav .container { display: flex; flex-wrap: wrap; gap: 0.35rem 1.5rem; padding-top: 0.55rem; padding-bottom: 0.6rem; }
  .section-subnav a { font-size: 0.9rem; line-height: 1.3; color: var(--ink-soft); text-decoration: none; padding-bottom: 2px; border-bottom: 2px solid transparent; transition: color 0.15s ease, border-color 0.15s ease; }
  .section-subnav a:hover { color: var(--accent); }
  .section-subnav a[aria-current="page"] { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); }
}
