/* Polices Google Fonts chargées via <link rel="stylesheet"> dans le <head> de
   chaque page (après les <link rel="preconnect">) plutôt que par @import ici :
   un @import dans le CSS retarde la découverte de la police tant que ce
   fichier n'est pas lui-même téléchargé et analysé. */

/* ==========================================================================
   CalculatriceTaxes.ca : Système de design
   Concept : « reçu de taxes », document officiel, marine + or.
   1 tokens · 2 reset · 3 typographie · 4 mise en page · 5 en-tête · 6 reçu
   7 champs & bascule · 8 boutons · 9 tableau des taux · 10 contenu
   11 pied de page · 12 responsive · 13 impression
   ========================================================================== */

/* ---------- 1. Tokens ---------------------------------------------------- */
:root {
  /* Palette */
  --navy: #16233F;
  --navy-deep: #0E1830;
  --amber: #C6902F;
  --amber-light: #E4B65C;
  --paper: #FAF8F4;
  --ink: #232323;
  --ink-soft: #5B5B58;
  --green: #2E6B4F;

  /* Dérivés (teintes des couleurs ci-dessus, aucune nouvelle famille) */
  --white: #FFFFFF;
  --rule: #D9D4C9;
  --rule-strong: #B7AF9F;
  --navy-tint: rgba(22, 35, 63, 0.06);
  --amber-tint: rgba(198, 144, 47, 0.10);
  --on-navy: #E8E4DC;
  /* amber assombri pour du texte/icônes sur fond clair, 4,5:1 minimum (WCAG AA),
     l'amber de marque (--amber) ne passe pas ce ratio en texte fin */
  --amber-text: #8F6A1C;

  /* Typographie */
  --font-head: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;

  /* Mesures */
  --content: 960px;
  --gutter: 24px;
  --radius: 2px;
}

/* ---------- 2. Reset ----------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  text-align: left;
}

img,
svg { max-width: 100%; height: auto; }

a { color: var(--navy); text-underline-offset: 2px; }
a:hover { color: var(--amber-text); }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ---------- 3. Typographie ---------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--navy);
  line-height: 1.2;
  margin: 0 0 0.5em;
}

h1 { font-size: 2.25rem; letter-spacing: -0.01em; }
h2 { font-size: 1.6rem; margin-top: 2em; }
h3 { font-size: 1.2rem; margin-top: 1.6em; }

p { margin: 0 0 1.1em; }

p.lead {
  font-size: 1.075rem;
  color: var(--ink-soft);
  max-width: 68ch;
}

small,
.note {
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.num,
code,
kbd {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* le code inline (formules) casse la ligne plutôt que de déborder sur mobile */
code {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ---------- 4. Mise en page --------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

main { padding: 40px 0 64px; }

.section { margin-bottom: 48px; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--amber);
  color: var(--navy-deep);
  padding: 10px 16px;
  font-weight: 600;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- 5. En-tête --------------------------------------------------- */
.site-header {
  background: var(--navy);
  border-bottom: 3px solid var(--amber);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  flex-wrap: wrap;
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--white);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.wordmark:hover { color: var(--white); }
.wordmark .wordmark-accent { color: var(--amber-light); }
.wordmark .wordmark-tld {
  font-family: var(--font-mono);
  font-size: 0.8em;
  font-weight: 500;
  color: var(--on-navy);
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 26px;
  margin: 0;
  padding: 0;
  list-style: none;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--on-navy);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--white); border-bottom-color: var(--amber); }
.site-nav a[aria-current="page"] { color: var(--white); border-bottom-color: var(--amber); }

/* ---------- 6. Carte « reçu » ------------------------------------------- */
.receipt {
  background: var(--white);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  max-width: 560px;
  overflow: hidden;
}

.receipt-band {
  background: var(--navy-deep);
  color: var(--white);
  padding: 12px 22px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.receipt-band .receipt-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0;
  color: var(--white);
}

.receipt-band .receipt-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--amber-light);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.receipt-body { padding: 22px; }

.receipt-sep {
  border: 0;
  border-top: 1px dashed var(--rule-strong);
  margin: 16px 0;
}
.receipt-sep--tight { margin: 12px 0; }

.receipt-lines { margin: 0; }

.receipt-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
}

.receipt-line .line-label {
  font-size: 0.95rem;
  color: var(--ink);
  min-width: 0;
}

.receipt-line .line-label .line-rate {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-left: 6px;
  white-space: nowrap;
}

.receipt-line .line-dots {
  flex: 1 1 auto;
  border-bottom: 1px dotted var(--rule);
  transform: translateY(-4px);
  min-width: 12px;
}

.receipt-line .line-amount {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  font-size: 0.98rem;
  text-align: right;
  white-space: nowrap;
  color: var(--ink);
}

.receipt-line--muted .line-label,
.receipt-line--muted .line-amount { color: var(--ink-soft); }

.receipt-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 2px solid var(--navy);
}

.receipt-total .total-label {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--navy);
  letter-spacing: 0.01em;
}

.receipt-total .total-amount {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--green);
  text-align: right;
  white-space: nowrap;
}

.receipt-foot {
  border-top: 1px dashed var(--rule-strong);
  margin-top: 18px;
  padding-top: 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

/* bord inférieur dentelé, comme un ticket détaché */
.receipt-edge {
  height: 10px;
  background:
    linear-gradient(-45deg, transparent 50%, var(--white) 51%) 0 0 / 12px 10px repeat-x,
    linear-gradient(45deg, transparent 50%, var(--white) 51%) 0 0 / 12px 10px repeat-x;
  filter: drop-shadow(0 1px 0 var(--rule-strong));
  margin-top: -1px;
}

/* ---------- 7. Champs & bascule ----------------------------------------- */
.field { margin-bottom: 16px; }

.field label,
.field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.input,
select.input,
input.input {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  appearance: none;
  -webkit-appearance: none;
}
.input:focus {
  border-color: var(--navy);
  outline: 2px solid var(--amber);
  outline-offset: 0;
}

.input-money {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--white);
}
.input-money:focus-within {
  border-color: var(--navy);
  outline: 2px solid var(--amber);
}
.input-money .money-symbol {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--navy-tint);
  border-right: 1px solid var(--rule-strong);
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--ink-soft);
}
.input-money input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.25rem;
  color: var(--ink);
}
.input-money input:focus { outline: none; }

select.input {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--navy) 50%),
    linear-gradient(135deg, var(--navy) 50%, transparent 50%);
  background-position: calc(100% - 19px) calc(50% + 1px), calc(100% - 13px) calc(50% + 1px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

/* bascule à deux boutons */
.toggle {
  display: flex;
  border: 1px solid var(--navy);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}

.toggle .toggle-btn {
  flex: 1 1 50%;
  padding: 11px 12px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--navy);
  background: var(--white);
  border: 0;
  cursor: pointer;
  text-align: center;
}
.toggle .toggle-btn + .toggle-btn { border-left: 1px solid var(--navy); }
.toggle .toggle-btn:hover { background: var(--amber-tint); }
.toggle .toggle-btn[aria-pressed="true"],
.toggle .toggle-btn.is-active {
  background: var(--navy);
  color: var(--white);
}
.toggle .toggle-btn[aria-pressed="true"]:hover,
.toggle .toggle-btn.is-active:hover { background: var(--navy-deep); }

/* ---------- 8. Boutons --------------------------------------------------- */
.btn {
  display: inline-block;
  padding: 12px 22px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--navy);
  background: var(--navy);
  color: var(--white);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--navy-deep); color: var(--white); }

.btn-amber {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--navy-deep);
}
.btn-amber:hover { background: var(--amber-light); color: var(--navy-deep); }

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

/* actions sous le reçu : copier le lien, imprimer — deux boutons discrets */
.receipt-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.btn-copy-link,
.btn-print {
  flex: 1 1 0;
  border-color: var(--rule-strong);
  font-size: 0.88rem;
  padding: 10px 16px;
}
.btn-copy-link:disabled { opacity: 0.7; cursor: default; }

/* ---------- 9. Tableau des taux ----------------------------------------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--white);
}

.rate-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.rate-table caption {
  caption-side: top;
  text-align: left;
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule);
}

.rate-table th,
.rate-table td {
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--rule);
}

.rate-table thead th {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
  background: var(--white);
  border-bottom: 2px solid var(--navy);
  white-space: nowrap;
}

.rate-table td.num,
.rate-table th.num,
.rate-table .rate-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.rate-table tbody tr:hover { background: var(--amber-tint); }
.rate-table tbody tr:last-child td { border-bottom: 0; }
.rate-table tbody tr.is-current { background: var(--navy-tint); }
.rate-table tbody tr.is-current > :first-child {
  box-shadow: inset 3px 0 0 var(--amber);
  font-weight: 600;
}

/* en-tête de rangée (nom de province) : gras discret, jamais en majuscules */
.rate-table tbody th {
  font-weight: 600;
  color: var(--ink);
}

/* ---------- 10. Blocs de contenu ---------------------------------------- */
.prose { max-width: 68ch; }
.prose ul,
.prose ol { padding-left: 1.25em; margin: 0 0 1.1em; }
.prose li { margin-bottom: 0.4em; }

.callout {
  border-left: 3px solid var(--amber);
  border-top: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--white);
  padding: 14px 18px;
  margin: 0 0 1.4em;
  font-size: 0.95rem;
}
.callout p:last-child { margin-bottom: 0; }

/* carte d'article de blog : liste sur blog/index.html, "articles liés" en bas
   d'un billet (titre en h2 sur l'index, en h3 dans les articles liés). */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-card {
  display: block;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
  text-decoration: none;
}
.post-card:hover { border-color: var(--amber); background: var(--amber-tint); }
.post-card h2,
.post-card h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  color: var(--navy);
}
.post-card p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }

.calc-layout {
  display: grid;
  grid-template-columns: minmax(0, 560px) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

/* pages de texte (guide, FAQ, pages légales) : longueur de ligne lisible */
.content {
  max-width: 68ch;
}

.content h2 {
  margin-top: 1.9em;
  padding-top: 0.9em;
  border-top: 1px solid var(--rule);
}

.content h2:first-of-type { border-top: 0; padding-top: 0; }
.content h3 { margin-top: 1.5em; }

.content ul,
.content ol { padding-left: 1.25em; margin: 0 0 1.1em; }
.content li { margin-bottom: 0.45em; }

.content dl { margin: 0 0 1.1em; }
.content dt { font-weight: 600; color: var(--navy); }
.content dd { margin: 0 0 0.7em; }

/* schemas SVG dans les articles : cadre discret, meme papier que le fond */
.content img {
  display: block;
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  margin: 0 0 1.4em;
}

/* fil d'Ariane sobre, sans chevrons décoratifs */
.breadcrumb {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0 0 18px;
}
.breadcrumb a { color: var(--ink-soft); }
.breadcrumb a:hover { color: var(--amber-text); }

/* exemple chiffré : mêmes codes que le reçu, en plus compact */
.example {
  background: var(--white);
  border: 1px solid var(--rule-strong);
  border-left: 3px solid var(--navy);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 0 0 1.4em;
}

.example h3,
.example .example-title {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 10px;
}

.example .receipt-line { padding: 5px 0; }
.example .receipt-total { margin-top: 10px; padding-top: 10px; }
.example .receipt-total .total-amount { font-size: 1.15rem; }

/* accordéon FAQ : <details>/<summary> natif, sans JavaScript */
.faq-list { margin: 0 0 1.6em; }

.faq-item {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 10px;
}
.faq-item[open] { border-color: var(--rule-strong); }

.faq-item > summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  list-style: none;
}
.faq-item > summary::-webkit-details-marker { display: none; }

/* indicateur + / − en mono, cohérent avec les chiffres du site */
.faq-item > summary::after {
  content: '+';
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--amber-text);
  flex: 0 0 auto;
}
.faq-item[open] > summary::after { content: '\2212'; }

.faq-item > summary:hover { background: var(--amber-tint); }
.faq-item > summary:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }

.faq-answer {
  padding: 0 18px 16px;
  border-top: 1px dashed var(--rule-strong);
  margin-top: -1px;
}
.faq-answer > *:first-child { margin-top: 14px; }
.faq-answer > *:last-child { margin-bottom: 0; }

/* ---------- 11. Pied de page -------------------------------------------- */
.site-footer {
  background: var(--navy-deep);
  color: var(--on-navy);
  border-top: 3px solid var(--amber);
  margin-top: 48px;
}

.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
  padding: 40px 0 32px;
}

.footer-col h4 {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber-light);
  margin: 0 0 12px;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-col li { margin-bottom: 8px; }

.footer-col a,
.footer-col p {
  color: var(--on-navy);
  font-size: 0.92rem;
  text-decoration: none;
}
.footer-col a:hover { color: var(--amber-light); text-decoration: underline; }
.footer-col p { margin: 0 0 8px; line-height: 1.55; }

.footer-bar {
  border-top: 1px solid rgba(232, 228, 220, 0.18);
  padding: 16px 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: rgba(232, 228, 220, 0.72);
}
.footer-bar .footer-legal {
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

/* ---------- 12. Responsive ---------------------------------------------- */
@media (max-width: 880px) {
  .calc-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .receipt { max-width: none; }
}

@media (max-width: 720px) {
  :root { --gutter: 18px; }
  body { font-size: 16px; }
  h1 { font-size: 1.85rem; }
  h2 { font-size: 1.4rem; }

  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding-top: 12px;
    padding-bottom: 8px;
    min-height: 0;
  }
  .site-nav { width: 100%; }
  .site-nav ul { gap: 18px; }

  .footer-cols { grid-template-columns: minmax(0, 1fr); gap: 26px; padding: 32px 0 24px; }
  .footer-bar { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  main { padding: 28px 0 48px; }

  .site-nav ul {
    gap: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .site-nav ul::-webkit-scrollbar { display: none; }
  .site-nav a { font-size: 0.88rem; }

  .receipt-band { padding: 10px 16px; }
  .receipt-band .receipt-meta { display: none; }
  .receipt-body { padding: 16px; }

  .receipt-line { gap: 8px; }
  .receipt-line .line-label { font-size: 0.9rem; }
  .receipt-line .line-label .line-rate { display: block; margin-left: 0; }
  .receipt-line .line-dots { display: none; }
  .receipt-line .line-amount { font-size: 0.92rem; }

  .receipt-total .total-amount { font-size: 1.3rem; }

  .toggle { flex-direction: column; }
  .toggle .toggle-btn + .toggle-btn {
    border-left: 0;
    border-top: 1px solid var(--navy);
  }

  .btn { display: block; width: 100%; text-align: center; }
  .receipt-actions { flex-direction: column; }
}

/* garde-fou 375 px : aucun débordement horizontal */
@media (max-width: 375px) {
  :root { --gutter: 14px; }
  .wordmark { font-size: 1.15rem; }
  .input-money input { font-size: 1.1rem; }
  .receipt-band .receipt-title { font-size: 0.72rem; letter-spacing: 0.1em; }
}

/* ---------- 13. Impression ---------------------------------------------- */
@media print {
  .site-header,
  .site-footer,
  .toggle,
  .btn { display: none !important; }
  body { background: #fff; }
  .receipt { border-color: #000; max-width: none; }
}
