/* ============================================================
   Two Reads, Seven Gates — audit-desk aesthetic
   Warm paper, ink serif, mono data, stamp verdicts.
   ============================================================ */

:root {
  --paper: #f4efe4;
  --paper-deep: #ece5d3;
  --card: #fbf8f0;
  --ink: #1a1f1c;
  --ink-soft: #4a4f47;
  --ink-faint: #8a8878;
  --line: #d8d0ba;
  --stamp-red: #c2402a;
  --stamp-red-soft: #f4ded7;
  --pass-green: #2e6b46;
  --pass-green-soft: #dfe9dd;
  --amber: #a06a14;
  --amber-soft: #f2e6c9;
  --serif: "Spectral", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--serif);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  /* subtle paper grain */
  background-image:
    radial-gradient(circle at 18% 12%, rgba(194, 64, 42, 0.05), transparent 42%),
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(26, 31, 28, 0.012) 2px 4px);
}

/* ---------- Masthead ---------- */

.masthead {
  border-bottom: 3px double var(--ink);
  padding: 4.5rem 1.5rem 3.2rem;
}

.masthead-inner { max-width: 68rem; margin: 0 auto; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  background: var(--card);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border-radius: 2rem;
  animation: rise 0.7s ease both;
}

.eyebrow .dot {
  width: 0.5rem; height: 0.5rem;
  border-radius: 50%;
  background: var(--stamp-red);
  animation: pulse 2.4s ease-in-out infinite;
}

.masthead h1 {
  font-size: clamp(2.8rem, 8vw, 5.4rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 1.4rem 0 1.2rem;
  animation: rise 0.7s 0.08s ease both;
}

.masthead h1 em {
  font-style: italic;
  font-weight: 400;
  color: var(--stamp-red);
}

.thesis {
  font-size: clamp(1.1rem, 2.4vw, 1.4rem);
  max-width: 42rem;
  animation: rise 0.7s 0.16s ease both;
}

.sub {
  margin-top: 0.9rem;
  max-width: 44rem;
  color: var(--ink-soft);
  animation: rise 0.7s 0.24s ease both;
}

/* ---------- Sections ---------- */

main { max-width: 68rem; margin: 0 auto; padding: 0 1.5rem 4rem; }

.section-title {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.step-no {
  color: var(--stamp-red);
  border-bottom: 2px solid var(--stamp-red);
  padding-bottom: 1px;
}

.tag {
  font-size: 0.62rem;
  padding: 0.15rem 0.5rem;
  border-radius: 1rem;
  letter-spacing: 0.08em;
}

.tag-static { background: var(--amber-soft); color: var(--amber); }
.tag-live   { background: var(--pass-green-soft); color: var(--pass-green); }

/* ---------- Picker ---------- */

.picker-section { padding: 3rem 0 1rem; }

.picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.8rem;
}

.picker button {
  font-family: var(--mono);
  font-size: 0.8rem;
  text-align: left;
  padding: 0.9rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  cursor: pointer;
  color: var(--ink-soft);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.picker button .k {
  display: block;
  color: var(--ink-faint);
  font-size: 0.65rem;
  margin-bottom: 0.3rem;
  letter-spacing: 0.1em;
}

.picker button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(26, 31, 28, 0.08);
}

.picker button[aria-selected="true"] {
  border-color: var(--ink);
  color: var(--ink);
  background: #fff;
  box-shadow: 3px 3px 0 var(--ink);
}

.story {
  margin-top: 1.1rem;
  font-style: italic;
  color: var(--ink-soft);
  max-width: 46rem;
  min-height: 3.2em;
}

/* ---------- Workbench ---------- */

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  gap: 2.5rem;
  padding: 1.5rem 0 3rem;
  align-items: start;
}

@media (max-width: 56rem) {
  .workbench { grid-template-columns: 1fr; }
}

/* Certificate — the "paper" artifact */

.certificate {
  background: var(--card);
  border: 1px solid var(--line);
  outline: 1px solid var(--line);
  outline-offset: -7px;
  border-radius: 2px;
  padding: 2rem 1.6rem 1.7rem;
  box-shadow: 0 14px 30px rgba(26, 31, 28, 0.12), 0 2px 6px rgba(26, 31, 28, 0.08);
  transform: rotate(-0.6deg);
  position: relative;
}

.certificate::after {
  /* synthetic watermark */
  content: "SYNTHETIC SPECIMEN";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 1.05rem;
  letter-spacing: 0.34em;
  color: rgba(194, 64, 42, 0.13);
  transform: rotate(-18deg);
  pointer-events: none;
  white-space: nowrap;
}

.cert-issuer {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-align: center;
  color: var(--ink-soft);
}

.cert-rule {
  border: none;
  border-top: 1px solid var(--line);
  margin: 0.8rem 0;
}

.cert-title {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
  font-variant: small-caps;
  letter-spacing: 0.06em;
}

.cert-holder {
  text-align: center;
  font-size: 1.6rem;
  font-style: italic;
  margin: 0.7rem 0 0.2rem;
}

.cert-program {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.cert-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
  display: grid;
  gap: 0.35rem;
}

.cert-meta div { display: flex; justify-content: space-between; gap: 1rem; }
.cert-meta dt { color: var(--ink-faint); }
.cert-meta dd { text-align: right; }
.cert-meta .missing { color: var(--stamp-red); font-style: italic; }

/* Run button */

.run-btn {
  margin-top: 1.6rem;
  width: 100%;
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 1rem 1.2rem;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 0.3rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.run-btn:hover {
  background: #000;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(26, 31, 28, 0.25);
}

.run-btn:active { transform: translateY(0); }

.run-btn .btn-arrow { transition: transform 0.15s ease; }
.run-btn:hover .btn-arrow { transform: translateX(4px); }

/* ---------- Pipeline stages ---------- */

.stage {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  margin-bottom: 2.4rem;
  pointer-events: none;
}

.stage.revealed {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.reads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 40rem) {
  .reads { grid-template-columns: 1fr; }
}

.read-panel {
  background: var(--ink);
  color: #e8e4d5;
  border-radius: 0.4rem;
  padding: 1rem 1.1rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  box-shadow: 0 8px 20px rgba(26, 31, 28, 0.18);
}

.read-panel h3 {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #b8b29a;
  margin-bottom: 0.7rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(232, 228, 213, 0.18);
}

.read-panel dl { display: grid; gap: 0.3rem; }
.read-panel div { display: flex; justify-content: space-between; gap: 0.8rem; }
.read-panel dt { color: #8f8b76; }
.read-panel dd { text-align: right; word-break: break-word; }
.read-panel .null { color: var(--stamp-red); font-style: italic; }

/* Diff table */

.table-wrap { overflow-x: auto; }

.diff-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.72rem;
  background: var(--card);
  border: 1px solid var(--line);
}

.diff-table th {
  text-align: left;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0.6rem 0.8rem;
  border-bottom: 2px solid var(--ink);
}

.diff-table td {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  word-break: break-word;
}

.diff-table tr.disagree td { background: var(--stamp-red-soft); }
.diff-table tr.disagree td:first-child { border-left: 3px solid var(--stamp-red); }

.pill {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 1rem;
  white-space: nowrap;
}

.pill-agree    { background: var(--pass-green-soft); color: var(--pass-green); }
.pill-disagree { background: var(--stamp-red); color: #fff; }

.stage-note {
  margin-top: 0.7rem;
  font-style: italic;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

/* Gates */

.gates { list-style: none; display: grid; gap: 0.5rem; }

.gate {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 0.7rem 0.9rem;
  opacity: 0;
  transform: translateX(-10px);
}

.stage.revealed .gate { animation: gate-in 0.35s ease forwards; }

.gate-icon {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.8rem;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.gate.pass .gate-icon { background: var(--pass-green-soft); color: var(--pass-green); }
.gate.fail .gate-icon { background: var(--stamp-red); color: #fff; }

.gate.fail { border-color: var(--stamp-red); background: var(--stamp-red-soft); }

.gate-name { font-weight: 600; font-size: 0.95rem; }
.gate-detail {
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

/* Verdict stamp */

.verdict-stage { margin-bottom: 0; }

.verdict {
  border-radius: 0.4rem;
  padding: 1.6rem 1.8rem;
  border: 2px solid;
  position: relative;
  overflow: hidden;
}

.verdict.ship { border-color: var(--pass-green); background: var(--pass-green-soft); }
.verdict.hold { border-color: var(--stamp-red); background: var(--stamp-red-soft); }

.verdict .stamp {
  font-family: var(--mono);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  display: inline-block;
  padding: 0.3rem 1rem;
  border: 3px solid;
  border-radius: 0.3rem;
  transform: rotate(-3deg);
  animation: stamp-in 0.4s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

.verdict.ship .stamp { color: var(--pass-green); border-color: var(--pass-green); }
.verdict.hold .stamp { color: var(--stamp-red); border-color: var(--stamp-red); }

.verdict .reason {
  margin-top: 1rem;
  font-size: 1rem;
}

/* ---------- Pattern note & colophon ---------- */

.pattern-note {
  border-top: 3px double var(--ink);
  padding-top: 2.5rem;
}

.note-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  max-width: 62rem;
}

@media (max-width: 48rem) {
  .note-cols { grid-template-columns: 1fr; }
}

.note-cols p { color: var(--ink-soft); }
.note-cols strong { color: var(--ink); }

.colophon {
  border-top: 1px solid var(--line);
  background: var(--paper-deep);
  padding: 1.6rem 1.5rem 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---------- Animations ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.5); opacity: 0.55; }
}

@keyframes gate-in {
  to { opacity: 1; transform: none; }
}

@keyframes stamp-in {
  from { opacity: 0; transform: rotate(-3deg) scale(1.6); }
  to   { opacity: 1; transform: rotate(-3deg) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
