:root {
  --bg: #f0ece4;
  --surface: #fbf9f5;
  --surface-2: #e8e2d6;
  --border: #d6cdbb;
  --border-strong: #b5a98f;
  --text: #191814;
  --text-dim: #585246;
  --text-faint: #8a8373;
  --accent: #1f3a6e;
  --accent-hover: #152a52;
  --accent-soft: #e2e6ef;
  --accent-ink: #ffffff;
  --pass: #2f6a3a;
  --pass-soft: #e4eee2;
  --warn: #8a6516;
  --warn-soft: #f4ead3;
  --fail: #9d2f26;
  --fail-soft: #f3e3e0;
  --shadow: 0 1px 0 rgba(25, 24, 20, .04);
  --radius: 3px;
  --radius-sm: 2px;
  --maxw: 1120px;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, ui-serif, serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141310;
    --surface: #1c1a16;
    --surface-2: #24211a;
    --border: #322e25;
    --border-strong: #4a4436;
    --text: #efeade;
    --text-dim: #a8a08f;
    --text-faint: #7e7768;
    --accent: #c9b177;
    --accent-hover: #ddc893;
    --accent-soft: #2a2417;
    --accent-ink: #19170f;
    --pass: #8fbf7a;
    --pass-soft: #1d2617;
    --warn: #d6a84e;
    --warn-soft: #2b2314;
    --fail: #d98276;
    --fail-soft: #2d1b18;
    --shadow: 0 1px 0 rgba(0, 0, 0, .5);
  }
}

:root[data-theme="dark"] {
    --bg: #141310;
  --surface: #1c1a16;
  --surface-2: #24211a;
  --border: #322e25;
  --border-strong: #4a4436;
  --text: #efeade;
  --text-dim: #a8a08f;
  --text-faint: #7e7768;
  --accent: #c9b177;
  --accent-hover: #ddc893;
  --accent-soft: #2a2417;
  --accent-ink: #19170f;
  --pass: #8fbf7a;
  --pass-soft: #1d2617;
  --warn: #d6a84e;
  --warn-soft: #2b2314;
  --fail: #d98276;
  --fail-soft: #2d1b18;
  --shadow: 0 1px 0 rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

/* The hidden attribute must beat the display rules below it, otherwise a
   panel with `display: flex` stays on screen while marked hidden. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 16px;
}

.brand {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--text); text-decoration: none;
  font-size: 17px; letter-spacing: -.01em;
}
.brand strong { font-weight: 700; }
.brand-mark {
  width: 20px; height: 20px; border-radius: 5px;
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 4px var(--accent);
  flex: none;
}

.site-nav { display: flex; gap: 20px; }
.site-nav a {
  color: var(--text-dim); text-decoration: none; font-size: 14.5px;
}
.site-nav a:hover { color: var(--text); }

/* ---------- hero ---------- */

.hero {
  max-width: 760px;
  margin: 18px auto 26px;
  padding: 0 16px;
  text-align: center;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(27px, 5.2vw, 40px);
  line-height: 1.14;
  letter-spacing: -.022em;
  font-weight: 680;
}

.hero-sub {
  margin: 0 auto;
  max-width: 62ch;
  color: var(--text-dim);
  font-size: clamp(15px, 2vw, 17px);
}

/* ---------- tool ---------- */

.tool {
  max-width: var(--maxw);
  margin: 0 auto 56px;
  padding: 0 16px;
}

.spec-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.spec-row label { font-size: 14px; color: var(--text-dim); }
.spec-row select {
  appearance: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6.5 8 10.5l4-4' fill='none' stroke='%235b6a69' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center / 15px;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 34px 9px 12px;
  font: inherit; font-size: 15px;
  cursor: pointer;
}
.spec-size { font-size: 13.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

.stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* dropzone */

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  padding: 54px 20px;
  text-align: center;
  cursor: pointer;
  border: 2px dashed transparent;
  transition: background .14s ease, border-color .14s ease;
}
.dropzone:hover, .dropzone:focus-visible {
  background: var(--accent-soft);
  border-color: var(--accent);
  outline: none;
}
.dropzone.dragging {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.dz-icon { width: 34px; height: 34px; color: var(--accent); }
.dz-title { margin: 4px 0 0; font-size: 17px; font-weight: 560; }
.dz-hint { margin: 0; font-size: 13.5px; color: var(--text-faint); max-width: 44ch; }

/* working */

.working {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 72px 20px;
  color: var(--text-dim);
}
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* problem */

.problem { padding: 46px 20px; text-align: center; }
.problem p { margin: 0 0 14px; color: var(--fail); font-size: 16px; }

/* result */

.result {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: 0;
}
@media (max-width: 800px) {
  .result { grid-template-columns: 1fr; }
}

.result-preview {
  padding: 22px;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
@media (max-width: 800px) {
  .result-preview { border-right: 0; border-bottom: 1px solid var(--border); }
}

.preview-frame {
  width: 100%;
  max-width: 256px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  overflow: hidden;
  line-height: 0;
}
.preview-frame canvas { width: 100%; height: auto; display: block; }

.preview-caption {
  margin: 0; font-size: 12.5px; color: var(--text-faint); text-align: center;
  font-variant-numeric: tabular-nums;
}

.result-report { padding: 22px; min-width: 0; }

.verdict {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 560;
  margin-bottom: 16px;
}
.verdict.pass { background: var(--pass-soft); color: var(--pass); }
.verdict.warn { background: var(--warn-soft); color: var(--warn); }
.verdict.fail { background: var(--fail-soft); color: var(--fail); }
.verdict-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }

.checks { list-style: none; margin: 0 0 22px; padding: 0; }
.check {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.check:last-child { border-bottom: 0; }
.check-icon { width: 18px; height: 18px; margin-top: 2px; flex: none; }
.check-icon.pass { color: var(--pass); }
.check-icon.warn { color: var(--warn); }
.check-icon.fail { color: var(--fail); }
.check-label { font-size: 14.5px; font-weight: 560; }
.check-detail { font-size: 13.5px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.check-fix { font-size: 13px; color: var(--text-faint); margin-top: 3px; }

/* actions */

.actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.action-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: var(--surface);
}
.action-card.paid { border-color: var(--accent); background: var(--accent-soft); }
.action-card h3 { margin: 0 0 3px; font-size: 15.5px; }
.action-sub { margin: 0 0 12px; font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.action-note { margin: 9px 0 0; font-size: 12.5px; color: var(--text-faint); }

.price-tag {
  position: absolute; top: 14px; right: 14px;
  font-size: 15px; font-weight: 700; color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.paper-choice { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.paper-opt {
  font: inherit; font-size: 12.5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
}
.paper-opt[aria-checked="true"] {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .paper-opt[aria-checked="true"] { color: #06201d; }
}
:root[data-theme="dark"] .paper-opt[aria-checked="true"] { color: #06201d; }
/* buttons */

.btn {
  font: inherit; font-size: 15px; font-weight: 560;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  border: 1px solid transparent;
  cursor: pointer;
  width: 100%;
  transition: background .13s ease, border-color .13s ease, color .13s ease;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
:root[data-theme="dark"] .btn-primary { color: #06201d; }
.btn-secondary {
  background: var(--surface); color: var(--text); border-color: var(--border-strong);
}
.btn-secondary:hover { border-color: var(--text-faint); }
.btn-ghost {
  background: transparent; color: var(--text-dim); border-color: var(--border-strong);
  width: auto;
}
.btn-ghost:hover { color: var(--text); }
.btn-small { font-size: 13px; padding: 7px 12px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.dev-note {
  margin: 16px 0 0;
  padding: 10px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-faint);
}

/* ---------- prose sections ---------- */

.prose {
  max-width: 720px;
  margin: 0 auto 56px;
  padding: 0 16px;
}
.prose h2 {
  font-size: clamp(21px, 3.4vw, 26px);
  letter-spacing: -.016em;
  margin: 0 0 16px;
}
.prose h3 { font-size: 16px; margin: 26px 0 6px; }
.prose p { color: var(--text-dim); margin: 0 0 12px; }

.spec-table {
  margin: 0 0 20px;
  display: grid;
  grid-template-columns: minmax(130px, auto) 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.spec-table dt, .spec-table dd {
  margin: 0; padding: 10px 14px; font-size: 14.5px;
  border-bottom: 1px solid var(--border);
}
.spec-table dt { color: var(--text-dim); background: var(--surface-2); }
.spec-table dd { font-variant-numeric: tabular-nums; }
.spec-table dt:nth-last-of-type(1), .spec-table dd:nth-last-of-type(1) { border-bottom: 0; }

.notes { margin: 0 0 14px; padding-left: 20px; color: var(--text-dim); }
.notes li { margin-bottom: 5px; font-size: 14.5px; }
.source-line { font-size: 13px; color: var(--text-faint); }
.source-line a { color: var(--accent); }

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

.site-footer {
  border-top: 1px solid var(--border);
  padding: 26px 16px 40px;
}
.site-footer > * { max-width: 720px; margin-left: auto; margin-right: auto; }
.disclaimer { font-size: 13px; color: var(--text-faint); margin: 0 0 12px; }
.footer-links { display: flex; gap: 18px; font-size: 13px; }
.footer-links a { color: var(--text-dim); text-decoration: none; }
.footer-links a:hover { color: var(--text); }

/* Shown when an authority's own rules mean no online tool can produce an
   acceptable photo. It replaces the sales path rather than sitting beside it. */
.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 13px 15px;
  margin-bottom: 12px;
  border: 1px solid var(--warn);
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
}
.notice strong { color: var(--warn); }

.country-list { list-style: none; margin: 0 0 18px; padding: 0; }
.country-list li {
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14.5px;
}
.country-list li:last-child { border-bottom: 0; }
.country-list .country-name { font-weight: 560; }
.country-list .country-reason { color: var(--text-dim); display: block; margin-top: 2px; }
.country-list.muted .country-name { color: var(--text-dim); font-weight: 400; }
.spec-group-label { font-size: 12px; color: var(--text-faint); }

/* link styled as a button (used on the requirements pages) */
.btn-link { display: inline-block; width: auto; text-decoration: none; text-align: center; }
.prose a:not(.btn) { color: var(--accent); }

/* ============================================================
   Design pass: document register.
   Paper and ink rather than slate and teal, measurements set in
   monospace the way a form prints them, crop marks for the brand,
   hairlines instead of shadowed cards.
   ============================================================ */

h1, h2, h3, .hero h1, .prose h2, .dz-title {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: 0;
}
.prose h2 { font-size: clamp(22px, 3.2vw, 27px); }
.prose h3 {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-dim);
  margin: 28px 0 8px;
}

/* hero: left aligned, with a measured rule under it */
.hero {
  text-align: left;
  max-width: 760px;
  margin: 26px auto 30px;
}
.hero h1 { font-size: clamp(28px, 5vw, 42px); line-height: 1.1; }
.hero-sub { margin: 0; max-width: 58ch; }
.hero::after {
  content: "";
  display: block;
  width: 64px;
  height: 0;
  margin-top: 22px;
  border-top: 2px solid var(--accent);
}

/* brand: registration marks, not a rounded square */
.brand { font-family: var(--font-serif); font-size: 18px; letter-spacing: 0; }
.brand-mark {
  position: relative;
  width: 18px; height: 18px;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  width: 7px; height: 7px;
  border: 1.5px solid var(--accent);
}
.brand-mark::before { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.brand-mark::after { bottom: 0; right: 0; border-left: 0; border-top: 0; }

/* labels and nav in the form-field register */
.site-nav a, .spec-row label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .09em;
}

/* the specification as a printed table: hairline rows, mono figures */
.spec-table { border-radius: 0; background: none; border-color: var(--border-strong); }
.spec-table dt {
  background: none;
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-faint);
  padding-top: 13px;
}
.spec-table dd {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.spec-size, .result-meta { font-family: var(--font-mono); }

/* buttons: square, ink-correct in both schemes */
.btn { border-radius: 2px; letter-spacing: .01em; }
.btn-primary { color: var(--accent-ink); }
.btn-link { padding: 12px 22px; }

/* links read as document references */
.prose a:not(.btn) { text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* the stage is a sheet, not a floating card */
.stage { border-radius: 0; border-color: var(--border-strong); box-shadow: none; }
.dropzone { border-width: 1px; }
.spec-row select { border-radius: 2px; }

/* one column: header, hero, tool and prose share a left edge, while the
   text inside stays at a readable measure */
.hero, .prose { max-width: var(--maxw); }
.hero h1 { max-width: 20ch; }
.hero-sub { max-width: 56ch; }
.prose > p, .prose > ul, .prose > ol, .prose > .source-line { max-width: 68ch; }
.spec-table, .country-list { max-width: 820px; }

/* the letterspaced nav is wider than a phone: let it wrap and tighten it */
@media (max-width: 620px) {
  .site-header { flex-wrap: wrap; gap: 10px 14px; padding: 14px 16px; }
  .site-nav { gap: 14px; flex-wrap: wrap; }
  .site-nav a { font-size: 10.5px; letter-spacing: .07em; }
}
