/* PROTOTYPE 001 — neutral, temporary styling. Not a brand. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #4a505c;
  --border: #d4d8df;
  --primary: #0b57d0;
  --primary-text: #ffffff;
  --primary-hover: #0842a0;
  --danger: #b3261e;
  --danger-hover: #8c1d18;
  --ok-bg: #e3f4e8;
  --ok-text: #0d5224;
  --off-bg: #eceef1;
  --off-text: #3b404a;
  --notice-bg: #fff4d6;
  --notice-text: #5c4300;
  --focus: #f59e0b;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --surface: #1b1e24;
    --text: #f1f3f6;
    --muted: #b8bec9;
    --border: #3a3f49;
    --primary: #8ab4f8;
    --primary-text: #0b1a33;
    --primary-hover: #aecbfa;
    --danger: #f2b8b5;
    --danger-hover: #f9dedc;
    --ok-bg: #173d24;
    --ok-text: #b7ecc6;
    --off-bg: #2c3038;
    --off-text: #d3d7de;
    --notice-bg: #3d3214;
    --notice-text: #ffe39c;
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 1.125rem;
  line-height: 1.5;
}

main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}
main:focus { outline: none; }

h1 { font-size: 1.75rem; line-height: 1.2; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.25rem; margin: 1.5rem 0 0.5rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 0.5rem; color: var(--muted); }

a { color: var(--primary); text-underline-offset: 0.15em; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.btn:disabled { opacity: 0.6; cursor: progress; }

.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--muted); }

.btn-selected { background: var(--ok-bg); color: var(--ok-text); border-color: currentColor; }

.btn-danger { background: var(--surface); color: var(--danger); border-color: currentColor; }
.btn-danger:hover { color: var(--danger-hover); }

.btn-xl {
  width: 100%;
  min-height: 72px;
  font-size: 1.375rem;
  margin: 1rem 0;
}

.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.btn-row .btn { flex: 1 1 12rem; }

/* ---------- Public scan page ---------- */

body.public main { padding-top: 2.5rem; }
body.public h1 { font-size: 2.25rem; }
.lead { font-size: 1.375rem; font-weight: 600; margin: 0 0 0.5rem; }

.result:empty { display: none; }
.result {
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}
.result:focus { outline: none; }
.result:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.result-main { font-weight: 600; margin: 0 0 0.5rem; }
.result-note { margin: 0; color: var(--muted); font-size: 1rem; }

.emergency {
  border-left: 4px solid var(--danger);
  padding: 0.5rem 0 0.5rem 0.75rem;
  margin-top: 1.5rem;
}

.fine-print { color: var(--muted); font-size: 0.9375rem; margin-top: 2rem; }

/* ---------- Dashboard / tools ---------- */

.proto-banner {
  background: var(--notice-bg);
  color: var(--notice-text);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  margin: 0 0 1rem;
}

.announce:empty { display: none; }
.announce {
  background: var(--ok-bg);
  color: var(--ok-text);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-weight: 600;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0;
}
.card h2 { margin-top: 0; }

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1rem;
  margin: 0;
}
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

.badge {
  display: inline-block;
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
}
.badge-on { background: var(--ok-bg); color: var(--ok-text); }
.badge-off { background: var(--off-bg); color: var(--off-text); }

.links { margin: 1.25rem 0 0; font-size: 1rem; }
.reset-row { margin: 1.5rem 0; }

.link-list { padding-left: 1.25rem; }
.link-list li { margin: 0.5rem 0; }
.link-list a { display: inline-block; padding: 0.25rem 0; }

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

.field { margin: 1rem 0; }
.field label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.field input {
  width: 100%;
  min-height: 48px;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
}

.qr-output { margin: 1.5rem 0; }
.qr-svg {
  display: block;
  width: min(100%, 320px);
  height: auto;
  border-radius: 4px;
}
.qr-url { font-family: ui-monospace, Consolas, monospace; font-size: 1rem; overflow-wrap: anywhere; }
.warning {
  background: var(--notice-bg);
  color: var(--notice-text);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 1rem;
}

/* ---------- QR paper print test (/print) ---------- */
/* Physical sizes use CSS inches/cm. At 100% print scale, 1in prints as 1 real inch. */

.steps li { margin: 0.375rem 0; }

.sheet {
  background: #ffffff;
  color: #000000;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1.5rem 0;
  overflow-x: auto; /* sheet is wider than a phone screen; never widen the page */
}
.sheet-title { margin: 0 0 0.25rem; color: #000000; font-size: 1.125rem; }
.sheet-url { margin: 0 0 1rem; font-size: 0.875rem; }
.sheet-url code { font-family: ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.sheet-invalid { color: #b3261e; font-weight: 700; margin: 0 0 0.5rem; }
.sheet-note { font-size: 0.8125rem; margin: 0.75rem 0; }

.print-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.35in;
}
.print-fig { margin: 0; text-align: center; break-inside: avoid; }
.qr-print { display: block; margin: 0 auto; background: #ffffff; }
.print-fig figcaption { margin-top: 0.08in; font-size: 0.8125rem; line-height: 1.3; }
.fig-detail { font-size: 0.6875rem; }

.rulers { display: flex; flex-wrap: wrap; gap: 0.5in; margin: 0.75rem 0; }
.ruler {
  height: 0.2in;
  border: 1.5px solid #000000;
  border-top: 0;
  position: relative;
}
.ruler span { position: absolute; top: 0.24in; left: 0; font-size: 0.6875rem; white-space: nowrap; }
.ruler-in { width: 2in; }
.ruler-cm { width: 5cm; }

.log { width: 100%; border-collapse: collapse; margin-top: 0.45in; font-size: 0.8125rem; }
.log caption { text-align: left; font-weight: 700; padding-bottom: 0.25rem; white-space: pre; }
.log th, .log td { border: 1px solid #000000; padding: 0.35rem; text-align: left; }
.log td { height: 0.4in; }

@page { margin: 0.5in; }

@media print {
  .no-print { display: none !important; }
  html, body { background: #ffffff !important; color: #000000 !important; }
  main { max-width: none; margin: 0; padding: 0; }
  .sheet { border: 0; border-radius: 0; padding: 0; margin: 0; overflow: visible; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
