/* =============================================================================================
   Church email setup form (templates/church-email-form.php, assets/js/church-email-form.js)

   Mobile first; every rule is scoped under #cef so nothing leaks into the site chrome and the
   Webflow export cannot restyle the form. Enqueued with 'oc-custom' as a dependency, so ties
   on specificity are won by load order.

   Accessibility floor kept here: 16px text in inputs (iOS zooms the page on focus below 16px),
   44px minimum targets, 3:1 borders on controls, visible error states that do not rely on
   colour alone (every error also has text), and reduced motion honoured.
   ============================================================================================= */

#cef {
  max-width: 820px;
  margin: 0 auto;
  font-size: 16px;
  line-height: 1.6;
  overflow-wrap: break-word;
}

/* Webflow utility classes can set display on elements that carry [hidden]; the attribute must
   always win, because the script shows exactly one state at a time by toggling it. */
#cef [hidden] {
  display: none !important;
}

/* header.php adds .w-mod-js before the body renders. Without it the script cannot run, so the
   "Loading" message would be a lie; the <noscript> notice speaks instead. */
html:not(.w-mod-js) #cef [data-cef-state="loading"] {
  display: none !important;
}

/* The theme's .screen-reader-text is not relied on: this page must not depend on oc-custom.css
   keeping that class. */
#cef .cef-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- Headings and prose -------------------------------------------------------------------- */

#cef .cef-h2 {
  margin: 0 0 12px;
  font-size: 26px;
  line-height: 1.3;
  color: #003a5d;
}

#cef .cef-h3,
#cef .cef-legend {
  margin: 0 0 10px;
  font-size: 20px;
  line-height: 1.35;
  color: #003a5d;
}

#cef h4.cef-legend {
  font-size: 17px;
}

/* Headings that receive focus programmatically show the ring only for keyboard-driven moves. */
#cef [data-cef-focus]:focus {
  outline: none;
}

#cef [data-cef-focus]:focus-visible {
  outline: 2px solid #0066cc;
  outline-offset: 4px;
}

#cef p {
  margin: 0 0 12px;
}

/* Links in running text: the Email FAQ and Email Use Policy the first question asks people to
   read, support@, and the MX text's own links. The export's light blue is 3.8:1 on white and
   told from the text by colour alone, so they are darker (11.9:1) and underlined, like the
   note's link below. */
#cef p a,
#cef .cef-prose a {
  color: #003a5d;
  text-decoration: underline;
}

#cef .cef-intro {
  margin-bottom: 18px;
}

#cef .cef-for {
  font-size: 20px;
  line-height: 1.4;
}

#cef .cef-hint {
  color: #4a5560;
  font-size: 15px;
}

#cef .cef-optional {
  font-weight: 400;
  color: #4a5560;
}

#cef .cef-required-note {
  color: #4a5560;
  font-size: 15px;
}

#cef .cef-next {
  margin: 14px 0 0;
  padding: 10px 12px;
  background: #f3f7fa;
  border-left: 4px solid #003a5d;
  border-radius: 4px;
}

/* A standing note under a field (the NINJIO list's "keep it up to date"), styled like .cef-next. */
#cef .cef-note {
  margin: 10px 0 0;
  padding: 10px 12px;
  font-size: 15px;
  background: #f3f7fa;
  border-left: 4px solid #003a5d;
  border-radius: 4px;
}

/* Its link is what the note asks people to use: the export's light blue is 3.6:1 on the tint
   and told from the text by colour alone, so it is darker (11:1) and underlined. */
#cef .cef-note a {
  color: #003a5d;
  text-decoration: underline;
}

#cef .cef-addresses {
  margin: 0 0 12px;
  padding-left: 22px;
}

#cef .cef-addresses li {
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* The MX text comes from OC_CDF_MX_Conditions::render_html(): headings, paragraphs and lists. */
#cef .cef-prose h4,
#cef .cef-prose h5 {
  margin: 18px 0 8px;
  font-size: 17px;
  line-height: 1.4;
  color: #1f2a33;
}

#cef .cef-prose ul {
  margin: 0 0 12px;
  padding-left: 22px;
}

#cef .cef-prose li {
  margin-bottom: 6px;
}

/* --- Cards and fieldsets ------------------------------------------------------------------- */

#cef fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

/* A floated legend sits inside its card like a heading instead of notching the border. */
#cef legend {
  float: left;
  width: 100%;
  margin: 0;
  padding: 0;
}

#cef legend + * {
  clear: both;
}

#cef .cef-card {
  margin: 18px 0;
  padding: 16px;
  border: 1px solid #d5dce2;
  border-radius: 10px;
  background: #fff;
}

#cef .cef-sub {
  margin: 20px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid #e3e8ec;
}

#cef .cef-noscript {
  border-color: #c0392b;
}

/* --- Option cards -------------------------------------------------------------------------- */

#cef .cef-option-card {
  margin: 10px 0;
  border: 1px solid #b8c3cc;
  border-radius: 10px;
  background: #fff;
}

#cef .cef-option-card.is-selected {
  border-color: #003a5d;
  box-shadow: 0 0 0 1px #003a5d;
  background: #f3f7fa;
}

#cef .cef-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-height: 44px;
  padding: 14px;
  cursor: pointer;
}

#cef .cef-option-text strong {
  display: block;
  color: #003a5d;
}

#cef .cef-option-sub {
  display: block;
  margin-top: 4px;
  color: #4a5560;
  font-size: 15px;
}

/* --- Disclosures --------------------------------------------------------------------------- */

#cef details {
  margin: 0;
}

#cef .cef-mx-preview {
  border-top: 1px solid #e3e8ec;
  padding: 0 14px;
}

#cef summary {
  min-height: 44px;
  padding: 11px 0;
  cursor: pointer;
  font-weight: 600;
  color: #0059b3;
}

#cef .cef-mx-preview-body {
  padding: 0 0 14px;
}

#cef .cef-mx-version {
  color: #4a5560;
  font-size: 15px;
}

#cef .cef-mx-intro {
  margin: 20px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid #e3e8ec;
}

/* Each section of the agreement reads as its own block, with its "I agree" at the end. */
#cef .cef-mx-terms .cef-mx,
#cef .cef-mx-terms section {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid #e3e8ec;
  border-radius: 8px;
}

/* --- Fields -------------------------------------------------------------------------------- */

#cef .cef-field {
  margin: 0 0 14px;
}

/* The Webflow export styles every <label> as 14px bold at a 1.143em line height. Most labels
   here are whole sentences ("I understand that…"), so they read as body text instead. */
#cef label {
  margin: 0;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  color: inherit;
}

#cef .cef-label {
  display: block;
  margin: 0 0 6px;
  font-weight: 600;
  line-height: 1.4;
}

#cef input[type="text"],
#cef input[type="email"] {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  color: #1a1a1a;
  background: #fff;
  border: 1px solid #767676;
  border-radius: 8px;
}

/* The NINJIO address list (Option B): one address per line, so it only grows downwards. */
#cef textarea {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 12em;
  margin: 0;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  color: #1a1a1a;
  background: #fff;
  border: 1px solid #767676;
  border-radius: 8px;
  resize: vertical;
}

#cef input[type="text"]:disabled,
#cef input[type="email"]:disabled,
#cef textarea:disabled {
  background: #f2f4f6;
  color: #5c6670;
  border-color: #a9b2ba;
}

#cef input[type="checkbox"],
#cef input[type="radio"] {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  accent-color: #003a5d;
}

#cef .cef-check,
#cef .cef-radio {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-height: 44px;
  padding: 10px 0;
  cursor: pointer;
}

/* The MX class writes each "I agree" as <p class="cef-check"><label>…</label></p>: the
   paragraph is only a wrapper there, and the label is the tap target. */
#cef p.cef-check {
  display: block;
  min-height: 0;
  margin: 10px 0 0;
  padding: 0;
}

#cef p.cef-check > label {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-height: 44px;
  padding: 10px 0;
  font-weight: 600;
  cursor: pointer;
}

#cef .cef-field--check {
  margin: 0 0 4px;
}

#cef .cef-radios {
  margin: 0 0 6px;
}

/* Local part + "@domain" on one line where it fits; a long domain wraps under the input. */
#cef .cef-local {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

#cef .cef-local input[type="text"] {
  flex: 1 1 12em;
  width: auto;
  min-width: 0;
}

#cef .cef-at {
  font-weight: 600;
  overflow-wrap: anywhere;
}

#cef .cef-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 12px;
}

/* --- Errors ---------------------------------------------------------------------------------- */

#cef .cef-error {
  margin: 6px 0 0;
  color: #a8261b;
  font-weight: 600;
}

#cef input[aria-invalid="true"],
#cef textarea[aria-invalid="true"] {
  border-color: #c0392b;
  box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.25);
}

#cef input[type="checkbox"][aria-invalid="true"],
#cef input[type="radio"][aria-invalid="true"] {
  outline: 2px solid #c0392b;
  outline-offset: 2px;
  box-shadow: none;
}

#cef .cef-summary {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 2px solid #c0392b;
  border-radius: 10px;
  background: #fff6f5;
}

#cef .cef-summary:focus {
  outline: 3px solid #0066cc;
  outline-offset: 2px;
}

#cef .cef-summary-list {
  margin: 0;
  padding-left: 20px;
}

#cef .cef-summary-list a {
  color: #a8261b;
  font-weight: 600;
  text-decoration: underline;
}

#cef .cef-alert {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 2px solid #b26a00;
  border-radius: 10px;
  background: #fff8ec;
}

/* --- Buttons and status ---------------------------------------------------------------------- */

#cef .cef-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin: 18px 0 0;
}

#cef .cef-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 12px 20px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  background: #003a5d;
  border: 1px solid #003a5d;
  border-radius: 10px;
  cursor: pointer;
}

#cef .cef-btn:hover {
  background: #00507f;
}

#cef .cef-btn[aria-disabled="true"] {
  opacity: 0.65;
  cursor: progress;
}

#cef .cef-btn--secondary {
  color: #003a5d;
  background: #fff;
}

#cef .cef-btn--secondary:hover {
  background: #f3f7fa;
}

#cef .cef-status {
  margin: 0;
  font-size: 15px;
}

/* --- Loading ------------------------------------------------------------------------------- */

#cef .cef-loading {
  display: flex;
  gap: 10px;
  align-items: center;
}

#cef .cef-spinner {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 3px solid #c9d4dc;
  border-top-color: #003a5d;
  border-radius: 50%;
  animation: cef-spin 0.9s linear infinite;
}

@keyframes cef-spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Receipt ------------------------------------------------------------------------------- */

#cef .cef-banner {
  margin: 0 0 22px;
  padding: 18px 20px;
  border: 1px solid #c3e6cb;
  border-radius: 10px;
  background: #f2faf4;
}

#cef .cef-receipt {
  width: 100%;
  margin: 0 0 14px;
  border-collapse: collapse;
  border: 1px solid #e3e8ec;
  font-size: 15px;
}

#cef .cef-receipt th,
#cef .cef-receipt td {
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #e3e8ec;
  overflow-wrap: anywhere;
}

#cef .cef-receipt th {
  width: 40%;
  font-weight: 400;
  color: #4a5560;
}

#cef .cef-receipt td {
  font-weight: 600;
}

#cef .cef-receipt-terms {
  margin: 0 0 14px;
  padding: 0 14px;
  border: 1px solid #e3e8ec;
  border-radius: 8px;
}

/* Narrow phones: label above value rather than two squeezed columns. */
@media (max-width: 479px) {
  #cef .cef-receipt th,
  #cef .cef-receipt td {
    display: block;
    width: auto;
  }

  #cef .cef-receipt th {
    padding-bottom: 0;
    border-bottom: 0;
  }
}

@media (min-width: 640px) {
  #cef .cef-card {
    padding: 20px 22px;
  }

  #cef .cef-grid-2 {
    grid-template-columns: 1fr 1fr;
  }

  #cef .cef-h2 {
    font-size: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #cef,
  #cef * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* --- Print: the receipt (or whatever state is showing) without the site around it ---------- */

@media print {
  /* Keep only #cef and its ancestor chain. :has() keeps this to one rule; a browser without it
     drops the rule and prints the whole page, which is still usable. */
  body *:not(:has(#cef)):not(#cef):not(#cef *) {
    display: none !important;
  }

  #cef {
    max-width: none;
    margin: 0;
    color: #000;
  }

  #cef .cef-no-print,
  #cef .cef-spinner {
    display: none !important;
  }

  #cef .cef-banner,
  #cef .cef-card,
  #cef .cef-receipt-terms {
    border-color: #888;
    background: #fff;
    break-inside: avoid;
  }

  #cef .cef-receipt th,
  #cef .cef-receipt td {
    border-bottom-color: #888;
  }

  /* Every link, the screen's more specific link rules above included. */
  #cef a,
  #cef p a,
  #cef .cef-prose a,
  #cef .cef-note a {
    color: #000;
    text-decoration: underline;
  }

  #cef summary {
    color: #000;
  }
}
