/* ========================================
   Ville de Trois-Rivières — Démo
   Palette: fleuve & vieux Trois-Rivières
   ======================================== */

:root {
  --papier: #F6F2EA;
  --papier-fonce: #EDE6D8;
  --ardoise: #1F3640;
  --ardoise-clair: #2E4D59;
  --fleuve: #3B6E7E;
  --brique: #B5512C;
  --brique-clair: #D97A4E;
  --encre: #1A1A18;
  --gris-texte: #5C5750;
  --ligne: #D8D0BE;
  --blanc: #FFFFFF;

  --serif: 'Source Serif 4', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--papier);
  color: var(--encre);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

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

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ---------- Topbar ---------- */
.topbar {
  background: var(--ardoise);
  color: var(--papier);
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}
.topbar .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  padding-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}
.topbar .topbar-alert {
  color: var(--brique-clair);
}

/* ---------- Header ---------- */
header.site-header {
  background: var(--papier);
  border-bottom: 1px solid var(--ligne);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  padding-bottom: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--brique);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--papier);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}
.brand-text {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ardoise);
}
.brand-text small {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fleuve);
  font-weight: 500;
  margin-top: 2px;
}

nav.main-nav {
  display: flex;
  gap: 36px;
}
nav.main-nav a {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ardoise-clair);
  position: relative;
  padding: 4px 0;
  transition: color 0.15s ease;
}
nav.main-nav a:hover { color: var(--brique); }
nav.main-nav a.active { color: var(--brique); }
nav.main-nav a.active::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 2px;
  background: var(--brique);
}

/* ---------- Hero ---------- */
.hero {
  background:
    linear-gradient(180deg, rgba(31,54,64,0.0) 0%, rgba(31,54,64,0.04) 100%),
    var(--papier);
  border-bottom: 1px solid var(--ligne);
  overflow: hidden;
  position: relative;
}
.hero .wrap {
  padding-top: 76px;
  padding-bottom: 84px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 56px;
  align-items: center;
}
.hero-eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fleuve);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero-eyebrow::before {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--fleuve);
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(38px, 4.6vw, 58px);
  line-height: 1.05;
  font-weight: 600;
  color: var(--ardoise);
  letter-spacing: -0.01em;
  margin-bottom: 22px;
}
.hero h1 em {
  font-style: italic;
  color: var(--brique);
}
.hero p.lead {
  font-size: 17.5px;
  color: var(--gris-texte);
  max-width: 46ch;
  margin-bottom: 32px;
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14.5px;
  padding: 13px 24px;
  border-radius: 3px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--brique);
  color: var(--papier);
}
.btn-primary:hover { background: #9C4324; }
.btn-ghost {
  background: transparent;
  color: var(--ardoise);
  border-color: var(--ardoise);
}
.btn-ghost:hover { background: var(--ardoise); color: var(--papier); }

.hero-art {
  position: relative;
  aspect-ratio: 4/5;
  background: var(--ardoise);
  border-radius: 4px;
  overflow: hidden;
}
.hero-art svg { width: 100%; height: 100%; }

/* ---------- River strip / stat band ---------- */
.statband {
  background: var(--ardoise);
  color: var(--papier);
}
.statband .wrap {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}
.stat {
  padding: 30px 28px;
  border-right: 1px solid rgba(246,242,234,0.12);
}
.stat:last-child { border-right: none; }
.stat .num {
  font-family: var(--serif);
  font-size: 30px;
  color: var(--brique-clair);
  margin-bottom: 4px;
}
.stat .label {
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(246,242,234,0.7);
}

/* ---------- Section generic ---------- */
section { padding: 88px 0; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 48px;
  gap: 24px;
  flex-wrap: wrap;
}
.section-eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fleuve);
  margin-bottom: 10px;
}
.section-head h2 {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 600;
  color: var(--ardoise);
  letter-spacing: -0.01em;
}
.section-head p {
  color: var(--gris-texte);
  max-width: 38ch;
  font-size: 15px;
}

/* ---------- Service cards ---------- */
.cardgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--ligne);
  border: 1px solid var(--ligne);
}
.card {
  background: var(--papier);
  padding: 32px 28px;
  transition: background 0.15s ease;
}
.card:hover { background: var(--papier-fonce); }
.card .card-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--brique);
  margin-bottom: 18px;
}
.card h3 {
  font-family: var(--serif);
  font-size: 19px;
  color: var(--ardoise);
  margin-bottom: 10px;
  font-weight: 600;
}
.card p {
  font-size: 14px;
  color: var(--gris-texte);
  margin-bottom: 16px;
}
.card a.card-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--fleuve);
}
.card a.card-link::after { content: ' →'; }

/* ---------- News strip ---------- */
.news-strip {
  background: var(--papier-fonce);
  border-top: 1px solid var(--ligne);
  border-bottom: 1px solid var(--ligne);
}
.news-list { display: flex; flex-direction: column; }
.news-item {
  display: flex;
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--ligne);
  align-items: baseline;
}
.news-item:last-child { border-bottom: none; }
.news-date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fleuve);
  width: 110px;
  flex-shrink: 0;
}
.news-title {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ardoise);
  font-weight: 600;
}

/* ---------- Page header (sous-pages) ---------- */
.page-header {
  background: var(--ardoise);
  color: var(--papier);
  padding: 64px 0 48px;
}
.page-header .section-eyebrow { color: var(--brique-clair); }
.page-header h1 {
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 600;
  margin-bottom: 14px;
}
.page-header p {
  color: rgba(246,242,234,0.78);
  max-width: 56ch;
  font-size: 16px;
}

/* ---------- Service detail blocks ---------- */
.service-block {
  display: grid;
  grid-template-columns: 0.9fr 1.5fr;
  gap: 48px;
  padding: 56px 0;
  border-bottom: 1px solid var(--ligne);
}
.service-block:last-child { border-bottom: none; }
.service-block-label {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brique);
}
.service-block h3 {
  font-family: var(--serif);
  font-size: 24px;
  color: var(--ardoise);
  margin-top: 10px;
}
.service-block .detail p { color: var(--gris-texte); margin-bottom: 14px; font-size: 15px; }
.service-block ul { padding-left: 18px; color: var(--gris-texte); font-size: 14.5px; }
.service-block li { margin-bottom: 6px; }

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
}
.info-row {
  display: flex;
  gap: 18px;
  padding: 20px 0;
  border-bottom: 1px solid var(--ligne);
}
.info-row .icon-box {
  width: 38px; height: 38px;
  background: var(--ardoise);
  color: var(--brique-clair);
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 13px;
  flex-shrink: 0;
}
.info-row h4 { font-size: 14.5px; font-weight: 600; color: var(--ardoise); margin-bottom: 4px; }
.info-row p { font-size: 14px; color: var(--gris-texte); }

.callout {
  background: var(--brique);
  color: var(--papier);
  padding: 36px 32px;
  border-radius: 4px;
}
.callout h3 {
  font-family: var(--serif);
  font-size: 21px;
  margin-bottom: 10px;
}
.callout p { font-size: 14.5px; opacity: 0.92; margin-bottom: 18px; }
.callout .btn-ghost { border-color: var(--papier); color: var(--papier); }
.callout .btn-ghost:hover { background: var(--papier); color: var(--brique); }

/* ---------- Footer ---------- */
footer {
  background: var(--ardoise);
  color: rgba(246,242,234,0.75);
  padding: 56px 0 28px;
  font-size: 13.5px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 36px;
  border-bottom: 1px solid rgba(246,242,234,0.12);
  margin-bottom: 24px;
}
footer h5 {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brique-clair);
  margin-bottom: 14px;
}
footer ul { list-style: none; }
footer li { margin-bottom: 9px; }
footer a:hover { color: var(--papier); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11.5px;
  color: rgba(246,242,234,0.5);
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Chat widget ---------- */
#chat-launcher {
  position: fixed;
  bottom: 26px;
  right: 26px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--brique);
  color: var(--papier);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(31,54,64,0.28);
  z-index: 999;
  transition: transform 0.15s ease;
}
#chat-launcher:hover { transform: scale(1.06); }
#chat-launcher svg { width: 26px; height: 26px; }

#chat-panel {
  position: fixed;
  bottom: 100px;
  right: 26px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 540px;
  max-height: calc(100vh - 140px);
  background: var(--papier);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(26,26,24,0.3);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 999;
  border: 1px solid var(--ligne);
}
#chat-panel.open { display: flex; }

.chat-head {
  background: var(--ardoise);
  color: var(--papier);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-head .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #5FD08A;
  flex-shrink: 0;
}
.chat-head .titles { flex: 1; }
.chat-head .titles strong {
  display: block;
  font-family: var(--serif);
  font-size: 15.5px;
}
.chat-head .titles span {
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(246,242,234,0.65);
}
.chat-head button.close {
  background: none; border: none; color: var(--papier);
  cursor: pointer; font-size: 18px; opacity: 0.7;
}
.chat-head button.close:hover { opacity: 1; }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--papier);
}
.msg {
  max-width: 86%;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.msg.bot {
  background: var(--papier-fonce);
  color: var(--encre);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}
.msg.user {
  background: var(--ardoise);
  color: var(--papier);
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}
.msg.typing {
  background: var(--papier-fonce);
  align-self: flex-start;
  color: var(--gris-texte);
  font-family: var(--mono);
  font-size: 12.5px;
}
.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 14px;
}
.chip {
  font-size: 12px;
  font-family: var(--sans);
  font-weight: 600;
  background: var(--papier-fonce);
  border: 1px solid var(--ligne);
  color: var(--ardoise-clair);
  padding: 7px 12px;
  border-radius: 14px;
  cursor: pointer;
}
.chip:hover { border-color: var(--brique); color: var(--brique); }

.chat-input-row {
  border-top: 1px solid var(--ligne);
  display: flex;
  padding: 12px;
  gap: 8px;
  background: var(--papier);
}
.chat-input-row input {
  flex: 1;
  border: 1px solid var(--ligne);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-family: var(--sans);
  outline: none;
}
.chat-input-row input:focus { border-color: var(--fleuve); }
.chat-input-row button {
  background: var(--brique);
  color: var(--papier);
  border: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chat-input-row button:hover { background: #9C4324; }
.chat-input-row button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  nav.main-nav { display: none; }
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-art { aspect-ratio: 16/9; }
  .statband .wrap { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: none; }
  .cardgrid { grid-template-columns: 1fr; }
  .service-block { grid-template-columns: 1fr; gap: 16px; }
  .contact-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  #chat-panel { right: 16px; bottom: 90px; width: calc(100vw - 32px); }
  #chat-launcher { right: 16px; }
}
