/*
  Targeted responsive corrections for the finalized BlueGreen Guide UI.
  Loaded after ui-refresh.css so these rules resolve legacy selector conflicts.
*/

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.app-shell,
.sidebar,
.brand,
.brand-stack,
.wayfinding-key,
.wayfinding-items,
.wayfinding-item,
.collections-panel,
.collection-button,
.controls,
.field,
.results,
.launch-card,
.map-panel {
  min-width: 0;
}

img {
  max-width: 100%;
}

/*
  Older design-system rules targeted every direct span inside a Wayfinding item.
  The finalized markup has separate symbol and copy containers, so explicitly
  restore their intended sizing and remove inherited generated content.
*/
.wayfinding-item > .wayfinding-symbol::before,
.wayfinding-item > .wayfinding-copy::before {
  display: none !important;
  content: none !important;
}

.wayfinding-items {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.wayfinding-item {
  display: flex;
  min-width: 0;
  min-height: 82px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 6px;
  text-align: center;
}

.wayfinding-item > .wayfinding-symbol {
  display: grid !important;
  width: 36px !important;
  min-width: 36px !important;
  height: 36px !important;
  place-items: center !important;
  align-self: center;
  justify-self: center;
  border-width: 1px;
  background: #fff !important;
  font-size: inherit !important;
  line-height: 1;
}

.wayfinding-item > .wayfinding-copy {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  height: auto !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  color: inherit !important;
  font-size: inherit !important;
  line-height: 1.15;
  text-align: center;
}

.wayfinding-copy strong,
.wayfinding-copy small {
  width: 100%;
  margin: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
}

.wayfinding-copy strong {
  display: block;
  color: currentColor;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
}

/* The shape and color already communicate the category; hide redundant helper text. */
.wayfinding-copy small {
  display: none;
}

.wayfinding-water > .wayfinding-symbol {
  border-radius: 50% !important;
  border-color: var(--ui-blue) !important;
  color: var(--ui-blue) !important;
}

.wayfinding-land > .wayfinding-symbol {
  border-radius: 6px !important;
  border-color: var(--ui-green) !important;
  color: var(--ui-green-deep) !important;
}

.wayfinding-neutral > .wayfinding-symbol {
  border-radius: 50% !important;
  border-color: var(--ui-line) !important;
  color: var(--ui-blue-deep) !important;
}

.wayfinding-symbol .ui-icon {
  width: 20px;
  height: 20px;
}

/* Keep button icons and labels aligned as one centered control. */
.button,
.card-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  max-width: 100%;
  line-height: 1.15;
  text-align: center;
}

.button > .ui-icon,
.card-button > .ui-icon {
  width: 18px;
  min-width: 18px;
  height: 18px;
  align-self: center;
}

.button > span,
.card-button > span {
  display: block;
  min-width: 0;
  line-height: 1.15;
}

input,
select,
button {
  max-width: 100%;
}

/* Tablet and compact desktop: retain the efficient multi-column layout. */
@media (max-width: 860px) {
  .app-shell {
    width: 100%;
    max-width: 100vw;
    grid-template-columns: minmax(0, 1fr);
  }

  .brand,
  .wayfinding-key,
  .collections-panel,
  .controls,
  .result-summary,
  .results {
    width: auto;
    max-width: calc(100vw - 24px);
  }

  .brand {
    max-width: 100vw;
  }

  .map-panel {
    width: 100%;
    max-width: 100vw;
  }
}

/* Phone layout: preserve readable controls without compressing content. */
@media (max-width: 720px) {
  .wayfinding-items {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .wayfinding-item {
    min-height: 82px;
    padding: 9px 5px;
  }

  .wayfinding-copy strong {
    font-size: 10.5px;
  }

  .controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .controls .field,
  .controls .field-full,
  .controls .button,
  .controls .button-wide {
    grid-column: 1 / -1;
    width: 100%;
  }

  .button,
  .card-button {
    min-height: 46px;
  }

  .brand-logo-image {
    width: min(340px, 100%);
  }

  .map-panel {
    min-height: clamp(340px, 58dvh, 520px);
  }

  .detail-card {
    width: 100%;
    max-width: 100vw;
  }
}

@media (max-width: 420px) {
  .brand,
  .wayfinding-key,
  .collections-panel,
  .controls,
  .result-summary,
  .results {
    max-width: calc(100vw - 20px);
  }

  .wayfinding-key,
  .collections-panel,
  .controls {
    margin-right: 10px;
    margin-left: 10px;
    padding: 12px;
  }

  .brand {
    padding-right: 10px;
    padding-left: 10px;
  }

  .results {
    padding-right: 10px;
    padding-left: 10px;
  }

  .brand-logo-image {
    width: 100%;
  }

  .wayfinding-items {
    gap: 6px;
  }

  .wayfinding-item {
    min-height: 78px;
    padding: 8px 4px;
  }

  .wayfinding-item > .wayfinding-symbol {
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
  }

  .wayfinding-copy strong {
    font-size: 10px;
  }

  .launch-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .pill {
    align-self: flex-start;
  }

  .rating-row,
  .detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
