:root {
  --paper: #f3efe6;
  --paper-deep: #e8e1d4;
  --ink: #171713;
  --muted: #69665e;
  --line: #b9b1a3;
  --red: #c7352e;
  --green: #1f6b52;
  --amber: #a15c12;
  --white: #fffdf8;
  --display: "Iowan Old Style", "Baskerville", "Times New Roman", serif;
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --mono: "Menlo", "Consolas", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 5%, rgba(199, 53, 46, .07), transparent 28rem),
    var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
  touch-action: manipulation;
}

button, input { font: inherit; }
button { color: inherit; }

.grain {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: .26;
  background-image: repeating-linear-gradient(92deg, transparent 0 3px, rgba(25, 22, 16, .018) 3px 4px);
  mix-blend-mode: multiply;
}

.masthead {
  width: min(1460px, calc(100% - 56px));
  margin: 0 auto;
  min-height: 102px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--ink);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.wordmark-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-family: var(--display);
  font-size: 28px;
  line-height: 1;
}

.wordmark > span:last-child,
.privacy-seal > span:last-child {
  display: flex;
  flex-direction: column;
}

.wordmark b {
  letter-spacing: .16em;
  font-size: 13px;
}

.wordmark small,
.privacy-seal small {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .08em;
}

.privacy-seal {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(161, 92, 18, .12);
}

.pulse.ready {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(31, 107, 82, .12);
}

main {
  width: min(1460px, calc(100% - 56px));
  margin: 0 auto;
}

.hero {
  min-height: 590px;
  display: grid;
  grid-template-columns: minmax(0, 9fr) minmax(250px, 3fr);
  gap: 9vw;
  align-items: end;
  padding: 105px 0 70px;
}

.eyebrow {
  margin: 0 0 22px;
  color: var(--red);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 35px;
  font-family: var(--display);
  font-size: clamp(64px, 8.2vw, 132px);
  font-weight: 400;
  letter-spacing: -.065em;
  line-height: .83;
}

h1 em {
  color: var(--red);
  font-weight: 400;
}

.lede {
  max-width: 700px;
  margin-bottom: 0;
  padding-left: 21%;
  color: #4e4b45;
  font-size: clamp(17px, 1.25vw, 20px);
}

.scope-note {
  align-self: end;
  border-top: 5px solid var(--ink);
  padding: 18px 0 0;
}

.scope-note b {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.scope-note p {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.desk,
.results,
.revision-strip {
  border-top: 1px solid var(--ink);
  padding: 42px 0 96px;
}

.desk-heading,
.result-head {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 420px);
  gap: 7vw;
  align-items: start;
  margin-bottom: 36px;
}

h2 {
  margin-bottom: 0;
  font-family: var(--display);
  font-size: clamp(34px, 4vw, 62px);
  font-weight: 400;
  letter-spacing: -.035em;
  line-height: .98;
}

.desk-heading > p {
  color: var(--muted);
  font-size: 14px;
}

.capture-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.capture-slot {
  position: relative;
  min-height: 390px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 62px 1fr;
  grid-template-rows: 1fr auto;
  border: 1px solid var(--ink);
  background-color: rgba(255, 253, 248, .48);
  background-image:
    linear-gradient(rgba(23, 23, 19, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 23, 19, .055) 1px, transparent 1px);
  background-size: 30px 30px;
  transition: background-color .2s ease, color .2s ease;
}

.capture-slot.dragging {
  color: var(--white);
  background-color: var(--ink);
}

.slot-index {
  grid-row: 1 / 3;
  display: grid;
  place-items: start center;
  padding-top: 26px;
  border-right: 1px solid currentColor;
  font-family: var(--display);
  font-size: 36px;
}

.slot-copy {
  align-self: end;
  padding: 42px 38px 50px;
  display: flex;
  flex-direction: column;
}

.side-label {
  margin-bottom: 9px;
  color: var(--red);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.capture-slot.dragging .side-label { color: #f17b72; }

.slot-copy strong {
  font-family: var(--display);
  font-size: clamp(30px, 3vw, 46px);
  font-weight: 400;
  letter-spacing: -.03em;
}

.slot-copy small {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.file-action {
  grid-column: 2;
  min-height: 66px;
  padding: 0 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid currentColor;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.file-action::after { content: "+"; font-size: 22px; font-weight: 400; }
.file-action:hover { background: var(--ink); color: var(--white); }
.file-action input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-action:focus-within { outline: 3px solid var(--red); outline-offset: -4px; }

.preview-wrap {
  position: absolute;
  inset: 0 0 0 62px;
  z-index: 2;
  background: var(--ink);
}

.preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .9;
}

.remove-file {
  position: absolute;
  right: 15px;
  top: 15px;
  border: 1px solid var(--white);
  border-radius: 0;
  padding: 9px 13px;
  color: var(--white);
  background: rgba(23, 23, 19, .78);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

.action-row {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 25px;
  margin-top: 18px;
}

.privacy-line {
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.privacy-line svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.scan-button {
  min-width: 310px;
  min-height: 74px;
  padding: 0 0 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--ink);
  border-radius: 0;
  color: var(--white);
  background: var(--ink);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.scan-button:disabled { cursor: not-allowed; opacity: .35; }
.scan-button:not(:disabled):hover .button-arrow { color: var(--ink); background: var(--red); }

.button-arrow {
  align-self: stretch;
  width: 74px;
  display: grid;
  place-items: center;
  border-left: 1px solid #6e6c67;
  font-size: 24px;
  transition: background .18s ease;
}

.form-error {
  margin: 15px 0 0;
  padding: 12px 16px;
  border-left: 4px solid var(--red);
  color: #84251f;
  background: rgba(199, 53, 46, .08);
}

.result-head { grid-template-columns: 1fr auto; align-items: end; }

.result-actions {
  display: flex;
  border: 1px solid var(--ink);
}

.result-actions button {
  padding: 11px 16px;
  border: 0;
  border-right: 1px solid var(--ink);
  background: transparent;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

.result-actions button:last-child { border-right: 0; }
.result-actions button:hover { color: var(--white); background: var(--ink); }

.empty-result {
  min-height: 330px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 2fr;
  align-items: center;
  gap: 8vw;
  border: 1px dashed var(--line);
  padding: 55px 8%;
}

.empty-reticle {
  width: min(230px, 100%);
  aspect-ratio: 1;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.empty-reticle::before,
.empty-reticle::after,
.empty-reticle span::before,
.empty-reticle span::after {
  content: "";
  position: absolute;
  background: var(--red);
}
.empty-reticle::before { width: 1px; height: 130%; left: 50%; top: -15%; }
.empty-reticle::after { height: 1px; width: 130%; top: 50%; left: -15%; }
.empty-reticle span::before { inset: 28%; border: 1px solid var(--line); border-radius: 50%; background: transparent; }
.empty-reticle span::after { width: 9px; height: 9px; border-radius: 50%; top: calc(50% - 4px); left: calc(50% - 4px); }

.empty-result p { max-width: 560px; margin: 0; color: var(--muted); font-size: 18px; }

.loading-result {
  min-height: 330px;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--white);
}

.loading-result p { display: flex; flex-direction: column; text-align: center; }
.loading-result b { font-family: var(--display); font-size: 40px; font-weight: 400; }
.loading-result span { margin-top: 8px; color: #aaa8a1; font-family: var(--mono); font-size: 10px; text-transform: uppercase; }

.scan-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--red);
  box-shadow: 0 0 24px 6px rgba(199, 53, 46, .55);
  animation: scan 2.1s ease-in-out infinite alternate;
}

@keyframes scan { to { transform: translateY(328px); } }

.verdict-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 30px;
  align-items: end;
  padding: 24px 0 31px;
  border-top: 5px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.status-chip {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--green);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
}
.status-chip.needs_review { color: var(--red); }
.status-chip.partial { color: var(--amber); }

.verdict-row h3 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(36px, 4vw, 58px);
  font-weight: 400;
  letter-spacing: -.04em;
}

.result-metrics {
  margin: 0;
  display: flex;
  border-left: 1px solid var(--line);
}

.result-metrics div { min-width: 120px; padding-left: 22px; }
.result-metrics dt { color: var(--muted); font-family: var(--mono); font-size: 9px; text-transform: uppercase; }
.result-metrics dd { margin: 6px 0 0; font-family: var(--mono); font-size: 12px; }

.missing-banner,
.warning-list {
  margin-top: 15px;
  padding: 15px 18px;
  border-left: 4px solid var(--amber);
  background: rgba(161, 92, 18, .07);
  font-size: 13px;
}
.warning-list { border-color: var(--red); background: rgba(199, 53, 46, .06); }
.warning-list p { margin: 0 0 6px; }
.warning-list p:last-child { margin-bottom: 0; }

.field-list { margin-top: 26px; border-top: 1px solid var(--ink); }

.field-row {
  display: grid;
  grid-template-columns: minmax(150px, 2fr) minmax(230px, 4fr) minmax(180px, 2fr);
  gap: 25px;
  align-items: center;
  min-height: 84px;
  border-bottom: 1px solid var(--line);
}

.field-label { color: var(--muted); font-family: var(--mono); font-size: 10px; text-transform: uppercase; }
.field-value { overflow-wrap: anywhere; font-family: var(--display); font-size: clamp(20px, 2vw, 29px); }
.field-meta { display: flex; align-items: center; gap: 12px; }

.confidence-track { width: 76px; height: 4px; background: #d4cdc0; }
.confidence-track span { display: block; height: 100%; background: var(--green); }
.confidence-track.low span { background: var(--red); }
.field-source { color: var(--muted); font-family: var(--mono); font-size: 9px; text-transform: uppercase; }
.verified-mark { color: var(--green); font-size: 13px; }

.mrz-details { border-bottom: 1px solid var(--ink); }
.mrz-details summary { padding: 19px 0; cursor: pointer; font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.mrz-details pre { overflow-x: auto; margin: 0 0 18px; padding: 22px; color: #d5f4e2; background: var(--ink); font-family: var(--mono); font-size: clamp(11px, 1.3vw, 16px); line-height: 1.8; }
.mrz-checks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.mrz-check { padding: 5px 9px; border: 1px solid var(--line); font-family: var(--mono); font-size: 9px; text-transform: uppercase; }
.mrz-check.ok { border-color: var(--green); color: var(--green); }
.mrz-check.fail { border-color: var(--red); color: var(--red); }

.revision-strip {
  display: grid;
  grid-template-columns: minmax(280px, 4fr) minmax(0, 8fr);
  gap: 8vw;
}
.revision-intro p:last-child { max-width: 450px; margin-top: 28px; color: var(--muted); font-size: 13px; }
.revision-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--ink); }
.revision-list li {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.revision-list b { font-family: var(--display); font-size: 24px; font-weight: 400; }
.revision-list p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.revision-list small { align-self: center; font-family: var(--mono); font-size: 9px; text-align: right; text-transform: uppercase; }

footer {
  width: min(1460px, calc(100% - 56px));
  margin: 0 auto;
  padding: 32px 0 48px;
  display: grid;
  grid-template-columns: 1fr minmax(300px, 540px);
  gap: 40px;
  border-top: 1px solid var(--ink);
  color: var(--muted);
  font-size: 11px;
}
footer div { display: flex; flex-direction: column; }
footer b { color: var(--ink); letter-spacing: .13em; }
footer p { margin: 0; }

[hidden] { display: none !important; }

@media (max-width: 900px) {
  .hero { min-height: auto; grid-template-columns: 1fr; gap: 60px; padding: 85px 0 60px; }
  .lede { padding-left: 0; }
  .scope-note { max-width: 420px; }
  .capture-grid { grid-template-columns: 1fr; }
  .revision-strip { grid-template-columns: 1fr; }
  .verdict-row { grid-template-columns: 1fr; }
  .result-metrics { border-left: 0; }
  .result-metrics div:first-child { padding-left: 0; }
}

@media (max-width: 620px) {
  .masthead, main, footer { width: min(100% - 28px, 1460px); }
  .masthead { min-height: 82px; }
  .privacy-seal b { display: none; }
  .hero { padding-top: 70px; }
  h1 { font-size: clamp(54px, 18vw, 92px); }
  .desk, .results, .revision-strip { padding: 31px 0 70px; }
  .desk-heading { grid-template-columns: 1fr; gap: 25px; }
  .capture-slot { min-height: 325px; grid-template-columns: 45px 1fr; }
  .slot-copy { padding: 30px 22px 38px; }
  .file-action { padding: 0 22px; }
  .preview-wrap { left: 45px; }
  .action-row { flex-direction: column; }
  .scan-button { width: 100%; min-width: 0; }
  .result-head { grid-template-columns: 1fr; gap: 24px; }
  .result-actions { width: max-content; }
  .empty-result { grid-template-columns: 1fr; gap: 45px; padding: 50px 12%; }
  .empty-reticle { width: 150px; }
  .result-metrics { display: grid; grid-template-columns: repeat(3, 1fr); }
  .result-metrics div { min-width: 0; padding-left: 12px; }
  .field-row { grid-template-columns: 1fr; gap: 7px; padding: 18px 0; }
  .field-meta { justify-content: space-between; }
  .revision-list li { grid-template-columns: 80px 1fr; }
  .revision-list small { grid-column: 2; text-align: left; }
  footer { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
