/* ───────────────────────────── AllerTrip ───────────────────────────── */

:root {
  --bg: #f5faf3;
  --bg-soft: #ecf3e6;
  --ink: #1d2b23;
  --ink-soft: #5a6e60;
  --line: #dde9d8;
  --accent: #22a05c;        /* fresh green */
  --accent-dark: #15824a;
  --accent-soft: #e4f5ea;
  --alert: #e6493f;         /* card warning red — kept for safety recognition */
  --alert-dark: #c43830;
  --alert-soft: #fdeae8;
  --teal: #0f766e;
  --teal-soft: #e3f4f2;
  --card-radius: 22px;
  --shadow-lg: 0 24px 60px -18px rgba(29, 43, 35, 0.26);
  --shadow-sm: 0 4px 14px -4px rgba(29, 43, 35, 0.12);
  --font-display: "Sora", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 500px at 85% -100px, #ddf2df 0%, transparent 60%),
    radial-gradient(900px 420px at -10% 0px, #eef7dc 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button { -webkit-tap-highlight-color: transparent; }

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

/* ── Hero ─────────────────────────────────────────────── */

.hero {
  padding: clamp(28px, 6vw, 64px) 22px 10px;
  max-width: 720px;
  margin: 0 auto;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px 8px 12px;
  box-shadow: var(--shadow-sm);
}

.logo-mark { font-size: 1.15rem; }

.logo svg { width: 22px; height: 22px; display: block; }

.acard-footer .brand { display: inline-flex; align-items: center; gap: 5px; }

.acard-footer .brand svg { width: 13px; height: 13px; display: block; }

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 8vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 22px 0 14px;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero-sub {
  color: var(--ink-soft);
  font-size: clamp(1rem, 2.6vw, 1.12rem);
  max-width: 46ch;
  margin: 0 0 18px;
}

.trust-strip {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0 0 8px;
}

.trust-strip li {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
  box-shadow: var(--shadow-sm);
}

/* ── Steps ────────────────────────────────────────────── */

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 18px 40px;
}

.step { margin-top: 36px; }

.step-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.step-num {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  border-radius: 12px;
  margin-top: 2px;
}

.step-head h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin: 0;
  letter-spacing: -0.01em;
}

.step-head p {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

/* ── Allergen chips & language tiles ──────────────────── */

.chip-grid,
.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.chip,
.lang {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
  text-align: left;
}

.chip { font-weight: 600; font-size: 0.93rem; }

.chip:active, .lang:active { transform: scale(0.97); }

.chip .chip-emoji { font-size: 1.35rem; }

.chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 6px 18px -6px rgba(34, 160, 92, 0.45);
}

.chip[aria-pressed="true"]::after {
  content: "✓";
  margin-left: auto;
  font-weight: 800;
  color: var(--accent);
}

.chip--extra[aria-pressed="true"]::after { content: "✕"; font-size: 0.85em; }

.lang { padding: 11px 14px; }

.lang .flag { font-size: 1.4rem; }

.lang .lang-names { display: flex; flex-direction: column; line-height: 1.25; }

.lang .native { font-weight: 700; font-size: 0.92rem; }

.lang .english { color: var(--ink-soft); font-size: 0.78rem; }

.lang[aria-pressed="true"] {
  border-color: var(--teal);
  background: var(--teal-soft);
  box-shadow: 0 6px 18px -6px rgba(15, 118, 110, 0.4);
}

.lang[aria-pressed="true"]::after {
  content: "✓";
  margin-left: auto;
  font-weight: 800;
  color: var(--teal);
}

/* ── Search (shared by allergy + language search) ─────── */

.search-wrap { position: relative; margin-top: 14px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px 3px 17px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(34, 160, 92, 0.13);
}

.search-wrap--lang .search-box:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.search-icon { color: var(--ink-soft); display: grid; place-items: center; }

.search-box input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  border: none;
  padding: 11px 10px 11px 0;
}

.search-box input::placeholder { color: #a8a193; }

.search-box input:focus { outline: none; }

.search-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  padding: 6px;
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
}

.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 13px;
  background: transparent;
  border: none;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease;
}

.search-item:hover { background: var(--bg-soft); }

.search-item .s-emoji { font-size: 1.2rem; }

.search-item .s-sub { font-weight: 500; color: var(--ink-soft); font-size: 0.8rem; }

.search-item .s-hint {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

.search-item.s-added .s-hint { color: var(--teal); }

.search-item--custom { color: var(--accent-dark); }

.search-empty {
  padding: 13px 15px;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

/* ── Card stage ───────────────────────────────────────── */

.card-single {
  max-width: 430px;
  margin: 0 auto;
}

/* ── The card itself (shared by preview + export) ─────── */

.acard {
  width: 100%;
  border-radius: var(--card-radius);
  background: #ffffff;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.acard-band {
  background: linear-gradient(120deg, var(--alert) 0%, var(--alert-dark) 100%);
  color: #fff;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.acard-band .warn {
  font-size: 1.5rem;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}

.acard-band .titles { line-height: 1.2; }

.acard-band .t-local {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.12rem;
  letter-spacing: 0.01em;
}

.acard-band .t-en {
  font-size: 0.72rem;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.acard-body {
  padding: 20px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.acard-emojis { font-size: 2rem; letter-spacing: 6px; }

.acard .severe {
  font-weight: 600;
  font-size: 1.02rem;
}

.acard .allergen-names {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.45rem, 5.4vw, 1.7rem);
  line-height: 1.25;
  color: var(--alert-dark);
  letter-spacing: -0.01em;
}

.acard .request { font-size: 0.97rem; }

.acard .thanks {
  color: var(--teal);
  font-weight: 600;
  font-size: 0.95rem;
}

/* divider strip between the message and the hidden-sources section */
.acard-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-soft);
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  padding: 11px 22px;
}

.acard-divider .d-icon { font-size: 1.1rem; }

.acard-divider .d-local {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.3;
}

.acard-divider .d-en {
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  margin-top: 1px;
}

.acard-body--groups { gap: 16px; }

.acard-footer {
  margin-top: auto;
  border-top: 1px dashed var(--line);
  padding: 12px 22px 16px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.45;
  display: flex;
  gap: 14px;
  align-items: flex-end;
  justify-content: space-between;
}

.acard-footer .en-label {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.62rem;
  font-weight: 700;
  color: #b0a795;
  margin-bottom: 3px;
}

.acard-footer .foot-note {
  display: block;
  margin-top: 5px;
  font-size: 0.7rem;
  color: #b0a795;
}

.acard-footer .brand {
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.68rem;
  color: #b0a795;
  white-space: nowrap;
}

/* back face specifics */

.acard .group { margin-top: 2px; }

.acard .group-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--alert-dark);
  margin-bottom: 8px;
}

.acard .group-name .gn-en {
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.mini-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin: 8px 0 6px;
}

.mini-label--local { color: var(--alert-dark); }

.ing-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.ing {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 6px 11px;
  line-height: 1.3;
}

.ing .local {
  display: block;
  font-weight: 600;
  font-size: 0.86rem;
}

.ing .en {
  display: block;
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.ing--regional {
  background: var(--alert-soft);
  border-color: #f3c8c3;
}

.ing--generic { border-style: dashed; }

/* RTL languages (Arabic, Hebrew) */
.acard [dir="rtl"] { text-align: right; }

/* empty state */
.acard-empty {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 60px 30px;
  color: var(--ink-soft);
  flex: 1;
}

.acard-empty .big { font-size: 2.4rem; margin-bottom: 10px; }

/* ── Actions / download ───────────────────────────────── */

.actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: 14px;
  padding: 13px 24px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(120deg, #27b066 0%, var(--accent-dark) 100%);
  color: #fff;
  box-shadow: 0 10px 26px -8px rgba(21, 130, 74, 0.55);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn .btn-sub { font-weight: 500; opacity: 0.8; font-size: 0.88em; }

.btn.is-busy { pointer-events: none; opacity: 0.7; }

.wallet-note {
  margin-top: 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  font-size: 0.88rem;
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
}

.wallet-note strong { color: var(--ink); display: block; margin-bottom: 2px; }

.wallet-badge { font-size: 1.3rem; line-height: 1; }

/* ── Footer / toast / export ──────────────────────────── */

footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 22px 56px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  max-width: 88vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* offscreen export stage: fixed width so PNGs are consistent */
#export-stage {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 480px;
  pointer-events: none;
}

.export-wrap {
  background: var(--bg);
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.export-wrap .export-brand {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: #b0a795;
}

/* ── Larger screens ───────────────────────────────────── */

@media (min-width: 700px) {
  .chip-grid, .lang-grid { grid-template-columns: repeat(3, 1fr); }
  .step-head h2 { font-size: 1.45rem; }
}
