/* Oreo Atlas Viewer UX/Performance V1 candidate-only overrides. */
@media (max-width: 640px) {
  /* Keep the map in the viewport instead of limiting it to 55dvh and leaving
     a large blank region below it. The image library remains an overlay. */
  .workspace {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    height: calc(100dvh - 52px) !important;
    min-height: 0 !important;
    overflow: hidden;
  }
  .workspace > .map-section {
    grid-column: 1;
    grid-row: 1;
    order: initial;
    height: auto !important;
    min-height: 0 !important;
  }
  .workspace > .library {
    order: initial;
  }

  /* Touch targets: map rail controls, layer labels and close button. */
  .map-tool-rail .minimal-icon-button {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    touch-action: manipulation;
  }
  .layer-panel .layer-heading button,
  .terrain-panel .terrain-heading button,
  #measure-panel .measure-heading button {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    display: inline-grid;
    place-items: center;
    touch-action: manipulation;
  }
  .layer-panel label.layer-item {
    min-height: 44px !important;
    padding: 8px 6px !important;
    gap: 11px !important;
    touch-action: manipulation;
  }
  .layer-panel label.layer-item input[type="checkbox"] {
    width: 20px !important;
    height: 20px !important;
    flex: 0 0 20px;
  }
  .layer-panel input[type="range"] {
    min-height: 32px;
    touch-action: pan-x;
  }
}

@media (max-width: 380px) {
  /* Override the older 35px rail sizing on narrow phones. */
  .map-tool-rail .minimal-icon-button {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
  }
}
