/* Mobile-first corrections for the landing page.
 *
 * Loaded last, so it overrides without editing any existing rule. Removing the
 * one <link> in index.html reverts everything here.
 *
 * Measured on a real 390px viewport before any change:
 *   - document scroll width 401px against a 390px viewport, so the page
 *     scrolled sideways on a phone
 *   - 45 links and buttons under the 44px minimum touch height
 *   - 39.7 screens of scrolling
 *
 * Two separate causes of the sideways scroll, both confirmed by measurement
 * rather than inspection:
 *
 *   1. AOS. Seventeen elements carry data-aos, and the zoom presets set
 *      matrix(1.2, 0, 0, 1.2, 0, -100) as their *initial* state. A 344px card
 *      renders 413px wide and sticks 11px past each edge. The animation is
 *      worth keeping, so the sections that hold those cards clip instead.
 *
 *   2. .laning-page-left is a fixed 400px, wider than the viewport it has to
 *      sit in below 512px.
 */

@media (max-width: 512px) {

  /* 1. Clip the scaled-up initial state of the AOS zoom presets.
   *    overflow-x: clip does not create a scroll container, so it cannot
   *    break position: sticky the way overflow-x: hidden can. The hidden
   *    fallback is for browsers without clip support. */
  .extraText-section,
  .section-items-style,
  .section-calculate-style,
  .section-link-directory,
  .faq-section-landing {
    overflow-x: hidden;
    overflow-x: clip;
  }

  /* 2. The hero column and its images must not exceed the viewport. */
  .laning-page-left,
  .laning-page-left-img,
  .laning-page-left-img2 {
    max-width: 100%;
    height: auto;
  }

  /* 3. Touch targets. 44px is the minimum reliable tap height.
   *    Links sitting inside running text are deliberately excluded: giving a
   *    link in a sentence a 44px box breaks the paragraph, and the guidance
   *    applies to controls outside running text. */
  .nav-menu a,
  .nav-menu button,
  .dropbtn,
  .dropbtn10,
  .buyer-btn,
  footer a,
  .dropdown-menu a,
  .home-select-state-btn {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .dropdown-menu a {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  /* .buyer-btn is a centred pill, so keep it centred once it becomes a flex box. */
  .buyer-btn {
    justify-content: center;
  }
}


/* ---------------------------------------------------------------------------
 * FAQ accordion. Applies at every width, not just phones.
 *
 * The 14 answers used to sit permanently open. Measured on a 390px viewport,
 * the FAQ section was 19,289px tall: 24.5 of the page's 40.7 screens, which is
 * 60% of the whole landing page. They are now <details>/<summary>, so the text
 * stays in the DOM for Google and for the FAQPage structured data while the
 * section collapses to a readable list.
 *
 * Native <details> was chosen over a JS accordion deliberately: it is
 * keyboard-operable and announced correctly by screen readers with no code,
 * and it still works if the JavaScript fails.
 * ------------------------------------------------------------------------ */

.faq-landing-row > summary.question-landing-faq {
  cursor: pointer;
  list-style: none;              /* Firefox default marker */
  position: relative;
  padding: 14px 44px 14px 0;     /* 44px keeps the chevron clear of the text */
  min-height: 44px;
  display: flex;
  align-items: center;
}

/* Safari and Chrome draw their own triangle. */
.faq-landing-row > summary::-webkit-details-marker { display: none; }

/* Chevron, drawn in CSS so there is no extra request and it inherits colour. */
.faq-landing-row > summary::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.2s ease;
}

.faq-landing-row[open] > summary::after {
  transform: translateY(-20%) rotate(-135deg);
}

/* The focus ring has to be visible: this is now a keyboard control. */
.faq-landing-row > summary:focus-visible {
  outline: 2px solid #9c1d5e;
  outline-offset: 3px;
  border-radius: 4px;
}

.faq-landing-row {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.faq-landing-row > .answer-landing-faq {
  padding-bottom: 18px;
}

@media (prefers-reduced-motion: reduce) {
  .faq-landing-row > summary::after { transition: none; }
}


/* ---------------------------------------------------------------------------
 * Hero.
 *
 * The state picker was a Bootstrap dropdown: two taps, a menu that opened off
 * the bottom of a phone screen, a dependency on Bootstrap's JS, and nothing for
 * a crawler to follow. It is now eight plain links. They are also eight
 * internal links in the first screen, which the dropdown never gave us.
 *
 * The hero copy block carried an inline line-height of 100px, which is what
 * produced the enormous gaps between the headline and the question.
 * ------------------------------------------------------------------------ */

.hero-copy {
  padding-top: 1rem;
  max-width: 34rem;
}

.hero-copy h1 {
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.hero-copy h2 {
  line-height: 1.35;
  font-size: clamp(1rem, 2.6vw, 1.35rem);
  font-weight: 400;
  margin-bottom: 1.5rem;
}

.hero-question {
  font-weight: 600;
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 1rem;
}

.state-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  width: 100%;
  max-width: 34rem;
}

.state-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 1rem;
  border: 1.5px solid #bc3b82;
  border-radius: 999px;
  color: #9c1d5e;
  background: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.state-chip:hover,
.state-chip:focus-visible {
  background: #bc3b82;
  color: #fff;
  text-decoration: none;
  transform: translateY(-2px);
}

.state-chip:focus-visible {
  outline: 2px solid #9c1d5e;
  outline-offset: 3px;
}

.state-chip:active {
  transform: translateY(0);
}

/* Two across once there is room, four on a wide screen. */
@media (min-width: 480px) {
  .state-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 992px) {
  .state-grid { grid-template-columns: repeat(4, 1fr); }
  .state-chip { font-size: 0.875rem; padding: 0.75rem 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .state-chip { transition: none; }
  .state-chip:hover, .state-chip:focus-visible { transform: none; }
}


/* ---------------------------------------------------------------------------
 * Testimonials. Twelve real reviews, so they are worth presenting properly.
 *
 * The stars were emoji, which a screen reader announces five separate times
 * and which render differently on every platform. They are now characters with
 * a single aria-label, coloured to the brand.
 *
 * No Review or AggregateRating structured data here on purpose: Google treats
 * reviews a business collects about itself as self-serving and ineligible for
 * rich results, so marking them up invites a manual action rather than stars
 * in search.
 * ------------------------------------------------------------------------ */

.review-stars {
  color: #e8a33d;
  letter-spacing: 0.08em;
  font-size: 1.05rem;
  line-height: 1;
  display: inline-block;
  margin: 0.35rem 0 0.6rem;
}

/* The card is not clickable, so it must not claim to be. */
.review-card {
  cursor: auto;
}

.review-card p {
  font-size: 0.95rem;
  line-height: 1.55;
}


/* ---------------------------------------------------------------------------
 * The state question, /state/ - the first step of the funnel.
 *
 * The Next button is disabled until a state is chosen, which is correct, but
 * it was drawn at opacity 0.8 on the full brand pink. That reads as "slightly
 * faded", not "off", so people clicked it, nothing happened, and nothing told
 * them the button was waiting on them. The owner hit this himself.
 * ------------------------------------------------------------------------ */

#submitButton:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

#submitButton:not(:disabled) {
  cursor: pointer;
}

#stateSelect {
  border-radius: 8px;
  padding: 0 12px;
}

#stateSelect:focus-visible,
#submitButton:focus-visible {
  outline: 2px solid #9c1d5e;
  outline-offset: 3px;
}

label[for="stateSelect"] .funnel-h1 {
  margin-bottom: 0.75rem;
}


/* ---------------------------------------------------------------------------
 * State pages. The page is titled "Best Buyers Agents in <state>" with an h2
 * reading "List of Top Professionals Buyers Agents", and showed none: a
 * visitor who searched for that landed on a questionnaire. These are the
 * agents who cover the state. Mobile-first: one column, two from 640px.
 * ------------------------------------------------------------------------ */

.state-agents { max-width: 1100px; margin: 2.5rem auto; padding: 0 1rem; }

.state-agents-heading {
  font-size: 1.3rem;
  text-align: center;
  margin-bottom: 0.4rem;
}

.state-agents-lead {
  text-align: center;
  color: #555;
  max-width: 34rem;
  margin: 0 auto 1.5rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

.state-agents-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.state-agent {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  padding: 1rem;
  border: 1px solid rgba(156, 29, 94, 0.25);
  border-radius: 12px;
  background: #fff;
}

.state-agent-photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}

.state-agent-body { min-width: 0; }

.state-agent-name {
  display: block;
  font-weight: 700;
  color: #9c1d5e;
  text-decoration: none;
  min-height: 24px;
}

.state-agent-name:hover { text-decoration: underline; }

.state-agent-agency {
  display: block;
  font-size: 0.85rem;
  color: #555;
  text-decoration: none;
  margin-top: 2px;
}

.state-agent-intro {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #333;
  margin: 0.5rem 0 0;
}

.state-agents-empty {
  text-align: center;
  color: #555;
  max-width: 34rem;
  margin: 0 auto;
}

@media (min-width: 640px) {
  .state-agents-grid { grid-template-columns: 1fr 1fr; }
}


/* ---------------------------------------------------------------------------
 * Funnel form fields.
 *
 * Every field on the signup page was placeholder-only, because the labels were
 * spelled <lable>, which is not an element and so did nothing. Two were empty
 * as well, and the name field pointed at an id that does not exist. A
 * placeholder disappears the moment someone types, leaving them guessing what
 * the box was for - on the last step before they hand over their details.
 * ------------------------------------------------------------------------ */

.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.35rem;
  text-align: left;
  width: 100%;
}

/* The funnel questions use a heading as the label. Keep the heading's look. */
label > h4 {
  margin: 0 0 0.5rem;
}

label[for="state"],
label[for="stateSelect"] {
  cursor: pointer;
}


/* ---------------------------------------------------------------------------
 * Funnel step headings.
 *
 * Four of the five steps a real client walks - /budget/, /processing/,
 * /teaser/ and /create/ - had no <h1> at all. /budget/ and /processing/ led
 * with an h4, /teaser/ with an h3, /create/ with an h5, so a screen reader
 * announced no page heading and the document outline started partway down.
 * The main question or statement on each is now the h1, kept at the size it
 * already rendered at so nothing moves.
 * ------------------------------------------------------------------------ */

.funnel-h1 {
  font-size: 1.35rem;
  line-height: 1.3;
  font-weight: 600;
  margin-top: 0;
}

@media (min-width: 768px) {
  .funnel-h1 { font-size: 1.5rem; }
}


/* The funnel's questions are the labels for the control that answers them.
 * They were plain <p> or <h4> text with a separate sr-only label, so tapping
 * the question did nothing and a screen reader read the question and the
 * field as unrelated. */
.funnel-question {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.6rem;
  cursor: pointer;
}


/* ---------------------------------------------------------------------------
 * Select2 and the suburb row on /states/<slug>/.
 *
 * Measured in a 390px window on the live page: the suburb control a client
 * taps is a Select2 widget, not the <select> - Select2 hides the real one at
 * 1x1 and draws its own. funel-d.css pins that widget's height, its text
 * line-height and its arrow at 40px with !important, and the "add" button
 * beside it at 40px with !important inside a media query, so all of them sat
 * under the 44px minimum no matter what the template said. This file loads
 * after funel-d.css, so matching !important here is the only way to raise
 * them without editing a rule the other funnel pages share.
 *
 * The <select> keeps the visible question as its label even though Select2
 * hides it: Select2's select2-hidden-accessible pattern leaves the real
 * control in the accessibility tree, so that is what a screen reader reads.
 *
 * /states/ and /cities/ carry their own copy of the widget rule in a <style>
 * block that sits after this file, so they pin the same 48px there. Change
 * both if you change this.
 * ------------------------------------------------------------------------ */

.select2-container .select2-selection--single { height: 48px !important; }

.select2-container--default
  .select2-selection--single
  .select2-selection__rendered { line-height: 48px !important; }

.select2-container--default
  .select2-selection--single
  .select2-selection__arrow { height: 48px !important; }

#addBtnareas { height: 48px !important; }


/* ---------------------------------------------------------------------------
 * The agent cards on /states/<slug>/.
 *
 * The name and the agency are two links to two different pages, 24px and 20px
 * tall, stacked - twelve targets under the minimum on a six-agent page, and
 * close enough together to mis-tap. Each gets a 44px box; the text stays on
 * one line, centred in it.
 * ------------------------------------------------------------------------ */

.state-agent-name,
.state-agent-agency {
  display: flex;
  align-items: center;
  min-height: 44px;
}

/* They are stacked, so collapse the gap the two 44px boxes would otherwise
 * open up between the name and the agency. */
.state-agent-agency { margin-top: 0; }


/* ---------------------------------------------------------------------------
 * The one button that carries each funnel step.
 *
 * Measured at 390px on the live funnel: the Next button on /processing/ and
 * the "Get my matches" link on /teaser/ both render 40px tall. funel-d.css
 * gives .primary-button padding: 0.5rem 2rem, and 8 + 24 + 8 is 40. These are
 * the single control on their page - the only thing a client can do there -
 * and they were the smallest targets in the funnel.
 * ------------------------------------------------------------------------ */

.primary-button {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* #nextBtn carries Bootstrap's p-0, so padding on the button does nothing;
 * the link inside it is what a thumb actually lands on, so it takes the box. */
#nextBtn > a {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2rem;
  width: 100%;
}

#nextBtn { align-items: stretch; }


/* The country-code select on /create/ sat at 42px inside a 44px wrapper,
 * while the mobile number beside it is 48px. */
#countryCode { height: 48px !important; }


/* ---------------------------------------------------------------------------
 * "Surrounding Suburbs" on /states/ and /cities/.
 *
 * A 13px checkbox with the label text beside it: the smallest thing to hit in
 * the funnel, and the label - which is correctly wired to it - is only as tall
 * as one line of text. The row becomes a 44px band and the box itself 20px.
 * ------------------------------------------------------------------------ */

#group1 {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

#group1 + label {
  min-height: 44px;
  display: flex;
  align-items: center;
}


/* The topped-up agents on a state page print the states they actually cover.
 * On a page headed "buyers agents in NT" that label is the whole reason they
 * can be shown at all, so it has to be legible, not a footnote. */
.state-agent-covers {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(156, 29, 94, 0.08);
  color: #9c1d5e;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.state-agents-heading-more {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}


/* ---------------------------------------------------------------------------
 * Two things the 44px tap-target rules above broke. Both found by Ryan on a
 * real handset, both measured at 390px before and after.
 *
 * 1. Subscribe. The rule further up gives every `footer a` min-height 44px and
 *    display: flex. The Subscribe button is an <a> inside the footer, so it
 *    caught that too: flex with no justify-content made it a 342px-wide white
 *    bar, and the text sat hard left behind its 50px of padding, still
 *    underlined like the ordinary footer links beside it. It needs the 44px
 *    box, so the rule stays - it just has to be a button, centred and not
 *    underlined. .btn-subscribe outranks `footer a` on specificity.
 *
 * 2. The add button on the suburb row. Making the select full width left no
 *    room beside it, so the button wrapped onto its own line, flush left and
 *    square-cornered. Its wrapper becomes a flex row: the select takes the
 *    space that is left, the button keeps its own width, both 48px.
 * ------------------------------------------------------------------------ */

.btn-subscribe {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 40px;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
}

.btn-subscribe:hover,
.btn-subscribe:focus-visible {
  text-decoration: none;
}

.btn-subscribe:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* The gradient panel around it is a fixed 500x145. Below that width the box
 * overflows its own content as soon as the heading wraps to a third line. */
@media (max-width: 560px) {
  .border-contactus {
    width: 100% !important;
    height: auto !important;
    padding-bottom: 18px !important;
  }
}


.suburbs-select > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Select2 writes width:100% inline on its own container, so this has to be
 * !important to hand the sizing back to flex. */
.suburbs-select .select2-container {
  flex: 1 1 auto;
  width: auto !important;
  min-width: 0;
}

/* funel-d.css squares the widget off with border-radius: 0 !important, which
 * now reads as a mismatch next to the rounded button and the rounded card. */
.select2-container .select2-selection--single {
  border-radius: 8px !important;
}

#addBtnareas {
  flex: 0 0 auto;
  width: 76px !important;
  height: 48px !important;
  border-radius: 8px !important;
  text-transform: capitalize;
  font-weight: 600;
}
