@font-face { font-family: "Instrument Sans"; src: url("/fonts/instrument-sans-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("/fonts/ibm-plex-mono-400-latin.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("/fonts/ibm-plex-mono-500-latin.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --bg: #f4f2ee;
  --sheet: #ffffff;
  --ink: #171717;
  --soft: #3f3f3f;
  --dim: #636363;
  --line: #e3dfd7;
  --accent: #14532d;
  --accent-hover: #0f3f22;
  --ok: #166534;
  --flag: #8a3b0a;
  --flag-bg: #fdf0d5;
  --flag-line: #e8b04b;
  --radius: 14px;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --pad: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 var(--sans); }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, white); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.1; margin: 0; letter-spacing: -0.02em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }

.bar, main, .foot { max-width: 720px; margin: 0 auto; padding-inline: var(--pad); }
.bar { display: flex; justify-content: space-between; align-items: baseline; padding-top: 14px; font: 500 13px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }
.bar .tagline { color: var(--dim); }

/* Hero: fits one phone screen */
.hero { padding: 36px 0 28px; }
.hero h1 { font-size: clamp(2.5rem, 11vw, 4rem); font-weight: 700; letter-spacing: -0.035em; }
.lede { font-size: 1.2rem; line-height: 1.4; color: var(--soft); margin: 14px 0 22px; max-width: 30ch; }
.actions { display: grid; gap: 10px; }
.btn { display: flex; align-items: center; justify-content: center; min-height: 54px; padding: 0 20px; border-radius: 12px; font: 600 1.05rem/1.2 var(--sans); text-decoration: none; cursor: pointer; border: 2px solid transparent; text-align: center; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.secondary { background: var(--sheet); color: var(--ink); border-color: var(--ink); }
.btn.secondary:hover { background: #ece9e3; }
.btn:disabled { opacity: 0.5; cursor: default; }
.fine { font-size: 0.95rem; color: var(--dim); margin: 14px 0 0; }

/* A strip of the paper slip under the buttons, so the result is visible before anyone taps */
.slip { margin-top: 26px; background: var(--sheet); border: 1px solid var(--line); border-radius: 10px; padding: 4px 12px; font: 400 0.82rem/1.3 var(--mono); }
.sl { display: grid; grid-template-columns: 1fr auto auto; grid-template-areas: "d d s" "m t s"; column-gap: 12px; padding: 9px 0; }
.sl + .sl { border-top: 1px dashed var(--line); }
.sl .d { grid-area: d; font-family: var(--sans); font-size: 0.95rem; color: var(--ink); }
.sl .m { grid-area: m; color: var(--dim); }
.sl .t { grid-area: t; text-align: right; }
.sl .s { grid-area: s; align-self: center; font-weight: 500; color: var(--ok); min-width: 4.2em; text-align: right; }
.sl.flag .s { color: var(--flag); }
.sl.flag .t { color: var(--flag); text-decoration: line-through; }
.slipnote { margin: 8px 2px 0; font-size: 0.92rem; color: var(--dim); }

/* The results sheet */
.demo { padding: 4px 0 24px; scroll-margin-top: 12px; }
.sheet { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 18px; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05); }
.readbar { display: flex; gap: 12px; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.thumb { position: relative; flex: none; width: 60px; height: 76px; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #eee; cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.scan { position: absolute; left: 0; right: 0; height: 30%; top: -30%; background: linear-gradient(to bottom, transparent, rgba(20,83,45,.35), transparent); display: none; }
.reading .scan { display: block; animation: scan 1.4s ease-in-out infinite; }
@keyframes scan { to { top: 100%; } }
.readtext { min-width: 0; }
.status { margin: 0; font-weight: 600; }
.note { margin: 2px 0 0; font-size: 0.9rem; color: var(--dim); }
.note:empty { display: none; }

.meta { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 12px 0 4px; }
.meta div { display: flex; justify-content: space-between; gap: 12px; }
.meta dt { color: var(--dim); font-size: 0.9rem; }
.meta dd { margin: 0; font: 500 0.95rem/1.35 var(--mono); text-align: right; overflow-wrap: anywhere; }

.lines { list-style: none; margin: 8px 0 0; padding: 0; counter-reset: ln; }
.lines li { display: grid; grid-template-columns: 2em 1fr auto; column-gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); opacity: 0; transform: translateY(6px); transition: opacity .25s ease, transform .25s ease, background .3s ease; }
.lines li.in { opacity: 1; transform: none; }
.lines .n { font: 400 0.8rem/1.6 var(--mono); color: var(--dim); }
.lines .d { font-size: 0.98rem; line-height: 1.35; }
.lines .m { grid-column: 2; font: 400 0.84rem/1.5 var(--mono); color: var(--dim); }
.lines .t { grid-column: 3; grid-row: 1 / span 2; text-align: right; font: 500 0.95rem/1.4 var(--mono); white-space: nowrap; }
.lines .t small { display: block; font: 500 0.75rem/1.6 var(--mono); color: var(--ok); }
.lines li.flag { background: var(--flag-bg); border-top-color: var(--flag-line); margin: 0 -14px; padding-inline: 14px; grid-template-columns: 2em 1fr auto; }
.lines li.flag .t small { color: var(--flag); }
.lines .why { grid-column: 2 / span 2; margin: 8px 0 0; font-size: 0.95rem; color: var(--flag); font-weight: 600; }

.totals { margin: 6px 0 0; padding-top: 10px; border-top: 2px solid var(--ink); display: grid; gap: 4px; }
.totals div { display: flex; justify-content: space-between; gap: 12px; }
.totals dt { color: var(--soft); }
.totals dd { margin: 0; font: 500 0.98rem/1.5 var(--mono); }
.totals .grand dt, .totals .grand dd { font-weight: 700; color: var(--ink); font-size: 1.1rem; }

.verdict { margin: 14px 0 6px; padding: 14px; border-radius: 10px; background: #edf5ef; color: var(--ok); }
.verdict.warn { background: var(--flag-bg); color: var(--flag); }
.verdict h3 { font-size: 1.15rem; margin-bottom: 6px; }
.verdict p { margin: 6px 0 0; }
.verdict ul { margin: 6px 0 0; padding-left: 20px; }

.limit p, .error { margin: 14px 0; }
.error { color: var(--flag); font-weight: 600; }
.again { display: grid; gap: 10px; margin-top: 14px; }

/* How it works + contact */
.how, .cta { padding: 36px 0 8px; }
.how h2, .cta h2 { font-size: clamp(1.6rem, 6.5vw, 2.2rem); margin-bottom: 14px; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: st; }
.steps li { counter-increment: st; position: relative; padding: 0 0 18px 44px; color: var(--soft); }
.steps li::before { content: counter(st); position: absolute; left: 0; top: 0; width: 30px; font: 500 1.05rem/1.5 var(--mono); color: var(--ink); border-bottom: 2px solid var(--ink); text-align: left; }
.steps b { display: block; color: var(--ink); }
.proof { margin: 4px 0 0; padding: 14px 16px; border-left: 3px solid var(--accent); background: var(--sheet); border-radius: 0 10px 10px 0; font-weight: 600; }
.cta p { color: var(--soft); margin: 0 0 18px; }
.cta .btn { overflow-wrap: anywhere; }

.foot { display: flex; justify-content: space-between; gap: 16px; padding-top: 40px; padding-bottom: 36px; color: var(--dim); font-size: 0.95rem; }
.foot p { margin: 0; }
.foot a { color: var(--dim); min-height: 44px; }

dialog { width: min(96vw, 900px); max-height: 94vh; padding: 10px; border: 0; border-radius: 12px; background: var(--sheet); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog img { width: 100%; height: auto; display: block; margin-top: 8px; }
dialog .close { min-height: 44px; margin-left: auto; }
dialog form { display: flex; }

/* Privacy page */
.doc { padding: 28px 0 8px; }
.doc h1 { font-size: 2rem; margin-bottom: 16px; }
.doc h2 { font-size: 1.2rem; margin: 26px 0 8px; }
.doc p, .doc li { color: var(--soft); }

@media (min-width: 640px) {
  :root { --pad: 24px; }
  .hero { padding-top: 64px; }
  .actions { grid-template-columns: 1fr 1fr; }
  .cta .actions { grid-template-columns: 1fr 1fr; }
  .cta .actions .btn:first-child { grid-column: 1 / -1; }
  .meta { grid-template-columns: repeat(3, 1fr); }
  .meta div { display: block; }
  .meta dd { text-align: left; }
  .again { grid-template-columns: 1fr 1fr; }
  .sheet { padding: 20px 22px 24px; }
  .lines li.flag { margin: 0 -22px; padding-inline: 22px; }
  .lines li { grid-template-columns: 2.4em 1fr auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .lines li { opacity: 1; transform: none; }
}
