/*
 * Shannan Group — Signature 10 · Locations page
 * Interactive Leaflet map, overview figures, filters and the location directory.
 * Markup is generated by assets/js/mobile-experience.js.
 */
.sg-location-map-root {
  position: relative !important;
  display: block !important;
  box-sizing: border-box !important;
  width: min(1240px, calc(100% - 2 * var(--sg-gutter))) !important;
  max-width: 1240px !important;
  min-width: 0 !important;
  height: auto !important;
  margin: clamp(24px, 4vw, 52px) auto clamp(56px, 7vw, 96px) !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.sg-location-map-loading {
  display: grid;
  min-height: 240px;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 28px;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius-lg);
  color: var(--sg-ink);
  background: var(--sg-card);
  box-shadow: var(--sg-shadow-sm);
  text-align: center;
}
.sg-location-map-loading__mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 18px;
  color: var(--sg-gold-light);
  background: linear-gradient(145deg, var(--sg-forest), color-mix(in oklab, var(--sg-forest) 70%, var(--sg-leaf)));
  font-size: 1.7rem;
  animation: sg-pulse 1.8s ease-in-out infinite;
}
.sg-location-map-loading strong { color: var(--sg-heading); font-family: var(--sg-font-heading); font-size: 1.06rem; font-weight: 600; }
.sg-location-map-loading > span:last-child { color: var(--sg-muted); font-size: .88rem; }

.sg-map-experience {
  --sg-map-accent: var(--sg-gold);
  --sg-map-deep: var(--sg-forest);
  display: grid;
  min-width: 0;
  gap: clamp(16px, 2vw, 24px);
  color: var(--sg-ink);
  font-family: var(--sg-font-body);
}

/* Header card */
.sg-map-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, .65fr);
  align-items: center;
  gap: 24px;
  min-height: 240px;
  overflow: hidden;
  padding: clamp(26px, 4vw, 52px);
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius-lg);
  color: #fff;
  background:
    radial-gradient(600px 340px at 10% 0%, color-mix(in srgb, var(--sg-gold) 32%, transparent), transparent 62%),
    radial-gradient(520px 320px at 100% 100%, rgba(127, 163, 90, .28), transparent 62%),
    linear-gradient(130deg, var(--sg-forest-ink), var(--sg-forest));
  box-shadow: var(--sg-shadow-lg);
}
.sg-map-hero::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  opacity: .45;
  background-image: radial-gradient(rgba(228, 200, 143, .25) .8px, transparent .8px);
  background-size: 20px 20px;
  -webkit-mask-image: linear-gradient(90deg, #000, transparent 70%);
  mask-image: linear-gradient(90deg, #000, transparent 70%);
}
.sg-map-hero::after {
  position: absolute;
  z-index: -1;
  inset: auto auto -140px -90px;
  width: 340px;
  aspect-ratio: 1;
  border: 1px solid rgba(228, 200, 143, .26);
  border-radius: 50%;
  content: "";
  box-shadow: 0 0 0 34px rgba(228, 200, 143, .04), 0 0 0 70px rgba(228, 200, 143, .025);
  pointer-events: none;
}
.sg-map-hero__copy { position: relative; z-index: 1; }
.sg-map-eyebrow,
.sg-map-panel__eyebrow { display: inline-flex; align-items: center; gap: 9px; margin: 0 0 12px; color: var(--sg-accent-text); font-family: var(--sg-font-heading); font-size: .8rem; font-weight: 600; letter-spacing: .02em; }
.sg-map-hero .sg-map-eyebrow { color: var(--sg-gold-light); }
.sg-map-eyebrow::before { width: 26px; height: 2px; border-radius: 2px; content: ""; background: currentColor; }
.sg-map-hero h1 { margin: 0; color: #fff; font-family: var(--sg-font-heading); font-size: clamp(2.1rem, 1.3rem + 3vw, 3.6rem); font-weight: 700; line-height: 1.22; letter-spacing: 0; }
.sg-map-hero__copy > p:last-child { max-width: 60ch; margin: 14px 0 0; color: rgba(255, 255, 255, .78); font-size: var(--sg-text-lg); line-height: 2; }
.sg-map-hero__visual {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 170px;
  place-items: center;
  align-content: center;
  gap: 8px;
  overflow: hidden;
  color: var(--sg-gold-light);
}
.sg-map-hero__visual::before,
.sg-map-hero__visual::after {
  position: absolute;
  width: 150px;
  aspect-ratio: 1;
  border: 1px solid rgba(228, 200, 143, .4);
  border-radius: 50%;
  content: "";
  animation: sg-orbit-spin 18s linear infinite;
}
.sg-map-hero__visual::after { width: 196px; border-style: dashed; opacity: .5; animation-direction: reverse; animation-duration: 28s; }
.sg-map-hero__visual svg { position: relative; z-index: 2; width: 60px; height: 60px; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .35)); animation: sg-pin-bob 3.2s var(--sg-ease-in-out) infinite; }
.sg-map-hero__visual > span { position: relative; z-index: 2; color: rgba(255, 255, 255, .65); font-family: var(--sg-font-heading); font-size: .62rem; font-weight: 500; letter-spacing: .16em; }
.sg-map-hero__visual > strong { position: relative; z-index: 2; color: #fff; font-family: var(--sg-font-heading); font-size: clamp(2.1rem, 4vw, 3rem); font-weight: 700; line-height: 1; }
.sg-map-hero__visual > small { position: relative; z-index: 2; color: rgba(255, 255, 255, .7); font-family: var(--sg-font-heading); font-size: .74rem; font-weight: 500; }

/* Overview figures */
.sg-map-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.sg-map-overview__item {
  position: relative;
  display: grid;
  min-width: 0;
  justify-items: center;
  gap: 2px;
  overflow: hidden;
  padding: 18px 10px;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius);
  background: var(--sg-card);
  box-shadow: var(--sg-shadow-xs);
  transition: transform 500ms var(--sg-ease), border-color var(--sg-transition);
}
.sg-map-overview__item::before { position: absolute; inset: 0 0 auto; height: 3px; content: ""; background: linear-gradient(90deg, transparent, var(--sg-gold), transparent); opacity: .7; }
.sg-map-overview__item:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--sg-gold) 45%, var(--sg-border)); }
.sg-map-overview__item strong { color: var(--sg-heading); font-family: var(--sg-font-heading); font-size: 1.8rem; font-weight: 700; line-height: 1.1; font-variant-numeric: lining-nums; }
.sg-map-overview__item span { color: var(--sg-muted); font-family: var(--sg-font-heading); font-size: .8rem; font-weight: 500; text-align: center; }

/* Map panel */
.sg-map-panel {
  padding: clamp(14px, 2vw, 22px);
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius-lg);
  background: var(--sg-card);
  box-shadow: var(--sg-shadow-md);
}
.sg-map-panel__heading,
.sg-map-directory__heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 16px; }
.sg-map-panel__heading h2,
.sg-map-directory__heading h2 { margin: 0; color: var(--sg-heading); font-family: var(--sg-font-heading); font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem); font-weight: 700; line-height: 1.4; }
.sg-map-panel__eyebrow { margin-bottom: 4px; font-size: .72rem; }
.sg-map-count { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--sg-border); border-radius: 999px; color: var(--sg-muted); background: var(--sg-surface-soft); font-family: var(--sg-font-heading); font-size: .78rem; font-weight: 500; }
.sg-map-count > span { width: 8px; height: 8px; border-radius: 50%; background: #2a9a6c; box-shadow: 0 0 0 4px rgba(42, 154, 108, .14); animation: sg-pulse 2s ease-in-out infinite; }
.sg-locations-map {
  position: relative;
  z-index: 0;
  width: 100%;
  height: clamp(400px, 46vw, 580px);
  overflow: hidden;
  border: 1px solid var(--sg-border);
  border-radius: calc(var(--sg-radius-lg) - 8px);
  background: #e7ece6;
  isolation: isolate;
}
.sg-locations-map .leaflet-container { width: 100%; height: 100%; }
.sg-locations-map,
.sg-locations-map.leaflet-container { direction: ltr; background: #e7ece6; font-family: var(--sg-font-body); outline: none; }
.sg-locations-map .leaflet-control-attribution { font-size: 10px; }
.sg-locations-map .leaflet-control-zoom { margin: 0 12px 12px 0 !important; overflow: hidden; border: 1px solid var(--sg-border) !important; border-radius: 12px !important; box-shadow: var(--sg-shadow-sm) !important; }
.sg-locations-map .leaflet-control-zoom a { width: 36px !important; height: 36px !important; color: var(--sg-forest) !important; background: #fff !important; line-height: 36px !important; }
.sg-locations-map .leaflet-popup-content-wrapper { border-radius: 16px; box-shadow: var(--sg-shadow-md); }
.sg-locations-map .leaflet-popup-content { margin: 14px 16px; }
.sg-map-panel__footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px 0; color: var(--sg-muted); font-size: .76rem; line-height: 1.7; }
.sg-map-unavailable { display: grid; width: 100%; height: 100%; min-height: 280px; place-items: center; padding: 25px; color: var(--sg-heading); background: repeating-linear-gradient(135deg, var(--sg-surface-soft), var(--sg-surface-soft) 14px, var(--sg-surface) 14px, var(--sg-surface) 28px); font-family: var(--sg-font-heading); font-weight: 600; text-align: center; }
.sg-locations-map.has-tile-errors::after { position: absolute; z-index: 500; inset: 12px 12px auto; padding: 8px 11px; border: 1px solid rgba(120, 95, 52, .24); border-radius: 10px; color: #624b28; background: rgba(255, 249, 234, .96); content: "بعض أجزاء الخريطة لم تُحمّل؛ يمكنك استخدام بطاقات المواقع والاتجاهات أدناه."; font-size: .74rem; font-weight: 600; text-align: center; pointer-events: none; }

/* Markers + popup */
.sg-map-marker-shell { border: 0; background: transparent; transition: opacity 360ms var(--sg-ease, ease), filter 360ms var(--sg-ease, ease); }
.sg-map-marker-shell.is-dimmed { opacity: .32; filter: grayscale(.85); }
.sg-map-pin { position: relative; display: grid; width: 38px; height: 45px; place-items: center; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .3)); transition: transform 300ms var(--sg-ease); }
.sg-map-marker-shell:hover .sg-map-pin { transform: translateY(-4px) scale(1.06); }
.sg-map-pin::before { position: absolute; inset: 0; border: 2px solid #fff; border-radius: 50% 50% 50% 8px; content: ""; background: var(--sg-forest); transform: rotate(-45deg); }
.sg-map-pin--facility::before { background: #b8873b; }
.sg-map-pin--branch::before { background: #4f7a99; }
.sg-map-pin__number { position: relative; z-index: 1; display: grid; width: 22px; height: 22px; place-items: center; color: #fff; font-family: var(--sg-font-heading); font-size: 10px; font-weight: 700; line-height: 1; }
.sg-map-popup { display: grid; min-width: 180px; gap: 6px; color: var(--sg-ink); font-family: var(--sg-font-body); text-align: right; }
.sg-map-popup__tag { color: var(--sg-accent-text); font-family: var(--sg-font-heading); font-size: .7rem; font-weight: 600; }
.sg-map-popup strong { color: var(--sg-heading); font-family: var(--sg-font-heading); font-size: 1rem; font-weight: 700; }
.sg-map-popup > span:not(.sg-map-popup__tag) { color: var(--sg-muted); font-size: .78rem; line-height: 1.6; }
.sg-map-popup a { display: inline-flex; align-items: center; gap: 7px; margin-top: 4px; color: var(--sg-forest) !important; font-family: var(--sg-font-heading); font-size: .8rem; font-weight: 600; text-decoration: none !important; }
.sg-map-popup a:hover { text-decoration: underline !important; }

/* Directory */
.sg-map-directory { display: grid; gap: 16px; }
.sg-map-directory__heading { margin-bottom: 0; }
.sg-map-directory__heading p { max-width: 42ch; margin: 0; color: var(--sg-muted); font-size: .88rem; line-height: 1.8; }
.sg-map-filters { display: flex; max-width: 100%; align-items: center; gap: 8px; overflow-x: auto; padding: 2px 1px 6px; overscroll-behavior-inline: contain; scrollbar-width: thin; }
.sg-map-filter {
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 16px;
  border: 1px solid var(--sg-border-strong);
  border-radius: 999px;
  color: var(--sg-ink);
  background: var(--sg-card);
  font-family: var(--sg-font-heading);
  font-size: .84rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 300ms var(--sg-ease), color var(--sg-transition), background-color var(--sg-transition), border-color var(--sg-transition), box-shadow var(--sg-transition);
}
.sg-map-filter b { display: grid; min-width: 22px; height: 22px; place-items: center; padding-inline: 5px; border-radius: 99px; color: var(--sg-heading); background: var(--sg-tint-gold); font-size: .7rem; font-weight: 600; }
.sg-map-filter:hover { transform: translateY(-1px); border-color: var(--sg-gold); }
.sg-map-filter.is-active { border-color: var(--sg-forest); color: #fff; background: var(--sg-forest); box-shadow: 0 10px 22px -12px color-mix(in srgb, var(--sg-forest) 80%, transparent); }
.sg-map-filter.is-active b { color: var(--sg-forest); background: #fff; }
.sg-map-location-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.sg-map-location-card {
  display: grid;
  min-width: 0;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius);
  background: var(--sg-card);
  box-shadow: var(--sg-shadow-xs);
  transition: transform 450ms var(--sg-ease), border-color var(--sg-transition), box-shadow 450ms var(--sg-ease), background-color var(--sg-transition);
  animation: sg-map-card-in 420ms var(--sg-ease-out) both;
}
.sg-map-location-card[hidden] { display: none !important; }
.sg-map-location-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--sg-gold) 50%, var(--sg-border)); box-shadow: var(--sg-shadow-md); }
.sg-map-location-card.is-active { border-color: var(--sg-gold); box-shadow: 0 0 0 3px var(--sg-tint-gold), var(--sg-shadow-md); }
.sg-map-location-card__select { display: grid; width: 100%; min-width: 0; grid-template-columns: 38px minmax(0, 1fr) 24px; align-items: center; gap: 10px; padding: 0; border: 0; color: inherit; background: transparent; font: inherit; text-align: right; cursor: pointer; }
.sg-map-location-card__index { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: var(--sg-gold-light); background: linear-gradient(145deg, var(--sg-forest), color-mix(in oklab, var(--sg-forest) 70%, var(--sg-leaf))); font-family: var(--sg-font-heading); font-size: .74rem; font-weight: 600; }
.sg-map-location-card[data-location-category="facility"] .sg-map-location-card__index { color: #fffaf0; background: linear-gradient(145deg, var(--sg-gold-deep), var(--sg-gold)); }
.sg-map-location-card[data-location-category="branch"] .sg-map-location-card__index { color: #fff; background: linear-gradient(145deg, #3d6684, #5b8aac); }
.sg-map-location-card__copy { display: grid; min-width: 0; gap: 1px; }
.sg-map-location-card__type { color: var(--sg-accent-text); font-family: var(--sg-font-heading); font-size: .68rem; font-weight: 600; }
.sg-map-location-card__copy strong { overflow: hidden; color: var(--sg-heading); font-family: var(--sg-font-heading); font-size: .95rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.sg-map-location-card__copy small { overflow: hidden; color: var(--sg-muted); font-size: .72rem; line-height: 1.6; text-overflow: ellipsis; white-space: nowrap; }
.sg-map-location-card__target { color: var(--sg-muted); font-size: 1.25rem; text-align: center; transition: color var(--sg-transition), transform 400ms var(--sg-ease); }
.sg-map-location-card.is-active .sg-map-location-card__target { color: var(--sg-gold); transform: scale(1.15); }
.sg-map-location-card__select:focus-visible { outline: 2px solid var(--sg-gold); outline-offset: 5px; border-radius: 10px; }
.sg-map-location-card__directions { display: inline-flex; min-height: 36px; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px; border-radius: 10px; color: var(--sg-heading) !important; background: var(--sg-surface-soft); font-family: var(--sg-font-heading); font-size: .76rem; font-weight: 600; text-decoration: none !important; transition: background-color var(--sg-transition), color var(--sg-transition); }
.sg-map-location-card__directions:hover { color: #fff !important; background: var(--sg-forest); }
.sg-map-location-card__directions:focus-visible { outline: 2px solid var(--sg-gold); outline-offset: 3px; }

/* Dark mode */
:root[data-theme="dark"] .sg-map-hero { border-color: var(--sg-border-strong); background: radial-gradient(600px 340px at 10% 0%, color-mix(in srgb, var(--sg-gold) 18%, transparent), transparent 62%), linear-gradient(130deg, #0b1f16, #10291e); }
:root[data-theme="dark"] .sg-map-panel,
:root[data-theme="dark"] .sg-map-location-card,
:root[data-theme="dark"] .sg-map-overview__item { background: var(--sg-card); }
:root[data-theme="dark"] .sg-map-filter { background: var(--sg-card); }
:root[data-theme="dark"] .sg-map-filter.is-active { border-color: var(--sg-gold-light); color: var(--sg-forest-ink); background: var(--sg-gold-light); }
:root[data-theme="dark"] .sg-map-filter.is-active b { color: var(--sg-forest-ink); background: rgba(255, 255, 255, .7); }
:root[data-theme="dark"] .sg-map-location-card__directions:hover { color: var(--sg-forest-ink) !important; background: var(--sg-gold-light); }
:root[data-theme="dark"] .sg-locations-map,
:root[data-theme="dark"] .sg-locations-map.leaflet-container { background: #0e1b15; }
:root[data-theme="dark"] .sg-locations-map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.55); }
:root[data-theme="dark"] .sg-locations-map .leaflet-popup-content-wrapper,
:root[data-theme="dark"] .sg-locations-map .leaflet-popup-tip { color: var(--sg-ink); background: var(--sg-card-raised); box-shadow: var(--sg-shadow-md); }
:root[data-theme="dark"] .sg-map-popup a { color: var(--sg-gold-light) !important; }
:root[data-theme="dark"] .sg-locations-map .leaflet-control-zoom a { border-color: var(--sg-border) !important; color: var(--sg-ink) !important; background: var(--sg-card-raised) !important; }
:root[data-theme="dark"] .sg-locations-map .leaflet-control-attribution { color: #cfdcd3; background: rgba(14, 28, 21, .88); }
:root[data-theme="dark"] .sg-locations-map .leaflet-control-attribution a { color: var(--sg-gold-light); }
:root[data-theme="dark"] .sg-map-unavailable { color: var(--sg-ink); }
:root[data-theme="dark"] .sg-locations-map.has-tile-errors::after { border-color: rgba(228, 200, 143, .28); color: #f0dfc1; background: rgba(20, 38, 29, .96); }

/* Responsive */
@media (max-width: 1000px) {
  .sg-map-location-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 782px) {
  .sg-location-map-root { width: calc(100% - 2 * var(--sg-gutter)) !important; margin-block: 18px 48px !important; }
  .sg-map-experience { gap: 14px; }
  .sg-map-hero { grid-template-columns: minmax(0, 1fr); gap: 6px; min-height: 0; padding: 24px 20px 18px; }
  .sg-map-hero__visual { min-height: 130px; }
  .sg-map-hero__visual::before { width: 104px; }
  .sg-map-hero__visual::after { width: 136px; }
  .sg-map-hero__visual svg { width: 44px; height: 44px; }
  .sg-map-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .sg-map-overview__item { grid-template-columns: 40px minmax(0, 1fr); align-items: center; justify-items: start; gap: 0 10px; padding: 12px 14px; }
  .sg-map-overview__item strong { grid-row: span 2; font-size: 1.5rem; }
  .sg-map-overview__item span { font-size: .76rem; text-align: right; }
  .sg-map-panel { padding: 12px; }
  .sg-map-panel__heading { align-items: flex-start; gap: 8px; margin-bottom: 12px; }
  .sg-map-count { padding: 6px 10px; font-size: .7rem; }
  .sg-locations-map { height: min(108vw, 440px); min-height: 320px; }
  .sg-map-panel__footer { flex-direction: column; align-items: flex-start; gap: 3px; font-size: .7rem; }
  .sg-map-directory__heading { flex-direction: column; align-items: flex-start; gap: 4px; }
  .sg-map-location-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .sg-map-location-card { gap: 8px; padding: 10px; }
  .sg-map-location-card__select { grid-template-columns: 32px minmax(0, 1fr) 18px; gap: 7px; }
  .sg-map-location-card__index { width: 32px; height: 32px; border-radius: 10px; font-size: .66rem; }
  .sg-map-location-card__copy strong { font-size: .84rem; }
  .sg-map-location-card__copy small { font-size: .64rem; }
  .sg-map-location-card__directions { min-height: 32px; padding: 4px 9px; font-size: .7rem; }
}
@media (max-width: 400px) {
  .sg-map-location-grid { grid-template-columns: minmax(0, 1fr); }
  .sg-map-panel__heading { flex-direction: column; }
}
