/* app.css - one small stylesheet. D-110: the "Fresh Air" look from the Lovable
   design (cream, deep blue instead of black, leafy green for actions), in hex so
   older Chrome on low-end phones reads it, with the green and red deepened until
   every text pair passes WCAG AA (4.5:1). Fonts are self-hosted in fonts/ (never
   Google's servers: no visitor IP leaves for a font) and swap in, so text shows
   at once in the system font on a slow network.
   Colour carries status on the people cards only; every status is also written
   out in words, so nothing depends on colour alone. */

@font-face { font-family: "DM Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/dm-sans-400.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/dm-sans-600.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/dm-sans-700.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/bricolage-grotesque-600.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 800; font-style: normal; font-display: swap; src: url("fonts/bricolage-grotesque-800.woff2") format("woff2"); }

:root {
  color-scheme: light dark;
  --bg: #fbf9ee; --surface: #ffffff; --ink: #244b6b; --muted: #57768c; --line: #c9e3ec;
  --brand: #048149; --brand-ink: #fcfcf8; --accent: #6dc88f; --ring: #008cba; --mint: #c4f6d4;
  --stop: #c92324; --stop-bg: #ffe5e0;                              /* on the avoid list / may contain */
  --unsure: #6c380d; --unsure-bg: #ffefcd; --unsure-line: #f59e3b;  /* couldn't confirm / uncertain */
  --calm: #194860; --calm-bg: #d5f7f4;                              /* not listed / nothing extra */
  --radius: 16px;
  --shadow: 0 1px 2px rgba(36, 75, 107, .06), 0 12px 32px -12px rgba(36, 75, 107, .18);
  --hero: radial-gradient(60% 60% at 15% 10%, rgba(196, 246, 212, .7), transparent 70%),
          radial-gradient(50% 50% at 90% 20%, rgba(196, 234, 250, .7), transparent 70%);
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --display: "Bricolage Grotesque", var(--font);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #193043; --surface: #234058; --ink: #e0f2f6; --muted: #a3c4d1; --line: #3e6378;
    --brand: #66c189; --brand-ink: #042234; --accent: #66c189; --ring: #7dccda; --mint: #28523c;
    --stop: #ffbdb5; --stop-bg: #6c3530; --unsure: #ffd791; --unsure-bg: #674420; --unsure-line: #f7ac4d;
    --calm: #d9f0f3; --calm-bg: #265368;
    --shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 12px 32px -12px rgba(0, 0, 0, .45);
    --hero: radial-gradient(60% 60% at 15% 10%, rgba(40, 82, 60, .8), transparent 70%),
            radial-gradient(50% 50% at 90% 20%, rgba(38, 83, 104, .8), transparent 70%);
  }
}

* { box-sizing: border-box; }
/* A class that sets display (e.g. .choice) would otherwise override the hidden attribute. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
/* The colour sits on html so the body's gradient stays at the top of the page
   instead of spreading to the whole canvas (and repeating under short pages). */
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font: 16px/1.5 var(--font);
  background: var(--hero) no-repeat top / 100% 420px;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 48px; }

.top {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px; color: var(--ink);
  background: var(--bg);   /* older Chrome: no color-mix, solid header */
  background: color-mix(in srgb, var(--bg) 85%, transparent); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.top a { color: inherit; text-decoration: none; }
.brand { display: inline-flex; align-items: center; gap: 8px; font: 800 1.2rem/1 var(--display); letter-spacing: -.01em; }
.mark { display: block; flex: none; width: 32px; height: 32px; }   /* D-112: the logo, icon.svg */
.top nav { display: flex; gap: 6px; font-size: .9rem; font-weight: 600; }
.top nav a {
  padding: 6px 12px; white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  box-shadow: var(--shadow);
}

h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: 1.7rem; line-height: 1.1; margin: 0; }
h2 { font-size: 1.15rem; margin: 8px 0 0; }
h1:focus, h2:focus { outline: none; }
p { margin: 0; }
.stack > * + * { margin-top: 14px; }
.center { text-align: center; }
.lead { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .92rem; }
.tech { color: var(--muted); font-size: .85rem; font-family: ui-monospace, "Roboto Mono", monospace; }
.error { color: var(--stop); font-weight: 600; min-height: 0; }
.error:empty { display: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.wrap .btn { flex: 1 1 140px; }
.row.between { justify-content: space-between; }
.row input { flex: 1; min-width: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 18px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 700; cursor: pointer; text-align: center; box-shadow: var(--shadow);
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}
.btn:active:not(:disabled) { transform: translateY(2px) scale(.99); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); width: 100%; min-height: 54px; font-size: 1.05rem; }
.btn.link { border: 0; background: none; color: var(--brand); min-height: 44px; padding: 8px 0; width: auto; box-shadow: none; }
.btn.danger { color: var(--stop); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

.scan-cta {
  width: 100%; display: flex; align-items: center; gap: 16px; padding: 22px 20px; border: 0;
  border-radius: 24px; background: var(--brand); color: var(--brand-ink); font: 800 1.35rem/1.2 var(--display);
  cursor: pointer; box-shadow: var(--shadow); transition: transform 120ms ease;
}
.scan-cta:active { transform: translateY(2px) scale(.99); }
.scan-cta-icon .icon-svg { width: 56px; height: 38px; }
.s-bars { stroke: currentColor; stroke-width: 4; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow);
}
.card > * + * { margin-top: 8px; }
.card.note { border-left: 4px solid var(--brand); }
.card.warn { background: var(--unsure-bg); border-color: var(--unsure-line); color: var(--unsure); }
.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--brand); }

ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li + li { margin-top: 6px; }
.list {
  list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.list li { border-top: 1px solid var(--line); padding: 4px 14px; }
.list li:first-child { border-top: 0; }
.list a { display: flex; flex-direction: column; padding: 8px 0; color: inherit; text-decoration: none; }

label { font-weight: 600; }
input[type=text], input:not([type]), input[inputmode], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink); font: inherit;
}
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0; background: var(--surface); }
legend { font-weight: 700; padding: 0 4px; }
.choice { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 400; }
.choice input { width: 22px; height: 22px; flex: none; accent-color: var(--brand); }
.consent { align-items: flex-start; }
.consent input { margin-top: 3px; }

/* Barcode camera */
.viewfinder-wrap { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.viewfinder { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame { position: absolute; inset: 30% 12%; border: 3px solid var(--accent); border-radius: 10px; box-shadow: 0 0 0 2000px rgba(0,0,0,.35); }

/* Photo step */
.sample { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: center; }
.sample-svg { width: 100%; max-width: 260px; height: auto; }
.s-pack { fill: var(--bg); stroke: var(--line); stroke-width: 1.5; }
.s-hi { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-dasharray: 4 3; }
.s-t { font: 700 6px system-ui, sans-serif; fill: var(--ink); }
.s-line { fill: var(--muted); }
.s-dim { fill: var(--line); }
.thumb img { max-width: 100%; max-height: 220px; border-radius: 12px; display: block; }

/* Working */
.pulse { width: 56px; height: 56px; margin: 24px auto 0; border-radius: 50%; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none; }
  .btn, .scan-cta { transition: none; }
}

/* A 360-390 px phone: the name, the mark and two pills on one line. */
@media (max-width: 400px) {
  .top { padding: 10px 12px; }
  .brand { font-size: 1.05rem; gap: 6px; }
  .mark { width: 28px; height: 28px; }
  .top nav a { padding: 6px 10px; font-size: .85rem; }
}

/* Result (D-060 to D-066) */
.product { font-weight: 700; color: var(--muted); text-transform: none; }
.people > * + * { margin-top: 8px; }
.person { border-radius: var(--radius); padding: 12px 14px; border-left: 6px solid var(--calm); background: var(--calm-bg); color: var(--calm); }
.person .who { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.person .line { font-size: 1.08rem; font-weight: 600; margin-top: 2px; }
.status-contains, .status-may_contain { border-color: var(--stop); background: var(--stop-bg); color: var(--ink); }
.status-contains .who, .status-may_contain .who { color: var(--stop); }
.status-cannot_confirm, .status-uncertain, .status-worth_knowing { border-color: var(--unsure-line); background: var(--unsure-bg); color: var(--ink); }
.status-cannot_confirm .who, .status-uncertain .who, .status-worth_knowing .who { color: var(--unsure); }
.headline { font-size: 1.45rem; }
.band { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; box-shadow: var(--shadow); }
.band details { margin-top: 6px; }
details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }
.items > * + * { margin-top: 8px; }
.item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2px 14px;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
@media (hover: hover) { .item:hover { transform: translateY(-2px); box-shadow: var(--shadow); } }
.item[open] { padding-bottom: 12px; }
.item > p + p { margin-top: 6px; }
.concern-high { border-left: 4px solid var(--stop); }
.concern-moderate { border-left: 4px solid var(--unsure-line); }
.item.best { border: 2px solid var(--brand); }
.flag { font-weight: 600; }
ol { margin: 0; padding-left: 22px; }
q { quotes: "“" "”"; }
.report { color: var(--muted); }

/* Report a problem (D-092) */
.foot { padding-top: 0; text-align: center; font-size: .9rem; }
.foot a { color: var(--muted); }
.preview { white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow: auto; }

/* D-102: photo upload on a computer - choose or drop. */
.drop { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 16px;
        border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface); }
.drop.over { border-color: var(--brand); border-style: solid; background: var(--mint); }
.drop .btn { width: auto; }
.rating { flex-wrap: wrap; gap: 4px 16px; }
.rating .choice { min-height: 36px; }

/* D-104: the tick or cross under each photo. */
.check { margin: 6px 0 0; padding: 8px 12px; border-radius: 12px; font-weight: 600; }
.check.ok { background: var(--mint); color: var(--ink); }
.check.bad { background: var(--stop-bg); color: var(--stop); }
.check.unknown { background: var(--unsure-bg); color: var(--unsure); font-weight: 400; }

/* D-105: "Before you start". */
.rules { padding-left: 22px; } .rules li { margin: 8px 0; }

/* D-111: additive cards with a badge. Colour repeats what the badge says in words. */
.add-alert { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 14px 16px;
             border-radius: var(--radius); background: var(--stop-bg); border-left: 6px solid var(--stop); }
.add-alert strong { display: block; color: var(--stop); }
.add-alert p { font-size: .95rem; margin-top: 2px; }
.add-alert > .add-icon { background: var(--stop); color: var(--surface); width: 26px; height: 26px; margin-top: 1px; }
.add-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 18px; height: 18px;
            border-radius: 50%; font-weight: 800; font-size: .72rem; line-height: 1; }
.add { background: var(--surface); border: 1px solid var(--line); border-left-width: 6px; border-radius: var(--radius);
       padding: 12px 14px; display: grid; gap: 6px; }
.add-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.add-name { font-weight: 700; font-size: 1.02rem; line-height: 1.3; }
.add-name small { display: block; font-size: .78rem; font-weight: 600; letter-spacing: .02em; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 5px; flex: none; white-space: nowrap; border-radius: 999px;
         padding: 3px 10px 3px 4px; font-size: .78rem; font-weight: 700; }
.add-not_permitted { border-left-color: var(--stop); }
.add-not_permitted .badge { background: var(--stop-bg); color: var(--stop); }
.add-not_permitted .add-icon { background: var(--stop); color: var(--surface); }
.add-worth_knowing { border-left-color: var(--unsure-line); }
.add-worth_knowing .badge { background: var(--unsure-bg); color: var(--unsure); }
.add-worth_knowing .add-icon { background: var(--unsure-line); color: #3a1f06; }
.add-permitted { border-left-color: var(--brand); }
.add-permitted .badge { background: var(--mint); color: var(--ink); }
.add-permitted .add-icon { background: var(--brand); color: var(--surface); }
.add-note { color: var(--unsure); font-weight: 600; }
@media (max-width: 400px) { .add-top { flex-wrap: wrap; } }
.fold[open] > .items { padding-bottom: 4px; }
.fold .add { box-shadow: none; }
