/**
 * BITS Perth Device Intake — styling.
 * Inherits the theme's palette through custom properties rather than
 * hard-coding a second set of brand colours.
 */

.bits-intake {
  --bi-navy:   var(--b-navy,   #0a1628);
  --bi-blue:   var(--b-blue,   #1565c0);
  --bi-gray:   var(--b-gray,   #6b7280);
  --bi-border: var(--b-border, #e5e7eb);
  --bi-light:  var(--b-light,  #f4f7fb);
  --bi-radius: var(--b-radius, 14px);
  margin-inline: auto;
}

/*
 * Width handling.
 *
 * Normally the shortcode sits inside a constrained group block, which
 * already gives it the theme's 820px content width - matching every other
 * section on the site, including the existing quote form. Nothing to do
 * in that case.
 *
 * But if someone drops [bits_intake_form] straight onto a bare page, it
 * becomes a direct child of .entry-content, where the theme's
 * `.entry-content > *:not(.alignfull)... { max-width: 100% }` rule applies
 * and the form stretches the full 1355px. That rule is two classes deep,
 * so a bare `.bits-intake { max-width }` loses to it. Matching the same
 * shape here wins on specificity without resorting to !important.
 */
.entry-content > .bits-intake,
.wp-block-post-content > .bits-intake {
  max-width: var(--wp--style--global--content-size, 820px);
  margin-inline: auto;
}

/* --- Groups ------------------------------------------------------------ */

.bits-intake-group {
  border: 1px solid var(--bi-border);
  border-radius: var(--bi-radius);
  padding: 1.5rem;
  margin: 0 0 1.5rem;
  background: #fff;
}

.bits-intake-group > legend {
  padding: 0 .6rem;
  font-family: var(--wp--preset--font-family--heading, inherit);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--bi-navy);
}

.bits-intake-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem;
}

.bits-intake-field--full { grid-column: 1 / -1; }

.bits-intake-field { display: flex; flex-direction: column; }

.bits-intake-field label {
  font-weight: 600;
  font-size: .9rem;
  color: var(--bi-navy);
  margin-bottom: .4rem;
}

.bits-intake-req { color: #b32d2e; }

.bits-intake-field input,
.bits-intake-field select,
.bits-intake-field textarea {
  width: 100%;
  padding: .7rem .85rem;
  border: 1px solid var(--bi-border);
  border-radius: 10px;
  font: inherit;
  font-size: .95rem;
  color: var(--bi-navy);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}

.bits-intake-field input:focus,
.bits-intake-field select:focus,
.bits-intake-field textarea:focus {
  outline: none;
  border-color: var(--bi-blue);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, .15);
}

.bits-intake-field textarea { resize: vertical; min-height: 96px; }

.bits-intake-hint {
  margin-top: .35rem;
  font-size: .8rem;
  color: var(--bi-gray);
  line-height: 1.5;
}

/* --- The ACL repair notice --------------------------------------------- */

/*
 * The ACCC requires this notice to be "easy to see" and "clearly set apart"
 * from the rest of the document. The amber panel and heavy left rule are
 * doing compliance work, not decoration - don't flatten them into the
 * surrounding card styling.
 */
.bits-intake-notice {
  border: 1px solid #f0d48a;
  border-left: 5px solid #e3a008;
  border-radius: var(--bi-radius);
  background: #fffbeb;
  padding: 1.5rem 1.6rem;
  margin: 0 0 1.5rem;
}

.bits-intake-notice h3 {
  margin: 0 0 .35rem !important;
  font-size: 1.15rem !important;
  color: #7a4f01;
  letter-spacing: .01em;
}

.bits-intake-notice-lede {
  margin: 0 0 1rem !important;
  font-weight: 700;
  font-size: .9rem !important;
  color: #7a4f01;
}

/* Same theme-decoration reset as the agreement box, for the same reason. */
.bits-intake .bits-intake-notice p {
  background: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 0 .85rem !important;
  font-size: .92rem !important;
  line-height: 1.65;
  color: #4a3400;
  max-width: none !important;
  text-align: left !important;
}

.bits-intake .bits-intake-notice p::before,
.bits-intake .bits-intake-notice p::after {
  content: none !important;
  display: none !important;
}

.bits-intake .bits-intake-notice p:last-child { margin-bottom: 0 !important; }

/* --- The agreement ------------------------------------------------------ */

.bits-intake-terms {
  border: 1px solid var(--bi-border);
  border-radius: var(--bi-radius);
  background: #fff;
  padding: 1.5rem;
  margin: 0 0 1.5rem;
}

.bits-intake-terms h3 {
  margin: 0 0 1rem !important;
  font-size: 1.15rem !important;
  color: var(--bi-navy);
}

/* Scrollable so the form stays navigable, but the full text is present on
   the page rather than hidden behind a link. */
.bits-intake-terms-scroll {
  max-height: 340px;
  overflow-y: auto;
  padding: 1rem 1.2rem;
  background: var(--bi-light);
  border: 1px solid var(--bi-border);
  border-radius: 10px;
}

.bits-intake-terms-scroll:focus-visible {
  outline: 2px solid var(--bi-blue);
  outline-offset: 2px;
}

/*
 * The theme styles h4 + following paragraph as an FAQ accordion card:
 * white panel, 14px radius, ~50px left padding and a decorative ::before
 * bullet. Inside the agreement that reads as a stack of broken cards, so
 * the decoration is stripped back here. These overrides need !important
 * because the theme's own rules carry it.
 */
.bits-intake .bits-intake-terms-scroll h4,
.bits-intake .bits-intake-terms-scroll p {
  background: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.bits-intake .bits-intake-terms-scroll h4::before,
.bits-intake .bits-intake-terms-scroll h4::after,
.bits-intake .bits-intake-terms-scroll p::before,
.bits-intake .bits-intake-terms-scroll p::after {
  content: none !important;
  display: none !important;
}

.bits-intake .bits-intake-terms-scroll h4 {
  margin: 1.25rem 0 .3rem !important;
  font-size: .92rem !important;
  font-weight: 700;
  color: var(--bi-navy);
}

.bits-intake .bits-intake-terms-scroll h4:first-child { margin-top: 0 !important; }

.bits-intake .bits-intake-terms-scroll p {
  margin: 0 !important;
  font-size: .88rem !important;
  line-height: 1.65;
  color: #374151;
  max-width: none !important;
  text-align: left !important;
}

.bits-intake-version {
  margin: .75rem 0 0 !important;
  font-size: .78rem !important;
  color: var(--bi-gray);
}

/* --- Consents ----------------------------------------------------------- */

.bits-intake-check {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .9rem 1rem;
  border: 1px solid var(--bi-border);
  border-radius: 10px;
  margin-bottom: .75rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.bits-intake-check:hover { border-color: var(--bi-blue); background: var(--bi-light); }
.bits-intake-check:last-child { margin-bottom: 0; }

.bits-intake-check input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: .1rem;
  accent-color: var(--bi-blue);
}

.bits-intake-check span {
  font-size: .88rem;
  line-height: 1.6;
  color: var(--bi-navy);
}

/* The marketing opt-in is visually separated so it never reads as part of
   the mandatory set. Consent has to look optional to be optional. */
.bits-intake-check--optional {
  margin-top: 1.25rem;
  border-style: dashed;
  background: #fafafa;
}

.bits-intake-check--optional span { color: var(--bi-gray); }

/* --- Submit ------------------------------------------------------------- */

.bits-intake-submit {
  display: block;
  width: 100%;
  padding: 1rem 1.5rem;
  border: 0;
  border-radius: 10px;
  background: var(--bi-blue);
  color: #fff;
  font-family: var(--wp--preset--font-family--heading, inherit);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: background .15s, transform .15s;
}

.bits-intake-submit:hover { background: var(--bi-navy); transform: translateY(-1px); }
.bits-intake-submit:focus-visible { outline: 3px solid rgba(21,101,192,.4); outline-offset: 2px; }

.bits-intake-foot {
  margin: 1rem 0 0 !important;
  text-align: center;
  font-size: .8rem !important;
  color: var(--bi-gray);
}

/* --- Messages ----------------------------------------------------------- */

.bits-intake-done {
  border: 1px solid #a7d8b0;
  border-left: 5px solid #1a7f37;
  border-radius: var(--bi-radius);
  background: #f0f9f2;
  padding: 1.75rem;
}

.bits-intake-done h3 { margin: 0 0 .6rem !important; color: #12591f; }
.bits-intake-done p  { margin: 0 0 .6rem !important; font-size: .95rem !important; }
.bits-intake-done p:last-child { margin-bottom: 0 !important; }

.bits-intake-error {
  border: 1px solid #f0b4b4;
  border-left: 5px solid #b32d2e;
  border-radius: var(--bi-radius);
  background: #fdf2f2;
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.5rem;
  font-size: .92rem;
  color: #7a1c1d;
}

/* --- Honeypot ----------------------------------------------------------- */

/* Off-screen rather than display:none — some bots skip hidden inputs. */
.bits-intake-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --- Responsive --------------------------------------------------------- */

@media (max-width: 700px) {
  .bits-intake-grid { grid-template-columns: 1fr; }
  .bits-intake-group { padding: 1.15rem; }
  .bits-intake-notice { padding: 1.2rem 1.25rem; }
  .bits-intake-terms-scroll { max-height: 280px; padding: .9rem 1rem; }
}
