/* ==========================================================================
   Mount Elgon Hotel & Spa — Destination Map
   Every rule is scoped inside .elgon-map. No element selectors escape the
   root, no custom properties are declared on :root, and no font-face or
   reset is applied globally — the component can drop into any theme page
   (Elementor HTML widget, shortcode, template part) without touching it.
   ========================================================================== */

/* The root is matched by attribute as well as class so the box is reserved
   from first paint — before the script runs. Without this the placeholder
   collapses to zero height, the poster never shows, and the lazy-load
   IntersectionObserver never reports an intersection. */
.elgon-map,
[data-elgon-map] {
  /* --- palette, inherited in spirit from the mtelgon theme ---------------- */
  --em-cobalt:   #0132A2;   /* Mount Elgon royal blue — brand primary        */
  --em-ink:      #0B1A45;   /* deepest surface                               */
  --em-abyss:    #060F2C;   /* map land, one step below --em-ink             */
  --em-water:    #04091F;   /* water bodies — darker than land               */
  --em-gold:     #C6A14E;   /* Aqua Foam — routes, active markers, CTA       */
  --em-gold-dim: #A6833A;   /* Lagoon — pressed / secondary gold             */
  --em-ivory:    #F7F4EC;   /* typography on dark                            */
  --em-slate:    #8FA0C6;   /* soft blue-grey — secondary geography          */
  --em-slate-dk: #46517A;   /* muted rules, hairlines                        */
  --em-seafoam:  #C9D6F2;

  /* Identical stacks to the mtelgon theme's :root, so the map renders in the
     same faces the rest of the site does — Outfit for display AND all UI,
     Lora for prose. The theme sets headings at weight 200 and UI at 300; this
     component follows that split rather than inventing its own. */
  --em-head: 'Outfit', sans-serif;
  --em-body: 'Lora', Georgia, serif;
  --em-display-w: 200;
  --em-ui-w: 300;

  --em-ease: cubic-bezier(.22, .61, .36, 1);      /* cinematic, no overshoot */
  --em-fast: 400ms;
  --em-slow: 700ms;

  --em-glass: rgba(6, 15, 44, .82);
  --em-hair:  rgba(198, 161, 78, .28);

  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 620px;
  height: clamp(620px, 92vh, 1040px);
  background: var(--em-abyss);
  color: var(--em-ivory);
  font-family: var(--em-body);
  overflow: hidden;
  contain: layout paint;
  -webkit-font-smoothing: antialiased;
}

.elgon-map *,
.elgon-map *::before,
.elgon-map *::after { box-sizing: border-box; }

/* Optional full-bleed: hotel themes wrap page content in a reading column, and
   a map is one of the few things that should escape it. Requires no ancestor
   in the chain to clip overflow-x. Opt out with full_width="false". */
.elgon-map.is-fullbleed {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.elgon-map :focus-visible {
  outline: 2px solid var(--em-gold);
  outline-offset: 3px;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   1. Map canvas + static fallback
   -------------------------------------------------------------------------- */

/* MapLibre's stylesheet is injected at load time — i.e. AFTER this file — and
   it sets `.maplibregl-map { position: relative }` on this very element. At
   equal specificity the later sheet wins and the container collapses to zero
   height, so the map renders as a 300px stub. The descendant selector raises
   specificity to (0,2,0) and settles it regardless of load order. */
.elgon-map .em-canvas,
[data-elgon-map] .em-canvas {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
}

/* Same load-order problem as the container: MapLibre's sheet wins at equal
   specificity, so every override of its own chrome is scoped one level up. */
/* MapLibre's own attribution control is disabled in favour of the credit line
   below, which is part of the component's own markup. ODbL attribution is
   still shown in full — it is simply typeset rather than bolted on. */
.elgon-map .maplibregl-ctrl-bottom-left,
.elgon-map .maplibregl-ctrl-bottom-right,
.elgon-map .maplibregl-ctrl-logo { display: none; }
.elgon-map .maplibregl-ctrl-group { display: none; }   /* default zoom UI — ours replaces it */

.em-credit {
  position: absolute;
  right: 34px; bottom: 9px;
  z-index: 24;
  margin: 0;
  font-family: var(--em-head);
  font-size: 11.5px; font-weight: 300;
  letter-spacing: .06em;
  color: rgba(143, 160, 198, .62);
  pointer-events: auto;
}
.em-credit a { color: inherit; text-decoration: none; border-bottom: 1px solid rgba(143, 160, 198, .28); }
.em-credit a:hover { color: var(--em-gold); border-bottom-color: var(--em-hair); }

/* Lightweight poster shown until MapLibre + tiles are ready. Pure CSS —
   no image request, so it paints on first frame. */
.em-poster {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 90% at 78% 18%, rgba(1, 50, 162, .34) 0%, transparent 58%),
    radial-gradient(80% 70% at 22% 88%, rgba(198, 161, 78, .09) 0%, transparent 60%),
    linear-gradient(168deg, #0B1A45 0%, #060F2C 52%, #04091F 100%);
  transition: opacity var(--em-slow) var(--em-ease), visibility var(--em-slow);
}
.em-poster::after {
  /* a soft ridge silhouette — decorative, not a map */
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 42%;
  background: linear-gradient(to top, rgba(4, 9, 31, .9), transparent);
  clip-path: polygon(0 100%, 0 62%, 12% 54%, 24% 66%, 38% 40%, 52% 58%,
                     63% 26%, 71% 44%, 84% 30%, 100% 52%, 100% 100%);
  opacity: .55;
}
.elgon-map.is-ready .em-poster { opacity: 0; visibility: hidden; pointer-events: none; }

.em-poster-inner { position: relative; text-align: center; z-index: 1; }
.em-poster-mark {
  font-family: var(--em-head);
  font-size: 12.5px;
  font-weight: var(--em-ui-w);
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--em-gold);
  margin: 0 0 14px;
}
.em-poster-title {
  font-family: var(--em-head);
  font-size: clamp(24px, 3vw, 34px);
  font-weight: var(--em-display-w);
  letter-spacing: 1px;
  color: var(--em-ivory);
  margin: 0 0 22px;
}
.em-poster-bar {
  width: 132px; height: 1px; margin: 0 auto;
  background: rgba(143, 160, 198, .28);
  position: relative; overflow: hidden;
}
.em-poster-bar::after {
  content: ''; position: absolute; inset: 0; width: 40%;
  background: var(--em-gold);
  animation: em-sweep 1.5s var(--em-ease) infinite;
}
@keyframes em-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* --------------------------------------------------------------------------
   2. Editorial panel — "THE ROAD EAST"
   -------------------------------------------------------------------------- */

.em-editorial {
  position: absolute;
  top: 34px; left: 34px;
  z-index: 20;
  width: min(360px, calc(100% - 68px));
  padding: 30px 32px 28px;
  background: var(--em-glass);
  border: 1px solid var(--em-hair);
  border-radius: 3px;
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  backdrop-filter: blur(18px) saturate(1.15);
  box-shadow: 0 28px 64px -28px rgba(0, 0, 0, .85);
  transition: opacity var(--em-slow) var(--em-ease),
              transform var(--em-slow) var(--em-ease);
}
.elgon-map.is-editorial-hidden .em-editorial {
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}
/* The theme marks every section kicker with a 9px rotated square in the accent
   colour (.kicker::before). Reusing that motif is what makes this section read
   as part of the site rather than as an embedded widget. */
.em-editorial-kicker {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--em-head);
  font-size: 13px; font-weight: var(--em-ui-w);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--em-gold);
  margin: 0 0 16px;
}
.em-editorial-kicker::before,
.em-card-kicker::before {
  content: '';
  width: 9px; height: 9px;
  background: currentColor;
  transform: rotate(45deg);
  flex-shrink: 0;
}
.em-editorial-title {
  font-family: var(--em-head);
  font-size: clamp(28px, 2.6vw, 36px);
  font-weight: var(--em-display-w); line-height: 1.14;
  letter-spacing: .8px;
  color: var(--em-ivory);
  margin: 0 0 16px;
}
.em-editorial-body {
  font-size: 14.5px; line-height: 1.72;
  color: rgba(247, 244, 236, .72);
  margin: 0 0 22px;
}
.em-editorial-body em { font-style: italic; color: rgba(247, 244, 236, .85); }
.em-editorial-cta {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--em-head);
  font-size: 14.5px; font-weight: var(--em-ui-w);
  letter-spacing: .6px;
  color: var(--em-gold);
  background: none; border: 0; padding: 0;
  cursor: pointer;
  transition: color var(--em-fast) var(--em-ease);
}
.em-editorial-cta:hover { color: var(--em-ivory); }
.em-editorial-cta span:last-child {
  transition: transform var(--em-fast) var(--em-ease);
}
.em-editorial-cta:hover span:last-child { transform: translateX(5px); }

/* --------------------------------------------------------------------------
   3. Category control — "Explore from Mount Elgon Hotel"
   -------------------------------------------------------------------------- */

.em-filters {
  position: absolute;
  top: 34px; right: 34px;
  z-index: 20;
  padding: 22px 24px 20px;
  background: var(--em-glass);
  border: 1px solid var(--em-hair);
  border-radius: 3px;
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  backdrop-filter: blur(18px) saturate(1.15);
  box-shadow: 0 28px 64px -28px rgba(0, 0, 0, .85);
  max-width: 250px;
}
.em-filters-label {
  font-family: var(--em-head);
  font-size: 11.5px; font-weight: var(--em-ui-w);
  letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--em-slate);
  margin: 0 0 15px;
}
.em-filters-list {
  display: flex; flex-direction: column; gap: 1px;
  list-style: none; margin: 0; padding: 0;
}
.em-filter {
  position: relative;
  display: flex; align-items: baseline; gap: 10px;
  width: 100%;
  font-family: var(--em-head);
  font-size: 15px; font-weight: var(--em-ui-w);
  letter-spacing: .5px;
  color: rgba(247, 244, 236, .62);
  background: none; border: 0;
  padding: 8px 10px 8px 14px;
  text-align: left; cursor: pointer;
  border-radius: 2px;
  transition: color var(--em-fast) var(--em-ease),
              background-color var(--em-fast) var(--em-ease);
}
.em-filter::before {
  content: '';
  position: absolute; left: 0; top: 50%;
  width: 1px; height: 0;
  background: var(--em-gold);
  transform: translateY(-50%);
  transition: height var(--em-fast) var(--em-ease);
}
.em-filter:hover { color: var(--em-ivory); background: rgba(255, 255, 255, .035); }
.em-filter[aria-pressed="true"] { color: var(--em-gold); }
.em-filter[aria-pressed="true"]::before { height: 62%; }
.em-filter-count {
  font-size: 10px; font-weight: 400;
  color: var(--em-slate-dk);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}
.em-filter[aria-pressed="true"] .em-filter-count { color: var(--em-gold-dim); }

/* --------------------------------------------------------------------------
   4. Custom map controls + elevation scale
   -------------------------------------------------------------------------- */

.em-controls {
  position: absolute;
  right: 34px; bottom: 152px;
  z-index: 20;
  display: flex; flex-direction: column; gap: 8px;
}
.em-ctrl {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: var(--em-glass);
  border: 1px solid rgba(143, 160, 198, .2);
  border-radius: 2px;
  color: rgba(247, 244, 236, .78);
  cursor: pointer;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transition: border-color var(--em-fast) var(--em-ease),
              color var(--em-fast) var(--em-ease),
              background-color var(--em-fast) var(--em-ease);
}
.em-ctrl:hover {
  border-color: var(--em-hair);
  color: var(--em-gold);
  background: rgba(11, 26, 69, .9);
}
.em-ctrl[aria-pressed="true"] { color: var(--em-gold); border-color: var(--em-hair); }
.em-ctrl svg { width: 17px; height: 17px; display: block; }

.em-elevation {
  position: absolute;
  left: 34px; bottom: 152px;
  z-index: 18;
  display: flex; align-items: flex-end; gap: 9px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity var(--em-slow) var(--em-ease),
              transform var(--em-slow) var(--em-ease);
}
.elgon-map.is-terrain .em-elevation { opacity: 1; transform: none; }
.em-elevation-bar {
  width: 3px; height: 116px; border-radius: 2px;
  background: linear-gradient(to top,
      rgba(70, 81, 122, .55) 0%,
      rgba(143, 160, 198, .5) 42%,
      rgba(198, 161, 78, .75) 82%,
      var(--em-gold) 100%);
}
.em-elevation-ticks {
  display: flex; flex-direction: column;
  justify-content: space-between;
  height: 116px;
  font-family: var(--em-head);
  font-size: 10px; font-weight: var(--em-ui-w);
  letter-spacing: .6px;
  color: var(--em-slate);
  font-variant-numeric: tabular-nums;
}
.em-elevation-ticks span:first-child { color: var(--em-gold); }

/* --------------------------------------------------------------------------
   5. "From the hotel" ribbon
   -------------------------------------------------------------------------- */

.em-ribbon {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 22;
  padding: 20px 34px 34px;                 /* extra base keeps the attribution clear */
  background: linear-gradient(to top,
      rgba(4, 9, 31, .97) 0%, rgba(4, 9, 31, .92) 45%, rgba(4, 9, 31, 0) 100%);
}
.em-ribbon-label {
  font-family: var(--em-head);
  font-size: 11.5px; font-weight: var(--em-ui-w);
  letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--em-slate);
  margin: 0 0 13px;
}
.em-ribbon-list {
  display: flex; align-items: stretch; gap: 0;
  list-style: none; margin: 0; padding: 0;
}
.em-ribbon-list > li { flex: 1 1 0; min-width: 0; }
.em-stop {
  position: relative;
  display: block; width: 100%;
  padding: 12px 18px 12px 0;
  background: none; border: 0;
  border-top: 1px solid rgba(143, 160, 198, .18);
  text-align: left; cursor: pointer;
  transition: border-color var(--em-fast) var(--em-ease);
}
.em-stop::after {
  content: '';
  position: absolute; left: 0; top: -1px;
  height: 1px; width: 0;
  background: var(--em-gold);
  transition: width var(--em-slow) var(--em-ease);
}
.em-stop:hover::after,
.em-stop[aria-current="true"]::after { width: 100%; }
.em-stop-time {
  display: block;
  font-family: var(--em-head);
  font-size: 11.5px; font-weight: var(--em-ui-w);
  letter-spacing: 1.1px;
  color: var(--em-gold);
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}
.em-stop-name {
  display: block;
  font-family: var(--em-head);
  font-size: 16.5px; font-weight: var(--em-ui-w);
  letter-spacing: .5px;
  color: rgba(247, 244, 236, .78);
  transition: color var(--em-fast) var(--em-ease);
}
.em-stop:hover .em-stop-name,
.em-stop[aria-current="true"] .em-stop-name { color: var(--em-ivory); }

/* --------------------------------------------------------------------------
   6. Markers
   -------------------------------------------------------------------------- */

.em-marker {
  position: relative;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  cursor: pointer;
  background: none; border: 0; padding: 0;
  transition: transform var(--em-fast) var(--em-ease),
              opacity var(--em-fast) var(--em-ease);
  will-change: transform;
}
.em-marker-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--em-gold);
  box-shadow: 0 0 0 1px rgba(4, 9, 31, .9), 0 2px 6px rgba(0, 0, 0, .6);
  transition: transform var(--em-fast) var(--em-ease),
              box-shadow var(--em-fast) var(--em-ease);
}
.em-marker-halo {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(198, 161, 78, .55);
  opacity: 0;
  transform: scale(.55);
  transition: opacity var(--em-fast) var(--em-ease),
              transform var(--em-fast) var(--em-ease);
}
.em-marker:hover { transform: translateY(-3px); }
.em-marker:hover .em-marker-dot { transform: scale(1.35); }
.em-marker:hover .em-marker-halo { opacity: 1; transform: scale(1); }

.em-marker.is-active .em-marker-dot {
  transform: scale(1.45);
  box-shadow: 0 0 0 1px rgba(4, 9, 31, .9), 0 0 14px rgba(198, 161, 78, .55);
}
.em-marker.is-active .em-marker-halo {
  opacity: 1; transform: scale(1);
  animation: em-ring 2.4s var(--em-ease) infinite;
}
@keyframes em-ring {
  0%   { transform: scale(.85); opacity: .75; }
  70%  { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* The hotel — the anchor of the whole map, so it names itself permanently:
   a gold icon badge with a standing pulse, and a nameplate set to its right. */
.em-marker.is-hotel { width: 40px; height: 40px; }
.em-marker.is-hotel .em-marker-dot { display: none; }
.em-marker.is-hotel .em-marker-halo { inset: 3px; }

.em-hotel-badge {
  position: relative;
  z-index: 2;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--em-gold);
  color: var(--em-ink);
  box-shadow: 0 0 0 3px rgba(4, 9, 31, .92), 0 4px 16px rgba(0, 0, 0, .55);
  transition: transform var(--em-fast) var(--em-ease),
              box-shadow var(--em-fast) var(--em-ease);
}
.em-hotel-badge svg { width: 19px; height: 19px; display: block; }
.em-marker.is-hotel:hover .em-hotel-badge,
.em-marker.is-hotel.is-active .em-hotel-badge {
  transform: scale(1.1);
  box-shadow: 0 0 0 3px rgba(4, 9, 31, .92), 0 0 22px rgba(198, 161, 78, .7);
}

.em-hotel-plate {
  position: absolute;
  left: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 3px;
  padding: 7px 12px 8px;
  border-radius: 2px;
  background: rgba(6, 15, 44, .72);
  border-left: 1px solid var(--em-gold);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  white-space: nowrap;
  text-align: left;
  pointer-events: none;
}
.em-hotel-name {
  font-family: var(--em-head);
  font-weight: var(--em-ui-w);
  font-size: 16px; line-height: 1.15;
  letter-spacing: .5px;
  color: var(--em-ivory);
  text-shadow: 0 1px 6px rgba(4, 9, 31, .9);
}
.em-hotel-sub {
  font-family: var(--em-head);
  font-size: 10px; font-weight: var(--em-ui-w);
  letter-spacing: .9px;
  color: var(--em-gold);
}

/* The plate stays inert so it can never swallow a drag on the map — the one
   thing inside it that takes a pointer is the directions link. */
.elgon-map .em-hotel-plate a { pointer-events: auto; }
.elgon-map .em-hotel-dir {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 5px;
  /* The anchor sets line-height:0 for MapLibre and the plate inherits it, so
     this line must state its own or it collapses onto the address above. */
  line-height: 1;
  margin-top: 7px;
  padding-bottom: 2px;
  font-family: var(--em-head);
  font-size: 10px; font-weight: var(--em-ui-w);
  letter-spacing: .9px;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(247, 244, 236, .82);
  border-bottom: 1px solid rgba(198, 161, 78, .38);
  transition: color var(--em-fast) var(--em-ease),
              border-color var(--em-fast) var(--em-ease);
}
.elgon-map .em-hotel-dir:hover,
.elgon-map .em-hotel-dir:focus-visible { color: var(--em-gold); border-bottom-color: var(--em-gold); }
.elgon-map .em-hotel-dir-arrow { transition: transform var(--em-fast) var(--em-ease); }
.elgon-map .em-hotel-dir:hover .em-hotel-dir-arrow { transform: translate(2px, -2px); }

.em-marker.is-hotel::before,
.em-marker.is-hotel::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  margin: -17px 0 0 -17px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(198, 161, 78, .55);
  animation: em-pulse 3.2s var(--em-ease) infinite;
}
.em-marker.is-hotel::after { animation-delay: 1.6s; }
@keyframes em-pulse {
  0%   { transform: scale(.7); opacity: .8; }
  75%  { transform: scale(2.1); opacity: 0; }
  100% { transform: scale(2.1); opacity: 0; }
}

/* peaks + trail camps read as geography, not destinations */
.em-marker.is-peak .em-marker-dot {
  width: 0; height: 0; border-radius: 0;
  background: none;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 8px solid var(--em-slate);
  box-shadow: none;
}
.em-marker.is-peak.is-summit .em-marker-dot { border-bottom-color: var(--em-gold); }
.em-marker.is-camp .em-marker-dot {
  width: 6px; height: 6px;
  background: none;
  border: 1px solid var(--em-seafoam);
  box-shadow: none;
}

/* The anchor is MapLibre's; it positions it and, under terrain, writes an
   inline opacity on it. It must stay geometry-only. */
.em-marker-anchor { line-height: 0; will-change: transform; }

.em-marker.is-dimmed { opacity: .16; pointer-events: none; }
.em-marker.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(.6);
  visibility: hidden;
}

/* hover label */
.em-tip {
  position: absolute;
  left: 50%; bottom: calc(100% + 6px);
  transform: translate(-50%, 4px);
  min-width: max-content; max-width: 230px;
  padding: 9px 13px 10px;
  background: var(--em-glass);
  border: 1px solid var(--em-hair);
  border-radius: 3px;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 40px -18px rgba(0, 0, 0, .9);
  opacity: 0; pointer-events: none;
  transition: opacity var(--em-fast) var(--em-ease),
              transform var(--em-fast) var(--em-ease);
}
.em-marker:hover .em-tip,
.em-marker:focus-visible .em-tip { opacity: 1; transform: translate(-50%, 0); }
.em-tip-name {
  display: block;
  font-family: var(--em-head);
  font-weight: var(--em-ui-w);
  font-size: 15px; letter-spacing: .4px; color: var(--em-ivory);
  white-space: nowrap;
}
.em-tip-meta {
  display: block; margin-top: 4px;
  font-family: var(--em-head);
  font-size: 11.5px; font-weight: var(--em-ui-w);
  letter-spacing: .7px;
  color: var(--em-gold);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   7. Destination card (desktop) / bottom sheet (mobile)
   -------------------------------------------------------------------------- */

.em-card {
  position: absolute;
  left: 34px; bottom: 152px;
  z-index: 30;
  width: min(384px, calc(100% - 68px));
  /* The travel headline makes a full card tall; on a short laptop viewport it
     would run past the top of the map. Cap it to the space above the ribbon
     and let it scroll inside itself instead. */
  max-height: calc(100% - 200px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px 30px 26px;
  background: var(--em-glass);
  border: 1px solid var(--em-hair);
  border-radius: 3px;
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  backdrop-filter: blur(22px) saturate(1.2);
  box-shadow: 0 34px 74px -30px rgba(0, 0, 0, .9);
  opacity: 0;
  transform: translateY(16px);
  visibility: hidden;
  transition: opacity var(--em-slow) var(--em-ease),
              transform var(--em-slow) var(--em-ease),
              visibility var(--em-slow);
}
.em-card.is-open { opacity: 1; transform: none; visibility: visible; }

.em-card-close {
  position: absolute; top: 16px; right: 16px;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: none; border: 0;
  color: var(--em-slate); cursor: pointer;
  transition: color var(--em-fast) var(--em-ease);
}
.em-card-close:hover { color: var(--em-gold); }
.em-card-close svg { width: 11px; height: 11px; }

.em-card-kicker {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--em-head);
  font-size: 12.5px; font-weight: var(--em-ui-w);
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--em-gold);
  margin: 0 0 12px;
}
.em-card-title {
  font-family: var(--em-head);
  font-size: 27px; font-weight: var(--em-display-w); line-height: 1.18;
  letter-spacing: .6px;
  color: var(--em-ivory);
  margin: 0 0 14px;
  padding-right: 22px;
}
.em-card-meta {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
  font-family: var(--em-head);
  font-size: 13px; font-weight: var(--em-ui-w);
  letter-spacing: .7px;
  color: var(--em-gold);
  margin: 0 0 12px;
  font-variant-numeric: tabular-nums;
}
.em-card-meta .em-sep { color: var(--em-slate-dk); }

/* "How far is it from the hotel" is the question this card exists to answer,
   so the figure is set as a headline, not as caption text under the title. */
.em-card-travel {
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 18px;
  padding: 14px 0 15px;
  border-top: 1px solid rgba(198, 161, 78, .22);
  border-bottom: 1px solid rgba(198, 161, 78, .22);
}
.em-travel-big {
  font-family: var(--em-head);
  font-size: 34px; font-weight: var(--em-display-w);
  line-height: 1;
  letter-spacing: .5px;
  color: var(--em-gold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.em-travel-rest { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.em-travel-lead {
  font-family: var(--em-head);
  font-size: 13.5px; font-weight: var(--em-ui-w);
  letter-spacing: .8px;
  text-transform: uppercase;
  color: rgba(247, 244, 236, .86);
}
.em-travel-sub {
  font-family: var(--em-head);
  font-size: 12.5px; font-weight: var(--em-ui-w);
  letter-spacing: .5px;
  color: var(--em-slate);
  font-variant-numeric: tabular-nums;
}
.em-card-activity {
  font-family: var(--em-head);
  font-size: 13px; font-weight: var(--em-ui-w);
  letter-spacing: .9px;
  color: var(--em-slate);
  margin: 0 0 16px;
  text-transform: uppercase;
}
.em-card-desc {
  font-size: 14.5px; line-height: 1.74;
  color: rgba(247, 244, 236, .74);
  margin: 0 0 18px;
}
/* Trail spec list — was inline-styled in the JS; a class keeps it on the
   theme's type scale like everything else. */
.em-trail-specs {
  display: grid; grid-template-columns: auto 1fr; gap: 7px 16px;
  margin: 0 0 18px;
}
.em-trail-specs dt {
  font-family: var(--em-head);
  font-size: 12.5px; font-weight: var(--em-ui-w);
  letter-spacing: .9px; text-transform: uppercase;
  color: var(--em-slate);
}
.em-trail-specs dd {
  margin: 0;
  font-family: var(--em-body);
  font-size: 14.5px; line-height: 1.55;
  color: rgba(247, 244, 236, .82);
}

.em-card-note {
  position: relative;
  font-size: 12px; line-height: 1.6;
  color: rgba(143, 160, 198, .8);
  margin: 0 0 20px;
  padding-left: 13px;
  border-left: 1px solid rgba(143, 160, 198, .3);
}
.em-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* The theme's buttons are pills — border-radius 24-26px, Outfit 300, ~15.5px,
   generous horizontal padding. Matching that is the single most recognisable
   carry-over from the site's visual language. */
.em-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--em-head);
  font-size: 14.5px; font-weight: var(--em-ui-w);
  letter-spacing: .6px;
  text-decoration: none;
  padding: 12px 28px;
  min-height: 44px;
  border-radius: 24px;
  cursor: pointer;
  transition: background-color var(--em-fast) var(--em-ease),
              color var(--em-fast) var(--em-ease),
              border-color var(--em-fast) var(--em-ease);
}
.em-btn-primary {
  background: var(--em-gold);
  color: var(--em-ink);
  border: 1px solid var(--em-gold);
}
.em-btn-primary:hover { background: var(--em-gold-dim); border-color: var(--em-gold-dim); color: var(--em-ink); }
.em-btn-ghost {
  background: none;
  color: rgba(247, 244, 236, .8);
  border: 1px solid rgba(143, 160, 198, .32);
}
.em-btn-ghost:hover { color: var(--em-gold); border-color: var(--em-hair); }
.em-btn span:last-child { transition: transform var(--em-fast) var(--em-ease); }
.em-btn:hover span:last-child { transform: translateX(4px); }

/* --------------------------------------------------------------------------
   8. Trail panel (Mountain Trails mode)
   -------------------------------------------------------------------------- */

.em-trailbar {
  position: absolute;
  left: 50%; top: 34px;
  transform: translate(-50%, -14px);
  z-index: 21;
  display: flex; gap: 1px;
  padding: 5px;
  background: var(--em-glass);
  border: 1px solid var(--em-hair);
  border-radius: 3px;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  opacity: 0; visibility: hidden;
  transition: opacity var(--em-fast) var(--em-ease),
              transform var(--em-fast) var(--em-ease),
              visibility var(--em-fast);
}
.elgon-map.is-trails .em-trailbar { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.em-trailbtn {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--em-head);
  font-size: 14px; font-weight: var(--em-ui-w);
  letter-spacing: .6px;
  color: rgba(247, 244, 236, .66);
  background: none; border: 0;
  padding: 9px 15px; cursor: pointer;
  border-radius: 2px;
  transition: color var(--em-fast) var(--em-ease),
              background-color var(--em-fast) var(--em-ease);
}
.em-trailbtn:hover { color: var(--em-ivory); background: rgba(255, 255, 255, .04); }
.em-trailbtn[aria-pressed="true"] { color: var(--em-ink); background: var(--em-gold); }
.elgon-map .em-trailbtn { border-radius: 22px; padding-left: 18px; padding-right: 18px; }
.em-trailswatch {
  width: 16px; height: 2px; border-radius: 2px;
  background: currentColor; opacity: .85; flex: none;
}
.em-trailbtn[data-trail="sipi"] .em-trailswatch {
  background: repeating-linear-gradient(to right, currentColor 0 4px, transparent 4px 7px);
}
.em-trailbtn[data-trail="piswa"] .em-trailswatch {
  background: repeating-linear-gradient(to right, currentColor 0 2px, transparent 2px 5px);
  opacity: .5;
}

/* --------------------------------------------------------------------------
   9. Fullscreen
   -------------------------------------------------------------------------- */

.elgon-map:fullscreen { height: 100%; min-height: 0; }
.elgon-map:fullscreen .em-canvas { inset: 0; }

/* --------------------------------------------------------------------------
   10. Mobile — bottom sheet, scrollable pills, no hover dependency
   -------------------------------------------------------------------------- */

@media (max-width: 860px) {
  .elgon-map { height: clamp(560px, 88vh, 780px); }

  .em-editorial {
    top: 18px; left: 18px; right: 18px;
    width: auto;
    padding: 20px 22px 18px;
  }
  .em-editorial-title { font-size: 22px; }
  .em-editorial-body { font-size: 13.5px; margin-bottom: 16px; }

  /* filters become a horizontally scrollable pill rail */
  .em-filters {
    top: auto; right: 0; left: 0;
    bottom: 128px;
    max-width: none;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .em-filters-label { display: none; }
  .em-filters-list {
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    /* Without this the gutter in `padding` counts as scrollable slack and the
       row rests at scrollLeft:18, clipping its own first chip. */
    scroll-padding-inline: 18px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 18px 6px;
  }
  .em-filters-list::-webkit-scrollbar { display: none; }
  .em-filters-list > li { flex: 0 0 auto; scroll-snap-align: start; }
  .em-filter {
    width: auto;
    min-height: 44px;
    padding: 11px 16px;
    border-radius: 999px;
    border: 1px solid rgba(143, 160, 198, .28);
    background: rgba(6, 15, 44, .86);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    white-space: nowrap;
    font-size: 12.5px;
  }
  .em-filter::before { display: none; }
  .em-filter[aria-pressed="true"] {
    color: var(--em-ink);
    background: var(--em-gold);
    border-color: var(--em-gold);
  }
  .em-filter-count { display: none; }

  .em-ribbon { padding: 16px 0 38px; }
  .em-credit {
    left: 18px; right: 18px; bottom: 8px;
    font-size: 8.5px; line-height: 1.45;
    text-align: left;
  }
  .em-ribbon-label { padding: 0 18px; margin-bottom: 10px; }
  .em-ribbon-list {
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 18px;
    gap: 22px;
  }
  .em-ribbon-list::-webkit-scrollbar { display: none; }
  .em-ribbon-list > li { flex: 0 0 auto; scroll-snap-align: start; }
  .em-stop { padding: 10px 0; min-width: 92px; }
  .em-stop-name { font-size: 14.5px; }

  .em-controls { right: 18px; bottom: 200px; }
  .em-ctrl { width: 34px; height: 34px; }
  .em-elevation { left: 18px; bottom: 200px; }

  .em-trailbar {
    top: auto; bottom: 178px;
    left: 18px; right: 18px;
    transform: none;
    justify-content: space-between;
  }
  .elgon-map.is-trails .em-trailbar { transform: none; }
  .em-trailbtn { flex: 1 1 0; justify-content: center; padding: 9px 8px; font-size: 10.5px; }

  /* card becomes a bottom sheet */
  .em-card {
    left: 0; right: 0; bottom: 0;
    width: 100%;
    max-height: 72%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 26px 22px 30px;
    border-radius: 14px 14px 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
    transform: translateY(100%);
  }
  .em-card.is-open { transform: translateY(0); }
  .em-card::before {
    content: '';
    display: block;
    width: 38px; height: 3px;
    border-radius: 3px;
    background: rgba(143, 160, 198, .38);
    margin: -8px auto 18px;
  }
  .em-card-title { font-size: 22px; }
  .em-card-actions { flex-direction: column; align-items: stretch; }
  .em-btn { justify-content: center; }

  /* hover tooltips never gate information on touch */
  .em-marker:hover { transform: none; }
  .em-marker .em-tip { display: none; }

  .em-hotel-plate { padding: 5px 9px 6px; }
  .em-hotel-name { font-size: 13px; }
  .em-hotel-sub { display: none; }          /* the address is in the card */
  /* Directions stay — on a phone this is the most useful control on the map.
     Sized up a little so it is a real tap target rather than 8.5px of text. */
  .elgon-map .em-hotel-dir {
    margin-top: 4px;
    padding: 2px 0 3px;
    font-size: 11px;
    letter-spacing: .8px;
  }
  .em-card-travel { gap: 12px; padding: 12px 0 13px; margin-bottom: 16px; }
  .em-travel-big { font-size: 26px; }
  .em-travel-lead { font-size: 11.5px; }
}

/* --------------------------------------------------------------------------
   11. Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .elgon-map *,
  .elgon-map *::before,
  .elgon-map *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ---------------------------------------------------------------------------
   MARKER PULSE — inviting a click without nagging
   ---------------------------------------------------------------------------
   The gold dots read as decoration until you happen to hover one, so they get a
   slow breathing pulse: a click affordance, not an alarm. Two deliberate
   choices keep it from becoming irritating:

   1. It is a SOFT pulse, not a blink. Hard on/off flashing is both visually
      cheap and an accessibility hazard, and anything near 3Hz is a seizure risk.
      This runs at roughly 0.3Hz.
   2. The dots are STAGGERED (--em-pulse-delay, set per marker in the JS), so
      they breathe independently. In unison it looks like a fault indicator.

   Hovering, opening a place, or hiding a marker all stop the idle pulse — at
   that point the visitor has already found it and the invitation is spent.
   --------------------------------------------------------------------------- */

@keyframes em-dot-breathe {
  0%, 100% { transform: scale(1);
             box-shadow: 0 0 0 1px rgba(4, 9, 31, .9), 0 2px 6px rgba(0, 0, 0, .6); }
  50%      { transform: scale(1.22);
             box-shadow: 0 0 0 1px rgba(4, 9, 31, .9), 0 0 12px rgba(198, 161, 78, .55); }
}

.em-marker:not(.is-active):not(.is-hidden):not(.is-hotel):not(.is-cued):not(:hover) .em-marker-dot {
  animation: em-dot-breathe 3.6s var(--em-ease) infinite;
  animation-delay: var(--em-pulse-delay, 0s);
}

/* ---------------------------------------------------------------------------
   FILTER CUE — answering "which ones did I just ask for?"
   ---------------------------------------------------------------------------
   Choosing a category hides the markers that do not match, but on a map this
   size a disappearance is easy to miss. The ones that REMAIN therefore fire a
   short, louder ring — three beats, then silence, so it draws the eye to the
   answer and then gets out of the way. It is time-boxed in the JS rather than
   left running, because a permanently pulsing map is a permanently distracting
   one. --------------------------------------------------------------------- */

/* NOTE on the :not(.is-cued) above — it is load-bearing, not tidiness. Each
   :not() adds class-level specificity, so the idle selector scores higher than
   `.em-marker.is-cued .em-marker-dot` below and would win the `animation`
   property outright, leaving a cued marker still breathing slowly instead of
   firing its three beats. Excluding the cued state is what lets the louder
   animation take over. */

@keyframes em-cue-ring {
  0%   { transform: scale(.7);  opacity: .95; }
  75%  { transform: scale(1.85); opacity: 0; }
  100% { transform: scale(1.85); opacity: 0; }
}

.em-marker.is-cued .em-marker-halo {
  opacity: 1;
  border-color: rgba(198, 161, 78, .9);
  animation: em-cue-ring 1s var(--em-ease) 3;
}
.em-marker.is-cued .em-marker-dot {
  animation: em-dot-breathe 1s var(--em-ease) 3;
  animation-delay: 0s;
}

/* Someone who has asked for less motion gets the state without the movement:
   the cued markers still brighten, they simply do not animate. */
@media (prefers-reduced-motion: reduce) {
  .em-marker .em-marker-dot,
  .em-marker.is-cued .em-marker-halo,
  .em-marker.is-cued .em-marker-dot {
    animation: none !important;
  }
  .em-marker.is-cued .em-marker-dot {
    transform: scale(1.22);
    box-shadow: 0 0 0 1px rgba(4, 9, 31, .9), 0 0 12px rgba(198, 161, 78, .55);
  }
  .em-marker.is-cued .em-marker-halo { opacity: 1; transform: scale(1.1); }
}
