/* =========================================================
   Inline MP-email widget + embedded petition form.
   Styles both the "Sign the petition, 30 seconds" embed and the
   "Email your MP as a {label}" flow that opens inline on each
   /for-{id}.html segment page and inside the overview blurb card.

   Tokens resolved in this order (declared so it works on every
   page regardless of whether style.css or landing.css is loaded):
     --font-sans  / --sans
     --font-serif / --serif
     --font-mono  / --mono
   See wiify.css for the shared compat shim.
   ========================================================= */

/* Outer frame shared by both widgets. Sits at the bottom of a segment
   page and inside the wiify blurb card. */
.inline-action-stack {
  max-width: 760px;
  margin: 48px auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Each widget card. */
.inline-action {
  padding: 28px 28px;
  background: var(--bg-elev, #FFFCF2);
  border: 1.5px solid var(--rule, #DDD3B6);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(28,38,32,.05), 0 12px 32px rgba(28,38,32,.06);
}

.inline-action-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.inline-action-eyebrow {
  font-family: var(--font-mono, 'JetBrains Mono', ui-monospace, monospace);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2-deep, #B85A2A);
  margin: 0;
}

.inline-action-title {
  font-family: var(--font-serif, 'Fraunces', Georgia, serif);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink, #1C2620);
  margin: 0;
  letter-spacing: -0.01em;
}

.inline-action-sub {
  font-size: 15px;
  color: var(--ink-dim, #5C6B5D);
  line-height: 1.5;
  margin: 0 0 18px;
}

/* ── PETITION EMBED ───────────────────────────────────────── */

.petition-embed {
  border-left: 5px solid var(--accent, #2E5D3F);
}
.petition-embed form { margin: 0; }
.petition-embed .form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.petition-embed label {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim, #5C6B5D);
}
.petition-embed input[type="text"],
.petition-embed input[type="email"],
.petition-embed textarea {
  font-family: var(--font-sans, 'Inter', system-ui, sans-serif);
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink, #1C2620);
  background: var(--bg, #F7F2E4);
  border: 1.5px solid var(--rule, #DDD3B6);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 140ms ease;
}
.petition-embed input:focus,
.petition-embed textarea:focus {
  border-color: var(--accent, #2E5D3F);
}
.petition-embed textarea { min-height: 84px; resize: vertical; }

.petition-embed .form-expand-btn {
  align-self: flex-start;
  background: transparent;
  border: none;
  color: var(--accent, #2E5D3F);
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 12px;
}
.petition-embed .form-expand-btn:hover { text-decoration: underline; }

.petition-embed .form-submit {
  width: 100%;
  margin-top: 6px;
  padding: 13px 22px;
  font-size: 15px;
}

.petition-embed #form-error,
.inline-action .form-error {
  display: none;
  color: var(--danger, #8B2C1B);
  text-align: center;
  margin-top: 14px;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 13px;
}

.petition-embed .fine-print {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--ink-faint, #93A092);
  text-align: center;
  margin: 14px 0 0;
  line-height: 1.6;
}

/* Post-sign states */
.petition-embed .check-email,
.petition-embed .thank-you {
  display: none;
  text-align: center;
  padding: 10px 0;
}
.petition-embed .check-email.is-active,
.petition-embed .thank-you.is-active { display: block; }
.petition-embed .check-email h4,
.petition-embed .thank-you h4 {
  font-family: var(--font-serif, Georgia, serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink, #1C2620);
  margin: 0 0 10px;
}
.petition-embed .check-email p,
.petition-embed .thank-you p {
  font-size: 15px;
  color: var(--ink-dim, #5C6B5D);
  line-height: 1.55;
  margin: 0 0 10px;
}

/* ── MP EMAIL WIDGET ──────────────────────────────────────── */

.mp-email-inline {
  border-left: 5px solid var(--accent-2, #D97742);
}

/* State A, dormant. The "Open the widget" button. */
.mp-email-inline-dormant {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.mp-email-inline.is-expanded .mp-email-inline-dormant { display: none; }

/* Expanded region holds state B (postal form), state C (composed email), state D (sent). */
.mp-email-inline-expanded { display: none; }
.mp-email-inline.is-expanded .mp-email-inline-expanded { display: block; }

/* State B, the lookup form. */
.mp-email-lookup {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}
.mp-email-inline.is-composed .mp-email-lookup { display: none; }
.mp-email-inline.is-sent   .mp-email-lookup { display: none; }

.mp-email-lookup label {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim, #5C6B5D);
  display: block;
  margin-bottom: 6px;
}
.mp-email-lookup input {
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 15px;
  width: 100%;
  padding: 10px 12px;
  background: var(--bg, #F7F2E4);
  border: 1.5px solid var(--rule, #DDD3B6);
  border-radius: 8px;
  color: var(--ink, #1C2620);
  outline: none;
  transition: border-color 140ms ease;
}
.mp-email-lookup input:focus { border-color: var(--accent-2, #D97742); }

.mp-email-lookup-row-full {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}
.mp-email-lookup-row-full .btn { min-width: 180px; }

@media (max-width: 560px) {
  .mp-email-lookup { grid-template-columns: 1fr; }
  .mp-email-lookup-row-full .btn { width: 100%; }
}

.mp-email-status {
  font-size: 13px;
  color: var(--ink-dim, #5C6B5D);
  font-family: var(--font-mono, ui-monospace, monospace);
  letter-spacing: 0.04em;
}
.mp-email-status.is-error { color: var(--danger, #8B2C1B); }

/* State C, composed email. */
.mp-email-composed { display: none; }
.mp-email-inline.is-composed .mp-email-composed { display: block; }

.mp-email-rep-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg, #F7F2E4);
  border: 1.5px solid var(--rule, #DDD3B6);
  border-radius: 10px;
  margin-bottom: 14px;
}
.mp-email-rep-photo {
  width: 52px; height: 52px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-elev-2, #EFE7D0);
}
.mp-email-rep-photo.is-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif, Georgia, serif);
  font-weight: 700;
  font-size: 20px;
  color: var(--ink-dim, #5C6B5D);
}
.mp-email-rep-name {
  font-family: var(--font-serif, Georgia, serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink, #1C2620);
  line-height: 1.25;
}
.mp-email-rep-meta {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  color: var(--ink-dim, #5C6B5D);
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.mp-email-rep-change {
  align-self: start;
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--accent, #2E5D3F);
  font-family: var(--font-sans, sans-serif);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}
.mp-email-rep-change:hover { text-decoration: underline; }

.mp-email-field { margin-bottom: 12px; }
.mp-email-field-label {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim, #5C6B5D);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mp-email-subject-input,
.mp-email-body-textarea {
  width: 100%;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink, #1C2620);
  background: var(--bg, #F7F2E4);
  border: 1.5px solid var(--rule, #DDD3B6);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  resize: vertical;
}
.mp-email-subject-input { font-size: 15px; }
.mp-email-subject-input:focus,
.mp-email-body-textarea:focus { border-color: var(--accent-2, #D97742); }
.mp-email-body-textarea { min-height: 260px; }

.mp-email-reset {
  background: transparent;
  border: none;
  color: var(--accent, #2E5D3F);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
}
.mp-email-reset:hover { text-decoration: underline; }

.mp-email-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.mp-email-actions .btn { flex: 1 1 auto; min-width: 200px; padding: 12px 20px; font-size: 14px; }

.mp-email-server-note {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-faint, #93A092);
  margin: 10px 0 0;
  line-height: 1.5;
}

/* State D, sent. */
.mp-email-sent { display: none; text-align: center; padding: 10px 0; }
.mp-email-inline.is-sent .mp-email-sent { display: block; }
.mp-email-sent h4 {
  font-family: var(--font-serif, Georgia, serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink, #1C2620);
  margin: 0 0 8px;
}
.mp-email-sent p {
  font-size: 15px;
  color: var(--ink-dim, #5C6B5D);
  line-height: 1.55;
  margin: 0 0 14px;
}
.mp-email-sent-share {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 6px;
}
.mp-email-sent-share button {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  border: 1.5px solid var(--rule, #DDD3B6);
  border-radius: 999px;
  color: var(--accent, #2E5D3F);
  font-family: var(--font-sans, sans-serif);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.mp-email-sent-share button:hover {
  background: rgba(46,93,63,.06);
  border-color: var(--accent, #2E5D3F);
}
.mp-email-sent-share button.is-copied {
  background: var(--accent, #2E5D3F);
  color: var(--bg-elev, #FFFCF2);
  border-color: var(--accent, #2E5D3F);
}

/* ── Inline widget INSIDE the overview blurb card ─────────── */
/* When mounted inside .wiify-card, compress padding and de-emphasize
   the outer frame because the card already provides one. */
.wiify-card .mp-email-inline {
  margin-top: 16px;
  padding: 18px 18px;
  border: 1.5px solid var(--rule, #DDD3B6);
  border-left: 5px solid var(--accent-2, #D97742);
  box-shadow: none;
  border-radius: 12px;
  background: var(--bg, #F7F2E4);
}
.wiify-card .mp-email-inline .inline-action-title { font-size: 18px; }
.wiify-card .mp-email-inline .mp-email-body-textarea { min-height: 220px; }

/* Reduced motion: disable all CSS transitions on state change. */
@media (prefers-reduced-motion: reduce) {
  .mp-email-inline * { transition: none !important; }
}
