/* ============================================================
   Oracle. The page is built to look like a measurement readout,
   because that is what the project is: a check on whether a
   stated probability matches what actually happened. Dark panel,
   mono numerals, hairline rules, registration ticks on the
   corners, and the 45-degree calibration diagonal as the motif.
   ============================================================ */
:root {
  --panel:      #0d1014;
  --panel-2:    #12161c;
  --panel-3:    #171d25;
  --rule:       #262e39;
  --rule-soft:  #1c232c;
  --tick:       #3d4a5a;
  --text:       #e3e9f0;
  --dim:        #94a1b2;
  --dimmer:     #6b7787;
  --raw:        #f0883e;   /* uncalibrated trace */
  --cal:        #3fd0b6;   /* calibrated trace */
  --diag:       #4a5665;   /* perfect-calibration diagonal */
  --warn:       #e3b341;
  --bad:        #f85149;
  --good:       #3fb950;
  --maxw: 1000px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--panel);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: 'Space Grotesk', sans-serif; font-weight: 700; line-height: 1.12; }
.mono, code { font-family: 'Inconsolata', ui-monospace, 'SF Mono', monospace; }
a { color: var(--cal); }
code {
  font-size: .92em; background: var(--panel-3);
  border: 1px solid var(--rule); padding: .06em .34em; color: var(--text);
}

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--cal); color: var(--panel);
  padding: .7rem 1rem; z-index: 100; font-weight: 700;
}
.skip:focus { left: 0; }
:where(a, button, input, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--cal); outline-offset: 2px;
}

/* Registration ticks. Two opposite corners, which also nods at the diagonal. */
.rig { position: relative; }
.rig::before, .rig::after {
  content: ""; position: absolute; width: 9px; height: 9px; pointer-events: none;
}
.rig::before {
  top: -1px; left: -1px;
  border-top: 1px solid var(--tick); border-left: 1px solid var(--tick);
}
.rig::after {
  bottom: -1px; right: -1px;
  border-bottom: 1px solid var(--tick); border-right: 1px solid var(--tick);
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1.4rem;
  padding: .7rem clamp(1rem, 4vw, 2.6rem);
  background: rgba(13, 16, 20, .92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.logo {
  font-family: 'Inconsolata', monospace; font-weight: 700; font-size: 1.1rem;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--text); text-decoration: none;
}
.topnav { display: flex; gap: 1.1rem; flex-wrap: wrap; margin-right: auto; }
.topnav a {
  color: var(--dim); text-decoration: none; font-size: .84rem;
  font-family: 'Inconsolata', monospace; letter-spacing: .03em;
}
.topnav a:hover { color: var(--cal); }
@media (max-width: 760px) { .topnav { display: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; text-decoration: none; font: inherit;
  font-family: 'Inconsolata', monospace; font-weight: 700; font-size: .88rem;
  letter-spacing: .05em; text-transform: uppercase;
  padding: .6rem 1.1rem; border: 1px solid var(--rule);
  background: none; color: var(--text); cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn-primary { background: var(--cal); border-color: var(--cal); color: #06231d; }
.btn-primary:hover:not(:disabled) { background: #55e0c6; border-color: #55e0c6; }
.btn-ghost:hover { border-color: var(--cal); color: var(--cal); }
.btn.sm { padding: .38rem .75rem; font-size: .78rem; }

/* ---------- layout ---------- */
.hero, .band {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(2.2rem, 5.5vw, 4rem) clamp(1.1rem, 4vw, 2rem);
}
.hero { position: relative; overflow: hidden; }
.hero-grid {
  position: absolute; inset: 0; pointer-events: none; opacity: .6;
  background-image: repeating-linear-gradient(45deg, var(--rule-soft) 0 1px, transparent 1px 58px);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .85), transparent 80%);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .85), transparent 80%);
}
.hero > *:not(.hero-grid) { position: relative; }
.band { border-top: 1px solid var(--rule); }
.band.alt { background: var(--panel-2); }
.band.cta { text-align: center; }

.eyebrow {
  font-size: .73rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--dimmer); margin-bottom: 1.1rem;
}
h1 { font-size: clamp(1.85rem, 5vw, 3.1rem); letter-spacing: -.02em; }
h1 .num { color: var(--cal); font-family: 'Inconsolata', monospace; }
h2 {
  font-size: clamp(1.35rem, 3vw, 1.85rem); margin-bottom: .6rem;
  letter-spacing: -.01em; display: flex; align-items: baseline; gap: .7rem;
}
.h2-num { color: var(--tick); font-size: .8rem; font-weight: 700; letter-spacing: .1em; }
h3 { font-size: 1rem; margin-bottom: .45rem; }

.lede { font-size: clamp(.98rem, 1.7vw, 1.06rem); color: var(--dim); max-width: 62ch; margin-top: 1.15rem; }
.lede strong { color: var(--text); }
.sub { color: var(--dim); max-width: 66ch; margin-bottom: 1.6rem; font-size: .95rem; }
.sub em { color: var(--text); font-style: normal; border-bottom: 1px solid var(--tick); }
.note { font-size: .86rem; color: var(--dimmer); max-width: 64ch; margin-top: 1.4rem; }
.band.cta .note { margin-inline: auto; }

/* ---------- runtime readout ---------- */
.runs-here {
  margin-top: 1.7rem; display: inline-flex; align-items: center; gap: .6rem;
  font-size: .79rem; color: var(--dim); letter-spacing: .02em;
  background: var(--panel-2); border: 1px solid var(--rule);
  padding: .42rem .85rem;
}
.runs-here.is-ready { border-color: #1e4d43; color: var(--cal); }
.runs-here.is-failed { border-color: #5c2b28; color: var(--bad); }
.spin {
  width: 8px; height: 8px; flex: none;
  border: 1px solid var(--rule); border-top-color: var(--cal);
  border-radius: 50%; animation: sp .8s linear infinite;
}
.is-ready .spin { border: 0; border-radius: 0; background: var(--cal); animation: none; }
.is-failed .spin { border: 0; border-radius: 0; background: var(--bad); animation: none; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- controls ---------- */
.controls {
  display: grid; gap: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
  background: var(--panel-2); border: 1px solid var(--rule); padding: 1.35rem;
}
.ctl { display: flex; flex-direction: column; gap: .45rem; }
.ctl label {
  font-family: 'Inconsolata', monospace; font-size: .74rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--dimmer);
  display: flex; justify-content: space-between; align-items: baseline; gap: .5rem;
}
.ctl label output { color: var(--cal); font-size: 1.05rem; font-weight: 700; letter-spacing: 0; }
.ctl input[type="range"] { width: 100%; accent-color: var(--cal); background: none; }
.ctl .hint { font-size: .77rem; color: var(--dimmer); line-height: 1.45; }
.ctl-go { justify-content: flex-end; }
.ctl-go .btn { width: 100%; }

/* ---------- score table ---------- */
.out { margin-top: 1.6rem; display: grid; gap: 1.1rem; }
.scorecard {
  background: var(--panel-2); border: 1px solid var(--rule); padding: 1.25rem 1.3rem;
}
.scorecard-head { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.scorecard-head h3 { font-size: 1rem; }
.scorecard-head .n {
  font-family: 'Inconsolata', monospace; font-size: .78rem; color: var(--dimmer);
}
table.scores { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.scores caption {
  caption-side: bottom; text-align: left; font-size: .78rem;
  color: var(--dimmer); padding-top: .8rem; line-height: 1.5;
}
table.scores th, table.scores td {
  padding: .5rem .6rem; text-align: left; border-bottom: 1px solid var(--rule-soft);
}
table.scores thead th {
  font-family: 'Inconsolata', monospace; font-size: .72rem;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--dimmer); font-weight: 500; white-space: nowrap;
  border-bottom-color: var(--rule);
}
table.scores tbody th { font-weight: 500; color: var(--text); }
table.scores td.num, table.scores th.num {
  text-align: right; font-family: 'Inconsolata', monospace; font-size: .95rem;
}
table.scores tbody tr:last-child td, table.scores tbody tr:last-child th { border-bottom: none; }
table.scores tr.is-winner { background: rgba(63, 208, 182, .09); }
table.scores tr.is-winner th { color: var(--cal); }
table.scores tr.is-baseline td, table.scores tr.is-baseline th { color: var(--dimmer); }
.delta { font-size: .74rem; color: var(--dimmer); margin-left: .35rem; }

/* ---------- verdict strip ---------- */
.verdict-strip {
  display: grid; gap: 1px; margin-top: 1.3rem;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  background: var(--rule); border: 1px solid var(--rule);
}
.vs-item { background: var(--panel-3); padding: .85rem .95rem; }
.vs-item.is-good { box-shadow: inset 2px 0 0 var(--cal); }
.vs-item.is-warn { box-shadow: inset 2px 0 0 var(--warn); }
.vs-k {
  display: block; font-family: 'Inconsolata', monospace;
  font-size: .69rem; letter-spacing: .11em; text-transform: uppercase;
  color: var(--dimmer); margin-bottom: .35rem;
}
.vs-v {
  display: block; font-size: 1.5rem; font-weight: 700; line-height: 1;
  letter-spacing: -.01em; color: var(--text);
}
.vs-item.is-good .vs-v { color: var(--cal); }
.vs-item.is-warn .vs-v { color: var(--warn); }
.vs-n { display: block; font-size: .75rem; color: var(--dimmer); margin-top: .4rem; line-height: 1.45; }

/* ---------- reliability diagram ---------- */
.chart-card {
  background: var(--panel-2); border: 1px solid var(--rule); padding: 1.25rem 1.3rem;
}
.chart-card h3 { font-size: 1rem; margin-bottom: .35rem; }
.chart-card .sub { margin-bottom: 1.1rem; font-size: .87rem; }
.chart-wrap { position: relative; width: 100%; max-width: 500px; margin: 0 auto; }
canvas#reliability { width: 100%; height: auto; display: block; }
.legend-row {
  display: flex; gap: 1.2rem; flex-wrap: wrap; justify-content: center;
  margin-top: 1rem; font-family: 'Inconsolata', monospace;
  font-size: .76rem; color: var(--dim);
}
.legend-row .key { display: inline-flex; align-items: center; gap: .4rem; }
.legend-row .sw { width: 16px; height: 2px; flex: none; }
.legend-row .sw.dash { height: 0; border-top: 1px dashed var(--diag); background: none; }

/* ---------- forecast ---------- */
.forecast {
  background: var(--panel-2); border: 1px solid var(--rule);
  box-shadow: inset 2px 0 0 var(--cal); padding: 1.25rem 1.3rem;
}
.forecast.is-unsure { box-shadow: inset 2px 0 0 var(--warn); }
.forecast h3 { font-size: 1rem; margin-bottom: .9rem; }
.fc-main { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; }
.fc-label {
  font-family: 'Inconsolata', monospace; font-weight: 700; font-size: 2rem;
  letter-spacing: .04em; line-height: 1; color: var(--cal);
}
.forecast.is-unsure .fc-label { color: var(--warn); }
.fc-p { font-family: 'Inconsolata', monospace; font-size: 1rem; color: var(--dim); }
.fc-hedge {
  font-family: 'Inconsolata', monospace; font-size: .7rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  background: rgba(227, 179, 65, .12); border: 1px solid #5a4a20; color: var(--warn);
  padding: .18rem .45rem;
}
.fc-rows { margin-top: 1rem; display: grid; gap: .5rem; }
.fc-row { display: flex; gap: .7rem; font-size: .87rem; flex-wrap: wrap; }
.fc-row .k {
  font-family: 'Inconsolata', monospace; font-size: .72rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--dimmer);
  min-width: 9rem; padding-top: .12rem;
}
.fc-row .v { color: var(--text); }
.drivers { display: flex; gap: .4rem; flex-wrap: wrap; }
.driver {
  font-family: 'Inconsolata', monospace; font-size: .8rem;
  padding: .14rem .5rem; border: 1px solid var(--rule); color: var(--dim);
}
.driver.up { border-color: #1e4d43; color: var(--cal); }
.driver.down { border-color: #5c3a24; color: var(--raw); }

.err {
  background: rgba(248, 81, 73, .08); border: 1px solid #5c2b28;
  color: #ff9d97; padding: .9rem 1rem; font-size: .89rem;
}

/* ---------- steps / callout / limits ---------- */
.steps { list-style: none; display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.steps li { background: var(--panel); padding: 1.15rem 1.3rem; }
.band.alt .steps li { background: var(--panel-2); }
.steps h3 { display: flex; align-items: baseline; gap: .7rem; }
.step-n { color: var(--cal); font-size: .8rem; font-weight: 700; letter-spacing: .08em; }
.steps p { color: var(--dim); max-width: 72ch; font-size: .92rem; }
.steps code { font-size: .88em; }

.callout {
  background: var(--panel-3); border: 1px solid var(--rule);
  padding: 1.25rem 1.3rem;
  background-image: repeating-linear-gradient(45deg, var(--rule-soft) 0 1px, transparent 1px 46px);
}
.callout p { color: var(--dim); max-width: 70ch; }
.callout p + p { margin-top: .9rem; }
.callout strong, .callout em { color: var(--text); font-style: normal; }
.callout .honest {
  font-size: .89rem; border-top: 1px solid var(--rule); padding-top: .9rem;
}

.limits { list-style: none; display: grid; gap: .85rem; max-width: 76ch; }
.limits li {
  padding-left: 1.35rem; position: relative; color: var(--dim); font-size: .93rem;
}
.limits li::before {
  content: ""; position: absolute; left: 0; top: .62em;
  width: 8px; height: 8px; border-top: 1px solid var(--tick); border-right: 1px solid var(--tick);
  transform: rotate(45deg);
}
.limits strong { color: var(--text); font-weight: 500; }

.cta-row { display: flex; gap: .7rem; flex-wrap: wrap; justify-content: center; margin-top: 1.4rem; }
.foot {
  border-top: 1px solid var(--rule); padding: 1.7rem 1.2rem;
  text-align: center; font-size: .8rem; letter-spacing: .04em;
}
.foot a { color: var(--dimmer); text-decoration: none; }
.foot a:hover { color: var(--cal); }
.foot span { margin: 0 .6rem; color: var(--rule); }
