/* =========================================================
   MJ Garden — home.css
   Sections et animations propres à la page d'accueil
   ========================================================= */

/***** hero *****/
.hero-frame {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: max(640px, 100svh);
  border-bottom-left-radius: var(--radius-leaf);
  color: var(--color-text-light);
}
.hero-media { position: absolute; inset: 0; z-index: -2; overflow: hidden; background: var(--color-main); }
.hero-media img {
  width: 100%; height: 100%; object-fit: cover; object-position: 38% 18%;
  transform: scale(1.12); transform-origin: 40% 30%; will-change: transform;
}
.hero-frame::after {         /* voile de lisibilité : dense en bas à gauche, sous le titre */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(to top, rgba(13, 26, 19, .88) 0%, rgba(13, 26, 19, .45) 32%, rgba(13, 26, 19, 0) 62%),
    linear-gradient(to right, rgba(13, 26, 19, .45), transparent 60%);
}
.hero { --hero-notch-h: clamp(92px, 7vw, 112px); }
.hero-content {
  padding: 0 var(--gutter) calc(var(--hero-notch-h) + clamp(28px, 4vw, 56px));
  padding-left: max(var(--gutter), calc((100vw - var(--container-width)) / 2 + var(--gutter)));
}
/* Slogan au-dessus du H1 */
.hero-tagline {
  margin-bottom: clamp(14px, 1.6vw, 24px);
  font-family: var(--font-title); font-size: clamp(1.25rem, 1.1vw + .8rem, 1.9rem); line-height: 1.2;
  color: var(--color-second);
  text-shadow: 0 1px 14px rgba(13, 26, 19, .7);
}
/* H1 : deux lignes maximum, chaque ligne reste insécable et la taille suit la largeur d'écran */
.hero-title {
  font-family: var(--font-title); font-weight: 400;
  font-size: clamp(2.6rem, 5.4vw, 6.2rem); line-height: 1; letter-spacing: -.03em;
}
.hero-title .line { display: block; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; white-space: nowrap; }
.hero-title .line > span { display: inline-block; transform: translateY(105%); }
.hero-title .line:nth-child(2) { padding-left: .9em; }

/* Accroche sous le H1 */
.hero-intro { max-width: 60ch; margin-top: clamp(24px, 2.6vw, 40px); }
.hero-intro p { color: var(--color-text-light); font-size: clamp(.98rem, .3vw + .9rem, 1.08rem); }

/* Encoche du CTA devis (principe Monfort) */
.hero-notch { width: min(48%, 640px); height: var(--hero-notch-h); padding: 14px 0 0 14px; }
.hero-notch .quote-cta-icon { width: calc(var(--hero-notch-h) - 14px); }

/* Séquence d'entrée */
.is-loaded .hero-media img { transform: scale(1); transition: transform 2.4s cubic-bezier(.16, .9, .2, 1); }
.is-loaded .hero-title .line > span { transform: none; transition: transform 1.1s var(--ease) .25s; }
.is-loaded .hero-title .line:nth-child(2) > span { transition-delay: .4s; }
.js .hero-tagline, .js .hero-intro, .js .hero-notch .quote-cta { opacity: 0; transform: translateY(16px); }
.is-loaded .hero-tagline { opacity: 1; transform: none; transition: opacity .9s .1s, transform 1s var(--ease) .1s; }
.is-loaded .hero-intro { opacity: 1; transform: none; transition: opacity .9s .6s, transform 1s var(--ease) .6s; }
.is-loaded .hero-notch .quote-cta { opacity: 1; transform: none; transition: opacity .9s .8s, transform 1s var(--ease) .8s; }

/***** à propos *****/
.about-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(40px, 7vw, 120px); align-items: center; }
.about-text .title { margin-bottom: 30px; }
.about-text .lead { margin-bottom: 18px; }
.about-text .text-muted { max-width: 58ch; margin-bottom: 26px; }

.about-media { position: relative; padding-bottom: 12%; }
.about-photo {
  position: relative; width: 76%; aspect-ratio: 4 / 5; overflow: hidden;
  border-radius: var(--radius-card) var(--radius-leaf) var(--radius-card) var(--radius-card);
}
.about-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; }
.about-badge { --notch-r: 34px; padding: 12px 12px 0 0; }
.about-badge p {
  display: grid; gap: 4px; width: clamp(150px, 15vw, 220px); padding: clamp(16px, 1.6vw, 24px) clamp(18px, 1.8vw, 28px);
  background: var(--color-main); color: var(--color-text-light);
  border-radius: var(--radius-main) var(--radius-card) var(--radius-main) var(--radius-main);
  font-size: .92rem; line-height: 1.3;
}
.about-badge strong { font-family: var(--font-title); font-weight: 400; font-size: clamp(2.4rem, 3.4vw, 3.6rem); line-height: .9; color: var(--color-second); }

.about-video { --media-w: 36%; position: absolute; right: 0; bottom: 0; }   /* détachement : .media-frame */
.about-video video {
  display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover;
  border-radius: var(--radius-main) var(--radius-card) var(--radius-main) var(--radius-card);
  background: var(--color-main);
}

/***** services *****/
/* En-tête : texte d'introduction dans un encart vert, aligné en haut avec le titre */
.services-head { align-items: start; }
.services-intro {
  display: grid; justify-items: start; gap: 14px;
  padding: clamp(26px, 2.8vw, 40px) clamp(28px, 3vw, 44px);
  border-radius: var(--radius-main) var(--radius-card) var(--radius-main) var(--radius-card);
}
.section-head .services-intro p { max-width: 40ch; font-size: clamp(1.05rem, .5vw + .85rem, 1.25rem); line-height: 1.5; }
.services-grid {
  --stagger: clamp(60px, 9vw, 140px);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 2.4vw, 36px);
  padding-top: var(--stagger);
}
.services-grid > li:nth-child(3n + 2) { margin-top: calc(var(--stagger) * -1); }

.service-card {
  --card-pad: clamp(24px, 2.6vw, 40px);
  --card-notch: clamp(56px, 4.4vw, 64px);
  position: relative;
  display: flex; flex-direction: column; gap: 14px;
  aspect-ratio: 4/3;   /* carré par défaut, s'allonge si le texte l'exige */
  padding: var(--card-pad); padding-right: calc(var(--card-notch) + 12px);
  background: var(--color-surface); color: var(--color-text); text-decoration: none;
  border-radius: var(--radius-card) var(--radius-card) 0 var(--radius-card);
  transition: background-color .5s var(--ease), color .5s var(--ease);
}
/* Taille et position fixes : seul le remplissage change au survol */
.service-picto, .service-cta-icon { width: clamp(64px, 6.2vw, 88px); margin-bottom: auto; }
.service-title { font-family: var(--font-title); font-weight: 400; font-size: clamp(1.35rem, 1.2vw + .7rem, 1.95rem); line-height: 1.1; }
.service-text { font-size: .95rem; line-height: 1.5; color: var(--color-text-muted); transition: color .5s var(--ease); }
.service-notch { --notch-r: 18px; width: var(--card-notch); height: var(--card-notch); padding: 7px 0 0 7px; border-top-left-radius: 50%; }

/* Survol : couleurs inversées et rotation de la flèche, sans aucun déplacement */
.service-card:hover, .service-card:focus-visible { background: var(--color-main); color: var(--color-text-light); }
.service-card:hover .service-text, .service-card:focus-visible .service-text { color: var(--color-text-light); }
.service-card:hover .service-picto .c-main,
.service-card:focus-visible .service-picto .c-main { fill: var(--color-text-light); }   /* bicolore orange et blanc */
.service-card:hover .arrow-btn .icon, .service-card:focus-visible .arrow-btn .icon { transform: rotate(45deg); }

/* Sixième emplacement : carte d'appel à l'action */
.service-card.is-cta { background: var(--color-main); color: var(--color-text-light); }
.service-card.is-cta:hover, .service-card.is-cta:focus-visible { background: var(--color-main-hover); }
.service-cta-icon {
  display: grid; place-items: center; aspect-ratio: 1; border-radius: 50%;
  background: var(--color-second); color: var(--color-main);
  transition: transform var(--transition-main);
}
.service-cta-icon .icon { width: 36%; height: 36%; }
.service-card.is-cta:hover .service-cta-icon { transform: rotate(-8deg); }
.service-cta-label { font-weight: 700; font-size: .95rem; letter-spacing: .04em; text-transform: uppercase; color: var(--color-second); }





/***** engagements *****/
.commit { position: relative; overflow: hidden; }
.commit-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(40px, 6vw, 104px); align-items: center; }
.commit .section-head { grid-template-columns: minmax(0, 1fr); gap: 16px; margin-bottom: clamp(28px, 3vw, 44px); }

/* Deux photos : une grande verticale, une seconde carrée en léger chevauchement */
.commit-media { position: relative; padding-bottom: 14%; }
.commit-photo { overflow: hidden; }
.commit-photo img { width: 100%; height: 100%; object-fit: cover; }
.commit-photo.is-main {
  width: 82%; aspect-ratio: 4 / 5;
  border-radius: var(--radius-main) var(--radius-leaf) var(--radius-main) var(--radius-main);
}
.commit-photo.is-main img { object-position: 40% 45%; }
.commit-photo.is-secondary {   /* détachement : .media-frame, bordure couleur du fond de section */
  --media-w: 50%; --frame-bg: var(--color-main); --frame-radius: var(--radius-card);
  position: absolute; right: 0; bottom: 0;
}
.commit-photo.is-secondary img {
  aspect-ratio: 1; height: auto; object-position: 50% 38%;
  border-radius: var(--radius-card) var(--radius-main) var(--radius-card) var(--radius-card);
}

/* Six atouts : liste compacte sur deux colonnes */
.commit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(24px, 3vw, 48px); }
.commit-grid li { display: grid; grid-template-columns: 44px 1fr; column-gap: 18px; align-content: start; padding: 24px 0; border-top: 1px solid var(--color-line); }
.commit-grid h3 { font-family: var(--font-title); font-weight: 400; font-size: clamp(1.15rem, .6vw + .9rem, 1.35rem); line-height: 1.2; margin: 0 0 6px; }
.commit-grid p { color: var(--color-text-muted); font-size: .92rem; line-height: 1.5; }
.commit-grid .line-picto { grid-row: 1 / span 2; width: 44px; height: 44px; }
.commit-grid li:hover .line-picto { transform: rotate(-6deg) scale(1.06); }





/***** réalisations *****/
.work { overflow: hidden; }
.gallery-track {
  --track-offset: max(var(--gutter), calc((100vw - var(--container-width)) / 2 + var(--gutter)));
  display: flex; gap: clamp(14px, 1.6vw, 24px);
  padding-inline: var(--track-offset); scroll-padding-inline: var(--track-offset);
  overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none; cursor: grab;
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-track.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.gallery-track.is-dragging button { pointer-events: none; }
.gallery-card {
  position: relative; flex: none; overflow: hidden; scroll-snap-align: start;
  width: clamp(260px, 28vw, 520px); height: clamp(400px, 38vw, 640px);
  border-radius: var(--radius-main);
  background: var(--color-main);
}
/*
.gallery-card.is-wide { width: clamp(300px, 46vw, 860px); border-radius: var(--radius-main) var(--radius-leaf) var(--radius-main) var(--radius-main); }
*/
.gallery-shot { display: block; position: relative; width: 100%; height: 100%; cursor: grab; }
.gallery-track.is-dragging .gallery-shot { cursor: grabbing; }
.gallery-card img {
  width: 100%; height: 100%; object-fit: cover; object-position: var(--focus, 50% 50%);
  user-select: none; -webkit-user-drag: none;
}

.gallery-footer { display: flex; align-items: center; gap: clamp(20px, 3vw, 48px); margin-top: clamp(28px, 3vw, 48px); }
.gallery-progress { position: relative; flex: 1; height: 2px; background: var(--color-line); overflow: hidden; }
.gallery-progress span { position: absolute; inset: 0; background: var(--color-second); transform-origin: left; transform: scaleX(.2); transition: transform .3s; }
.gallery-nav { display: flex; gap: 8px; }
.gallery-btn {
  display: grid; place-items: center; width: clamp(50px, 3.8vw, 60px); aspect-ratio: 1; border-radius: 50%;
  background: var(--color-surface); color: var(--color-main); box-shadow: inset 0 0 0 1px var(--color-line);
  transition: background-color .3s, color .3s, opacity .3s;
}
.gallery-btn .icon { width: 18px; height: 18px; }
.gallery-btn.is-prev .icon { transform: rotate(180deg); }
.gallery-btn:not(:disabled):hover { background: var(--color-main); color: var(--color-text-light); }
.gallery-btn:disabled { opacity: .35; cursor: default; }

/***** contrats d'entretien (principe Piret Pellet) *****/
.contracts { position: relative; isolation: isolate; overflow: hidden; background: #000}
.contracts::before {         /* photographie fixe, teintée par le vert de la section */
  content: ""; position: absolute; inset: 0; z-index: -1;
  /* agrandie et décalée pour écarter les véhicules visibles en bordure de la photo */
  background: url("../images/home/bkg.webp") 35% 25% / max(125vw, 170vh) auto no-repeat fixed;
  opacity: .3;
}
.contracts::after {          /* renfort de contraste derrière le titre */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(rgba(29, 58, 44, .55), rgba(29, 58, 44, 0) 45%);
}
.contracts .section-head { margin-bottom: clamp(40px, 5vw, 64px); }
.contracts .lead { color: var(--color-text-muted); }


/***** responsive *****/
@media (max-width: 1023px) {
  .hero-notch { width: min(72%, 560px); }
  .hero-title .line:nth-child(2) { padding-left: .5em; }

  .about-grid { grid-template-columns: minmax(0, 1fr); row-gap: 56px; }
  .about-media { max-width: 640px; }

  .services-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-top: 0; }
  .services-grid > li:nth-child(3n + 2) { margin-top: 0; }
  .service-card { aspect-ratio: auto; min-height: 100%; padding-bottom: calc(var(--card-notch) + 8px); }
  .service-picto, .service-cta-icon { margin-bottom: 18px; }

  .commit-layout { grid-template-columns: minmax(0, 1fr); }
  .commit-media { width: min(100%, 560px); }

  /* background-attachment: fixed est coûteux ou ignoré sur mobile : fond simplement couvrant */
  .contracts::before { background-attachment: scroll; background-size: cover; background-position: 40% 30%; background-image: url("../images/realisations/massif-arbustes-tailles-en-boules-800.webp"); }
}

@media (max-width: 767px) {
  .hero-frame { min-height: max(560px, 92svh); border-bottom-left-radius: 0; }
  .hero { --hero-notch-h: 84px; }
  .hero-media img { object-position: 30% 26%; }
  .hero-title { font-size: 7.2vw; }
  .hero-tagline { font-size: 1.15rem; }
  .hero-title .line:nth-child(2) { padding-left: 0; }
  .hero-intro { margin-top: 20px; }
  .hero-intro p { font-size: .95rem; }
  .hero-notch { width: calc(100% - 28px); padding: 10px 0 0 10px; }
  .hero-notch .quote-cta-icon { width: 64px; }

  .about-media { padding-bottom: 18%; }
  .about-photo { width: 78%; }
  .about-video { --media-w: 40%; }
  .about-badge p { width: 130px; padding: 12px 14px; font-size: .8rem; }

  .services-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .service-card { --card-notch: 56px; display: grid; grid-template-columns: 56px 1fr; gap: 6px 18px; align-content: start; padding: 24px; padding-bottom: calc(var(--card-notch) - 4px); }
  .service-picto, .service-cta-icon { grid-row: 1 / span 2; width: 56px; margin: 0; }
  .service-cta-label { grid-column: 2; margin-top: 4px; }
  .service-text { font-size: .92rem; }

  .commit-media { width: 88%; padding-bottom: 12%; }   /* photos contenues en hauteur */
  .commit-grid { grid-template-columns: minmax(0, 1fr); }
  .commit-grid li { padding: 20px 0; }

  .gallery-card, .gallery-card.is-wide { width: 82vw; height: min(104vw, 520px); }
  .gallery-footer { flex-wrap: wrap; }
  .gallery-progress { flex: 1 1 100%; order: -1; }
  .gallery-footer .link-arrow { margin-left: auto; }

  .accordion-trigger { padding: 18px 16px 18px 20px; }
  .accordion-inner p { padding: 0 20px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-media img { transform: none; }
  .hero-title .line > span, .js .hero-tagline, .js .hero-intro, .js .hero-notch .quote-cta { transform: none; opacity: 1; }
}
