/* style.css — front-end-NXV
 *
 * Colour palette — matches compute.py plot styling:
 *   BG_DARK      #0f1117
 *   SURFACE      #181c27
 *   BORDER       #2a2f40
 *   ACCENT       #5b8dee   (blue: body bars, interactive, success)
 *   ACCENT_TAIL  #e8a838   (orange: answer tail, pNXV, warnings, errors)
 *   COMPARATOR   #8b93ad   (grey: comparator tail and voice)
 *   FOUND_U      #d4d8e8   (light grey: observed-U line in plots)
 *
 * Colour-blind-safe scheme (July 2026): orange/blue/grey only — no red,
 * no green. Answer speaks in orange, comparator is subordinate by
 * MUTEDNESS (grey), errors share the amber family but carry weight.
 *   TEXT_MAIN    #d4d8e8
 *   TEXT_MUTED   #5c6280
 *
 * Fonts — Atkinson Hyperlegible (OFL; files + OFL.txt in static/fonts/)
 * for all UI text; JetBrains Mono stack retained for data entry and
 * p-value display (aligned digits). NOTE: Atkinson's compact glyph set
 * has no Greek (λ, τ) or subscripts (₀) — those characters fall back
 * per-character to the rest of the stack, so keep the fallbacks listed.
 * Plot text inside the PNGs is matplotlib's own (DejaVu), untouched.
 */

/* ── Fonts ────────────────────────────────────────────── */
@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('fonts/AtkinsonHyperlegible-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('fonts/AtkinsonHyperlegible-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('fonts/AtkinsonHyperlegible-Italic.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('fonts/AtkinsonHyperlegible-BoldItalic.ttf') format('truetype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

/* ── Reset & base ─────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  background: #0f1117;
  color: #d4d8e8;
  font-family: 'Atkinson Hyperlegible', 'Inter', 'Segoe UI', system-ui, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────── */
header {
  background: #000000;
  border-bottom: 1px solid #2a2f40;
  padding: 0.75rem 2rem;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
}

/* SVG logo: scale to fit header, never exceed natural size */
.logo-svg-wrap {
  display: block;
  width: 100%;
  max-width: 250px;
  margin-bottom: 0.35rem;
}

.logo-svg-wrap svg {
  display: block;
  width: 100%;
  height: auto;
}

.tagline {
  font-size: 0.78rem;
  color: #5c6280;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

/* ── Main layout ──────────────────────────────────────── */
main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 2rem;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 800px) {
  main {
    grid-template-columns: 1fr;
    padding: 1.25rem;
  }
}

/* ── Panels ───────────────────────────────────────────── */
.input-panel,
.output-panel {
  background: #181c27;
  border: 1px solid #2a2f40;
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
}

.panel-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #5c6280;
  margin-bottom: 0.9rem;
}

/* ── Form fields ──────────────────────────────────────── */
.field-group {
  margin-bottom: 1.1rem;
}

label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: #d4d8e8;
  margin-bottom: 0.35rem;
}

.hint {
  font-size: 0.72rem;
  font-weight: 400;
  color: #5c6280;
  margin-left: 0.4rem;
}

textarea,
input[type="number"] {
  width: 100%;
  background: #0f1117;
  border: 1px solid #2a2f40;
  border-radius: 5px;
  color: #d4d8e8;
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 0.88rem;
  padding: 0.55rem 0.7rem;
  resize: vertical;
  transition: border-color 0.15s;
}

textarea:focus,
input[type="number"]:focus {
  outline: none;
  border-color: #5b8dee;
}

textarea::placeholder,
input[type="number"]::placeholder {
  color: #3a3f55;
}

/* ── Scalar row (r and λ side by side) ────────────────── */
.scalar-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  margin-bottom: 1.1rem;
}

/* ── Run button ───────────────────────────────────────── */
#run-btn {
  width: 100%;
  background: #5b8dee;
  border: none;
  border-radius: 5px;
  color: #fff;
  cursor: pointer;
  font-family: inherit;   /* buttons don't inherit fonts by default */
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1rem;
  transition: background 0.15s, opacity 0.15s;
  margin-bottom: 0.75rem;
}

#run-btn:hover:not(:disabled) {
  background: #4a7de0;
}

#run-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Status message ───────────────────────────────────── */
.status {
  font-size: 0.82rem;
  min-height: 1.2em;
  color: #5c6280;
}

.status.error {
  color: #e8a838;
  font-weight: 700;
}

.status.success {
  color: #5b8dee;
}

/* ── Warnings block ───────────────────────────────────── */
.warnings-block {
  margin-top: 0.75rem;
  background: rgba(232, 168, 56, 0.08);
  border: 1px solid rgba(232, 168, 56, 0.35);
  border-radius: 5px;
  padding: 0.75rem 0.9rem;
  font-size: 0.8rem;
  color: #e8a838;
  line-height: 1.55;
}

.warnings-block p + p {
  margin-top: 0.5rem;
}

/* ── Graph area ───────────────────────────────────────── */
.graph-area {
  background: #0f1117;
  border: 1px solid #2a2f40;
  border-radius: 6px;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.placeholder-text {
  font-size: 0.82rem;
  color: #3a3f55;
}

/* Both graph images: preserve aspect ratio, never exceed panel width,
 * and cap height in viewport units so the two-graph page fits one
 * screen. The comparator's cap is lower — the height hierarchy mirrors
 * the semantic one (pNXV above is the answer, grey below the warning). */
#graph-img,
#comparator-img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

#graph-img {
  max-height: 38vh;
}

#comparator-img {
  max-height: 27vh;
}

/* ── p-value display ──────────────────────────────────── */
.pvalue-block {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  background: #0f1117;
  border: 1px solid #2a2f40;
  border-radius: 6px;
}

.pvalue-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5c6280;
}

.pvalue-label sub {
  font-size: 0.65rem;
  text-transform: none;
}

.pvalue-number {
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 1.35rem;
  font-weight: 700;
  color: #e8a838;
  letter-spacing: -0.02em;
}

/* ── Untied comparator (the warning beneath the answer) ──
 * Visually subordinate to the NXV result: dashed rule above,
 * grey subordinate voice for caption and number, slightly smaller
 * graph. The hierarchy is deliberate — pNXV is the answer, the
 * comparator shows what a ties-blind analysis would have said. */
.comparator-section {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px dashed #2a2f40;
}

.comparator-caption {
  font-size: 0.75rem;
  color: #8b93ad;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.comparator-graph-area {
  min-height: 120px;
  opacity: 0.92;
}

.comparator-pvalue-block .comparator-number {
  font-size: 1.05rem;
  color: #8b93ad;
}

/* Narrow screens stack the panels; scrolling is normal there, so the
 * viewport-height caps come off — width governs instead. */
@media (max-width: 800px) {
  #graph-img,
  #comparator-img {
    max-height: none;
    width: 100%;
  }
}
