/* Olzha's compact browsing layout. Search and offer data stay in app.js. */
:root {
  --color-background: #faf8f5;
  --color-muted: #f5f1eb;
  --color-border: #ece6de;
  --color-accent: #c94308;
  --color-on-accent: #fff;
  --footer-safe: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px), var(--tg-content-safe-area-inset-bottom, 0px));
  --nav-height: 68px;
  --shadow-card: 0 2px 8px rgb(46 30 17 / 4%);
}

body { padding-bottom: calc(var(--nav-height) + var(--footer-safe) + 32px); }
button, input { font-size: inherit; }
.top { padding: calc(20px + var(--header-safe)) 20px 4px; }
.top h1 { font-size: 36px; letter-spacing: -.06em; text-shadow: none; }
#notifications-btn { width: 44px; height: 44px; border-width: 1px; background: var(--color-card); }
.hero { margin: 12px 16px 24px; padding: 24px 20px 20px; border-radius: 24px; overflow: visible; }
.hero-shapes { border-radius: inherit; }
.hero-copy { overflow: hidden; }
.hero.is-compact { padding: 6px; }
.hero.is-compact .hero-shapes { opacity: .65; }
.hero.is-compact .search-stack { margin: 0; padding: 12px; }
.search-stack[hidden], .search-heading[hidden], .address-summary[hidden] { display: none; }
.search-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 700; }
.search-close { min-height: 44px; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.address-summary {
  position: relative; z-index: 1;
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px;
  border: 0; border-radius: 18px; background: var(--color-card); color: var(--color-foreground);
  text-align: left; font: inherit; cursor: pointer;
}
.address-summary > svg { flex: 0 0 auto; color: var(--color-accent); }
.address-summary-copy { flex: 1; min-width: 0; display: grid; gap: 2px; }
.address-eyebrow { font-size: 11px; color: var(--color-muted-foreground); }
.address-summary .place { margin: 0; font-size: 14px; font-weight: 700; line-height: 20px; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.address-edit { flex: 0 0 auto; color: var(--color-accent); font-size: 12px; font-weight: 700; }
.search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.search-field { width: 100%; min-width: 0; padding-left: 12px; }
.search > .btn-accent { width: auto; min-width: 68px; padding: 12px; background: #fff7ed; color: #943009; }
.search-field input { font-size: 16px; color: #1c1410; }
.hero .suggest-list { --color-foreground: #1c1410; }
.search-field:focus-within { transform: none; }
.geo-inline { flex: 0 0 44px; min-width: 44px; min-height: 44px; }
.geo-inline-label { display: none; }
.suggest-list { z-index: 12; }
.city-list { z-index: 14; }
.hero .address-help { color: inherit; }
.recents { max-height: 88px; overflow-y: auto; }
.recent-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.controls { position: static; gap: 10px; margin-bottom: 16px; padding: 0 16px; background: transparent; }
.controls-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.section-eyebrow { margin: 0 0 3px; color: var(--color-muted-foreground); font-size: 11px; }
.controls-heading h2 { margin: 0; font: 800 22px/1.25 var(--font-display); letter-spacing: -.7px; }
.controls-heading > div { min-width: 0; }
.controls-heading .toolbar-btn { flex: 0 0 auto; min-height: 44px; padding: 8px 10px; gap: 6px; border-width: 1px; border-radius: 12px; font-size: 12px; }
.controls-heading .toolbar-hint { display: none; }
.controls-heading .toolbar-copy { flex: 0 0 auto; }
.toolbar-btn[data-active="true"] { background: var(--color-card); border-color: var(--color-accent); color: var(--color-accent); box-shadow: none; }
.toolbar-btn[data-active="true"] .count-badge { background: var(--color-accent); color: #fff; }
.quick-foods { gap: 6px; min-height: 44px; align-items: center; padding: 2px; margin-inline: -2px; }
.quick-foods .chip { min-height: 40px; padding: 8px 12px; font-size: 13px; border-width: 1px; }
#budget-chips .chip { min-height: 36px; padding: 7px 11px; font-size: 12px; }
.quick-foods .chip[aria-pressed="true"] { background: var(--color-foreground); color: var(--color-background); border-color: var(--color-foreground); }
.budget-note { margin: 0; font-size: 11px; }
.pills { gap: 6px; }
.pills .pill { min-height: 36px; padding: 6px 10px; font-size: 12px; }
.party-choices { flex-wrap: wrap; overflow: visible; }
.filter-sheet-body { gap: 24px; }
.filter-section h3 { font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--color-foreground); }
.filter-sheet-foot { flex: 0 0 auto; background: var(--color-card); }
.filter-sheet .sheet-head { flex: 0 0 auto; padding-bottom: 12px; }

.feed { padding-inline: 16px; }
#feed-more[hidden] { display: none; }
.status { margin: 0 0 6px; min-height: 2.8em; font-size: 13px; }
.source-progress { margin-bottom: 16px; min-height: 28px; gap: 8px; }
.source-state { display: inline-flex; align-items: center; gap: 5px; padding: 4px 0; border: 0; border-radius: 0; background: transparent; font-size: 11px; }
.source-state + .source-state { padding-left: 8px; border-left: 1px solid var(--color-border); }
.source-state::before { content: ""; width: 5px; height: 5px; flex: 0 0 auto; border-radius: 50%; background: #64856a; }
.source-loading::before { background: var(--color-primary); }
.source-error::before, .source-partial::before, .source-unavailable::before { background: #a8a29e; }

.bottom-nav {
  position: fixed; inset: auto 0 0; z-index: 5; width: min(100%, 560px); margin-inline: auto;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: center;
  min-height: calc(var(--nav-height) + var(--footer-safe)); padding: 6px 12px calc(6px + var(--footer-safe));
  border: 1px solid var(--color-border); border-bottom: 0; border-radius: 24px 24px 0 0;
  background: var(--color-card); box-shadow: 0 -4px 24px rgb(46 30 17 / 5%);
}
.nav-item {
  position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px;
  min-height: 54px; padding: 6px; border: 0; border-radius: 14px; background: transparent;
  color: var(--color-muted-foreground); font: 600 11px/1.25 var(--font-body); cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
}
.nav-item[aria-current="page"] { background: var(--color-muted); color: var(--color-accent); }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; top: 4px; width: 16px; height: 2px; border-radius: 2px; background: currentColor; }
.nav-icon { position: relative; display: flex; }
.nav-icon .count-badge { position: absolute; left: 15px; top: -6px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 9px; line-height: 16px; background: var(--color-accent); color: #fff; }
.count-badge[hidden] { display: none; }
.new-deals-btn { bottom: calc(var(--nav-height) + var(--footer-safe) + 12px); }
.is-keyboard-open .bottom-nav, .is-keyboard-open .new-deals-btn { display: none; }
.address-summary:focus-visible, .search-close:focus-visible, .nav-item:focus-visible { outline: 3px solid var(--color-ring); outline-offset: 2px; }

/* Photos reserve their space before loading; streamed updates keep card nodes. */
.grid { grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: stretch; }
.deal, .skeleton-card {
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr;
  min-width: 0; min-height: 0; border: 1px solid var(--color-border); border-radius: 18px;
  background: var(--color-card); box-shadow: var(--shadow-card);
}
.deal { transition: border-color 180ms ease, box-shadow 180ms ease; }
.deal::after { display: none; }
.deal:active { transform: none; }
.deal-photo, .skeleton-photo { min-height: 0; height: auto; aspect-ratio: 4 / 3; }
.deal-photo { background: var(--color-muted); }
.deal-photo img { transition: transform 400ms var(--ease-out); }
.deal-photo .badge { left: 8px; bottom: 8px; padding: 4px 8px; font-size: 11px; box-shadow: none; background: #fff7ed; color: #943009; }
.fav-btn { width: 44px; height: 44px; top: 4px; right: 4px; color: #fff; background: rgb(25 23 20 / 55%); }
.fav-btn svg { width: 18px; height: 18px; fill: transparent; stroke: currentColor; stroke-width: 1.75; }
.fav-btn svg path { fill: none; }
.fav-btn[aria-pressed="true"] { background: #fff; box-shadow: 0 1px 6px #00000012; }
.fav-btn[aria-pressed="true"] svg { fill: currentColor; stroke-width: 0; }
.fav-btn[aria-pressed="true"] svg path { fill: currentColor; }
.deal-open { position: absolute; inset: 0; z-index: 1; width: 100%; border: 0; padding: 0; border-radius: inherit; background: transparent; cursor: pointer; }
.deal-open:focus-visible { outline: 3px solid var(--color-ring); outline-offset: -3px; }
.deal-body { padding: 12px; gap: 6px; justify-content: flex-start; }
.deal-venue { min-height: 18px; font-size: 12px; font-weight: 600; line-height: 18px; }
.deal-source { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 20px; }
.deal-source .platform-badge { padding: 3px 6px; font-size: 10px; line-height: 14px; }
.deal-distance { min-width: 0; color: var(--color-muted-foreground); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal-title { height: 40px; font: 700 14px/20px var(--font-body); overflow-wrap: anywhere; }
.deal-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 6px; min-height: 46px; margin: 2px 0 0; line-height: 1.2; }
.price-current { font: 800 21px/1.25 var(--font-display); letter-spacing: -.7px; overflow-wrap: anywhere; }
.deal-price .price-old { margin: 0; color: var(--color-muted-foreground); font-size: 12px; font-weight: 400; white-space: nowrap; }
.deal-price.is-promo { font-size: 14px; line-height: 20px; font-weight: 700; color: var(--color-accent); }
.deal-price.is-promo .price-current { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font: inherit; letter-spacing: 0; }
.price-note { margin: 0; font-size: 11px; line-height: 15px; }
.deal-conditions { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 11px; line-height: 15px; color: var(--color-accent); }
.deal-facts { flex-wrap: wrap; gap: 3px 6px; margin: 0; overflow: visible; }
.deal-fact { padding: 0; border-radius: 0; background: transparent; color: var(--color-muted-foreground); font-size: 11px; font-weight: 400; line-height: 16px; white-space: normal; }
.deal-fact.is-free { background: transparent; color: #247047; }
.deal-fact.is-recent { background: transparent; color: var(--color-accent); }
.deal.is-closed .deal-fact { background: transparent; color: var(--color-destructive); }
.offer-freshness { margin-top: auto; padding-top: 4px; height: 19px; -webkit-line-clamp: 1; color: var(--color-muted-foreground); font-size: 10px; line-height: 15px; }
.deal.is-closed, .deal.is-soon { opacity: 1; }
.deal.is-closed .deal-photo img { filter: saturate(.65); }
.skeleton-body { min-height: 216px; padding: 16px 12px; }
.skeleton-chips { margin-top: auto; }
.skeleton-chips span { max-width: 40%; }
.empty { grid-column: 1 / -1; padding: 32px 20px; }
.soon { margin-top: 28px; }
.soon-title { font-size: 18px; }

/* The order action comes before supporting tools, with no empty comparison. */
.sheet { max-height: calc(100dvh - 16px - var(--header-safe)); border-radius: 24px 24px 0 0; }
.offer-sheet { width: min(100%, 520px); }
.offer-sheet .sheet-head { position: sticky; top: 0; z-index: 3; align-items: center; padding: 8px 12px; background: var(--color-card); }
.offer-sheet .icon-btn { border-width: 1px; }
.offer-sheet .sheet-image { height: auto; aspect-ratio: 16 / 10; max-height: 300px; }
.offer-sheet .sheet-image.is-logo { padding: 32px; }
.offer-sheet .sheet-image[hidden] { display: none; }
.offer-sheet .sheet-body { padding: 20px 20px calc(24px + var(--footer-safe)); gap: 12px; }
.sheet-venue { color: var(--color-muted-foreground); font-size: 13px; }
.sheet-body h2 { font-size: 25px; line-height: 1.25; letter-spacing: -.7px; }
.sheet-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; margin: 4px 0 0; }
.sheet-price .price-current { font-size: 30px; }
.sheet-price .price-old { font-size: 16px; font-weight: 400; color: var(--color-muted-foreground); white-space: nowrap; }
.sheet-price .badge { margin: 0; align-self: center; }
#sheet-total { margin: 0; font-size: 12px; }
.sheet-conditions { margin: 0; color: var(--color-accent); font-size: 13px; font-weight: 600; }
.sheet-conditions[hidden] { display: none; }
.sheet-actions { gap: 8px; margin: 4px 0 8px; }
.sheet-actions > .btn-accent { min-height: 52px; padding: 14px; border-radius: 14px; font-size: 15px; text-align: center; }
.sheet-actions > .btn-accent[hidden] { display: none; }
.sheet-secondary-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet-secondary-actions > .btn-ghost { flex: 1 1 auto; min-height: 44px; padding: 10px 12px; border: 1px solid var(--color-border); background: transparent; border-radius: 12px; font-size: 12px; }
.sheet-information { display: grid; gap: 10px; padding-top: 16px; border-top: 1px solid var(--color-border); }
.sheet-information p { margin: 0; }
.sheet-desc { font-size: 14px; line-height: 1.6; }
.sheet-meta { font-size: 13px; line-height: 1.6; }
.sheet-freshness { font-size: 11px; }
.history-toggle { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--color-border); background: var(--color-muted); color: var(--color-foreground); border-radius: 14px; font-size: 13px; }
.history-toggle::after { content: "+"; color: var(--color-accent); font-size: 20px; line-height: 1; }
.history-toggle[aria-expanded="true"]::after { content: "−"; }
.offer-comparisons { padding-top: 20px; margin: 8px 0 0; border-top: 1px solid var(--color-border); }
.offer-comparisons h3, .similar-section h3 { font-family: var(--font-display); font-size: 16px; }
.similar-section { margin-top: 8px; }
.similar-card { flex-basis: 156px; }
.offer-report { margin-top: 8px; }

@media (min-width: 360px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
  .grid { gap: 16px; }
  .deal-body { padding: 16px; }
  .deal-title { font-size: 16px; line-height: 22px; height: 44px; }
  .price-current { font-size: 24px; }
}
@media (min-width: 1024px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (hover: hover) {
  .deal:hover { box-shadow: 0 4px 16px rgb(46 30 17 / 7%); border-color: color-mix(in srgb, var(--color-primary) 35%, var(--color-border)); }
  .deal:hover .deal-photo img { transform: scale(1.025); }
  .btn-accent:hover, .toolbar-btn:hover { transform: none; box-shadow: 0 3px 10px rgb(46 30 17 / 8%); }
  .nav-item:hover { background: var(--color-muted); }
}
/* Batch updates change content, never animate the reading position. */
.quick-foods, .quick-foods .chip, .pills .pill, .recent-chip,
.sheet.is-open .sheet-image, .sheet.is-open #sheet-title, .sheet.is-open #sheet-price,
.sheet.is-open #sheet-meta, .sheet.is-open .sheet-actions, .sheet.is-open .sheet-grip,
.sheet.is-open .filter-section, .sheet.is-open .switch-row, .sheet.is-open .filter-sheet-foot { animation: none; }
@media (prefers-reduced-motion: no-preference) {
  .deal { animation: card-reveal 180ms ease-out; }
  .quick-foods .chip.is-pop { animation: chip-select 240ms var(--ease-out); }
  .fav-btn.is-pop { animation: heart-pop 360ms var(--ease-out); }
  .nav-item svg { transition: transform 150ms var(--ease-out); }
  .nav-item:active svg { transform: scale(.92); }
  .source-loading::before { animation: pulse-soft 1.6s ease-in-out infinite; }
}

@media (max-width: 359px) {
  .search { grid-template-columns: minmax(0, 1fr); }
  .search > .btn-accent { width: 100%; }
  .address-summary { gap: 8px; padding: 10px; }
  .address-edit { font-size: 11px; }
  .controls-heading h2 { font-size: 20px; }
}
@media (min-width: 768px) {
  .top { padding-inline: 24px; }
  .hero, .controls, .feed { margin-inline: 24px; }
  .controls, .feed { padding-inline: 0; }
  .hero { padding: 28px; }
  .hero.is-compact { padding: 8px; }
  .hero.is-compact .search-stack { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 12px; }
  .hero.is-compact .search-heading, .hero.is-compact .recents, .hero.is-compact .address-help { grid-column: 1 / -1; }
  .hero.is-compact .search-stack[hidden] { display: none; }
  .address-summary .place { font-size: 16px; }
  .geo-inline-label { display: inline; }
  .geo-inline { flex-basis: auto; }
}
body.tg-dark { --color-accent: #ffb180; --color-on-accent: #24150e; --shadow-card: none; }
body.tg-dark .btn-accent { background: #ffb180; color: #24150e; }
body.tg-dark .hero .search > .btn-accent { background: #fff7ed; color: #943009; }
body.tg-dark .toolbar-btn[data-active="true"] { background: var(--color-card); color: var(--color-accent); border-color: var(--color-accent); }
body.tg-dark .toolbar-btn[data-active="true"] .count-badge { background: var(--color-accent); color: #24150e; }
body.tg-dark .deal-fact.is-free { color: #8cd5ac; }
