/* ==========================================================================
   Newsletter & webinars band
   --------------------------------------------------------------------------
   Full-bleed light teal, matching the pale green band in the client mock-up.
   This is the brand's Light Teal at 40% over white (--color-surface-cool),
   which is the tint the palette approves for a ground carrying body copy; the
   undiluted brand value is too dark behind text.

   The band is one row on a wide screen: icon, copy, form, then a rule and the
   webinars panel. Everything sits in the standard container so the envelope
   lines up with the logo above it and with every section heading below it.
   ========================================================================== */

.signup {
  background: var(--color-surface-cool);
  padding-block: var(--band-y);
}

.signup__inner {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: 1fr;
  align-items: center;
}

/* --- Icons ---------------------------------------------------------------- */

/* No circle. It was drawn as an outlined disc to echo the mock-up and read as
   a spare UI element on a tinted ground, so the icon now sits on its own.
   Both icons in this band share one size and one alignment rule, which is
   what keeps the two halves looking like a pair. */
/* Aligned to the START of the row, not centred in it. Centring looks right
   only while both halves happen to be the same height; the moment one of them
   gains a line the two icons sit at different heights and the band looks
   crooked. Anchored to the top they stay level whatever the copy does. The
   2px nudge lines the icon's optical centre up with the heading's cap height
   rather than with its line box. */
.signup__icon {
  display: block;
  flex: none;
  color: var(--color-heading);
  align-self: start;
}

/* As tall as the heading line plus the first line of the body beneath it,
   rather than as tall as one line of type. Derived from the two type scales
   it sits against so it tracks them. */
.signup__icon svg {
  display: block;
  stroke-width: 1.3;
  inline-size: calc(var(--lh-snug) * var(--fs-h6) + var(--lh-snug) * var(--fs-sm));
  block-size:  calc(var(--lh-snug) * var(--fs-h6) + var(--lh-snug) * var(--fs-sm));
}

/* --- Copy ----------------------------------------------------------------- */

.signup__copy { min-inline-size: 0; }

/* Both headings are --fs-h6, and the same size as each other.
   Measured at this container width: "Stay informed. Stay empowered." needs
   375px at --fs-h5 and "Live & On-Demand Webinars" needs 273px, against a row
   that has about 1150px to share with a 368px form. There is no way to fit
   both on one line at --fs-h5. At --fs-h6 they need 307px and 273px, which
   does fit, and matching sizes reads as a pair rather than as a main heading
   with a smaller one beside it.

   No text-wrap: balance either — it splits a heading into two even lines,
   which is the opposite of what a one-row band wants. */
.signup__heading {
  color: var(--color-heading);
  font-size: var(--fs-h6);
  line-height: var(--lh-snug);
  margin: 0 0 var(--sp-1);
}

.signup__body {
  color: var(--color-text);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  margin: 0;
  max-width: 42ch;
}

/* --- Form ----------------------------------------------------------------- */

.signup__form {
  display: flex;
  gap: var(--sp-2);
  align-items: stretch;
}

.signup__input {
  flex: 1 1 auto;
  min-inline-size: 0;
  /* 12px sides rather than 16px. The placeholder "Enter your email address"
     measures 187px and the input had 179px of content width, so it was being
     clipped mid-word. Trimming the padding is the cheaper fix: widening the
     form column instead pushes the heading beside it onto two lines, which
     costs more than it gains. */
  padding: var(--sp-3);
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--color-text);
  background: var(--color-surface);
  /* The control token, not the decorative divider: an input outline has to
     reach 3:1 for WCAG 1.4.11 and the divider token is 1.20:1. */
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-sm);
}

.signup__input::placeholder { color: var(--color-text-muted); }

.signup__input:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 1px;
}

.signup__submit {
  flex: none;
  white-space: nowrap;
}

.signup__notice {
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  margin: var(--sp-2) 0 0;
}

/* After a submit (inc/newsletter.php sends the visitor back with
   ?newsletter=). The thank-you takes the form's place; the error sits under
   the form in body colour so it is not mistaken for the grey small print. */
.signup__status {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  color: var(--color-heading);
  font-weight: var(--fw-semi);
}

.signup__notice--error { color: var(--color-text); }

/* Muted grey links fail contrast on the tint; the link inherits body colour. */
.signup__consent a {
  color: var(--color-text);
  text-decoration: underline;
}

/* The accent gold is measured against white, where it only just clears 4.5:1,
   so it fails on any tint. Tinted grounds use the darker variant — the
   measurements are recorded in tokens.css.

   Scoped to .signup deliberately. It was originally needed because a bare
   .signup__link ties with .link-accent in base.css and base.css won on order,
   back when these were block stylesheets printed before the theme's CSS. That
   order is now reversed, so the scoping is no longer load-bearing — it is kept
   because a section rule that beats a component rule should say so in the
   selector rather than depend on which file happens to load last. */
.signup .signup__link {
  color: var(--color-link-accent-on-warm);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin-block-start: var(--sp-2);
  font-weight: var(--fw-semi);
  font-size: var(--fs-sm);
}

.signup .signup__link:hover { color: var(--hpw-gold-800); }

/* --- Halves --------------------------------------------------------------- */

.signup__main,
.signup__aside {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--sp-3);
  align-items: center;
}

/* Same size as the newsletter heading; kept as its own rule so the two can
   diverge later without hunting for which one wins. */
.signup__heading--aside { font-size: var(--fs-h6); }

/* --- Stacked to one row --------------------------------------------------- */

@media (min-width: 40rem) {
  /* Form on its own row, aligned to the copy rather than to the icon, so the
     heading, the body line and the input share a left edge. */
  .signup__form,
  .signup__status { grid-column: 2; }
  .signup__notice { grid-column: 2; }
}

@media (min-width: 66rem) {
  /* Wide enough for one row. Stacked, this band runs to about 300px; in a
     single row it is closer to 150px, which is the mock-up's proportion. */
  .signup__main {
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 24rem);
    column-gap: var(--sp-5);
  }

  .signup__form,
  .signup__status {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
  }

  .signup__notice { grid-column: 2 / -1; }
}

@media (min-width: 72rem) {

  /* Stretch the two halves to equal height and start their content at the top
     of each. Centred, the shorter half floats down by half the difference and
     the two icons end up 8px out of line — small enough to look like sloppy
     work rather than a choice. Stretching also lets the rule between them run
     the full height of the band. */
  .signup--split .signup__inner { align-items: stretch; }
  .signup--split .signup__main,
  .signup--split .signup__aside { align-content: start; }

  /* The webinars half is given a width rather than a share, and the
     newsletter half takes what is left. Fractions were the wrong tool here:
     every adjustment to one half moved the other, and the two kept trading a
     wrapped heading back and forth.

     These numbers come from measuring, not from taste. At a 1280px container
     there is no arrangement where both headings stay on one line AND the
     email input has room for its placeholder — the content is simply wider
     than the row. Given that, the newsletter heading keeps its single line,
     because it is the one sitting next to the form, and "Live & On-Demand
     Webinars" is allowed two. The icons stay level either way, since each is
     anchored to the top of its own half rather than centred in it. */
  .signup--split .signup__inner {
    grid-template-columns: minmax(0, 1fr) minmax(0, 23rem);
    gap: clamp(var(--sp-5), 3vw, var(--sp-7));
  }

  /* A hairline between the two halves. Decorative only — the band still reads
     correctly as two things without it.

     NOT --color-divider: that token is #E5E5E9 and effectively vanishes
     against a tinted ground, so the rule was being drawn and simply not
     showing up. */
  .signup--split .signup__aside {
    border-inline-start: 1px solid var(--color-border);
    padding-inline-start: clamp(var(--sp-4), 2.2vw, var(--sp-5));
  }
}

/* --- Phones ---------------------------------------------------------------
   Below 40rem the form had no column of its own, so the grid put it in the
   icon's column. That column grew to the width of the form and squeezed the
   heading into the space left over: one letter per line at 390px. The form,
   note and link now run the full width under the icon and heading. */
@media (max-width: 39.99rem) {
  .signup__form,
  .signup__status,
  .signup__notice { grid-column: 1 / -1; }
  .signup__inner { gap: var(--sp-5); }
  .signup--split .signup__aside {
    padding-block-start: var(--sp-5);
    border-block-start: 1px solid var(--color-border);
  }
}

@media (max-width: 24rem) {
  .signup__form { flex-wrap: wrap; }
  .signup__submit { flex: 1 1 100%; }
}
