/* Existence Proof web UI. Plain CSS, light and dark via prefers-color-scheme. */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --text: #1c1e22;
  --muted: #5a606a;
  --border: #dcd8cf;
  --border-strong: #bcb6aa;
  --accent: #1f4e8c;
  --accent-text: #ffffff;
  --accent-soft: #e6edf7;
  --pass: #1b6b3a;
  --pass-soft: #e5f2ea;
  --fail: #a32626;
  --fail-soft: #f8e6e6;
  --warn: #855400;
  --warn-soft: #f8efdd;
  --focus: #2a6fd6;
  --code-bg: #f1efe9;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, "Bitstream Charter", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 6px;
  --measure: 44rem;
  --wide: 64rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417;
    --surface: #191c20;
    --surface-2: #20242a;
    --text: #e8e6e1;
    --muted: #a2a8b1;
    --border: #2f343b;
    --border-strong: #464c55;
    --accent: #8fb6ee;
    --accent-text: #0f1a2b;
    --accent-soft: #1c2a3d;
    --pass: #74cf98;
    --pass-soft: #15281d;
    --fail: #f19191;
    --fail-soft: #331a1a;
    --warn: #e7b862;
    --warn-soft: #2f2514;
    --focus: #8fb6ee;
    --code-bg: #1e2227;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.6 var(--sans);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; width: 100%; max-width: var(--measure); margin: 0 auto; padding: 2.5rem 1.25rem 4rem; }
main.wide { max-width: var(--wide); }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; letter-spacing: -0.005em; }
h1 { font-size: 2.1rem; margin: 0 0 0.75rem; }
h2 { font-size: 1.45rem; margin: 2.75rem 0 0.75rem; }
h3 { font-size: 1.15rem; margin: 2rem 0 0.5rem; }
p, ul, ol, dl, table, pre { margin: 0 0 1rem; }
li { margin: 0.25rem 0; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 38rem; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

code, pre, .mono { font-family: var(--mono); font-size: 0.9em; }
code { background: var(--code-bg); padding: 0.1em 0.3em; border-radius: 3px; }
pre { background: var(--code-bg); padding: 0.9rem 1rem; border-radius: var(--radius); overflow-x: auto; line-height: 1.45; }
pre code { background: none; padding: 0; }
.hash { font-family: var(--mono); font-size: 0.92rem; word-break: break-all; overflow-wrap: anywhere; }

/* ---- header / footer ---- */

.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-header .inner {
  max-width: var(--wide); margin: 0 auto; padding: 0.85rem 1.25rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--serif); font-weight: 600; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.brand svg { width: 1.6rem; height: 1.6rem; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; font-size: 0.95rem; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 0.2rem 0; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.9rem; }
.site-footer .inner { max-width: var(--wide); margin: 0 auto; padding: 1.5rem 1.25rem 2.5rem; display: grid; gap: 0.75rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; }
.site-footer a { color: var(--muted); }

/* ---- components ---- */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.25rem; margin: 0 0 1.25rem; }
.card > :last-child { margin-bottom: 0; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: 0.35rem; min-height: 11rem; padding: 1.5rem;
  border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface);
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.dropzone .big { font-family: var(--serif); font-size: 1.25rem; }
.dropzone.compact { min-height: 7rem; }
.dropzone.has-file { border-style: solid; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.or { display: flex; align-items: center; gap: 0.75rem; color: var(--muted); font-size: 0.9rem; margin: 1.25rem 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

form.inline { display: flex; gap: 0.5rem; flex-wrap: wrap; }
form.inline input { flex: 1 1 16rem; min-width: 0; }

input[type="text"], input[type="search"] {
  font: inherit; font-family: var(--mono); font-size: 0.92rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 0.55rem 0.7rem;
}
input::placeholder { color: var(--muted); opacity: 0.8; }

.button, button {
  font: inherit; font-size: 0.98rem; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.55rem 1rem; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; line-height: 1.3;
}
.button:hover, button:hover { border-color: var(--accent); }
.button.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.button.primary:hover, button.primary:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.big { font-size: 1.1rem; padding: 0.75rem 1.6rem; }
button.link { border: none; background: none; padding: 0; color: var(--accent); text-decoration: underline; font-size: inherit; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1rem 0; }

progress { width: 100%; height: 0.6rem; accent-color: var(--accent); }
.progress-line { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.9rem; color: var(--muted); margin-top: 0.3rem; }

.notice { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 0.75rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1rem 0; }
.notice.pass { border-color: var(--pass); background: var(--pass-soft); }
.notice.fail { border-color: var(--fail); background: var(--fail-soft); }
.notice.warn { border-color: var(--warn); background: var(--warn-soft); }
.notice > :last-child { margin-bottom: 0; }
.notice strong:first-child { display: block; }

/* key/value records */
dl.record { display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr; gap: 0.55rem 1.25rem; margin: 0 0 1rem; }
dl.record dt { color: var(--muted); font-size: 0.93rem; }
dl.record dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 34rem) {
  dl.record { grid-template-columns: 1fr; gap: 0.1rem; }
  dl.record dd { margin-bottom: 0.65rem; }
}

/* verification checklist */
ul.checks { list-style: none; padding: 0; margin: 0 0 1rem; }
ul.checks li { display: grid; grid-template-columns: 5.5rem 1fr; gap: 0.75rem; padding: 0.6rem 0; border-top: 1px solid var(--border); margin: 0; }
ul.checks li:first-child { border-top: none; }
.badge { display: inline-block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; text-align: center; padding: 0.15rem 0.4rem; border-radius: 4px; height: fit-content; }
.badge.pass { color: var(--pass); background: var(--pass-soft); }
.badge.fail { color: var(--fail); background: var(--fail-soft); }
.badge.warn { color: var(--warn); background: var(--warn-soft); }
.badge.skip { color: var(--muted); background: var(--surface-2); }
.checks .detail { display: block; color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 1rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 0.85rem; background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td .hash { font-size: 0.85rem; }

.grid-2 { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 48rem) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.steps { counter-reset: step; list-style: none; padding: 0; }
.steps > li { counter-increment: step; position: relative; padding-left: 2.4rem; margin: 0 0 1rem; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0.05rem; width: 1.7rem; height: 1.7rem; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.85rem; font-weight: 700; background: var(--accent-soft); color: var(--accent);
}

.pager { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }

.hidden { display: none !important; }

/* diagram (how-it-works) */
figure.diagram { margin: 1.5rem 0 2rem; }
figure.diagram svg { width: 100%; height: auto; display: block; }
figure.diagram svg.dg-narrow { display: none; max-width: 22rem; margin: 0 auto; }
@media (max-width: 40rem) {
  figure.diagram svg.dg-wide { display: none; }
  figure.diagram svg.dg-narrow { display: block; }
}
figure.diagram figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 0.5rem; }
.dg-box { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.5; }
.dg-box.accent { stroke: var(--accent); }
.dg-box.ext { fill: var(--surface-2); stroke-dasharray: 5 4; }
.dg-text { fill: var(--text); font-family: var(--sans); font-size: 15px; }
.dg-title { fill: var(--text); font-family: var(--serif); font-size: 17px; font-weight: 600; }
.dg-sub { fill: var(--muted); font-family: var(--sans); font-size: 12.5px; }
.dg-line { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.dg-arrow { fill: var(--muted); }

/* rendered markdown (guide, API) */
.prose h2 { border-top: 1px solid var(--border); padding-top: 1.5rem; }
.prose h2:first-of-type { border-top: none; padding-top: 0; }
.prose table { margin-bottom: 1.25rem; }
.prose .table-wrap table { margin: 0; }
.prose blockquote { margin: 1rem 0; padding: 0.5rem 1rem; border-left: 4px solid var(--border-strong); color: var(--muted); }
.toc { font-size: 0.95rem; }
.toc ol { padding-left: 1.25rem; }

@media (max-width: 34rem) {
  body { font-size: 1rem; }
  h1 { font-size: 1.7rem; }
  main { padding-top: 1.75rem; }
  .card { padding: 1rem; }
}

@media print {
  .site-header, .site-footer, .dropzone, .actions, button { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; }
}
