/* Blue Sky Ranch trail map. Paired with bsr-trail-map.js; loaded only where [data-bsr-trail-map] renders. */
.bsr-map {
  position: relative;
  width: 100%;
  height: clamp(420px, 72vh, 760px);
  border-radius: var(--radius, 0.5rem);
  overflow: hidden;
  background: #2b3a2e;
  isolation: isolate;
  font-family: inherit;
}
.bsr-map:focus-visible { outline: 3px solid var(--action, #c98a2b); outline-offset: 2px; }
.bsr-map { scroll-margin-top: var(--header-height, 6.5rem); } /* clears the sticky header when the table scrolls the map into view */
.bsr-map.is-loading::after,
.bsr-map.is-failed::after {
  content: "Loading the trail map";
  position: absolute; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  color: #fff; font-size: var(--text-s, 0.95rem); letter-spacing: 0.02em;
  background: rgba(20, 28, 22, 0.55);
  pointer-events: none;
}
.bsr-map.is-failed::after { content: "The map could not load. The printable PDF below has every trail."; }

/* Leaflet chrome tuned to the site */
.bsr-map .leaflet-container { font-family: inherit; font-size: 0.9rem; }
.bsr-map .leaflet-bar a { color: #1c1c1c; }
.bsr-map .leaflet-control-attribution { font-size: 0.65rem; background: rgba(255,255,255,0.75); }
.bsr-map .leaflet-popup-content-wrapper { border-radius: 0.5rem; padding: 0; overflow: hidden; }
.bsr-map .leaflet-popup-content { margin: 0; line-height: 1.4; }
.bsr-map .leaflet-popup-content p { margin: 0; }
.bsr-map-popup { padding: 0.85rem 1rem 1rem; }
.bsr-map-popup__photo { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; margin: -0.85rem -1rem 0.75rem; width: calc(100% + 2rem); max-width: none; }
.bsr-map-popup__kicker { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--neutral-dark, #5c5c5c); margin: 0 0 0.15rem; }
.bsr-map-popup__title { font-size: 1.05rem; line-height: 1.2; margin: 0 0 0.4rem; display: flex; align-items: center; gap: 0.45rem; }
.bsr-map-popup__meta, .bsr-map-popup__joins { font-size: 0.85rem; color: #2a2a2a; margin: 0; }
.bsr-map-popup__joins { margin-top: 0.25rem; }
.bsr-map-popup__swatch { display: inline-block; width: 0.9em; height: 0.9em; border-radius: 999px; box-shadow: 0 0 0 1.5px #111; flex: none; }
.bsr-map-tip { background: rgba(16, 20, 24, 0.9); color: #fff; border: 0; border-radius: 0.35rem; font-weight: 600; padding: 0.25rem 0.5rem; }
.bsr-map-tip::before { display: none; }

/* POI markers */
.bsr-map-poi { background: none; border: 0; }
.bsr-map-poi__dot {
  position: absolute; left: 0; top: 0; width: 14px; height: 14px; border-radius: 999px;
  background: #ffffff; border: 2.5px solid #111; box-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.bsr-map-poi--building .bsr-map-poi__dot { background: #f5c04a; border-radius: 2px; }
.bsr-map-poi--lookout .bsr-map-poi__dot { background: #6fc3ff; }
.bsr-map-poi--feature .bsr-map-poi__dot { background: #9be37a; }
.bsr-map-poi__label {
  position: absolute; left: 18px; top: -3px; white-space: nowrap;
  font-size: 0.72rem; font-weight: 600; color: #fff;
  text-shadow: 0 0 3px #000, 0 0 3px #000, 0 1px 2px #000;
  pointer-events: none;
  transition: opacity 0.2s;
}
.bsr-map.is-labels-off .bsr-map-poi__label { opacity: 0; }
.bsr-map-poi:hover .bsr-map-poi__label, .bsr-map-poi:focus .bsr-map-poi__label { opacity: 1; }

/* Legend */
.bsr-map-legend {
  background: rgba(255,255,255,0.94); color: #1c1c1c; border-radius: 0.5rem;
  box-shadow: 0 1px 5px rgba(0,0,0,0.4); max-width: 15.5rem; max-height: calc(100% - 1.5rem); overflow: auto;
  font-size: 0.8rem;
}
.bsr-map-legend__summary { cursor: pointer; font-weight: 700; padding: 0.5rem 0.75rem; list-style: none; }
.bsr-map-legend__summary::-webkit-details-marker { display: none; }
.bsr-map-legend__summary::before { content: "▾"; display: inline-block; margin-right: 0.4rem; transition: transform 0.15s; }
.bsr-map-legend__details:not([open]) .bsr-map-legend__summary::before { transform: rotate(-90deg); }
.bsr-map-legend__count { font-weight: 400; color: #666; }
.bsr-map-legend__list { list-style: none; margin: 0; padding: 0 0.35rem 0.35rem; }
.bsr-map-legend__item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.45rem;
  width: 100%; text-align: left; background: none; border: 0; border-radius: 0.3rem;
  padding: 0.22rem 0.4rem; font: inherit; color: inherit; cursor: pointer; line-height: 1.25;
}
.bsr-map-legend__item:hover, .bsr-map-legend__item:focus-visible { background: #eef2ea; outline: none; }
.bsr-map-legend__name { text-align: left; justify-self: start; }
.bsr-map-legend__km { color: #666; font-variant-numeric: tabular-nums; text-align: right; justify-self: end; white-space: nowrap; }
.bsr-map-legend__keys { margin: 0; padding: 0.4rem 0.75rem 0.6rem; border-top: 1px solid #ddd; display: flex; flex-wrap: wrap; gap: 0.35rem 0.7rem; }
.bsr-map-key { display: inline-flex; align-items: center; gap: 0.3rem; }
.bsr-map-key::before { content: ""; width: 0.7em; height: 0.7em; border-radius: 999px; border: 1.5px solid #111; }
.bsr-map-key--building::before { background: #f5c04a; border-radius: 2px; }
.bsr-map-key--lookout::before { background: #6fc3ff; }
.bsr-map-key--feature::before { background: #9be37a; }
.bsr-map-reset a { font-size: 1.2rem; line-height: 26px; }
@media (max-width: 767px) {
  .bsr-map { height: clamp(380px, 70vh, 600px); }
  .bsr-map-legend { max-width: 11.5rem; }
  .bsr-map-legend__details[open] .bsr-map-legend__list { max-height: 9rem; overflow: auto; }
}

/* Trail table (static HTML in the page; JS adds sort + locate) */
.bsr-trail-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.bsr-trail-table { width: 100%; border-collapse: collapse; font-size: var(--text-s, 0.95rem); line-height: 1.35; }
.bsr-trail-table th, .bsr-trail-table td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--neutral-light, #d9d6cf); vertical-align: top; }
.bsr-trail-table thead th { font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; border-bottom-width: 2px; white-space: nowrap; }
.bsr-trail-table tbody th { font-weight: 600; }
.bsr-trail-table caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.bsr-trail-table td[data-sort-value] { white-space: nowrap; font-variant-numeric: tabular-nums; }
.bsr-trail-table__sort, .bsr-trail-table__locate {
  background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; text-align: left; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.4rem; border-radius: 0; box-shadow: none; text-transform: none; letter-spacing: inherit; min-height: 0;
}
.bsr-trail-table thead .bsr-trail-table__sort { font-size: inherit; letter-spacing: inherit; text-transform: inherit; }
.bsr-trail-table__sort:hover, .bsr-trail-table__locate:hover { text-decoration: underline; text-underline-offset: 0.15em; }
.bsr-trail-table__arrow::after { content: "↕"; opacity: 0.45; font-size: 0.9em; }
th[aria-sort="ascending"] .bsr-trail-table__arrow::after { content: "↑"; opacity: 1; }
th[aria-sort="descending"] .bsr-trail-table__arrow::after { content: "↓"; opacity: 1; }
.bsr-trail-table__note { font-size: 0.8rem; color: var(--neutral-dark, #5c5c5c); margin-top: 0.75rem; }

/* Mobile: stack each trail row into a block with labelled lines (no horizontal scrolling). Header sorting hides here. */
@media (max-width: 767px) {
  .bsr-trail-table-wrap { overflow-x: visible; }
  .bsr-trail-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .bsr-trail-table, .bsr-trail-table tbody, .bsr-trail-table tr, .bsr-trail-table th, .bsr-trail-table td { display: block; width: 100%; }
  .bsr-trail-table tr { padding: 0.85rem 0; border-bottom: 1px solid var(--neutral-light, #d9d6cf); }
  .bsr-trail-table tr:last-child { border-bottom: 0; }
  .bsr-trail-table th, .bsr-trail-table td { padding: 0.15rem 0; border: 0; }
  .bsr-trail-table tbody th { font-size: 1.05em; padding-bottom: 0.35rem; }
  .bsr-trail-table td[data-sort-value] { white-space: normal; }
  .bsr-trail-table td::before {
    display: inline-block; min-width: 6.5rem; margin-right: 0.5rem;
    font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--neutral-dark, #5c5c5c);
  }
  .bsr-trail-table td:nth-of-type(1)::before { content: "Length"; }
  .bsr-trail-table td:nth-of-type(2)::before { content: "Route"; }
  .bsr-trail-table td:nth-of-type(3)::before { content: "Connects to"; display: block; margin: 0 0 0.1rem; }
}
