/* ============================================================
   Groupe TERRA — Site corporate
   Design system & styles globaux
   ============================================================ */
:root {
  --green-dark: #0f6b2f;
  --green: #1a8a3c;
  --green-mid: #2fa14e;
  --green-light: #76bf3f;
  --green-soft: #e9f6ec;
  --gold: #c9a227;
  --ink: #14231a;
  --muted: #5b6f61;
  --line: #dfeee3;
  --white: #ffffff;
  --bg-alt: #f4faf5;
  --ring: rgba(26, 138, 60, 0.18);
  --shadow-sm: 0 6px 18px -10px rgba(15, 107, 47, 0.35);
  --shadow-md: 0 18px 40px -22px rgba(15, 107, 47, 0.45);
  --radius: 16px;
  --header-h: 76px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--white);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--green-dark); text-decoration: none; }
a:hover { color: var(--green); }

.container { width: min(1160px, 92%); margin: 0 auto; }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  transition: box-shadow 0.25s;
}
.site-header.scrolled { box-shadow: var(--shadow-sm); }

.header-inner {
  height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px;
}
.brand-link { display: flex; align-items: center; gap: 12px; }
.brand-link img { width: 46px; height: 46px; border-radius: 10px; }
.brand-name { font-weight: 700; font-size: 1.15rem; color: var(--green-dark); letter-spacing: -0.01em; }
.brand-name span { color: var(--green-light); }

.main-nav ul { display: flex; gap: 6px; list-style: none; }
.main-nav a {
  display: block; padding: 10px 14px;
  font-size: 0.92rem; font-weight: 500; color: var(--ink);
  border-radius: 10px; transition: background 0.2s, color 0.2s;
}
.main-nav a:hover { background: var(--green-soft); color: var(--green-dark); }
.main-nav a.active { background: var(--green); color: #fff; }

.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.nav-toggle span { width: 20px; height: 2px; background: var(--green-dark); border-radius: 2px; transition: 0.25s; }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 28px; border-radius: 12px;
  font-family: inherit; font-size: 0.95rem; font-weight: 600;
  cursor: pointer; border: none; white-space: nowrap;
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s, background 0.2s, color 0.2s;
}
.btn-primary {
  background: linear-gradient(90deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff; box-shadow: 0 12px 24px -14px rgba(15, 107, 47, 0.8);
}
.btn-primary:hover { filter: brightness(1.06); color: #fff; transform: translateY(-2px); }
.btn-outline {
  background: transparent; color: var(--green-dark);
  border: 1.5px solid var(--green);
}
.btn-outline:hover { background: var(--green); color: #fff; transform: translateY(-2px); }
.btn-light { background: #fff; color: var(--green-dark); }
.btn-light:hover { color: var(--green); transform: translateY(-2px); }

/* ---------------- Hero (accueil) ---------------- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(118, 191, 63, 0.18) 0%, transparent 60%),
    linear-gradient(180deg, #f7fcf7 0%, #ffffff 100%);
}
.hero-grid {
  display: grid; grid-template-columns: 1.15fr 0.85fr;
  gap: 56px; align-items: center;
  padding: 88px 0 96px;
}
.kicker {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--green-soft); color: var(--green-dark);
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 8px 16px; border-radius: 999px; margin-bottom: 22px;
}
.kicker .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 1.8s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(26, 138, 60, 0.5); }
  70% { box-shadow: 0 0 0 9px rgba(26, 138, 60, 0); }
  100% { box-shadow: 0 0 0 0 rgba(26, 138, 60, 0); }
}
.hero h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.2rem);
  font-weight: 700; line-height: 1.14; letter-spacing: -0.02em;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--green) 0%, var(--green-light) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { margin-top: 20px; color: var(--muted); font-size: 1.06rem; max-width: 540px; }
.hero-cta { margin-top: 32px; display: flex; gap: 14px; flex-wrap: wrap; }

.hero-visual { position: relative; display: flex; justify-content: center; }
.hero-card {
  width: 100%; max-width: 380px;
  background: #fff; border: 1px solid var(--line); border-radius: 24px;
  box-shadow: var(--shadow-md);
  padding: 34px 30px; text-align: center;
}
.hero-card img { width: 150px; margin: 0 auto 16px; }
.hero-card h3 { font-size: 1.05rem; color: var(--green-dark); }
.hero-card p { font-size: 0.88rem; color: var(--muted); margin-top: 6px; }
.hero-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-top: 22px;
}
.hero-stats .stat { background: var(--bg-alt); border-radius: 12px; padding: 12px 6px; }
.hero-stats .num { font-size: 1.35rem; font-weight: 700; color: var(--green-dark); }
.hero-stats .lbl { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

/* ---------------- Sections ---------------- */
section.block { padding: 84px 0; }
section.block.alt { background: var(--bg-alt); }

.section-head { text-align: center; max-width: 640px; margin: 0 auto 52px; }
.section-head .kicker { margin-bottom: 14px; }
.section-head h2 { font-size: clamp(1.6rem, 3.4vw, 2.25rem); font-weight: 700; letter-spacing: -0.02em; }
.section-head p { margin-top: 14px; color: var(--muted); }

/* Cards grids */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 26px; }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 26px;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: #cfe7d5; }
.card .icon {
  width: 54px; height: 54px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--green-soft); color: var(--green-dark);
  margin-bottom: 18px;
}
.card .icon svg { width: 26px; height: 26px; fill: currentColor; }
.card h3 { font-size: 1.08rem; font-weight: 600; margin-bottom: 8px; }
.card p { font-size: 0.92rem; color: var(--muted); }
.card .link-more {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 16px; font-size: 0.88rem; font-weight: 600; color: var(--green);
}
.card .link-more:hover { gap: 10px; }

/* Branch cards */
.branch-card { display: flex; flex-direction: column; }
.branch-card .tag {
  align-self: flex-start;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--green-dark); background: var(--green-soft);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 14px;
}
.branch-card h3 { font-size: 1.15rem; }
.branch-card p { flex: 1; }

/* Values strip */
.values { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.value { text-align: center; padding: 26px 14px; }
.value .icon { margin: 0 auto 14px; }

/* CTA band */
.cta-band {
  background:
    radial-gradient(600px 300px at 15% 120%, rgba(118, 191, 63, 0.35) 0%, transparent 60%),
    linear-gradient(90deg, var(--green-dark) 0%, var(--green) 100%);
  color: #fff; text-align: center;
  padding: 70px 0;
}
.cta-band h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; }
.cta-band p { margin: 14px auto 28px; max-width: 520px; opacity: 0.9; }

/* ---------------- Page hero (sous-pages) ---------------- */
.page-hero {
  background:
    radial-gradient(700px 320px at 90% -20%, rgba(118, 191, 63, 0.2) 0%, transparent 60%),
    linear-gradient(180deg, #f5fbf5 0%, #ffffff 100%);
  padding: 64px 0 56px;
  border-bottom: 1px solid var(--line);
}
.breadcrumb { font-size: 0.82rem; color: var(--muted); margin-bottom: 14px; }
.breadcrumb a { color: var(--green); font-weight: 500; }
.breadcrumb span.sep { margin: 0 6px; color: #b5cabb; }
.page-hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 700; letter-spacing: -0.02em; }
.page-hero p { margin-top: 14px; color: var(--muted); max-width: 680px; font-size: 1.02rem; }

/* ---------------- Content helpers ---------------- */
.prose { max-width: 820px; }
.prose h2 { font-size: 1.45rem; margin: 34px 0 12px; }
.prose h3 { font-size: 1.12rem; margin: 26px 0 10px; color: var(--green-dark); }
.prose p { margin-bottom: 14px; color: #33463a; }
.prose ul { margin: 0 0 16px 22px; color: #33463a; }
.prose li { margin-bottom: 8px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }

.checklist { list-style: none; margin: 18px 0; }
.checklist li {
  position: relative; padding-left: 34px; margin-bottom: 14px; color: #33463a;
}
.checklist li::before {
  content: "✓";
  position: absolute; left: 0; top: 1px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--green-soft); color: var(--green-dark);
  font-weight: 700; font-size: 0.85rem;
  display: grid; place-items: center;
}

.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.chip {
  font-size: 0.8rem; font-weight: 500;
  background: #fff; border: 1px solid var(--line); color: var(--green-dark);
  padding: 7px 14px; border-radius: 999px;
}
.chip.solid { background: var(--green); border-color: var(--green); color: #fff; }

/* Branch profile layout */
.branch-head {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.branch-head .badge-letter {
  width: 64px; height: 64px; border-radius: 18px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff; font-weight: 700; font-size: 1.5rem;
}
.branch-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 30px 0; }
.branch-meta .box { background: var(--bg-alt); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.branch-meta .box .k { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 6px; }
.branch-meta .box .v { font-weight: 600; color: var(--green-dark); font-size: 0.95rem; }

/* ---------------- Contact ---------------- */
.contact-grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 48px; align-items: start; }
.contact-info .item {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 18px 0; border-bottom: 1px solid var(--line);
}
.contact-info .item .icon { width: 44px; height: 44px; border-radius: 12px; margin: 0; flex-shrink: 0; }
.contact-info .item h4 { font-size: 0.95rem; }
.contact-info .item p { font-size: 0.9rem; color: var(--muted); }

.form-card {
  background: #fff; border: 1px solid var(--line); border-radius: 20px;
  padding: 34px; box-shadow: var(--shadow-sm);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 7px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 16px;
  border: 1.5px solid #dcebe0; border-radius: 12px;
  font-family: inherit; font-size: 0.93rem; color: var(--ink); background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field textarea { min-height: 130px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 4px var(--ring);
}
.form-msg { min-height: 22px; margin-top: 10px; font-size: 0.88rem; font-weight: 500; }
.form-msg.ok { color: var(--green-dark); }
.form-msg.err { color: #c0392b; }

/* ---------------- Footer ---------------- */
.site-footer {
  background: #0c2416; color: #cfe0d4;
  padding: 64px 0 0;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 40px; }
.site-footer h4 { color: #fff; font-size: 0.95rem; margin-bottom: 18px; }
.site-footer ul { list-style: none; }
.site-footer li { margin-bottom: 10px; font-size: 0.88rem; }
.site-footer a { color: #cfe0d4; }
.site-footer a:hover { color: var(--green-light); }
.footer-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.footer-brand img { width: 48px; border-radius: 10px; background: #fff; }
.footer-brand .name { font-weight: 700; color: #fff; font-size: 1.1rem; }
.footer-about p { font-size: 0.88rem; opacity: 0.85; max-width: 300px; }
.footer-bottom {
  margin-top: 48px; border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 20px 0; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 0.8rem; opacity: 0.75;
}

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ---------------- Image media frames ---------------- */
.media-frame {
  position: relative; overflow: hidden;
  border-radius: var(--radius);
  aspect-ratio: 16 / 10;
  background:
    radial-gradient(400px 200px at 80% 0%, rgba(118,191,63,0.35), transparent 60%),
    linear-gradient(135deg, var(--green-dark) 0%, var(--green) 55%, var(--green-mid) 100%);
  border: 1px solid var(--line);
}
.media-frame img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.6s ease;
}
.media-frame.tall { aspect-ratio: 4 / 3; }
.media-frame.wide { aspect-ratio: 21 / 9; }
.card:hover .media-frame img { transform: scale(1.05); }
.media-frame .media-label {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 22px 16px 12px;
  color: #fff; font-size: 0.8rem; font-weight: 500;
  background: linear-gradient(0deg, rgba(6,30,15,0.75), transparent);
  z-index: 2;
}
.media-frame.img-failed img { display: none; }
.media-frame.img-failed::after {
  content: attr(data-fallback);
  position: absolute; inset: 0; display: grid; place-items: center;
  color: rgba(255,255,255,0.9); font-weight: 600; font-size: 1.05rem; padding: 20px; text-align: center;
}

/* Media card (image on top) */
.card.media-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.card.media-card .media-frame { border: none; border-radius: 0; aspect-ratio: 16 / 10; }
.card.media-card .card-body { padding: 24px 24px 28px; display: flex; flex-direction: column; flex: 1; }

/* ---------------- Slider / carousel ---------------- */
.slider {
  position: relative; overflow: hidden;
  border-radius: 20px; border: 1px solid var(--line);
  box-shadow: var(--shadow-md); background: var(--green-dark);
  margin: 8px 0 10px;
}
.slides { display: flex; transition: transform 0.6s cubic-bezier(0.22,1,0.36,1); will-change: transform; }
.slide { position: relative; min-width: 100%; aspect-ratio: 16 / 8; background: linear-gradient(135deg, var(--green-dark), var(--green)); }
.slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slide figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 40px 24px 18px; color: #fff; font-size: 0.92rem; font-weight: 500;
  background: linear-gradient(0deg, rgba(6,30,15,0.85), transparent);
}
.slider-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  border: none; cursor: pointer;
  background: rgba(255,255,255,0.85); color: var(--green-dark);
  font-size: 1.5rem; line-height: 1; display: grid; place-items: center;
  transition: background 0.2s, transform 0.2s; z-index: 3;
}
.slider-btn:hover { background: #fff; }
.slider-btn.prev { left: 14px; }
.slider-btn.next { right: 14px; }
.slider-dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; z-index: 3; }
.slider-dots button {
  width: 9px; height: 9px; padding: 0; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,0.5); transition: background 0.2s, transform 0.2s;
}
.slider-dots button.active { background: #fff; transform: scale(1.25); }

/* Figure with caption in prose */
figure.prose-media { margin: 22px 0; }
figure.prose-media figcaption { font-size: 0.82rem; color: var(--muted); margin-top: 8px; font-style: italic; }

/* Sector image strip on branch pages */
.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 22px 0; }
.gallery-grid .media-frame { aspect-ratio: 4 / 3; }
@media (max-width: 700px) { .gallery-grid { grid-template-columns: 1fr 1fr; } }

/* ---------------- Responsive ---------------- */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; padding: 60px 0 70px; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .values { grid-template-columns: repeat(2, 1fr); }
  .split, .contact-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .branch-meta { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .nav-toggle { display: flex; }
  .main-nav {
    position: fixed; top: var(--header-h); left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    max-height: 0; overflow: hidden; transition: max-height 0.3s ease;
  }
  .main-nav.open { max-height: 420px; }
  .main-nav ul { flex-direction: column; padding: 14px 5%; gap: 2px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  section.block { padding: 60px 0; }
  .form-row { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
}
