/* MotoEtkinlik shared frontend shell — excludes WordPress admin. */
:root {
  --me-layout-max: 1248px;
  --me-layout-edge-gap: 20px;
  --me-layout-hero-inset: 15px;
  --me-layout-hero-radius: 16px;
  --container-width: var(--me-layout-max);
}
body:not(.wp-admin) :is(.container, .container--content) {
  --container-width: var(--me-layout-max);
  box-sizing: border-box;
}
/* Only outer page shells: do not resize nested grids, cards or results. */
body:not(.wp-admin) main > :is(.container, .container--content),
body:not(.wp-admin) main.content-page > :is(.container, .container--content),
body:not(.wp-admin) main > :is(.me-front-inner, .results-hub-container, .riders-page-container) {
  width: 100%;
  max-width: var(--me-layout-max);
  margin-inline: auto;
  box-sizing: border-box;
}
/* Editorial templates, including author, search and 404. */
body:not(.wp-admin) main.content-page {
  padding-block: var(--me-layout-edge-gap);
}
body:not(.wp-admin) main.content-page > .container.container--content {
  max-width: var(--me-layout-max);
}
/* Shared page spacing, scoped to the direct page shell. */
body:not(.wp-admin) main:not(.content-page) {
  margin-block-start: var(--me-layout-edge-gap);
  margin-block-end: var(--me-layout-edge-gap);
}
/* Hero radius standard; never change the hero's content or imagery. */
body:not(.wp-admin) :is(
  .results-hub-race-hero, .riders-page-hero, .me-front-hero,
  .me-page-hero, .race-hero, .standings-hero, .calendar-hero,
  .youtube-hero, .me-hero
) { border-radius: var(--me-layout-hero-radius); }
/* Page shell-to-hero inset: apply to known direct hero shells only. */
body:not(.wp-admin) :is(.results-hub-race-hero, .riders-page-hero, .me-page-hero, .standings-hero, .calendar-hero, .youtube-hero) {
  margin-inline: var(--me-layout-hero-inset);
}
@media (max-width: 768px) {
  /* Retain existing mobile card/grid layouts and readable side gutters. */
  body:not(.wp-admin) main.content-page > .container.container--content {
    width: 100%; max-width: var(--me-layout-max);
  }
}

/* Template alignment correction: preserve the already-approved Results Hub pages. */
/* Editorial page shells previously had 40px vertical breathing room. The global
   20px override collapsed that space and pulled the surfaces against the header. */
body:not(.wp-admin) main:is(.archive-page,.author-page,.search-page,.page-404,.category-page).content-page {
  padding-top: 40px;
  padding-bottom: 40px;
}
/* The home template uses site-main rather than content-page. Do not alter its
   internal editorial grids; constrain only its outer layout when applicable. */
body.home main#primary.site-main {
  max-width: 1248px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}
/* YouTube has its own 30/26px padding override. Normalize that page shell
   without affecting the hero content, typography, or video cards. */
body.moto-youtube-page .me-youtube-archive {
  padding-top: 20px !important;
}
@media (max-width: 767px) {
  body.moto-youtube-page .me-youtube-archive { padding-top: 20px !important; }
}

/* REV — Single article and homepage top alignment.
   Match the approved editorial top breathing room without touching the
   already-correct MotoGP results, standings, calendar and riders pages. */
body.single-post main.single-page.content-page {
  padding-top: 40px;
}
/* Home's own 20px padding plus the shared 20px main margin used to stack.
   Keep only the shared 20px external gap; preserve internal hero/grid layout. */
body.home main#primary.site-main {
  padding-top: 0;
}

/* REV — 10px top alignment across non-home frontend pages.
   Keep the approved home page exactly as-is. */
body:not(.wp-admin):not(.home) main:not(.content-page) {
  margin-block-start: 10px;
}
body:not(.wp-admin) main.content-page {
  padding-top: 10px;
}
body:not(.wp-admin) main:is(.archive-page,.author-page,.search-page,.page-404,.category-page).content-page,
body.single-post main.single-page.content-page {
  padding-top: 10px;
}
body.moto-youtube-page .me-youtube-archive {
  padding-top: 10px !important;
}
@media (max-width: 767px) {
  body.moto-youtube-page .me-youtube-archive { padding-top: 10px !important; }
}

/* REV — Editorial 20px, tighter race/video page shell, approved home untouched.
   Remove the extra shared main top margin on non-editorial pages to avoid
   accumulating it with template-specific hero/container spacing. */
body:not(.wp-admin):not(.home) main:not(.content-page) {
  margin-block-start: 0;
}
body:not(.wp-admin) main.content-page,
body:not(.wp-admin) main:is(.archive-page,.author-page,.search-page,.page-404,.category-page).content-page,
body.single-post main.single-page.content-page {
  padding-top: 20px;
}
/* Video archive retains its own 10px gap, without a second shared main gap. */
body.moto-youtube-page .me-youtube-archive {
  padding-top: 10px !important;
}
@media (max-width: 767px) {
  body.moto-youtube-page .me-youtube-archive { padding-top: 10px !important; }
}

/* 2026-10-12 — MotoGP four-page header gap correction.
   The actual 40px gap comes from .motocal-wrapper's outer margin,
   not the hero's internal padding. Halve only that outer top margin;
   preserve hero geometry, images, insets and every other template. */
body:not(.wp-admin) .motocol-results-hub--motogp > .motocal-wrapper,
body:not(.wp-admin) .motocal-wrapper.standings-hub--motogp,
body:not(.wp-admin) .motocal-wrapper.riders-hub--motogp,
body:not(.wp-admin) .motocal-wrapper.me-calendar-unified-shell {
  margin-top: 20px !important;
}

/* MotoGP four-page hero alignment — 15px inset from the page container.
   Keep the approved outer header-to-container spacing untouched. */
body:not(.wp-admin) .motocol-results-hub--motogp > .motocal-wrapper .results-hub-race-hero,
body:not(.wp-admin) .motocal-wrapper.standings-hub--motogp .standings-hero,
body:not(.wp-admin) .motocal-wrapper.riders-hub--motogp .riders-page-hero,
body:not(.wp-admin) .motocal-wrapper.me-calendar-unified-shell .me-calendar-hero {
  box-sizing: border-box;
  width: calc(100% - 30px) !important;
  max-width: calc(100% - 30px) !important;
  margin-top: 15px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  border-radius: 16px !important;
}

/* Final hero alignment: Results Hub had an additional 24px (12px mobile)
   wrapper padding above its hero. The common 15px hero margin already
   supplies the required container-to-hero gap. */
body:not(.wp-admin) .motocol-results-hub--motogp.results-hub--v22 > .motocal-wrapper {
  padding-top: 0 !important;
}

/* YouTube: share the four MotoGP heroes' width, inset and corner radius.
   Keep the video archive's existing header spacing and inner content intact. */
body.moto-youtube-page .me-youtube-archive > .me-youtube-shell {
  width: 100%;
  max-width: 1248px;
  box-sizing: border-box;
}
body.moto-youtube-page .me-youtube-archive .me-youtube-results-hero {
  box-sizing: border-box;
  width: calc(100% - 30px) !important;
  max-width: calc(100% - 30px) !important;
  margin: 15px auto 26px !important;
  border-radius: 16px !important;
}

/* YouTube archive: constrain the entire visible white/dark shell, not only
   the hero. Preserve its existing padding, cards and vertical spacing. */
body.moto-youtube-page .me-youtube-archive > .me-youtube-shell {
  max-width: 1160px !important;
  margin-inline: auto !important;
}

/* 2026-10-12 targeted spacing: results container-to-hero 15 -> 30px;
   YouTube header-to-container 10 -> 20px, container-to-hero 15 -> 7.5px.
   Preserve all other templates, horizontal dimensions and hero appearance. */
body:not(.wp-admin) .motocol-results-hub--motogp > .motocal-wrapper .results-hub-race-hero {
  margin-top: 30px !important;
}
body.moto-youtube-page .me-youtube-archive {
  padding-top: 20px !important;
}
body.moto-youtube-page .me-youtube-archive .me-youtube-results-hero {
  margin-top: 7.5px !important;
}
@media (max-width: 767px) {
  body.moto-youtube-page .me-youtube-archive {
    padding-top: 20px !important;
  }
}
