body {
  font-family: Arial, sans-serif;
  margin: 20px;
}
h2 {
  margin-bottom: 10px;
}

/* ================================
   MAP CONTROLS (EMBED + INDEX)
   ================================ */

.map-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end; /* aligns bottoms of controls */
  margin-bottom: 12px;
}

.map-controls .control {
  display: flex;
  flex-direction: column; /* keeps label above input */
  gap: 4px;
}

.map-controls .control label {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.1;
  margin: 0;
  white-space: nowrap;
}

.map-controls select,
.map-controls input[type="text"],
.map-controls input[type="date"],
.map-controls button {
  height: 36px;
  padding: 6px 10px;
  font-size: 14px;
  border: 1px solid #cfd5dc;
  border-radius: 4px;
  box-sizing: border-box;
}

.map-controls .control-search input[type="text"] { width: 260px; }
.map-controls .control-state select { width: 180px; }
.map-controls .control-category select { max-width: 200px; }
.map-controls .control-start input[type="date"],
.map-controls .control-end input[type="date"] { width: 150px; }

.map-controls .control-reset {
  justify-content: flex-end;
}

.map-controls button {
  background-color: #0b63b6;
  color: #fff;
  border: none;
  cursor: pointer;
  padding: 0 14px;
}

.map-controls button:hover {
  filter: brightness(0.92);
}

/* Mobile: stack controls */
@media (max-width: 768px) {
  .map-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .map-controls .control-search input[type="text"],
  .map-controls .control-state select,
  .map-controls .control-category select,
  .map-controls .control-start input[type="date"],
  .map-controls .control-end input[type="date"],
  .map-controls button {
    width: 100%;
  }
}


/* Map canvas */
svg {
  width: 100%;
  height: auto;
  border: 1px solid #ccc;
  background-color: #f8f9fa;
  display: block;
  margin: 0 auto;
}

/* --- Tooltip (single, consolidated definition) --- */
.tooltip {
  position: absolute;
  display: none;               /* shown via JS */
  z-index: 10;
  font-size: 14px;
  background: #ffffff;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  padding: 14px;
  pointer-events: auto;        /* keep links clickable */
  min-width: 560px;
  max-width: 720px;
}
.tooltip a {
  color: rgba(1, 47, 132, 1);              /* unify link color */
  text-decoration: none;
}
.tooltip a:hover {
  text-decoration: underline;
}

/* Hospitals (markers) */
.hospital {
  fill: #9d2235;
  stroke: white;
  stroke-width: 1px;
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.5s ease;
}
.hospital.hidden {
  opacity: 0;
  pointer-events: none;
}
.hospital:hover {
  fill: #9d2235;
}

/* Tooltip card layout */
.tt-card {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: start;
}
.tt-left {
  text-align: center;
}
.tt-thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e5e5e5;
  margin-bottom: 8px;
}
.tt-hname {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 2px;
}
.tt-loc {
  color: #666;
  font-size: 14px;
}

/* Stories table */
.tt-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.tt-table thead th {
  text-align: left;
  font-weight: 600;
  background: #e9ecef;
  padding: 8px 10px;
  border: 1px solid #dee2e6;
}
.tt-table tbody td {
  vertical-align: top;
  padding: 8px 10px;
  border: 1px solid #f0f0f0;
}
.tt-cat {
  width: 40%;
}

.tt-pub {
  width: 110px;
  white-space: nowrap;
}


/* ================================
   DESKTOP TOOLTIP - Add overflow Scrollbar
   ================================ */

@media (min-width: 769px) {
  .tooltip {
    max-height: calc(100vh - 40px); 
    overflow: hidden;               
  }

  .tooltip .tt-card {
    max-height: calc(100vh - 68px); 
    overflow-y: auto;               
    overflow-x: hidden;
  }
}



/* ================================
   MOBILE TOOLTIP "BOTTOM SHEET"
   Only when JS adds .tt-mobile
   ================================ */

@media (max-width: 768px) {

  /* Turn tooltip container into a bottom sheet */
  .tooltip {
    position: fixed;            /* override absolute positioning */
    left: 10px !important;
    right: 10px !important;
    top: auto !important;
    bottom: 10px !important;
    width: auto !important;
    min-width: 0 !important;    /* override desktop min-width:560px */
    max-width: none !important;
    padding: 0 !important;      /* padding moves to the card for cleaner edges */
    border-radius: 14px;
    z-index: 9999;
  }

  /* The card becomes the scrollable surface */
  .tooltip .tt-card.tt-mobile {
    display: block;             /* override grid layout on mobile sheet */
    max-height: 65vh;           /* key: prevents it from taking entire iframe */
    overflow: auto;             /* allow scrolling inside the sheet */
    background: #fff;
    border-radius: 14px;
    padding: 14px;              /* restore padding here instead of container */
    box-shadow: 0 12px 30px rgba(0,0,0,0.25);
    -webkit-overflow-scrolling: touch;
  }

  /* Close button */
  .tooltip .tt-close {
    position: sticky;           /* stays visible while scrolling */
    top: 0;
    float: right;
    border: 0;
    background: transparent;
    font-size: 30px;
    line-height: 30px;
    padding: 6px 10px;
    cursor: pointer;
    z-index: 2;
  }

  /* Optional: slightly smaller left image area spacing */
  .tooltip .tt-left {
    margin-bottom: 10px;
  }

  /* Make the table easier to read in the sheet */
  .tooltip .tt-table thead th {
    /* position: sticky; */
    top: 44px;                  /* below close button */
    z-index: 1;
  }

  /* let the category dropdown be full width in mobile */
  .map-controls .control-category select {
    max-width: 100%;
  }
}
