/* ─────────────────────────────────────────────────────────────
   Piandré · /salons interactive map (MapLibre + positron light tiles).
   White canvas, single red accent. Desktop: sidebar list + map split.
   Mobile: map on top, list below, detail card as a bottom sheet.
   ───────────────────────────────────────────────────────────── */

.salons-map-wrap { margin-top: clamp(20px, 3vw, 34px); }

.salons-map {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 0;
  height: min(72vh, 720px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.salons-map.is-listonly { grid-template-columns: 1fr; }
.salons-map.is-listonly .sm-map { display: none; }

/* ── Sidebar ── */
.sm-side {
  display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--paper);
}
.sm-search {
  display: flex; align-items: center; gap: 12px;
  padding: 16px clamp(16px, 2vw, 22px);
  border-bottom: 1px solid var(--line);
}
.sm-search input {
  flex: 1; min-width: 0; background: none; border: 0; outline: none;
  font-family: var(--font-sans); font-size: 16px; color: var(--ink);
  padding: 4px 0;
}
.sm-search input::placeholder { color: var(--muted); }
.sm-search-ico { flex: none; color: var(--muted); }

/* Drag/tap handle — only ever shown on mobile (the bottom-sheet grip). */
.sm-handle { display: none; }
.sm-handle-bar {
  display: block; width: 40px; height: 4px; border-radius: 4px;
  background: var(--line-2); transition: background .15s var(--ease);
}

.sm-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.sm-region-head {
  position: sticky; top: 0; z-index: 1;
  padding: 12px clamp(16px, 2vw, 22px) 8px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); background: var(--paper); border-bottom: 1px solid var(--line);
}
.sm-row {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 13px clamp(16px, 2vw, 22px);
  background: none; border: 0; border-bottom: 1px solid var(--line);
  border-left: 2px solid transparent;
  transition: background .18s var(--ease), border-color .18s var(--ease);
}
.sm-row:hover { background: #faf7f7; }
.sm-row.is-active { background: #fbf1f1; border-left-color: var(--red); }
.sm-row.is-hidden, .sm-region.is-hidden, .sm-pin.is-hidden { display: none; }
.sm-row-name { font-family: var(--font-display); font-size: 19px; font-weight: 500; color: var(--ink); letter-spacing: -.01em; line-height: 1.1; }
.sm-row.is-active .sm-row-name { color: var(--red); }
.sm-row-meta { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; line-height: 1.4; }
.sm-row-flag { display: inline-block; font-size: 9.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--red); margin-left: 8px; vertical-align: middle; }

.sm-empty { padding: 40px clamp(16px, 2vw, 22px); text-align: center; color: var(--muted); font-size: 14px; }

/* ── Map ── */
.sm-map { position: relative; background: #eceff1; min-height: 0; }
.sm-map .maplibregl-map { position: absolute; inset: 0; }
.sm-map-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  background: #eceff1; z-index: 1; transition: opacity .4s var(--ease);
}
.sm-map-loading.is-hidden { opacity: 0; pointer-events: none; }

/* MapLibre chrome tuned to the brand */
.sm-map .maplibregl-ctrl-group { border-radius: var(--radius); box-shadow: 0 2px 10px rgba(20,18,16,.12); }
.sm-map .maplibregl-ctrl-attrib { font-size: 10px; }

/* ── Pins ── (transforms on .sm-pin-inner so they survive MapLibre's
   positioning transform on the marker root) */
.sm-pin { width: 22px; height: 30px; padding: 0; border: 0; background: none; cursor: pointer; }
.sm-pin-flag { width: 42px; height: 42px; z-index: 4; }
.sm-pin-inner { display: block; transform-origin: 50% 100%; transition: transform .16s var(--ease); }
.sm-pin-dot {
  display: block; width: 18px; height: 18px; margin: 0 auto;
  background: var(--red); border: 2px solid #fff;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  box-shadow: 0 2px 6px rgba(192,45,47,.45);
}
.sm-pin:hover .sm-pin-inner { transform: translateY(-2px) scale(1.08); }
.sm-pin.is-active { z-index: 5; }
.sm-pin.is-active .sm-pin-inner { transform: translateY(-3px) scale(1.28); }
.sm-pin.is-active .sm-pin-dot { box-shadow: 0 0 0 5px rgba(192,45,47,.18), 0 3px 8px rgba(192,45,47,.5); }

/* Flagship — the Piandré emblem, bouncing. */
.sm-pin-img {
  display: block; width: 42px; height: 42px; box-sizing: border-box;
  background: #fff; border-radius: 50%; padding: 6px; object-fit: contain;
  box-shadow: 0 4px 12px rgba(20,18,16,.28);
}
.sm-pin-flag .sm-pin-inner { animation: sm-pin-bounce 1.4s ease-in-out infinite; }
@keyframes sm-pin-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@media (prefers-reduced-motion: reduce) { .sm-pin-flag .sm-pin-inner { animation: none; } }

/* ── Detail card (desktop: a floating panel fixed below the header so it's
   always visible, even as the map scrolls under the fixed site header) ── */
.sm-card {
  position: fixed; top: 100px; right: clamp(16px, 3vw, 40px); z-index: 90;
  width: min(340px, calc(100vw - 32px));
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; padding: 22px 22px 20px;
  box-shadow: 0 24px 48px -20px rgba(20,18,16,.32);
  opacity: 0; transform: translateY(-6px) scale(.98);
  transition: opacity .26s var(--ease), transform .26s var(--ease);
}
.sm-card.is-open { opacity: 1; transform: none; }
.sm-card-x {
  position: absolute; top: 8px; right: 8px; width: 44px; height: 44px;   /* ≥44px tap target */
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer;
  border-radius: 50%; transition: color .15s, background .15s;
}
.sm-card-x:hover { color: var(--red); background: #faf7f7; }
.sm-card-region { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--red); }
.sm-card-name { font-family: var(--font-display); font-weight: 400; font-size: clamp(26px, 3vw, 34px); line-height: 1.05; letter-spacing: -.01em; margin: 8px 0 0; color: var(--ink); }
.sm-card-addr { font-size: 14.5px; color: var(--ink-soft); line-height: 1.5; margin: 12px 0 0; max-width: 38ch; }
.sm-card-hours { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.sm-card-hour { font-size: 13.5px; color: var(--ink-soft); line-height: 1.7; }
.sm-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 18px 0 0; }
.sm-card-book {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 12px; font-weight: 700; letter-spacing: .06em;
  border: 1px solid var(--red); color: var(--red); border-radius: 999px;
  padding: 11px 20px; min-height: 44px; box-sizing: border-box;   /* ≥44px tap target */
  transition: background .25s var(--ease), color .25s var(--ease);
}
.sm-card-book .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); transition: background .25s var(--ease); }
.sm-card-book:hover { background: var(--red); color: #fff; }
.sm-card-book:hover .dot { background: #fff; }
.sm-card-link { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--ink); transition: color .2s var(--ease); }
.sm-card-link:hover { color: var(--red); }
.sm-card-tel { display: block; margin-top: 14px; font-family: var(--font-display); font-size: 20px; color: var(--ink); }
.sm-card-tel:hover { color: var(--red); }

/* ── Mobile: Waze-style bottom sheet ──────────────────────────────
   The map fills the viewport; the sidebar floats at the bottom as a
   sheet. Collapsed, only the handle + search bar peek above the edge;
   tap the handle (or focus the search) to slide it up and reveal the
   list. The map stays visible behind it so spatial context is kept. */
@media (max-width: 768px) {
  /* The hero subtitle is redundant on a small screen (the map + list say
     it) — kept in the DOM for SEO, hidden visually to save headroom. */
  .sln-hero-lead { display: none; }

  /* Base (no-JS / map-failed) fallback: stack map over a scrollable list —
     the server-rendered list stays usable without JavaScript. */
  .salons-map {
    display: block;
    height: auto;
    border-bottom: 0;
  }
  .sm-map {
    height: 56dvh;
    border-bottom: 1px solid var(--line);
  }
  .sm-side { border-right: 0; border-top: 1px solid var(--line); }
  .sm-list { overflow-y: auto; -webkit-overflow-scrolling: touch; max-height: 60dvh; }

  /* JS-enhanced (root gets .sheet-ready once the map is live).
     The search bar stays pinned at the BOTTOM (thumb-reachable); the
     results drop DOWN from the top, over the header/nav — so the map
     in the middle band stays visible while you search. */
  .sheet-ready .sm-map { height: 72dvh; }

  /* Bottom sheet: handle + search peek at the bottom; expands UPWARD to
     reveal the list. Capped at 56dvh so a band of map stays visible above
     it — and on expand the JS scrolls the map up under the header so that
     visible band sits nicely framed. */
  .sheet-ready .sm-side {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    width: 100%; box-sizing: border-box;
    border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    background: var(--paper);
    box-shadow: 0 -16px 40px -18px rgba(20,18,16,.3);
    max-height: 56dvh;
    transform: translateY(calc(100% - 96px));   /* peek: handle + search */
    transition: transform .34s var(--ease), bottom .3s ease;
  }
  .sheet-ready .sm-side.is-expanded { transform: translateY(0); }
  /* When the map scrolls out of view, drop the sheet away. */
  .sheet-ready .sm-side.is-stowed { bottom: -260px; }

  .sheet-ready .sm-handle {
    display: flex; align-items: center; justify-content: center;
    width: 100%; padding: 11px 0 7px; min-height: 30px;
    background: transparent; border: 0; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .sheet-ready .sm-handle:hover .sm-handle-bar,
  .sheet-ready .sm-handle:active .sm-handle-bar { background: var(--muted); }

  .sheet-ready .sm-search { border-bottom: 1px solid var(--line); }
  .sheet-ready .sm-list {
    max-height: calc(56dvh - 96px);
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    opacity: 0; pointer-events: none;
    transition: opacity .2s var(--ease);
  }
  .sheet-ready .sm-side.is-expanded .sm-list { opacity: 1; pointer-events: auto; }

  /* Card sheet rides above everything. */
  .sm-card { z-index: 130; }

  /* Card becomes a bottom sheet over everything */
  .sm-card {
    position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: 100%;
    border-radius: 16px 16px 0 0; border-bottom: 0;
    padding: 22px clamp(18px, 6vw, 26px) calc(22px + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%); box-shadow: 0 -18px 44px -16px rgba(20,18,16,.34);
  }
  .sm-card.is-open { transform: none; }
  .sm-card::before {
    content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    width: 38px; height: 4px; border-radius: 2px; background: var(--line-2);
  }
}

/* Discreet map-data credit (kept off the map, in the footer, for OSM/ODbL). */
.map-credit { margin: 14px 0 0; font-size: 10.5px; color: var(--muted); letter-spacing: .02em; }
.map-credit a { color: var(--muted); text-decoration: underline; }
.map-credit a:hover { color: var(--red); }

/* ── Inline booking modal (iframe → book-embed.html) ── */
.sm-book-lock { overflow: hidden; }
.sm-book {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(12px, 4vw, 40px);
  opacity: 0; transition: opacity .26s var(--ease);
}
/* The [hidden] attribute must win over display:flex — otherwise a closed modal
   stays present at opacity 0 and its backdrop swallows every click. */
.sm-book[hidden] { display: none; }
.sm-book:not(.is-open) { pointer-events: none; }
.sm-book.is-open { opacity: 1; pointer-events: auto; }
.sm-book-backdrop { position: absolute; inset: 0; background: rgba(20,18,16,.5); backdrop-filter: blur(3px); }
.sm-book-panel {
  position: relative; width: min(560px, 100%); height: min(680px, 92dvh);
  background: var(--paper); border-radius: 14px; overflow: hidden;
  box-shadow: 0 40px 90px -30px rgba(20,18,16,.5);
  transform: translateY(10px) scale(.99); transition: transform .26s var(--ease);
}
.sm-book.is-open .sm-book-panel { transform: none; }
.sm-book-frame { width: 100%; height: 100%; border: 0; display: block; background: var(--paper); }
.sm-book-x {
  position: absolute; top: 8px; right: 10px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.85); color: var(--ink); font-size: 26px; line-height: 1;
  box-shadow: 0 2px 8px rgba(20,18,16,.16); transition: color .15s, background .15s;
}
.sm-book-x:hover { color: var(--red); background: #fff; }

@media (max-width: 768px) {
  .sm-book { padding: 0; }
  .sm-book-panel { width: 100%; height: 100dvh; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sm-card, .sm-pin, .sm-row, .sm-map-loading, .sm-book, .sm-book-panel { transition: none; }
}
