:root {
  --bg: #0c1218;
  --panel: rgba(12, 19, 25, 0.9);
  --panel-soft: rgba(17, 27, 35, 0.78);
  --border: rgba(255, 255, 255, 0.11);
  --text: #f3efe6;
  --muted: #bdb5a3;
  --accent: #c69253;
  --accent-soft: rgba(198, 146, 83, 0.15);
  --property: #74d5df;
  --surrounding: #f4b868;
  --road: #f6e2b4;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-display: "Trebuchet MS", "Segoe UI", sans-serif;
  --font-body: "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(198, 146, 83, 0.16), transparent 32%),
    radial-gradient(circle at bottom right, rgba(116, 213, 223, 0.12), transparent 24%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

body {
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 390px 1fr;
  min-height: 100vh;
}

.panel {
  background: linear-gradient(180deg, rgba(18, 28, 36, 0.92), rgba(10, 16, 21, 0.88));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3vw, 2.7rem);
  line-height: 1.05;
}

.lede {
  color: var(--muted);
  line-height: 1.55;
}

.control-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.control-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(198, 146, 83, 0.45);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(198, 146, 83, 0.24), rgba(198, 146, 83, 0.12));
  color: var(--text);
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.control-button:hover,
.control-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(198, 146, 83, 0.8);
}

.control-button-secondary {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
}

.section-block {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.section-header h2 {
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
}

.section-meta {
  font-size: 0.76rem;
  color: var(--muted);
  text-align: right;
}

.legend-list,
.item-list {
  display: grid;
  gap: 0.55rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.legend-list li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--muted);
}

.swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 999px;
}

.swatch-property {
  background: var(--property);
}

.swatch-surrounding {
  background: var(--surrounding);
}

.swatch-road {
  background: var(--road);
}

.item-button {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.item-button:hover,
.item-button:focus-visible,
.item-button.is-active {
  transform: translateY(-1px);
  border-color: rgba(198, 146, 83, 0.5);
  background: rgba(198, 146, 83, 0.14);
}

.item-title {
  display: block;
  font-weight: 600;
}

.item-subtitle {
  display: block;
  margin-top: 0.22rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.item-tag {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-card {
  margin-top: auto;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.detail-content {
  display: grid;
  gap: 0.8rem;
}

.detail-placeholder {
  color: var(--muted);
}

.detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.detail-description {
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.6;
}

.detail-meta-grid {
  display: grid;
  gap: 0.55rem;
}

.detail-meta-grid span {
  color: var(--muted);
}

.detail-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  background: rgba(198, 146, 83, 0.14);
  color: var(--text);
  text-decoration: none;
  border: 1px solid rgba(198, 146, 83, 0.45);
}

.map-shell {
  position: relative;
  min-height: 100vh;
}

#map {
  width: 100%;
  min-height: 100vh;
  background: #0b1217;
}

.map-floating {
  position: absolute;
  z-index: 700;
  border-radius: var(--radius-md);
}

.top-right {
  top: 1.25rem;
  right: 1.25rem;
}

.bottom-left {
  left: 1.25rem;
  bottom: 1.25rem;
}

.compact-panel {
  padding: 0.9rem 1rem;
}

.compact-panel-wide {
  max-width: 420px;
}

.compact-label {
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2rem;
  line-height: 1.3;
}

.site-marker {
  position: relative;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.site-marker::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.site-marker--office {
  background: #f35e5e;
}

.site-marker--utility {
  background: #ffca67;
}

.site-marker--access {
  background: #63c6ff;
}

.site-marker--road {
  background: #ece7cf;
}

.site-marker--area {
  background: #d89049;
}

.site-marker--hotspot-photo {
  width: 22px;
  height: 22px;
  background: #7aead3;
}

.site-marker--hotspot-video {
  width: 22px;
  height: 22px;
  background: #9ebdff;
}

.leaflet-popup-content-wrapper {
  background: rgba(11, 18, 24, 0.95);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.3);
}

.leaflet-popup-tip {
  background: rgba(11, 18, 24, 0.95);
}

.leaflet-popup-content {
  display: grid;
  gap: 0.35rem;
  min-width: 180px;
  margin: 0.95rem 3rem 0.95rem 1rem;
}

.leaflet-popup-close-button {
  top: 0.75rem !important;
  right: 0.75rem !important;
  display: grid !important;
  place-items: center;
  width: 28px !important;
  height: 28px !important;
  padding: 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text) !important;
  font-size: 1rem !important;
  line-height: 1 !important;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.leaflet-popup-close-button:hover,
.leaflet-popup-close-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
}

.popup-title {
  font-weight: 700;
  font-size: 0.96rem;
  line-height: 1.35;
}

.popup-copy {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.popup-action {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
}

.modal[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(880px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  margin: 1rem auto;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  overflow: auto;
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
}

.modal-content {
  display: grid;
  gap: 1rem;
  clear: both;
}

.modal-media {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

.modal-media img,
.modal-media video {
  display: block;
  width: 100%;
  height: auto;
}

.modal-kicker {
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.76rem;
}

.modal-description {
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.65;
}

.modal-placeholder {
  padding: 1.25rem;
  color: var(--muted);
}

.leaflet-control-zoom {
  border: none;
  box-shadow: var(--shadow);
}

.leaflet-control-zoom a {
  background: rgba(15, 23, 30, 0.92);
  color: var(--text);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 340px 1fr;
  }
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: absolute;
    z-index: 900;
    left: 0.8rem;
    right: 0.8rem;
    top: 0.8rem;
    max-height: calc(100vh - 1.6rem);
    border-radius: var(--radius-lg);
  }

  .map-shell,
  #map {
    min-height: 100vh;
  }

  .top-right {
    top: auto;
    right: 1rem;
    bottom: 9.25rem;
  }

  .bottom-left {
    right: 1rem;
    left: 1rem;
    bottom: 1rem;
  }
}

@media (max-width: 640px) {
  .sidebar {
    padding: 1rem;
  }

  .compact-panel-wide {
    max-width: none;
  }
}


/* Landing palette alignment for the map sidebar only */
.sidebar {
  color: #f0ede8;
  background: linear-gradient(180deg, rgba(42, 42, 42, 0.96), rgba(26, 26, 26, 0.98));
  border-right-color: rgba(196, 168, 130, 0.12);
}

.sidebar .eyebrow {
  color: #e8622b;
}

.sidebar h1 {
  color: #f0ede8;
}

.sidebar .lede,
.sidebar .section-meta,
.sidebar .legend-list li,
.sidebar .detail-placeholder,
.sidebar .item-subtitle,
.sidebar .detail-meta-grid span,
.sidebar .detail-help {
  color: #c4a882;
}

.sidebar .section-header h2,
.sidebar .item-title,
.sidebar .detail-description {
  color: #f0ede8;
}

.sidebar .control-button,
.sidebar .control-button-secondary,
.sidebar .detail-link,
.sidebar .admin-toggle {
  border-color: rgba(196, 168, 130, 0.15);
  background: linear-gradient(180deg, rgba(42, 42, 42, 0.92), rgba(26, 26, 26, 0.94));
  color: #f0ede8;
}

.sidebar .control-button:hover,
.sidebar .control-button:focus-visible,
.sidebar .control-button-secondary:hover,
.sidebar .control-button-secondary:focus-visible,
.sidebar .detail-link:hover,
.sidebar .detail-link:focus-visible,
.sidebar .admin-toggle:hover,
.sidebar .admin-toggle:focus-visible {
  border-color: rgba(232, 98, 43, 0.6);
  background: linear-gradient(180deg, rgba(232, 98, 43, 0.18), rgba(232, 98, 43, 0.08));
  color: #f0ede8;
}

.sidebar .item-button,
.sidebar .detail-card {
  border-color: rgba(196, 168, 130, 0.12);
  background: linear-gradient(180deg, rgba(42, 42, 42, 0.8), rgba(26, 26, 26, 0.86));
}

.sidebar .item-button:hover,
.sidebar .item-button:focus-visible,
.sidebar .item-button.is-active {
  border-color: rgba(232, 98, 43, 0.45);
  background: linear-gradient(180deg, rgba(232, 98, 43, 0.16), rgba(232, 98, 43, 0.08));
}

.sidebar .item-tag {
  background: rgba(232, 98, 43, 0.12);
  color: #f0ede8;
}

@media (max-width: 768px) {
  #app-shell.app-shell,
  #app-shell.app-shell:not(.is-admin),
  #app-shell.app-shell.is-admin {
    position: relative;
    grid-template-columns: 1fr;
  }

  #app-shell > .sidebar {
    position: absolute;
    top: 0;
    right: auto;
    bottom: 0;
    left: 0;
    width: min(320px, calc(100vw - 3rem));
    max-width: calc(100vw - 3rem);
    height: 100%;
    max-height: 100dvh;
    margin: 0;
    padding: 4.25rem 1rem 1rem;
    border-radius: 0 24px 24px 0;
    transform: translateX(calc(-100% - 1rem));
    transition: transform 240ms ease;
    will-change: transform;
    z-index: 960;
    box-shadow: 24px 0 48px rgba(0, 0, 0, 0.34);
  }

  #app-shell.mobile-sidebar-open > .sidebar {
    transform: translateX(0);
  }

  #app-shell > .map-shell {
    width: 100%;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
  }

  #app-shell > .map-shell #map {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
  }

  #app-shell > .mobile-sidebar-toggle[hidden],
  #app-shell > .mobile-sidebar-overlay[hidden] {
    display: none;
  }

  #app-shell > .mobile-sidebar-toggle {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(232, 98, 43, 0.9);
    border-radius: 14px;
    background: #2a2a2a;
    color: #e8622b;
    font-size: 1.5rem;
    line-height: 1;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
    cursor: pointer;
    z-index: 980;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
    touch-action: manipulation;
  }

  #app-shell > .mobile-sidebar-toggle:hover,
  #app-shell > .mobile-sidebar-toggle:focus-visible {
    transform: translateY(-1px);
    border-color: #e8622b;
    background: rgba(42, 42, 42, 0.96);
  }

  #app-shell.mobile-sidebar-open > .mobile-sidebar-toggle {
    color: #f0ede8;
    background: rgba(42, 42, 42, 0.96);
  }

  #app-shell > .mobile-sidebar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.48);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 240ms ease, visibility 240ms ease;
    z-index: 930;
  }

  #app-shell.mobile-sidebar-open > .mobile-sidebar-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}
