/* Ikrar map section — [ikrar_peta]
   Markup (owned by M2):
   section.ikrar-map-section#peta > .wrap > h2, p.section-lead,
     .ikrar-map-wrap(.ikrar-map-head, .ikrar-map-container#ikrar-map > .ikrar-map-viewport > svg#ikrar-map-svg + .ikrar-map-popover),
     .ikrar-map-table-wrap(.ikrar-map-search-wrap, table.ikrar-map-table), p.ikrar-map-note
   Layout: stacked on phones; map on the left and a scrollable table on the right from 1000px. */

.ikrar-map-section {
  background: var(--sand, #faf6ea);
  padding: clamp(48px, 8vw, 88px) 0;
}
.ikrar-map-section > .wrap {
  width: 100%;
  max-width: 1500px;
  margin-inline: auto;
  padding-inline: var(--gutter, 20px);
  display: grid;
  gap: 18px 32px;
  grid-template-columns: minmax(0, 1fr);
}
.ikrar-map-section h2 { margin: 0; }
.ikrar-map-section .section-lead {
  font-size: 1.05rem;
  color: var(--muted, #4b5d53);
  max-width: 62ch;
  margin: 0 0 6px;
}
.ikrar-map-wrap {
  display: grid;
  gap: 14px;
  min-width: 0;
}
@media (min-width: 1000px) {
  .ikrar-map-section > .wrap {
    grid-template-columns: minmax(0, 2.6fr) minmax(320px, 1fr);
    align-items: start;
  }
  .ikrar-map-wrap { grid-column: 1 / 2; }
  .ikrar-map-table-wrap { grid-column: 2 / 3; }
  .ikrar-map-section > h2,
  .ikrar-map-section > .wrap > h2,
  .ikrar-map-section > .wrap > .section-lead,
  .ikrar-map-section > .wrap > .ikrar-map-note { grid-column: 1 / -1; }
}

/* Head: legend + refresh */
.ikrar-map-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
}
.ikrar-map-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}
.ikrar-map-head .ikrar-meta { font-size: .82rem; color: var(--muted, #4b5d53); }
.ikrar-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  font-size: .82rem;
  color: var(--muted, #4b5d53);
}
.ikrar-legend-row { display: flex; align-items: center; gap: 4px 6px; flex-wrap: wrap; }
.ikrar-legend-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 6px;
  border: 1px solid #6f8a7a;      /* visible even for the palest swatch */
  flex: none;
}
.ikrar-legend-label { margin: 0 8px 0 2px; font-size: .8rem; }
#ikrar-map-refresh { min-height: 40px; padding: .5em 1.1em; font-size: .8rem; }

/* Map container + viewport */
.ikrar-map-container {
  position: relative;
  border-radius: 20px;
  border: 1px solid var(--line, #d9d2bc);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 6px 24px rgba(7, 59, 39, .08);
}
.ikrar-map-viewport {
  width: 100%;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y pinch-zoom;
  /* soft lat/long grid so the empty sea reads as "a map" */
  background-color: #f6fbf8;
  background-image:
    linear-gradient(rgba(11, 93, 59, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 93, 59, .07) 1px, transparent 1px);
  background-size: 12.5% 16.66%;
}
.ikrar-map-svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 800 / 303;   /* matches the viewBox so nothing is letterboxed */
  background: transparent;
  transform-origin: 0 0;
  transition: transform 0.2s ease-out;
}
.ikrar-map-svg.panning { cursor: grabbing; }
.ikrar-map-svg:not(.panning) { cursor: grab; }
.ikrar-map-bg, .ikrar-map-svg .ikrar-map-bg { fill: transparent; }   /* let the grid show through */
.ikrar-map-svg text { font-family: var(--font-head, system-ui, sans-serif); font-weight: 700; paint-order: stroke; stroke: #fff; stroke-width: 2px; }

/* Visible marker labels */
.ikrar-bubble-label {
  font-family: var(--font-head, system-ui, sans-serif);
  font-weight: 800;
  font-size: 11px;
  fill: #073b27;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3px;
  pointer-events: none;
  text-anchor: middle;
  dominant-baseline: central;
}

/* Zoom control buttons */
.ikrar-map-zoom {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ikrar-map-zoom button {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line, #d9d2bc);
  background: #fff;
  box-shadow: 0 4px 12px rgba(7, 59, 39, .15);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--g900, #073b27);
  transition: background .15s, transform .1s;
}
.ikrar-map-zoom button:hover { background: var(--g50, #effaf1); transform: scale(1.05); }
.ikrar-map-zoom button:active { transform: scale(0.98); }
.ikrar-map-zoom button:focus-visible {
  outline: 2px solid var(--teal-d, #0b7f6e);
  outline-offset: 2px;
}

/* Phones: the map keeps a readable width and pans sideways (bubbles stay tappable) */

.ikrar-map-svg circle {
  cursor: pointer;
  transition: filter .15s, fill-opacity .15s;
}
.ikrar-map-svg circle:hover { filter: brightness(1.08) saturate(1.2); fill-opacity: .95; }
.ikrar-map-svg circle:focus { outline: none; }
.ikrar-map-svg circle:focus-visible {
  stroke: #052a1c;
  stroke-width: 3px;
  outline: 3px solid var(--teal-d, #0b7f6e);
  outline-offset: 2px;
}

/* Phones: the map keeps a readable width and pans sideways (bubbles stay tappable) */
@media (max-width: 699px) {
  .ikrar-map-svg { min-width: 640px; }
  .ikrar-map-container::before {
    content: "Geser peta untuk menjelajah";
    position: absolute; left: 10px; top: 10px; z-index: 2;
    padding: .25em .7em; border-radius: 999px;
    background: rgba(7, 59, 39, .82); color: #fff;
    font: 700 .72rem/1.5 var(--font-head, system-ui, sans-serif);
    pointer-events: none;
  }
}

/* Popover: a card pinned inside the map (no JS positioning needed).
   map.js sets aria-hidden="true" on close but leaves .show in place, so the
   attribute is what actually hides it. */
.ikrar-map-popover {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 5;
  width: min(300px, calc(100% - 24px));
  background: #fff;
  border: 1px solid var(--line, #d9d2bc);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(7, 59, 39, .22);
  padding: 14px 16px;
  display: none;
}
.ikrar-map-popover.show { display: block; }
.ikrar-map-popover[aria-hidden="true"] { display: none; }
.ikrar-map-popover h3 { font-size: 1.02rem; margin: 0 28px 4px 0; }
.ikrar-map-pop-row { font-size: .88rem; margin: 2px 0; color: var(--muted, #4b5d53); }
.ikrar-map-pop-row strong { color: var(--g900, #073b27); font-size: 1rem; }
.ikrar-map-close {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 36px;
  height: 36px;
  background: none;
  border: 0;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted, #4b5d53);
}
.ikrar-map-close:hover { background: var(--g100, #e6f2ea); color: var(--g900, #073b27); }

/* Table */
.ikrar-map-table-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
  max-height: 440px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border: 1px solid var(--line, #d9d2bc);
  border-radius: 20px;
  box-shadow: 0 6px 24px rgba(7, 59, 39, .08);
}
@media (min-width: 1000px) { .ikrar-map-table-wrap { max-height: 560px; } }
.ikrar-map-search-wrap {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 3;
  padding: 12px;
  background: #fff;
  border-bottom: 1px solid var(--line, #d9d2bc);
}
.ikrar-map-search-wrap input {
  width: 100%;
  font: inherit;
  color: inherit;
  background: #fff;
  border: 2px solid var(--line, #d9d2bc);
  border-radius: 10px;
  padding: .55em .8em;
  min-height: 44px;
}
.ikrar-map-search-wrap input:focus { border-color: var(--teal-d, #0b7f6e); outline: 2px solid var(--teal-d, #0b7f6e); outline-offset: 1px; }
.ikrar-map-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .92rem;
  margin: 0;
}
.ikrar-map-table th {
  position: sticky;
  top: 69px;                    /* sits under the search box */
  z-index: 2;
  background: var(--g700, #0b5d3b);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .05em;
  font: 800 .74rem/1.2 var(--font-head, system-ui, sans-serif);
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
}
.ikrar-map-table th.num { text-align: right; }
.ikrar-map-table td {
  padding: 10px 12px;
  border-top: 1px solid var(--line, #d9d2bc);
  vertical-align: middle;
}
.ikrar-map-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ikrar-map-table tbody tr:nth-child(even) { background: #fbfaf4; }
.ikrar-map-table tbody tr:hover { background: var(--g50, #effaf1); cursor: pointer; }
.ikrar-map-table tbody tr.current { background: var(--g100, #e6f2ea); }
.ikrar-map-table tfoot td {
  position: sticky;
  bottom: 0;
  font-weight: 800;
  background: var(--sand2, #f2ecd9);
}

.ikrar-map-note { color: var(--muted, #4b5d53); font-size: .85rem; margin: 0; min-height: 1px; }

/* Loading state */
.ikrar-map-container.loading { opacity: .6; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .ikrar-map-svg circle { transition: none; }
}
