@import url("design-tokens.css");

/* ============================================================
   VeraNet Design System — infrastructure-grade
   Tokens: design-tokens.css (canonical single source, V1.2 aligned)
   Aesthetic reference: Stripe / Cloudflare / Vercel
   Four-state reconciliation colors — V1.2 (matched/missing/conflict/unresolved)
   Fonts are loaded via <link> in each HTML head (preconnect + stylesheet).
   ============================================================ */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--fs-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* Restrained infra glow */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 520px at 50% -12%, rgba(76, 141, 255, .10), transparent 60%),
    radial-gradient(720px 420px at 86% 8%, rgba(46, 230, 168, .06), transparent 60%);
}
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:focus-visible, .btn:focus-visible, .nav-links a:focus-visible,
.card .link:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
h1, h2, h3 { margin: 0; }

.mono { font-family: var(--mono); }
.dim { color: var(--dim); }

/* ---------- Navigation ---------- */
nav { display: flex; align-items: center; justify-content: space-between; padding: 22px 0; border-bottom: 1px solid var(--border); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.logo-mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--on-accent); font-size: 15px;
}
.nav-links { display: flex; gap: 26px; font-size: 14px; }
.nav-links a { color: var(--dim); }
.nav-links a:hover { color: var(--text); }
.preview-tag {
  font-size: 11px; color: var(--dim); border: 1px solid var(--border);
  padding: 4px 11px; border-radius: var(--r-pill);
  font-family: var(--mono); letter-spacing: .5px;
}

/* ---------- Hero ---------- */
.hero { padding: 88px 0 64px; }
.hero-kicker, .kicker {
  font-family: var(--mono); font-size: 13px; color: var(--accent);
  letter-spacing: 2px; text-transform: uppercase; margin-bottom: 22px;
}
h1 { font-size: var(--fs-h1); line-height: 1.15; font-weight: 800; letter-spacing: -.02em; }
.hero h1 { font-size: var(--fs-display); line-height: 1.06; letter-spacing: -.03em; max-width: 840px; }
.hero h1 .dim { color: var(--dim); }
.brand h1 { font-size: 26px; letter-spacing: -.01em; }
.hero-sub, .sub { margin-top: 24px; font-size: 20px; color: var(--dim); max-width: 640px; font-weight: 400; line-height: 1.5; }
.hero-cta { margin-top: 38px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.hero-note { margin-top: 18px; font-size: 12px; color: var(--dim); font-family: var(--mono); }
.hero-witness { margin-top: 10px; font-size: 12px; color: var(--dim-2); font-family: var(--mono); border-left: 2px solid var(--unresolved); padding-left: 10px; line-height: 1.5; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 28px; border-radius: var(--r);
  font-size: 15px; font-weight: 600; cursor: pointer; border: none;
  transition: opacity .15s, transform .15s, border-color .15s;
  text-decoration: none;
}
.btn:hover { opacity: .9; transform: translateY(-1px); }
.btn-primary { background: var(--grad); color: var(--on-accent); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--border-strong); }

/* ---------- Sections ---------- */
.section { padding: 64px 0; border-top: 1px solid var(--border); }
.section:first-of-type { border-top: none; }
.section-label {
  font-family: var(--mono); font-size: 12px; color: var(--dim);
  letter-spacing: 2px; text-transform: uppercase; margin-bottom: 16px;
}
.section-title { font-size: var(--fs-h2); font-weight: 700; letter-spacing: -.02em; margin-bottom: 12px; line-height: 1.2; }
.section-desc { color: var(--dim); max-width: 680px; font-size: 16px; line-height: 1.6; }

/* ---------- Generic card ---------- */
.card, .claim-card, .evidence-card, .state-card, .layer-card,
.form-card, .who-card, .flow-step, .note {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: border-color .15s;
}
.card { padding: 22px; }
.card--conflict { border-color: rgba(239, 68, 68, .5); }
.card:hover, .claim-card:hover, .evidence-card:hover,
.state-card:hover, .layer-card:hover, .who-card:hover, .flow-step:hover {
  border-color: var(--border-strong);
}
.wrap > .card { margin-bottom: 20px; }

/* ---------- Conflict scene (index) ---------- */
.conflict-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 36px; }
.claim-card, .evidence-card { padding: 24px; }
.claim-card { border-color: rgba(76, 141, 255, .35); }
.evidence-card { border-color: rgba(239, 68, 68, .35); }
.card-title { font-size: 12px; font-family: var(--mono); letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 16px; }
.claim-card .card-title { color: var(--accent); }
.evidence-card .card-title { color: var(--conflict); }
.claim-line { font-size: 22px; font-weight: 700; padding: 14px 18px; border-radius: var(--r); background: var(--panel-2); border: 1px solid var(--border); }
.ev-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.ev-row:last-child { border-bottom: none; }
.ev-src { color: var(--dim); width: 90px; font-family: var(--mono); font-size: 13px; flex-shrink: 0; }
.ev-state { font-family: var(--mono); font-weight: 700; font-size: 13px; }
.st-match { color: var(--match); }
.st-conflict { color: var(--conflict); }
.st-missing { color: var(--missing); }
.resolve-banner {
  grid-column: 1 / -1; text-align: center; padding: 28px;
  background: linear-gradient(135deg, rgba(76, 141, 255, .08), rgba(46, 230, 168, .08));
  border: 1px solid var(--border); border-radius: var(--r-lg);
}
.resolve-banner .q { font-size: 20px; font-weight: 700; }
.resolve-banner .a { margin-top: 8px; font-size: 28px; font-weight: 800; letter-spacing: -.5px; }

/* ---------- Four states (index) ---------- */
.states-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 36px; }
.state-card { padding: 22px 18px; }
.state-code { font-family: var(--mono); font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.state-name { font-size: 14px; color: var(--dim); line-height: 1.4; }
.state-card.matched .state-code { color: var(--match); }
.state-card.missing .state-code { color: var(--missing); }
.state-card.conflict .state-code { color: var(--conflict); }
.state-card.unresolved .state-code { color: var(--unresolved); }

/* ---------- Three layers (index) ---------- */
.layers-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 36px; }
.layer-card { padding: 24px; }
.layer-name { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.layer-role { font-size: 13px; color: var(--dim); font-family: var(--mono); }
.layer-desc { font-size: 14px; color: var(--dim); margin-top: 10px; line-height: 1.5; }

/* ---------- Statement / CTA (index) ---------- */
.statement { border-radius: var(--r-xl); padding: 40px 32px; text-align: center; margin-top: 20px; }
.statement .en { font-size: 26px; font-weight: 700; letter-spacing: -.5px; line-height: 1.3; }
.statement .zh { margin-top: 12px; color: var(--dim); font-size: 15px; }
.cta {
  background: linear-gradient(135deg, rgba(76, 141, 255, .10), rgba(46, 230, 168, .06));
  border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 56px 32px; text-align: center;
}
.cta h2 { font-size: var(--fs-h2); font-weight: 800; letter-spacing: -.02em; }
.cta p { color: var(--dim); margin: 14px auto 30px; max-width: 560px; font-size: 16px; line-height: 1.6; }

/* ---------- Developer: pipeline flow ---------- */
.flow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.flow-step { padding: 16px 20px; }
.flow-step .n { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.flow-step .t { font-size: 15px; font-weight: 600; margin-top: 4px; }
.flow-arrow { color: var(--dim); font-size: 20px; }

pre { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); padding: 20px; overflow-x: auto; font-family: var(--mono); font-size: 13px; line-height: 1.7; color: var(--code-fg); margin-top: 20px; }
pre .key { color: var(--accent); }
pre .str { color: var(--code-str); }

.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.card h3 { font-size: 16px; margin-bottom: 10px; }
.card p { font-size: 14px; color: var(--dim); }
.card .link { margin-top: 14px; font-size: 14px; font-weight: 600; }

.note { margin-top: 28px; font-size: 13px; color: var(--dim); font-family: var(--mono); border-radius: var(--r); padding: 16px 20px; }

/* ---------- Early Access: form ---------- */
.pill-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.pill-row .pill { font-size: 13px; border: 1px solid var(--border); border-radius: var(--r-pill); padding: 7px 16px; color: var(--dim); font-family: var(--mono); }

.form-card { padding: 32px; margin-top: 32px; }
.field { margin-bottom: 24px; }
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
label .qnum { color: var(--accent); font-family: var(--mono); font-size: 12px; margin-right: 8px; }
.hint { color: var(--dim); font-size: 12px; margin-top: 10px; }
.hint code { background: var(--panel-2); padding: 1px 6px; border-radius: 4px; font-family: var(--mono); }
input, textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--r-sm); padding: 13px 15px;
  font-size: 15px; font-family: var(--mono); outline: none; transition: border-color .15s;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
.form-note { margin-top: 20px; font-size: 12px; color: var(--dim); font-family: var(--mono); line-height: 1.8; }

.who { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 32px; }
.who-card { padding: 20px; }
.who-card .t { font-weight: 700; font-size: 14px; }
.who-card .d { font-size: 13px; color: var(--dim); margin-top: 6px; line-height: 1.5; }

/* ---------- Reconcile demo ---------- */
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.subtitle { color: var(--dim); margin: 4px 0 28px; font-size: 15px; line-height: 1.5; }
.subtitle b { color: var(--accent); font-weight: 600; }
.row { display: flex; gap: 14px; margin-bottom: 16px; }
.row > div { flex: 1; }

.verdict-bar { display: flex; align-items: center; gap: 16px; padding: 18px 22px; border-radius: var(--r); margin-bottom: 18px; border: 1px solid var(--border); background: var(--panel); }
.verdict-label { font-size: 13px; color: var(--dim); font-weight: 600; }
.verdict-value { font-size: 26px; font-weight: 800; letter-spacing: -.5px; font-family: var(--mono); }
.verdict-note { font-size: 12px; color: var(--dim); margin-left: auto; text-align: right; }
.verdict-result { font-size: 12px; color: var(--dim); margin-top: 5px; font-family: var(--mono); letter-spacing: .3px; }
.v-CONSISTENT { background: var(--match-bg); }
.v-CONSISTENT .verdict-value { color: var(--match); }
.v-INCOMPLETE { background: var(--missing-bg); }
.v-INCOMPLETE .verdict-value { color: var(--missing); }
.v-CONFLICTING { background: var(--conflict-bg); }
.v-CONFLICTING .verdict-value { color: var(--conflict); }
.v-UNSUPPORTED { background: var(--conflict-bg); }
.v-UNSUPPORTED .verdict-value { color: var(--conflict); }
.s-unresolved { color: var(--unresolved); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--dim); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: .4px; }
td { padding: 13px 12px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: top; }
tr:last-child td { border-bottom: none; }
.status { font-family: var(--mono); font-weight: 700; font-size: 13px; white-space: nowrap; }
.s-matched { color: var(--match); }
.s-missing { color: var(--missing); }
.s-conflict { color: var(--conflict); }
.detail { color: var(--text); }
.q { color: var(--dim); font-size: 12px; }
.detail a { color: var(--accent); text-decoration: none; font-size: 12px; font-family: var(--mono); }
.detail a:hover { text-decoration: underline; }
.indep { font-size: 11px; color: var(--dim); font-family: var(--mono); }

.summary-pills { display: flex; gap: 14px; margin-bottom: 18px; }
.summary-pills .pill { font-family: var(--mono); font-size: 14px; }
.summary-pills .pill b { font-size: 20px; }
.summary-pills .s-matched { color: var(--match); }
.summary-pills .s-missing { color: var(--missing); }
.summary-pills .s-conflict { color: var(--conflict); }
.summary-pills .s-unresolved { color: var(--unresolved); }

.error { color: var(--conflict); font-size: 13px; margin-top: 12px; }
.loading { color: var(--dim); font-size: 14px; }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--border); padding: 40px 0 60px; margin-top: 60px; }
.footer-grid { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer-note { font-size: 12px; color: var(--dim); max-width: 480px; font-family: var(--mono); line-height: 1.8; }
.footer-links { display: flex; gap: 20px; font-size: 13px; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .hero { padding: 56px 0 40px; }
  .hero h1 { font-size: 34px; }
  h1 { font-size: 32px; }
  .section { padding: 44px 0; }
  .conflict-grid, .states-grid, .layers-grid, .card-grid, .who { grid-template-columns: 1fr; }
  .nav-links { gap: 16px; font-size: 12px; }
  .preview-tag { display: none; }
}

/* ---------- Flat / no-glow opt-in (visual assets) ---------- */
/* design-tokens.css is the single source of truth for design tokens.
   Visual assets link this file but opt out of the ambient glow. */
body.flat::before { display: none; }

/* ---------- Embedded demo (index landing) ---------- */
.demo-embed { margin-top: 28px; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--bg); }
.demo-embed iframe { width: 100%; height: 640px; border: none; display: block; }
@media (max-width: 720px) {
  .demo-embed iframe { height: 760px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
