/* =========================================================================
   Microlev — Styles spécifiques aux pages
   Fiche produit, contact, pages légales, 404.
   ========================================================================= */

/* ============================================================ FICHE PRODUIT */
.product {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: clamp(2rem, 4.5vw, 3.75rem);
  align-items: start;
}

/* ---- Colonne de gauche : photos puis caractéristiques ----
   Le tableau technique était auparavant dans la colonne de droite, qui se
   retrouvait deux fois plus haute que les photos — d'où un grand vide sous
   la galerie. Le placer ici équilibre les deux colonnes. */
.product-media {
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 3vw, 2.25rem);
}

/* ---- Galerie ---- */
.gallery { position: static; }

.gallery-main {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 3;
}
.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: zoom-in;
  background: var(--surface);
}

.gallery-thumbs {
  list-style: none;
  margin: .85rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: .55rem;
}
.gallery-thumbs li { margin: 0; }
.gallery-thumbs button {
  display: block;
  width: 100%;
  padding: 0;
  aspect-ratio: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .16s var(--ease), transform .16s var(--ease);
}
.gallery-thumbs button:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.gallery-thumbs button[aria-current="true"] {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--hi);
}
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }

/* En une seule colonne, l'ordre du DOM ferait lire les photos, puis tout le
   tableau technique, AVANT le titre et le prix. On aplatit donc les deux
   colonnes avec display:contents pour pouvoir réordonner chaque bloc. */
@media (max-width: 880px) {
  .product {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }
  .product-media,
  .product-info { display: contents; }

  .gallery         { order: 1; }
  .product-head    { order: 2; }
  .price-box       { order: 3; margin: 0; }
  .spec-table      { order: 4; }
  .product-section { order: 5; margin-top: 0; }
  .product-info .btn-row { order: 6; margin-top: 0; }
}

/* ---- Colonne d'informations ---- */
.product-head h1 {
  font-size: var(--fs-2xl);
  margin-bottom: .4em;
}
.product-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-bottom: 1rem;
}
.product-intro {
  font-size: var(--fs-md);
  color: var(--ink-700);
}

/* ---- Bloc prix ---- */
.price-box {
  margin: 1.75rem 0;
  padding: 1.35rem 1.5rem;
  background: var(--brand-900);
  color: #fff;
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}
.price-box .price-label {
  display: block;
  font-size: var(--fs-xs);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-200);
  margin-bottom: .2rem;
}
.price-box .price-value {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 1.3rem + 1.1vw, 2.1rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
  color: var(--hi);
  font-variant-numeric: tabular-nums;
}
.price-box .price-value small {
  font-size: .5em;
  color: #fff;
  letter-spacing: .04em;
  margin-left: .35rem;
}

/* ---- Tableau de caractéristiques ---- */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: var(--fs-sm);
}
.spec-table caption {
  caption-side: top;
  text-align: left;
  padding: 0 0 .85rem;
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.spec-table th, .spec-table td {
  padding: .8rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: 0; }
.spec-table th {
  width: 48%;
  font-weight: 550;
  color: var(--ink-500);
  background: var(--paper);
}
.spec-table td {
  font-family: var(--font-display);
  font-weight: 650;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.product-section { margin-top: 2.5rem; }
.product-section h2 {
  font-size: var(--fs-lg);
  padding-bottom: .6rem;
  border-bottom: 2px solid var(--hi);
  margin-bottom: 1.1rem;
}

/* ---- Autres machines ---- */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.1rem;
}
.related-card {
  position: relative;
  display: block;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color .16s var(--ease), transform .16s var(--ease);
}
.related-card:hover { border-color: var(--ink); transform: translateY(-3px); }
.related-card .r-name {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: .15rem;
}
.related-card .r-meta {
  display: block;
  font-size: var(--fs-sm);
  color: var(--ink-500);
}

/* ================================================================ CONTACT */
/* Les deux colonnes n'ont pas la même hauteur : on les centre l'une par
   rapport à l'autre plutôt que de les caler en haut, ce qui laissait un vide
   sous le bouton de gauche. */
.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
@media (max-width: 880px) {
  .contact-layout { grid-template-columns: 1fr; }
}

.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 1rem;
  align-items: start;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.contact-list li:first-child { padding-top: 0; }
.contact-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: var(--hi);
  border-radius: var(--radius-sm);
}
.contact-icon svg { width: 20px; height: 20px; stroke: var(--on-hi); fill: none; stroke-width: 1.9; }
.contact-list .label {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: .15rem;
}
.contact-list .value { color: var(--ink); font-weight: 550; line-height: 1.5; }
.contact-list .value a { color: inherit; text-decoration: none; }
.contact-list .value a:hover { text-decoration: underline; text-decoration-color: var(--hi); text-decoration-thickness: 2px; }

/* ---- Formulaire ---- */
.form-card {
  padding: clamp(1.5rem, 3vw, 2.25rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--hi);
  border-radius: var(--radius);
}
/* ---- Carte ---- */
.map-embed {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-2);
}
.map-embed iframe { width: 100%; height: 400px; border: 0; display: block; }

/* ========================================================== PAGES LÉGALES */
.legal { max-width: 78ch; }
.legal h2 {
  font-size: var(--fs-lg);
  margin-top: 2.5rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--line);
}
.legal h2:first-of-type { margin-top: 0; }
.legal h3 { font-size: var(--fs-md); margin-top: 1.75rem; }
.legal p, .legal li { color: var(--ink-700); }
.legal-updated {
  display: inline-block;
  margin-bottom: 2rem;
  padding: .4rem .8rem;
  background: var(--paper-2);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  color: var(--ink-500);
}

/* ==================================================================== 404 */
.error-page {
  display: grid;
  place-items: center;
  text-align: center;
  padding-block: clamp(4rem, 12vw, 8rem);
}
.error-code {
  font-family: var(--font-display);
  font-size: clamp(4rem, 14vw, 8rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.05em;
  color: var(--brand);
  margin-bottom: 1rem;
}
.error-page .btn-row { justify-content: center; }

/* --------------------------------- Miniature et vue d'un document (fiche technique)
   Les photos sont recadrées en carré (cover). Un document doit au contraire
   rester entier et lisible : on le contient sur fond blanc. */
.gallery-thumbs button[data-doc="true"] img {
  object-fit: contain;
  background: #fff;
  padding: 3px;
}
.gallery-thumbs button[data-doc="true"] {
  border-color: var(--line-strong);
}
.gallery-thumbs button[data-doc="true"]::after {
  content: "DOC";
  position: absolute;
  left: 0;
  bottom: 0;
  padding: 1px 4px;
  background: var(--brand);
  color: #fff;
  font-family: var(--font-display);
  font-size: .55rem;
  font-weight: 700;
  letter-spacing: .08em;
  border-radius: 0 3px 0 0;
}
.gallery-thumbs button { position: relative; }
