/* Gutbugs Scanner — large type, high contrast, plain layout.
   Body text is at least 20px. Buttons are at least 28px. */

@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/montserrat/Montserrat-ExtraBold.woff2") format("woff2"),
       url("../fonts/montserrat/Montserrat-ExtraBold.woff") format("woff");
}

:root {
  --bg: #fffef8;
  --text: #1a1a1a;
  --muted: #333333;
  --green: #0a4d28;
  --green-text: #ffffff;
  --banner-bg: #ffe08a;
  --banner-text: #3d2a00;
  --enjoy-bg: #e6f5ec;
  --enjoy-text: #0a4d28;
  --limit-bg: #fff3d6;
  --limit-text: #5c3d00;
  --avoid-bg: #fde8ea;
  --avoid-text: #7a1020;
  --unknown-bg: #ececec;
  --unknown-text: #222222;
  --neutral-bg: #e8eef5;
  --neutral-text: #1a2a44;
  --line: #cfcfc8;
  --focus: #0840a8;
  --radius: 12px;
  --cream: #F6F0E6;
  --navy: #1B3C53;
}


* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 22px;          /* above the 20px minimum */
  line-height: 1.45;
}

body {
  min-height: 100vh;
  min-height: 100dvb;
  padding-bottom: env(safe-area-inset-bottom);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--text);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 20;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

.banner {
  margin: 0;
  padding: 0.75rem 1rem;
  padding-top: calc(0.75rem + env(safe-area-inset-top));
  background: var(--banner-bg);
  color: var(--banner-text);
  font-weight: 700;
  text-align: center;
  border-bottom: 3px solid #c48a00;
}

.top {
  padding: 0.75rem 1.25rem 0;
}
.app-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.02em;
}

main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0.5rem 1.25rem 2rem;
}

.screen h1, .screen h2 {
  font-size: 2rem;
  line-height: 1.25;
  margin: 0.75rem 0 0.75rem;
}
.screen h1:focus, .screen h2:focus { outline: none; }

.lede {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

.btn {
  display: block;
  width: 100%;
  margin: 0 0 1rem;
  padding: 1rem 1.25rem;
  min-height: 4rem;
  font-size: 1.35rem;       /* ~30px at 22px root — above 28px */
  font-weight: 700;
  line-height: 1.3;
  border-radius: var(--radius);
  border: 3px solid var(--green);
  cursor: pointer;
  text-align: center;
  font-family: inherit;
}
.btn:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}
.btn-primary {
  background: var(--green);
  color: var(--green-text);
}
.btn-primary:hover { background: #083c1f; }
.btn-secondary {
  background: var(--bg);
  color: var(--green);
}
.btn-secondary:hover { background: #eef6f1; }

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

label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

#barcode-input {
  display: block;
  width: 100%;
  font-size: 1.5rem;
  font-family: inherit;
  padding: 0.8rem 0.9rem;
  margin-bottom: 0.75rem;
  border: 3px solid var(--text);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  letter-spacing: 0.04em;
}
#barcode-input:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 2px;
}

.form-error {
  min-height: 1.4em;
  color: #7a1020;
  font-weight: 700;
  margin: 0 0 0.75rem;
}

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

/* Results */
.product-name {
  font-size: 2rem;
  margin: 0.5rem 0 0.25rem;
  line-height: 1.25;
}
.product-code, .results-source {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 1.05rem;
}
.summary-line {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  background: #fff;
  border: 3px solid var(--text);
  border-radius: var(--radius);
  font-weight: 700;
}

.ingredient {
  display: block;
  margin: 0 0 1rem;
  padding: 1rem 1rem 1.05rem;
  border-radius: var(--radius);
  border: 3px solid currentColor;
}
.ingredient-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.grade-icon { flex: 0 0 36px; }
.grade-word {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.ingredient-name {
  margin: 0.15rem 0 0.35rem;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.3;
}
.ingredient-catalog,
.ingredient-swap,
.ingredient-note,
.check-package {
  margin: 0.35rem 0 0;
  font-size: 1.05rem;
}
.check-package { font-weight: 700; }
.ingredient-swap { font-weight: 600; }

.grade-enjoy   { background: var(--enjoy-bg);   color: var(--enjoy-text); }
.grade-limit   { background: var(--limit-bg);   color: var(--limit-text); }
.grade-avoid   { background: var(--avoid-bg);   color: var(--avoid-text); }
.grade-unknown { background: var(--unknown-bg); color: var(--unknown-text); }
.grade-neutral { background: var(--neutral-bg); color: var(--neutral-text); }

.ocr-words {
  margin: 1.25rem 0;
  padding: 0.75rem 1rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  font-size: 1.05rem;
}
.ocr-words summary {
  cursor: pointer;
  font-weight: 700;
}
.speak-status {
  min-height: 1.3em;
  margin: 0.25rem 0 0.75rem;
  color: var(--muted);
}

.foot {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 2.5rem;
  border-top: 2px solid var(--line);
  color: var(--muted);
  font-size: 1.05rem; /* still above 20px at 22px root? 1.05*22 ≈ 23px */
}
.foot p { margin: 0 0 0.6rem; }

@media (min-width: 700px) {
  .btn { max-width: 28rem; }
}

.ingredient-flag, .positive-flag {
  margin: 0.4rem 0 0;
  font-weight: 700;
  color: var(--enjoy-text);
}
.positive-flag {
  margin: 0 0 1rem;
}

/* Member login and past scans */
.auth-bar {
  margin: 0.75rem 0 0;
}
.auth-status {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-weight: 600;
}
.notice {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--limit-bg);
  color: var(--limit-text);
  border: 3px solid var(--limit-text);
  border-radius: var(--radius);
  font-weight: 700;
}
.btn-danger {
  background: var(--avoid-bg);
  color: var(--avoid-text);
  border-color: var(--avoid-text);
}
.btn-danger:hover { background: #f8d0d5; }

#callback-home.btn {
  display: block;
  text-decoration: none;
}

.history-row {
  margin: 0 0 1.25rem;
  padding: 1rem 1rem 0.5rem;
  background: #fff;
  border: 3px solid var(--text);
  border-radius: var(--radius);
}
.history-product {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
  line-height: 1.3;
}
.history-date,
.history-counts {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 1.1rem;
}
.history-counts {
  font-weight: 700;
  color: var(--text);
}
.history-row .btn { margin-top: 0.5rem; }

/* Traffic-light ratings (Spark production v1).
   Phone widths: 96px icon + real ENJOY/LIMIT/AVOID text.
   700px and up (iPad): same 96px icon + larger real text (lockup not shown).
   The rating sits on cream so the navy word and lockup meet contrast rules. */
.rating-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 0 0 0.7rem;
  padding: 0.7rem 0.8rem;
  background: var(--cream);
  color: var(--navy);
  border-radius: 10px;
}
.rating-lockup { display: none; }
.rating-icon {
  display: block;
  flex: 0 0 48px;
  margin: 0;
  line-height: 0;
}
.rating-icon img {
  display: block;
  width: 48px;
  height: 96px;
}
.rating-word {
  margin: 0;
  font-family: "Montserrat", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-weight: 800;
  font-size: 2rem; /* 44px at 22px root */
  letter-spacing: 0.06em;
  color: var(--navy);
  line-height: 1.1;
}

@media (min-width: 700px) {
  /* Joan's decision (23 Nov 2026): iPad uses the same icon-only light with
     big real text as phones, just larger text. The lockup stays hidden. */
  .rating-head { gap: 1.1rem; padding: 0.9rem 1rem; }
  .rating-word { font-size: 2.6rem; }
}
