/* =========================================================
   Niagara Wine Map — winery directory (map view + list view)
   ========================================================= */

.dir-hero {
  background: linear-gradient(150deg, var(--grape-900), var(--green-900));
  color: #fff; padding: clamp(2.75rem, 6vw, 4rem) 0 clamp(2rem, 4vw, 2.5rem);
}
.dir-hero h1 { color: #fff; font-size: clamp(2.1rem, 4.5vw, 3.1rem); margin-bottom: .35rem; }
.dir-hero p { color: rgba(255,255,255,.72); margin: 0; max-width: 56ch; }

/* ---------- Search + controls bar ---------- */
.controls {
  position: sticky; top: var(--header-h); z-index: 40;
  background: rgba(251, 248, 243, .95);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 1rem 0;
}
.controls__row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }

.search {
  position: relative; flex: 1 1 320px; min-width: 240px;
}
.search svg { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input {
  width: 100%; padding: .8rem 1rem .8rem 2.9rem;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper);
}
.search input:focus { border-color: var(--grape-600); }

.select-wrap { position: relative; }
.select-wrap select {
  appearance: none; padding: .8rem 2.4rem .8rem 1.1rem;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper);
  font-size: .9rem; cursor: pointer;
}
.select-wrap::after {
  content: ""; position: absolute; right: 1.05rem; top: 50%; width: 7px; height: 7px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}

/* View toggle */
.viewtoggle {
  display: inline-flex; background: var(--grape-100); border-radius: 999px; padding: 4px; gap: 2px;
}
.viewtoggle button {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 0; background: transparent; border-radius: 999px; cursor: pointer;
  padding: .55rem 1.1rem; font-size: .85rem; color: var(--grape-700); transition: background .18s, color .18s;
}
.viewtoggle button.is-active { background: var(--grape-700); color: #fff; box-shadow: var(--shadow-sm); }

.filter-btn { position: relative; }
.filter-btn .count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--gold-500); color: var(--grape-900);
  font-size: .7rem; font-weight: 600;
}

/* ---------- Filter panel ---------- */
.filters {
  display: none; margin-top: 1rem; padding: 1.5rem;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.filters.is-open { display: block; }
.filters__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.75rem; }
@media (max-width: 860px) { .filters__grid { grid-template-columns: 1fr; } }
.filters__group h4 {
  font-family: var(--font-body); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold-600); margin: 0 0 .9rem; font-weight: 600;
}
.filters__note {
  font-size: .78rem; color: var(--text-muted); margin: 1.25rem 0 0;
  padding-top: 1rem; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap;
}
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  border: 1px solid var(--line-strong); background: var(--paper); border-radius: 999px;
  padding: .42rem .95rem; font-size: .83rem; color: var(--ink-soft); cursor: pointer;
  transition: background .16s, color .16s, border-color .16s;
}
.chip:hover { border-color: var(--grape-600); color: var(--grape-700); }
.chip.is-on { background: var(--grape-700); border-color: var(--grape-700); color: #fff; }
.chip.is-on:hover { background: var(--grape-600); color: #fff; }

/* Distance slider */
.range-row { display: flex; align-items: center; gap: 1rem; }
.range-row input[type="range"] { flex: 1; accent-color: var(--grape-700); }
.range-val {
  font-size: .85rem; color: var(--grape-700); font-weight: 500; min-width: 68px; text-align: right;
}

/* ---------- Results meta ---------- */
.results-meta {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  flex-wrap: wrap; padding: 1.5rem 0 1rem;
}
.results-count { font-size: .9rem; color: var(--text-muted); }
.results-count strong { color: var(--text); font-weight: 600; }
.active-filters { display: flex; flex-wrap: wrap; gap: .45rem; }
.active-filters .chip { padding: .3rem .5rem .3rem .8rem; display: inline-flex; align-items: center; gap: .45rem; }
.active-filters .chip button {
  border: 0; background: none; cursor: pointer; color: inherit; font-size: 1rem; line-height: 1; padding: 0;
}

/* ---------- List view ---------- */
.winery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; padding-bottom: 4rem; }
@media (max-width: 1000px) { .winery-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px) { .winery-grid { grid-template-columns: 1fr; } }

.wcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.wcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.wcard__media {
  height: 140px; position: relative;
  background: linear-gradient(140deg, var(--grape-700), var(--green-700));
  display: grid; place-items: center; color: rgba(255,255,255,.5);
}
.wcard__media .initials {
  font-family: var(--font-display); font-size: 2.4rem; color: rgba(255,255,255,.85); letter-spacing: .04em;
}
.wcard__region {
  position: absolute; left: .85rem; bottom: .85rem;
  background: rgba(255,255,255,.92); color: var(--grape-800);
  font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  padding: .3rem .65rem; border-radius: 999px;
}
.wcard__award {
  position: absolute; right: .85rem; top: .85rem;
  background: var(--gold-500); color: var(--grape-900);
  font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600;
  padding: .3rem .6rem; border-radius: 999px;
}
.wcard__body { padding: 1.25rem 1.25rem 1.4rem; display: flex; flex-direction: column; flex: 1; }
.wcard__body h3 { font-size: 1.22rem; margin-bottom: .3rem; }
.wcard__meta { font-size: .82rem; color: var(--text-muted); margin: 0 0 .75rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.wcard__meta .dot { color: var(--line-strong); }
.wcard__blurb { font-size: .9rem; color: var(--ink-soft); margin: 0 0 1rem; }
.wcard__tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: auto; }
.tag {
  font-size: .72rem; padding: .26rem .6rem; border-radius: 4px;
  background: var(--green-100); color: var(--green-700);
}
.tag--wine { background: var(--grape-100); color: var(--grape-700); }
.tag--more { background: transparent; color: var(--muted); }
.wcard__actions { display: flex; gap: .6rem; margin-top: 1.1rem; }

/* ---------- Map view ---------- */
.mapview { display: grid; grid-template-columns: 1fr 380px; gap: 1.25rem; padding-bottom: 4rem; align-items: start; }
@media (max-width: 1000px) { .mapview { grid-template-columns: 1fr; } }

.mapview__canvas {
  position: relative; background: linear-gradient(165deg, #F4EFE7, #EAF0EA);
  border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden;
}
.mapview__canvas svg { width: 100%; height: auto; display: block; }
.map-note {
  position: absolute; left: 1rem; bottom: 1rem; z-index: 3;
  background: rgba(255,255,255,.9); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: .45rem .7rem; font-size: .72rem; color: var(--text-muted);
  max-width: 300px;
}
/* Map side panel */
.mapview__panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 1.25rem; max-height: 560px; overflow-y: auto;
}
.panel-empty { color: var(--text-muted); font-size: .9rem; text-align: center; padding: 3rem 1rem; }
.panel-empty svg { margin: 0 auto 1rem; color: var(--line-strong); }
.mini-list { display: grid; gap: .5rem; }
.mini {
  display: flex; gap: .75rem; align-items: flex-start; width: 100%; text-align: left;
  padding: .7rem .8rem; border: 1px solid transparent; border-radius: var(--r-sm);
  background: transparent; cursor: pointer; transition: background .16s, border-color .16s;
}
.mini:hover { background: var(--cream); border-color: var(--line); }
.mini.is-selected { background: var(--grape-100); border-color: var(--grape-600); }
.mini__n {
  flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--grape-700); color: #fff;
  display: grid; place-items: center; font-size: .72rem; margin-top: .1rem;
}
.mini__name { font-weight: 500; font-size: .95rem; }
.mini__meta { font-size: .78rem; color: var(--text-muted); }

.detail__head { display: flex; justify-content: space-between; gap: .75rem; align-items: flex-start; }
.detail__back {
  border: 0; background: none; cursor: pointer; color: var(--grape-700);
  font-size: .82rem; padding: 0 0 .75rem; display: inline-flex; gap: .35rem; align-items: center;
}
.detail h3 { margin: .25rem 0 .3rem; }
.detail dl { display: grid; grid-template-columns: auto 1fr; gap: .5rem .9rem; margin: 1.1rem 0; font-size: .87rem; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; }
.detail dd a { color: var(--grape-700); text-decoration: underline; text-underline-offset: 2px; }

/* Empty state */
.empty {
  text-align: center; padding: 5rem 1rem; color: var(--text-muted);
  border: 1px dashed var(--line-strong); border-radius: var(--r-md); margin-bottom: 4rem;
}
.empty h3 { color: var(--text); }

/* On narrow screens the stylised map is small — get the caption out of the artwork. */
@media (max-width: 720px) {
  .map-note {
    position: static; max-width: none; border: 0; border-top: 1px solid var(--line);
    border-radius: 0; background: var(--paper); margin: 0;
  }
}


.filters__todo {
  margin: 1.5rem 0 0; font-size: .8rem; color: var(--text-muted);
  background: var(--gold-100); border-radius: var(--r-sm); padding: .7rem .9rem;
}
.detail__todo { font-size: .87rem; color: var(--text-muted); margin: 1.1rem 0; }

/* Card titles link through to the generated winery page. */
.wcard__body h3 a { color: inherit; }
.wcard__body h3 a:hover { color: var(--grape-700); text-decoration: underline; text-underline-offset: 3px; }

/* =========================================================
   Live tile map (Leaflet). The stylised SVG rules above are
   still used by the generated winery and town pages.
   ========================================================= */
#map { height: 560px; width: 100%; background: #EAF0EA; z-index: 1; }
@media (max-width: 1000px) { #map { height: 440px; } }
@media (max-width: 600px)  { #map { height: 380px; } }

/* Leaflet's chrome, restyled to the brand */
.leaflet-container { font-family: var(--font-body); }
.leaflet-control-zoom a {
  color: var(--grape-700); border-radius: 0; font-weight: 400;
}
.leaflet-control-zoom a:hover { background: var(--grape-100); color: var(--grape-800); }
.leaflet-bar { border: 1px solid var(--line-strong); box-shadow: var(--shadow-sm); }
.leaflet-control-attribution {
  background: rgba(251, 248, 243, .88); font-size: .68rem; color: var(--muted);
}
.leaflet-control-attribution a { color: var(--grape-700); }

/* Pins — same silhouette as the brand mark */
.nwm-pin svg { overflow: visible; }
.nwm-pin path { fill: var(--grape-700); stroke: #fff; stroke-width: 1.5; }
.nwm-pin circle { fill: #fff; }
.nwm-pin { transition: transform .14s ease; transform-origin: center bottom; }
.nwm-pin:hover { transform: scale(1.14); }
.nwm-pin.is-selected path { fill: var(--gold-500); stroke: var(--grape-900); stroke-width: 1.8; }
.nwm-pin.is-selected circle { fill: var(--grape-900); }
.nwm-pin.is-selected { transform: scale(1.2); z-index: 1000; }

/* Clusters */
.nwm-cluster {
  display: grid; place-items: center;
  background: var(--grape-700); color: #fff;
  border: 2px solid rgba(255, 255, 255, .85); border-radius: 50%;
  box-shadow: 0 2px 8px rgba(36, 16, 31, .3);
  font-size: .82rem; font-weight: 500;
  transition: background .16s ease;
}
.nwm-cluster.is-mid { background: var(--grape-600); }
.nwm-cluster.is-big { background: var(--gold-600); color: var(--grape-900); }
.nwm-cluster:hover { background: var(--grape-800); }

/* Tooltips + the search-radius ring */
.leaflet-tooltip {
  background: var(--grape-900); color: #fff; border: 0; border-radius: var(--r-sm);
  font-size: .8rem; padding: .3rem .6rem; box-shadow: var(--shadow-sm);
}
.leaflet-tooltip-top::before { border-top-color: var(--grape-900); }
.nwm-radius { fill: var(--grape-600); fill-opacity: .07; stroke: var(--grape-600); stroke-width: 1.5; stroke-dasharray: 5 6; }

/* The map fills its card now, so the caption sits below it. */
.mapview__canvas { background: none; }
.map-note {
  position: static; max-width: none; border: 0; border-top: 1px solid var(--line);
  border-radius: 0; background: var(--paper); margin: 0; padding: .55rem .8rem;
}

/* The global `svg { display:block; max-width:100% }` reset in site.css
   inflates Leaflet's inline attribution flag and constrains its vector
   panes. Scope both back inside the map. */
.leaflet-container svg { max-width: none; }
.leaflet-attribution-flag {
  display: inline-block !important;
  width: 12px !important; height: 8px !important; vertical-align: baseline;
}

/* =========================================================
   Discovery Pass — a promoted filter for the Grape & Wine
   Festival. Deliberately the only gold control in the bar, so
   it reads as special without shouting.
   ========================================================= */
.passfilter {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .78rem 1.15rem; border-radius: 999px; cursor: pointer;
  font-size: .88rem; letter-spacing: .01em; white-space: nowrap;
  background: var(--paper); color: var(--grape-800);
  border: 1px solid var(--gold-500);
  box-shadow: inset 0 0 0 0 var(--gold-500);
  transition: background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.passfilter svg { color: var(--gold-600); transition: color .18s ease; }
.passfilter:hover { background: var(--gold-100); }
.passfilter__n {
  font-size: .72rem; font-weight: 500; color: var(--muted);
  background: var(--cream); border-radius: 999px; padding: .1rem .45rem;
  transition: background .18s ease, color .18s ease;
}
.passfilter.is-on {
  background: var(--gold-500); border-color: var(--gold-500); color: var(--grape-900);
  box-shadow: var(--shadow-sm);
}
.passfilter.is-on svg { color: var(--grape-900); }
.passfilter.is-on .passfilter__n { background: rgba(36, 16, 31, .16); color: var(--grape-900); }

/* Badge on cards and in the A–Z index */
.wcard__pass {
  position: absolute; right: .85rem; top: .85rem;
  background: var(--gold-500); color: var(--grape-900);
  font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600;
  padding: .3rem .6rem; border-radius: 999px;
}
.tag--pass { background: var(--gold-100); color: var(--gold-600); font-weight: 500; }

/* =========================================================
   Festival note — sits directly under the toolbar so it
   explains the gold Discovery Pass control beside it.
   ========================================================= */
.festival {
  display: flex; align-items: baseline; gap: 1.25rem; flex-wrap: wrap;
  margin: 1.75rem 0 .25rem; padding: 1rem 1.35rem;
  background: linear-gradient(100deg, var(--gold-100), rgba(245, 234, 201, .35));
  border: 1px solid var(--gold-400); border-left: 3px solid var(--gold-500);
  border-radius: var(--r-sm);
}
.festival__eyebrow {
  margin: 0; flex: none;
  font-size: .68rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--gold-600); font-weight: 600;
}
.festival__text {
  margin: 0; flex: 1 1 30ch; font-size: .92rem; line-height: 1.55; color: var(--ink-soft);
}
.festival__text strong { color: var(--grape-800); font-weight: 500; }

/* Sleek link: gold rule that fills in and an arrow that steps forward. */
.festival__link {
  display: inline-flex; align-items: center; gap: .35rem;
  color: var(--grape-700); font-weight: 500; white-space: nowrap;
  padding-bottom: 1px;
  background-image: linear-gradient(var(--gold-500), var(--gold-500));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1.5px;
  transition: background-size .28s cubic-bezier(.4, 0, .2, 1), color .2s ease;
}
.festival__link span { transition: transform .28s cubic-bezier(.4, 0, .2, 1); }
.festival__link:hover { color: var(--grape-900); background-size: 100% 1.5px; }
.festival__link:hover span { transform: translateX(3px); }
.festival__link:focus-visible { background-size: 100% 1.5px; }

@media (prefers-reduced-motion: reduce) {
  .festival__link, .festival__link span { transition: none; }
}
@media (max-width: 620px) {
  .festival { gap: .5rem; padding: .9rem 1.1rem; }
}
