/* =========================================================
   map-regions.css — Vineyard Regions Map (/map-regions/)
   Uses the standard site header + footer from layout.njk.
   Only overrides what needs to differ from the base styles.
   ========================================================= */

/* ── Override site main constraints ──────────────────────── */
body.vr-page main {
  padding: 0 !important;
  margin: 0 auto !important;
  max-width: 1120px !important;
  width: 100% !important;
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
}

/* ── Intro text (above map) ──────────────────────────────── */
.vr-intro {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 20px 20px;
}

.vr-intro__title {
  font-family: var(--ff-display, serif);
  font-size: 1.75rem;
  font-weight: 700;
  color: #111;
  margin: 0 0 8px;
  line-height: 1.2;
}

.vr-intro__lead {
  font-size: 1rem;
  color: #555;
  margin: 0;
  max-width: 680px;
  line-height: 1.6;
}

/* ── FAQ section (below map) ─────────────────────────────── */
.vr-faq {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

/* ── Body wrapper — map + panel side by side ─────────────── */
.vr-body {
  display: flex;
  flex-direction: row;
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
  /* Minimum usable map height regardless of window size */
  min-height: 480px;
}

/* ── Map canvas ─────────────────────────────────────────── */
.vr-map {
  flex: 1;
  min-width: 0;
  position: relative;
}

/* Ensure Mapbox canvas fills the container */
body.vr-page .vr-map .mapboxgl-map,
body.vr-page .vr-map .mapboxgl-canvas-container {
  width: 100% !important;
  height: 100% !important;
}

body.vr-page .vr-map .mapboxgl-canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── Breadcrumb button (← All regions) ───────────────────── */
.vr-breadcrumb[hidden] {
  display: none !important;
}

.vr-breadcrumb {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: background 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.vr-breadcrumb:hover {
  background: #f7f7f7;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.16);
}

/* ── Side panel ─────────────────────────────────────────── */
.vr-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 340px;
  background: #fff;
  overflow-y: auto;
  z-index: 8;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.10);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
  border-left: 1px solid rgba(0, 0, 0, 0.06);
}

.vr-panel.is-open {
  transform: translateX(0);
}

.vr-panel__inner {
  padding: 20px 18px 32px;
}

.vr-panel__header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.vr-panel__title {
  font-size: 18px;
  font-weight: 700;
  color: #111;
  margin: 0 0 4px;
  line-height: 1.2;
}

.vr-panel__count {
  font-size: 13px;
  color: #777;
  margin: 0;
}

.vr-panel__desc {
  margin-top: 10px;
  font-size: 13px;
  color: #555;
  line-height: 1.55;
}

.vr-panel__desc p {
  margin: 0 0 8px;
}

.vr-panel__desc p:last-child {
  margin-bottom: 0;
}

/* ── Panel vineyard list ─────────────────────────────────── */
.vr-panel__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.vr-card {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.vr-card:last-child {
  border-bottom: none;
}

.vr-card__link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
  border-radius: 6px;
  padding: 10px 8px;
}

.vr-card__link:hover {
  background: #f7f9f7;
}

.vr-card__name {
  font-size: 14px;
  font-weight: 600;
  color: #111;
  line-height: 1.3;
}

.vr-card__county {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

/* ── Vineyard pin popup (custom card, mirrors /map lvf-pin-popup) ──── */
.vr-pin-popup {
  position: absolute;
  bottom: 16px;
  left: 12px;
  z-index: 20;
  width: 280px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  overflow: hidden;
  animation: vrPopupIn 0.22s ease;
}
.vr-pin-popup[hidden] { display: none !important; }

@keyframes vrPopupIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.vr-pin-popup__close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255,255,255,0.92);
  border: 1px solid #ddd;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  z-index: 1;
  line-height: 1;
}

.vr-pin-popup__inner {
  padding: 14px 44px 14px 14px;
}

.vr-pin-popup__name {
  display: block;
  font-size: 0.93rem;
  font-weight: 700;
  color: #111;
  text-decoration: none;
  line-height: 1.3;
  margin-bottom: 3px;
}
.vr-pin-popup__name:hover { color: #3a7c47; text-decoration: underline; }

.vr-pin-popup__county {
  font-size: 0.78rem;
  color: #888;
  margin-bottom: 10px;
}

.vr-pin-popup__view {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #3a7c47;
  text-decoration: none;
}
.vr-pin-popup__view:hover { text-decoration: underline; }

/* ── Hover tooltip (mousemove popup) ─────────────────────── */
.vr-hover-popup .mapboxgl-popup-content {
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.24);
  pointer-events: none;
}

.vr-hover-popup .mapboxgl-popup-tip {
  border-top-color: rgba(0, 0, 0, 0.78);
}

.vr-hover-popup.mapboxgl-popup-anchor-top .mapboxgl-popup-tip {
  border-bottom-color: rgba(0, 0, 0, 0.78);
  border-top-color: transparent;
}

.vr-hover-popup .mapboxgl-popup-close-button {
  display: none;
}

/* ── Mapbox attribution ───────────────────────────────────── */
body.vr-page .vr-map .mapboxgl-ctrl-bottom-right,
body.vr-page .vr-map .mapboxgl-ctrl-bottom-left {
  z-index: 4;
}

/* ── Mobile: panel below map ─────────────────────────────── */
@media (max-width: 768px) {
  .vr-body {
    flex-direction: column;
    overflow: visible;
    min-height: 0;
  }

  .vr-map {
    position: sticky;
    top: 0;
    z-index: 10;
    height: 50vh;
    min-height: 260px;
    flex: none;
  }

  .vr-panel {
    position: static;
    transform: none !important;
    width: 100%;
    height: auto;
    max-height: none;
    box-shadow: 0 -3px 16px rgba(0, 0, 0, 0.08);
    border-left: none;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: none;
  }

  .vr-panel.is-open {
    display: block;
  }

  .vr-breadcrumb {
    top: 10px;
    left: 10px;
  }
}
