/* ============================================================
   TASMANIA DIRECTORY — REGION HALFMAP
   Layout: desktop = side-by-side (map | list), mobile = stacked
   ============================================================ */

/* Palette vars (mirror tasdir-site-styles) — used by tile accents */
:root {
  --tw-cream:    #fbf7ee;
  --tw-ink:      #2a1e16;
  --tw-amber:    #c8872d;
  --tw-burgundy: #6d1f2c;
  --tw-distil:   #1f2a3d;
  --tw-brewery:  #c8872d;
  --tw-cidery:   #4f6b3a;
}

/* ============================================================
   MAIN WRAPPER — kills theme container padding on region archives
   ============================================================ */
body.tasdir-halfmap-active .site-main.tasdir-halfmap-main {
  max-width: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Kill Listdomer's own archive header if it still renders above */
body.tasdir-halfmap-active .lsd-archive-title,
body.tasdir-halfmap-active .page-header,
body.tasdir-halfmap-active .archive-header {
  display: none !important;
}

/* ============================================================
   HERO STRIP — region name + intro (above the halfmap).
   Centred layout so it doesn't look marooned on the left when the
   intro text is short/medium length.
   KNOBS:
     - max-width caps the text column width
     - text-align centre vs left
   ============================================================ */
.tasdir-halfmap-hero {
  padding: 32px 32px 22px;
  background: var(--tw-cream);
  border-bottom: 1px solid rgba(200, 159, 76, 0.25);
  text-align: center;                       /* KNOB: left | center */
}
.tasdir-halfmap-hero-inner {
  max-width: 900px;                         /* KNOB: reading column */
  margin: 0 auto;
}
.tasdir-halfmap-title {
  font-size: 36px;                          /* KNOB: title size */
  font-weight: 700;
  color: var(--tw-ink);
  margin: 0 0 10px;
  letter-spacing: 0.005em;
}
.tasdir-halfmap-intro {
  font-size: 15.5px;
  line-height: 1.6;
  color: #4a382c;
  margin: 0 auto;
}
.tasdir-halfmap-intro p:last-child { margin-bottom: 0; }

/* ============================================================
   SHELL — desktop side-by-side, mobile stacked
   KNOBS:
     - .tasdir-halfmap-shell height
     - breakpoint (900px) for stack
     - pane proportions (55/45 below)
   ============================================================ */
.tasdir-halfmap-shell {
  display: flex;
  flex-direction: row;
  height: calc(100vh - 180px);  /* leaves room for hero + site header */
  min-height: 600px;
  background: var(--tw-cream);
}

/* MAP pane — left on desktop, top on mobile */
.tasdir-halfmap-map-pane {
  flex: 0 0 55%;              /* KNOB: map width */
  position: relative;
  border-right: 1px solid rgba(42, 30, 22, 0.12);
}

/* LIST pane — right on desktop, bottom on mobile */
.tasdir-halfmap-list-pane {
  flex: 1 1 auto;
  overflow-y: auto;            /* list scrolls independently of map */
  background: var(--tw-cream);
}

/* STACK on mobile */
@media (max-width: 900px) {
  .tasdir-halfmap-shell {
    flex-direction: column;
    height: auto;
  }
  .tasdir-halfmap-map-pane {
    flex: 0 0 auto;
    height: 55vh;              /* KNOB: mobile map height */
    border-right: 0;
    border-bottom: 1px solid rgba(42, 30, 22, 0.12);
  }
  .tasdir-halfmap-list-pane {
    max-height: none;
    overflow-y: visible;
  }
}

/* ============================================================
   MAP ITSELF
   ============================================================ */
.tasdir-halfmap-map {
  width: 100%;
  height: 100%;
  min-height: 500px;
}
@media (max-width: 900px) {
  .tasdir-halfmap-map { min-height: 0; height: 100%; }
}

/* ============================================================
   STATUS BAR floating in the bottom-left of the map
   ============================================================ */
.tasdir-halfmap-statusbar {
  position: absolute;
  left: 16px;
  bottom: 18px;
  z-index: 500;                /* above map tiles, below controls */
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 8px 14px;
  background: rgba(251, 247, 238, 0.95);
  backdrop-filter: blur(6px);
  border-radius: 22px;
  box-shadow: 0 2px 12px rgba(42, 30, 22, 0.18);
  font-size: 13px;
  color: var(--tw-ink);
}
.tasdir-halfmap-count   { font-weight: 600; }
.tasdir-halfmap-sort    { color: #6a5244; font-size: 12px; }

/* ============================================================
   PERMANENT MAKER LABELS — bubble next to each pin
   KNOBS:
     - background/color for each category variant
     - font-size + padding
   ============================================================ */
.tasdir-halfmap-label {
  background: rgba(251, 247, 238, 0.96);
  border: 1px solid rgba(42, 30, 22, 0.12);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--tw-ink);
  box-shadow: 0 2px 6px rgba(42, 30, 22, 0.12);
  white-space: nowrap;
}
/* Leaflet's default arrow — keep or hide? hiding for a cleaner chip look */
.tasdir-halfmap-label::before { display: none !important; }
.tasdir-halfmap-label-winery     { border-color: var(--tw-burgundy); }
.tasdir-halfmap-label-distillery { border-color: var(--tw-distil); }
.tasdir-halfmap-label-brewery    { border-color: var(--tw-amber); }
.tasdir-halfmap-label-cidery     { border-color: var(--tw-cidery); }

/* Map labels are clickable (navigate to the listing) — hover affordance */
.tasdir-halfmap-label:hover {
  background: #fff;
  border-color: var(--tw-amber);
  box-shadow: 0 3px 10px rgba(42, 30, 22, 0.22);
  transform: translateY(-1px);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

/* Fade labels a little at low zoom to reduce clutter */
.leaflet-zoom-7  .tasdir-halfmap-label { display: none; }
.leaflet-zoom-8  .tasdir-halfmap-label { opacity: 0.7; }

/* Pin hover emphasis (driven by .is-hovered class from JS) */
.tasdir-halfmap-pin.is-hovered {
  filter: drop-shadow(0 0 6px rgba(200, 159, 76, 0.9));
  transform: scale(1.08);
  transition: transform 0.15s ease;
}

/* ============================================================
   TILE LIST — grid of maker cards
   KNOBS:
     - grid column min-width (240px)
     - tile image height (140px)
   ============================================================ */
.tasdir-halfmap-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  padding: 18px;
}

.tasdir-halfmap-tile {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(42, 30, 22, 0.1);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: var(--tw-ink);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.tasdir-halfmap-tile:hover,
.tasdir-halfmap-tile.is-hovered {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(42, 30, 22, 0.14);
  border-color: rgba(200, 159, 76, 0.55);
}

/* --- THUMB: image or fallback solid colour block --- */
.tasdir-halfmap-tile-thumb {
  position: relative;
  width: 100%;
  height: 140px;               /* KNOB: tile image height */
  overflow: hidden;
  background: #eee;
}
.tasdir-halfmap-tile-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tasdir-halfmap-tile-thumb.is-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Big centred glyph on fallback tiles (no photo).
   Selector is chained with .tasdir-halfmap-tile-thumb so it beats the
   generic `.tasdir-halfmap-tile-thumb img { width:100%; height:100% }`
   cover rule above (same class count but later cascade doesn't help when
   the parent selector needs to match explicitly).
   KNOBS:
     - width/height = glyph size (relative to 140px tall thumb)
     - filter turns the category-coloured SVG into cream
     - opacity tones it back so the colour block still reads as the hero
*/
.tasdir-halfmap-tile-thumb img.tasdir-halfmap-tile-bigglyph {
  width: 56px !important;         /* KNOB: glyph size */
  height: 56px !important;
  object-fit: contain !important; /* never cover-crop the glyph */
  filter: brightness(0) invert(1);/* cream-on-colour */
  opacity: 0.9;                   /* KNOB: 0.7–1.0 */
  pointer-events: none;
  position: absolute;             /* float over the fallback colour block */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  display: block;
}

/* Category pill over the thumb — glyph SVG + label text */
.tasdir-halfmap-tile-cat {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;          /* KNOB: inline-flex so glyph + label sit side-by-side */
  align-items: center;
  gap: 6px;                      /* KNOB: space between glyph + text */
  padding: 3px 10px 3px 8px;
  background: rgba(251, 247, 238, 0.95);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tw-ink);
}

/* Glyph inside the chip — specificity chained with .tasdir-halfmap-tile-thumb
   so it beats the generic `.tasdir-halfmap-tile-thumb img { width:100% }`
   cover rule that stretches every <img> inside the thumb. */
.tasdir-halfmap-tile-thumb img.tasdir-halfmap-tile-glyph {
  width: 14px !important;        /* KNOB: chip glyph size */
  height: 14px !important;
  object-fit: contain !important;
  display: block !important;
  flex: 0 0 auto !important;
  position: static !important;   /* inside the chip, not absolute-floating */
  transform: none !important;
  margin: 0 !important;
}
.tasdir-halfmap-tile-cat-winery     .tasdir-halfmap-tile-cat { color: var(--tw-burgundy); }
.tasdir-halfmap-tile-cat-distillery .tasdir-halfmap-tile-cat { color: var(--tw-distil); }
.tasdir-halfmap-tile-cat-brewery    .tasdir-halfmap-tile-cat { color: var(--tw-amber); }
.tasdir-halfmap-tile-cat-cidery     .tasdir-halfmap-tile-cat { color: var(--tw-cidery); }

/* --- BODY: name, meta, excerpt, distance --- */
.tasdir-halfmap-tile-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
}
.tasdir-halfmap-tile-name {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 2px;
  line-height: 1.2;
}
/* Only the name is a clickable link; underline on hover for affordance */
.tasdir-halfmap-tile-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.tasdir-halfmap-tile-link:hover {
  color: var(--tw-burgundy);                  /* KNOB: hover colour */
  border-bottom-color: var(--tw-amber);       /* KNOB: underline colour */
}

/* Pinned tile (user double-clicked its marker) — amber top border */
.tasdir-halfmap-tile.is-pinned {
  border-color: var(--tw-amber) !important;
  box-shadow: 0 6px 20px rgba(200, 159, 76, 0.28);
}
.tasdir-halfmap-tile-meta {
  font-size: 12px;
  color: #6a5244;
  margin: 0;
}
.tasdir-halfmap-tile-excerpt {
  font-size: 13px;
  color: #4a382c;
  line-height: 1.4;
  margin: 4px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;       /* KNOB: how many lines of excerpt */
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tasdir-halfmap-tile-distance {
  margin-top: auto;
  padding-top: 8px;
  font-size: 11px;
  color: #8a6f5a;
  font-weight: 500;
}

/* Empty state */
.tasdir-halfmap-empty {
  padding: 40px 24px;
  text-align: center;
  color: #6a5244;
}
