/*
Theme Name: Sheshi Responsive Surface Consistency
Version: 0.28.6
Description: Removes the legacy mobile shell frame, normalizes compact filters and keeps result metadata readable.
*/

@media (max-width: 767px) {
  /* Every mobile page uses the same edge-to-edge header. The bottom rule is
     introduced only after the header enters its scrolled state. */
  body.sheshi-home .sheshi-site-header,
  body.sheshi-shell .sheshi-site-header {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-top: 0 !important;
    border-right: 0 !important;
    border-bottom-color: transparent !important;
    border-left: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  body.sheshi-home .sheshi-site-header.is-scrolled,
  body.sheshi-shell .sheshi-site-header.is-scrolled {
    border-bottom: 1px solid var(--border) !important;
  }

  /* The filter icon previously inherited the generic responsive SVG width,
     turning the summary into a 327px square and leaving a large empty block. */
  body.sheshi-shell .sheshi-search:not(.sheshi-search-results) .sheshi-search-mobile-filters > summary {
    display: flex !important;
    width: 100% !important;
    height: auto !important;
    min-height: 44px !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 0 12px !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: 8px !important;
    color: var(--text-secondary) !important;
    background: var(--surface-card) !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    cursor: pointer;
    list-style: none;
  }

  body.sheshi-shell .sheshi-search:not(.sheshi-search-results) .sheshi-search-mobile-filters > summary::-webkit-details-marker {
    display: none;
  }

  body.sheshi-shell .sheshi-search:not(.sheshi-search-results) .sheshi-search-mobile-filters > summary svg {
    display: block !important;
    width: 18px !important;
    height: 18px !important;
    flex: 0 0 18px !important;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 1.75 !important;
    stroke-linecap: round !important;
  }

  /* Mobile result facts may wrap to a second compact line. They must never
     disappear at the card edge or enlarge the document canvas. */
  body.search.sheshi-shell .sheshi-result-card--search .sheshi-result-facts,
  body.archive.sheshi-shell .sheshi-result-card--search .sheshi-result-facts,
  body.tax-listing-category.sheshi-shell .sheshi-result-card--search .sheshi-result-facts,
  body.tax-location.sheshi-shell .sheshi-result-card--search .sheshi-result-facts {
    display: flex !important;
    max-height: none !important;
    flex-wrap: wrap !important;
    gap: 2px 8px !important;
    overflow: visible !important;
    white-space: normal !important;
    line-height: 1.35 !important;
  }

  body.search.sheshi-shell .sheshi-result-card--search .sheshi-result-facts > span,
  body.archive.sheshi-shell .sheshi-result-card--search .sheshi-result-facts > span,
  body.tax-listing-category.sheshi-shell .sheshi-result-card--search .sheshi-result-facts > span,
  body.tax-location.sheshi-shell .sheshi-result-card--search .sheshi-result-facts > span {
    display: inline-flex !important;
    max-width: 100% !important;
    flex: 0 1 auto !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
  }

  body.search.sheshi-shell .sheshi-result-card--search .sheshi-result-facts > span + span::before,
  body.archive.sheshi-shell .sheshi-result-card--search .sheshi-result-facts > span + span::before,
  body.tax-listing-category.sheshi-shell .sheshi-result-card--search .sheshi-result-facts > span + span::before,
  body.tax-location.sheshi-shell .sheshi-result-card--search .sheshi-result-facts > span + span::before {
    display: none !important;
    content: none !important;
  }

  /* The place at the end of long institution names is often the decisive
     distinction. Keep enough lines for the full title and a useful summary. */
  body.search.sheshi-shell .sheshi-result-card--search .sheshi-result-title-row h2 a,
  body.archive.sheshi-shell .sheshi-result-card--search .sheshi-result-title-row h2 a,
  body.tax-listing-category.sheshi-shell .sheshi-result-card--search .sheshi-result-title-row h2 a,
  body.tax-location.sheshi-shell .sheshi-result-card--search .sheshi-result-title-row h2 a {
    -webkit-line-clamp: 3 !important;
  }

  body.search.sheshi-shell .sheshi-result-card--search .sheshi-result-description,
  body.archive.sheshi-shell .sheshi-result-card--search .sheshi-result-description,
  body.tax-listing-category.sheshi-shell .sheshi-result-card--search .sheshi-result-description,
  body.tax-location.sheshi-shell .sheshi-result-card--search .sheshi-result-description {
    -webkit-line-clamp: 2 !important;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  /* The compact desktop row is too shallow at the tablet breakpoint. Allow
     the row and its facts to grow instead of clipping the final fact. */
  body.search.sheshi-shell .sheshi-result-card--search,
  body.archive.sheshi-shell .sheshi-result-card--search,
  body.tax-listing-category.sheshi-shell .sheshi-result-card--search,
  body.tax-location.sheshi-shell .sheshi-result-card--search {
    height: auto !important;
    min-height: 124px !important;
    overflow: visible !important;
    padding-block: 12px !important;
  }

  body.search.sheshi-shell .sheshi-result-card--search .sheshi-result-facts,
  body.archive.sheshi-shell .sheshi-result-card--search .sheshi-result-facts,
  body.tax-listing-category.sheshi-shell .sheshi-result-card--search .sheshi-result-facts,
  body.tax-location.sheshi-shell .sheshi-result-card--search .sheshi-result-facts {
    display: flex !important;
    max-height: none !important;
    flex-wrap: wrap !important;
    gap: 2px 8px !important;
    overflow: visible !important;
    white-space: normal !important;
    line-height: 1.35 !important;
  }

  body.search.sheshi-shell .sheshi-result-card--search .sheshi-result-facts > span,
  body.archive.sheshi-shell .sheshi-result-card--search .sheshi-result-facts > span,
  body.tax-listing-category.sheshi-shell .sheshi-result-card--search .sheshi-result-facts > span,
  body.tax-location.sheshi-shell .sheshi-result-card--search .sheshi-result-facts > span {
    max-width: 100% !important;
    flex: 0 1 auto !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
  }

  body.search.sheshi-shell .sheshi-result-card--search .sheshi-result-facts > span + span::before,
  body.archive.sheshi-shell .sheshi-result-card--search .sheshi-result-facts > span + span::before,
  body.tax-listing-category.sheshi-shell .sheshi-result-card--search .sheshi-result-facts > span + span::before,
  body.tax-location.sheshi-shell .sheshi-result-card--search .sheshi-result-facts > span + span::before {
    display: none !important;
    content: none !important;
  }
}
