/* harhor.com — small overrides on top of Tailwind */

html, body { height: 100%; }
body { font-family: 'IBM Plex Sans Thai', system-ui, sans-serif; }

/* Map needs explicit z-index control so sidebars/headers float above */
#map, #pin-map { z-index: 0; }
.leaflet-control-container { z-index: 10; }

/* Suppress the browser's default focus outline on clickable SVG overlays
   (zones / geoJSON polygons). Without this, clicking a zone shows a dotted
   rectangle around the polygon's bounding box. */
.leaflet-interactive,
.leaflet-interactive:focus,
.leaflet-interactive:focus-visible {
  outline: none;
}

/* "ซ่อนหมุด" toggle — fully hides every dorm/post marker and cluster icon
   so the user can read the underlying tiles. Class is set on the map
   container by togglePinsHidden() in home-map.js. A bottom-left pill
   (.harhor-pins-hidden-notice in home.ejs) reminds them they turned it off. */
.harhor-pins-hidden .leaflet-marker-pane {
  display: none;
}

/* Building markers (divIcon with image) */
.leaflet-div-icon, .harhor-marker-wrap { background: transparent; border: 0; }

/* Brief snap-back slide applied at zoomend when home-map.js corrects pins
   that got stranded by an interrupted zoom animation. Class is added then
   removed after ~300ms so it never collides with Leaflet's own zoom anim. */
.leaflet-marker-icon.harhor-snap {
  transition: transform .28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.harhor-marker {
  position: relative;
  width: 42px;
  height: 50px;
  cursor: pointer;
  transition: transform .12s;
  /* Scale grows the building upward from its base, so the anchor (bottom-
     center, where the lat/lng is) stays fixed when hover/selected scale
     kicks in — otherwise the pin appears to drift off its location during
     zoom (hover state flickers as the cursor's relative position changes). */
  transform-origin: 50% 100%;
}
.harhor-marker-img {
  display: block;
  width: 42px;
  height: 50px;
  object-fit: contain;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.3));
  pointer-events: none;
}
.harhor-marker:hover { transform: scale(1.12); z-index: 100; }
.harhor-marker.is-selected {
  transform: scale(1.18);
  z-index: 200;
}
.harhor-marker.is-selected .harhor-marker-img {
  filter: drop-shadow(0 0 6px #FF6A1A) drop-shadow(0 3px 4px rgba(0,0,0,.3));
}
.harhor-marker-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  z-index: 2;
}

/* Pinned post markers (admin-curated posts: land/promotion/etc.)
   The cover image is the pin face; a small triangular tail below points at the location. */
.harhor-post-marker { position: relative; width: 56px; height: 64px; cursor: pointer; transition: transform .12s; transform-origin: 50% 100%; }
.harhor-post-marker:hover { transform: scale(1.12); z-index: 100; }
.harhor-post-pin {
  position: absolute;
  top: 0;
  left: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid #FF6A1A;
  background: white;
  overflow: hidden;
  box-shadow: 0 3px 6px rgba(0,0,0,.28);
  display: flex;
  align-items: center;
  justify-content: center;
}
.harhor-post-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.harhor-post-fallback {
  font-size: 26px;
  line-height: 1;
}
/* Custom pin — when a post has customPinUrl set, the uploaded PNG/SVG IS the
   marker (no circle, no border, no tail). Width/height set inline per-post
   (customPinSize), so the rule below only owns the visual styling. */
.harhor-post-custom-pin {
  position: absolute;
  top: 0;
  left: 0;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.28));
}
.harhor-post-tail {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid #FF6A1A;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.2));
}
.harhor-post-popup {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border-radius: 10px;
  padding: 8px 12px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
  border: 1px solid #FFE6D5;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 100;
  max-width: 220px;
  white-space: normal;
}
.harhor-post-marker:hover .harhor-post-popup,
.harhor-post-marker.is-selected .harhor-post-popup { opacity: 1; }
.harhor-post-marker.is-selected { transform: scale(1.18); z-index: 200; }
.harhor-post-popup::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: white;
}
.harhor-marker-popup {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border-radius: 8px;
  padding: 6px 10px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,.15);
  border: 1px solid #FFE6D5;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 100;
}
.harhor-marker-popup::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: white;
}
.harhor-marker:hover .harhor-marker-popup,
.harhor-marker.is-selected .harhor-marker-popup { opacity: 1; }

/* Legacy single vertical slider (no longer used, kept for fallback) */
.filter-vslider {
  -webkit-appearance: slider-vertical;
  writing-mode: vertical-lr;
  direction: rtl;
  width: 8px;
  height: 180px;
}

/* Custom dual-thumb vertical slider — single shared track with two button thumbs */
.vrange-wrap {
  position: relative;
  width: 28px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vrange-track {
  position: relative;
  width: 4px;
  height: 160px;
  background: #e5e7eb;
  border-radius: 2px;
  cursor: pointer;
  touch-action: none;
}
.vrange-fill {
  /* Child of .vrange-track — percentages refer to the track's height. */
  position: absolute;
  left: 0;
  width: 100%;
  background: #FF6A1A;
  border-radius: 2px;
  pointer-events: none;
}
.vrange-thumb {
  position: absolute;
  left: 50%;
  /* translate(-50%, +50%) puts the thumb's center exactly at the `bottom` percentage anchor */
  transform: translate(-50%, 50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #22c55e;
  border: 3px solid white;
  box-shadow: 0 2px 5px rgba(0,0,0,.25);
  cursor: grab;
  padding: 0;
  z-index: 3;
  touch-action: none;
  transition: transform .1s, box-shadow .1s;
}
.vrange-thumb:hover {
  transform: translate(-50%, 50%) scale(1.1);
}
.vrange-thumb:active,
.vrange-thumb.is-active {
  cursor: grabbing;
  z-index: 10;
  box-shadow: 0 0 0 6px rgba(34, 197, 94, .15), 0 2px 5px rgba(0,0,0,.25);
}


/* Marker cluster recolor to match brand */
.marker-cluster-small { background-color: rgba(255, 106, 26, 0.4); }
.marker-cluster-small div { background-color: rgba(255, 106, 26, 0.8); color: white; }
.marker-cluster-medium { background-color: rgba(255, 106, 26, 0.5); }
.marker-cluster-medium div { background-color: rgba(232, 90, 15, 0.9); color: white; }
.marker-cluster-large { background-color: rgba(232, 90, 15, 0.6); }
.marker-cluster-large div { background-color: rgba(210, 78, 7, 1); color: white; }

/* Hide horizontal scrollbar on tray */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }

/* Rich-text rendering for post.description on the public sidebar.
   Mirrors the .harhor-rt-editor styles in views/admin/post-form.ejs so the
   admin editor and the live render look the same. Whitespace between
   paragraphs is collapsed by browsers — we use small explicit margins
   instead of pre-line so the layout matches the editor exactly. */
.harhor-rt-prose h3 { font-size: 1.05rem; font-weight: 600; margin: 0.6em 0 0.3em; line-height: 1.3; }
.harhor-rt-prose h4 { font-size: 0.95rem; font-weight: 600; margin: 0.6em 0 0.3em; line-height: 1.3; }
.harhor-rt-prose p { margin: 0.25em 0; }
.harhor-rt-prose ul { list-style: disc; padding-left: 1.5em; margin: 0.4em 0; }
.harhor-rt-prose ol { list-style: decimal; padding-left: 1.5em; margin: 0.4em 0; }
.harhor-rt-prose a { color: #FF6A1A; text-decoration: underline; }
.harhor-rt-prose a:hover { color: #E85A0F; }
.harhor-rt-prose blockquote { border-left: 3px solid #cbd5e1; padding-left: 0.75em; color: #475569; margin: 0.4em 0; }
.harhor-rt-prose b, .harhor-rt-prose strong { font-weight: 600; }
