/* ==========================================================================
   MAP LAYOUT BASE
   WordPress block wrapper for full-width map display in content area.
   ========================================================================== */
.wp-block-group.alignfull.block-wrapper-map.is-layout-flow.wp-block-group-is-layout-flow {
	width: 1024px;
	margin: 32px auto;
}

/* Parent container maintaining 16:9 aspect ratio for the map. */
.map-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
}

/* Map element positioned absolutely to fill wrapper. */
#map {
  position: absolute;
  top: 0; 
  left: 0;
  height: 100%;
  width: 100%;
  background-color: transparent;
}

/* ==========================================================================
   RESPONSIVE LAYOUT (MOBILE + TABLET)
   Expands map to full width, adjusts padding for viewport height.
   ========================================================================== */
@media (max-width: 1024px) {
	.wp-block-group.alignfull.block-wrapper-map.is-layout-flow.wp-block-group-is-layout-flow {
		max-width: none;
		width: auto;
		margin-right: calc(var(--wp--style--root--padding-right) * -1);
        margin-left: calc(var(--wp--style--root--padding-left) * -1);
	}

	.map-wrapper {
	  position: relative;
	  padding-top: 90vh; /* Uses viewport height ratio for tall aspect */
	}
}

/* ==========================================================================
   INFO PANEL BASE
   Hidden overlay panel showing map feature details when activated.
   ========================================================================== */
.infopanel {
  position: absolute;
  background: rgba(255, 255, 255, 0.96);
  border: 4px double black;
  box-shadow: 0 0 10px rgba(0,0,0,0.15);
  display: none;
  z-index: 500;
  overflow-y: auto;
  padding: 15px 5px 15px 15px;
  backdrop-filter: blur(5px);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Scrollable content inside info panel. */
.infopanel__content {
	overflow: auto;
    height: calc(100% - 35px);
	font-size: 1rem;
}

/* Smaller text icon for close button. */
.infopanel__close span {
	font-size:50%;
}

/* Visible state for the info panel. */
.infopanel--visible {
  display: block;
  opacity: 1;
}

/* Panel color variables and button styling theme. */
.infopanel__content {
    --primary-green: #4a7c59;
    --green-light: #e8f0e8;
    --green-darker: #3a5f48;
    --accent-green: #6ba68a;
    --shadow-green: rgba(74, 124, 89, 0.15);
    --border-color: #d1e3d4;
    --text-muted: #6b8a7a;
    --gap: 1.5rem;
    --radius: 12px;
    --shadow: 0 4px 12px var(--shadow-green);
    --shadow-hover: 0 8px 24px var(--shadow-green);
}

/* Centered button wrapper for consistent alignment. */
.infopanel__content .button-wrapper {
	display:block;
	text-align:center;
}

/* Primary action button inside the panel. */
.infopanel__content .btn-primary {
	display: inline-block;
    background: linear-gradient(135deg, var(--green-light) 0%, #f5fbf5 100%);
    color: var(--primary-green);
    border-color: var(--border-color);
    box-shadow: 0 2px 8px var(--shadow-green);
    padding: 0.875rem 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-weight: 500;
    text-decoration: none;
    text-transform: none;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Hover transforms and color inversion for emphasis. */
.infopanel__content .btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-green) 0%, var(--primary-green) 100%);
    color: white;
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

/* ==========================================================================
   RESPONSIVE INFO PANEL POSITIONS
   Desktop: slides in from right.
   Mobile/Tablet: slides up from bottom.
   ========================================================================== */

/* Right-side fixed sliding panel for desktop viewports. */
@media (min-width: 1025px) {
  .infopanel {
    top: 0;
    right: 0;
    width: 33%;
    height: calc(100% - 38px);
    transform: translateX(100%);
  }

  .infopanel--visible {
    transform: translateX(0);
  }
}

/* Bottom sliding drawer layout for smaller screens. */
@media (max-width: 1024px) {
  .infopanel {
    left: 0;
    bottom: 0;
    width: calc(100% - 28px);
    height: 75%;
    transform: translateY(100%);
  }

  .infopanel--visible {
    transform: translateY(0);
  }
}

/* ==========================================================================
   INFO PANEL CONTENT LAYOUT
   Spacing, typography, and visual grouping of related items.
   ========================================================================== */
.infopanel__content {
  margin-top: 35px;
}

.infopanel__content .nms-infopanel-b {
	font-weight: 700;
}

.infopanel__content .nms-infopanel-img {
	width:100%;
}

/* Flex layout for sibling item grid inside panel. */
.infopanel__content .nnms-siblings-wrapper {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

/* Individual item card for related entries. */
.infopanel__content .nnms-siblings-wrapper li {
	flex: 0 0 135px;
    border: 1px solid rgb(204, 204, 204);
    padding: 5px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
	box-shadow: 0px 0px 13px -2px rgb(183 183 183);
}

.infopanel__content .title {
	font-weight:bold; 
	font-size: 12px;
}

.infopanel__content .image {
	text-align:center; 
	margin-bottom:5px;
}

/* ==========================================================================
   CLOSE BUTTON
   Positioned top-right, changes color on hover.
   ========================================================================== */
.infopanel__close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  cursor: pointer;
  color: #444;
  transition: color 0.2s ease;
}

.infopanel__close:hover {
  color: crimson;
}

/* ==========================================================================
   MAP PIN STYLING
   Custom text-based map markers for Leaflet.
   ========================================================================== */
.custom-text-icon {
    font-family: 'PT Sans Narrow', sans-serif;
    font-weight: 700;
    line-height: normal;
    background-color: white;
    opacity: 0.8;
    color: black;
    padding: 0;
    border-radius: 200px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    user-select: none;
    cursor: pointer;
    display: inline-block;
    border: 4px double black;
    overflow: hidden;
}

.custom-text-icon:hover {
    opacity: 0.95;
}

/* Active marker state with pulsing green animation. */
.custom-text-icon.marker-active {
    opacity: 1;
    background-color: #6B8A7A;
    animation: colorPulse 2s ease-in-out infinite;
}

@keyframes colorPulse {
    0%, 100% {
        background-color: #6B8A7A;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 0 rgba(107, 138, 122, 0);
    }
    50% {
        background-color: #7AA68B; /* Lighter pulse tone */
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 15px rgba(107, 138, 122, 0.4);
    }
}

/* Aligns icon text perfectly centered within marker. */
.leaflet-marker-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 40px; 
  width: 40px; 
  font-size: 11px; 
  line-height: 11px; 
  outline-style: none;
}

.custom-text-icon .small { white-space: nowrap; }
.custom-text-icon .big   { display: none; text-align: center; }

/* ==========================================================================
   HOVER TITLE POPUP
   Floating info popup for map markers.
   ========================================================================== */
.hover-title-popup .leaflet-popup-content-wrapper {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    animation: floatPopup 3s ease-in-out 1;
    margin-bottom: -1px;
}

.hover-title-popup .leaflet-popup-content {
    margin: 8px 12px;
    font-weight: 600;
    color: #333;
	width: auto;
    font-size: 0.75rem;
}

.hover-title-popup .leaflet-popup-tip-container {
    border-top-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
	animation: floatPopup 3s ease-in-out 2;
}

/* Subtle floating animation to give life to the popup. */
@keyframes floatPopup {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

/* ==========================================================================
   ADMIN / EDITOR UI
   Small inline notice visible only in map editor mode.
   ========================================================================== */
.nmsEditorModeMapWrapper {
    font-size: 71%;
    color: #a10202;
    margin: 0;
    font-style: italic;
}

/* ==========================================================================
   POPUP ADAPTIVE ROTATION
   Adjusts leaflet tooltips when near viewport edges.
   ========================================================================== */

/* Flip vertically if close to top edge. */
.hover-title-popup.needs-flip .leaflet-popup-tip-container {
    transform: rotate(180deg);
	top: -17px;
	animation: floatPopupflip 3s ease-in-out 2;
}

@keyframes floatPopupflip {
    0%, 100% { transform: translateY(0) rotate(180deg); }
    50% { transform: translateY(-2px) rotate(180deg); }
}

/* Flip horizontally toward right edge. */
.hover-title-popup.needs-flip2right .leaflet-popup-content {
	width: 100px;
}

.hover-title-popup.needs-flip2right .leaflet-popup-tip-container {
    transform: rotate(90deg);
    left: -8px;
    animation: floatPopupflip2 3s ease-in-out 2;
    top: calc(53% - 11px);
}

@keyframes floatPopupflip2 {
    0%, 100% { transform: translateY(0) rotate(90deg); }
    50% { transform: translateY(-2px) rotate(90deg); }
}

/* Flip horizontally toward left edge. */
.hover-title-popup.needs-flip2left .leaflet-popup-content {
	width: 100px;
}

.hover-title-popup.needs-flip2left .leaflet-popup-tip-container {
    transform: rotate(270deg);
    right: -28px;
	left: auto;
    animation: floatPopupflip3 3s ease-in-out 2;
    top: calc(53% - 11px);
}

@keyframes floatPopupflip3 {
    0%, 100% { transform: translateY(0) rotate(270deg); }
    50% { transform: translateY(-2px) rotate(270deg); }
}
