/* api4pqc — design tokens forked from prototype.
   Edit defaults in public/legacy/app.jsx (TWEAK_DEFAULTS). */
:root {
  --bg: #f7f9fb;
  --bg-elev: #ffffff;
  --bg-section: #f1f4f7;
  --bg-dark: #0a1626;
  --bg-dark-2: #0f1f33;
  --ink: #0a1626;
  --ink-2: #1a2b42;
  --ink-3: #4a5b73;
  --ink-4: #6b7a90;
  --ink-5: #8b97a8;
  --line: #e1e7ee;
  --line-2: #d3dbe4;
  --line-strong: #b8c2cf;
  --accent: #0891a8;        /* cyan/teal */
  --accent-2: #06b6c4;
  --accent-soft: #e0f4f7;
  --accent-deep: #064e5b;
  --warn: #b45309;
  --good: #047857;
  --danger: #be123c;
  --shadow-sm: 0 1px 2px rgba(10, 22, 38, 0.04), 0 1px 1px rgba(10, 22, 38, 0.03);
  --shadow-md: 0 4px 16px rgba(10, 22, 38, 0.06), 0 2px 4px rgba(10, 22, 38, 0.04);
  --shadow-lg: 0 12px 40px rgba(10, 22, 38, 0.10), 0 4px 12px rgba(10, 22, 38, 0.05);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --serif: "Newsreader", "Source Serif Pro", Georgia, serif;
  --sans: "Inter Tight", "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Fira Code", "SF Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body { overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent); color: white; }

/* Layout */
.shell { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
.section { padding: 96px 0; border-top: 1px solid var(--line); }
.section.tight { padding: 64px 0; }
.section.dark { background: var(--bg-dark); color: #e8eef5; border-color: #1a2b42; }
.section.muted { background: var(--bg-section); }

/* Eyebrow */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(8, 145, 168, 0.15);
}
.section.dark .eyebrow { color: var(--accent-2); }
.section.dark .eyebrow::before { background: var(--accent-2); box-shadow: 0 0 0 4px rgba(6, 182, 196, 0.18); }

/* Type */
h1, h2, h3, h4 { font-family: var(--sans); font-weight: 500; letter-spacing: -0.02em; color: var(--ink); }
.section.dark h1, .section.dark h2, .section.dark h3, .section.dark h4 { color: #f4f7fb; }
h1 { font-size: clamp(40px, 5.6vw, 76px); line-height: 1.02; letter-spacing: -0.035em; font-weight: 450; }
h2 { font-size: clamp(32px, 3.6vw, 52px); line-height: 1.05; letter-spacing: -0.028em; font-weight: 450; }
h3 { font-size: clamp(20px, 1.6vw, 24px); line-height: 1.2; letter-spacing: -0.018em; font-weight: 500; }
.lede { font-size: 19px; line-height: 1.55; color: var(--ink-3); max-width: 60ch; }
.section.dark .lede { color: #b8c2cf; }
.label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: all 140ms ease;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: var(--ink);
  color: white;
}
.btn-primary:hover { background: #1a2b42; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-accent {
  background: var(--accent);
  color: white;
}
.btn-accent:hover { background: var(--accent-deep); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-2);
}
.btn-ghost:hover { border-color: var(--ink); background: white; }
.section.dark .btn-ghost { color: #e8eef5; border-color: #2a3b52; }
.section.dark .btn-ghost:hover { border-color: #e8eef5; background: rgba(255,255,255,0.04); }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 6px; }

/* Nav */
.nav {
  position: sticky;
  top: 0; z-index: 50;
  background: rgba(247, 249, 251, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px;
  max-width: 1280px;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.015em; font-size: 17px; }
.brand-mark {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--ink);
  color: white;
}
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a { font-size: 14px; color: var(--ink-3); transition: color 140ms; }
.nav-links a:hover { color: var(--ink); }
.nav-cta { display: flex; gap: 10px; align-items: center; }

/* Pill / status badge */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  background: white;
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-family: var(--mono);
  color: var(--ink-3);
  font-weight: 450;
}
.pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.14);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.14); }
  50% { box-shadow: 0 0 0 5px rgba(4, 120, 87, 0.05); }
}

/* Card */
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all 200ms ease;
}
.card.flat { box-shadow: none; }
.card-hover:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Grid utilities */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 920px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Code block */
.code-window {
  background: var(--bg-dark);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid #1a2b42;
  font-family: var(--mono);
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
}
.code-tabs {
  display: flex;
  background: #061222;
  border-bottom: 1px solid #1a2b42;
  padding: 0 8px;
  align-items: center;
  gap: 2px;
  position: relative;
}
.code-tab {
  padding: 12px 16px;
  font-size: 12.5px;
  font-family: var(--mono);
  color: #6b7a90;
  letter-spacing: -0.005em;
  border-bottom: 2px solid transparent;
  transition: all 140ms;
  position: relative;
  top: 1px;
}
.code-tab:hover { color: #b8c2cf; }
.code-tab.active {
  color: var(--accent-2);
  border-bottom-color: var(--accent-2);
}
.code-traffic {
  display: flex; gap: 6px; padding: 0 12px;
}
.code-traffic span {
  width: 11px; height: 11px; border-radius: 50%;
  background: #1f3149;
}
.code-body {
  padding: 22px 24px;
  color: #c8d1de;
  line-height: 1.65;
  position: relative;
  white-space: pre;
  overflow-x: auto;
  min-height: 280px;
}
.code-copy {
  position: absolute;
  top: 14px; right: 14px;
  padding: 6px 10px;
  font-size: 11px;
  font-family: var(--mono);
  color: #6b7a90;
  border: 1px solid #1f3149;
  border-radius: 6px;
  background: rgba(255,255,255,0.02);
  transition: all 140ms;
  z-index: 2;
}
.code-copy:hover { color: var(--accent-2); border-color: var(--accent-2); }
.code-copy.copied { color: var(--good); border-color: var(--good); }

/* Syntax */
.tk-kw { color: #c084fc; }
.tk-fn { color: #60a5fa; }
.tk-str { color: #5eead4; }
.tk-num { color: #fbbf24; }
.tk-com { color: #4a5b73; font-style: italic; }
.tk-op { color: #94a3b8; }
.tk-prop { color: #93c5fd; }
.tk-const { color: #f472b6; }

/* Trust bar logos */
.trust-bar {
  display: flex; align-items: center; gap: 48px;
  flex-wrap: wrap;
  opacity: 0.7;
}
.trust-logo {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--ink-4);
  font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}

/* Animated diagram */
.diagram-wrap {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px;
  position: relative;
  overflow: hidden;
}
.diagram-wrap::before {
  content: "";
  position: absolute; inset: 0;
  background-image: 
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.4;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
          mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

/* Stepper */
.stepper {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: white;
  overflow: hidden;
  min-height: 480px;
}
.step-list {
  background: var(--bg-section);
  border-right: 1px solid var(--line);
  padding: 12px;
}
.step-item {
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  border-radius: 10px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  position: relative;
  transition: all 160ms;
  margin-bottom: 4px;
}
.step-item:hover { background: rgba(255,255,255,0.6); }
.step-item.active { background: white; box-shadow: var(--shadow-sm); }
.step-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: white;
  border: 1px solid var(--line-2);
  display: grid; place-items: center;
  color: var(--ink-3);
  font-weight: 500;
  flex-shrink: 0;
  transition: all 160ms;
}
.step-item.active .step-num {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}
.step-item.done .step-num {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.step-title {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.005em;
  margin-bottom: 2px;
}
.step-sub {
  font-size: 12.5px;
  color: var(--ink-4);
}
.step-detail {
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Feature card */
.feature {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
  transition: all 220ms ease;
  cursor: pointer;
  overflow: hidden;
}
.feature:hover {
  border-color: var(--ink);
  transform: translateY(-3px);
}
.feature-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  display: grid; place-items: center;
  margin-bottom: 18px;
  transition: all 220ms;
}
.feature:hover .feature-icon { background: var(--ink); color: var(--accent-2); }
.feature h3 { margin-bottom: 8px; }
.feature p { color: var(--ink-3); font-size: 14.5px; line-height: 1.55; }
.feature-detail {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--line-2);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-4);
  line-height: 1.6;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 280ms ease;
  border-top-color: transparent;
}
.feature:hover .feature-detail {
  max-height: 200px;
  opacity: 1;
  border-top-color: var(--line-2);
}

/* Use case row */
.use-case {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--line);
  padding: 32px 0;
  align-items: start;
}
.use-case:last-child { border-bottom: 1px solid var(--line); }
.use-case-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-4);
  letter-spacing: 0.06em;
}
.use-case h3 { margin-top: 8px; margin-bottom: 8px; }
.use-case p { color: var(--ink-3); font-size: 15.5px; max-width: 50ch; }

/* Pricing */
.price-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: all 200ms;
  position: relative;
}
.price-card.featured {
  border-color: var(--ink);
  box-shadow: var(--shadow-lg);
  transform: scale(1.02);
  background: linear-gradient(180deg, white, #fafcfd);
}
.price-card.featured::before {
  content: "Most popular";
  position: absolute;
  top: -12px; right: 24px;
  background: var(--ink);
  color: white;
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.05em;
  padding: 5px 10px;
  border-radius: 6px;
  text-transform: uppercase;
}
.price-amount {
  font-size: 44px;
  font-weight: 450;
  letter-spacing: -0.03em;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.price-amount .unit {
  font-size: 14px;
  color: var(--ink-4);
  font-family: var(--mono);
  font-weight: 400;
}
.price-feat {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 14.5px;
  color: var(--ink-3);
  line-height: 1.5;
}
.price-feat svg { flex-shrink: 0; margin-top: 3px; color: var(--accent); }

.toggle-pill {
  display: inline-flex;
  background: white;
  border: 1px solid var(--line);
  padding: 4px;
  border-radius: 999px;
  position: relative;
}
.toggle-pill button {
  padding: 8px 18px;
  font-size: 13px;
  border-radius: 999px;
  color: var(--ink-3);
  position: relative;
  z-index: 2;
  transition: color 200ms;
  font-weight: 500;
}
.toggle-pill button.active { color: white; }
.toggle-pill .toggle-thumb {
  position: absolute;
  top: 4px; bottom: 4px;
  background: var(--ink);
  border-radius: 999px;
  transition: all 280ms cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 1;
}
.toggle-pill .save-badge {
  font-size: 10px;
  font-family: var(--mono);
  background: var(--accent-soft);
  color: var(--accent-deep);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

/* Quote */
.quote {
  font-family: var(--serif);
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 400;
  color: var(--ink);
  max-width: 22ch;
}
.quote-attr {
  margin-top: 32px;
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 14px;
  color: var(--ink-3);
}
.quote-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
  display: grid; place-items: center;
  font-weight: 500;
  font-size: 14px;
}

/* Footer */
.footer {
  background: var(--bg-dark);
  color: #b8c2cf;
  padding: 80px 0 32px;
}
.footer h4 { color: white; font-size: 13px; font-family: var(--mono); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 16px; font-weight: 500;}
.footer ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer a { color: #8b97a8; font-size: 14px; transition: color 140ms; }
.footer a:hover { color: white; }
.footer-bottom {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid #1a2b42;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 12px;
  color: #6b7a90;
}

/* Big final CTA */
.cta-final {
  text-align: center;
  padding: 120px 0;
  background: var(--bg-dark);
  color: white;
  position: relative;
  overflow: hidden;
}
.cta-final h2 { color: white; max-width: 18ch; margin: 0 auto 32px; }

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 600ms cubic-bezier(0.22, 1, 0.36, 1) both; }

@keyframes flow {
  0% { stroke-dashoffset: 60; }
  100% { stroke-dashoffset: 0; }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: white;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--mono);
  opacity: 0;
  pointer-events: none;
  transition: all 220ms;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Hero */
.hero { padding: 80px 0 100px; position: relative; overflow: hidden; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 64px;
  align-items: center;
}
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; }
}
.hero h1 { margin-bottom: 24px; }
.hero .lede { font-size: 20px; margin-bottom: 32px; }
.hero-cta { display: flex; gap: 12px; margin-bottom: 40px; flex-wrap: wrap; }
.hero-trust {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px;
  color: var(--ink-4);
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

/* Lattice background for hero */
.hero-bg {
  position: absolute;
  top: 0; right: -10%; width: 70%; height: 100%;
  pointer-events: none;
  opacity: 0.5;
  -webkit-mask-image: radial-gradient(ellipse at top right, black 20%, transparent 70%);
          mask-image: radial-gradient(ellipse at top right, black 20%, transparent 70%);
}

/* Compliance badges */
.badge-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 768px) { .badge-row { grid-template-columns: repeat(2, 1fr); } }
.badge {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  background: white;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.badge .label { font-family: var(--mono); font-size: 10.5px; }
.badge h4 { font-size: 15px; font-weight: 500; }
.badge p { font-size: 13px; color: var(--ink-3); line-height: 1.5; }

/* Section header */
.section-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 56px;
  max-width: 720px;
}
.section-header.center { margin-left: auto; margin-right: auto; text-align: center; align-items: center; }

/* Code playground response panel */
.response-panel {
  background: #061222;
  border-top: 1px solid #1a2b42;
  padding: 18px 24px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: #b8c2cf;
  max-height: 0;
  overflow: hidden;
  transition: max-height 320ms ease, padding 320ms ease;
}
.response-panel.open { max-height: 280px; padding: 18px 24px; }
.response-header {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 10px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7a90;
}
.response-status {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--good);
}
.response-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); }
.run-btn {
  position: absolute;
  top: 14px; right: 80px;
  padding: 6px 12px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--accent-2);
  border: 1px solid var(--accent-2);
  border-radius: 6px;
  background: rgba(6, 182, 196, 0.06);
  transition: all 140ms;
  z-index: 2;
  display: inline-flex; align-items: center; gap: 5px;
}
.run-btn:hover { background: var(--accent-2); color: var(--bg-dark); }
.run-btn.loading { opacity: 0.7; pointer-events: none; }

/* Tweaks helper */
.tweaks-tip {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: white;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 8px 12px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms;
  z-index: 40;
}
