/*
 * marnamic layout system.
 *
 * Inspired by framework systems such as Tailwind/shadcn: one fluid shell,
 * one spacing scale and a small set of explicit 12-column page contracts.
 * Component styling belongs in the component layers; this file owns only
 * page geometry, responsive spans and section rhythm.
 */

body.wp-child-theme-marnamic {
  --marnamic-layout-max: 1800px;
  --marnamic-layout-width: min(82%, var(--marnamic-layout-max));
  --marnamic-mobile-gutter: 16px;
  --marnamic-mobile-shell-width: calc(100% - 32px);
  --marnamic-reading-max: 900px;
  --marnamic-grid-columns: 12;
  --marnamic-grid-gap: clamp(18px, 1.35vw, 28px);
  --marnamic-section-gap: clamp(48px, 5vw, 88px);
  --marnamic-section-gap-sm: clamp(28px, 3vw, 48px);
}

/* One content shell. The full-width header keeps its independent geometry in
 * marnamic-header-footer.css; plugins may also use nested .container classes. */
body.wp-child-theme-marnamic :is(
  .site-content > .container,
  .site-footer > .container,
  .site-footer .container,
  #main-content > .container
) {
  box-sizing: border-box !important;
  width: var(--marnamic-layout-width) !important;
  max-width: none !important;
  margin-right: auto !important;
  margin-left: auto !important;
  padding-right: 0 !important;
  padding-left: 0 !important;
}

body.wp-child-theme-marnamic :is(.content-area, .hp-page, .page__text) {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
}

/* Shared 12-column primitive for page headers and explicit layout groups. */
body.wp-child-theme-marnamic :is(.hp-page__header, .marnamic-layout-grid) {
  display: grid !important;
  grid-template-columns: repeat(var(--marnamic-grid-columns), minmax(0, 1fr)) !important;
  column-gap: var(--marnamic-grid-gap) !important;
}

body.wp-child-theme-marnamic .hp-page__header > * {
  min-width: 0 !important;
  grid-column: 1 / -1;
}

/* Discovery controls use ten grid columns; result-page search forms are
 * promoted to the full shell immediately below. */
body.wp-child-theme-marnamic:is(.marnamic-vendor-discovery, .marnamic-archive-search-results) .hp-page__header > :is(
  .hp-form--vendor-search,
  .hp-form--listing-search,
  .marnamic-vendor-discovery__clusters
) {
  width: 100% !important;
  max-width: none !important;
  grid-column: 2 / -2;
  margin-right: 0 !important;
  margin-left: 0 !important;
}

body.wp-child-theme-marnamic.marnamic-archive-search-results .hp-page__header > :is(
  .hp-form--vendor-search,
  .hp-form--listing-search
) {
  grid-column: 1 / -1;
}

/* Homepage: every major section shares the same outer edges and grid logic. */
body.home.wp-child-theme-marnamic .page__text {
  display: grid !important;
  grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  column-gap: var(--marnamic-grid-gap) !important;
}

body.home.wp-child-theme-marnamic .page__text > * {
  min-width: 0 !important;
  grid-column: 1 / -1;
}

body.home.wp-child-theme-marnamic :is(
  .marnamic-map-hotfix__filters,
  .marnamic-home-vendor-map .map-controls
) {
  display: none !important;
}

body.home.wp-child-theme-marnamic .page__text > :is(h2, .content-title) {
  margin-top: var(--marnamic-section-gap) !important;
  margin-bottom: var(--marnamic-section-gap-sm) !important;
}

body.home.wp-child-theme-marnamic :is(.hp-listing-categories, .hp-listings) {
  width: 100% !important;
  max-width: none !important;
  margin-right: 0 !important;
  margin-left: 0 !important;
}

body.home.wp-child-theme-marnamic .hp-listing-categories > .hp-row,
body.home.wp-child-theme-marnamic .hp-listings > .hp-row {
  display: grid !important;
  width: 100% !important;
  margin: 0 !important;
  gap: var(--marnamic-grid-gap) !important;
  align-items: stretch !important;
}

body.home.wp-child-theme-marnamic :is(.hp-listing-categories, .hp-listings) > .hp-row > :is(.hp-grid__item, [class*="hp-col-"]) {
  display: flex !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  flex: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.home.wp-child-theme-marnamic .hp-listing-category--view-block {
  width: 100% !important;
  min-height: 0 !important;
  aspect-ratio: 16 / 10 !important;
}

/* Standard HivePress pages: 4/8 or 8/4 according to semantic source order. */
body.wp-child-theme-marnamic:is(
  .hp-template--listings-view-page,
  .hp-template--listing-view-page,
  .hp-template--vendor-view-page
) .hp-page > .hp-row {
  display: grid !important;
  width: 100% !important;
  grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  gap: var(--marnamic-grid-gap) !important;
  align-items: start !important;
  margin: 0 !important;
}

body.wp-child-theme-marnamic.hp-template--listings-view-page .hp-page > .hp-row > .hp-page__sidebar,
body.wp-child-theme-marnamic.hp-template--vendor-view-page .hp-page > .hp-row > .hp-page__sidebar {
  grid-column: span 4;
}

body.wp-child-theme-marnamic.hp-template--listings-view-page .hp-page > .hp-row > .hp-page__content,
body.wp-child-theme-marnamic.hp-template--vendor-view-page .hp-page > .hp-row > .hp-page__content {
  grid-column: span 8;
}

body.wp-child-theme-marnamic.hp-template--listing-view-page .hp-page > .hp-row > .hp-page__content {
  grid-column: span 8;
}

body.wp-child-theme-marnamic.hp-template--listing-view-page .hp-page > .hp-row > .hp-page__sidebar {
  grid-column: span 4;
}

body.wp-child-theme-marnamic:is(
  .hp-template--listings-view-page,
  .hp-template--listing-view-page,
  .hp-template--vendor-view-page
) .hp-page > .hp-row > :is(.hp-page__content, .hp-page__sidebar) {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  flex: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* HivePress stores the WordPress block's column setting in hp-col-sm-*.
 * Keep CSS Grid for equal gaps and card heights, but derive its column count
 * from that setting instead of replacing it with an automatic card minimum. */
body.wp-child-theme-marnamic :is(.hp-vendors, .hp-listings, .hp-listing-categories) > .hp-row {
  display: grid !important;
  width: 100% !important;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)) !important;
  gap: var(--marnamic-grid-gap) !important;
  align-items: stretch !important;
  margin: 0 !important;
}

body.wp-child-theme-marnamic :is(.hp-vendors, .hp-listings, .hp-listing-categories) > .hp-row:has(> .hp-col-sm-12) {
  grid-template-columns: minmax(0, 1fr) !important;
}

body.wp-child-theme-marnamic :is(.hp-vendors, .hp-listings, .hp-listing-categories) > .hp-row:has(> .hp-col-sm-6) {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

body.wp-child-theme-marnamic :is(.hp-vendors, .hp-listings, .hp-listing-categories) > .hp-row:has(> .hp-col-sm-4) {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

body.wp-child-theme-marnamic :is(.hp-vendors, .hp-listings, .hp-listing-categories) > .hp-row:has(> .hp-col-sm-3) {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

body.wp-child-theme-marnamic :is(.hp-vendors, .hp-listings, .hp-listing-categories) > .hp-row > :is(.hp-grid__item, [class*="hp-col-"]) {
  display: flex !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  flex: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Akteur discovery: stable equal-height cards with content-safe internals. */
body.wp-child-theme-marnamic.marnamic-vendor-discovery .hp-vendors > .hp-row {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr)) !important;
}

body.wp-child-theme-marnamic.marnamic-vendor-discovery .hp-vendor--view-block.marnamic-card {
  height: 100% !important;
  min-height: 400px !important;
  max-height: none !important;
}

body.wp-child-theme-marnamic.marnamic-vendor-discovery .hp-vendor--view-block.marnamic-card .hp-vendor__image {
  height: 150px !important;
  min-height: 150px !important;
  max-height: 150px !important;
}

body.wp-child-theme-marnamic.marnamic-vendor-discovery .hp-vendor--view-block.marnamic-card .hp-vendor__content {
  min-height: 0 !important;
  flex: 1 1 auto !important;
  overflow: visible !important;
}

body.wp-child-theme-marnamic .marnamic-card__tags > :nth-child(n + 3) {
  display: none !important;
}

body.wp-child-theme-marnamic.marnamic-archive-search-results .hp-page > .hp-row {
  display: grid !important;
  width: 100% !important;
  grid-template-columns: 1fr !important;
  gap: var(--marnamic-grid-gap) !important;
  align-items: start !important;
  margin: 0 !important;
}

body.wp-child-theme-marnamic.marnamic-archive-search-results .hp-page > .hp-row > :is(.hp-page__content, .hp-page__sidebar) {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.wp-child-theme-marnamic.marnamic-archive-search-results .marnamic-map-hotfix--archive {
  width: 100% !important;
  height: clamp(360px, 62vw, 520px) !important;
  min-height: 360px !important;
  overflow: hidden !important;
}

body.wp-child-theme-marnamic.marnamic-archive-search-results .marnamic-map-hotfix--archive > [id^="marnamic-hotfix-map-"] {
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
}

/* Search results: the one sanctioned split-view contract. */
@media (min-width: 1180px) {
  body.wp-child-theme-marnamic.marnamic-archive-search-results .hp-page > .hp-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: var(--marnamic-grid-gap) !important;
    align-items: start !important;
  }

  body.wp-child-theme-marnamic.marnamic-archive-search-results .hp-page > .hp-row > .hp-page__content,
  body.wp-child-theme-marnamic.marnamic-archive-search-results .hp-page > .hp-row > .hp-page__sidebar {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    grid-column: auto !important;
  }

  body.wp-child-theme-marnamic.marnamic-archive-search-results .hp-page__content :is(.hp-vendors, .hp-listings) > .hp-row {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)) !important;
    gap: clamp(16px, 1.1vw, 22px) !important;
  }

  body.wp-child-theme-marnamic.marnamic-archive-search-results .hp-page > .hp-row > .hp-page__sidebar {
    position: sticky !important;
    top: var(--marnamic-archive-sticky-offset, 116px) !important;
    height: clamp(420px, calc(100dvh - var(--marnamic-archive-sticky-offset, 116px) - 32px), 680px) !important;
    max-height: 680px !important;
  }

  body.wp-child-theme-marnamic.marnamic-archive-search-results .marnamic-map-hotfix--archive {
    width: 100% !important;
    height: clamp(420px, calc(100dvh - var(--marnamic-archive-sticky-offset, 116px) - 32px), 680px) !important;
    min-height: 420px !important;
    max-height: 680px !important;
    overflow: hidden !important;
  }

  body.wp-child-theme-marnamic.marnamic-archive-search-results .marnamic-map-hotfix--archive > [id^="marnamic-hotfix-map-"] {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: none !important;
  }
}

@media (min-width: 1536px) {
  body.wp-child-theme-marnamic.marnamic-archive-search-results .hp-page > .hp-row {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr) !important;
  }
}

/* Blog archive: use the full shell and the same card minimum as other grids. */
body.blog.wp-child-theme-marnamic .site-content > .container > .row {
  display: grid !important;
  grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  gap: var(--marnamic-grid-gap) !important;
  margin: 0 !important;
}

body.blog.wp-child-theme-marnamic .site-content > .container > .row > main {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  grid-column: span 8;
  margin: 0 !important;
  padding: 0 !important;
}

body.blog.wp-child-theme-marnamic .posts {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: var(--marnamic-grid-gap) !important;
  width: 100% !important;
}

body.blog.wp-child-theme-marnamic .posts > .post {
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
}

/* Editorial singles: full-width hero may remain, copy stays on an 8-column reading line. */
body.single-post.wp-child-theme-marnamic .site-content main,
body.single-post.wp-child-theme-marnamic .post--single .post__text {
  width: 100% !important;
  max-width: var(--marnamic-reading-max) !important;
  margin-right: auto !important;
  margin-left: auto !important;
}

/* Glossary plugin output joins the same shell; only prose uses the reading line. */
body.wp-child-theme-marnamic .glossary-index-page {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  margin-right: 0 !important;
  margin-left: 0 !important;
}

body.wp-child-theme-marnamic .glossary-index-page > :is(p, ul) {
  max-width: var(--marnamic-reading-max) !important;
}

body.wp-child-theme-marnamic .glossary-index-page .index-item-preview ul {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)) !important;
  gap: clamp(10px, 1vw, 16px) !important;
}

/* Glossary detail pages use the established 1120px card contract. The ID
 * selectors intentionally outrank the shared shell's :is() specificity while
 * remaining isolated to single glossary entries. */
body.wp-child-theme-marnamic.single-glossary #content.site-content > .container,
body.wp-child-theme-marnamic.single-glossary .site-content #main-content > .container {
  width: min(100%, 1120px) !important;
  max-width: calc(100vw - 32px) !important;
}

body.wp-child-theme-marnamic.single-glossary article.glossary {
  width: 100% !important;
  max-width: 1120px !important;
}

/* Glossary categories use the same 1120px stacked-card shell as term pages. */
body.wp-child-theme-marnamic.tax-glossary-cat .site-content #main-content > .container {
  width: min(100%, 1120px) !important;
  max-width: calc(100vw - 32px) !important;
}

body.wp-child-theme-marnamic.tax-glossary-cat article.glossary {
  width: 100% !important;
  max-width: 1120px !important;
}

@media (max-width: 1179px) {
  body.wp-child-theme-marnamic {
    --marnamic-layout-width: min(92%, var(--marnamic-layout-max));
  }

  body.wp-child-theme-marnamic:is(
    .hp-template--listings-view-page,
    .hp-template--listing-view-page,
    .hp-template--vendor-view-page,
    .marnamic-archive-search-results
  ) .hp-page > .hp-row {
    grid-template-columns: 1fr !important;
  }

  body.wp-child-theme-marnamic:is(
    .hp-template--listings-view-page,
    .hp-template--listing-view-page,
    .hp-template--vendor-view-page,
    .marnamic-archive-search-results
  ) .hp-page > .hp-row > :is(.hp-page__content, .hp-page__sidebar) {
    width: 100% !important;
    grid-column: 1 !important;
  }
}

@media (max-width: 760px) {
  body.wp-child-theme-marnamic {
    --marnamic-layout-width: var(--marnamic-mobile-shell-width);
    --marnamic-grid-gap: 16px;
    --marnamic-section-gap: 48px;
    --marnamic-section-gap-sm: 24px;
  }

  body.wp-child-theme-marnamic:is(.marnamic-vendor-discovery, .marnamic-archive-search-results) .hp-page__header > :is(
    .hp-form--vendor-search,
    .hp-form--listing-search,
    .marnamic-vendor-discovery__clusters
  ) {
    grid-column: 1 / -1;
  }

  body.home.wp-child-theme-marnamic .hp-listing-categories > .hp-row,
  body.home.wp-child-theme-marnamic .hp-listings > .hp-row,
  body.wp-child-theme-marnamic :is(.hp-vendors, .hp-listings) > .hp-row,
  body.blog.wp-child-theme-marnamic .posts {
    grid-template-columns: 1fr !important;
  }

  body.home.wp-child-theme-marnamic .hp-listing-category--view-block {
    aspect-ratio: 16 / 9 !important;
  }

  body.wp-child-theme-marnamic:is(
    .hp-template--listings-view-page,
    .hp-template--listing-view-page,
    .hp-template--vendor-view-page
  ) .hp-page > .hp-row {
    gap: 24px !important;
  }

  body.wp-child-theme-marnamic:is(
    .hp-template--listings-view-page,
    .hp-template--listing-view-page,
    .hp-template--vendor-view-page
  ) .hp-page > .hp-row > :is(.hp-page__content, .hp-page__sidebar) {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.wp-child-theme-marnamic.marnamic-vendor-discovery .hp-vendor--view-block.marnamic-card {
    height: auto !important;
    min-height: 410px !important;
    max-height: none !important;
  }

  body.wp-child-theme-marnamic .glossary-index-page .index-item {
    grid-template-columns: 1fr !important;
  }
}

/*
 * Final containment guards.
 * Older archive layers intentionally use a duplicated body class. Match that
 * specificity here so the central shell remains the final geometry owner.
 */
body.wp-child-theme-marnamic.wp-child-theme-marnamic:is(.marnamic-vendor-discovery, .marnamic-archive-search-results) :is(
  .content-area,
  .hp-page,
  .hp-page > .hp-row
) {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin-right: 0 !important;
  margin-left: 0 !important;
}

body.wp-child-theme-marnamic.wp-child-theme-marnamic:is(.marnamic-vendor-discovery, .marnamic-archive-search-results) .site-content > .container {
  width: var(--marnamic-layout-width) !important;
  max-width: none !important;
  margin-right: auto !important;
  margin-left: auto !important;
  padding-right: 0 !important;
  padding-left: 0 !important;
}

body.wp-child-theme-marnamic.wp-child-theme-marnamic.marnamic-vendor-discovery .hp-page > .hp-row > .hp-page__content {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  flex: 0 0 100% !important;
  margin: 0 !important;
  padding-right: 0 !important;
  padding-left: 0 !important;
}

/* The news overview keeps the native WordPress sidebar in the shared 8/4 grid. */
body.blog.wp-child-theme-marnamic .site-content > .container > .row > .site-sidebar {
  display: block !important;
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  grid-column: span 4;
  margin: 0 !important;
  padding: 0 !important;
}

body.blog.wp-child-theme-marnamic .site-content > .container > .row > main {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

@media (max-width: 980px) {
  body.blog.wp-child-theme-marnamic .site-content > .container > .row > :is(main, .site-sidebar) {
    width: 100% !important;
    max-width: 100% !important;
    grid-column: 1 / -1;
  }
}

@media (max-width: 1179px) {
  body.wp-child-theme-marnamic.wp-child-theme-marnamic.marnamic-archive-search-results .hp-page > .hp-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 24px !important;
  }

  body.wp-child-theme-marnamic.wp-child-theme-marnamic.marnamic-archive-search-results .hp-page > .hp-row > .hp-page__content,
  body.wp-child-theme-marnamic.wp-child-theme-marnamic.marnamic-archive-search-results .hp-page > .hp-row > .hp-page__sidebar {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    flex: none !important;
    grid-column: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.wp-child-theme-marnamic.wp-child-theme-marnamic.marnamic-archive-search-results .hp-page > .hp-row > .hp-page__sidebar {
    position: static !important;
    order: 1 !important;
    height: auto !important;
    max-height: none !important;
  }

  body.wp-child-theme-marnamic.wp-child-theme-marnamic.marnamic-archive-search-results .hp-page > .hp-row > .hp-page__content {
    order: 2 !important;
  }

  body.wp-child-theme-marnamic.wp-child-theme-marnamic.marnamic-archive-search-results .marnamic-map-hotfix--archive,
  body.wp-child-theme-marnamic.wp-child-theme-marnamic.marnamic-archive-search-results .marnamic-map-hotfix--archive > [id^="marnamic-hotfix-map-"] {
    width: 100% !important;
    height: clamp(420px, 46vw, 520px) !important;
    min-height: 420px !important;
    max-height: 520px !important;
  }
}

@media (min-width: 1180px) {
  body.wp-child-theme-marnamic.wp-child-theme-marnamic.marnamic-archive-search-results .hp-page > .hp-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: var(--marnamic-grid-gap) !important;
  }

  body.wp-child-theme-marnamic.wp-child-theme-marnamic.marnamic-archive-search-results .hp-page > .hp-row > .hp-page__content,
  body.wp-child-theme-marnamic.wp-child-theme-marnamic.marnamic-archive-search-results .hp-page > .hp-row > .hp-page__sidebar {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    flex: none !important;
    grid-column: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.wp-child-theme-marnamic.wp-child-theme-marnamic.marnamic-archive-search-results .hp-page > .hp-row > .hp-page__sidebar {
    position: sticky !important;
    top: var(--marnamic-archive-sticky-offset, 116px) !important;
    height: clamp(420px, calc(100dvh - var(--marnamic-archive-sticky-offset, 116px) - 32px), 680px) !important;
    max-height: 680px !important;
  }

  body.wp-child-theme-marnamic.wp-child-theme-marnamic.marnamic-archive-search-results .marnamic-map-hotfix--archive,
  body.wp-child-theme-marnamic.wp-child-theme-marnamic.marnamic-archive-search-results .marnamic-map-hotfix--archive > [id^="marnamic-hotfix-map-"] {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: none !important;
  }
}

@media (min-width: 1536px) {
  body.wp-child-theme-marnamic.wp-child-theme-marnamic.marnamic-archive-search-results .hp-page > .hp-row {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr) !important;
  }
}

/* Desktop filter widgets own the panel; their mobile-modal wrapper is structural only.
 * Sticky-kit inserts two wrappers between the sidebar and the widget, so this must be
 * scoped from the widget itself instead of relying on a direct sidebar child. */
@media (min-width: 981px) {
  body.wp-child-theme-marnamic.wp-child-theme-marnamic:is(.hp-template--vendors-view-page, .hp-template--listings-view-page) :is(
    .hp-widget--vendor-filter,
    .hp-widget--listing-filter
  ) > .hp-modal--mobile.hp-modal {
    background: transparent !important;
    border: 0 !important;
    outline: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }
}

/* Related listings keep fixed slots; a single result must not stretch full-width. */
body.single-hp_listing.wp-child-theme-marnamic .hp-page__footer .hp-listings > .hp-row {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: var(--marnamic-grid-gap) !important;
  align-items: stretch !important;
  width: 100% !important;
  margin: 0 !important;
}

body.single-hp_listing.wp-child-theme-marnamic .hp-page__footer .hp-listings > .hp-row > :is(.hp-grid__item, [class*="hp-col-"]) {
  display: flex !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  flex: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.single-hp_listing.wp-child-theme-marnamic .hp-page__footer .hp-listing--view-block {
  width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
}

@media (max-width: 980px) {
  body.single-hp_listing.wp-child-theme-marnamic .hp-page__footer .hp-listings > .hp-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 640px) {
  body.single-hp_listing.wp-child-theme-marnamic .hp-page__footer .hp-listings > .hp-row {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
