/* Browser normalization and mobile viewport behavior. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button {
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
  font-family: inherit;
  text-transform: none;
}

/* Restore the intentional radii after resetting native button styling. */
.gradient-button, .outline-button, .news-tabs button { border-radius: 100px; }
.tabs button { border-radius: 6px 6px 0 0; }
.mock-sample, .voice-card, .promotion { border-radius: 6px; }
.dialog-close { border-radius: 50%; }

/* Allow text to wrap inside CSS grid and flex items in each engine. */
.section-heading > *, .editorial-layout > *, .mock-intro > *,
.footer-grid > *, .grade-item > *, .column-row > * { min-width: 0; }

.hero, .about { overflow: hidden; }
@supports (overflow: clip) {
  .hero, .about { overflow: clip; }
}

.flow-scroll {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

/* Use the layout viewport, excluding desktop scrollbars, for the full-bleed
   timeline. 100vw includes the scrollbar in Firefox and Windows browsers. */
.flow.container {
  width: 100%;
  padding-left: max(32px, calc((100% - 1120px) / 2));
}
.flow .section-heading { width: calc(100% - 32px); max-width: 1120px; }
.flow .flow-scroll { width: 100%; }

.site-menu {
  max-height: calc(100vh - 135px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.detail-dialog {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  max-height: calc(100vh - 40px);
  padding-bottom: max(28px, env(safe-area-inset-bottom, 0px));
}
.detail-dialog::backdrop {
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* A fixed body also prevents background movement in iOS Safari. */
html.dialog-open { overflow: hidden; }
html.dialog-open body {
  position: fixed;
  width: 100%;
  top: var(--dialog-scroll-top);
  left: 0;
  overflow: hidden;
}
html.restoring-scroll { scroll-behavior: auto !important; }

@supports (height: 100dvh) {
  .detail-dialog { max-height: calc(100dvh - 40px); }
  .site-menu { max-height: calc(100dvh - 135px); }
}
@media (max-width: 800px) {
  .flow.container { padding-left: 20px; }
  .flow .section-heading { width: calc(100% - 20px); }
  .site-menu { max-height: calc(100vh - 110px); }
  @supports (height: 100dvh) {
    .site-menu { max-height: calc(100dvh - 110px); }
  }
}
@media (max-width: 430px) {
  .grade-tabs button { border-radius: 4px 4px 0 0; }
}
/* Keep the shade attached to the left edge at every desktop width, including
   the 1441–1599px range between the design width and the large-screen rules. */
@media (min-width: 801px) {
  .hero-shade::after {
    left: 0;
    width: calc(50% + 130px);
    background-size: 100% 100%;
  }
}
