/* Ambry — site styles. Tokens verbatim from the app's design system. */

:root {
  --bg: #F2F2F7;
  --surface: #FFFFFF;
  --surface-pressed: #E9E9EB;
  --border: #E5E5EA;
  --thumb-fill: #EFEFF1;
  --ink: #000000;
  --ink-soft: #3C3C43;
  --muted: #6D6D72;
  --accent: #1F7A35;
  --accent-fill: #34C759;
  --accent-contrast: #FFFFFF;
  --accent-tint-bg: #E4F7E9;
  --danger: #D70015;
  --danger-icon: #FF3B30;
  --warn-text: #C93400;
  --warning-icon: #FF9500;
  --warn-tint-bg: #FFF3E0;
  --info: #007AFF;
  --toast-bg: #1C1C1E;
  --search-bg: rgba(118, 118, 128, 0.12);

  /* CTA pairing: AA-safe in both schemes (accent-fill + white is 2.2:1, fails AA) */
  --btn-bg: #1F7A35;
  --btn-ink: #FFFFFF;

  /* category tints */
  --cat-produce-ink: #1F7A35;   --cat-produce-tint: #E4F7E9;
  --cat-dairy-ink: #2A63C9;     --cat-dairy-tint: #E7EFFB;
  --cat-meat-ink: #BC3A4C;      --cat-meat-tint: #FBE6E9;
  --cat-leftovers-ink: #525D6E; --cat-leftovers-tint: #EBEEF2;
  --cat-bev-ink: #1668A0;       --cat-bev-tint: #E1F0FA;

  /* tab hues */
  --tab-pantry: #1F7A35;
  --tab-lists: #1668A0;
  --tab-add: #B04517;
  --tab-recipes: #7A3FA8;
  --tab-profile: #525D6E;

  color-scheme: light dark;
}

/* Dark tokens apply when the OS is dark (and not manually overridden to light),
   or when the toggle forces dark. The two blocks below must stay identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --surface: #1C1C1E;
    --surface-pressed: #2C2C2E;
    --border: #38383A;
    --thumb-fill: #2C2C2E;
    --ink: #FFFFFF;
    --ink-soft: #EBEBF0;
    --muted: #98989E;
    --accent: #30D158;
    --accent-fill: #30D158;
    --accent-contrast: #FFFFFF;
    --accent-tint-bg: #1B3A24;
    --danger: #FF453A;
    --danger-icon: #FF453A;
    --warn-text: #FF9F0A;
    --warning-icon: #FF9F0A;
    --warn-tint-bg: #3A2A0F;
    --info: #0A84FF;
    --toast-bg: #F2F2F7;
    --search-bg: rgba(118, 118, 128, 0.24);

    --btn-bg: #30D158;
    --btn-ink: #08290F;

    --cat-produce-ink: #30D158;   --cat-produce-tint: #1B3A24;
    --cat-dairy-ink: #6BA6FF;     --cat-dairy-tint: #16294A;
    --cat-meat-ink: #FF7A8A;      --cat-meat-tint: #3A1A20;
    --cat-leftovers-ink: #A9B6C7; --cat-leftovers-tint: #262B33;
    --cat-bev-ink: #66BFF2;       --cat-bev-tint: #12293A;

    --tab-pantry: #30D158;
    --tab-lists: #66BFF2;
    --tab-add: #FF8F5E;
    --tab-recipes: #BE7CFF;
    --tab-profile: #A9B6C7;

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #1C1C1E;
  --surface-pressed: #2C2C2E;
  --border: #38383A;
  --thumb-fill: #2C2C2E;
  --ink: #FFFFFF;
  --ink-soft: #EBEBF0;
  --muted: #98989E;
  --accent: #30D158;
  --accent-fill: #30D158;
  --accent-contrast: #FFFFFF;
  --accent-tint-bg: #1B3A24;
  --danger: #FF453A;
  --danger-icon: #FF453A;
  --warn-text: #FF9F0A;
  --warning-icon: #FF9F0A;
  --warn-tint-bg: #3A2A0F;
  --info: #0A84FF;
  --toast-bg: #F2F2F7;
  --search-bg: rgba(118, 118, 128, 0.24);

  --btn-bg: #30D158;
  --btn-ink: #08290F;

  --cat-produce-ink: #30D158;   --cat-produce-tint: #1B3A24;
  --cat-dairy-ink: #6BA6FF;     --cat-dairy-tint: #16294A;
  --cat-meat-ink: #FF7A8A;      --cat-meat-tint: #3A1A20;
  --cat-leftovers-ink: #A9B6C7; --cat-leftovers-tint: #262B33;
  --cat-bev-ink: #66BFF2;       --cat-bev-tint: #12293A;

  --tab-pantry: #30D158;
  --tab-lists: #66BFF2;
  --tab-add: #FF8F5E;
  --tab-recipes: #BE7CFF;
  --tab-profile: #A9B6C7;

  color-scheme: dark;
}

:root[data-theme="light"] { color-scheme: light; }

/* ---------- base ---------- */

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

h1, h2, h3 { text-wrap: balance; margin: 0 0 0.4em; }
h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.4px; line-height: 1.15; }
h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.3px; }
h3 { font-size: 17px; font-weight: 600; }

p { margin: 0 0 1em; max-width: 65ch; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

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

.skip-link {
  position: absolute;
  left: 16px; top: -48px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  z-index: 20;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
}

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

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand img {
  width: 28px; height: 28px;
  border-radius: 22.37%;
}
.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}
.site-nav a {
  color: var(--ink-soft);
  font-size: 15px;
  padding: 12px 12px;
  border-radius: 10px;
}
.site-nav a:hover {
  background: var(--surface-pressed);
  text-decoration: none;
}
.theme-toggle {
  width: 44px;
  height: 44px;
  margin-left: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  border-radius: 10px;
  color: var(--ink-soft);
  cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-pressed); }
.theme-toggle svg { width: 20px; height: 20px; }

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 56px;
  padding: 28px 0 44px;
  color: var(--muted);
  font-size: 14px;
}
.site-footer .container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.site-footer img {
  width: 22px; height: 22px;
  border-radius: 22.37%;
  vertical-align: middle;
}
.site-footer a {
  color: var(--muted);
  display: inline-block;
  padding: 12px 6px;
  margin: -12px -6px;
}
.site-footer a:hover { color: var(--ink-soft); }

/* ---------- landing sections ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.section {
  margin-top: 24px;
}
.section-card {
  padding: 32px 28px;
}
@media (max-width: 600px) {
  .section-card { padding: 24px 20px; }
}

.section-kicker {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 6px;
}

/* hero */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 40px;
  align-items: center;
  padding: 56px 0 40px;
}
@media (max-width: 860px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 40px;
    gap: 32px;
  }
}

.hero-icon {
  width: 76px; height: 76px;
  border-radius: 22.37%;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  margin-bottom: 22px;
}
.hero h1 {
  font-size: clamp(38px, 5.4vw, 56px);
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}
.hero-sub {
  font-size: 19px;
  color: var(--ink-soft);
  max-width: 34ch;
  margin-bottom: 26px;
}
.hero-quiet {
  font-size: 14px;
  color: var(--muted);
  margin-top: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 26px;
  border-radius: 999px;
  border: 0;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(0.95); text-decoration: none; }
.btn:active { filter: brightness(0.88); }

.btn-secondary {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-pressed); filter: none; }

/* how it works */

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 760px) {
  .steps { grid-template-columns: minmax(0, 1fr); }
}
.step {
  padding: 22px 20px;
}
.step-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.step-icon svg { width: 20px; height: 20px; fill: #fff; }
.step-icon.tint-info { background: var(--info); }
.step-icon.tint-warn { background: var(--warning-icon); }
.step-icon.tint-accent { background: var(--accent-fill); }
.step h3 { margin-bottom: 6px; }
.step p { font-size: 15px; color: var(--ink-soft); margin: 0; }
.step .step-n {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  display: block;
  margin-bottom: 4px;
}

/* trust band */

.trust p { color: var(--ink-soft); }
.trust .trust-plain {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}

/* waitlist */

.waitlist-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.waitlist-form input[type="email"] {
  flex: 1 1 260px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
}
.waitlist-form input[type="email"]::placeholder { color: var(--muted); }
.waitlist-form input[type="email"]:focus-visible { outline-offset: 0; }

.waitlist-caption {
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
}
.waitlist-msg {
  font-size: 15px;
  margin-top: 12px;
}
.waitlist-msg.is-error { color: var(--danger); }
.waitlist-success {
  font-size: 17px;
  font-weight: 600;
  color: var(--accent);
  margin: 18px 0 0;
}
#turnstile-slot { margin-top: 4px; }

/* donate */

.donate h2 { font-size: 20px; }
.donate p { color: var(--ink-soft); font-size: 15px; }
.donate-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 12px; }
.donate .waitlist-caption { margin-top: 8px; }

/* ---------- article pages (privacy / support) ---------- */

.article {
  max-width: 68ch;
  margin: 0 auto;
  padding: 44px 0 12px;
}
.article h1 { margin-bottom: 10px; }
.article h2 { font-size: 22px; margin-top: 1.6em; }
.article h3 { margin-top: 1.4em; }
.article hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}
.article ul { padding-left: 22px; }
.article li { margin-bottom: 8px; max-width: 62ch; }
.article .effective { color: var(--muted); }

.table-scroll { overflow-x: auto; }
.article table {
  border-collapse: collapse;
  font-size: 15px;
  min-width: 560px;
}
.article th, .article td {
  text-align: left;
  vertical-align: top;
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--border);
}
.article th { font-weight: 600; }

.faq details {
  border-bottom: 1px solid var(--border);
  padding: 4px 0;
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  padding: 14px 0;
  list-style-position: outside;
}
.faq summary:hover { color: var(--accent); }
.faq details p { color: var(--ink-soft); margin: 0 0 16px; }

/* ---------- phone mock ---------- */

.hero-mock {
  justify-self: center;
  text-align: center;
}

.phone {
  width: min(300px, 82vw);
  border-radius: 46px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 9px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  margin: 0 auto;
  text-align: left;
}
.phone-screen {
  position: relative;
  border-radius: 38px;
  background: var(--bg);
  overflow: hidden;
  aspect-ratio: 9 / 19;
  display: flex;
  flex-direction: column;
}

.island {
  position: absolute;
  top: 9px; left: 50%;
  transform: translateX(-50%);
  width: 74px; height: 21px;
  border-radius: 999px;
  background: #000;
  z-index: 3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .island { background: #1C1C1E; border: 1px solid #38383A; }
}
:root[data-theme="dark"] .island { background: #1C1C1E; border: 1px solid #38383A; }

.statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px 2px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.statusbar svg { height: 10px; fill: var(--ink); display: block; }

.screens {
  position: relative;
  flex: 1;
  min-height: 0;
}
.screen {
  position: absolute;
  inset: 0;
  padding: 8px 14px 10px;
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}
.screen.is-active { opacity: 1; pointer-events: auto; }

.screen-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 2px 0 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.screen-title .chev { font-size: 11px; color: var(--muted); font-weight: 600; }

.mock-section-h {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 4px 2px 3px;
}

.mock-card {
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.mock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 500;
}
.mock-row + .mock-row { border-top: 1px solid var(--border); }
.mock-date {
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}
.mock-date.warn { color: var(--warn-text); font-weight: 600; }
.mock-date.late { color: var(--danger); font-weight: 600; }

.mock-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--search-bg);
  border-radius: 10px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 12px;
}
.mock-search svg { width: 11px; height: 11px; fill: var(--muted); flex: none; }

.mock-chip {
  font-size: 9px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
}
.chip-produce { background: var(--cat-produce-tint); color: var(--cat-produce-ink); }
.chip-dairy { background: var(--cat-dairy-tint); color: var(--cat-dairy-ink); }
.chip-meat { background: var(--cat-meat-tint); color: var(--cat-meat-ink); }

.mock-row .mock-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mock-btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: var(--accent-fill);
  color: var(--accent-contrast);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 9px 0;
  text-align: center;
}

.mock-card-pad { padding: 9px 10px; }
.mock-card-title { font-size: 12px; font-weight: 600; margin: 0 0 2px; }

.mock-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--accent-tint-bg);
  color: var(--accent);
  margin-bottom: 4px;
}
.mock-sub { font-size: 10.5px; color: var(--muted); }
.mock-sub.ok { color: var(--accent); font-weight: 600; }
.mock-link { font-size: 10.5px; font-weight: 600; color: var(--accent); }
.mock-dim { opacity: 0.55; }
.mock-note {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  margin: 2px 0 0;
}

.mock-stat {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}
.mock-bars { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.mock-bar { display: flex; align-items: center; gap: 7px; font-size: 9.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mock-bar .lbl { width: 24px; flex: none; }
.mock-bar .pct { width: 26px; flex: none; text-align: right; }
.mock-track { flex: 1; height: 6px; border-radius: 999px; background: var(--thumb-fill); overflow: hidden; }
.mock-fill { display: block; height: 100%; border-radius: 999px; background: var(--muted); }
.mock-fill.now { background: var(--accent-fill); }

.tabbar {
  flex: none;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.tabbar-tabs {
  display: flex;
  padding: 6px 6px 0;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: 0;
  font-family: inherit;
  font-size: 8.5px;
  font-weight: 500;
  color: var(--muted);
  padding: 3px 0;
  cursor: pointer;
}
.tab svg { width: 18px; height: 18px; fill: currentColor; }
.tab.is-active.tab-pantry { color: var(--tab-pantry); }
.tab.is-active.tab-add { color: var(--tab-add); }
.tab.is-active.tab-recipes { color: var(--tab-recipes); }
.tab.is-active.tab-profile { color: var(--tab-profile); }
.tab-lists { cursor: default; }
.home-indicator {
  height: 4px;
  width: 82px;
  border-radius: 999px;
  background: var(--ink);
  opacity: 0.28;
  margin: 6px auto 8px;
}

.mock-caption {
  font-size: 12px;
  color: var(--muted);
  margin-top: 14px;
}

/* ---------- 404 ---------- */

.empty-shelf {
  text-align: center;
  padding: 96px 0 40px;
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- print ---------- */

@media print {
  body { background: #fff; color: #000; }
  .site-header, .site-footer, .skip-link { display: none; }
  .article { max-width: none; padding-top: 0; }
  a { color: #000; text-decoration: underline; }
}
