/* ZarchBot public site — "Orchard" theme.
 *
 * Visual reference is the Orchard neighborhood in Orem: fruit rows, blossom,
 * warm afternoon light, and the bench above them. Deliberately civic and warm
 * rather than devotional. It must not read as official Church branding, so the
 * Church's own palette, typefaces, and iconography are avoided on purpose
 * (see A2P_REGISTRATION.md).
 *
 * Accessibility targets: WCAG 2.2 AA. Every text pair below is >= 4.5:1, every
 * control border and focus ring >= 3:1, targets >= 44px, and the layout is
 * usable at 320px wide and at 200% zoom. Do not darken --leaf or lighten
 * --paper without re-checking contrast.
 */

/* ---------- tokens ---------- */

:root {
  color-scheme: light dark;

  /* orchard palette — light ("blossom") */
  --paper: #fbf7f0;          /* warm cream, page */
  --surface: #ffffff;        /* cards */
  --surface-2: #f4efe5;      /* tinted panels */
  --ink: #241e17;            /* bark, body text        15.4:1 on paper */
  --ink-muted: #5a5147;      /* secondary text          7.3:1 on paper */
  --leaf: #2c6146;           /* primary, links          6.8:1 on paper */
  --leaf-deep: #1f4a34;      /* hover / pressed */
  --leaf-ink: #ffffff;       /* text on leaf            7.2:1 */
  --leaf-wash: #e7f0e9;      /* faint green fill */
  --fruit: #a8442a;          /* accent, sparingly       5.6:1 on paper */
  --danger: #9b2c1f;         /* errors, stop actions    7.1:1 on paper */
  --rule: #e2d9ca;           /* decorative dividers only */
  --edge: #8a7b66;           /* control borders         3.9:1 on paper */

  --shadow-sm: 0 1px 2px rgb(36 30 23 / 0.06), 0 1px 3px rgb(36 30 23 / 0.05);
  --shadow-md: 0 2px 4px rgb(36 30 23 / 0.05), 0 8px 20px rgb(36 30 23 / 0.07);

  --radius: 12px;
  --radius-sm: 8px;
  --shell: 66rem;
  --measure: 68ch;

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Charter,
                  "Bitstream Charter", Georgia, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
               Arial, sans-serif;

  /* fluid type: readable at 320px, generous on a desktop */
  --step--1: clamp(0.875rem, 0.85rem + 0.12vw, 0.9375rem);
  --step-0: clamp(1rem, 0.97rem + 0.16vw, 1.0625rem);
  --step-1: clamp(1.125rem, 1.07rem + 0.28vw, 1.25rem);
  --step-2: clamp(1.375rem, 1.28rem + 0.47vw, 1.6875rem);
  --step-3: clamp(1.75rem, 1.55rem + 1vw, 2.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* orchard at dusk */
    --paper: #17130f;
    --surface: #201b16;
    --surface-2: #2a231c;
    --ink: #f2eae0;
    --ink-muted: #bfb3a4;
    --leaf: #7fc79c;
    --leaf-deep: #9bd8b2;
    --leaf-ink: #10231a;
    --leaf-wash: #23342b;
    --fruit: #f0a183;
    --danger: #f09a8c;
    --rule: #3a3129;
    --edge: #9a8b7a;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-md: 0 2px 4px rgb(0 0 0 / 0.35), 0 8px 20px rgb(0 0 0 / 0.45);
  }
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  /* soft blossom light in the top corners; decorative only */
  background-image:
    radial-gradient(60rem 24rem at 12% -8rem, var(--leaf-wash), transparent 70%),
    radial-gradient(44rem 20rem at 92% -6rem, rgb(168 68 42 / 0.07), transparent 70%);
  background-repeat: no-repeat;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1 0 auto; padding-block: clamp(2rem, 1rem + 4vw, 3.5rem); }

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: clamp(1rem, 0.5rem + 2vw, 2rem);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0 0 0.5em;
}

h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }

p { margin: 0 0 1em; max-width: var(--measure); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a { color: var(--leaf); text-underline-offset: 0.18em; text-decoration-thickness: 0.08em; }
a:hover { color: var(--leaf-deep); }

img { max-width: 100%; height: auto; }

:focus-visible {
  outline: 3px solid var(--leaf);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 20;
  padding: 0.75rem 1rem;
  background: var(--leaf);
  color: var(--leaf-ink);
  font-weight: 600;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transition: top 120ms ease-out;
}
.skip-link:focus { top: 0; color: var(--leaf-ink); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

/* ---------- header ---------- */

.site-header {
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 0.625rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  text-decoration: none;
  padding: 0.25rem 0;
  min-height: 44px;
}
.brand:hover { color: var(--ink); }
.brand span { display: block; }
.brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: var(--step-1);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.brand small {
  display: block;
  font-size: var(--step--1);
  color: var(--ink-muted);
  line-height: 1.3;
}
.brand:hover strong { color: var(--leaf); }

/* a leaf, not a circle — the one piece of orchard iconography */
.brand-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--leaf);
  color: var(--leaf-ink);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  border-radius: 62% 12% 62% 12%;
  box-shadow: var(--shadow-sm);
}

.primary-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.primary-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}
.primary-nav a:hover { background: var(--leaf-wash); color: var(--leaf-deep); }
.primary-nav a[aria-current="page"] {
  color: var(--leaf-deep);
  font-weight: 650;
  box-shadow: inset 0 -3px 0 var(--leaf);
}

/* ---------- buttons ---------- */

.button, button, .danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.7rem 1.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--leaf);
  color: var(--leaf-ink);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease, transform 140ms ease;
}
.button:hover, button:hover, .danger-button:hover {
  background: var(--leaf-deep);
  color: var(--leaf-ink);
}
.button:active, button:active { transform: translateY(1px); }

.button.secondary {
  background: transparent;
  color: var(--leaf);
  border-color: var(--edge);
}
.button.secondary:hover { background: var(--leaf-wash); color: var(--leaf-deep); border-color: var(--leaf); }

.button.light {
  background: var(--surface);
  color: var(--leaf-deep);
}
.button.light:hover { background: var(--leaf-wash); color: var(--leaf-deep); }

.danger-button { background: var(--danger); }
.danger-button:hover { background: color-mix(in srgb, var(--danger) 78%, var(--ink)); }

@media (prefers-color-scheme: dark) {
  .danger-button { color: #2a0f0b; }
  .danger-button:hover { background: color-mix(in srgb, var(--danger) 82%, var(--paper)); color: #2a0f0b; }
}

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0 1rem; }

/* ---------- shared blocks ---------- */

.eyebrow {
  margin: 0 0 0.5rem;
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fruit);
}

.lede { font-size: var(--step-1); color: var(--ink-muted); max-width: 54ch; }

.fine-print, .optional { font-size: var(--step--1); color: var(--ink-muted); }

.section { margin-top: clamp(2.5rem, 1.5rem + 4vw, 4.5rem); }

.page-heading { margin-bottom: 2rem; }
.page-heading.compact { margin-bottom: 1.5rem; }

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
  gap: clamp(1.5rem, 1rem + 3vw, 3rem);
  align-items: center;
}

.hero h1 { margin-bottom: 0.4em; }

.qr-card {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.qr-card img {
  width: 100%;
  max-width: 13.75rem;
  border-radius: var(--radius-sm);
  /* QR must stay high-contrast black-on-white even in dark mode */
  background: #fff;
  padding: 0.5rem;
}
.qr-card strong { margin-top: 0.35rem; font-family: var(--font-display); font-size: var(--step-1); }
.qr-card span { font-size: var(--step--1); color: var(--ink-muted); }

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

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.card {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--leaf);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card h2, .card h3 { font-size: var(--step-1); margin-bottom: 0.35em; }
.card p, .card dd { color: var(--ink-muted); }
.card p { max-width: none; }

.step {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.75rem;
  background: var(--leaf-wash);
  color: var(--leaf-deep);
  border-radius: 50%;
  font-weight: 700;
  font-size: var(--step--1);
}

.card dl { margin: 0; }
.card dt {
  margin-top: 0.6rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.card dt:first-child { margin-top: 0; }
.card dd { margin: 0.1rem 0 0; }

/* ---------- split panel ---------- */

.split-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: clamp(1.5rem, 1rem + 2vw, 2.5rem);
  align-items: start;
  padding: clamp(1.5rem, 1rem + 2vw, 2.25rem);
  background: var(--surface-2);
  border-radius: var(--radius);
}
.split-panel h2, .split-panel h3 { margin-top: 0; }

.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.check-list li {
  position: relative;
  padding-left: 1.9rem;
  color: var(--ink);
}
.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.42em;
  width: 0.75rem;
  height: 0.4rem;
  border-left: 2.5px solid var(--leaf);
  border-bottom: 2.5px solid var(--leaf);
  transform: rotate(-45deg);
}

/* ---------- callout ---------- */

.callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: clamp(1.5rem, 1rem + 2vw, 2.5rem);
  background: var(--leaf);
  color: var(--leaf-ink);
  border-radius: var(--radius);
}
.callout h2 { margin-bottom: 0.3em; }
.callout p { color: color-mix(in srgb, var(--leaf-ink) 88%, var(--leaf)); }

/* ---------- forms ---------- */

.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.8fr);
  gap: clamp(1.5rem, 1rem + 2vw, 2.5rem);
  align-items: start;
}

.form-card {
  padding: clamp(1.25rem, 1rem + 1.5vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.form-card.narrow { max-width: 34rem; }

.side-card {
  padding: 1.5rem;
  background: var(--surface-2);
  border-radius: var(--radius);
}
.side-card img {
  display: block;
  width: 11.25rem;
  max-width: 100%;
  margin-bottom: 1rem;
  background: #fff;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}
.side-card h2 { font-size: var(--step-1); }
.side-card p { color: var(--ink-muted); font-size: var(--step--1); }

label {
  display: block;
  margin: 1.1rem 0 0.35rem;
  font-weight: 600;
}

input[type="text"], input[type="tel"], input[type="email"] {
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 0.8rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
}
input::placeholder { color: var(--ink-muted); opacity: 1; }
input:hover { border-color: var(--ink-muted); }
input:focus-visible { outline: 3px solid var(--leaf); outline-offset: 1px; border-color: var(--leaf); }

.hint { margin: 0.35rem 0 0; font-size: var(--step--1); color: var(--ink-muted); }

.required-mark { color: var(--fruit); font-weight: 700; }

fieldset {
  margin: 1.75rem 0 0;
  padding: 1.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface-2);
}
legend {
  padding: 0 0.5rem;
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 600;
}

/* consent rows: whole row is the label, so the tap target is large */
.choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
  margin: 0;
  padding: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-weight: 400;
  cursor: pointer;
}
.choice + .choice { margin-top: 0.75rem; }
.choice:hover { border-color: var(--leaf); }
.choice:has(input:checked) {
  border-color: var(--leaf);
  background: var(--leaf-wash);
  box-shadow: inset 0 0 0 1px var(--leaf);
}
.choice:has(input:focus-visible) { outline: 3px solid var(--leaf); outline-offset: 2px; }
.choice input[type="checkbox"] {
  width: 1.4rem;
  height: 1.4rem;
  margin: 0.15rem 0 0;
  accent-color: var(--leaf);
  flex: none;
}
.choice strong { display: block; font-size: var(--step-0); }
.choice small { display: block; margin-top: 0.2rem; font-size: var(--step--1); color: var(--ink-muted); line-height: 1.5; }

/* A2P/10DLC program disclosure — must stay visible, never collapsed */
.disclosure {
  margin-top: 1.5rem;
  padding: 1rem 1.1rem;
  border-left: 3px solid var(--fruit);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: var(--step--1);
  color: var(--ink-muted);
}
.disclosure p { max-width: none; }
.disclosure p + p { margin-top: 0.6rem; }

form button[type="submit"] { margin-top: 1.75rem; }

.error {
  margin: 0 0 1.25rem;
  padding: 0.9rem 1.1rem;
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  border: 1px solid var(--danger);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-weight: 600;
}
.error:focus-visible { outline: 3px solid var(--danger); outline-offset: 2px; }

/* ---------- policy pages ---------- */

.policy { max-width: var(--measure); }
.policy h2 {
  margin-top: 2.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: var(--step-2);
}
.policy .page-heading h2 { margin-top: 0; padding-top: 0; border-top: 0; }
.policy p { color: var(--ink); }

/* ---------- confirmation ---------- */

.confirmation {
  max-width: 40rem;
  padding: clamp(1.5rem, 1rem + 2vw, 2.5rem);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--leaf);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.confirmation h1 { font-size: var(--step-2); }
.confirmation .actions { margin-top: 1.5rem; margin-bottom: 0; }

/* same page template also renders "link expired" states — do not signal success */
.confirmation.notice { border-top-color: var(--fruit); }
.confirmation.notice .eyebrow { color: var(--ink-muted); }

/* ---------- footer ---------- */

.site-footer {
  margin-top: clamp(3rem, 2rem + 4vw, 5rem);
  padding-block: 2.5rem;
  background: var(--surface-2);
  border-top: 1px solid var(--rule);
  font-size: var(--step--1);
  color: var(--ink-muted);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1.75rem;
}
.footer-grid strong { display: block; margin-bottom: 0.4rem; color: var(--ink); font-family: var(--font-display); font-size: var(--step-0); }
.footer-grid nav { display: grid; gap: 0.15rem; justify-items: start; }
.footer-grid nav a, .footer-grid a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.footer-grid p a { min-height: 0; }
.footer-grid p { margin-bottom: 0.35rem; }
.footer-grid nav a[aria-current="page"] { color: var(--ink); font-weight: 650; text-decoration-thickness: 0.12em; }

/* ---------- responsive ---------- */

@media (max-width: 52rem) {
  .hero, .form-layout { grid-template-columns: minmax(0, 1fr); }
  .qr-card { justify-self: start; max-width: 22rem; }
  .callout { flex-direction: column; align-items: flex-start; }
  .callout .button { width: 100%; }
}

@media (max-width: 30rem) {
  .header-inner { padding-block: 0.5rem; }
  .primary-nav { width: 100%; }
  .primary-nav a { padding-inline: 0.6rem; }
  .actions .button { width: 100%; }
}

/* ---------- user preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .card, .form-card, .side-card, .split-panel, .callout, .choice,
  .qr-card, .disclosure, .error, .confirmation {
    border: 1px solid CanvasText;
  }
  .button, button, .danger-button { border: 1px solid ButtonText; }
  .brand-mark { border: 1px solid CanvasText; }
  .check-list li::before { border-color: CanvasText; }
  .primary-nav a[aria-current="page"] { box-shadow: none; text-decoration: underline; }
}

@media print {
  body { background: #fff; color: #000; }
  .site-header, .site-footer, .skip-link, .qr-card, .side-card, .actions { display: none; }
  main { padding: 0; }
  .policy { max-width: none; }
  a { color: #000; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; word-break: break-all; }
}
