/* Load after the feature styles. Desktop keeps its established layout; mobile
   Explore defaults to a comfortable two-column wall with Compact opt-in. */
.explore-density { display: none; }

@media (max-width: 780px) {
  /* The collection menu belongs below the global filter drawer, not above it. */
  .collection-more { z-index: 2; }
  /* A 16px editing size prevents iOS from zooming into otherwise tiny fields.
     Checkbox/radio/range controls retain their dedicated visual treatments. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]),
  select,
  textarea {
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    font-size: 16px !important;
  }

  .spot .spot-actions .visit,
  .spot .spot-disclosure .visit {
    min-width: 44px;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.3;
    white-space: normal;
  }

  .spot .spot-actions { gap: 8px; }
  .spot .close { width: 44px; height: 44px; }
}

@media (max-width: 680px) {
  #wallGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: clamp(224px, calc(46vw + 76px), 388px);
    gap: 10px;
  }

  #wallGrid[data-density="compact"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: clamp(186px, calc(30.67vw + 65px), 276px);
    gap: 6px;
  }

  #explore .explore-context {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  #explore .wall-tools {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
  }

  #explore .active-discovery-filters {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .explore-density {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid #d3dfd4;
    border-radius: 12px;
    background: #f2f5ed;
  }

  .explore-density button {
    min-width: 44px;
    min-height: 44px;
    padding: 8px 11px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: #52665a;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
  }

  .explore-density button[aria-pressed="true"] {
    border-color: #c3d2c2;
    background: #fffefa;
    color: #143e2d;
    box-shadow: 0 2px 5px rgba(18, 50, 35, .06);
  }

  .explore-density button:focus-visible {
    outline: 3px solid #446e45;
    outline-offset: 2px;
  }

  #explore .wall-tools .shuffle-btn {
    min-height: 44px;
    margin-left: auto;
    padding: 8px 10px;
    font-size: 11px;
  }

  #wallGrid .board:not(.site-board) {
    border-color: #d6dfd5;
    box-shadow: 0 3px 12px rgba(18, 50, 35, .035);
  }

  /* Let captions take their own space instead of covering the photograph.
     Existing uploaded artwork keeps its full proportions at either density. */
  .grid .board:not(.site-board):not(.empty) {
    display: flex;
    flex-direction: column;
  }

  .grid .board:not(.site-board):not(.empty) .creative {
    position: relative;
    inset: auto;
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    padding: 8px;
  }

  .grid .board.media-card:not(.site-board) .creative { padding: 0; }
  /* Legacy portrait rules used intrinsic image height. Anchor media to the
     measured flex frame so contain can display the entire upload. */
  .grid .board.media-card:not(.site-board) .creative .creative-media {
    position: absolute !important;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    max-height: 100%;
    min-height: 0;
    object-fit: contain !important;
    background: #f7f6f1;
  }

  .grid .board:not(.site-board) .board-identity {
    position: relative;
    inset: auto;
    flex: 0 0 auto;
    width: 100%;
    margin-top: auto;
    gap: 3px;
    padding: 5px;
    background: #fffefa;
  }

  .grid .board:not(.site-board) .board-identity-main { align-items: flex-start; gap: 4px; }
  .grid .board:not(.site-board) .board-identity-main > .brand-mark {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
  }

  .grid .board:not(.site-board) .board-company {
    letter-spacing: normal;
    text-transform: none;
    opacity: 1;
  }

  .grid .board:not(.site-board) .board-company strong {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
    white-space: normal;
    color: #123e31;
    font-size: 11px;
    line-height: 1.25;
  }

  .grid .board:not(.site-board) .board-service-area {
    padding-left: 0;
    color: #52635a;
    font-size: 10px !important;
    line-height: 1.25 !important;
  }

  /* An available space needs one legible promise and one usable action, not
     a miniature second sales pitch. Full Boost details stay on the buy page. */
  .grid .board.empty .offer-strip {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 0;
    gap: 5px;
    padding: 6px;
  }
  .grid .board.empty .offer-strip b { font-size: 11px; line-height: 1.25; }
  .grid .board.empty .offer-strip span { display: none; }
  .grid .board.empty .empty-buy {
    min-width: 44px;
    min-height: 44px !important;
    width: 100%;
    padding: 9px 4px !important;
    font-size: 12px;
    line-height: 1.25;
  }
  .grid .board.empty .creative { bottom: 104px; padding: 8px 7px; justify-content: center; }
  .grid .board.empty .board-icon { display: none; }

  #wallGrid:not([data-density="compact"]) .board:not(.site-board) .board-identity {
    gap: 5px;
    padding: 9px;
  }

  #wallGrid:not([data-density="compact"]) .board-identity-main > .brand-mark {
    width: 22px;
    height: 22px;
    flex-basis: 22px;
  }

  #wallGrid:not([data-density="compact"]) .board-company strong {
    font-size: 13px;
    line-height: 1.3;
  }

  #wallGrid:not([data-density="compact"]) .board-service-area {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    white-space: normal;
    font-size: 11px !important;
    line-height: 1.35 !important;
  }

  #wallGrid:not([data-density="compact"]) .empty h2 {
    font-size: 17px;
    line-height: 1.15;
  }

  #wallGrid:not([data-density="compact"]) .board-unverified {
    width: fit-content;
    padding: 3px 5px;
    font-size: .75rem;
    box-shadow: none;
  }

  #wallGrid[data-density="compact"] .board-unverified {
    width: fit-content;
    padding: 3px 4px;
    font-size: .75rem;
  }

  #wallGrid:not([data-density="compact"]) .board-event-time {
    font-size: 8px;
    padding: 4px 6px;
  }
}
