@import url('/theme.css');

/* Shared stylesheet for all pages. Page-specific rules are scoped by a class
   on <body> (page-email / page-checkout / page-success / page-redirect).
   All brand colors, fonts, and radii come from the tokens in theme.css —
   change them there, not here. */

/* ---- Shared base ---- */
body {
  font-family: var(--cn-font);
  color: var(--cn-text);
  line-height: 1.5;
}
h1 { font-size: 1.4rem; font-family: var(--cn-font-title); font-weight: 600; }
p.description { color: var(--cn-muted); }

/* Narrow single-column pages */
body.page-email,
body.page-success {
  max-width: 560px;
  margin: 40px auto;
  padding: 0 20px;
  box-sizing: border-box;
}

/* Checkout page spans wider for its two-column layout */
body.page-checkout { margin: 0; padding: 0; }

/* ---- ChowNow-branded chrome (get.chownow.com look) ---- */
/* Reused by any page that opts in with the .cn-header / .cn-divider / .cn-main
   markup (currently the onboarding form and the embedded checkout). */
body.page-onboarding { margin: 0; padding: 0; }
/* White header bar with the ChowNow wordmark, like the marketing site. */
.cn-header {
  display: flex;
  align-items: center;
  padding: 14px 24px;
  background: var(--cn-bg);
}
.cn-logo { display: inline-flex; }
.cn-header svg { height: 30px; width: auto; display: block; }
/* Dotted divider that runs under the header on get.chownow.com. */
.cn-divider {
  height: 8px;
  background-image: radial-gradient(circle, var(--cn-ink) 1.5px, transparent 1.6px);
  background-size: 13px 8px;
  background-repeat: repeat-x;
  background-position: center;
}
/* Centered content column below the header. */
.cn-main {
  max-width: 560px;
  margin: 48px auto;
  padding: 0 20px;
  box-sizing: border-box;
}
/* Wide variant (embedded checkout opts in). Stripe's Embedded Checkout renders
   its two-column layout — order summary/price on the left, payment form on the
   right, divider between — only when its container is wide enough; the default
   560px column collapses it to a single stacked column. Kept off the base
   .cn-main so the onboarding form / already-submitted pages stay narrow. */
.cn-main.cn-main--wide {
  max-width: 1040px;
}
/* Heading: Roboto, large and tightly tracked, matching the site's hero type. */
.cn-main h1 {
  font-family: var(--cn-font);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  margin-bottom: 12px;
}
.cn-main .description { text-align: center; }
/* Narrow onboarding-flow pages left-align their header + copy to match the rest
   of the marketing site; the wide embedded-checkout heading stays centered. */
.cn-main:not(.cn-main--wide) h1,
.cn-main:not(.cn-main--wide) .description { text-align: left; }
/* Logo at the top of the branded column — horizontally centered, above the checkout. */
.cn-main .cn-logo { display: flex; justify-content: center; margin-bottom: 24px; }
.cn-main .cn-logo svg { height: 30px; width: auto; display: block; }
/* Embedded Stripe Checkout sits in the branded column. */
.cn-main #checkout { margin-top: 8px; }
/* In-flight progress indicator shown under the submit button while submitting. */
.cn-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--cn-muted);
  font-size: 0.9rem;
}
/* The `hidden` attribute must win over display:flex above, or the spinner would
   never hide (author display beats the UA [hidden]{display:none} rule). */
.cn-progress[hidden] { display: none; }
.cn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--cn-border);
  border-top-color: var(--cn-ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ---- Checkout page ---- */
.checkout-wrap {
  display: flex;
  gap: 40px;
  max-width: 920px;
  margin: 48px auto;
  padding: 0 24px;
  align-items: flex-start;
  box-sizing: border-box;
}
.summary { flex: 1; min-width: 0; padding-top: 8px; }
.summary .product { font-size: 1rem; color: var(--cn-muted); margin: 0; }
.summary .price {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 4px 0 12px;
}
.summary .price-interval { color: var(--cn-muted); font-size: 0.95rem; margin: -8px 0 12px; }
.summary .description { color: var(--cn-muted); max-width: 34ch; }
.form-col {
  flex: 0 0 420px;
  min-width: 0;
  border-left: 1px solid var(--cn-border);
  padding-left: 40px;
}
@media (max-width: 760px) {
  .checkout-wrap { flex-direction: column; gap: 24px; }
  .form-col { flex: 1 1 auto; border-left: none; padding-left: 0; }
}
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
  width: 100%;
  padding: 11px 12px;
  font-size: 0.95rem;
  border: 1px solid var(--cn-border);
  border-radius: var(--cn-radius);
  box-sizing: border-box;
}
/* Input paired with a reveal (show/hide) toggle, e.g. a masked account number. */
.input-with-toggle { position: relative; }
.input-with-toggle input { padding-right: 44px; }
.reveal-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--cn-muted);
  cursor: pointer;
}
.reveal-toggle:hover { color: var(--cn-text); }
.reveal-toggle svg { display: block; width: 20px; height: 20px; }
/* Helper text under a field label describing where to find the value. */
.field-hint { color: var(--cn-muted); font-size: 0.8rem; margin: -2px 0 6px; }
/* Per-field inline validation message; empty (collapsed) until there's an error. */
.field-error { color: var(--cn-danger); font-size: 0.8rem; margin: 6px 0 0; }
.field-error:empty { display: none; }
.field input[aria-invalid="true"] { border-color: var(--cn-danger); }
#payment-element { margin: 8px 0 16px; }
.consent {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.8rem;
  color: var(--cn-muted);
  margin-bottom: 16px;
}
.consent input { margin-top: 3px; }
#submit-btn {
  width: 100%;
  padding: 12px 20px;
  background: var(--cn-ink);
  color: var(--cn-brand-text);
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
}
#submit-btn:disabled { opacity: 0.6; cursor: default; }
/* Authorization disclosure shown above the Save & Continue button. */
.auth-note { color: var(--cn-muted); font-size: 0.8rem; margin: 0 0 12px; }
.form-error { color: var(--cn-danger); font-size: 0.85rem; margin-top: 10px; min-height: 1em; }
.debug-panel {
  max-width: 920px;
  margin: 24px auto;
  padding: 12px 24px;
  background: var(--cn-surface);
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--cn-text);
  word-break: break-all;
}
.debug-panel h2 { font-size: 0.9rem; margin: 0 0 8px 0; }
.debug-panel div { margin-bottom: 4px; }

/* ---- Email sim page (test harness) ---- */
.page-email label { display: block; font-weight: bold; margin-top: 16px; margin-bottom: 4px; }
.page-email label code {
  background: var(--cn-surface);
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
}
.page-email input[type="text"] { width: 100%; padding: 8px; font-size: 1rem; box-sizing: border-box; }
.page-email .cta {
  display: inline-block;
  margin-top: 24px;
  padding: 14px 28px;
  background: var(--cn-brand);
  color: var(--cn-brand-text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}
.page-email .cta:hover { background: var(--cn-brand-hover); }
.page-email .flow-choice {
  margin-top: 24px;
  padding: 16px;
  border: 1px solid var(--cn-border);
  border-radius: var(--cn-radius);
}
.page-email .flow-choice legend {
  font-weight: bold;
  padding: 0 6px;
}
.page-email .flow-note {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--cn-muted);
}
.page-email .flow-note code {
  background: var(--cn-surface);
  padding: 1px 4px;
  border-radius: 3px;
}
.page-email .flow-option {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-weight: normal;
  margin: 10px 0 0;
  font-size: 0.95rem;
  cursor: pointer;
}
.page-email .flow-option input { margin-top: 4px; }
.page-email .flow-option strong { font-weight: 600; }
.page-email .link-preview {
  margin-top: 16px;
  padding: 12px;
  background: var(--cn-surface);
  border-radius: 4px;
  word-break: break-all;
  font-size: 0.9rem;
  color: var(--cn-text);
}

/* ---- Post-checkout selection page (next/) ---- */
.dest-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}
.dest-card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--cn-border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--cn-ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dest-card:hover {
  border-color: var(--cn-ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.dest-card strong { display: block; font-size: 1rem; }
.dest-card span { display: block; color: var(--cn-muted); font-size: 0.9rem; margin-top: 2px; }

/* Embedded Connect onboarding container (onboarding-embedded/) */
#onboarding-container { margin-top: 24px; }

/* ---- Success page ---- */
.page-success a.back { color: var(--cn-ink); font-weight: 600; }
.page-success .cta {
  display: inline-block;
  margin-top: 24px;
  padding: 14px 28px;
  background: var(--cn-brand);
  color: var(--cn-brand-text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}
.page-success .cta:hover { background: var(--cn-brand-hover); }

/* ---- Post-onboarding success view (onboarding-form success state) ---- */
/* Revealed in place of the form once banking details submit. Two columns on
   desktop — a confirmation card on the left, product value props on the right —
   stacking to one column on narrow screens. */
.success-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 48px;
  align-items: start;
}
.success-card h1 { text-align: left; margin-top: 16px; }
.success-card .description { text-align: left; margin-top: 8px; }
/* Green success checkmark in a soft circle. */
.success-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--cn-success-bg);
  color: var(--cn-success);
}
.success-check svg { width: 26px; height: 26px; display: block; }
/* Callout box drawing the eye to the Welcome-email next step. */
.success-callout {
  margin-top: 24px;
  padding: 16px 18px;
  background: var(--cn-info-bg);
  border-radius: var(--cn-radius);
}
.success-callout-label { font-weight: 700; margin: 0 0 4px; }
.success-callout-body { margin: 0; color: var(--cn-text); font-size: 0.95rem; }
.success-footnote { margin-top: 16px; color: var(--cn-muted); font-size: 0.85rem; }
/* Value-prop rail — separated from the card by a divider on desktop. */
.value-rail { border-left: 1px solid var(--cn-border-soft); padding-left: 48px; }
.value-rail-heading {
  font-family: var(--cn-font-title);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 16px;
}
.value-props { list-style: none; margin: 0; padding: 0; }
.value-props li { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.value-props li:last-child { margin-bottom: 0; }
.value-text { min-width: 0; }
.value-props strong { display: block; font-size: 0.95rem; }
.value-props span { display: block; color: var(--cn-muted); font-size: 0.9rem; margin-top: 2px; }
/* Halftone illustration on a color tile, blended so the white prints out to the
   tile color — Shannon's "placed over color" treatment for the Pantry halftones. */
.value-icon {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--cn-surface);
  overflow: hidden;
}
.value-icon img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
@media (max-width: 760px) {
  .success-grid { grid-template-columns: 1fr; gap: 32px; }
  .value-rail { border-left: none; padding-left: 0; }
}

/* ---- Transient hand-off pages (checkout → onboarding redirect) ---- */
/* Minimal, button-free "redirecting" screens so the hop to onboarding doesn't
   flash a full landing page with a prominent CTA. */
body.page-redirect {
  max-width: 420px;
  margin: 80px auto;
  padding: 0 20px;
  text-align: center;
  box-sizing: border-box;
}
.page-redirect .spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 16px;
  border: 3px solid var(--cn-border);
  border-top-color: var(--cn-ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.page-redirect .redirect-note { color: var(--cn-muted); font-size: 0.95rem; margin: 0; }
/* Subtle plain-text fallback — only revealed if the auto-redirect stalls; never
   the orange CTA that was flashing before. */
.page-redirect .fallback-link {
  display: inline-block;
  margin-top: 20px;
  color: var(--cn-ink);
  font-size: 0.9rem;
  font-weight: 600;
}
.page-redirect .form-error { color: var(--cn-danger); font-size: 0.9rem; margin-top: 12px; }
