/* =========================================================
   AI Branding Pages — Test Site
   Design tokens
   ---------------------------------------------------------
   Two independent token layers on purpose:

   1) --harness-*  → chrome for the QA/test-harness bar.
      Constant. Branding must NEVER touch these — this is
      how you can tell "the tool" from "the site under test"
      at a glance, even when branding fails to apply.

   2) --ab-*       → the actual brand contract. This is the
      exact surface the Cloudflare Worker (edge <style>
      injection) and the SyncBrand SDK (runtime JS) are
      both expected to override. If a deployment method
      changes these variables, the page re-themes instantly.
   ========================================================= */

:root {
  /* Harness chrome — fixed, never overridden */
  --harness-bg: #0b1220;
  --harness-fg: #e2e8f0;
  --harness-muted: #7c8aa5;
  --harness-accent: #22d3ee;
  --harness-ok: #34d399;
  --harness-warn: #fbbf24;
  --harness-font: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  /* Brand contract — generic/default ("unbranded") values.
     These are the values a fresh, un-integrated checkout
     would show before any AI Branding payload is applied. */
  --ab-color-primary: #64748b;
  --ab-color-secondary: #334155;
  --ab-color-accent: #94a3b8;
  --ab-color-background: #f1f5f9;
  --ab-color-surface: #ffffff;
  --ab-color-text: #0f172a;
  --ab-font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --ab-logo-url: none;
  --ab-brand-name: 'Generic Checkout';
  --ab-radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--ab-font-family);
  background: var(--ab-color-background);
  color: var(--ab-color-text);
  transition: background 220ms ease, color 220ms ease;
  min-height: 100vh;
}

a { color: inherit; }

/* ---------- Harness bar ---------- */
.harness {
  font-family: var(--harness-font);
  background: var(--harness-bg);
  color: var(--harness-fg);
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  font-size: 12.5px;
  border-bottom: 1px solid #1e293b;
  position: sticky;
  top: 0;
  z-index: 100;
}
.harness .tag {
  color: var(--harness-accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}
.harness .sep { color: #334155; }
.harness .field { color: var(--harness-muted); }
.harness .field b { color: var(--harness-fg); font-weight: 500; }
.harness .dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 6px;
  background: var(--harness-warn);
}
.harness .dot.applied { background: var(--harness-ok); }
.harness .swatches { display: inline-flex; gap: 4px; vertical-align: middle; }
.harness .sw {
  width: 13px; height: 13px; border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.25);
  display: inline-block;
}
.harness-spacer { flex: 1; }
.harness button {
  font-family: var(--harness-font);
  font-size: 12px;
  background: transparent;
  border: 1px solid #334155;
  color: var(--harness-fg);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.harness button:hover { border-color: var(--harness-accent); color: var(--harness-accent); }
.harness button.primary { background: var(--harness-accent); color: #05202a; border-color: var(--harness-accent); font-weight: 600; }
.harness a.navlink { color: var(--harness-muted); text-decoration: none; }
.harness a.navlink:hover { color: var(--harness-fg); }

/* ---------- Generic page chrome ---------- */
.site-header {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 28px;
  background: var(--ab-color-surface);
  border-bottom: 1px solid rgba(15,23,42,0.08);
}
.site-header .logo-mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--ab-color-primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px;
  background-image: var(--ab-logo-url);
  background-size: cover; background-position: center;
}
.site-header .brand-name { font-weight: 700; font-size: 17px; }
.site-header .brand-name::before { content: var(--ab-brand-name); }

.page-shell { max-width: 980px; margin: 0 auto; padding: 40px 24px 80px; }

.grid-2 { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 28px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--ab-color-surface);
  border: 1px solid rgba(15,23,42,0.08);
  border-radius: var(--ab-radius);
  padding: 24px;
}
.card h2 { margin-top: 0; font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--ab-color-secondary); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12.5px; color: var(--ab-color-secondary); }
.field input {
  padding: 11px 12px; border-radius: 8px;
  border: 1px solid rgba(15,23,42,0.15);
  font-family: var(--ab-font-family); font-size: 14px;
  background: var(--ab-color-background);
  color: var(--ab-color-text);
}
.field input:focus { outline: 2px solid var(--ab-color-accent); outline-offset: 1px; }

.line-item { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed rgba(15,23,42,0.1); font-size: 14px; }
.line-item.total { font-weight: 700; border-bottom: none; padding-top: 14px; font-size: 16px; }

.btn-pay {
  width: 100%; padding: 14px; margin-top: 8px;
  background: var(--ab-color-primary);
  color: #fff; border: none; border-radius: var(--ab-radius);
  font-family: var(--ab-font-family); font-weight: 700; font-size: 15px;
  cursor: pointer;
}
.btn-pay:hover { background: var(--ab-color-secondary); }
.btn-pay:focus-visible { outline: 3px solid var(--ab-color-accent); outline-offset: 2px; }

.badge-accent {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  background: var(--ab-color-accent); color: #fff; font-size: 11.5px; font-weight: 600;
}

.hint { font-size: 12.5px; color: var(--ab-color-secondary); opacity: .85; margin-top: 10px; }
.test-card-note { font-size: 12.5px; background: var(--ab-color-background); border: 1px dashed rgba(15,23,42,0.2); border-radius: 8px; padding: 10px 12px; margin-top: 14px; }

.pay-hosted {
  max-width: 420px; margin: 60px auto; text-align: center;
}
.pay-hosted .amount { font-size: 34px; font-weight: 800; margin: 14px 0 4px; }
.pay-hosted .merchant { color: var(--ab-color-secondary); font-size: 13px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
