/* Shared directory nav, text-size control, and large-text reflow.
   Loaded on the home page and directory pages. */

html { font-size: 18px; }
html[data-text-size="bigger"] { font-size: 22px; }
html[data-text-size="largest"] { font-size: 26px; }

/* Directory link in the main menu: always highlighted as a pill. */
.nav a.dir-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  background: #2A1C7A;
  color: #fff !important;
  font-weight: 700;
  box-shadow: 0 0 0 2px rgb(42 28 122 / 20%);
}
.nav a.dir-nav-link[aria-current="page"] {
  background: #1D1352;
}
.nav a.dir-nav-link:hover {
  background: #5233E6;
  color: #fff !important;
}

/* Gentle pulse: 1 second per pulse, 5 times, then it stays as the pill.
   About 1 flash per second, well under 3 flashes per second. */
@keyframes dir-nav-pulse {
  0%, 100% {
    box-shadow: 0 0 0 2px rgb(42 28 122 / 20%), 0 0 0 0 rgb(46 196 182 / 0);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 2px rgb(42 28 122 / 20%), 0 0 0 8px rgb(46 196 182 / 35%);
    transform: scale(1.06);
  }
}
html.dir-nav-pulse .nav a.dir-nav-link {
  animation: dir-nav-pulse 1s ease-in-out 5;
}
@media (prefers-reduced-motion: reduce) {
  html.dir-nav-pulse .nav a.dir-nav-link {
    animation: none;
  }
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #2A1C7A;
  outline-offset: 3px;
}

.nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding-left: 0.55rem;
  padding-right: 0.55rem;
}

.text-size-btn:hover { background: #EEEAFF; }

/* Text-size reflow: the header must wrap when text grows.
   Cause of the "out of sync" bug: .site-header .wrap was nowrap,
   .nav had flex-shrink: 0, the wordmark allowed min-width: 0 so the
   logo was crushed, and .text-size-btn was white-space: nowrap so its
   label spilled out of a squeezed 44px box. body overflow-x: hidden
   then clipped the overflow, so Home / Directory / List your business
   / the logo and the text-size button no longer lined up. */

.site-header .wrap {
  flex-wrap: wrap;
  align-items: center;
  row-gap: 0.5rem;
  column-gap: 0.75rem;
}

.wordmark {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}
.wordmark img {
  height: auto;
  width: auto;
  max-width: 100%;
  max-height: 1.7rem;
  object-fit: contain;
  object-position: left center;
}
@media (max-width: 379px) {
  .wordmark img { max-height: 1.4rem; }
}
@media (min-width: 720px) {
  .wordmark img { max-height: 2.2rem; }
}

.nav {
  display: flex;
  flex-wrap: wrap;
  flex: 1 1 12rem;
  flex-shrink: 1;
  min-width: 0;
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem 0.7rem;
  max-width: 100%;
}

.nav a,
.nav .btn,
.nav a.dir-nav-link {
  flex: 0 1 auto;
  max-width: 100%;
  height: auto;
  min-height: 44px;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
  overflow-wrap: break-word;
}

.text-size-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  min-height: 44px;
  min-width: 44px;
  max-width: 100%;
  margin: 0.25rem 0;
  padding: 0.5rem 0.9rem;
  border: 2px solid #2A1C7A;
  border-radius: 999px;
  background: #fff;
  color: #15112E;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
  height: auto;
  overflow-wrap: break-word;
}

/* Directory grids and forms: columns may shrink and wrap; no fixed card height. */
.listing-grid,
.dir-secondary-filters,
.dir-filters .filter-grid,
.photo-gallery,
.form-card.directory-form .wrap {
  min-width: 0;
}
.listing-grid > *,
.dir-secondary-filters > *,
.dir-filters .filter-grid > *,
.form-card.directory-form .wrap > * {
  min-width: 0;
}
@media (min-width: 720px) {
  .listing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dir-secondary-filters,
  .photo-gallery { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
  .dir-filters .filter-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
}
@media (min-width: 1000px) {
  .listing-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .form-card.directory-form .wrap {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  }
}

.listing-card-wrap {
  height: auto;
  min-height: 0;
  overflow: visible;
}
.listing-card {
  height: auto;
  overflow: visible;
}
.listing-card .photo,
.listing-hero .photo {
  overflow: hidden;
}
.photo-gallery img {
  height: auto;
  aspect-ratio: 3 / 2;
}

/* Home directory hero / join panel, without editing home-directory.css */
.dir-panel-wrap .dir-panel > * { min-width: 0; }
@media (min-width: 720px) {
  .dir-panel-wrap .dir-panel {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  }
}
.dir-steps li {
  grid-template-columns: auto minmax(0, 1fr);
}
.dir-steps li::before {
  width: auto;
  height: auto;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0.15rem;
  box-sizing: border-box;
}
.dir-lede, .dir-actions .btn, .hero h1, .hero p {
  overflow-wrap: break-word;
  max-width: 100%;
}

/* Other worker's listing-pro layout: keep it wrapping at large text
   without editing listing-pro.css. Higher specificity so this wins. */
.pro-listing .pro-head,
.pro-listing .pro-grid {
  min-width: 0;
}
.pro-listing .pro-head > *,
.pro-listing .pro-grid > * { min-width: 0; }
@media (min-width: 761px) {
  .pro-listing .pro-head,
  .pro-listing .pro-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  }
}
.pro-listing .pro-actions {
  flex-wrap: wrap;
}
.pro-listing .pro-actions .pro-btn {
  min-width: min(100%, 9rem);
  height: auto;
  white-space: normal;
  text-align: center;
}
@media (max-width: 760px) {
  .pro-listing .pro-services { columns: 1; }
  .pro-listing .pro-actions .pro-btn {
    flex: 1 1 min(100%, 12rem);
  }
}

/* Cookie banner should wrap rather than spill at 320px + large text */
#cookie-banner {
  max-width: calc(100% - 2rem);
  box-sizing: border-box;
}
#cookie-banner p { flex: 1 1 12rem; }
#cookie-banner .cb-btns { flex-wrap: wrap; }

.btn, .form-section, .simple-search, .simple-search input,
.dir-secondary-filters select, .dir-filters select, .dir-filters input {
  max-width: 100%;
  box-sizing: border-box;
}


/* More reflow: long emails, fieldsets, the How-it-works grid, and form controls
   were still widening the page after the header wrap fix. */
fieldset,
fieldset.consent,
fieldset.memberships {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

input, select, textarea,
.field, .membership-row, legend, label, .hint {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.directory-form input,
.directory-form select,
.directory-form textarea,
.form-card input,
.form-card select,
.form-card textarea {
  width: 100%;
  max-width: 100%;
}

a, p, li, h1, h2, h3, h4,
.site-footer, .site-footer a, .foot-links, .hint, legend, label {
  overflow-wrap: break-word;
}
/* Long emails may still wrap at 320px without shrinking grid min-content to 1ch. */
a[href^="mailto:"] { overflow-wrap: anywhere; }

.site-footer,
.site-footer .wrap {
  max-width: 100%;
}
.foot-links {
  min-width: 0;
  max-width: 100%;
}
@media (min-width: 720px) {
  .site-footer .wrap {
    grid-template-columns: minmax(min(100%, 18rem), 1fr) minmax(min(100%, 12rem), auto);
    align-items: start;
  }
  .site-footer .wrap > :first-child {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: break-word;
  }
}

.steps, .reasons { min-width: 0; }
.steps li, .reasons li {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: break-word;
}
@media (min-width: 720px) {
  .steps, .reasons {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  }
}

.site-header,
.site-header .wrap,
.nav,
.wordmark {
  max-width: 100%;
  box-sizing: border-box;
}


/* Honeypot fields must stay off-layout even when the root font-size grows.
   Without a left/top, their static position was past the viewport (about 16.5rem). */
form { position: relative; }
.hp,
label:has(input[name="bot-field"]),
input[name="bot-field"] {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  white-space: nowrap !important;
  pointer-events: none;
}

/* Keep the hero, sections and wraps inside the viewport at 200% text. */
.wrap, .hero, .hero .wrap, .hero-text, .cta, .cta-box, .section,
#how-it-works, #what-we-do {
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}
.hero-text, .kicker, .dir-hero-heading, .hero-copy, .dir-lede, .hero h1, .hero p {
  max-width: 100%;
  min-width: 0;
  overflow-wrap: break-word;
}
.hero-text { max-width: min(40rem, 100%); }
.hero, .cta-box, #how-it-works, .aurora {
  overflow-x: clip;
}


/* Privacy / legal data tables may need two-dimensional layout (WCAG 1.4.10
   exception). Contain them so they don't widen the whole page. */
.legal, .legal .table-wrap, .table-wrap {
  max-width: 100%;
  overflow-x: auto;
}
.legal table { max-width: 100%; }
