/* The interior tabs share the Garage and Gear page width and catalog tracks. */
.tab-page {
  --tab-side-space: 48px;
  --tab-columns: 3;
  --tab-pair-columns: 2;
  --tab-gap: 14px;
  --tab-section-gap: clamp(18px, 2.2vw, 28px);
}

.tab-page > main,
.tab-page :is(.ah-mast-inner, .ah-footer-inner) {
  box-sizing: border-box;
  width: min(1180px, calc(100% - var(--tab-side-space)));
  margin-inline: auto;
}
.tab-page > main { container-type: inline-size; }

/* The main element owns both gutters, including inside inactive panels. */
.tab-page main :is(.tab-hero, .catalog-wrap, .wrap.mainbody, .music-console-wrap, .street-contents, .ah-gallery, .fm-shelf) {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}
.tab-page .street-sources { margin-inline: 0; }
.tab-page main > :is(.ah-gallery, .fm-shelf),
.tab-page :is(.mainbody, .street-contents) > .ah-gallery {
  margin-block: var(--tab-section-gap);
}
.tab-page .mainbody { padding-bottom: var(--tab-section-gap); }
.tab-page .mainbody > :is(.issue-shelf, .issue-related, .stills) {
  margin-top: var(--tab-section-gap);
}

/* Use the main column as the reference even for a grid inside a padded section.
   Its heading retains the section padding while its cards line up with the catalogs. */
.tab-page main :is(
  .index-grid, .gear-product-grid, .build-grid, .catalog-census, .weapon-showcase-grid, .weapon-backroads-grid,
  .wild-grid, .fm-grid, .guide-field-grid, .campaign-list, .place-directory, .deck, .issue-links,
  .shame-grid, .stats, .digest-metrics, .source-grid, .ah-gallery-grid, .stills-grid, .street-look-grid,
  .ah-location-links > ul
) {
  box-sizing: border-box;
  grid-template-columns: repeat(var(--tab-columns), minmax(0, 1fr));
  gap: var(--tab-gap);
  inline-size: 100cqi;
  margin-inline: calc((100% - 100cqi) / 2);
}

/* A single lead photograph spans the page. A pair fills both halves. */
.tab-page main :is(.ah-gallery-grid, .stills-grid, .street-look-grid):has(> :nth-child(2):last-child) {
  grid-template-columns: repeat(var(--tab-pair-columns), minmax(0, 1fr));
}
.tab-page main :is(.ah-gallery-grid, .stills-grid, .street-look-grid):has(> :only-child) {
  grid-template-columns: minmax(0, 1fr);
}
.tab-page :is(.deck, .wild-grid) > .card:first-child { grid-column: auto; }
.tab-page .fm-grid figure { max-width: none; }
.tab-page .campaign-list { padding-inline: 0; }
.tab-page .ah-location-links > ul { display: grid; list-style: none; padding: 0; }
.tab-page .ah-location-links li > a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--ah-edge);
  border-radius: 9px;
}

@media (max-width: 780px) {
  .tab-page { --tab-columns: 2; }
}
@media (max-width: 590px) {
  .tab-page {
    --tab-side-space: 24px;
    --tab-columns: 1;
    --tab-pair-columns: 1;
    --tab-gap: 9px;
  }
}
