/* ============================================================
   contact.css — Contact page (extends brand/site/shop)
   ============================================================ */
.contact-body { max-width: 1240px; margin: 0 auto; padding: clamp(40px,6vw,72px) clamp(16px,5vw,120px) 80px; }
/* Narrow phones — trim body padding & info-block internal padding so the
   showroom cards don't feel cramped and the copy has breathing room. */
@media (max-width: 560px) {
  .contact-body { padding-inline: 14px; padding-bottom: 60px; }
  .info-block { padding: 22px 18px; }
  .info-block h3 { font-size: 1.18rem; }
  .info-block .addr { font-size: 14px; margin-bottom: 14px; }
  .msg-highlight { padding: 14px 14px; }
  .msg-highlight a { font-size: 1.05rem; word-break: break-all; }
  .contact-line { padding: 10px 0; gap: 10px; }
  .contact-line .ci { width: 30px; height: 30px; }
  .contact-line .ci svg { width: 15px; height: 15px; }
  .contact-line a { font-size: 14.5px; word-break: break-word; }
  .svc-cell { padding: 18px 18px; }
  .svc-cell .sc-name { font-size: 0.98rem; margin-bottom: 8px; }
  .svc-cell a { font-size: 14px; }
  .info-col { gap: 16px; }
}

/* ---- mode toggle (Devis ⇄ Nous écrire) ---- */
.contact-toggle {
  display: flex; justify-content: center; gap: 6px; width: fit-content;
  margin: 0 auto clamp(34px,4vw,52px);
  background: var(--bg-elevated); border: 1px solid var(--ivory-line);
  border-radius: var(--r-pill); padding: 6px; box-shadow: var(--shadow-sm);
}
.ctab {
  font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: .01em;
  color: var(--fg2); background: none; border: 0; cursor: pointer;
  padding: 13px 26px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; gap: 9px;
  transition: color .3s var(--ease), background .3s var(--ease), box-shadow .3s var(--ease);
  white-space: nowrap;
}
.ctab .ico { width: 17px; height: 17px; flex: none; }
.ctab .ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; }
.ctab:hover { color: var(--ink); }
.ctab.active { background: var(--royal-red); color: var(--ivory); box-shadow: var(--shadow-md); }
html[lang="ar"] .ctab { font-family: var(--font-arabic); font-size: 17px; }
@media (max-width: 520px){
  .contact-toggle { width: 100%; }
  .ctab { flex: 1; justify-content: center; padding: 13px 12px; font-size: 14px; }
}
.cmode { display: none; }
.cmode.on { display: block; }
.cmode.anim { animation: riseIn .45s var(--ease); }

.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px,4vw,60px); align-items: start; }
@media (max-width: 920px){ .contact-grid { grid-template-columns: 1fr; } }

/* ---- form card ---- */
.contact-card { background: var(--bg-elevated); border: 1px solid var(--ivory-line); border-radius: var(--r-md); padding: clamp(26px,3vw,40px); box-shadow: var(--shadow-md); position: sticky; top: 92px; }
/* Kill sticky as soon as the two-column grid collapses (≤920px). On mobile
   the info column stacks below the form; if the form stayed sticky it
   would obscure the showroom blocks whenever the visitor scrolled to
   read them. */
@media (max-width: 920px) { .contact-card { position: static; top: auto; } }
.contact-card h2 { font-family: var(--font-display); font-weight: 700; color: var(--ink); font-size: clamp(1.3rem,2vw,1.7rem); margin: 0 0 22px; }
html[lang="ar"] .contact-card h2 { font-family: var(--font-arabic); }
.contact-form { display: grid; gap: 16px; }
.contact-form .field { display: flex; flex-direction: column; gap: 7px; }
.contact-form label { font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--fg2); }
html[lang="ar"] .contact-form label { letter-spacing: .02em; font-size: 15px; }
.contact-form .req { color: var(--royal-red); }
/* Shared between contact and devis forms — same visual treatment. */
.contact-form .optional,
.devis-form .optional,
.field .optional { color: var(--fg2); font-size: 11px; font-style: italic; margin-inline-start: 4px; font-weight: 400; letter-spacing: 0; }
.contact-form input, .contact-form textarea {
  font-family: var(--font-body); font-size: 15px; color: var(--ink); background: var(--ivory);
  border: 1px solid var(--ivory-line); border-radius: var(--r-sm); padding: 13px 14px; outline: none;
  transition: border-color .25s var(--ease); width: 100%;
}
.contact-form input:focus, .contact-form textarea:focus { border-color: var(--gold); }
.contact-form textarea { resize: vertical; min-height: 130px; }
.contact-form .invalid { border-color: var(--royal-red); }
.form-error { color: var(--royal-red); font-size: 14px; display: none; }
.form-error.show { display: block; }
.contact-sent { display: none; text-align: center; padding: 30px 10px; }
.contact-sent.show { display: block; animation: riseIn .7s var(--ease); }
.contact-sent .seal { width: 64px; margin: 0 auto 18px; }
.contact-sent h3 { font-family: var(--font-display); color: var(--ink); font-size: 1.5rem; margin: 0 0 10px; }
html[lang="ar"] .contact-sent h3 { font-family: var(--font-arabic); }
.contact-sent p { color: var(--fg2); line-height: 1.6; max-width: 38ch; margin: 0 auto; }

/* ---- info column ---- */
.info-col { display: grid; gap: 22px; }
.info-block { background: var(--bg-elevated); border: 1px solid var(--ivory-line); border-radius: var(--r-md); padding: 28px 30px; }
.info-block .ib-eyebrow { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-deep); display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
html[lang="ar"] .info-block .ib-eyebrow { letter-spacing: .03em; font-size: 14px; }
.info-block .ib-eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--gold); }
.info-block h3 { font-family: var(--font-display); font-weight: 700; color: var(--ink); font-size: 1.3rem; margin: 0 0 6px; }
html[lang="ar"] .info-block h3 { font-family: var(--font-arabic); }
.info-block .addr { color: var(--fg2); line-height: 1.6; font-size: 14.5px; margin-bottom: 18px; }
.ph-label { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--fg2); margin: 16px 0 8px; }
html[lang="ar"] .ph-label { letter-spacing: .02em; font-size: 14px; }
.ph-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; }
@media (max-width: 520px){ .ph-list { grid-template-columns: 1fr; } }
.ph-list a { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 15px; padding: 5px 0; transition: color .2s var(--ease); font-variant-numeric: tabular-nums; }
.ph-list a:hover { color: var(--royal-red); }
.ph-list a::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); flex: none; }
.contact-line { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.contact-line a { color: var(--ink); font-size: 16px; }
.contact-line a:hover { color: var(--royal-red); }
.contact-line .ci { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--gold) 14%, transparent); color: var(--gold-deep); flex: none; }
.contact-line .ci svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.msg-highlight { margin-top: 8px; padding: 16px 18px; border: 1px solid color-mix(in srgb, var(--gold) 38%, transparent); border-radius: var(--r-sm); background: color-mix(in srgb, var(--gold) 6%, transparent); }
.msg-highlight .mh-k { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-deep); margin-bottom: 4px; }
html[lang="ar"] .msg-highlight .mh-k { letter-spacing: .02em; font-size: 14px; }
.msg-highlight a { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--royal-red); }

/* ---- services strip ---- */
.services-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--ivory-line); border: 1px solid var(--ivory-line); border-radius: var(--r-md); overflow: hidden; }
@media (max-width: 600px){ .services-grid { grid-template-columns: 1fr; } }
.svc-cell { background: var(--bg-elevated); padding: 22px 22px; transition: background .3s var(--ease); }
.svc-cell:hover { background: var(--ivory-warm); }
.svc-cell .sc-name { font-family: var(--font-display); font-weight: 700; color: var(--ink); font-size: 1.02rem; margin-bottom: 10px; }
html[lang="ar"] .svc-cell .sc-name { font-family: var(--font-arabic); }
.svc-cell a { display: block; color: var(--fg2); font-size: 14.5px; padding: 3px 0; font-variant-numeric: tabular-nums; }
.svc-cell a:hover { color: var(--royal-red); }

/* ============================================================
   ALGERIA MAP — gold thread draw + dropping pins
   ============================================================ */
.map-section { background: var(--ink); color: var(--ivory); padding: 0; position: relative; overflow: clip; min-height: 300vh; }
.map-sticky { position: sticky; top: 0; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: clamp(8px, 1.2vw, 16px); padding: clamp(16px, 2.5vh, 32px) clamp(20px, 6vw, 120px) clamp(20px, 3vh, 40px); }
.map-section .map-head { text-align: center; max-width: 60ch; margin: 0 auto; }
.map-section .eyebrow { color: var(--gold); }
.map-section h2 { font-family: var(--font-display); font-weight: 700; color: var(--ivory); font-size: clamp(1.8rem,4vw,3rem); margin: 12px 0 14px; }
html[lang="ar"] .map-section h2 { font-family: var(--font-arabic); }
.map-section .map-sub { color: var(--fg-on-dark-2); font-size: clamp(1rem,1.4vw,1.2rem); line-height: 1.6; }
/* Two-column stage: labels in their own column on the left, the map
   SVG centered in the available remaining width. The pair is centered
   together inside the sticky so the visual stays balanced. */
.map-stage {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 3vw, 60px);
}
.map-wrap { flex: 0 1 1120px; min-width: 0; width: 100%; max-width: 1120px; height: 76vh; position: relative; }
html[lang="ar"] .map-stage { flex-direction: row-reverse; }
.alg-map { width: 100%; height: 100%; display: block; overflow: visible; }
.alg-map .vanish { opacity: 0; }

/* ============================================================
   MAP LABELS — vertical list, sibling of the map wrap on the left.
   Each .map-label starts hidden; the inline script in contact.astro
   lerps opacity + translate-x in lockstep with its corresponding pin
   landing on the map. Below 900px the list stacks above the map.
   ============================================================ */
.map-labels {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(22px, 3.4vh, 42px);
  pointer-events: none;
}
.map-label {
  display: flex;
  align-items: baseline;
  gap: clamp(12px, 1.6vw, 20px);
  color: var(--ivory);
  opacity: 0;
  transform: translateX(-16px);
  transition: none;       /* JS sets opacity + transform per scroll frame */
  will-change: opacity, transform;
}
.map-label-num {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(15px, 1.4vw, 18px);
  letter-spacing: 0.18em;
  color: var(--gold-bright);
  min-width: 32px;
}
.map-label-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 3.4vw, 48px);
  letter-spacing: 0.005em;
  line-height: 1;
}
html[lang="ar"] .map-label-name { font-family: var(--font-arabic); }
@media (max-width: 900px) {
  /* Stack the stage vertically on narrow screens: labels above the map
     as a horizontal row so they don't compete for width. */
  .map-stage { flex-direction: column; gap: clamp(14px, 3vw, 24px); }
  html[lang="ar"] .map-stage { flex-direction: column; }
  .map-labels {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(16px, 3vw, 32px);
    padding: 0 12px;
  }
  .map-label { transform: translateX(0); }
  .map-label-name { font-size: clamp(20px, 5.4vw, 28px); }
  .map-label-num { font-size: clamp(12px, 2.8vw, 14px); min-width: 24px; }
}

/* ----- Phone & small tablet (≤720px) — DEAD-SIMPLE STATIC MAP -----
   Threshold synced with the JS smallScreen check (matchMedia
   '(max-width: 720px)') so behaviour and layout stay in lock-step.
   No sticky, no scroll-driven animation, no city-label sidebar.
   Sticky padding is horizontal-zero so the map uses the FULL
   viewport width (head text keeps its own inner padding). */
@media (max-width: 720px) {
  .map-section { min-height: auto; }
  .map-sticky {
    position: static;
    min-height: 0;
    display: block;
    padding: clamp(14px, 2vh, 24px) 0 clamp(16px, 2.5vh, 28px);
  }
  .map-section .map-head { padding: 0 16px; margin-bottom: clamp(14px, 2vh, 22px); text-align: center; max-width: 60ch; margin-inline: auto; }
  .map-section .eyebrow { font-size: 11px; letter-spacing: 0.2em; }
  .map-section h2 { font-size: clamp(1.3rem, 5.4vw, 1.7rem); margin: 6px 0 6px; }
  .map-section .map-sub { font-size: clamp(0.85rem, 3.4vw, 0.95rem); line-height: 1.4; }
  .map-stage { display: block; }
  .map-labels { display: none; }
  /* Map uses full viewport width — no horizontal sticky padding.
     IMPORTANT: iOS Safari ignores the SVG viewBox for height auto-sizing
     and defaults to 150px tall (long-standing bug), so we set the
     wrap's aspect-ratio to match the viewBox (1000:997 ≈ 1:1) and let
     the SVG fill it. Without this the Algeria outline renders squashed
     into a 300×150 rectangle on iPhone Safari. */
  .map-wrap {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1000 / 997;
    height: auto;
    padding: 0;
    margin: 0;
  }
  .alg-map {
    width: 100%;
    height: 100%;
    display: block;
    max-width: none;
    overflow: visible; /* pins that sit near the top of the viewBox mustn't get clipped */
  }
  /* Make the tap-targets on the pins bigger for finger accuracy — they
     already scale on :hover for desktop, but touch has no hover. Add a
     larger transparent hit box via padding on the wrapping <a>. */
  .alg-map a { -webkit-tap-highlight-color: transparent; }
}

.alg-map .m-wash { opacity: 0; }
.alg-map .m-border { stroke-dasharray: 1; stroke-dashoffset: 1; filter: drop-shadow(0 0 5px color-mix(in srgb, var(--gold) 55%, transparent)); }
.alg-map .marker { opacity: 0; transform: translateY(-10px); transform-box: fill-box; transform-origin: center bottom; filter: drop-shadow(0 5px 8px rgba(0,0,0,.5)); will-change: transform, opacity; }
/* Each pin wraps in an <a> that opens Google Maps in a new tab.
   .marker's transform is being driven inline by scroll JS, so the
   hover-grow lives on the <a> wrapper (CSS:hover beats inline only
   when the rule and the inline aren't fighting for the same prop). */
.alg-map a { cursor: pointer; transform-box: fill-box; transform-origin: center bottom; transition: transform .25s var(--ease), filter .25s var(--ease); }
.alg-map a:focus { outline: none; }
.alg-map a:hover, .alg-map a:focus-visible { transform: scale(1.12); filter: drop-shadow(0 0 4px color-mix(in srgb, var(--gold-bright) 80%, transparent)); }
.alg-map .halo { opacity: 0; }
.alg-map .lbl-group { opacity: 0; }
.alg-map .lbl { font-family: var(--font-display); font-weight: 700; font-size: 34px; letter-spacing: 1.5px; fill: var(--ivory); }
.alg-map .lbl-sub { font-family: var(--font-display); font-style: italic; font-size: 13px; fill: var(--gold-bright); letter-spacing: .5px; }
.alg-map .lbl-rule { stroke: var(--gold); stroke-width: 1; opacity: .5; vector-effect: non-scaling-stroke; }
.alg-map .beacon { opacity: 0; transform-box: fill-box; transform-origin: center; }

/* sonar pulses begin only once a pin is placed by the scroll-driven script */
.alg-map .pin.placed .b1 { animation: mapSonar 4.4s ease-out 0s infinite; }
.alg-map .pin.placed .b2 { animation: mapSonar 4.4s ease-out 2.2s infinite; }

@keyframes mapSonar { 0% { opacity: .5; transform: scale(1); } 70% { opacity: 0; } 100% { opacity: 0; transform: scale(7); } }
@media (prefers-reduced-motion: reduce){
  .alg-map .m-border { stroke-dashoffset: 0 !important; }
  .alg-map .m-wash, .alg-map .marker, .alg-map .halo, .alg-map .lbl-group { opacity: 1 !important; transform: none !important; }
  .alg-map .beacon { display: none; }
}

/* Mobile map: simple CSS-driven reveal. The scroll-driven desktop path
   is skipped under 720px — instead, renderStatic() is called from the
   inline script AFTER window.load + IntersectionObserver enter, and
   the transitions below carry the intermediate state → final state
   animation. Border draws first, wash fades in, then pins cascade. */
@media (max-width: 720px) and (prefers-reduced-motion: no-preference) {
  .map-section .alg-map .m-border {
    transition: stroke-dashoffset 900ms var(--ease);
  }
  .map-section .alg-map .m-wash {
    transition: opacity 800ms var(--ease) 300ms;
  }
  .map-section .alg-map .marker {
    transition: opacity 480ms var(--ease), transform 520ms var(--ease);
  }
  .map-section .alg-map .pin:nth-of-type(1) .marker { transition-delay: 900ms; }
  .map-section .alg-map .pin:nth-of-type(2) .marker { transition-delay: 1040ms; }
  .map-section .alg-map .pin:nth-of-type(3) .marker { transition-delay: 1180ms; }
}
/* Guarantee no horizontal overflow at any size — the map SVG scales
   inside .map-wrap, but a stale inline width from JS could otherwise
   push out on very narrow devices. */
.map-section, .map-sticky, .map-stage, .map-wrap { max-width: 100%; }
