/* Credence — credence.at landing site
   Single shared stylesheet for the static pages. Dark, "instrument-grade"
   theme built on the brand tokens in assets/brand/README.md. */

:root {
  /* Brand tokens */
  --bg:            #0e1116;   /* page background */
  --bg-elev:       #151a21;   /* raised panels / cards */
  --bg-elev-2:     #1a2029;   /* nested code blocks */
  --border:        #232a33;
  --border-strong: #2f3742;
  --ink:           #c2c7cf;   /* primary text */
  --ink-dim:       #8b93a0;   /* secondary text */
  --ink-faint:     #6b7079;   /* captions, footnotes */
  --accent:        #8A8F98;   /* brand gray */

  /* Editor-syntax accents (from the JSON response asset) */
  --syn-key:  #9cdcfe;        /* keys / n_effective */
  --syn-str:  #ce9178;        /* strings */
  --syn-num:  #b5cea8;        /* numbers / p_calibrated */
  --syn-punc: #b8bec8;

  --good: #b5cea8;
  --warn: #e0b877;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --maxw: 1080px;
  --radius: 12px;
  --radius-sm: 8px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* subtle top glow so the page doesn't read as flat black */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 480px;
  background: radial-gradient(60% 100% at 50% 0%, rgba(138,143,152,.10), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

h1, h2, h3, h4 { color: #e7eaef; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
h3 { font-size: 1.2rem; letter-spacing: -0.01em; }
p { margin: 0 0 1rem; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: #fff; }
strong { color: #e7eaef; font-weight: 650; }
hr { border: 0; border-top: 1px solid var(--border); margin: 0; }

.mono { font-family: var(--mono); }
.dim  { color: var(--ink-dim); }
.faint{ color: var(--ink-faint); font-size: .85rem; }
.lead { font-size: clamp(1.05rem, 2vw, 1.3rem); color: var(--ink-dim); max-width: 46ch; }
.center { text-align: center; }
.eyebrow {
  font-family: var(--mono); font-size: .8rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 1rem;
}

/* field-name tokens */
.tok { font-family: var(--mono); font-size: .95em; }
.tok.calib { color: var(--syn-num); }
.tok.neff  { color: var(--syn-key); }
.tok.mkt   { color: var(--ink-dim); }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(14,17,22,.82);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: inline-flex; align-items: center; }
.brand img { display: block; height: 26px; width: auto; }
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a { color: var(--ink-dim); font-size: .95rem; }
.nav-links a:hover { color: var(--ink); }
.nav-links a[aria-current="page"] { color: var(--ink); }
.nav-toggle, .nav-toggle-label { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font-family: var(--sans); font-size: .95rem; font-weight: 600;
  padding: .6em 1.1em; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; transition: transform .08s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: #0c1015; }
.btn-primary:hover { background: #fff; color: #0c1015; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--accent); color: #fff; }
.nav-cta { padding: .5em 1em; }

.arrow::after { content: " →"; }

/* ---------- Sections ---------- */
main { position: relative; z-index: 1; }
section { padding: 72px 0; }
section + section { border-top: 1px solid var(--border); }
.section-narrow { max-width: 760px; }
.section-title { max-width: 40ch; }
.muted-panel { background: var(--bg-elev); }

/* ---------- Hero ---------- */
.hero { padding: clamp(56px, 9vw, 104px) 0 72px; }
.hero h1 span { display: block; }
.hero h1 .accent-line { color: var(--accent); }
.hero .lead { margin-top: 1.2rem; font-size: clamp(1.1rem, 2.2vw, 1.4rem); max-width: 40ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 2rem; }

/* callout card (Eurovision teaser etc.) */
.callout {
  margin-top: 3rem; background: var(--bg-elev); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: var(--radius);
  padding: 22px 24px; max-width: 640px;
}
.callout .eyebrow { margin-bottom: .5rem; }
.callout p { margin: 0 0 .75rem; color: var(--ink); }
.callout a { color: var(--syn-key); font-weight: 600; }

/* ---------- Grids ---------- */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.split { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }

.card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.card h3 { margin-bottom: .35rem; }
.card p { color: var(--ink-dim); margin: 0; font-size: .98rem; }

/* probability-object field list */
.fields { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 12px; }
.fields li {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 18px; color: var(--ink-dim);
}
.fields b { font-family: var(--mono); font-weight: 600; }

/* stat row */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-top: 2rem; }
.stat .num { font-family: var(--mono); font-size: clamp(1.4rem, 3vw, 2rem); color: #e7eaef; letter-spacing: -.02em; }
.stat .lbl { color: var(--ink-dim); font-size: .9rem; margin-top: .25rem; }

/* figures */
figure { margin: 0; }
figure img { display: block; width: 100%; height: auto; }
figure.chart { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
figcaption { color: var(--ink-faint); font-size: .85rem; margin-top: .75rem; text-align: center; }

/* ---------- Code blocks ---------- */
pre {
  background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 18px 20px; overflow-x: auto; margin: 0 0 1rem;
}
code { font-family: var(--mono); font-size: .9rem; }
pre code { color: var(--syn-punc); line-height: 1.6; }
p code, li code { background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 6px; padding: .1em .4em; color: var(--ink); }
.code-tabs { display: grid; gap: 16px; }
.code-label { font-family: var(--mono); font-size: .8rem; color: var(--ink-faint); margin-bottom: .4rem; text-transform: lowercase; }

/* ---------- Examples ---------- */
.example {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; margin-bottom: 28px;
}
.example.resolved { border-color: var(--border-strong); box-shadow: 0 0 0 1px rgba(181,206,168,.12); }
.example > h3 { font-size: 1.35rem; }
.example .setup { color: var(--ink-dim); }
.decision-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 20px 0; }
.decision {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px; background: var(--bg);
}
.decision h4 { font-size: .95rem; color: var(--ink-dim); font-weight: 600; margin-bottom: .5rem; }
.decision.internet h4::before { content: "✕ "; color: var(--ink-faint); }
.decision.credence { border-color: rgba(156,220,254,.35); }
.decision.credence h4 { color: var(--syn-key); }
.decision.credence h4::before { content: "✓ "; }
.decision p { margin: 0; font-size: .96rem; }
.decision .num { font-family: var(--mono); color: #e7eaef; }
.why { color: var(--ink-dim); font-size: .96rem; }
.driving {
  font-family: var(--mono); font-size: .82rem; color: var(--ink-faint);
  border-top: 1px solid var(--border); margin-top: 18px; padding-top: 14px;
}
.driving .m { color: var(--ink-dim); }
.outcome {
  margin: 16px 0 4px; padding: 12px 16px; border-radius: var(--radius-sm);
  background: rgba(181,206,168,.08); border: 1px solid rgba(181,206,168,.25); color: var(--ink);
  font-size: .96rem;
}
details.math { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
details.math summary {
  cursor: pointer; font-family: var(--mono); font-size: .85rem; color: var(--syn-key); list-style: none;
}
details.math summary::-webkit-details-marker { display: none; }
details.math summary::before { content: "▸ "; }
details.math[open] summary::before { content: "▾ "; }
details.math .math-body { margin-top: 12px; font-family: var(--mono); font-size: .82rem; color: var(--ink-dim); line-height: 1.8; }
details.math .math-body p { margin: 0 0 .35rem; }

/* CTA band */
.cta-band { text-align: center; }
.cta-band h2 { margin-bottom: 1.2rem; }
.cta-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* disclaimer */
.disclaimer { color: var(--ink-faint); font-size: .82rem; max-width: 70ch; margin: 2rem auto 0; text-align: center; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0; margin-top: 24px; }
.footer-inner { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.footer-inner img { height: 18px; width: auto; opacity: .7; }
.footer-meta { margin: 0; color: var(--ink-faint); font-size: .9rem; }
.footer-meta a { color: var(--ink-dim); }
.footer-meta a:hover { color: var(--ink); }

/* ---------- 404 ---------- */
.notfound { min-height: 60vh; display: grid; place-content: center; text-align: center; gap: 1rem; }
.notfound .code { font-family: var(--mono); font-size: 4rem; color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; gap: 28px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .decision-cols { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  section { padding: 56px 0; }
  .nav-toggle-label {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border: 1px solid var(--border-strong); border-radius: 8px;
    cursor: pointer; color: var(--ink);
  }
  .nav-links {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg-elev); border-bottom: 1px solid var(--border);
    padding: 8px 24px 20px; display: none;
  }
  .nav-links a { padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 1rem; }
  .nav-cta { margin-top: 12px; border-radius: 999px; }
  .nav-toggle:checked ~ .nav-links { display: flex; }
  .grid-2 { grid-template-columns: 1fr; }
}
