/* ==========================================================================
   BOUSSOLE QC — Design system
   Concept : "atlas civique" — plaques de données inspirées des relevés
   d'arpentage et de la signalisation autoroutière québécoise.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Archivo+Condensed:wght@600;700&family=Archivo:wght@800;900&family=Public+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --paper: #F6F7F9;
  --paper-raised: #FFFFFF;
  --ink: #0B1526;
  --ink-soft: #3C4759;
  --blue: #1B4D8F;
  --blue-deep: #0F2E57;
  --blue-pale: #E8EEF6;
  --amber: #E8A33D;
  --amber-deep: #B87A1E;
  --line: #D3D8E0;
  --line-soft: #E4E7EC;
  --green: #2F6B4F;
  --green-pale: #E6F0EA;
  --red: #B24A3C;
  --red-pale: #F6E9E7;

  --display: 'Archivo', system-ui, sans-serif;
  --display-cond: 'Archivo Condensed', system-ui, sans-serif;
  --body: 'Public Sans', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;

  --max: 1180px;
  --radius: 2px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--blue); text-decoration-thickness: 1.5px; text-underline-offset: 2px; }
a:hover { color: var(--blue-deep); }

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  color: var(--ink);
}
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1.1em; }
.lede { font-size: 1.2rem; color: var(--ink-soft); max-width: 62ch; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 74ch; margin: 0 auto; padding: 0 24px; }

/* focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ---------- coordinate-style eyebrow ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 0.9em;
}
.eyebrow::before { content: '§'; color: var(--amber-deep); font-weight: 600; }

/* ---------- header / nav ---------- */
.site-header {
  border-bottom: 3px solid var(--ink);
  background: var(--paper-raised);
  position: sticky; top: 0; z-index: 40;
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; padding-bottom: 14px; gap: 20px;
}
.brand {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.3rem;
  color: var(--ink);
  text-decoration: none;
  display: flex; align-items: center; gap: 10px;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 30px; height: 30px;
  background: var(--blue);
  position: relative;
  flex: none;
}
.brand-mark::after {
  content: '';
  position: absolute; inset: 6px;
  border: 2px solid var(--amber);
}
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a {
  font-family: var(--display-cond);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--radius);
}
.main-nav a:hover, .main-nav a.active { background: var(--blue-pale); color: var(--blue-deep); }

.nav-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border: 2px solid var(--ink);
  background: white;
  cursor: pointer;
  flex: none;
}
.nav-toggle svg { width: 20px; height: 20px; }

@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .main-nav {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--paper-raised);
    border-bottom: 3px solid var(--ink);
    flex-direction: column;
    gap: 0;
    padding: 8px 20px 16px;
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 12px 4px; border-bottom: 1px solid var(--line-soft); border-radius: 0; }
  .site-header { position: sticky; }
}

/* ---------- hero ---------- */
.hero {
  background: var(--blue-deep);
  color: white;
  padding: 64px 0 56px;
  position: relative;
  overflow: hidden;
  border-bottom: 3px solid var(--ink);
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 42px 42px;
  pointer-events: none;
}
.hero .container { position: relative; }
.hero .eyebrow { color: var(--amber); }
.hero h1 { color: white; max-width: 15ch; }
.hero .lede { color: rgba(255,255,255,0.82); }

/* ---------- data plate (signature component) ---------- */
.plate {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  position: relative;
  padding: 20px 18px;
}
.plate::before, .plate::after,
.plate-corner-bl::before, .plate-corner-br::after { content: ''; }
.plate::before {
  position: absolute; top: -1px; left: -1px;
  width: 10px; height: 10px;
  border-top: 2px solid var(--amber); border-left: 2px solid var(--amber);
}
.plate::after {
  position: absolute; bottom: -1px; right: -1px;
  width: 10px; height: 10px;
  border-bottom: 2px solid var(--amber); border-right: 2px solid var(--amber);
}
.plate-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.plate-value {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.9rem;
  color: var(--ink);
  line-height: 1.1;
}
.plate-value .unit { font-size: 1rem; color: var(--ink-soft); font-weight: 500; }
.plate-note { font-size: 0.85rem; color: var(--ink-soft); margin-top: 6px; }
.plate.tone-blue { background: var(--blue-deep); border-color: var(--blue-deep); }
.plate.tone-blue .plate-value, .plate.tone-blue .plate-label { color: white; }
.plate.tone-blue .plate-note { color: rgba(255,255,255,0.7); }
.plate.tone-good .plate-value { color: var(--green); }
.plate.tone-warn .plate-value { color: var(--red); }

.plate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin: 28px 0;
}

/* ---------- route line (waypoint connector motif) ---------- */
.route-line {
  display: flex; align-items: center; gap: 0;
  margin: 40px 0; overflow-x: auto; padding-bottom: 6px;
}
.route-line a {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  padding: 6px 14px 6px 0;
  position: relative;
}
.route-line a::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--blue);
  margin-right: 8px;
  vertical-align: middle;
}
.route-line a:not(:last-child)::after {
  content: '';
  display: inline-block;
  width: 26px; height: 1px;
  background: var(--line);
  margin: 0 6px;
  vertical-align: middle;
}
.route-line a:hover { color: var(--blue); }
.route-line a.current { color: var(--ink); font-weight: 600; }
.route-line a.current::before { background: var(--amber); }

/* ---------- sections ---------- */
.section { padding: 52px 0; border-top: 1px solid var(--line-soft); }
.section:first-child { border-top: none; }
.section-head { max-width: 68ch; margin-bottom: 24px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--display-cond);
  font-weight: 700; font-size: 1rem; letter-spacing: 0.01em;
  padding: 12px 22px;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: white;
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius);
}
.btn:hover { background: var(--blue-deep); border-color: var(--blue-deep); color: white; }
.btn-amber { background: var(--amber); border-color: var(--amber-deep); color: var(--ink); }
.btn-amber:hover { background: var(--amber-deep); border-color: var(--amber-deep); color: white; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: white; }

/* ---------- cards (guides / cities index) ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card {
  display: block; text-decoration: none; color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--line);
  padding: 22px;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--blue); transform: translateY(-2px); }
.card h3 { color: var(--ink); margin-bottom: 6px; }
.card p { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 0; }
.card .card-tag {
  font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase;
  color: var(--blue); letter-spacing: 0.06em; margin-bottom: 10px; display: block;
}

/* ---------- featured cards (page Guides) ---------- */
.card-grid-featured { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-bottom: 8px; }
.card-featured {
  padding: 30px 26px;
  background: linear-gradient(160deg, var(--blue-pale), var(--paper-raised) 65%);
  border: 1px solid var(--blue);
  position: relative;
}
.card-featured::before {
  content: "★ En vedette";
  position: absolute; top: 14px; right: 16px;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.05em;
  color: var(--blue-deep); text-transform: uppercase;
}
.card-featured h3 { font-size: 1.25rem; margin-top: 6px; }
.card-featured p { font-size: 1rem; }
.card-featured:hover { border-color: var(--blue-deep); transform: translateY(-3px); }

/* ---------- sélecteur de profil (page d'accueil) ---------- */
.profil-selecteur { border-bottom: 1px solid var(--line); }
.profil-label { font-family: var(--display-cond); font-weight: 700; font-size: 0.95rem; margin-bottom: 12px; }
.profil-boutons { display: flex; gap: 10px; flex-wrap: wrap; }
.profil-btn {
  font-family: var(--body); font-size: 0.9rem; font-weight: 600; cursor: pointer;
  padding: 9px 18px; border: 1px solid var(--line); background: var(--paper-raised);
  color: var(--ink); border-radius: var(--radius); transition: border-color .15s, background .15s, color .15s;
}
.profil-btn:hover { border-color: var(--blue); }
.profil-btn.is-active { background: var(--blue); border-color: var(--blue); color: white; }
.profil-btn-reset { background: transparent; border-style: dashed; }
.profil-cta {
  margin-top: 16px; padding: 14px 18px; background: var(--blue-pale);
  border-left: 4px solid var(--blue); font-size: 0.92rem;
}
.profil-cta a { font-weight: 600; }
[data-profil].is-hidden { display: none; }

/* ---------- quiz "où vivre" ---------- */
.quiz-q { margin-bottom: 26px; }
.quiz-q:last-child { margin-bottom: 0; }
.quiz-q label { display: block; font-family: var(--display-cond); font-weight: 700; font-size: 1.05rem; margin-bottom: 12px; }
.quiz-options { display: flex; flex-wrap: wrap; gap: 10px; }
.quiz-opt {
  font-family: var(--body); font-size: 0.92rem; cursor: pointer;
  padding: 11px 18px; border: 1px solid var(--line); background: var(--paper);
  color: var(--ink); border-radius: var(--radius); text-align: left;
  transition: border-color .15s, background .15s, color .15s;
}
.quiz-opt:hover { border-color: var(--blue); }
.quiz-opt.is-active { background: var(--blue); border-color: var(--blue); color: white; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { font-family: var(--display-cond); font-weight: 700; letter-spacing: 0.02em; background: var(--blue-pale); color: var(--blue-deep); }
td.num, th.num { font-family: var(--mono); text-align: right; }
tr:last-child td { border-bottom: 2px solid var(--ink); }

/* ---------- callouts ---------- */
.callout { border-left: 4px solid var(--blue); background: var(--blue-pale); padding: 16px 20px; margin: 24px 0; }
.callout.warn { border-color: var(--amber-deep); background: #FBF3E4; }
.callout.danger { border-color: #B91C1C; background: #FDECEC; }
.callout p:last-child { margin-bottom: 0; }
.callout-title { font-family: var(--display-cond); font-weight: 700; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.05em; color: var(--blue-deep); margin-bottom: 6px; }
.callout.warn .callout-title { color: var(--amber-deep); }
.callout.danger .callout-title { color: #B91C1C; }

.disclaimer { font-size: 0.85rem; color: var(--ink-soft); border-top: 1px solid var(--line); padding-top: 16px; margin-top: 32px; }

/* ---------- guide feedback (mailto, pas de backend) ---------- */
.guide-feedback { margin-top: 20px; padding: 18px 20px; background: var(--paper-raised); border: 1px solid var(--line); }
.guide-feedback-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.guide-feedback-label { font-family: var(--display-cond); font-weight: 700; font-size: 0.95rem; }
.guide-feedback-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-feedback {
  font-family: var(--body); font-size: 0.85rem; font-weight: 600;
  padding: 7px 16px; border: 1px solid var(--line); background: transparent;
  color: var(--ink); text-decoration: none; border-radius: var(--radius);
  transition: border-color .15s, color .15s, background .15s;
}
.btn-feedback:hover { border-color: var(--blue); color: var(--blue-deep); background: var(--blue-pale); }
.guide-feedback-report { display: inline-block; font-size: 0.82rem; color: var(--ink-soft); text-decoration-color: var(--line); }
.guide-feedback-report:hover { color: var(--blue-deep); }

/* ---------- checklist (cases à cocher) ---------- */
.checklist-items { list-style: none; margin: 20px 0; padding: 0; }
.checklist-items li { border-bottom: 1px solid var(--line-soft); padding: 4px 0; }
.checklist-items label { display: flex; align-items: flex-start; gap: 12px; padding: 10px 4px; cursor: pointer; line-height: 1.45; }
.checklist-items input[type="checkbox"] { accent-color: var(--blue); width: 19px; height: 19px; margin-top: 2px; flex: none; cursor: pointer; }
.checklist-items label:has(input:checked) { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: var(--line); }
.checklist-items a { text-decoration-line: underline; }

/* ---------- verdict tags ---------- */
.tag { display: inline-block; font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 3px 9px; border: 1px solid currentColor; }
.tag-good { color: var(--green); }
.tag-warn { color: var(--red); }
.tag-neutral { color: var(--blue); }

/* ---------- forms (calculateur) ---------- */
.calc-panel { background: var(--paper-raised); border: 1px solid var(--line); padding: 28px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-family: var(--display-cond); font-weight: 700; font-size: 0.9rem; margin-bottom: 6px; }
.field input, .field select {
  width: 100%; font-family: var(--mono); font-size: 1.05rem;
  padding: 11px 12px; border: 1px solid var(--line); background: var(--paper);
  border-radius: var(--radius);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }
.result-block { display: none; margin-top: 28px; }
.result-block.show { display: block; }
.field-choice { display: flex; gap: 18px; flex-wrap: wrap; }
.field-choice label { display: flex; align-items: center; gap: 7px; font-family: var(--body); font-weight: 400; font-size: 0.98rem; cursor: pointer; text-transform: none; letter-spacing: normal; }
.field-choice input[type="radio"] { accent-color: var(--blue); width: 17px; height: 17px; cursor: pointer; }

/* ---------- ad slots ---------- */
.ad-slot {
  display: none;
  background: repeating-linear-gradient(45deg, #EEF0F3, #EEF0F3 10px, #E7E9ED 10px, #E7E9ED 20px);
  border: 1px dashed var(--line);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.75rem;
  text-align: center;
  padding: 18px;
  margin: 32px 0;
}
/* Une fois le placeholder texte remplacé par le vrai code AdSense (voir README),
   ce sélecteur masque automatiquement le conteneur si Google n'y injecte aucune
   annonce (ex: pas d'inventaire, ad-block, ou avant l'approbation du compte) —
   évite un rectangle vide et visible sur le site en production. */
.ad-slot:empty { display: none; margin: 0; padding: 0; border: none; }

/* ---------- footer ---------- */
.site-footer { background: var(--ink); color: rgba(255,255,255,0.75); padding: 44px 0 28px; margin-top: 60px; }
.site-footer a { color: white; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 28px; margin-bottom: 28px; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-grid h4 { color: white; font-family: var(--display-cond); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 7px; font-size: 0.9rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.15); padding-top: 18px; font-size: 0.8rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* ---------- recherche interne ---------- */
.search-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border: 2px solid var(--ink);
  background: white;
  cursor: pointer;
  flex: none;
}
.search-toggle svg { width: 18px; height: 18px; }
.search-panel {
  display: none;
  position: absolute; top: 100%; right: 0; left: 0;
  background: var(--paper-raised);
  border-bottom: 3px solid var(--ink);
  padding: 16px 20px;
  z-index: 50;
}
.search-panel.open { display: block; }
.search-panel input {
  width: 100%;
  font-family: var(--mono);
  font-size: 1.1rem;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.search-results { margin-top: 10px; max-height: 60vh; overflow-y: auto; display: none; }
.search-results.show { display: block; }
.search-result {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 8px;
  text-decoration: none;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
}
.search-result:hover { background: var(--blue-pale); }
.search-result strong { font-family: var(--display-cond); font-size: 0.98rem; }
.search-result span { font-size: 0.82rem; color: var(--ink-soft); }
.search-empty { padding: 14px 8px; color: var(--ink-soft); font-size: 0.9rem; }

/* ---------- capture de courriel (infolettre) ---------- */
.newsletter-box {
  background: var(--blue-deep);
  color: white;
  padding: 32px;
  margin: 40px 0;
  position: relative;
}
.newsletter-box::before {
  content: '';
  position: absolute; top: -1px; left: -1px;
  width: 14px; height: 14px;
  border-top: 3px solid var(--amber); border-left: 3px solid var(--amber);
}
.newsletter-box h3 { color: white; font-size: 1.3rem; margin-bottom: 8px; }
.newsletter-box p { color: rgba(255,255,255,0.8); margin-bottom: 18px; font-size: 0.95rem; }
.newsletter-form { display: flex; gap: 10px; flex-wrap: wrap; }
.newsletter-form input[type="email"] {
  flex: 1; min-width: 200px;
  font-family: var(--mono); font-size: 1rem;
  padding: 12px 14px; border: none;
}
.newsletter-form button {
  font-family: var(--display-cond); font-weight: 700; font-size: 1rem;
  padding: 12px 24px; border: 2px solid var(--amber);
  background: var(--amber); color: var(--ink); cursor: pointer;
}
.newsletter-form button:hover { background: var(--amber-deep); border-color: var(--amber-deep); color: white; }
.newsletter-note { font-size: 0.78rem; color: rgba(255,255,255,0.55); margin-top: 12px; margin-bottom: 0; }

/* ---------- ligne du temps (immigration) ---------- */
.timeline { list-style: none; margin: 24px 0; padding: 0; border-left: 3px solid var(--line); }
.timeline-step { position: relative; padding: 4px 0 28px 28px; }
.timeline-step::before {
  content: ""; position: absolute; left: -9px; top: 6px;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--paper); border: 3px solid var(--blue);
}
.timeline-step.done::before { background: var(--green); border-color: var(--green); }
.timeline-step.done { opacity: 0.6; }
.timeline-step-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.timeline-step-title { font-family: var(--display-cond); font-weight: 700; font-size: 1.15rem; }
.timeline-step-delai { font-family: var(--mono); font-size: 0.85rem; color: var(--blue-deep); background: var(--blue-pale); padding: 2px 8px; }

/* ---------- utility ---------- */
.mt-0 { margin-top: 0; }
.text-soft { color: var(--ink-soft); }
.mono { font-family: var(--mono); }
.center { text-align: center; }
