/*
 * Ignition Join Us earnings calculator – styles.
 * Brand colour is Ignition navy; the rest are neutral. Override tokens in the theme if needed.
 * Everything is scoped under .iec (the calculator) or .iec-form (an enquiry form placed outside it,
 * via html_class="iec-form" on the CF7 shortcode) so it does not leak into, or depend on, the theme.
 */
.iec, .iec-form {
  --iec-brand: #0b2b54;          /* Ignition navy: total figure, slider fill, focus ring */
  --iec-brand-contrast: #ffffff;
  --iec-accent: #e04264;         /* Ignition coral: "I want to know more" button */
  --iec-text: #1d1d1f;
  --iec-text-muted: #5b5b60;
  --iec-surface: #ffffff;
  --iec-surface-alt: #f0f2f5;
  --iec-border: #d4d7dd;
  --iec-track: #d9dce2;
  --iec-radius: 8px;
  --iec-font: inherit;
  --iec-gap: 24px;
  --iec-sticky-top: 24px;        /* results panel offset on wide screens; raise it to clear a fixed site header */

  color: var(--iec-text);
  font-family: var(--iec-font);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  margin-bottom: 3rem;
  padding: 3rem;
  background: #eeeeee;
  border-radius: var(--iec-radius);
}
@media (max-width: 599px) { .iec, .iec-form { padding: 16px; } }
.iec *, .iec *::before, .iec *::after, .iec-form *, .iec-form *::before, .iec-form *::after { box-sizing: border-box; }

/* ---------- Intro at the top of the calculator ---------- */
.iec-intro { margin: 0 0 var(--iec-gap); }
.iec-intro__heading {
  margin: 0 0 8px; padding: 0;
  font-family: inherit; font-size: 24px; font-weight: 600; line-height: 1.3; letter-spacing: normal; text-transform: none;
  color: var(--iec-text);
}
.iec-intro__text { margin: 0; max-width: 65ch; }

/* ---------- Suitability tick boxes ---------- */
.iec-suitability {
  margin: 0 0 var(--iec-gap);
  padding: 20px;
  border: 0;
  border-radius: var(--iec-radius);
  background: var(--iec-surface);
}
/* Floated so the legend sits inside the box as a title rather than on the border */
.iec-suitability__legend { float: left; width: 100%; padding: 0; font-size: 20px; font-weight: 600; line-height: 1.3; }
.iec-suitability__hint { clear: both; margin: 0; padding-top: 4px; font-size: 14px; color: var(--iec-text-muted); }
.iec-suitability__options { display: grid; gap: 10px 24px; grid-template-columns: 1fr; margin-top: 12px; }
@media (min-width: 720px) { .iec-suitability__options { grid-template-columns: 1fr 1fr; } }
.iec-check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.iec-check input { margin: 4px 0 0; width: 18px; height: 18px; flex: none; accent-color: var(--iec-brand); }

/* Phones: options collapse behind a toggle so the sliders are reachable quickly. The toggle and the
   collapsed state only exist once calculator.js has run (it adds --js), so without JS everything shows. */
.iec-suitability__toggle { display: none; }
@media (max-width: 599px) {
  .iec-suitability--js .iec-suitability__toggle {
    display: inline-flex; align-items: center; gap: 8px; margin: 12px 0 0; padding: 8px 0;
    border: 0; background: none; cursor: pointer;
    font: inherit; font-weight: 600; color: var(--iec-brand);
  }
  .iec-suitability__toggle::after {
    content: ""; width: 8px; height: 8px; margin-top: -4px;
    border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg);
  }
  .iec-suitability__toggle[aria-expanded="true"]::after { margin-top: 4px; transform: rotate(-135deg); }
  .iec-suitability__toggle:focus-visible { outline: 3px solid color-mix(in srgb, var(--iec-brand) 40%, transparent); outline-offset: 2px; }
  .iec-suitability--js.is-collapsed .iec-suitability__options { display: none; }
}

/* ---------- Layout: inputs | results ---------- */
.iec-main { display: grid; gap: var(--iec-gap); grid-template-columns: 1fr; }
@media (min-width: 900px) {
  /* Both panels stretch to the same height; the results inside the panel stay in view while scrolling */
  .iec-main { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .iec-output__inner { position: sticky; top: var(--iec-sticky-top); }
}
.iec-inputs, .iec-output {
  padding: 20px 16px;
  border-radius: var(--iec-radius);
  background: var(--iec-surface);
}

@media (min-width: 600px) { .iec-inputs, .iec-output { padding: 24px; } }

/* ---------- Slider fields ---------- */
.iec-field + .iec-field { margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--iec-border); }
.iec-field__head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.iec-field__label { flex: 1 1 220px; font-weight: 600; }
.iec-field__box {
  display: flex; align-items: center; gap: 6px;
  padding: 0 12px;
  border: 1px solid var(--iec-border);
  border-radius: 6px;
  background: var(--iec-surface);
}
.iec-field__box:focus-within { border-color: var(--iec-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--iec-brand) 25%, transparent); }
.iec-field__box input {
  width: 6.5em; margin-bottom: 0; padding: 8px 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-weight: 600; text-align: right; color: var(--iec-text);
}
.iec-field__box--money input { width: 7.5em; }
.iec-field__unit, .iec-field__prefix { color: var(--iec-text-muted); }
.iec-field__help { margin: 8px 0 0; font-size: 14px; color: var(--iec-text-muted); }

/* Range: filled track to the left of the thumb, driven by --iec-fill from calculator.js */
.iec-range {
  --iec-fill: 0%;
  width: 100%; height: 28px; margin: 0; background: transparent;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
.iec-range::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(to right, var(--iec-brand) var(--iec-fill), var(--iec-track) var(--iec-fill));
}
.iec-range::-moz-range-track { height: 6px; border-radius: 3px; background: var(--iec-track); }
.iec-range::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--iec-brand); }
.iec-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; margin-top: -8px; border-radius: 50%;
  background: var(--iec-surface); border: 3px solid var(--iec-brand);
}
.iec-range::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--iec-surface); border: 3px solid var(--iec-brand);
}
.iec-range:focus { outline: none; }
.iec-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--iec-brand) 30%, transparent); }
.iec-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--iec-brand) 30%, transparent); }

/* Touch screens: bigger thumb and a taller hit area */
@media (pointer: coarse) {
  .iec-range { height: 44px; }
  .iec-range::-webkit-slider-thumb { width: 28px; height: 28px; margin-top: -11px; }
  .iec-range::-moz-range-thumb { width: 22px; height: 22px; }
}

/* ---------- Results ---------- */
.iec-results { margin: 0; }
.iec-results__row {
  display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--iec-border);
}
.iec-results__row:first-child { padding-top: 0; }
.iec-results dt { font-size: 16px; font-weight: 400; color: var(--iec-text); }
.iec-results dd { margin: 0; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.iec-results__row:not(.iec-results__row--total) { flex-wrap: nowrap; }
.iec-results__row--total { border-bottom: 0; padding-bottom: 0; }
.iec-results__row--total dt { font-size: 20px; font-weight: 600; line-height: 1.3; }
.iec-results__row--total dd { font-size: 36px; font-weight: 700; color: var(--iec-brand); line-height: 1.2; transform-origin: left center; }

/* "I want to know more": scrolls to the enquiry form. Hidden unless calculator.js finds a form on the page. */
.iec-cta {
  display: block; width: 100%; margin: 20px 0 0; padding: 12px 24px;
  border: 0; border-radius: 6px; cursor: pointer;
  background: var(--iec-accent); color: #ffffff;
  font: inherit; font-weight: 600; text-align: center; text-transform: none; letter-spacing: normal;
}
.iec-cta[hidden] { display: none; }
.iec-cta:hover { background: var(--iec-accent); color: #ffffff; filter: brightness(1.1); }
.iec-cta:focus-visible { outline: 3px solid color-mix(in srgb, var(--iec-accent) 40%, transparent); outline-offset: 2px; }

/* Brief pulse on the total when it changes (added by calculator.js) */
@keyframes iec-pulse { from { transform: scale(1.06); } to { transform: none; } }
.iec-flash { animation: iec-pulse 0.3s ease-out; }

/* Phones and tablets: fixed bar repeating the total while the sliders are on screen and the
   results are not. Shown by calculator.js (is-visible). Hidden from screen readers: the results list is the live region. */
.iec-bar { display: none; }
@media (max-width: 899px) {
  .iec-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--iec-surface); border-top: 1px solid var(--iec-border);
    box-shadow: 0 -4px 16px rgb(0 0 0 / 0.08);
    transform: translateY(calc(100% + 24px)); transition: transform 0.2s ease-out;
  }
  .iec-bar.is-visible { transform: none; }
}
.iec-bar__label { font-size: 14px; line-height: 1.3; color: var(--iec-text-muted); }
.iec-bar__value { font-size: 24px; font-weight: 700; color: var(--iec-brand); font-variant-numeric: tabular-nums; white-space: nowrap; transform-origin: right center; }

@media (prefers-reduced-motion: reduce) {
  .iec-flash { animation: none; }
  .iec-bar { transition: none; }
}
.iec-caveats { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--iec-border); font-size: 13px; color: var(--iec-text-muted); }
.iec-caveats p { margin: 0 0 8px; }
.iec-caveats p:last-child { margin-bottom: 0; }

/* ---------- Enquiry form (also styles CF7 output inside .iec) ---------- */
.iec-enquiry {
  margin-top: var(--iec-gap); padding: 24px;
  border: 1px solid var(--iec-border); border-radius: var(--iec-radius); background: var(--iec-surface-alt);
}
.iec-enquiry__heading { margin: 0 0 16px; font-size: 24px; }
.iec-enquiry p { margin: 0 0 16px; }
.iec-form-grid { display: grid; gap: 0 20px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .iec-form-grid { grid-template-columns: 1fr 1fr; } }
.iec-enquiry label { font-weight: 600; }
.iec-enquiry input[type="text"], .iec-enquiry input[type="email"], .iec-enquiry input[type="tel"], .iec-enquiry select, .iec-enquiry textarea {
  width: 100%; margin-top: 4px; padding: 10px 12px;
  border: 1px solid var(--iec-border); border-radius: 6px; background: var(--iec-surface);
  font: inherit; font-weight: 400; color: var(--iec-text);
}
.iec-enquiry .iec-field__help { display: block; margin-top: 6px; font-weight: 400; }
.iec-enquiry .wpcf7-form-control-wrap { display: block; }
.iec-enquiry .wpcf7-not-valid-tip { margin-top: 4px; font-size: 14px; color: #b3261e; }
.iec-enquiry input:focus-visible, .iec-enquiry select:focus-visible, .iec-enquiry textarea:focus-visible, .iec-check input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--iec-brand) 40%, transparent); outline-offset: 1px;
}
.iec-req { color: #b3261e; }
.iec-enquiry input[type="submit"] {
  padding: 12px 28px; border: 0; border-radius: 6px; cursor: pointer;
  background: var(--iec-brand); color: var(--iec-brand-contrast); font: inherit; font-weight: 600;
}
.iec-enquiry input[type="submit"]:hover { filter: brightness(1.1); }
.iec-enquiry .wpcf7-response-output { margin: 0; padding: 12px 16px; border-radius: 6px; background: var(--iec-surface); border: 1px solid var(--iec-border); }

/* ---------- Enquiry form outside the calculator ----------
   .iec-form goes on the CF7 form (html_class="iec-form" on the shortcode) or on a wrapper div inside
   the CF7 form markup. Shares the calculator's tokens and grey card (see the top of this file).
   Field selectors include .row so they outrank the theme's .gt3-wpcf7-subscribe-style rules.
   Layout assumes the form markup in cf7/form-template.txt: a .row with one .span12 per field. */
.iec-form { max-width: none; }
/* Title and intro at the top of the form: plain <h2> and <p> or the classes below. Matches .iec-intro */
.iec-form__heading, .iec-form > h2 {
  margin: 0 0 8px; padding: 0;
  font-family: inherit; font-size: 24px; font-weight: 600; line-height: 1.3; letter-spacing: normal; text-transform: none;
  color: var(--iec-text);
}
.iec-form__text, .iec-form > h2 + p { margin: 0 0 var(--iec-gap); max-width: 65ch; font-size: 16px; line-height: 1.5; color: var(--iec-text); }.iec-form .row { display: grid; grid-template-columns: 1fr; gap: 16px 20px; width: auto; margin: 0; }
.iec-form .row::before, .iec-form .row::after { display: none; }
@media (min-width: 720px) {
  .iec-form .row { grid-template-columns: 1fr 1fr; }
  /* Name, email, phone and practice area pair up; the question, message and button run full width */
  .iec-form .row > :nth-child(n+5) { grid-column: 1 / -1; }
}
.iec-form .span12 { width: auto; margin: 0; padding: 0; float: none; }
.iec-form .row p { margin: 0; }
.iec-form .span12 br { display: none; }
/* Take CF7's spinner out of the layout so it adds no space; it shows just under the button while sending */
.iec-form .wpcf7-spinner { position: absolute; margin: 12px 0 0 12px; }
.iec-form .wpcf7-form-control-wrap { display: block; }

.iec-form .row input[type="text"],
.iec-form .row input[type="email"],
.iec-form .row input[type="tel"],
.iec-form .row select,
.iec-form .row textarea {
  display: block; width: 100%; height: auto; margin: 0; padding: 10px 12px;
  border: 1px solid var(--iec-border); border-radius: 6px; box-shadow: none;
  /* !important only because the theme's .gt3-wpcf7-subscribe-style sets background-color: transparent !important */
  background-color: var(--iec-surface) !important;
  font: inherit; font-weight: 400; line-height: 1.5; color: var(--iec-text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.iec-form .row textarea { height: 140px; resize: vertical; }
.iec-form .row select {
  -webkit-appearance: none; appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235b5b60' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.iec-form .row input::placeholder, .iec-form .row textarea::placeholder { color: var(--iec-text-muted); opacity: 1; }
.iec-form .row input:focus, .iec-form .row select:focus, .iec-form .row textarea:focus {
  outline: none; border-color: var(--iec-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--iec-brand) 25%, transparent);
}
.iec-form .iec-field__help { display: block; margin: 6px 0 0; font-size: 14px; line-height: 1.5; color: var(--iec-text-muted); }

.iec-form .row input.wpcf7-submit[type="submit"] {
  width: auto; min-width: 220px; height: auto; margin: 8px 0 0; padding: 12px 28px;
  border: 0; border-radius: 6px; cursor: pointer;
  background: var(--iec-brand); color: var(--iec-brand-contrast);
  font: inherit; font-weight: 600; text-transform: none; letter-spacing: normal;
}
.iec-form .row input.wpcf7-submit[type="submit"]:hover { background: var(--iec-brand); color: var(--iec-brand-contrast); filter: brightness(1.25); }
.iec-form .row input.wpcf7-submit[type="submit"]:focus-visible { outline: 3px solid color-mix(in srgb, var(--iec-brand) 40%, transparent); outline-offset: 2px; }

.wpcf7 .iec-form span.wpcf7-not-valid-tip { margin: 4px 0 0; padding: 0; background: none; font-size: 14px; color: #b3261e; }
/* CF7's response message sits outside a wrapper div, so also match it next to one */
.wpcf7 .iec-form .wpcf7-response-output,
.wpcf7 .wpcf7-form:has(> .iec-form) > .wpcf7-response-output {
  margin: 20px 0 0; padding: 12px 16px; border: 1px solid var(--iec-border); border-radius: 6px; background: var(--iec-surface);
}
