/* MyLegalDocs AI v22 — subpage layout hardening. The homepage is intentionally excluded. */

html:has(body.us22-subpage),
body.us22-subpage {
  max-width: 100%;
  overflow-x: clip;
}

body.us22-subpage main {
  position: relative;
  isolation: isolate;
  max-width: 100%;
  min-width: 0;
}

body.us22-subpage main *,
body.us22-subpage main *::before,
body.us22-subpage main *::after {
  box-sizing: border-box;
}

body.us22-subpage main :where(section, article, aside, nav, div, header, footer, form, ul, ol, li) {
  min-width: 0;
  max-width: 100%;
}

body.us22-subpage main :where(h1, h2, h3, h4, h5, p, li, summary, figcaption, label, dd, dt) {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
  text-wrap: pretty;
}

body.us22-subpage main :where(a, button, strong, b, span, small) {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
}

body.us22-subpage main :where(h1, h2, h3, h4) {
  position: relative;
  inset: auto;
  height: auto;
  min-height: 0;
  overflow: visible;
}

body.us22-subpage main h1 {
  line-height: 1.08 !important;
  letter-spacing: clamp(-1.45px, -0.12vw, -0.45px) !important;
}

body.us22-subpage main h2 {
  line-height: 1.16 !important;
  letter-spacing: clamp(-0.9px, -0.07vw, -0.2px) !important;
}

body.us22-subpage main h3 {
  line-height: 1.28 !important;
  letter-spacing: -0.2px !important;
}

body.us22-subpage main p,
body.us22-subpage main li {
  line-height: 1.68;
}

body.us22-subpage main :where(.us19-button, .button, button, [role="button"]) {
  height: auto !important;
  min-height: 44px;
  white-space: normal !important;
  text-align: center;
  line-height: 1.28 !important;
}

/* Prevent inherited fixed-height and absolute-position rules from clipping card copy. */
body.us22-subpage main :where(
  .us19-service-card,
  .us19-family-card,
  .us19-link-card,
  .us19-guide-card,
  .us19-sample,
  .us19-process-grid article,
  .us19-standard-grid article,
  .us19-level-grid article,
  .us19-compliance-grid article,
  .us19-tree-grid article,
  .us19-contact-grid article,
  .us19-legal-grid article,
  .us19-faq-group,
  .us13-panel,
  .us14-panel,
  .us13-grid article,
  .us14-grid article
) {
  position: relative !important;
  inset: auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  contain: none !important;
}

body.us22-subpage main :where(
  .us19-service-card,
  .us19-family-card,
  .us19-link-card,
  .us19-guide-card,
  .us19-sample,
  .us19-process-grid article,
  .us19-standard-grid article,
  .us19-level-grid article,
  .us19-compliance-grid article,
  .us19-tree-grid article,
  .us19-contact-grid article,
  .us19-legal-grid article,
  .us19-faq-group
) > * {
  position: relative;
  inset: auto;
  flex-shrink: 0;
  max-width: 100%;
}

body.us22-subpage main :where(.us19-service-card, .us19-family-card, .us19-link-card, .us19-guide-card) {
  gap: 10px;
}

body.us22-subpage main :where(.us19-service-card, .us19-family-card, .us19-link-card, .us19-guide-card) :where(h2, h3, p, b, small) {
  margin-block-start: 0;
  margin-block-end: 0;
}

body.us22-subpage main .us19-sample p {
  min-height: 0 !important;
}

/* Grids use intrinsic columns and never allow text to force an overlap. */
body.us22-subpage main :where(
  .us19-process-grid,
  .us19-control-grid,
  .us19-service-family > div,
  .us19-family-grid,
  .us19-link-grid,
  .us19-guide-grid,
  .us19-standard-grid,
  .us19-compliance-grid,
  .us19-sample-grid,
  .us19-level-grid,
  .us19-tree-grid,
  .us19-faq-groups,
  .us19-contact-grid,
  .us19-legal-grid,
  .us13-grid,
  .us14-grid
) {
  align-items: stretch;
  grid-auto-rows: auto;
  min-width: 0;
}

body.us22-subpage main :where(
  .us19-process-grid,
  .us19-control-grid,
  .us19-service-family > div,
  .us19-family-grid,
  .us19-link-grid,
  .us19-guide-grid,
  .us19-standard-grid,
  .us19-compliance-grid,
  .us19-sample-grid,
  .us19-level-grid
) > * {
  min-width: 0;
  width: auto;
}

body.us22-subpage main :where(.us19-hero, .us19-service-hero, .us19-section > header, .us19-service-family > header, .us19-price-grid, .us19-split, .us19-cta, .us19-related, .us19-service-overview) > * {
  min-width: 0;
  max-width: 100%;
}

body.us22-subpage main :where(.us19-hero, .us19-service-hero) {
  overflow: visible;
  gap: clamp(22px, 3vw, 38px);
}

body.us22-subpage main :where(.us19-hero-panel, .us19-service-hero > aside) {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
}

body.us22-subpage main :where(.us19-hero-panel, .us19-service-hero > aside) :where(strong, span, small, a) {
  position: relative;
  inset: auto;
  height: auto;
  max-height: none;
  white-space: normal;
}

body.us22-subpage main .us19-price-badge {
  min-width: 0 !important;
  width: 100%;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
}

body.us22-subpage main .us19-price-examples p {
  min-width: 0;
  flex-wrap: wrap;
  gap: 6px 14px;
}

body.us22-subpage main .us19-state-list li {
  min-width: 0;
  flex-wrap: wrap;
  align-items: flex-start;
}

body.us22-subpage main .us19-state-list span {
  min-width: min(230px, 100%);
  flex: 1 1 230px;
}

body.us22-subpage main .us19-state-list a {
  flex: 0 1 auto;
  white-space: normal;
  text-align: right;
}

body.us22-subpage main .us19-guide-layout {
  grid-template-columns: minmax(210px, 235px) minmax(0, 1fr);
}

body.us22-subpage main .us19-guide-layout > aside {
  max-height: calc(100vh - 40px);
  overflow: auto;
  overscroll-behavior: contain;
}

body.us22-subpage main .us19-guide-body {
  width: 100%;
  max-width: 790px;
  min-width: 0;
}

body.us22-subpage main .us19-guide-body > section {
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
}

body.us22-subpage main .us19-guide-sources li a {
  align-items: flex-start;
  flex-wrap: wrap;
}

body.us22-subpage main .us19-guide-sources li b {
  flex: 1 1 360px;
  min-width: 0;
}

body.us22-subpage main .us19-guide-sources li span {
  flex: 0 1 auto;
  min-width: 0;
  text-align: right;
}

body.us22-subpage main .us19-breadcrumbs {
  max-width: 100%;
  scrollbar-width: thin;
}

body.us22-subpage main .us19-breadcrumbs > * {
  flex: 0 0 auto;
  overflow-wrap: normal;
}

body.us22-subpage main :where(.us8-legal-content, .us13-legal-detail, .us13-page, .us14-page, .us12-feedback, .us8-page) {
  width: min(100%, 1180px);
  min-width: 0;
  max-width: 100% !important;
  overflow: visible !important;
}

body.us22-subpage main :where(.us8-legal-content, .us13-legal-detail) :where(section, article, div) {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
}

/* Runtime fallback classes are added only when the browser measures clipping or collision. */
body.us22-subpage main .us22-text-repair {
  position: relative !important;
  inset: auto !important;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  transform: none !important;
}

body.us22-subpage main .us22-card-repair {
  position: relative !important;
  inset: auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  align-self: stretch !important;
}

body.us22-subpage main .us22-collision-repair {
  grid-auto-rows: auto !important;
  align-items: stretch !important;
  overflow: visible !important;
}

@media (max-width: 1100px) {
  body.us22-subpage main :where(.us19-hero, .us19-service-hero) {
    padding: 34px;
  }

  body.us22-subpage main :where(.us19-section > header, .us19-service-family > header) {
    gap: 22px;
  }
}

@media (max-width: 900px) {
  body.us22-subpage main :where(
    .us19-hero,
    .us19-service-hero,
    .us19-section > header,
    .us19-service-family > header,
    .us19-price-grid,
    .us19-split,
    .us19-cta,
    .us19-related,
    .us19-service-overview,
    .us19-tree-grid,
    .us19-faq-groups,
    .us19-contact-grid,
    .us19-legal-grid,
    .us13-grid,
    .us14-grid
  ) {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.us22-subpage main .us19-guide-layout {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 22px;
  }

  body.us22-subpage main .us19-guide-layout > aside {
    position: relative !important;
    top: auto !important;
    max-height: none;
    overflow: visible;
  }

  body.us22-subpage main .us19-guide-layout > aside nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 18px;
  }

  body.us22-subpage main :where(.us19-process-grid, .us19-control-grid, .us19-level-grid) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 680px) {
  body.us22-subpage main :where(.us19-page, .us13-page, .us14-page, .us8-page, .us12-feedback) {
    width: min(100% - 20px, 1180px) !important;
  }

  body.us22-subpage main :where(.us19-hero, .us19-hero.compact, .us19-service-hero, .us19-guide-head) {
    padding: 22px 18px !important;
    border-radius: 18px !important;
  }

  body.us22-subpage main :where(.us19-hero h1, .us19-service-hero h1, .us19-guide-head h1, .us13-hero h1, .us14-hero h1, .us8-legal-hero h1) {
    font-size: clamp(30px, 9.2vw, 43px) !important;
    line-height: 1.1 !important;
    letter-spacing: -1px !important;
  }

  body.us22-subpage main :where(
    .us19-process-grid,
    .us19-control-grid,
    .us19-service-family > div,
    .us19-family-grid,
    .us19-link-grid,
    .us19-guide-grid,
    .us19-standard-grid,
    .us19-compliance-grid,
    .us19-sample-grid,
    .us19-level-grid
  ) {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.us22-subpage main .us19-guide-layout > aside nav {
    grid-template-columns: minmax(0, 1fr);
  }

  body.us22-subpage main .us19-guide-sources li span,
  body.us22-subpage main .us19-state-list a {
    width: 100%;
    text-align: left;
  }

  body.us22-subpage main .us19-price-examples {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.us22-subpage main :where(.us19-split > article, .us19-service-overview article, .us19-contact-grid article, .us19-legal-grid article, .us19-faq-group) {
    padding: 21px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.us22-subpage main * {
    scroll-behavior: auto !important;
  }
}
