/* ===== TOKENS (shared design system) ===== */
:root{
  --accent: oklch(0.62 0.18 45);
  --accent-ink: oklch(0.35 0.12 45);
  --accent-wash: oklch(0.96 0.035 60);
  --display-font: 'Instrument Serif', Georgia, serif;

  --bg: oklch(0.985 0.006 85);
  --bg-2: oklch(0.965 0.008 80);
  --ink: oklch(0.18 0.012 60);
  --ink-2: oklch(0.38 0.012 60);
  --ink-3: oklch(0.58 0.010 60);
  --rule: oklch(0.88 0.008 70);
  --rule-strong: oklch(0.78 0.010 70);
  --paper: oklch(1 0 0);

  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --sans: 'Inter', system-ui, sans-serif;
}

/* ===== RESET (minimal) ===== */
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a{color:inherit;text-decoration:none}
button{font-family:inherit;cursor:pointer;border:0;background:0}
h1,h2,h3,h4{margin:0;font-weight:400;letter-spacing:-0.01em}
p{margin:0}

/* ===== FORM ATOMS (shared across landing/FRR/human-rewrite/checkout pages) ===== */
.field{ margin-bottom: 14px; }
.field label{
  display:block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-3); margin-bottom: 8px; font-weight: 500;
}
.field input[type=text], .field input[type=email], .field input[type=url]{
  width:100%; padding: 13px 14px; font-size: 14.5px; font-family:inherit;
  border:1px solid var(--rule-strong); border-radius: 9px;
  background: var(--bg);
  transition: border-color .15s ease, background .15s ease;
}
.field input:focus{ outline:none; border-color: var(--ink); background: var(--paper); }

.consent-check{
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 2px; padding: 14px 14px 0;
  border-top: 1px solid var(--rule);
}
.consent-check input{
  margin: 2px 0 0; width: 16px; height: 16px; flex-shrink: 0;
  accent-color: var(--ink);
}
.consent-check label{
  font-size: 13px; line-height: 1.6; color: var(--ink-2);
}
.consent-check label a{
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* In-form loader shown while /api/checkout/ai/start is in flight (10-25 s
   typical, longer on Cloudflare-challenge path). The partial sibling
   .checkout-form-body is hidden via [hidden] when this is active. */
.checkout-loader{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 48px 20px;
  text-align: center;
}
.checkout-loader[hidden]{ display: none; }
.checkout-loader .spinner{
  width: 40px; height: 40px;
  border: 3px solid var(--rule);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: checkout-spin 0.8s linear infinite;
}
@keyframes checkout-spin{ to { transform: rotate(360deg); } }
.checkout-loader .status{
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
  margin: 0;
  min-height: 1.5em;
  transition: opacity 200ms ease;
}
.checkout-loader .status.fading{ opacity: 0; }

.form-legal{
  margin-top: 10px; font-size: 12px; line-height: 1.6;
  color: var(--ink-3); text-align: center;
}
.form-legal a{
  text-decoration: underline;
  text-underline-offset: 2px;
}

.modal-consent{
  display:flex; align-items:flex-start; gap:10px;
  margin-top: 4px; padding-top: 2px;
}
.modal-consent input{
  margin: 2px 0 0; width: 16px; height: 16px; flex-shrink: 0;
  accent-color: var(--ink);
}
.modal-consent label{
  font-size: 13px; line-height: 1.6; color: var(--ink-2);
}
.modal-legal{
  margin: 14px 0 0; font-size: 12px; line-height: 1.6;
  color: var(--ink-3); text-align: center;
}
.modal-legal a{
  text-decoration: underline;
  text-underline-offset: 2px;
}

.goal-grid{ display:grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.goal{
  font-size: 13px; padding: 11px 12px; border-radius: 8px;
  border: 1px solid var(--rule-strong); background: var(--bg);
  text-align:left; color: var(--ink-2);
  transition: all .15s ease;
}
.goal:hover{ border-color: var(--ink-3); color: var(--ink); }
.goal.active{ border-color: var(--ink); background: var(--ink); color: var(--bg); }

.form-actions{ margin-top: 18px; }
.form-actions .btn{ width:100%; justify-content: center; }
.form-note{ font-size: 12px; color: var(--ink-3); text-align:center; margin-top: 12px; }

/* ===== CHECKOUT MODAL ATOMS (used by FRR + landing-adjacent flows) ===== */
.modal-backdrop{
  position: fixed; inset: 0; z-index: 60;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(17,16,14,.56);
  backdrop-filter: blur(6px);
}
.modal-backdrop.open{ display: flex; }
.modal-card{
  width: min(100%, 520px);
  max-height: calc(100vh - 48px);
  background: var(--paper);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 18px;
  box-shadow: 0 28px 80px -36px rgba(17,16,14,.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-head{
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}
.modal-copy .eyebrow{ margin-bottom: 10px; }
.modal-copy h3{
  font-family: var(--display-font); font-size: 34px; line-height: 1.02;
  letter-spacing: -0.02em; margin-bottom: 10px;
}
.modal-copy p{ color: var(--ink-2); max-width: 38ch; }
.modal-close{
  width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid var(--rule); color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 18px;
}
.modal-close:hover{ border-color: var(--ink); color: var(--ink); }
.modal-body{ padding: 24px; overflow-y: auto; flex: 1 1 auto; }
.modal-body .field{ margin-bottom: 18px; }
.modal-meta{
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 0 0 20px;
}
.modal-meta span{
  display: inline-flex; align-items: center;
  min-height: 32px; padding: 8px 12px;
  border: 1px solid var(--rule); border-radius: 999px;
  background: var(--bg);
  font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--ink-2);
}
.modal-actions{
  display: flex; flex-direction: column; gap: 12px;
}
.modal-actions .btn{ width: 100%; justify-content: center; }
.modal-actions .btn-ghost{ border-color: var(--rule-strong); }
.modal-note{
  font-size: 12px; line-height: 1.5; color: var(--ink-3);
  text-align: center;
}
body.modal-open{ overflow: hidden; }
@media (max-width: 640px){
  .modal-backdrop{ padding: 16px; }
  .modal-head, .modal-body{ padding: 20px; }
  .modal-copy h3{ font-size: 30px; }
}

/* Inline form error (used by _AiCheckoutForm partial; shown via .show class set by JS). */
.checkout-error{
  display: none; margin-top: 16px; padding: 14px 16px;
  border-radius: 10px; border: 1px solid oklch(0.42 0.20 25);
  background: oklch(0.97 0.025 28); color: oklch(0.42 0.20 25);
  font-size: 14px; line-height: 1.5; font-weight: 500;
}
.checkout-error.show{ display: block; }
