/* ============================================================
   PAGE CONTACT (contact.html), DA « Télémétrie »
   Chaque coordonnée est un canal radio (CH1 à CH4) : plaque de
   canal, libellé, valeur, forme d'onde qui s'anime au survol ou au
   focus. La ligne entière reste cliquable. L'e-mail se copie d'un
   geste (js/contact.js, toast « RADIO CHECK »), le lien mailto reste.
   La photo devient la caméra embarquée : ONBOARD · CAM 1.
   Sans JS ou en mouvement réduit : tout est visible et lisible.
   ============================================================ */

.contact {
  container-type: inline-size;
  padding-bottom: var(--section);
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  column-gap: var(--gutter);
  row-gap: var(--s-8);
  align-items: start;
}

/* ------------------------------------------------------------
   1. CAMÉRA EMBARQUÉE
   ------------------------------------------------------------ */
.contact-photo {
  position: relative;
  grid-column: 1 / -1;
  width: 100%;
  max-width: 420px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line-2);
  background: #fff;
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.9);
}

.contact-photo img {
  width: 100%;
  height: auto;
  filter: contrast(1.04) saturate(1.06);
}

.contact-card { grid-column: 1 / -1; min-width: 0; }

@media (min-width: 1024px) {
  .contact-photo {
    grid-column: 1 / span 4;
    max-width: none;
    position: sticky;
    top: calc(var(--nav-h) + var(--s-6));
  }

  .contact-card { grid-column: 6 / -1; }
}

/* Calque caméra : vignettage, lignes de balayage, repères */
.cam-hud {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--white);
  font-variant-numeric: tabular-nums;
}

.cam-hud::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(to bottom, rgba(6, 7, 10, 0.07) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse 75% 70% at 50% 45%, transparent 55%, rgba(6, 7, 10, 0.55) 100%),
    linear-gradient(to bottom, rgba(6, 7, 10, 0.35), transparent 18%, transparent 80%, rgba(6, 7, 10, 0.45));
}

.cam-frame {
  --hud-c: var(--white);
  --hud-l: 16px;
  position: absolute;
  inset: 12px;
}

/* Viseur central, très discret */
.cam-cross {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 46px;
  height: 46px;
  translate: -50% -50%;
  background:
    linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)) 50% 0 / 1px 12px no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)) 50% 100% / 1px 12px no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)) 0 50% / 12px 1px no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)) 100% 50% / 12px 1px no-repeat;
  opacity: 0.55;
}

.cam-id,
.cam-tc,
.cam-car,
.cam-gps {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  padding: 4px 7px 3px;
  background: rgba(6, 7, 10, 0.72);
}

.cam-id { top: 22px; left: 22px; }
.cam-tc { top: 22px; right: 22px; }
.cam-gps { bottom: 22px; right: 22px; color: #c8cfdd; }

.cam-rec {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  color: var(--red);
}

.cam-rec::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
  animation: hud-blink 1.2s steps(2, jump-none) infinite;
}

/* Plaque pilote : numéro sur livrée, trigramme sur blanc */
.cam-car {
  bottom: 22px;
  left: 22px;
  gap: 8px;
  padding: 0 9px 0 0;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1;
  color: var(--carbon);
  background: var(--white);
}

.cam-car b {
  display: grid;
  place-items: center;
  padding: 5px 8px 4px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0;
  color: var(--white);
  background: var(--livery);
}

/* ------------------------------------------------------------
   2. FICHE : canaux radio
   ------------------------------------------------------------ */
.contact-name {
  margin-bottom: var(--s-7);
  font-size: clamp(2.4rem, 1rem + 4vw, 5.6rem);
  font-stretch: 104%;
  line-height: 0.88;
  text-transform: uppercase;
}

.contact .contact-list {
  list-style: none;
  margin: 0;
  border-top: 1px solid var(--line-2);
}

.coord {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "ch label wave"
    "ch value wave"
    "ch extra wave";
  column-gap: clamp(var(--s-4), 2.4cqi, var(--s-6));
  align-items: center;
  margin: 0;
  padding: var(--s-5) var(--s-3) var(--s-5) 0;
  border-bottom: 1px solid var(--rule);
  color: var(--fg);
}

/* Balayage de canal ouvert (survol, focus) */
.coord::before {
  content: "";
  position: absolute;
  inset: 0 calc(-1 * var(--s-3)) 0 calc(-1 * var(--s-3));
  z-index: -1;
  background:
    linear-gradient(var(--accent), var(--accent)) 0 0 / 2px 100% no-repeat,
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 14%, transparent), transparent 80%);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.55s var(--ease-out);
}

/* Plaque de canal */
.coord-ch {
  grid-area: ch;
  align-self: start;
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 3.4em;
  margin-top: 2px;
  padding: 4px 8px 3px;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 1px solid var(--line-2);
  transform: skewX(var(--slant));
  transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

/* Voyant d'émission */
.coord-ch::after {
  content: "";
  position: absolute;
  top: -3px;
  right: -3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--carbon-3);
  box-shadow: 0 0 0 1px var(--line-2);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.coord-label {
  grid-area: label;
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.3s ease;
}

.coord-value {
  grid-area: value;
  min-width: 0;
  font-family: var(--font-text);
  font-size: clamp(1.1rem, 0.55rem + 2cqi, 2.15rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.coord-value a {
  color: inherit;
  transition: color 0.3s ease;
}

/* Toute la ligne est cliquable */
.coord-value a::before {
  content: "";
  position: absolute;
  inset: 0;
}

.coord-value a[target="_blank"]::after {
  content: "↗";
  content: "↗" / "";
  margin-left: 0.3em;
  font-size: 0.6em;
  vertical-align: 0.4em;
  color: var(--accent-small);
}

/* Forme d'onde : barres posées à plat, elles s'animent canal ouvert */
.coord-wave {
  grid-area: wave;
  display: flex;
  align-items: center;
  gap: 3px;
  height: 34px;
}

.coord-wave i {
  --h: 0.5;
  display: block;
  width: 3px;
  height: 100%;
  border-radius: 1px;
  background: var(--accent);
  opacity: 0.5;
  transform: scaleY(0.12);
  transition: transform 0.4s var(--ease-out), opacity 0.3s ease;
}

.coord-wave i:nth-child(3n + 1) { --h: 0.55; }
.coord-wave i:nth-child(3n + 2) { --h: 0.9; }
.coord-wave i:nth-child(4n) { --h: 0.35; }
.coord-wave i:nth-child(5n) { --h: 1; }
.coord-wave i:nth-child(7n) { --h: 0.7; }

.coord-wave i:nth-child(2n) { animation-duration: 0.62s; }
.coord-wave i:nth-child(3n) { animation-duration: 0.84s; }
.coord-wave i:nth-child(5n) { animation-duration: 0.5s; }
.coord-wave i:nth-child(4n + 1) { animation-delay: -0.2s; }
.coord-wave i:nth-child(3n + 2) { animation-delay: -0.45s; }

/* Coordonnées GPS (décor) et bouton de copie : 3e rangée */
.coord-gps {
  grid-area: extra;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.coord-gps::before {
  content: "GPS ";
  color: var(--accent-small);
}

.coord-copy {
  grid-area: extra;
  justify-self: start;
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  min-height: 36px;
  margin-top: var(--s-3);
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg);
  border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  transition: border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

.coord-copy[hidden] { display: none; }

/* Icône : deux feuilles superposées */
.coord-copy-icon {
  position: relative;
  width: 10px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 1px;
}

.coord-copy-icon::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 2px;
  width: 10px;
  height: 12px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  opacity: 0.6;
}

.coord-copy:hover,
.coord-copy:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--bg));
}

.coord-copy.is-done { color: var(--green); border-color: color-mix(in srgb, var(--green) 60%, transparent); }

.coord-copy.is-done .coord-copy-icon {
  width: 12px;
  height: 7px;
  border-width: 0 0 2px 2px;
  border-radius: 0;
  transform: rotate(-45deg) translate(1px, -2px);
}

.coord-copy.is-done .coord-copy-icon::before { display: none; }

/* Canal ouvert : survol, focus clavier, ou émission (copie) */
.coord:hover::before,
.coord:focus-within::before,
.coord.is-tx::before { transform: scaleX(1); }

.coord:hover .coord-ch,
.coord:focus-within .coord-ch,
.coord.is-tx .coord-ch {
  color: var(--white);
  background: var(--livery);
  border-color: var(--livery);
}

.coord:hover .coord-ch::after,
.coord:focus-within .coord-ch::after,
.coord.is-tx .coord-ch::after {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.coord:hover .coord-label,
.coord:focus-within .coord-label,
.coord.is-tx .coord-label { color: var(--fg); }

.coord:hover .coord-wave i,
.coord:focus-within .coord-wave i,
.coord.is-tx .coord-wave i {
  opacity: 1;
  transform: scaleY(var(--h));
  animation-name: coord-wave;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

.coord-wave i { animation-duration: 0.72s; }

@keyframes coord-wave {
  0% { transform: scaleY(0.15); }
  100% { transform: scaleY(var(--h)); }
}

/* Focus : le cadre entoure tout le canal */
.coord:has(.coord-value a:focus-visible) {
  outline: 2px solid var(--accent-small);
  outline-offset: 2px;
}

.coord-value a:focus-visible { outline: none; }

.coord-status {
  min-height: 1.4em;
  margin-top: var(--s-3);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
}

.coord-status:empty { margin-top: 0; min-height: 0; }

.contact-note {
  max-width: 30ch;
  margin-top: var(--s-7);
  padding-left: var(--s-5);
  border-left: 3px solid var(--accent);
  font-size: var(--fs-lede);
  font-style: italic;
  font-weight: 300;
  line-height: 1.22;
  letter-spacing: -0.01em;
}

/* Réseau de liaison (js/atoms.js) : 4 sorties pour 4 canaux */
.contact-net {
  --hud-c: var(--line-2);
  position: relative;
  height: clamp(150px, 16cqi, 210px);
  margin-top: var(--s-8);
  background-color: color-mix(in srgb, var(--carbon) 40%, transparent);
}

/* Sans JS, pas de réseau à dessiner : le panneau vide est retiré */
html:not(.js) .contact-net { display: none; }

.contact-net-tag {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 1;
  background: color-mix(in srgb, var(--carbon) 80%, transparent);
}

/* Petits écrans : la forme d'onde passe en haut à droite, plus courte */
@media (max-width: 639.98px) {
  .coord {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "ch label"
      "ch value"
      "ch extra";
    padding-right: 0;
  }

  .coord-wave {
    position: absolute;
    top: var(--s-5);
    right: 0;
    height: 18px;
    gap: 2px;
  }

  .coord-wave i { width: 2px; }
  .coord-wave i:nth-child(n + 11) { display: none; }
}

/* ------------------------------------------------------------
   3. MOUVEMENT RÉDUIT : onde figée, pas de clignotement
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .coord .coord-wave i { animation: none !important; }
  .cam-rec::before { animation: none !important; }
}

/* ------------------------------------------------------------
   4. IMPRESSION
   ------------------------------------------------------------ */
@media print {
  .cam-hud,
  .coord-wave,
  .coord-copy,
  .coord-ch,
  .contact-net { display: none !important; }

  .coord { grid-template-columns: 1fr; grid-template-areas: "label" "value" "extra"; }
}
