/* Dewycart app: the same look as dewycart.com. A soft cream page, serif headings, pill buttons (berry only for the main action),
   white tool cards, and the torn receipt for the cheapest cart. Colours and type follow docs/brand/. Phone first, then wider screens.
   Always light. Colours are set once here. */
:root {
  --bg: #FBF7F6;            /* cream */
  --surface: #ffffff;
  --ink: #4A2A33;           /* berry: all text, the main button */
  --ink-2: #5A3540;         /* berry, hovered */
  --muted: #6B4651;
  --line: rgba(74, 42, 51, .14);
  --line-strong: rgba(74, 42, 51, .26);
  --tint: #fdf1f4;
  /* One job per colour:
     berry = text, the main button, the receipt total · petal = hero plate, notices, selected choices
     rose = a step deeper than petal · rose-deep = focus ring, bars · mint = the cheapest cart only */
  --petal: #F6DDE1;
  --rose: #F0C8D0;
  --rose-deep: #D98C9A;
  --mint: #DDEFDF;
  --mint-ink: #35684F;
  --perf: rgba(74, 42, 51, .38);
  --radius: 18px;
  --sans: "Libre Franklin", "Helvetica Neue", Arial, sans-serif;
  --serif: "Dewycart Serif", Georgia, "Times New Roman", serif;
  color-scheme: light;
}

/* Fonts: self-hosted (nothing is loaded from another company's server). Licences: fonts/FONT-LICENSES.txt */
@font-face { font-family: "Libre Franklin"; src: url("fonts/LibreFranklin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Dewycart Serif"; src: url("fonts/DewycartSerif.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--rose-deep) var(--bg); }
body { margin: 0; background: linear-gradient(var(--petal) 0, var(--petal) 300px, var(--bg) 520px) no-repeat var(--bg); color: var(--ink); font: 400 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
::selection { background: var(--rose-deep); color: var(--ink); }
a { color: var(--ink); text-decoration-color: var(--rose-deep); text-underline-offset: .2em; text-decoration-thickness: .07em; }
a:hover { text-decoration-color: var(--ink); }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -.02em; text-wrap: balance; }
h1 { font-size: 1.9rem; line-height: 1.1; margin: 0 0 .5rem; }
h2 { font-size: 1.3rem; line-height: 1.2; margin: 2.25rem 0 .85rem; }
h3, .order-name { font-size: 1.12rem; line-height: 1.25; margin: 0 0 .35rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small, small { font-size: .86rem; color: var(--muted); }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* --- demo mode: suggested searches, and what to show when a real product name finds nothing -------- */
.demo-ideas { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: .8rem 0 0; }
.demo-ideas span { font-size: .88rem; color: var(--muted); font-weight: 600; margin-right: .2rem; }
.demo-empty { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin: 1rem 0; }
.demo-empty-title { margin: 0 0 .2rem; font-family: var(--serif); font-size: 1.25rem; }
.demo-more { margin-top: .6rem; }
.demo-more .list { margin: .6rem 0 0; }
.demo-more .card:last-child { margin-bottom: 0; }

/* --- demo banner: shown only in demo mode --------------------------------------------- */
.demo-banner { color: var(--ink); text-align: center; font-size: .9rem; padding: .55rem 16px; border-bottom: 1px solid var(--line); }
.demo-banner b { font-weight: 700; }
.demo-banner .demo-try { display: block; margin-top: .2rem; color: var(--muted); font-size: .86rem; }

/* --- header ------------------------------------------------------------------------- */
.top { position: relative; z-index: 10; border-bottom: 1px solid var(--line); }
.top-inner { max-width: 920px; margin: 0 auto; padding: .5rem 16px; min-height: 68px; display: flex; align-items: center; justify-content: space-between; }
.top-right { display: flex; align-items: center; gap: 1.5rem; }
.toplink { font-size: .95rem; font-weight: 500; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.toplink:hover { text-decoration: underline; text-decoration-color: var(--rose-deep); }
@media (max-width: 639px) { .toplink { display: none; } }
.brand { display: inline-flex; align-items: center; min-height: 44px; }
.brand-logo { height: 30px; width: auto; display: block; }

.cart-area { position: relative; }
.cart-button {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: .35rem .5rem .35rem .95rem; border-radius: 999px;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; transition: background-color .15s;
}
.cart-button:hover, .cart-button[aria-expanded="true"] { background: var(--surface); }
.badge {
  min-width: 1.6rem; height: 1.6rem; padding: 0 .4rem; border-radius: 999px; background: var(--ink); color: var(--bg);
  font-size: .82rem; font-weight: 700; display: inline-grid; place-items: center;
}
.badge.empty { background: var(--petal); color: var(--muted); }
.badge.bump { animation: bump .4s ease; }
@keyframes bump { 40% { transform: scale(1.3); } 70% { transform: scale(.94); } }

/* Cart preview: opens on hover (computer) or tap (phone). */
.mini-cart {
  position: absolute; right: 0; top: calc(100% + 10px); width: min(340px, calc(100vw - 32px));
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--radius); padding: 1rem 1rem 1.1rem;
  animation: pop .16s ease-out; transform-origin: top right;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
/* An invisible bridge across the gap, so moving the mouse from the icon to the panel doesn't close it. */
.mini-cart::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px; }
.mini-title { margin: 0 0 .4rem; font-family: var(--serif); font-weight: 500; font-size: 1.15rem; }
.mini-items { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.mini-items li { display: flex; gap: .5rem; align-items: flex-start; padding: .55rem 0; border-top: 1px solid var(--line); }
.mini-items .what { flex: 1; min-width: 0; font-size: .9rem; line-height: 1.35; }
.mini-items .what b { display: block; font-size: .8rem; color: var(--muted); font-weight: 600; }
.remove-x { flex: none; width: 44px; height: 44px; margin: -7px -7px -7px 0; border-radius: 999px; border: 0; background: transparent; color: var(--ink); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.remove-x:hover, .remove-x:focus-visible { background: var(--petal); }
.mini-empty { margin: .25rem 0 .5rem; color: var(--muted); }
.mini-actions { display: flex; gap: .5rem; margin-top: .8rem; }
.mini-actions .btn { flex: 1; }

/* --- buttons and inputs: soft pills, berry only for the main action -------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem; min-height: 46px; padding: .5rem 1.4rem; border-radius: 999px;
  border: 1.5px solid var(--ink); background: var(--ink); color: var(--bg); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  white-space: nowrap; transition: background-color .15s, transform .1s;
}
.btn:hover { background: var(--ink-2); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--surface); }
.btn.soft { background: var(--petal); color: var(--ink); border-color: transparent; }
.btn.soft:hover { background: var(--rose); }
.btn.small { position: relative; min-height: 38px; padding: .2rem 1rem; font-size: .9rem; }
.btn.small::after, .pill::after, .stepper button::after { content: ""; position: absolute; inset: -4px -3px; }
.btn.added, .btn.added:hover { background: var(--mint); color: var(--mint-ink); border-color: var(--mint); cursor: default; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.big { width: 100%; min-height: 54px; font-size: 1.05rem; }
:focus-visible { outline: 3px solid var(--rose-deep); outline-offset: 3px; }

main { max-width: 920px; margin: 0 auto; padding: 1.25rem 16px 2.5rem; }

.search { position: relative; display: flex; gap: .5rem; padding: .35rem; background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 999px; }
.search:focus-within { border-color: var(--ink); }
.search-icon { position: absolute; left: 1.05rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input {
  flex: 1; min-width: 0; min-height: 46px; padding: .4rem .5rem .4rem 2.6rem; border: 0; background: transparent; color: var(--ink); outline: none;
  font: inherit; font-size: 16px; /* 16px stops phones zooming in */
}
.search input::placeholder { color: #8a7580; }

/* --- home hero: the pink plate ------------------------------------------------------- */
.welcome { margin: .5rem 0 1.1rem; }
.welcome h1 { font-size: 1.9rem; line-height: 1.1; margin: 0 0 .5rem; }
.welcome .hero-text { color: var(--ink); font-size: 1rem; max-width: 34rem; margin: 0; text-wrap: balance; }
.glow { margin: 1.1rem 0 1.25rem; }
.steps { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1.3rem; margin: 0; padding: 0; }
.steps li { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; font-size: .92rem; font-weight: 500; color: var(--ink); }
.steps span { width: 1.6rem; height: 1.6rem; border-radius: 999px; display: inline-grid; place-items: center; background: #fff; color: var(--ink); font-size: .78rem; font-weight: 700; }
.hero-mascot { display: none; }

/* --- lists and cards: white tool cards ------------------------------------------------ */
.list { list-style: none; margin: 1rem 0; padding: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.05rem 1.2rem; margin-bottom: .7rem; }
.product { display: flex; gap: .85rem; align-items: center; }
.product:hover { border-color: var(--line-strong); }
.product .what { flex: 1; min-width: 0; }
.thumb { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; font-size: .95rem; color: var(--ink); background: var(--petal); }
.thumb.t2 { background: var(--mint); color: var(--mint-ink); }
.brand-line { font-size: .84rem; color: var(--muted); font-weight: 600; }
.name-line { font-weight: 500; line-height: 1.35; }
.chip { display: inline-block; padding: .08rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 600; background: var(--petal); color: var(--ink); margin-left: .3rem; vertical-align: 1px; }
.opt { color: var(--muted); font-weight: 400; white-space: nowrap; }
.chip.good { background: var(--mint); color: var(--mint-ink); }
.chip.best { background: var(--mint); color: var(--mint-ink); }
.chip.warn { background: var(--rose); color: var(--ink); }
.more { margin: 1.75rem 0; text-align: center; }
.more p { margin: 0 0 .4rem; }
.more .small { margin-top: .5rem; }
.notice { background: var(--petal); color: var(--ink); border-radius: 18px; padding: .9rem 1.1rem; margin: 1rem 0; font-weight: 400; }
.notice b { font-weight: 700; }
.notice .btn { margin-top: .5rem; }
.error { background: var(--rose); border-radius: 18px; padding: .9rem 1.1rem; margin: 1rem 0; }
.page-title { margin-top: .5rem; }

.empty-state { text-align: center; padding: 2rem 1rem; }
.empty-state .mascot { width: 64px; height: 72px; color: var(--rose-deep); }
.empty-state p { color: var(--muted); }

.cart-actions { display: grid; gap: .6rem; margin-top: 1.1rem; }
.link-button { background: none; border: 0; padding: .4rem; min-height: 44px; display: inline-flex; align-items: center; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; }

/* --- loading: the receipt glyph, calmly ------------------------------------------------ */
.progress { text-align: center; padding: 3rem 1rem; }
.progress .mascot { width: 56px; height: 63px; color: var(--rose-deep); animation: breathe 1.6s ease-in-out infinite; }
.progress p { font-weight: 600; margin: .75rem 0 .25rem; }
.progress .small { font-weight: 400; max-width: 28rem; margin: 0 auto; }
@keyframes breathe { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .mascot, .badge.bump, .mini-cart, .btn, .compare-bar { animation: none !important; transition: none !important; } }

/* --- results ----------------------------------------------------------------------------- */
.results-head { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: baseline; justify-content: space-between; margin-top: .5rem; }

/* The cheapest cart is a receipt: white paper with torn top and bottom, dotted lines, a berry total. It sits on a pink plate. */
.plate { background: var(--petal); border-radius: 28px; padding: clamp(16px, 3vw, 32px); margin-top: 1rem; }
.card.best {
  --tooth: 18px; position: relative; margin: 0; border: 0; border-radius: 0; padding: 2.1rem 1.35rem 2.2rem; background: var(--surface);
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / var(--tooth) 51% repeat-x,
                conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / var(--tooth) 51% repeat-x;
          mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / var(--tooth) 51% repeat-x,
                conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / var(--tooth) 51% repeat-x;
}
.card.best .total { font: 700 2.4rem/1.1 var(--sans); letter-spacing: -.03em; color: var(--ink); margin: .35rem 0; font-variant-numeric: tabular-nums; }
.label { display: inline-block; font-size: .8rem; font-weight: 700; color: var(--ink); background: var(--mint); padding: .2rem .65rem; border-radius: 3px; }
.order { border-top: 3px dotted var(--perf); padding-top: .8rem; margin-top: .9rem; }
.order-head { display: flex; justify-content: space-between; gap: .5rem; align-items: center; flex-wrap: wrap; }
.order ul { margin: .35rem 0; padding-left: 1.15rem; font-size: .93rem; }
.sums { font-size: .93rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.sums .line { display: flex; align-items: baseline; gap: .4rem; padding: .12rem 0; }
.sums .leader { flex: 1; min-width: 1rem; border-bottom: 2px dotted var(--perf); transform: translateY(-.2em); }
.sums .val { font-weight: 600; text-align: right; }
.free { color: var(--mint-ink); font-weight: 700; }
.sums-line { text-wrap: balance; font-size: .9rem; font-weight: 500; color: var(--ink); }

.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table td { padding: .7rem .25rem; border-top: 1px solid var(--line); vertical-align: top; }
.table tr:first-child td { border-top: 0; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .num b { font-size: 1.1rem; font-weight: 700; }
.table td > a { display: inline-flex; align-items: center; min-height: 44px; font-size: .88rem; font-weight: 600; }

.price-row { display: flex; gap: .5rem; padding: .6rem 0; border-top: 1px solid var(--line); align-items: flex-start; }
.card > .price-row:first-child, .card > h3 + .price-row { border-top: 0; }
.price-row .shop { flex: 1; min-width: 0; font-weight: 600; }
.price-row .amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.05rem; }
.price-row .sub { font-size: .82rem; color: var(--muted); font-weight: 400; }
.price-row .sub a { font-weight: 600; }
.out { color: var(--muted) !important; font-weight: 500 !important; font-size: .9rem !important; }
.ext::after { content: " ↗"; }
.aff { font-size: .78rem; color: var(--muted); margin-left: .3rem; font-weight: 600; }

details.notes { margin-top: 1.5rem; }
details.notes summary { cursor: pointer; color: var(--muted); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.notes ul, ul.notes { padding-left: 1.15rem; color: var(--muted); font-size: .9rem; }

.foot { max-width: 920px; margin: 0 auto; padding: 1.5rem 16px 2.5rem; color: var(--muted); font-size: .86rem; border-top: 1px solid var(--line); text-align: left; }
.foot p { margin: .25rem 0; }
.foot a { display: inline-block; padding: .75rem 0; }

@media (min-width: 640px) {
  h1 { font-size: 2.2rem; }
  .welcome { text-align: center; margin-top: 1.25rem; }
  .welcome h1 { font-size: 2.6rem; }
  .welcome .hero-text { margin: 0 auto 1.4rem; font-size: 1.05rem; }
  .glow { text-align: center; }
  .steps, .demo-ideas { justify-content: center; }
  .cart-actions { grid-template-columns: auto 1fr; align-items: center; }
  .cart-actions .btn.big { width: auto; justify-self: end; padding: 0 2.25rem; }
}
@media (max-width: 380px) {
  .cart-label { display: none; }
  .product .thumb { display: none; }
}

/* --- home: trust lines ------------------------------------------------------------------ */
.trust { list-style: none; display: grid; gap: .6rem; margin: 1.5rem 0 0; padding: 0; }
.trust li { display: block; line-height: 1.4; border-top: 1.5px solid var(--ink); padding: .85rem 0 .2rem; }
.trust b { display: none; }
.trust strong { display: block; font-family: var(--serif); font-size: 1.1rem; font-weight: 500; }
.trust span { display: block; margin-top: .1rem; color: var(--muted); font-size: .88rem; text-wrap: pretty; }
@media (min-width: 720px) { .trust { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; } }

/* The winner in a list: each item's best price. Mint is for the cheapest only. */
.price-row.best-row { background: var(--mint); border-top-color: transparent; border-radius: 12px; margin: .2rem -.65rem; padding: .65rem; }
.price-row.best-row + .price-row { border-top-color: transparent; }

/* "Are you sure?" box */
dialog.ask { width: min(340px, calc(100vw - 32px)); padding: 1.25rem 1.25rem 1.1rem; border: 1.5px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-align: center; }
dialog.ask::backdrop { background: rgba(74, 42, 51, .3); }
.ask-title { font-family: var(--serif); font-weight: 500; font-size: 1.25rem; margin: 0 0 .25rem; }
.ask form > .small { margin: 0 0 1rem; }
.ask-actions { display: flex; gap: .5rem; }
.ask-actions .btn { flex: 1; }

/* Stock */
.stock-note { margin: .1rem 0 0; }
.left-out { margin: .6rem 0 .2rem; padding: .55rem .75rem; border-radius: 12px; background: var(--petal); color: var(--ink); font-size: .88rem; }
.price-row.sold .amount { color: var(--muted); text-decoration: line-through; font-weight: 500; }

/* Quantity: "– 2 +" */
.stepper { flex: none; display: inline-flex; align-items: stretch; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; }
.stepper button { position: relative; width: 38px; height: 36px; border: 0; border-radius: 0; background: transparent; color: var(--ink); font: inherit; font-size: 1.05rem; font-weight: 600; line-height: 1; cursor: pointer; }
.stepper button:hover:not(:disabled) { background: var(--tint); }
.stepper button:disabled { opacity: .35; cursor: default; }
.stepper button:first-child { border-radius: 999px 0 0 999px; }
.stepper button:last-child { border-radius: 0 999px 999px 0; }
.stepper .qty { min-width: 1.9rem; font-size: .95rem; display: grid; place-items: center; font-weight: 700; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.mini-qty { margin-top: .35rem; }
.mini-qty .stepper button { width: 36px; height: 34px; font-size: 1rem; }
.mini-qty .stepper button::after { inset: -5px -3px; }
.product .link-button { padding: .2rem 0 0; font-size: .85rem; }

/* Size and shade choices on a search result: selected is tinted pink, never solid berry */
.product-card { display: block; }
.product-card .product { display: flex; gap: .85rem; align-items: center; }
.choices { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .65rem; }
.choices-label { font-size: .86rem; color: var(--muted); font-weight: 600; margin-right: .2rem; }
.pill { position: relative; min-height: 36px; padding: .2rem .9rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: .88rem; font-weight: 500; cursor: pointer; }
.pill:hover { border-color: var(--rose-deep); }
.pill.on { background: var(--petal); border-color: var(--rose-deep); }
.pill.na { color: var(--muted); border-style: dashed; font-weight: 400; }
.pill.more-pill { border-color: var(--rose-deep); color: var(--ink); }

/* "How it works" */
.how .lead { color: var(--ink); font-size: 1.1rem; max-width: 38rem; margin: 0 0 .5rem; }
.how-steps { list-style: none; padding: 0; margin: 1.25rem 0; display: grid; gap: 1rem; }
.how-steps li { display: flex; gap: .85rem; align-items: flex-start; }
.how-steps > li > span { width: 2rem; height: 2rem; border-radius: 999px; background: var(--petal); color: var(--ink); flex: none; display: grid; place-items: center; font-weight: 700; }
.how-steps h2 { margin: 0 0 .15rem; font-size: 1.15rem; }
.how-steps p { margin: 0; color: var(--muted); }
.how-card h2 { margin: 0 0 .5rem; font-size: 1.15rem; }
.how-card ul { margin: 0; padding-left: 1.15rem; }
.how-card li { margin: .4rem 0; }
.how-card p { margin: .3rem 0; }
.how-cta { margin-top: 1.5rem; text-align: center; }
.how-cta .btn { width: auto; padding: 0 2.5rem; }

/* --- wide screens: use the space. Phones are unchanged. ------------------------------------ */
@media (min-width: 900px) {
  .top-inner, main, .foot { max-width: 1120px; }
  main { padding-top: 1.75rem; }

  .search { max-width: 760px; margin-left: auto; margin-right: auto; }
  .trust { margin-top: 1.25rem; }

  /* Search results: two columns of cards that pack together (cards are different heights, so a plain grid would leave gaps). */
  #search-results .list { display: block; column-count: 2; column-gap: .9rem; margin-top: 1.5rem; }
  #search-results .list > li.card { margin: 0 0 .9rem; break-inside: avoid; }

  /* Cart: the list on the left, a summary with the Compare button on the right. */
  #cart-list { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 0 2rem; align-items: start; }
  #cart-list > .empty-state { grid-column: 1 / -1; }
  #cart-list > .list { grid-column: 1; margin-top: 0; }
  #cart-list > .cart-actions { grid-column: 2; grid-row: 1; position: sticky; top: 5.5rem; grid-template-columns: 1fr; margin-top: 0; }
  #cart-list > .cart-actions .btn.big { order: -1; width: 100%; justify-self: stretch; padding: 0 1rem; }

  /* Results: the cheapest way across the top (shops side by side), then one-shop totals on the left and the per-item prices on the right. */
  .card.best { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); column-gap: 2.5rem; align-items: start; padding: 2.4rem 1.75rem; }
  .card.best > * { grid-column: 1; justify-self: start; }
  .card.best > .orders { grid-column: 2; grid-row: 1 / span 4; justify-self: stretch; margin-top: -.8rem; }
  .card.best .total { font-size: 3rem; }
  .orders { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 2rem; }
  .results-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 5fr); gap: 0 2rem; align-items: start; }
  .col-a { position: sticky; top: 5.5rem; }

  .how { max-width: 760px; margin-left: auto; margin-right: auto; }
}

/* "How it works" link under the three steps */
.hero-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: .6rem; font-size: .95rem; font-weight: 600; color: var(--ink); text-decoration: underline; text-decoration-color: var(--ink); text-underline-offset: .2em; }

/* "Spend $X more here for free shipping" */
.nudge { margin-top: .35rem; font-size: .86rem; font-weight: 600; color: var(--mint-ink); }
/* The header already links to "How it works" on bigger screens, so the hero link is for phones only. */
@media (min-width: 640px) { .hero-link { display: none; } }

/* --- Compare bar: a floating pink bar (the Compare button is the berry main action) at the bottom of the search page once the cart has something in it --- */
.compare-bar {
  position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  width: min(560px, calc(100% - 24px)); box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .45rem .45rem .45rem 1.3rem; border-radius: 999px; background: var(--rose); color: var(--ink); font-weight: 600;
  box-shadow: 0 8px 24px rgba(74, 42, 51, .2);
}
.compare-bar[hidden] { display: none; }
/* The one small moment of motion: the bar rises into place (and is still when animation is switched off). */
.compare-bar:not([hidden]) { animation: rise .3s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 18px); } }
.compare-bar .btn { min-height: 44px; }
.has-bar { padding-bottom: 5.5rem; }
.sub .link-button.ext, .shop .link-button.ext { padding: .2rem 0; min-height: 44px; margin: -8px 0; font-size: inherit; color: var(--ink); font-weight: 600; }

/* Small touch details: no double-tap-to-zoom delay on controls, and the tap flash uses the brand pink. */
a, button, summary, input, select { touch-action: manipulation; }
html { -webkit-tap-highlight-color: rgba(217, 140, 154, .25); }

/* "Check each store" (while Dewycart isn't reading any store): one card per store, a link per item. */
.store-links ul { list-style: none; margin: 0; padding: 0; }
.store-links li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .45rem 0; border-top: 1px solid var(--line); font-size: .93rem; }
.store-links li:first-child { border-top: 0; }
.store-links .what { flex: 1; min-width: 0; }
.store-links a.ext { flex: none; display: inline-flex; align-items: center; min-height: 44px; margin: -6px 0; font-weight: 600; color: var(--ink); }
.store-grid { display: block; }
.store-grid > .card { break-inside: avoid; margin: 0 0 .9rem; }
@media (min-width: 720px) { .store-grid { column-count: 2; column-gap: .9rem; } }

/* A way back on every page that has no search bar: cart, comparison, how it works, privacy. */
.backbar { display: flex; flex-wrap: wrap; gap: 0 1.25rem; margin: -.5rem 0 .25rem; }
.back { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; color: var(--ink); text-decoration: none; }
.back:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Pink at the top of every page; shorter than on the home screen, so the pink receipt frame below it still stands out. */
body[data-view]:not([data-view="search"]) { background: linear-gradient(var(--petal) 0, var(--petal) 110px, var(--bg) 300px) no-repeat var(--bg); }
