/* PayDataOps - design tokens + layout
   Aligned to /var/www/CLAUDE.md Web App Styling Standards:
   - 18px body, WCAG AA contrast, dark/light toggle, RAD navy #1E3A8A accent,
     system font stack, mobile-first.
*/

:root {
  --rad-navy: #1E3A8A;
  --rad-navy-soft: #2D4FB0;
  --rad-navy-deep: #142668;
  --rad-amber: #F59E0B;
  --rad-amber-soft: #FBBF24;

  --bg:           #FFFFFF;
  --bg-elevated:  #F8FAFC;
  --bg-section:   #F1F5F9;
  --bg-card:      #FFFFFF;
  --bg-input:     #FFFFFF;

  --text:         #0F172A;
  --text-muted:   #475569;
  --text-faint:   #64748B;

  --border:       #E2E8F0;
  --border-strong:#CBD5E1;

  --accent:       var(--rad-navy);
  --accent-text:  #FFFFFF;
  --accent-hover: var(--rad-navy-deep);

  --shadow-card:  0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-modal: 0 16px 48px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.10);

  --radius-sm:    6px;
  --radius:       12px;
  --radius-lg:    16px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --container-max: 1120px;
  --container-pad: 24px;
}

html[data-theme="dark"] {
  --bg:           #0B1220;
  --bg-elevated:  #111B2E;
  --bg-section:   #0F1A2E;
  --bg-card:      #15223A;
  --bg-input:     #0F1A2E;

  --text:         #F1F5F9;
  --text-muted:   #CBD5E1;
  --text-faint:   #94A3B8;

  --border:       #1F2D4A;
  --border-strong:#2A3B5C;

  --accent:       #5B7BD6;
  --accent-text:  #0B1220;
  --accent-hover: #7A95E0;

  --shadow-card:  0 1px 2px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.4);
  --shadow-modal: 0 16px 48px rgba(0,0,0,0.6), 0 4px 12px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

/* ---------- Header ---------- */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(8px);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 18px;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--rad-navy);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.5px;
  align-self: center;
}
.brand-name {
  font-size: 20px;
  letter-spacing: -0.01em;
}
.brand-sub {
  font-size: 14px;
  color: var(--text-faint);
  font-weight: 400;
}

.theme-toggle {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.theme-toggle:hover { background: var(--bg-section); }
.theme-icon-light, .theme-icon-dark { line-height: 1; }
html[data-theme="light"] .theme-icon-dark { display: none; }
html[data-theme="dark"]  .theme-icon-light { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  font-size: 17px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
  transition: background 0.12s, color 0.12s, border-color 0.12s, transform 0.06s;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
  outline: 3px solid var(--rad-amber-soft);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-elevated); text-decoration: none; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-arrow { transform: translateY(-1px); }

/* ---------- Section base ---------- */
section { padding: 80px 0; }
section + section { border-top: 1px solid var(--border); }
.section-title {
  font-size: 32px;
  line-height: 1.2;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.section-sub {
  font-size: 18px;
  color: var(--text-muted);
  margin: 0 0 40px;
  max-width: 720px;
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(180deg, var(--bg-section) 0%, var(--bg) 100%);
  padding: 96px 0 80px;
  text-align: left;
}
.hero-eyebrow {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(30, 58, 138, 0.1);
  color: var(--rad-navy);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 24px;
  letter-spacing: 0.02em;
}
html[data-theme="dark"] .hero-eyebrow {
  background: rgba(91, 123, 214, 0.18);
  color: #A6BCEC;
}
.hero-headline {
  font-size: 56px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  font-weight: 700;
  max-width: 820px;
  color: var(--text);
}
.hero-amount {
  color: var(--rad-amber);
  font-variant-numeric: tabular-nums;
}
html[data-theme="dark"] .hero-amount { color: var(--rad-amber-soft); }
.hero-sub {
  font-size: 21px;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0 0 32px;
  max-width: 760px;
}
.hero-ctas { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-foot {
  font-size: 15px;
  color: var(--text-faint);
  margin: 36px 0 0;
}

/* ---------- Problem ---------- */
.problem-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.problem-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.problem-card p { margin: 0; font-size: 17px; line-height: 1.55; color: var(--text); }
.problem-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
}

/* ---------- Capabilities ---------- */
.capabilities { background: var(--bg-section); }
.cap-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.cap-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-card);
}
.cap-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 22px;
  margin-bottom: 16px;
}
.cap-card h3 {
  font-size: 22px;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.cap-card p { margin: 0; font-size: 17px; line-height: 1.6; color: var(--text-muted); }
.cap-card strong { color: var(--text); }

/* ---------- Pricing ---------- */
.price-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.price-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.price-card-feature {
  border: 2px solid var(--accent);
  transform: translateY(-4px);
}
.price-tier {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.price-amount {
  font-size: 56px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.price-unit {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.price-range {
  font-size: 16px;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.price-foot {
  text-align: center;
  margin: 40px auto 0;
  font-size: 17px;
  color: var(--text-muted);
  max-width: 720px;
  line-height: 1.6;
}

/* ---------- Audit form ---------- */
.audit { background: var(--bg-section); }
.audit-form {
  max-width: 560px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-card);
}
.form-row { margin-bottom: 18px; }
.form-row label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-optional {
  font-weight: 400;
  color: var(--text-faint);
  font-size: 14px;
}
.form-row input,
.form-row textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 17px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font-family: inherit;
  line-height: 1.4;
}
.form-row input:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.18);
}
.form-row textarea { resize: vertical; min-height: 80px; }
.form-status {
  margin: 12px 0 0;
  font-size: 15px;
  min-height: 1.5em;
}
.form-status.ok   { color: #15803D; }
.form-status.err  { color: #B91C1C; }
html[data-theme="dark"] .form-status.ok  { color: #34D399; }
html[data-theme="dark"] .form-status.err { color: #FCA5A5; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 40px 0 60px;
}
.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-brand { font-size: 17px; color: var(--text); }
.footer-sub { color: var(--text-faint); font-weight: 400; }
.footer-meta { font-size: 15px; color: var(--text-muted); }
.footer-meta a { color: var(--text-muted); }
.footer-meta a:hover { color: var(--accent); }
.footer-dot { margin: 0 8px; color: var(--text-faint); }
.footer-copy {
  margin: 24px 0 0;
  font-size: 14px;
  color: var(--text-faint);
  max-width: 640px;
  line-height: 1.5;
}

/* ---------- Demo Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal.is-open { display: flex; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
html[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, 0.65); }
.modal-panel {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 36px 32px 32px;
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--border);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
}
.modal-close:hover { background: var(--bg-elevated); color: var(--text); }
.modal-header h2 {
  margin: 0 0 8px;
  font-size: 24px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.modal-header p {
  margin: 0 0 24px;
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.55;
}

.demo-result {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.result-category-block {
  background: var(--bg-section);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 16px;
}
.result-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  font-weight: 600;
  margin-bottom: 4px;
}
.result-category {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.result-meta { margin-bottom: 14px; }
.result-confidence {
  display: inline-block;
  font-size: 14px;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
}
.result-reasoning {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 24px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 18px 22px;
}
.result-footer {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.result-footer .btn { flex: 1 1 auto; }

.demo-error {
  margin: 16px 0 0;
  color: #B91C1C;
  font-size: 15px;
  background: rgba(185, 28, 28, 0.06);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid rgba(185, 28, 28, 0.15);
}
html[data-theme="dark"] .demo-error {
  color: #FCA5A5;
  background: rgba(252, 165, 165, 0.06);
  border-color: rgba(252, 165, 165, 0.2);
}

/* ---------- Loading spinner ---------- */
.btn.is-loading {
  position: relative;
  color: transparent !important;
}
.btn.is-loading::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 18px; height: 18px;
  margin-left: -9px; margin-top: -9px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  color: var(--accent-text);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .hero-headline { font-size: 42px; }
  .hero-sub { font-size: 19px; }
  .section-title { font-size: 26px; }
  .problem-grid { grid-template-columns: 1fr; }
  .cap-grid { grid-template-columns: 1fr; }
  .price-grid { grid-template-columns: 1fr; }
  .price-card-feature { transform: none; }
  section { padding: 64px 0; }
  .hero { padding: 64px 0 56px; }
}
@media (max-width: 520px) {
  :root { --container-pad: 18px; }
  .hero-headline { font-size: 34px; }
  .hero-sub { font-size: 18px; }
  .brand-sub { display: none; }
  .hero-ctas .btn { width: 100%; }
  .result-footer { flex-direction: column; }
}
