/* Main-site layout repairs. Independent portals and role workspaces are excluded. */
@media (max-width: 900px) {
  body[data-site-design][data-layout-repair="main"][data-review-area="public"] #main-content.page-education-events .topic-competition-row { min-width: 0; }
}
body[data-site-design][data-layout-repair="main"][data-review-area="public"] {
  --public-page-background: #fff;
  --public-sticky-top: 164px;
}

/* Use one page canvas behind the brand, navigation and public inner content. */
body[data-site-design][data-layout-repair="main"][data-layout-page="inner"][data-review-area="public"],
body[data-site-design][data-layout-repair="main"][data-layout-page="inner"][data-review-area="public"] :is(.site-header, #main-content, #main-content > .section) {
  background: var(--public-page-background);
}

/* Bordered return controls need actual space around their text. */
body[data-site-design][data-layout-repair="main"][data-review-area="public"] #main-content :is(.detail-back-link, .competition-portal-return) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  max-width: 100%;
  padding: 10px 16px;
  line-height: 1.5;
  border: 1px solid var(--sm-line, #ccdfec);
  border-radius: 6px;
  background: var(--sm-soft, #f3f8fb);
  white-space: normal;
  text-align: left;
  overflow-wrap: anywhere;
}

/* The actual header height is measured by layout-repair.js, including wrapping. */
body[data-site-design][data-layout-repair="main"][data-review-area="public"] #main-content :is(
  .registration-detail-shell .detail-sidebar-stack,
  .ar-reading-aside, .oa-side, .course-a-acquire-panel,
  .course-a-content-grid > .related-panel, .course-a-content-grid > aside,
  .service-map-copy, .topic-filter-panel, .two-col > .sidebar,
  .detail-sidebar-stack > .form-panel:first-child,
  .detail-sidebar-stack > .sidebar:first-child
) {
  top: var(--public-sticky-top);
}
body[data-site-design][data-layout-repair="main"][data-review-area="public"] #main-content :is(.registration-detail-shell .detail-sidebar-stack, .ar-reading-aside) :is(.registration-entry-panel, .sidebar, .form-panel, .detail-sidebar-stack) {
  position: static;
}
body[data-site-design][data-layout-repair="main"][data-review-area="public"] #main-content [data-layout-static="true"] {
  position: static;
}
body[data-site-design][data-layout-repair="main"][data-review-area="public"] #main-content :is(.account-panel-v2[id], #oa-certificate-form, .course-tab-panel[id]) {
  scroll-margin-top: var(--public-sticky-top);
}
/* An unset course cover must not collapse into a thin, empty caption strip. */
body[data-site-design][data-layout-repair="main"][data-review-area="public"] #main-content .course-a-cover:has(.course-cover-empty) {
  display: none;
}

/* The city and district controls share a row; help and selected chips follow. */
body[data-site-design][data-layout-repair="main"][data-review-area="public"] #oa-institution-form .oa-form-grid {
  align-items: start;
}
body[data-site-design][data-layout-repair="main"][data-review-area="public"] #oa-institution-form [data-oa-district-area] {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
body[data-site-design][data-layout-repair="main"][data-review-area="public"] #oa-institution-form :is(select[name="cityCode"], .oa-district-picker) {
  min-height: 46px;
  height: 46px;
  box-sizing: border-box;
}
body[data-site-design][data-layout-repair="main"][data-review-area="public"] #oa-institution-form .oa-district-picker > summary {
  min-height: 44px;
  height: 44px;
  padding: 10px 12px;
  box-sizing: border-box;
}
body[data-site-design][data-layout-repair="main"][data-review-area="public"] #oa-institution-form .oa-district-chips {
  margin: 0;
  min-height: 0;
}
body[data-site-design][data-layout-repair="main"][data-review-area="public"] .oa-page [data-oa-material-storage] {
  margin-top: 26px;
  padding: 24px 27px;
  min-width: 0;
}
body[data-site-design][data-layout-repair="main"][data-review-area="public"] .oa-page [data-oa-material-storage] .oa-help {
  overflow-wrap: anywhere;
}

/* Give navigation a real column wide enough for the full competition name. */
body[data-site-design][data-layout-repair="main"][data-review-area="public"] .footer.footer-competition-portals .footer-inner {
  grid-template-columns: minmax(220px, 1fr) minmax(350px, 1.4fr) minmax(130px, .6fr) minmax(250px, 1fr);
  gap: clamp(20px, 2.3vw, 34px);
}
body[data-site-design][data-layout-repair="main"][data-review-area="public"] .footer-inner > * {
  min-width: 0;
}
body[data-site-design][data-layout-repair="main"][data-review-area="public"] .footer-site-navigation > a {
  width: 100%;
  max-width: 100%;
  line-height: 1.75;
  overflow-wrap: anywhere;
}
@media (min-width: 1101px) {
  body[data-site-design][data-layout-repair="main"][data-review-area="public"] .footer-site-navigation > a {
    white-space: nowrap;
    font-size: 13px;
  }
}
@media (max-width: 1100px) {
  body[data-site-design][data-layout-repair="main"][data-review-area="public"] .footer.footer-competition-portals .footer-inner {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 32px;
  }
  body[data-site-design][data-layout-repair="main"][data-review-area="public"] .footer-site-navigation {
    grid-column: 1 / -1;
  }
}
@media (max-width: 1000px) {
  body[data-site-design][data-layout-repair="main"][data-review-area="public"] #main-content :is(.registration-detail-shell .detail-sidebar-stack, .ar-reading-aside) {
    position: static;
  }
}
@media (max-width: 760px) {
  body[data-site-design][data-layout-repair="main"][data-review-area="public"] #main-content :is(.oa-side, .course-a-acquire-panel, .course-a-content-grid > .related-panel, .course-a-content-grid > aside, .service-map-copy, .topic-filter-panel, .two-col > .sidebar, .detail-sidebar-stack > .form-panel:first-child, .detail-sidebar-stack > .sidebar:first-child) {
    position: static;
  }
  body[data-site-design][data-layout-repair="main"][data-review-area="public"] .oa-page [data-oa-material-storage] {
    padding: 20px 18px;
  }
  body[data-site-design][data-layout-repair="main"][data-review-area="public"] .footer.footer-competition-portals .footer-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
  body[data-site-design][data-layout-repair="main"][data-review-area="public"] .footer-site-navigation {
    grid-column: auto;
  }
}
