@font-face {
    font-family: 'BankGothicMd';
    src: url('https://static1.squarespace.com/static/536cf42ee4b0465238027de5/t/53724803e4b0356615b60e42/1400000515944/BankGothic-Medium.woff') format('woff');
}

/* ============================================================
GLOBAL PRESETS
=============================================================== */
body { 
  margin: 0; 
  padding: 0; 
}

/* ============================================================
AD CONTAINER
=============================================================== */
#ad-container-vertical {
  position: absolute;
  left: 10px;
  width: 120px;
  z-index: 2;
}

/* ============================================================
MAP CONTAINER
=============================================================== */
#map { 
  z-index: 0;
  height: 80vh;
  width: 95vw;
  margin: 0 auto;
  display: block;
  transition: width 0.4s ease, margin-left 0.4s ease;
}

/* ============================================================
MENU (Layer toggle UI)
=============================================================== */
#menu {
  background: #f9f9f9;
  position: absolute;
  z-index: 1;
  top: 0;
  left: 140px; /* Adjusted for ad container */
  width: 180px;
  max-height: 80vh;
  overflow-y: auto;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 5px;
  padding: 10px;
  box-sizing: border-box;
  font-family: 'Open Sans', sans-serif;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#menu a {
  font-size: 11px;
  color: #404040;
  display: block;
  margin: 0;
  padding: 3px;
  text-decoration: none;
  text-align: center;
  font-family: 'Europa', sans-serif;
  text-transform: uppercase;
  font-weight: 400;
  letter-spacing: 0.05em;
  background-color: white;
  border-radius: 5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

#menu a:hover {
  background-color: #f0f0f0;
  color: #404040;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

#menu a.active {
  background-color: #3887be;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4) inset;
}

/* ============================================================
GEOCODER CONTAINER (for control buttons and search bar)
=============================================================== */
#geocoder-container {
  display: none;
  position: absolute;
  top: 0;
  left: 330px; /* Adjusted for ad container and new menu position */
  z-index: 1;
  flex-direction: column;
  gap: 5px;
  width: 260px;
  background: #f9f9f9;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 5px;
  padding: 10px;
  box-sizing: border-box;
  max-height: 80vh;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Geocoder input box styling */
#geocoder {
  width: 100%;
}

/* Row layout for grouped control buttons */
#geocoder-container div {
  display: flex;
  flex-direction: row;
  gap: 5px;
}

/* Override Mapbox Geocoder's default width to fit our container */
#geocoder .mapboxgl-ctrl-geocoder {
  width: 240px;
  min-width: 220px;
}

/* ============================================================
CONTROL BUTTON STYLES
=============================================================== */

/* Shared base button styling */
#geocoder-container button {
  background-size: 60%;
  background-position: center;
  background-repeat: no-repeat;
  width: 40px;
  height: 40px;
  border: none;
  background-color: white;
  border-radius: 5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  margin-right: 5px;
}

/* Button hover effect */
#geocoder-container button:hover {
  background-color: #f0f0f0;
}

/* Style for active control buttons */
#geocoder-container button.active {
  box-shadow: 0 0 0 2px #007bff; /* Blue outline */
}

/* Individual icon images */
.mapboxgl-ctrl-point         { background-image: url('https://www.ese-llc.com/s/marker-blue-random.svg'); }
.mapboxgl-ctrl-print         { background-image: url('https://img.icons8.com/ios-glyphs/30/000000/print.png'); }
.mapboxgl-ctrl-custom-print  { background-image: url('https://east-southeast-llc.github.io/ese-map-viewer-dev/img/custom-print.png'); }
.mapboxgl-ctrl-measure       { background-image: url('https://www.ese-llc.com/s/marker-blue-measure.svg'); }
.mapboxgl-ctrl-legend        { background-image: url('https://east-southeast-llc.github.io/ese-map-viewer-dev/img/legend.png'); }
.mapboxgl-ctrl-bookmark      { background-image: url('https://img.icons8.com/ios-glyphs/30/bookmark-ribbon.png'); }
.mapboxgl-ctrl-identify      { background-image: url('https://img.icons8.com/ios-filled/50/info.png'); }

.mapboxgl-ctrl-point-center  { background-image: url('https://www.ese-llc.com/s/marker-blue-center.svg'); }
.mapboxgl-ctrl-parea         { background-image: url('https://www.ese-llc.com/s/square-50.png'); }
.mapboxgl-ctrl-sZoom         { background-image: url('https://www.ese-llc.com/s/scale-zoom.png'); }

.mapboxgl-ctrl-point-off     { background-image: url('https://www.ese-llc.com/s/marker-blue-off.svg'); }
.mapboxgl-ctrl-clear         { background-image: url('https://www.ese-llc.com/s/marker-blue-measure-cancel.svg'); }
.mapboxgl-ctrl-ten           { background-image: none; }

/* ============================================================
SHARE BUTTON 
=============================================================== */
#geocoder-container button.mapboxgl-ctrl-share {
  width: 100%;
  height: 40px;
  background-color: white; 
  color: black;
  font-size: 14px;
  border: none;
  border-radius: 5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  text-align: center;
  line-height: 40px;
  margin-right: 0;
}

/* ============================================================
TOOLTIP STYLES
=============================================================== */
#custom-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 0px 4px;
  border-radius: 5px;
  font-size: 10px;
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
  transform: translateX(-50%);
  opacity: 0; /* Start hidden */
  transition: opacity 0.3s ease; /* Smooth transition */
}

/* ============================================================
DISTANCE WINDOW ALIGNMENT
=============================================================== */
#distanceWindow div:nth-child(2) {
  text-align: right;
}

/* Styling for markers with measure distance */
.marker-label {
  font-size: 14px;
  color: black;
  background-color: white;
  padding: 3px 5px;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  font-weight: bold;
}

/* ============================================================
INFO DISPLAY PANELS (for distance and scale)
=============================================================== */
#distance-display {
  font-size: 12px;
  color: #333;
  background: white;
  padding: 5px 10px;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  margin-top: 5px;
  text-align: left;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  max-width: 240px;
  width: 100%;
  box-sizing: border-box;
}

#scale-box {
  font-size: 12px;
  color: #333;
  background: white;
  padding: 5px 10px;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  margin-top: 5px;
  text-align: left;
  max-width: 240px;
  width: 100%;
  box-sizing: border-box;
}

/* ==== LEGEND STYLES ==== */

/* main container for the legend */
#legend-box {
  background: white;
  color: #333;
  padding: 10px 15px;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  margin-top: 5px;
  max-width: 240px;
  overflow-y: auto; 
  width: 100%;
  box-sizing: border-box;
  display: none; 
}

.legend-title {
  font-weight: bold;
  font-size: 14px;
  margin-top: auto;
  text-align: center;
}

.legend-item-row {
  display: flex;
  align-items: center;
  font-size: 12px;
}

.color-box {
  width: 15px;
  height: 15px;
  border: 1px solid #555;
  margin-right: 8px;
  flex-shrink: 0;
}

.color-line {
  width: 15px;
  height: 3px;
  border: 1px solid #555;
  margin-right: 8px;
  flex-shrink: 0;
}

/* ============================================================
CUSTOM PRINT BOX STYLES
=============================================================== */
#custom-print-box {
  display: none;
  background: white;
  color: #333;
  padding: 10px 15px;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  margin-top: 5px;
  max-width: 240px;
  width: 100%;
  box-sizing: border-box;
}

/* Prevent toolkit popups from squashing in the flex container */
#distance-display,
#scale-box,
#legend-box,
#custom-print-box {
  flex-shrink: 0;
  min-height: 50px;
}

/* styling for private property upland in wellfleet layer */
#parcel-controls {
  display: none; /* Initially hidden, controlled by JS */
  background: white;
  color: #333;
  padding: 10px 15px;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  margin-top: 5px;
  max-width: 240px; /* This ensures it matches the width of other controls */
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
  min-height: 50px;
}

/* Styles for the container of the slider and its arrow buttons */
#parcel-controls .parcel-slider-row {
  display: flex;
  align-items: center;
  gap: 5px; /* Adds a small space between the buttons and the slider */
}

/* Overrides the default button styles ONLY for the small arrow buttons */
#parcel-controls .parcel-slider-row button {
  width: auto; /* Allow button to size to its content */
  height: auto;
  padding: 4px 8px; /* Make the button smaller */
  font-size: 10px;
  line-height: 1;
  margin-right: 0; /* Remove the default right margin */
}

/* Ensures the slider track fills the available space without overflowing */
#parcel-controls .parcel-slider-row input[type="range"] {
  width: 100%;
  margin: 0;
}

/* ============================================================
PRINT STYLES
=============================================================== */
@media print {
  @page {
    size: 8.5in 11in; /* Letter size, portrait orientation */
    margin: 0; /* No additional margins */
  }
  * {
    -webkit-print-color-adjust: exact; /* For Chrome, Safari, and older Edge */
    print-color-adjust: exact;          /* Standard property */
  }
  body.print-body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
  }
}
.print-body {
    background-color: transparent;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column; /* Stack pages vertically */
    align-items: center;
    position: relative;
    width: 8.5in;
}
.frame {
    width: 8in;
    height: 10.5in;
    position: relative;
    page-break-after: always; /* Ensure each frame is on a new page */
    z-index: 1;
    border: 4px solid black;
    box-sizing: border-box; 
    background: white;
    margin: 0.25in; /* Apply margin to center the frame */
}
.top-frame {
    height: 8in;
    position: relative;
}
.bottom-frame {
    height: 2.5in; 
    display: flex;
    align-items: center;
    position: relative;
}
.map-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-bottom: 4px solid black;
}
.map-container img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensure the map scales properly */
}
.image-container {
    width: 2in;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end; /* This correctly aligns the item to the bottom */
    padding-bottom: .125in;
    overflow: hidden;
    box-sizing: border-box;
}
.image-container img {
    object-fit: contain;
    max-width: 100%;
    max-height: 100%;
    display: block;
}
.custom-info-frame {
    position: absolute;
    left: 10px;
    top: 10px;
    width: 2in;
    /* set a fixed height and hide overflow */
    height: 1.4in; 
    overflow: hidden; 
    font-size: 14px; /* sets the max font size */
    text-align: left;
}
.inner-frame {
    width: 2.5in;
    height: 2.5in;
    position: absolute;
    right: 0;
    top: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 4px;
    flex-direction: column; /* Stack text vertically */
}
.inner-frame span {
    display: block;
    margin-bottom: 4px; /* Space between lines */
}
.gis-map {
    font-family: 'BankGothicMd', sans-serif;
    font-style: italic;
    font-size: 14px;
}
.date, .scale, .base-map {
    font-family: Arial, sans-serif;
}
.disclaimer {
    font-size: 9px;
}
.date {
    font-size: 10px;
    margin-bottom: 0;
}
.scale {
    font-size: 11px;
}
.sources {
    font-size: 10px;
}
.massgis {
    font-size: 10px;
}
.base-map {
    font-size: 10px;
}
.inner-frame a {
    color: black;
    text-decoration: none;
}
.legend-frame {
  width: 3.3in;
  height: 2.2in; 
  padding: 5px;
  display: flex;
  flex-direction: column; /* Stack title and grid vertically */
  justify-content: flex-start;
  align-items: center;
}
.legend-print-title {
  font-family: 'BankGothicMd', sans-serif;
  font-style: italic;
  font-size: 14px;
  text-align: center;
}
.legend-grid {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr; /* Single column */
  grid-template-rows: repeat(30, auto); /* More rows if needed */
  row-gap: 1.5px; /* Tighter row spacing */
  column-gap: 0;
  justify-items: center; /* Center content horizontally */
}
.legend-section {
    font-size: .1in;
    font-weight: bold;
    margin-top: 4px;
    font-family: Verdana, sans-serif;
    break-after: avoid-page; 
}
.legend-item {
    display: flex;
    font-family: Verdana, sans-serif;
    align-items: center;
    font-size: .1in;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.color-box {
    width: .1in;
    height: .1in;
    border: .5px solid #555;
    margin-right: 5px; /* Tighter margin */
    flex-shrink: 0;
}
.color-line {
    width: .1in;
    height: 2px;
    border: .5px solid #555;
    margin-right: 5px; /* Tighter margin */
    flex-shrink: 0;
}
.legend-item-not-present {
    font-size: .09in;
    font-style: italic;
    color: #555555;
    margin-top: 3px;
    padding-left: .1in;
    font-family: Verdana, sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
BOOKMARK GEOCODER BUTTON STYLES 
=============================================================== */
#bookmark-box {
  display: none; /* Initially hidden */
  background: white;
  color: #333;
  padding: 10px 15px;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  margin-top: 5px;
  max-width: 240px;
  width: 100%;
  box-sizing: border-box;
}

#bookmark-box input[type="text"] {
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 3px;
}

#bookmark-box button {
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
  background-color: #3887be;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}

#bookmark-box button:hover {
  background-color: #3074a4;
}

#bookmark-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 150px;
  overflow-y: auto;
}

#bookmark-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid #eee;
}

#bookmark-list li a {
  text-decoration: none;
  color: #3887be;
}

#bookmark-list .delete-bookmark {
  color: #cc0000;
  cursor: pointer;
  font-weight: bold;
  padding: 0 5px;
}

#identify-box {
  display: none; /* Initially hidden */
  background: white;
  color: #333;
  padding: 10px 15px;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  margin-top: 5px;
  max-width: 240px;
  width: 100%;
  box-sizing: border-box;
  font-size: 12px;
}

/* ============================================================
DISCLAIMER POPUP STYLES
=============================================================== */
.disclaimer-popup-container {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 350px;
    background-color: #ffffff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 20px;
    z-index: 1001;
    font-family: 'Europa', sans-serif;
    visibility: hidden; /* Hidden by default */
    opacity: 0;
    transition: opacity 0.4s ease-in-out, visibility 0.4s;
}

.disclaimer-popup-container.show {
    visibility: visible;
    opacity: 1;
}

.disclaimer-popup-container h2 {
    margin-top: 0;
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
}

.disclaimer-text {
    font-size: 0.85rem;
    line-height: 1.5;
    color: #555;
    margin-bottom: 15px;
}

/* Container for the buttons */
.disclaimer-actions {
    display: flex;
    justify-content: center; 
    align-items: center;
    gap: 10px; /* Creates space between buttons */
}

/* A new shared class for both buttons */
.disclaimer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 16px;
    min-width: 165px;
    box-sizing: border-box;

    /* --- CHANGE: Reduce font size to prevent wrapping --- */
    font-size: 0.85rem;

    font-family: 'Europa', sans-serif;
    color: #ffffff !important;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

/* Specific color for the "Instructions" link */
.disclaimer-link.disclaimer-btn {
    background-color: #3887be;
}

.disclaimer-link.disclaimer-btn:hover {
    background-color: #3074a4;
}

/* Specific color for the "Acknowledge" button */
.disclaimer-button-red.disclaimer-btn {
    background-color: #d9534f;
}

.disclaimer-button-red.disclaimer-btn:hover {
    background-color: #c9302c;
}

/* ============================================================
MOBILE & TABLET RESPONSIVE STYLES
=============================================================== */
@media (max-width: 768px) {

    /* --- 1. hide desktop elements --- */
    #header, #footer-sections, #ad-container-vertical, #geocoder-container {
        display: none !important;
    }

    /* --- 2. style the new hamburger button (updated position) --- */
    #hamburger-button {
        display: block;
        position: absolute;
        top: 25px;   /* increased from 10px to move it down */
        left: 25px;  /* increased from 10px to move it right */
        z-index: 1002;
        background-color: rgba(249, 249, 249, 0.9); /* added slight transparency */
        border: 1px solid rgba(0, 0, 0, 0.2);
        border-radius: 5px;
        width: 40px;
        height: 40px;
        font-size: 24px;
        cursor: pointer;
    }

    /* --- 3. restyle the map to be smaller and centered --- */
    #map {
        width: calc(100% - 20px) !important; /* full width minus padding */
        height: 85vh !important;             /* less than full screen height */
        margin: 15px 10px !important;        /* creates vertical and horizontal whitespace */
        border-radius: 5px;                  /* added rounded corners to match the menu */
        top: 0;
        left: 0;
    }

    /* --- 4. restyle the layer menu to be a collapsible panel --- */
    #menu {
        left: 0;
        top: 0;
        width: 85%;
        max-width: 320px;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        z-index: 1001;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }

    /* --- 5. class to show the menu --- */
    #menu.open {
        transform: translateX(0);
    }
}

/* --- hide hamburger on desktop --- */
@media (min-width: 769px) {
    #hamburger-button {
        display: none;
    }
}