/* =========================================================
   AK Marine Trails — site.css
   v1.1 — 2026-01-17
   Clean rebuild (deduped, no conflicting rules)
   ========================================================= */

:root{
  --bg: #ffffff;
  --text: #111111;
  --muted: #5b5b5b;
  --border: #e6e6e6;
  --card: #f7f7f7;
  --link: #0b57d0;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
  --radius: 14px;
  --wrap: 1100px;
}

*{ box-sizing: border-box; }
html, body{ height:100%; margin:0; }
body{ color: var(--text); background: transparent; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; }

a{ color: var(--link); text-decoration: none; }
a:hover{ text-decoration: underline; }

.wrap{
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 16px;
}

/* =========================
   Header
   ========================= */
.site-header{
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-row{
  height: 58px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 16px;
}

.brand{
  font-weight: 800;
  letter-spacing: .2px;
  color: var(--text);
  text-decoration: none;
}

.nav{
  display:flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items:center;
}

.nav a{
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
}

.nav a:hover{
  background: var(--card);
  text-decoration: none;
}

.nav a.active{
  background: var(--card);
  font-weight: 700;
}

/* =========================
   Landing page
   ========================= */
.hero{
  padding: 34px 0 18px;
}

.hero h1{
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.6px;
}

.lead{
  margin: 0 0 18px;
  color: var(--muted);
  max-width: 70ch;
  font-size: 1.05rem;
}

.cta-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.cta{
  display:block;
  padding: 16px 16px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
}

.cta:hover{
  text-decoration: none;
  transform: translateY(-1px);
}

.cta strong{
  display:block;
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.cta span{
  display:block;
  color: var(--muted);
  font-size: .95rem;
}

.note{
  margin: 14px 0 26px;
  border-left: 4px solid var(--border);
  padding: 12px 14px;
  background: #fff;
  border-radius: 10px;
}

/* Generic page content */
main.wrap{ padding-bottom: 24px; }
h1, h2, h3{ letter-spacing: -0.2px; }

.card{
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.site-footer{
  border-top: 0;
  margin-top: 22px;
  padding: 18px 0 26px;
  color: var(--muted);
  background: transparent;
}

/* =========================
   Background image layer
   ========================= */
html, body{ background: transparent; }
body{ position: relative; }

body::before{
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.8;
  pointer-events: none;
}

/* Ensure content sits above background */
.site-header,
main,
.site-footer{
  position: relative;
  z-index: 1;
}

/* Optional: soften hero for readability */
.hero{
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(6px);
  border-radius: 16px;
  padding: 24px 24px 20px;
}

.hero h1,
.hero .lead{
  color: #111;
}

/* =========================
   Toolbar (map page)
   ========================= */
.toolbar{
  display:flex;
  flex-wrap: wrap;
  align-items:center;
  justify-content: space-between;
  gap: 15px;
  padding: 10px 0;
}

.toolbar input[type="search"]{
  flex: 1 1 auto;
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.98rem;
}

.toolbar-right{
  display:flex;
  gap: 10px;
  flex: 0 0 auto;
}

button{
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}

button:hover{ background: var(--card); }

/* Map container */
#map{
  height: calc(100vh - 58px - 24px - 56px);
  min-height: 520px;
  margin: 12px 0 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

/* =========================
   Search dropdown (camps)
   ========================= */
.search-wrap{
  position: relative;
  flex: 1;
  max-width: 420px;
}

.search-wrap input[type="search"]{
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
}

.search-dropdown{
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #ccc;
  border-top: none;
  max-height: 260px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.search-item{
  padding: 8px 10px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid #eee;
}

.search-item:hover{ background-color: #f0f4f8; }
.search-item:last-child{ border-bottom: none; }

/* =========================
   Town labels
   ========================= */
.leaflet-tooltip.town-label{
  background: none;
  border: none;
  box-shadow: none;
  color: #111;
  font-size: 12px;
  font-weight: 600;
  text-shadow:
    -1px -1px 0 #fff,
     1px -1px 0 #fff,
    -1px  1px 0 #fff,
     1px  1px 0 #fff;
  padding: 0;
}

/* =========================
   Layer controls in toolbar
   ========================= */
.layer-filters{
  display: flex;
  flex-grow: 1;
  justify-content: center;
  align-items: center;
}

/* Remove Leaflet control box styling */
.layer-filters .leaflet-control-layers{
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Remove forced line breaks inside Leaflet control */
.layer-filters .leaflet-control-layers br{ display: none; }

/* Lay out base + overlays as inline groups */
.layer-filters .leaflet-control-layers-base,
.layer-filters .leaflet-control-layers-overlays{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin: 0;
  padding: 0;
}

/* Labels inline */
.layer-filters .leaflet-control-layers label{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 16px;
  white-space: nowrap;
  font-size: 13px;
}

/* A little separation between radios and checkboxes groups */
.layer-filters .leaflet-control-layers-base{ margin-right: 24px; }

/* =========================
   Layer legend icons
   ========================= */
.layer-icon{
  width: 18px;
  height: 18px;
  margin-right: 6px;
  vertical-align: middle;
}

.layer-dot{
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

.layer-dot.town{
  background: #ffd54f;
  border: 2px solid #111;
}

.layer-dot.warning{
  background: #e53935;
  border: 2px solid #b71c1c;
}

.layer-line{
  display: inline-block;
  width: 18px;
  height: 2px;
  background: #0b57d0;
  margin-right: 6px;
  vertical-align: middle;
}

.layer-dot.poi{
  background: #2e7d32;
  border: 2px solid #1b5e20;
}


/* =========================
   Leaflet popups (wrap + sane widths)
   ========================= */

/* Ensure long text wraps instead of causing horizontal scroll */
.leaflet-popup-content{
  white-space: normal;
  overflow-wrap: break-word;  /* don’t split every character */
  word-break: normal;         /* stop forced breaking */
}


/* Tables in popups should not force horizontal scroll */
.leaflet-popup-content table{ width: 100%; }
.leaflet-popup-content td{ white-space: normal; word-break: break-word; }

/*
  Mobile "super skinny" fix:
  Leaflet sets an inline width on .leaflet-popup-content; on small screens
  that calculation can collapse. Override wrapper + content width.
*/
@media (max-width: 768px){
  .leaflet-popup-content-wrapper,
  .leaflet-popup-content{
    width: clamp(260px, 92vw, 380px) !important;
    max-width: 92vw !important;
  }

  /* Allow the layer labels to wrap on tight screens */
  .layer-filters .leaflet-control-layers label{
    white-space: normal;
  }

  .toolbar{
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-right{
    display:flex;
    justify-content: space-between;
  }
}

/* Other responsiveness */
@media (max-width: 840px){
  .cta-grid{ grid-template-columns: 1fr; }
}
/* Desktop: stop Leaflet collapsing popup width */
@media (min-width: 769px) {
  .leaflet-popup-content-wrapper,
  .leaflet-popup-content {
    width: auto !important;     /* overrides Leaflet inline width */
  }

  .leaflet-popup-content {
    min-width: 320px;           /* prevents skinny desktop popups */
    max-width: 420px;           /* matches your JS maxWidth */
  }
}
