/* Districts page - interactive Sri Lanka choropleth and its side panel.
   Scoped to .districts-page so it can share the legal-page / front-home shells
   without reaching into them. */

/* Brand-blue hero, overriding the shared legal-page gradient for this page. */
.districts-page .legal-hero {
  background: #003b95;
}

.districts-page .sl-section {
  padding: 40px 0 90px;
}

/* The choropleth + its side panel need more room than the 1140/1320px shell the
   legal-page container gives them, so widen the container just for this section.
   It stays fluid (92vw) and never exceeds 1760px. */
.districts-page .sl-section > .container {
  max-width: min(1760px, 92vw);
  width: 100%;
}

@media (max-width: 1199px) {
  .districts-page .sl-section > .container {
    max-width: 100%;
  }
}

.districts-page .sl-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 26px;
}

/* View toggle -------------------------------------------------------------- */
.districts-page .sl-toggle {
  display: inline-flex;
  padding: 4px;
  border: 1px solid #e0e5ef;
  border-radius: 999px;
  background: #f4f6fb;
}

.districts-page .sl-toggle__btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 9px 22px;
  border-radius: 999px;
  font: 500 14px/1 "Jost", sans-serif;
  color: #55617a;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.districts-page .sl-toggle__btn:hover {
  color: #1b3a5c;
}

.districts-page .sl-toggle__btn.is-active {
  background: #ffffff;
  color: #14294a;
  box-shadow: 0 4px 12px rgba(20, 41, 74, .12);
}

/* Legend ---------------------------------------------------------------------*/
.districts-page .sl-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 400 12px/1 "Jost", sans-serif;
  color: #6b7690;
}

.districts-page .sl-legend__swatch {
  width: 22px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.districts-page .sl-legend__label {
  white-space: nowrap;
}

.districts-page .sl-c0 { background: #eef2f7; }
.districts-page .sl-c1 { background: #cfe0f3; }
.districts-page .sl-c2 { background: #9ec2e6; }
.districts-page .sl-c3 { background: #5b9bd6; }
.districts-page .sl-c4 { background: #2f6db0; }

/* Layout ------------------------------------------------------------------- */
.districts-page .sl-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 40px;
  align-items: start;
}

/* On wide screens the map does not need to keep growing - cap it and hand the
   rest of the extra width to the side panel so its hotel cards get more room. */
@media (min-width: 1400px) {
  .districts-page .sl-layout {
    grid-template-columns: minmax(0, 560px) minmax(0, 1fr);
    gap: 56px;
  }
}

.districts-page .sl-map-stage {
  position: relative;
  background: linear-gradient(180deg, #f7f9fc, #eef2f8);
  border: 1px solid #e6eaf2;
  border-radius: 18px;
  padding: 18px;
}

.districts-page .sl-map-readout {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 6px 12px;
  border-bottom: 1px solid #e6eaf2;
  margin-bottom: 12px;
}

.districts-page .sl-map-readout__name {
  font: 600 15px/1.2 "Jost", sans-serif;
  color: #17223b;
}

.districts-page .sl-map-readout__count {
  font: 500 13px/1.2 "Jost", sans-serif;
  color: #2f6db0;
}

.districts-page .sl-map-canvas {
  min-height: 320px;
  max-height: 76vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.districts-page .sl-map-canvas svg {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 76vh;
  margin: 0 auto;
  display: block;
  overflow: visible;
}

.districts-page .sl-map-loading,
.districts-page .sl-map-error {
  font: 400 14px/1.5 "Jost", sans-serif;
  color: #6b7690;
  text-align: center;
  padding: 40px 12px;
}

.districts-page .sl-map-credit {
  margin: 12px 2px 0;
  font: 400 11px/1.4 "Jost", sans-serif;
  color: #9aa3b7;
}

.districts-page .sl-map-credit a {
  color: #7d879c;
  text-decoration: underline;
}

/* District shapes -------------------------------------------------------------*/
.districts-page .sl-district {
  fill: #eef2f7;
  stroke: #ffffff;
  stroke-width: 0.7;
  stroke-linejoin: round;
  cursor: pointer;
  transition: fill .15s ease, filter .15s ease;
}

.districts-page .sl-district.sl-c1 { fill: #cfe0f3; }
.districts-page .sl-district.sl-c2 { fill: #9ec2e6; }
.districts-page .sl-district.sl-c3 { fill: #5b9bd6; }
.districts-page .sl-district.sl-c4 { fill: #2f6db0; }

/* Province view hides the internal district borders so each province reads as
   one shape. */
.districts-page .sl-map-canvas svg[data-mode="province"] .sl-district {
  stroke: rgba(255, 255, 255, .35);
  stroke-width: 0.4;
}

.districts-page .sl-district.is-hover {
  filter: brightness(1.06) saturate(1.1);
}

.districts-page .sl-district.is-active {
  stroke: #12325a;
  stroke-width: 1.4;
  filter: brightness(1.04);
}

/* In province view a whole province lights up at once, so a heavy border on
   every member district reads as noise - lift it with fill weight instead. */
.districts-page .sl-map-canvas svg[data-mode="province"] .sl-district.is-active {
  stroke: #12325a;
  stroke-width: 0.7;
  filter: brightness(1.1) saturate(1.12);
}

/* Once a region is picked, fade everything else so the selection reads
   regardless of how its own choropleth colour compares to its neighbours. */
.districts-page .sl-map-canvas svg.is-picking .sl-district:not(.is-active) {
  opacity: 0.38;
}

.districts-page .sl-district:focus {
  outline: none;
}

.districts-page .sl-district:focus-visible {
  stroke: #12325a;
  stroke-width: 1.6;
}

/* Side panel --------------------------------------------------------------- */
.districts-page .sl-map-aside {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Reserve the scrollbar track so cards never sit under the bar, and keep a
     little breathing room on the right edge. */
  scrollbar-gutter: stable;
  padding-right: 10px;
  scrollbar-width: thin;
  scrollbar-color: #c3ccdd transparent;
}

.districts-page .sl-map-aside::-webkit-scrollbar {
  width: 8px;
}

.districts-page .sl-map-aside::-webkit-scrollbar-track {
  background: transparent;
}

.districts-page .sl-map-aside::-webkit-scrollbar-thumb {
  background: #c3ccdd;
  border-radius: 999px;
}

.districts-page .sl-map-aside::-webkit-scrollbar-thumb:hover {
  background: #a7b2c8;
}

.districts-page .sl-panel {
  display: none;
}

.districts-page .sl-panel.is-active {
  display: block;
}

.districts-page .sl-panel__placeholder {
  border: 1px dashed #d3dae8;
  border-radius: 16px;
  padding: 48px 28px;
  text-align: center;
  color: #6b7690;
}

.districts-page .sl-panel__placeholder .bi {
  font-size: 30px;
  color: #9ab2d4;
}

.districts-page .sl-panel__placeholder h2 {
  margin: 14px 0 8px;
  font: 600 20px/1.2 "Jost", sans-serif;
  color: #22314e;
}

.districts-page .sl-panel__placeholder p {
  font: 400 14px/1.6 "Jost", sans-serif;
  margin: 0;
}

.districts-page .sl-panel__eyebrow {
  display: inline-block;
  font: 600 11px/1 "Jost", sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #6b7690;
}

.districts-page .sl-panel h2 {
  margin: 10px 0 6px;
  font: 600 26px/1.15 "Jost", sans-serif;
  color: #17223b;
}

.districts-page .sl-panel__meta {
  margin: 0 0 16px;
  font: 500 14px/1.4 "Jost", sans-serif;
  color: #2f6db0;
}

.districts-page .sl-panel__label {
  margin: 0 0 4px;
  font: 600 12px/1 "Jost", sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #8a93a8;
}

.districts-page .sl-panel__list {
  margin: 0 0 22px;
  font: 400 14px/1.7 "Jost", sans-serif;
  color: #4a5470;
}

.districts-page .sl-panel__empty {
  font: 400 14px/1.6 "Jost", sans-serif;
  color: #6b7690;
  margin: 0 0 16px;
}

.districts-page .sl-panel__cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

/* The widened panel fits a third card per row on large screens. */
@media (min-width: 1500px) {
  .districts-page .sl-panel__cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.districts-page .sl-card {
  border: 1px solid #e8ebf2;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  transition: box-shadow .18s ease, transform .18s ease;
}

.districts-page .sl-card:hover {
  box-shadow: 0 12px 26px rgba(20, 41, 74, .12);
  transform: translateY(-2px);
}

.districts-page .sl-card__media {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.districts-page .sl-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.districts-page .sl-card__body {
  padding: 12px 14px 14px;
}

.districts-page .sl-card__body h3 {
  margin: 0 0 4px;
  font: 600 15px/1.3 "Jost", sans-serif;
}

.districts-page .sl-card__body h3 a {
  color: #1c2942;
}

.districts-page .sl-card__body h3 a:hover {
  color: #2f6db0;
}

.districts-page .sl-card__place {
  margin: 0 0 6px;
  font: 400 12px/1.4 "Jost", sans-serif;
  color: #7a8398;
}

.districts-page .sl-card__price {
  font: 600 13px/1 "Jost", sans-serif;
  color: #17223b;
}

.districts-page .sl-panel__all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 500 14px/1 "Jost", sans-serif;
  color: #2f6db0;
}

.districts-page .sl-panel__all:hover {
  color: #17223b;
}

/* Province drill-down - one row per district, opens the district panel ------- */
.districts-page .sl-drill {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 16px;
}

.districts-page .sl-drill__item {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  border: 1px solid #e6eaf2;
  border-radius: 12px;
  background: #fff;
  font: 500 15px/1.2 "Jost", sans-serif;
  color: #1c2942;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.districts-page .sl-drill__item:hover {
  border-color: #2f6db0;
  box-shadow: 0 10px 22px rgba(20, 41, 74, .1);
  transform: translateY(-1px);
}

.districts-page .sl-drill__item:focus-visible {
  outline: 2px solid #2f6db0;
  outline-offset: 2px;
}

.districts-page .sl-drill__name {
  flex: 1 1 auto;
}

.districts-page .sl-drill__count {
  flex: none;
  font: 500 13px/1 "Jost", sans-serif;
  color: #6b7690;
}

.districts-page .sl-drill__go {
  flex: none;
  font-size: 14px;
  color: #2f6db0;
}

.districts-page .sl-panel__hint {
  margin: 0;
  font: 400 13px/1.5 "Jost", sans-serif;
  color: #8a93a8;
}

/* Responsive ------------------------------------------------------------------*/
@media (max-width: 991px) {
  .districts-page .sl-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .districts-page .sl-map-aside {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .districts-page .sl-map-canvas svg {
    max-height: 60vh;
  }
}

@media (max-width: 560px) {
  .districts-page .sl-toolbar {
    justify-content: center;
  }
  .districts-page .sl-panel__cards {
    grid-template-columns: 1fr;
  }
}
