/* ═══════════════════════════════════════════════════════════════════════
   Media consent form (/consent) — ported from the standalone consent app.
   All rules are scoped under .consent-scope so they cannot leak into the
   rest of the site, and the standalone app's design tokens are re-pointed
   at the MPC website's own palette (deep navy + gold) and fonts.
   ═══════════════════════════════════════════════════════════════════════ */

.consent-scope {
  --paper: #f7f7f3;
  --surface: #ffffff;
  --ink: #0b2745;
  --muted: #52627a;
  --line: #e2e4e2;
  --line-strong: #c3cdd6;
  --violet: #0b2745;
  --violet-deep: #071c33;
  --violet-wash: #e5edf5;
  --coral: var(--color-gold, #D9A72E);
  --coral-wash: #faf3dd;
  --gold-deep: #a97e14;
  --error: #b3261e;
  --sans: var(--font-body, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  --serif: var(--font-display, Georgia, "Times New Roman", serif);
}

.consent-shell {
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: 2.25rem 1.25rem 5rem;
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
}

.consent-masthead {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.consent-logo {
  width: 64px;
  height: auto;
  flex: none;
  filter: drop-shadow(0 2px 4px rgba(10, 36, 64, 0.12));
}

.consent-church {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.1875rem;
  font-weight: 620;
  line-height: 1.3;
  color: var(--violet-deep);
}

.consent-details {
  margin: 0.2rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--muted);
}

.consent-title {
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 640;
  font-size: clamp(2.1rem, 7vw, 3rem);
  line-height: 1.06;
  letter-spacing: -0.018em;
  text-wrap: balance;
  color: var(--violet-deep);
}

.consent-intro {
  margin: 0;
  max-width: 34rem;
  font-size: 1.0625rem;
  line-height: 1.65;
  text-wrap: pretty;
  color: var(--muted);
}

/* ── Form sections ─────────────────────────────────────────────────── */

.consent-scope .section {
  margin: 2.75rem 0 0;
  padding: 2.25rem 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  min-width: 0;
}

.consent-scope .section > legend {
  padding: 0;
  margin-bottom: 1rem;
  font-family: var(--serif);
  font-weight: 620;
  font-size: 1.55rem;
  line-height: 1.2;
  letter-spacing: -0.008em;
  color: var(--violet-deep);
}

.consent-scope .section > legend::after {
  content: "";
  display: block;
  width: 2.75rem;
  height: 3px;
  margin-top: 0.45rem;
  border-radius: 99px;
  background: var(--coral);
}

.consent-scope .field {
  margin-bottom: 1.3rem;
}

.consent-scope .field label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.consent-scope .optional {
  font-weight: 400;
  color: var(--muted);
}

.consent-scope .hint {
  margin: 0 0 0.5rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

.consent-scope .hint.lead {
  margin-bottom: 1rem;
}

.consent-scope input[type="text"],
.consent-scope input[type="email"],
.consent-scope input[type="tel"] {
  display: block;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.7rem 1rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: inset 0 1px 2px rgba(29, 45, 61, 0.05);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.consent-scope input[type="text"]:hover,
.consent-scope input[type="email"]:hover,
.consent-scope input[type="tel"]:hover {
  border-color: var(--muted);
}

.consent-scope input[type="text"]:focus-visible,
.consent-scope input[type="email"]:focus-visible,
.consent-scope input[type="tel"]:focus-visible {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-wash);
  outline: none;
}

.consent-scope input::placeholder {
  color: #93a0ad;
}

.consent-scope input[aria-invalid="true"] {
  border-color: var(--error);
}

.consent-scope .error {
  margin: 0.4rem 0 0;
  font-size: 0.9375rem;
  color: var(--error);
}

.consent-scope .form-error {
  margin: 0 0 1rem;
  padding: 0.8rem 1rem;
  color: var(--error);
  background: #fdeeed;
  border-left: 4px solid var(--error);
  border-radius: 6px;
}

/* ── Choices (checkbox cards) ──────────────────────────────────────── */

.consent-scope .choices {
  display: grid;
  gap: 0.7rem;
}

.consent-scope .choice {
  position: relative;
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  min-height: 3.5rem;
  padding: 0.95rem 1.1rem;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(10, 36, 64, 0.05);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s ease, background-color 0.15s ease,
    box-shadow 0.15s ease, transform 0.15s ease;
}

.consent-scope .choice:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(10, 36, 64, 0.08);
}

.consent-scope .choice:has(input:checked) {
  border-color: var(--coral);
  background: var(--coral-wash);
  box-shadow: 0 0 0 1px var(--coral), 0 4px 10px rgba(195, 154, 60, 0.18);
}

.consent-scope .choice input {
  position: absolute;
  opacity: 0;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0;
}

.consent-scope .choice-mark {
  flex: none;
  position: relative;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.1rem;
  background: var(--surface);
  border: 2px solid var(--muted);
  border-radius: 6px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.consent-scope .choice.radio .choice-mark {
  border-radius: 50%;
}

.consent-scope .choice input:checked + .choice-mark {
  background: var(--coral);
  border-color: var(--gold-deep);
}

.consent-scope .choice input:checked + .choice-mark::after {
  content: "";
  position: absolute;
  left: 0.42rem;
  top: 0.14rem;
  width: 0.36rem;
  height: 0.7rem;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.consent-scope .choice.radio input:checked + .choice-mark::after {
  left: 50%;
  top: 50%;
  width: 0.55rem;
  height: 0.55rem;
  border: 0;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}

.consent-scope .choice input:focus-visible + .choice-mark {
  outline: 3px solid var(--coral);
  outline-offset: 2px;
}

.consent-scope .choice input[aria-invalid="true"] + .choice-mark {
  border-color: var(--error);
}

.consent-scope .field .choice {
  display: flex;
  margin-bottom: 0;
  font-weight: 400;
}

.consent-scope .field .choice:has(input[aria-invalid="true"]) {
  border-color: var(--error);
  background: #fdf1f0;
  box-shadow: 0 0 0 2px var(--error);
}

.consent-scope .choice-text {
  display: grid;
  gap: 0.1rem;
}

.consent-scope .choice-label {
  font-weight: 600;
}

.consent-scope .choice-hint {
  font-size: 0.9375rem;
  color: var(--muted);
}

/* ── Buttons ───────────────────────────────────────────────────────── */

.consent-scope .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.5rem;
  padding: 0.8rem 1.75rem;
  font: inherit;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: #fdf9ee;
  text-decoration: none;
  background: var(--violet);
  border: 2px solid var(--violet-deep);
  border-radius: 12px;
  box-shadow: 0 2px 0 var(--violet-deep), 0 8px 18px rgba(11, 39, 69, 0.22);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: filter 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.consent-scope .button:hover:not(:disabled) {
  background: var(--violet-deep);
  filter: none;
}

.consent-scope .button:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 0 0 var(--violet-deep), 0 3px 8px rgba(11, 39, 69, 0.2);
}

.consent-scope .button:disabled {
  opacity: 0.75;
  cursor: progress;
}

.consent-scope .spinner {
  flex: none;
  width: 1.1rem;
  height: 1.1rem;
  margin-right: 0.6rem;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: consent-spin 0.7s linear infinite;
}

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

/* ── Person cards / add / remove ───────────────────────────────────── */

.consent-scope .person-card {
  position: relative;
  margin-top: 1.25rem;
  padding: 1.4rem 1.4rem 1.2rem;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-left: 4px solid var(--coral);
  border-radius: 12px;
}

.consent-scope .person-card > legend {
  font-size: 1.1rem;
}

.consent-scope .person-card > legend::after {
  display: none;
}

.consent-scope .add-extra {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.25rem;
}

.consent-scope .add-person {
  display: inline-flex;
  align-items: center;
  min-height: 2.9rem;
  padding: 0.55rem 1.15rem;
  font: inherit;
  font-weight: 600;
  color: var(--violet);
  background: var(--surface);
  border: 1.5px dashed var(--violet);
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.consent-scope .add-person:hover {
  color: #fff;
  background: var(--violet);
  border-style: solid;
}

.consent-scope .remove-person {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin-top: 0.25rem;
  padding: 0.4rem 0;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--error);
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-decoration: underline;
}

.consent-scope .remove-person:hover {
  color: #8f1d17;
}

.consent-scope .button.secondary {
  color: var(--violet);
  background: transparent;
  border-color: var(--line-strong);
  box-shadow: none;
}

.consent-scope .button.secondary:hover {
  color: var(--violet-deep);
  border-color: var(--violet);
  filter: none;
  background: var(--violet-wash);
}

.consent-scope .button.secondary:active:not(:disabled) {
  transform: none;
  box-shadow: none;
}

@media (min-width: 40rem) {
  .consent-scope .button {
    width: auto;
    min-width: 14rem;
  }
}

@media (hover: none) {
  .consent-scope .choice:hover {
    transform: none;
    box-shadow: 0 1px 3px rgba(10, 36, 64, 0.05);
  }

  .consent-scope .button:active:not(:disabled) {
    transform: translateY(1px);
  }
}

/* ── Privacy / honeypot / done / grant ─────────────────────────────── */

.consent-scope .privacy {
  margin-top: 2.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.9375rem;
  color: var(--muted);
}

.consent-scope .privacy summary {
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  font-weight: 600;
  color: var(--violet);
  cursor: pointer;
}

.consent-scope .privacy summary::marker {
  color: var(--gold-deep);
}

.consent-scope .hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.consent-scope .done {
  margin-top: 2.5rem;
  padding: 1.9rem 1.6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--coral);
  border-radius: 6px 16px 16px 6px;
  box-shadow: 0 10px 28px rgba(10, 36, 64, 0.1);
  animation: consent-done-in 0.4s ease-out both;
}

.consent-scope .done::before {
  content: "";
  display: block;
  width: 3rem;
  height: 3rem;
  margin-bottom: 1rem;
  border-radius: 50%;
  background: var(--coral)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E")
    center / 1.5rem no-repeat;
  box-shadow: 0 4px 10px rgba(169, 126, 20, 0.35);
}

.consent-scope .done h2 {
  margin: 0 0 0.75rem;
  font-family: var(--serif);
  font-size: 1.8rem;
  line-height: 1.2;
  color: var(--violet-deep);
}

.consent-scope .done h2:focus {
  outline: none;
}

.consent-scope .done p {
  margin: 0 0 1rem;
}

.consent-scope .done-ref {
  font-size: 1.05rem;
}

.consent-scope .done-ref strong {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.25rem 0.7rem;
  font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.2rem;
  letter-spacing: 0.12em;
  color: var(--violet-deep);
  background: var(--coral-wash);
  border: 1.5px dashed var(--coral);
  border-radius: 8px;
}

.consent-scope .done-note {
  font-size: 0.9375rem;
  color: var(--muted);
}

@keyframes consent-done-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.consent-scope .grant-list {
  margin: 0;
  padding: 1.35rem 1.35rem 1.35rem 2.6rem;
  display: grid;
  gap: 0.8rem;
  font-size: 0.95rem;
  line-height: 1.62;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--coral);
  border-radius: 4px 14px 14px 4px;
  box-shadow: 0 2px 8px rgba(10, 36, 64, 0.05);
}

.consent-scope .grant-list li {
  padding-left: 0.25rem;
}

.consent-scope .grant-list li::marker {
  color: var(--gold-deep);
  font-weight: 700;
}

/* ── Admin consents page: purpose chips (unscoped, used by /admin/consents) ── */
.consent-purposes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.consent-purpose-chip {
  display: inline-block;
  padding: 2px 9px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #0b2745;
  background: #e5edf5;
  border: 1px solid #c3cdd6;
  border-radius: 999px;
}

@media (prefers-reduced-motion: reduce) {
  .consent-scope * {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
