/* AfiaỌru Marketplace layout audit fixes — v1.32.0
   Loaded last so these rules correct theme/plugin cascade conflicts consistently. */

/* Prevent theme content wrappers from squeezing the custom page templates. */
body.afiaoru-app-shell #page,
body.afiaoru-app-shell .site,
body.afiaoru-app-shell .site-content,
body.afiaoru-app-shell #content,
body.afiaoru-app-shell .content-area,
body.afiaoru-app-shell main.afh-home,
body.afiaoru-app-shell main.afn,
body.afiaoru-app-shell main.afp {
  min-width: 0;
  max-width: 100%;
}
body.afiaoru-app-shell main.afh-home,
body.afiaoru-app-shell main.afn,
body.afiaoru-app-shell main.afp {
  width: 100%;
  margin-inline: auto;
  float: none;
}

/* Consistent box sizing, readable wrapping, and predictable vertical rhythm. */
.afh-home, .afn, .afp { box-sizing: border-box; }
.afh-home *, .afh-home *::before, .afh-home *::after,
.afn *, .afn *::before, .afn *::after,
.afp *, .afp *::before, .afp *::after { box-sizing: border-box; }
.afh-home h1, .afh-home h2, .afh-home h3,
.afn h1, .afn h2, .afn h3,
.afp h1, .afp h2, .afp h3 { max-width: 100%; overflow-wrap: anywhere; }
.afh-home p, .afn p, .afp p,
.afh-home li, .afn li, .afp li { overflow-wrap: anywhere; }
.afh-wrap, .afn-wrap, .afp-wrap {
  width: 100%;
  max-width: 1160px;
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(16px, 3vw, 28px);
  padding-right: clamp(16px, 3vw, 28px);
}
.afh-section, .afn-section, .afp-section { min-width: 0; }

/* Theme defaults often assign margins/widths to form elements and buttons. */
.afh-home input, .afh-home select, .afh-home textarea, .afh-home button,
.afn input, .afn select, .afn textarea, .afn button,
.afp input, .afp select, .afp textarea, .afp button { max-width: 100%; font-family: inherit; }
.afn .afn-search, .afp .afp-form, .afp .afp-form-wrap { min-width: 0; width: 100%; }
.afn .afn-field, .afp .afp-field { min-width: 0; width: 100%; }
.afn .afn-field input, .afn .afn-field select,
.afp .afp-field input, .afp .afp-field select, .afp .afp-field textarea {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
}
.afp .afp-field { display: grid; gap: 7px; margin: 0 0 16px; }
.afp .afp-field label { display: block; margin: 0; line-height: 1.4; }
.afp .afp-field textarea { min-height: 150px; resize: vertical; }
.afp .afp-hp { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; }

/* Cards and grid children must be allowed to shrink rather than overflow. */
.afh-home [class*="grid"], .afn [class*="grid"], .afp [class*="grid"] { min-width: 0; }
.afh-home .afh-card, .afn .afn-card, .afp .afp-card,
.afh-home .afh-hero-copy, .afn .afn-results-head, .afp .afp-form-wrap { min-width: 0; }
.afh-home .afh-actions, .afn .afn-actions, .afp .afp-actions { align-items: stretch; }
.afh-home .afh-btn, .afn .afn-btn, .afp .afp-btn { max-width: 100%; white-space: normal; text-align: center; }

@media (min-width: 720px) {
  .afp .afp-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
  .afp .afp-contact-grid { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 28px; }
  .afp .afp-contact-info { grid-template-columns: minmax(0, 1fr); }
  .afn .afn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .afn .afn-field.afn-wide { grid-column: 1 / -1; }
}
@media (min-width: 1024px) {
  .afn .afn-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .afn .afn-field.afn-wide { grid-column: 1 / -1; }
  .afh-home .afh-wrap, .afn .afn-wrap, .afp .afp-wrap { padding-left: 28px; padding-right: 28px; }
}
@media (max-width: 719px) {
  .afh-home, .afn, .afp { padding-bottom: 104px; }
  .afh-home .afh-wrap, .afn .afn-wrap, .afp .afp-wrap { padding-left: 16px; padding-right: 16px; }
  .afh-home .afh-hero, .afn .afn-hero, .afp .afp-hero { border-radius: 0 0 20px 20px; }
  .afh-home .afh-actions .afh-btn, .afn .afn-actions .afn-btn, .afp .afp-actions .afp-btn { flex: 1 1 100%; width: 100%; }
  .afp .afp-card, .afp .afp-form-wrap { padding: 20px 16px; }
  .afp .afp-info h2 { font-size: 1.15rem; }
  .afn .afn-search { padding: 16px 12px; }
}
