/* Final readability guardrails loaded after every other stylesheet. */
:root {
  --rr-readable-ink: #172235;
  --rr-readable-muted: #4f5c6b;
  --rr-readable-light: #ffffff;
  --rr-readable-dark: #10233d;
  --rr-readable-surface: #ffffff;
  --rr-readable-soft: #f4f6f8;
}

html,
body {
  background: var(--rr-readable-soft) !important;
  color: var(--rr-readable-ink) !important;
}

main,
section,
article,
aside,
header,
footer,
nav,
div,
form {
  min-width: 0;
}

/* Light surfaces must always use dark text. */
:is(.rr-card, .price-card, .account-card, .auth-card, .report-card, .faq-item, .preview-card, .calculator-card, .compare-card, .legal-card, .restore-card, .success-panel, .city-detail-card, .city-detail-signal, .city-related-card, .ash-method, .ash-membership, .city-editorial-facts, .city-editorial-body, .footer-inner, .rr-mobile-panel) {
  color: var(--rr-readable-ink) !important;
}

:is(.rr-card, .price-card, .account-card, .auth-card, .report-card, .faq-item, .preview-card, .calculator-card, .compare-card, .legal-card, .restore-card, .success-panel, .city-detail-card, .city-detail-signal, .city-related-card, .ash-method, .ash-membership, .city-editorial-facts, .city-editorial-body, .footer-inner, .rr-mobile-panel) :is(h1,h2,h3,h4,h5,h6,strong,label,a,button,span) {
  color: var(--rr-readable-ink) !important;
}

:is(.rr-card, .price-card, .account-card, .auth-card, .report-card, .faq-item, .preview-card, .calculator-card, .compare-card, .legal-card, .restore-card, .success-panel, .city-detail-card, .city-detail-signal, .city-related-card, .ash-method, .ash-membership, .city-editorial-facts, .city-editorial-body, .footer-inner, .rr-mobile-panel) :is(p,li,small) {
  color: var(--rr-readable-muted) !important;
}

/* Dark sections must always use light text. */
:is(.ash-hero__copy, .ash-ask, .ash-ask__panel, .city-editorial-hero__copy, .city-detail-match, .editorial-page-hero, .home-dark-section, .premium-dark-section) {
  color: var(--rr-readable-light) !important;
}

:is(.ash-hero__copy, .ash-ask, .ash-ask__panel, .city-editorial-hero__copy, .city-detail-match, .editorial-page-hero, .home-dark-section, .premium-dark-section) :is(h1,h2,h3,h4,h5,h6,p,li,strong,label,a,span) {
  color: var(--rr-readable-light) !important;
}

/* Keep accent labels readable instead of washed out. */
:is(.ash-kicker, .section-kicker, .city-editorial-kicker, .city-editorial-hero__country, .city-detail-signal span) {
  color: #9b6548 !important;
}

:is(.ash-hero__copy, .ash-ask__panel, .city-editorial-hero__copy, .city-detail-match) :is(.ash-kicker, .section-kicker, .city-editorial-kicker, .city-editorial-hero__country) {
  color: #f0c7aa !important;
}

/* Inputs and selects can never inherit white text on white fields. */
input,
select,
textarea,
.ash-input {
  background: #ffffff !important;
  color: var(--rr-readable-ink) !important;
  border-color: #aab4c0 !important;
}

input::placeholder,
textarea::placeholder {
  color: #667382 !important;
  opacity: 1 !important;
}

/* Primary and secondary button contrast. */
.btn-primary,
.nav-cta-btn,
.ash-btn--dark,
button[type="submit"] {
  background: var(--rr-readable-dark) !important;
  color: #ffffff !important;
  border-color: var(--rr-readable-dark) !important;
}

.btn-secondary,
.ash-btn--light {
  background: #ffffff !important;
  color: var(--rr-readable-dark) !important;
  border-color: var(--rr-readable-dark) !important;
}

:is(.ash-hero__copy, .city-editorial-hero__copy, .ash-ask__panel) .btn-secondary {
  background: transparent !important;
  color: #ffffff !important;
  border-color: rgba(255,255,255,0.85) !important;
}

/* Header and mobile navigation. */
#site-header.site-header-v1,
#site-header .header-shell {
  background: #ffffff !important;
  color: var(--rr-readable-ink) !important;
}

#site-header :is(a,button,label,span,select) {
  color: var(--rr-readable-ink) !important;
}

#site-header .nav-cta-btn {
  color: #ffffff !important;
}

.rr-mobile-panel {
  background: #ffffff !important;
}

.rr-mobile-panel :is(a,button,label,span,select) {
  color: var(--rr-readable-ink) !important;
}

/* Footer contrast. */
#site-footer,
#site-footer .footer-inner {
  background: #ffffff !important;
  color: var(--rr-readable-ink) !important;
}

#site-footer :is(a,h2,h3,strong,span) {
  color: var(--rr-readable-ink) !important;
}

#site-footer :is(p,small) {
  color: var(--rr-readable-muted) !important;
}

/* Prevent invisible content caused by inherited opacity or color. */
main :is(h1,h2,h3,h4,h5,h6,p,li,a,button,label,strong,span) {
  opacity: 1;
}

/* Mobile layout safeguards. */
@media (max-width: 900px) {
  body {
    overflow-x: hidden;
  }

  .header-shell,
  .content-wrap,
  .rr-container,
  .city-editorial-body,
  .editorial-page-hero-inner {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  .site-nav-desktop,
  #nav-auth:not(.nav-auth-mobile) {
    display: none !important;
  }

  .nav-toggle {
    display: inline-flex !important;
  }

  .ash-hero,
  .city-editorial-hero,
  .ash-method,
  .ash-ask,
  .ash-places__grid,
  .pricing-grid,
  .compare-grid,
  .calculator-grid,
  .city-detail-grid {
    grid-template-columns: 1fr !important;
  }

  .ash-hero__composition,
  .city-editorial-hero__media {
    min-height: 360px !important;
  }

  .ash-hero__copy,
  .city-editorial-hero__copy,
  .ash-method,
  .ash-places,
  .ash-membership,
  .ash-ask__panel {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  h1,
  .ash-hero h1,
  .city-editorial-hero__title,
  .editorial-hero-title {
    font-size: clamp(2.7rem, 13vw, 4.6rem) !important;
    line-height: 1 !important;
  }

  h2,
  .ash-method__title h2,
  .ash-places h2,
  .ash-membership h2,
  .city-editorial-intro h2 {
    font-size: clamp(2.2rem, 10vw, 3.7rem) !important;
    line-height: 1.04 !important;
  }

  p,
  li,
  label,
  input,
  select,
  textarea,
  button,
  a {
    font-size: 1rem !important;
  }

  .cta-button-group,
  .ash-actions,
  .city-editorial-hero__actions,
  .premium-preview-actions,
  .premium-ask-actions {
    width: 100% !important;
    align-items: stretch !important;
    flex-direction: column !important;
  }

  .cta-button-group > *,
  .ash-actions > *,
  .city-editorial-hero__actions > *,
  .premium-preview-actions > *,
  .premium-ask-actions > * {
    width: 100% !important;
  }

  input,
  select,
  textarea,
  button,
  .btn-primary,
  .btn-secondary,
  .ash-btn {
    min-height: 52px !important;
  }

  img {
    max-width: 100%;
    height: auto;
  }
}

@media (max-width: 520px) {
  .header-shell,
  .content-wrap,
  .rr-container,
  .city-editorial-body,
  .editorial-page-hero-inner,
  .ash-hero__copy,
  .city-editorial-hero__copy,
  .ash-method,
  .ash-places,
  .ash-membership,
  .ash-ask__panel {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  .ash-hero__composition,
  .city-editorial-hero__media {
    min-height: 300px !important;
  }
}
