/* The winery map (M2-MAP, MAP1): the brochure's printed map with its pins, the layer choice, the selection panel with the legend
   and the two lists. The design system's tokens only; the head, the source line, the notice, the filter bar and the buttons are
   the shared ones (components.css, institution.css, places.css). Numbered producers are burgundy pins, lettered attractions green
   ones, as in the prototype; a selected pin is larger and ringed, so it is not told by colour alone. */

.map-note {
  max-width: var(--size-44rem);
  margin: 0 0 var(--spacing-12);
  color: var(--color-text);
  font-size: var(--font-size-16);
  line-height: var(--line-height-24);
}

.map-body {
  gap: var(--spacing-24);
}

.map-tools {
  max-width: 100%;
}

/* With script the select filters on change: its 'Aplică' is hidden (the filter actions are a flex box, which [hidden] alone does not hide) */
.map-tools [hidden] {
  display: none;
}

.map-help {
  max-width: var(--size-44rem);
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-14);
  line-height: var(--line-height-20);
}

/* The frame and the panel: side by side from 1024 px, the panel under the frame below */
.map-layout {
  display: grid;
  gap: var(--spacing-24);
  align-items: start;
  min-width: 0;
}

@media (min-width: 1024px) {
  .map-layout {
    grid-template-columns: minmax(0, 1fr) var(--size-20rem);
  }
}

/* The frame: focusable and named; the image at the frame's width; a zoomed surface scrolls inside it, never the page */
.map-frame {
  position: relative;
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  border: var(--border-width-1) solid var(--color-border);
  border-radius: var(--border-radius-16);
  background: var(--color-surface);
}

.map-surface {
  position: relative;
  width: 100%;
  margin-inline: auto;
}

/* The stage: the zoom controls over the frame */
.map-stage {
  display: grid;
  gap: var(--spacing-12);
  min-width: 0;
}

.map-zoom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-8);
}

.map-zoom[hidden] {
  display: none;
}

.map-zoom-status {
  color: var(--color-text-secondary);
  font-size: var(--font-size-14);
  line-height: var(--line-height-20);
}

/* Zoomed (script): the frame is as high as the screen allows and scrolls inside, both ways. Nothing here catches the scrolling gesture:
   where the frame's own scroll ends the page scrolls on. */
.map-frame[data-zoomed] {
  max-height: min(75vh, var(--size-41rem));
}

@media (max-width: 767px) {
  .map-frame[data-zoomed] {
    max-height: min(70vh, var(--size-32rem));
  }
}

/* From 200 % the pins are 32 px (UI-11) */
.map-frame.is-large .map-pin {
  min-width: var(--size-2rem);
  min-height: var(--size-2rem);
}

/* A cluster of pins closer than 28 px, under 768 px: a count badge that zooms on activation. At least 24 px; Onest 600 14 px. */
.map-cluster {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: var(--size-2rem);
  min-height: var(--size-2rem);
  padding: 0 var(--spacing-4);
  border: var(--border-width-2) solid var(--color-background-base-default);
  border-radius: var(--border-radius-full);
  background: var(--color-text-base-default);
  box-shadow: var(--shadow-100);
  color: var(--color-background-base-default);
  font-family: var(--font-family-stack);
  font-size: var(--font-size-14);
  line-height: var(--line-height-20);
  font-weight: var(--font-weight-semibold);
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.map-cluster:focus-visible {
  z-index: 4;
}

.map-pin[data-clustered] {
  display: none;
}

.map-surface img {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
}

/* A pin: at least 24 px, Onest 600 12 px, centred on its printed marker */
.map-pin {
  position: absolute;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: var(--size-1-5rem);
  min-height: var(--size-1-5rem);
  padding: 0 var(--spacing-4);
  border: var(--border-width-2) solid var(--color-background-base-default);
  border-radius: var(--border-radius-full);
  background: var(--color-text-brand-default);
  box-shadow: var(--shadow-100);
  color: var(--color-background-base-default);
  font-family: var(--font-family-stack);
  font-size: var(--font-size-12);
  line-height: var(--line-height-16);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.map-pin.attraction {
  background: var(--color-text-positive-on-secondary);
}

.map-pin[hidden] {
  display: none;
}

.map-pin:hover {
  z-index: 2;
  text-decoration: underline;
}

/* The selected pin: larger, a dark ring around its white border, above the others */
.map-pin.is-selected,
.map-pin[aria-pressed="true"] {
  z-index: 3;
  min-width: var(--size-2rem);
  min-height: var(--size-2rem);
  font-size: var(--font-size-14);
  line-height: var(--line-height-20);
  box-shadow: 0 0 0 var(--border-width-3) var(--color-background-base-inverse-default), var(--shadow-100);
}

/* On keyboard focus the pin comes above its neighbours; the ring is the design's own, selected or not (the one rule of base.css) */
.map-pin:focus-visible {
  z-index: 4;
}

/* The selection panel and the legend */
.map-panel {
  display: grid;
  gap: var(--spacing-16);
  min-width: 0;
  padding: var(--spacing-24);
  border: var(--border-width-1) solid var(--color-border);
  border-radius: var(--border-radius-16);
  background: var(--color-surface);
}

.map-selection {
  display: grid;
  gap: var(--spacing-12);
}

.map-selection > *,
.map-selection p {
  margin: 0;
}

.map-selection [hidden] {
  display: none;
}

.map-selection h2 {
  margin: 0;
  font-size: var(--font-size-20);
  line-height: var(--line-height-28);
  overflow-wrap: anywhere;
}

.map-selection .eyebrow {
  margin: 0;
}

.map-not-found {
  padding: var(--spacing-12) var(--spacing-16);
  border: var(--border-width-1) solid var(--color-border-warning-secondary);
  border-radius: var(--border-radius-8);
  background: var(--color-background-warning-secondary);
  color: var(--color-text);
  font-weight: var(--font-weight-medium);
}

.map-facts {
  display: grid;
  gap: var(--spacing-8);
  margin: 0;
}

.map-facts dt {
  color: var(--color-text-secondary);
  font-size: var(--font-size-14);
  line-height: var(--line-height-20);
}

.map-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.map-divin {
  font-size: var(--font-size-14);
  line-height: var(--line-height-20);
}

.map-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-12);
}

.map-divider {
  width: 100%;
  margin: 0;
  border: 0;
  border-top: var(--border-width-1) solid var(--color-border);
}

.map-legend-title {
  margin: 0;
  font-size: var(--font-size-16);
  line-height: var(--line-height-24);
}

.map-legend {
  display: grid;
  gap: var(--spacing-8);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--font-size-14);
  line-height: var(--line-height-20);
}

.map-legend li {
  display: flex;
  align-items: center;
  gap: var(--spacing-8);
}

.map-key {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: var(--size-1-5rem);
  min-height: var(--size-1-5rem);
  border: var(--border-width-2) solid var(--color-background-base-default);
  border-radius: var(--border-radius-full);
  background: var(--color-text-brand-default);
  box-shadow: var(--shadow-100);
  color: var(--color-background-base-default);
  font-size: var(--font-size-12);
  line-height: var(--line-height-16);
  font-weight: var(--font-weight-semibold);
}

.map-key.attraction {
  background: var(--color-text-positive-on-secondary);
}

.map-swatch {
  flex: none;
  width: var(--size-1-5rem);
  min-height: var(--size-0-75rem);
  border: var(--border-width-1) solid var(--color-border);
  border-radius: var(--border-radius-4);
  background: var(--color-surface);
}

/* The groupings' swatches: the design's tokens closest to the printed areas (olive green, tan brown, red), so a reader matches
   a swatch to its area on the image */
.map-swatch.codru {
  border-color: var(--color-text-positive-on-secondary);
  background: var(--color-text-positive-on-secondary);
}

.map-swatch.stefan-voda {
  border-color: var(--color-text-warning);
  background: var(--color-text-warning);
}

.map-swatch.valul-lui-traian {
  border-color: var(--color-border-danger);
  background: var(--color-border-danger);
}

.map-swatch.route {
  border-color: var(--color-text-secondary);
}

.map-legend-note {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-14);
  line-height: var(--line-height-20);
}

/* The two lists: the text equivalent of the map */
.map-lists {
  display: grid;
  gap: var(--spacing-16);
  padding: var(--spacing-24);
  border: var(--border-width-1) solid var(--color-border);
  border-radius: var(--border-radius-16);
  background: var(--color-surface);
}

.map-lists-intro {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-14);
  line-height: var(--line-height-20);
}

.map-lists-grid {
  display: grid;
  gap: var(--spacing-32);
}

@media (min-width: 768px) {
  .map-lists-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.map-list-section[hidden] {
  display: none;
}

.map-list-section h2 {
  margin: 0 0 var(--spacing-16);
  font-size: var(--font-size-20);
  line-height: var(--line-height-28);
}

.map-list {
  display: grid;
  gap: var(--spacing-8);
  margin: 0;
  padding-inline-start: var(--spacing-24);
  font-size: var(--font-size-14);
  line-height: var(--line-height-20);
}

.map-list li {
  overflow-wrap: anywhere;
}

.map-list li[hidden] {
  display: none;
}

.map-list.lettered {
  padding-inline-start: 0;
  list-style: none;
}

/* A lettered item hangs its text beside its letter, as the numbered list does: a wrapped line starts under the text, not the letter */
.map-list.lettered li {
  display: grid;
  grid-template-columns: var(--size-1-25rem) minmax(0, 1fr);
  column-gap: var(--spacing-8);
  align-items: baseline;
}

.map-list-marker {
  display: inline-block;
  min-width: var(--size-1-25rem);
  font-weight: var(--font-weight-semibold);
}

.map-list-divin {
  color: var(--color-text-secondary);
}

.map-actions {
  margin-top: 0;
}

/* The selection as a sheet under 768 px: right under the map, raised, with a heavier top edge, so it reads as the map's own */
@media (max-width: 767px) {
  .map-panel {
    padding: var(--spacing-16);
  }

  .map-selection[data-sheet="open"] {
    padding: var(--spacing-16);
    border: var(--border-width-1) solid var(--color-border);
    border-top: var(--border-width-3) solid var(--color-text-brand-default);
    border-radius: var(--border-radius-12);
    background: var(--color-background-base-default);
    box-shadow: var(--shadow-100);
    scroll-margin-block: var(--spacing-16);
  }
}
