@import url("/assets/map-shell-v2.css");
@import url("/assets/display-mode.css");

:root {
  --city-shell-detail-width: 360px;
  --city-shell-touch-target: 44px;
  --city-shell-header-height: 52px;
}

.city-shell {
  min-height: 100dvh;
}

.city-shell .map-topbar {
  min-height: var(--city-shell-header-height);
}

.city-shell .map-topbar,
.city-shell .map-controls {
  max-width: none;
}

.city-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.city-heading {
  display: grid;
  gap: 1px;
}

.city-heading strong {
  color: #fff;
  font-size: 0.98rem;
  line-height: 1.2;
}

.city-heading span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.74rem;
  line-height: 1.2;
}

.city-switcher {
  display: flex;
  align-items: center;
  gap: 7px;
}

.city-topbar-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.city-switcher label {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.city-switcher select {
  min-height: 36px;
  max-width: 150px;
  padding: 6px 30px 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  color: var(--canopy-dark);
  background: #fff;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
}

.city-shell .workspace-v2 {
  grid-template-columns: minmax(0, 1fr) var(--city-shell-detail-width);
}

.city-shell .map-controls {
  grid-template-columns: minmax(240px, 1.2fr) minmax(190px, 0.72fr) minmax(170px, 0.62fr) auto;
}

.city-shell .map-controls.without-parts {
  grid-template-columns: minmax(260px, 1.3fr) minmax(210px, 0.78fr) minmax(150px, auto) auto;
}

.city-shell .map-controls.without-categories {
  grid-template-columns: minmax(260px, 1.3fr) minmax(210px, 0.78fr) auto;
}

.city-shell .map-controls.without-scan {
  grid-template-columns: minmax(300px, 1.3fr) minmax(210px, 0.78fr) minmax(170px, 0.62fr) auto;
}

.city-shell .control-button,
.city-shell .field input,
.city-shell .field select,
.city-shell .chip-btn {
  min-height: var(--city-shell-touch-target);
}

.city-shell .search-input-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.city-shell .search-input-row input {
  min-width: 0;
  flex: 1 1 auto;
}

.city-shell .search-submit-button {
  flex: 0 0 auto;
  min-height: var(--city-shell-touch-target);
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 8px;
  color: #fff;
  background: #184025;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.city-shell .leaflet-control-layers-toggle {
  width: 36px;
  height: 36px;
}

.mobile-menu-button {
  display: none;
}

.mobile-filter-toggle {
  display: none;
}

.mobile-map-nearby-button,
.mobile-map-protected-button {
  display: none;
}

.city-service-panel {
  gap: 12px;
}

.service-primary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.service-primary-actions button {
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #1a5c2a;
  border-radius: 8px;
  color: #fff;
  background: #1a5c2a;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.service-primary-actions button + button {
  color: #144821;
  background: #e8f5e9;
}

.city-service-list {
  display: grid;
  border-top: 1px solid #d7e1d8;
}

.city-service-list a {
  min-height: 62px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 10px 2px;
  border-bottom: 1px solid #e6eee8;
  color: #144821;
  text-decoration: none;
}

.city-service-list a:hover,
.city-service-list a:focus-visible {
  padding-left: 8px;
  background: #f2f8f3;
}

.city-service-list strong {
  font-size: 0.96rem;
}

.city-service-list span,
.service-data-note {
  color: #52655b;
  font-size: 0.78rem;
  line-height: 1.45;
}

.service-data-note {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid #a9cdb0;
  background: #f7fbf8;
}

.service-source-details {
  border-top: 1px solid #d7e1d8;
  color: #52655b;
  font-size: 0.8rem;
}

.service-source-details summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  color: #245941;
  font-weight: 900;
  cursor: pointer;
}

.service-source-details dl {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0 0 8px;
}

.service-source-details dl div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
}

.service-source-details dt {
  font-weight: 900;
}

.service-source-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (min-width: 1024px) {
  .city-shell[data-shell-mode="city"] .map-topbar {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .city-shell[data-shell-mode="city"] .map-nav {
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .city-shell[data-shell-mode="city"] .map-nav::-webkit-scrollbar {
    display: none;
  }

  .city-shell[data-shell-mode="city"] .map-nav .nav-secondary {
    display: none;
  }

  .city-shell[data-shell-mode="city"] .dataset-field,
  .city-shell[data-shell-mode="city"] .citizen-shortcuts {
    display: none;
  }

  .city-shell[data-shell-mode="city"] .map-controls,
  .city-shell[data-shell-mode="city"] .map-controls.without-parts,
  .city-shell[data-shell-mode="city"] .map-controls.without-categories,
  .city-shell[data-shell-mode="city"] .map-controls.without-scan {
    grid-template-columns: minmax(360px, 1.4fr) minmax(170px, 0.7fr) auto auto;
    padding-top: 7px;
    padding-bottom: 8px;
  }

  .city-shell[data-shell-mode="city"] .map-controls.without-parts {
    grid-template-columns: minmax(420px, 1fr) auto auto;
  }

  .city-shell[data-shell-mode="city"] .field label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .city-shell[data-shell-mode="city"] .data-bar {
    min-height: 34px;
    flex-wrap: nowrap;
    padding-top: 4px;
    padding-bottom: 4px;
    overflow: hidden;
  }

  .city-shell[data-shell-mode="city"] .data-caveat {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.city-shell-error {
  width: min(720px, calc(100% - 32px));
  margin: 48px auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--warn);
  background: var(--paper);
}

/* Replaced by the manifest-driven shared guide rendered by city-shell.js. */
body > .city-context {
  display: none;
}

.ecological-context {
  padding: 38px clamp(18px, 5vw, 64px) 42px;
  border-top: 1px solid #d7e1d8;
  color: #263a30;
  background: #eef5ef;
}

.ecological-context-inner {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 38px;
}

.ecological-context-kicker {
  margin: 0 0 6px;
  color: #8b4f35;
  font-size: 0.78rem;
  font-weight: 900;
}

.ecological-context h2,
.ecological-context h3 {
  margin: 0 0 9px;
  color: #16392c;
  letter-spacing: 0;
}

.ecological-context h2 { font-size: 1.45rem; }
.ecological-context h3 { font-size: 1rem; }

.ecological-context p {
  margin: 0;
  color: #52655b;
  line-height: 1.7;
}

.ecological-context-links {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.ecological-context a {
  color: #1a5c2a;
  font-weight: 800;
}

.service-footer-link {
  padding: 30px clamp(18px, 5vw, 64px);
  border-top: 1px solid #d7e1d8;
  color: #263a30;
  background: #fff;
}

.service-footer-link-inner {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.service-footer-link p {
  margin: 0;
  color: #52655b;
  line-height: 1.65;
}

.service-footer-link strong {
  display: block;
  margin-bottom: 4px;
  color: #16392c;
  font-size: 1.08rem;
}

.service-footer-link a {
  flex: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: 1px solid #245941;
  border-radius: 8px;
  color: #fff;
  background: #245941;
  font-weight: 900;
  text-decoration: none;
}

@media (max-width: 1023px) {
  .city-shell .workspace-v2 {
    display: block;
  }

  .city-shell #map {
    height: 56vh;
    min-height: 440px;
  }

  .city-shell .detail-panel {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    max-height: none;
    border-top: 1px solid var(--line);
    border-left: 0;
    border-radius: 0;
    box-shadow: none;
    transform: none;
  }

  .city-shell .detail-inner::before {
    display: none;
  }
}

@media (max-width: 640px) {
  .service-footer-link-inner {
    display: grid;
    gap: 14px;
  }

  .service-footer-link a {
    width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 760px) {
  .city-shell[data-shell-mode="city"] {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--mint);
  }

  .city-shell[data-shell-mode="city"] .map-topbar {
    order: 1;
    position: relative;
    min-height: 0;
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 20px 12px;
    background: var(--canopy);
  }

  .city-shell[data-shell-mode="city"] .city-identity {
    width: auto;
    flex: 1 1 auto;
    align-items: center;
    gap: 10px;
  }

  .city-shell[data-shell-mode="city"] .brand {
    min-width: 180px;
    flex: 1 1 auto;
    gap: 10px;
  }

  .city-shell[data-shell-mode="city"] .brand-logo {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
    border-radius: 8px;
  }

  .city-shell[data-shell-mode="city"] .city-heading {
    display: block;
  }

  .city-shell[data-shell-mode="city"] .city-heading strong {
    font-size: 1.22rem;
    line-height: 1.2;
    white-space: nowrap;
  }

  .city-shell[data-shell-mode="city"] .city-heading span {
    display: none;
  }

  .city-shell[data-shell-mode="city"] .city-topbar-tools {
    position: absolute;
    top: calc(100% - 4px);
    left: 12px;
    right: 12px;
    z-index: 910;
    display: none;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 8px;
    background: #10451f;
    box-shadow: 0 18px 38px rgba(15, 49, 28, 0.28);
  }

  .city-shell[data-shell-mode="city"] .map-topbar.is-menu-open .city-topbar-tools {
    display: grid;
  }

  .city-shell[data-shell-mode="city"] .city-switcher,
  .city-shell[data-shell-mode="city"] .display-mode-switcher {
    width: 100%;
    justify-content: flex-start;
  }

  .city-shell[data-shell-mode="city"] .city-switcher select {
    width: 100%;
    max-width: none;
    min-height: 42px;
    border-radius: 8px;
    font-size: 1rem;
  }

  .city-shell[data-shell-mode="city"] .display-mode-switcher span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .city-shell[data-shell-mode="city"] .display-mode-options {
    gap: 0;
    padding: 1px;
    border-color: rgba(255, 255, 255, 0.42);
    border-radius: 8px;
  }

  .city-shell[data-shell-mode="city"] .display-mode-button {
    min-height: 42px;
    padding: 0 9px;
    font-size: 0.88rem;
  }

  .city-shell[data-shell-mode="city"] .mobile-menu-button {
    flex: 0 0 52px;
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.42);
    border-radius: 12px;
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    font: inherit;
    font-size: 1.7rem;
    font-weight: 900;
    line-height: 1;
  }

  .city-shell[data-shell-mode="city"] .map-nav {
    position: absolute;
    top: calc(100% + 116px);
    left: 12px;
    right: 12px;
    z-index: 900;
    width: auto;
    max-height: min(58dvh, 420px);
    display: none;
    grid-template-columns: 1fr;
    gap: 6px;
    overflow: auto;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 8px;
    background: #10451f;
    box-shadow: 0 18px 38px rgba(15, 49, 28, 0.28);
  }

  .city-shell[data-shell-mode="city"] .map-nav.is-open {
    display: grid;
  }

  .city-shell[data-shell-mode="city"] .map-nav a {
    min-height: 42px;
    justify-content: flex-start;
    border-radius: 8px;
    font-size: 1rem;
  }

  .city-shell[data-shell-mode="city"] .map-controls,
  .city-shell[data-shell-mode="city"] .map-controls.without-parts,
  .city-shell[data-shell-mode="city"] .map-controls.without-categories {
    order: 2;
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 108px;
    gap: 8px 12px;
    padding: 8px 20px 10px;
    background: var(--canopy);
    box-shadow: none;
  }

  .city-shell[data-shell-mode="city"] .search-field {
    grid-column: 1;
  }

  .city-shell[data-shell-mode="city"] .map-controls.without-scan {
    grid-template-columns: minmax(0, 1fr);
  }

  .city-shell[data-shell-mode="city"] .map-controls.without-scan .search-field {
    grid-column: 1 / -1;
  }

  .city-shell[data-shell-mode="city"] .scan-button {
    grid-column: 2;
    align-self: end;
    min-height: 56px;
    border: 2px solid rgba(255, 255, 255, 0.64);
    border-radius: 10px;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    font-size: 1.08rem;
  }

  .city-shell[data-shell-mode="city"] .field label {
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.92rem;
  }

  .city-shell[data-shell-mode="city"] .search-field label,
  .city-shell[data-shell-mode="city"] .map-controls > .field:not(.search-field) label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .city-shell[data-shell-mode="city"] .field input,
  .city-shell[data-shell-mode="city"] .field select {
    min-height: 56px;
    border-radius: 10px;
    font-size: 1.08rem;
  }

  .city-shell[data-shell-mode="city"] .map-controls > .field:not(.search-field) {
    grid-column: 1 / -1;
  }

  .city-shell[data-shell-mode="city"] .dataset-field {
    display: none;
  }

  .city-shell[data-shell-mode="city"] .part-field {
    grid-column: 1 / -1;
    order: 5;
    display: none;
  }

  .city-shell[data-shell-mode="city"] .part-field.is-open {
    display: grid;
  }

  .city-shell[data-shell-mode="city"] .mobile-filter-toggle {
    grid-column: 1 / -1;
    order: 4;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    color: #fff;
    background: transparent;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 900;
  }

  .city-shell[data-shell-mode="city"] .part-field select {
    min-height: 46px;
    font-size: 1rem;
  }

  .city-shell[data-shell-mode="city"] .quick-chips {
    grid-column: 1 / -1;
    order: 3;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0 0 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .city-shell[data-shell-mode="city"] .quick-chips::-webkit-scrollbar {
    display: none;
  }

  .city-shell[data-shell-mode="city"] .chip-btn {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 5px 15px;
    border-color: rgba(255, 255, 255, 0.56);
    color: rgba(255, 255, 255, 0.9);
    background: transparent;
    font-size: 1rem;
  }

  .city-shell[data-shell-mode="city"] .chip-btn.active {
    border-color: #9edfb0;
    color: #10451f;
    background: #9edfb0;
  }

  .city-shell[data-shell-mode="city"] .control-actions {
    display: none;
  }

  .city-shell[data-shell-mode="city"] .data-bar {
    order: 3;
    min-height: 38px;
    padding: 7px 20px;
    background: #f7fbf8;
  }

  .city-shell[data-shell-mode="city"] .data-caveat {
    display: inline;
    min-width: 0;
  }

  .city-shell[data-shell-mode="city"] .workspace-v2 {
    order: 4;
    display: block;
  }

  .city-shell[data-shell-mode="city"] #map {
    height: min(55dvh, 520px);
    min-height: 380px;
  }

  .city-shell[data-shell-mode="city"] .map-status {
    bottom: 84px;
    max-width: calc(100% - 28px);
  }

  .city-shell[data-shell-mode="city"].has-protected-shortcut .map-status {
    bottom: 146px;
  }

  .city-shell[data-shell-mode="city"] .mobile-map-nearby-button,
  .city-shell[data-shell-mode="city"] .mobile-map-protected-button {
    position: absolute;
    right: 18px;
    z-index: 650;
    min-height: 54px;
    max-width: calc(100% - 36px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 17px;
    border: 1px solid rgba(138, 86, 17, 0.24);
    border-radius: 999px;
    color: #184025;
    background: #f4aa22;
    box-shadow: 0 14px 30px rgba(95, 58, 10, 0.28);
    font: inherit;
    font-weight: 900;
    cursor: pointer;
  }

  .city-shell[data-shell-mode="city"] .mobile-map-nearby-button {
    bottom: 18px;
  }

  .city-shell[data-shell-mode="city"] .mobile-map-protected-button {
    bottom: 82px;
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff;
    background: #175f2b;
    box-shadow: 0 14px 30px rgba(14, 66, 29, 0.28);
  }

  .city-shell[data-shell-mode="city"] .mobile-map-nearby-button small {
    color: rgba(24, 64, 37, 0.72);
    font-size: 0.78rem;
    font-weight: 900;
  }

  .city-shell[data-shell-mode="city"] .mobile-map-nearby-button:disabled,
  .city-shell[data-shell-mode="city"] .mobile-map-protected-button:disabled {
    cursor: progress;
    opacity: 0.78;
  }

  .city-shell[data-shell-mode="city"] .citizen-shortcuts {
    order: 5;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 12px 20px 14px;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    background: #f7fbf8;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .city-shell[data-shell-mode="city"] .citizen-shortcuts::-webkit-scrollbar {
    display: none;
  }

  .city-shell[data-shell-mode="city"] .citizen-shortcut {
    flex: 0 0 190px;
    min-height: 76px;
    padding: 12px 14px;
  }

  .city-shell[data-shell-mode="city"] .citizen-shortcut strong,
  .city-shell[data-shell-mode="city"] .citizen-shortcut span {
    white-space: normal;
  }

  .city-shell[data-shell-mode="city"] .search-field {
    min-width: 0;
  }

  .city-shell[data-shell-mode="city"] .search-submit-button {
    padding: 0 13px;
  }

  .city-shell[data-shell-mode="city"] .display-mode-panel {
    order: 6;
  }

  .city-shell[data-shell-mode="city"] .city-curated {
    order: 7;
  }

  .city-shell[data-shell-mode="city"] .city-public-guide {
    order: 8;
  }

  .city-shell[data-shell-mode="city"] .ecological-context {
    order: 9;
  }

  .ecological-context-inner {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .city-identity {
    width: 100%;
    justify-content: space-between;
  }

  .city-heading span {
    display: none;
  }

  .city-switcher label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .city-switcher select {
    min-height: var(--city-shell-touch-target);
    max-width: 132px;
  }

  .city-shell .map-controls,
  .city-shell .map-controls.without-parts,
  .city-shell .map-controls.without-categories {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .city-shell .search-field,
  .city-shell .quick-chips {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .city-shell[data-shell-mode="city"] #map {
    height: min(55dvh, 520px);
    min-height: 380px;
  }

  .city-shell #map {
    height: calc(100dvh - 256px);
    min-height: 420px;
  }

  .city-shell[data-shell-mode="national"] .citizen-shortcuts {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .city-shell .detail-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    max-height: 58vh;
    overflow: auto;
    border-top: 1px solid var(--line);
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -14px 36px rgba(20, 72, 33, 0.18);
    transform: translateY(calc(100% - 64px));
    transition: transform 0.22s ease;
  }

  .city-shell .detail-panel.is-open {
    transform: translateY(0);
  }

  .city-shell .detail-panel.is-open .sheet-close {
    display: inline-flex;
  }

  .city-shell .detail-inner::before {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  .city-shell .detail-panel {
    transition: none;
  }
}
