/* =====================================================================
   OrderStraight Stage 2.6a — Uber-parity polish on Stage 2.5 base.
   Brand tokens come from inline <style> in index.php (--os-* vars).
   Visual diffs vs Stage 2.5:
     * Promo overlay = red pill (white text) with stack support.
     * "All" cuisine tile = green-bag SVG variant.
     * Cuisine strip right-edge fade gradient (overflow affordance).
     * Filter pills: keep solid-navy active state.
     * NEW results bar ("N results · Reset").
   ===================================================================== */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
svg:not([width]):not([height]) { width: 1em; height: 1em; vertical-align: -0.15em; }
svg { display: inline-block; flex-shrink: 0; }
body {
  margin: 0;
  background: var(--os-bg);
  color: var(--os-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Tajawal', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-size: 16px; line-height: 1.5;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 72px);
}
@media (min-width: 900px) { body { padding-bottom: 0; } }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

.no-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--os-primary); color: #fff;
  padding: 10px 16px; border-radius: 0 0 8px 0; font-weight: 600; z-index: 1000;
}
.skip-link:focus { left: 0; }

/* ======================== TOP BAR ======================== */
.os-topbar {
  background: var(--os-primary); color: #fff;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 12px rgba(15,27,48,0.18);
}
.os-topbar img.os-logo { height: 36px; width: auto; }
.os-topbar .spacer { flex: 1; }

.os-location {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.12);
  padding: 8px 12px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
  cursor: pointer; transition: background .15s ease;
}
.os-location:hover { background: rgba(255,255,255,0.20); }
.os-location svg { width: 16px; height: 16px; }

.os-icon-btn {
  width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.10); color: #fff;
  border-radius: 50%; border: 1px solid rgba(255,255,255,0.16);
  cursor: pointer; transition: background .15s ease;
}
.os-icon-btn:hover { background: rgba(255,255,255,0.20); }
.os-icon-btn svg { width: 18px; height: 18px; }

.os-account {
  background: var(--os-accent); color: #fff;
  padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 700;
  border: 0; cursor: pointer; transition: background .15s ease; font-family: inherit;
}
.os-account:hover { background: var(--os-accent-d); }
.os-account.subtle { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18); }
.os-account.subtle:hover { background: rgba(255,255,255,0.22); }
.lang-switch {
  background: transparent; color: #fff;
  border: 1px solid rgba(255,255,255,0.24);
  padding: 6px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.lang-switch:hover { background: rgba(255,255,255,0.10); }

/* ======================== SEARCH HERO ======================== */
.os-search-hero {
  background: linear-gradient(180deg, var(--os-primary) 0%, var(--os-primary-d) 100%);
  padding: 22px 16px 36px;
}
.os-search-hero .wrap { max-width: 720px; margin: 0 auto; position: relative; }
/* 2.7: chunkier search input — Uber-Eats parity (taller, larger type, thicker shadow). */
.os-search-hero input {
  width: 100%; padding: 18px 22px 18px 56px;
  border-radius: 999px; border: 0; outline: 0;
  font-size: 17px; font-weight: 500; font-family: inherit;
  background: #fff; color: var(--os-text);
  box-shadow: 0 10px 28px rgba(0,0,0,0.22);
}
.os-search-hero input::placeholder { color: #6b7384; font-weight: 500; }
.os-search-hero .icon {
  position: absolute; left: 22px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; color: var(--os-muted); pointer-events: none;
}
[dir="rtl"] .os-search-hero input { padding: 18px 56px 18px 22px; }
[dir="rtl"] .os-search-hero .icon { left: auto; right: 22px; }
.os-search-hero input:focus-visible {
  box-shadow: 0 8px 24px rgba(0,0,0,0.18), 0 0 0 3px var(--os-accent);
}

/* ======================== CUISINE ROW ======================== */
.os-cuisine-row {
  max-width: 1280px; margin: -14px auto 0; padding: 0 16px;
  position: relative; z-index: 5;
}
/* Right-edge fade hints at horizontal scroll on mobile/tablet. */
.os-cuisine-row::after {
  content: ""; position: absolute; top: 14px; bottom: 8px; right: 0;
  width: 36px; pointer-events: none;
  background: linear-gradient(to right, transparent, var(--os-bg) 88%);
}
[dir="rtl"] .os-cuisine-row::after {
  right: auto; left: 0;
  background: linear-gradient(to left, transparent, var(--os-bg) 88%);
}
@media (min-width: 1280px) { .os-cuisine-row::after { display: none; } }

.os-cuisine-strip {
  display: flex; gap: 14px; overflow-x: auto; padding: 14px 4px 8px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.os-cuisine-tile {
  flex: 0 0 auto; width: 84px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; background: transparent; border: 0; padding: 4px 0;
  font-family: inherit; scroll-snap-align: start;
}
.os-cuisine-tile .icon {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; line-height: 1;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--tile-color, #1C2A44) 18%, #fff) 0%,
    color-mix(in srgb, var(--tile-color, #1C2A44) 32%, #fff) 100%);
  border: 2px solid transparent;
  box-shadow: 0 4px 12px rgba(28,42,68,0.10);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
/* "All" tile — Uber-style white circle with navy ring + 🛍️ emoji.
   Works mobile + desktop (emoji scales with font-size, ring scales with radius). */
.os-cuisine-tile .icon.all-icon {
  background: #fff;
  font-size: 30px;
  line-height: 1;
  box-shadow: inset 0 0 0 2px #1C2A44, 0 4px 12px rgba(28,42,68,0.10);
}
.os-cuisine-tile[aria-pressed="true"] .icon.all-icon {
  background: #fff;
  box-shadow: inset 0 0 0 2.5px #1C2A44, 0 4px 12px rgba(28,42,68,0.12);
}
@media (max-width: 599px) {
  .os-cuisine-tile .icon.all-icon { font-size: 26px; }
}
/* Other tiles when selected → flatten to white card, ring stays. */
.os-cuisine-tile[aria-pressed="true"] .icon:not(.all-icon) { background: #fff; }
.os-cuisine-tile .label {
  font-size: 12.5px; font-weight: 600; color: var(--os-text);
  text-align: center; line-height: 1.2;
}
.os-cuisine-tile[aria-pressed="true"] .label { color: var(--os-primary); }

/* ======================== FILTER PILLS ======================== */
.os-filter-pills {
  max-width: 1280px; margin: 4px auto 0; padding: 8px 16px 0;
  display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto;
}
.os-pill {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; color: var(--os-text);
  border: 1px solid var(--os-line); border-radius: 999px;
  padding: 8px 14px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: all .12s ease;
}
.os-pill:hover { background: #f3f0ea; }
.os-pill[aria-pressed="true"] {
  background: var(--os-primary); color: #fff; border-color: var(--os-primary);
  box-shadow: 0 2px 8px rgba(15,27,48,0.18);
}
.os-pill svg { width: 14px; height: 14px; }

/* ======================== RESULTS BAR ======================== */
.os-results-bar {
  max-width: 1280px; margin: 6px auto 0; padding: 6px 16px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 13.5px; color: var(--os-muted);
}
.os-results-bar .count { font-weight: 700; color: var(--os-text); }
.os-results-bar .reset-btn {
  background: #fff; color: var(--os-text);
  border: 1px solid var(--os-line); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: background .12s ease, border-color .12s ease;
}
.os-results-bar .reset-btn:hover { background: #f3f0ea; border-color: #ccc4b3; }

/* ======================== RAILS ======================== */
.os-section { max-width: 1280px; margin: 28px auto 0; padding: 0 16px; }
.os-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.os-section-head h2 {
  font-size: clamp(20px, 2.4vw, 24px);
  font-weight: 800; letter-spacing: -.4px; color: var(--os-text);
  margin: 0;
}
.os-section-head a.see-all {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: #f3f0ea; color: var(--os-text);
  transition: background .15s ease;
}
.os-section-head a.see-all:hover { background: #e6e0d4; }
.os-section-head a.see-all svg { width: 18px; height: 18px; }

.os-rail {
  display: flex; gap: 16px; overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px 4px 16px;
  -webkit-overflow-scrolling: touch;
}
.os-rail .os-card { flex: 0 0 78%; max-width: 360px; scroll-snap-align: start; }
@media (min-width: 600px) { .os-rail .os-card { flex: 0 0 46%; } }
@media (min-width: 920px) { .os-rail .os-card { flex: 0 0 31%; max-width: 380px; } }
@media (min-width: 1200px){ .os-rail .os-card { flex: 0 0 24%; max-width: 320px; } }

/* ======================== GRID ======================== */
.os-grid-section { margin-top: 16px; }
/* 2.7: 2-column grid on mobile (Uber-Eats parity). Was 1fr full-width. */
.os-grid {
  max-width: 1280px; margin: 8px auto 32px; padding: 0 12px;
  display: grid; gap: 12px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 600px)  { .os-grid { gap: 16px; padding: 0 16px; grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 920px)  { .os-grid { gap: 18px; grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .os-grid { grid-template-columns: repeat(4, 1fr); } }
/* Tighter typography for narrow mobile cards. */
@media (max-width: 599px) {
  .os-card .body { padding: 8px 4px 6px; }
  .os-card .name { font-size: 14px; line-height: 1.25; }
  .os-card .meta-row { font-size: 11.5px; gap: 4px; }
  .os-card .rating-row { font-size: 11.5px; }
  .os-card .promo-overlay { font-size: 10.5px; padding: 3px 7px; }
  .os-card .fav-btn { width: 30px; height: 30px; }
  .os-card .fav-btn svg { width: 15px; height: 15px; }
  .os-search-hero { padding: 14px 14px 22px; }
}

/* ======================== CARD ======================== */
.os-card {
  background: var(--os-surface);
  border-radius: 16px;
  overflow: hidden; position: relative;
  display: flex; flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease;
}
.os-card:hover { transform: translateY(-2px); }

.os-card .hero {
  position: relative; aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--card-color, #1C2A44) 0%, color-mix(in srgb, var(--card-color, #1C2A44) 70%, #000) 100%);
  overflow: hidden; border-radius: 14px;
}
@media (min-width: 720px) { .os-card .hero { aspect-ratio: 16/10; } }
.os-card .hero img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .25s ease;
}
.os-card .hero img.loaded { opacity: 1; }
/* 2.7: replaces giant initial overlay with a clean SVG placeholder + small
   corner letter badge. Hidden once a real image actually loads (.has-img). */
.os-card .hero .placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.55);
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.10), transparent 60%);
  transition: opacity .2s ease;
}
.os-card .hero .placeholder-icon { width: 56px; height: 56px; opacity: 0.85; }
.os-card .hero .placeholder-letter {
  position: absolute; bottom: 10px;
  inset-inline-start: 12px;
  font-size: 13px; font-weight: 800; letter-spacing: 0.5px;
  color: #fff; background: rgba(0,0,0,0.35);
  padding: 3px 8px; border-radius: 999px;
  text-transform: uppercase;
}
.os-card .hero.has-img .placeholder { opacity: 0; pointer-events: none; }

/* PROMO STACK (top-left) — Uber-parity red pills, up to 2 + "+N more". */
.os-card .promo-stack {
  position: absolute; top: 10px; left: 10px;
  display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start;
  max-width: calc(100% - 60px);
}
[dir="rtl"] .os-card .promo-stack { left: auto; right: 10px; }
.os-card .promo-overlay {
  background: #d32f2f; color: #fff;
  padding: 5px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; line-height: 1.2;
  display: inline-flex; align-items: center; gap: 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,.22);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.os-card .promo-overlay.secondary {
  background: #fff; color: #d32f2f;
  border: 1px solid rgba(211,47,47,0.30);
}
.os-card .promo-overlay.extra {
  background: rgba(255,255,255,0.92); color: var(--os-text);
  font-weight: 700; padding: 4px 9px; font-size: 11px;
}
.os-card .promo-overlay svg { width: 12px; height: 12px; color: currentColor; flex-shrink: 0; }
.os-card .promo-overlay.secondary svg { color: #d32f2f; }

.os-card .fav-btn {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.92);
  display: flex; align-items: center; justify-content: center;
  border: 0; cursor: pointer; color: var(--os-text);
  box-shadow: 0 2px 8px rgba(0,0,0,.14);
  transition: background .15s ease, color .15s ease;
}
.os-card .fav-btn:hover { background: #fff; color: var(--os-accent); }
.os-card .fav-btn[aria-pressed="true"] { color: var(--os-accent); }
.os-card .fav-btn svg { width: 18px; height: 18px; fill: currentColor; }
[dir="rtl"] .os-card .fav-btn { right: auto; left: 10px; }

.os-card .body { padding: 12px 6px 8px; }
.os-card .name-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px;
}
.os-card .name {
  font-size: 16.5px; font-weight: 700; color: var(--os-text);
  margin: 0; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.os-card .meta-row {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 13px; color: var(--os-muted); margin-bottom: 2px;
}
.os-card .meta-row .dot { width: 3px; height: 3px; background: currentColor; border-radius: 50%; opacity: .6; }
.os-card .meta-row .fee {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--os-text); font-weight: 600;
}
.os-card .meta-row .fee .free { color: var(--os-success); font-weight: 700; }
.os-card .rank-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: #e8f3ec; color: #2e7d4e;
  padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700;
  margin-inline-start: 4px;
}
.os-card .rating-row {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 13px; color: var(--os-text); font-weight: 600; margin-top: 4px;
}
.os-card .rating-row .star { color: #f7b733; line-height: 1; }
.os-card .rating-row .count { color: var(--os-muted); font-weight: 500; }
.os-card .city-tag {
  font-size: 12px; color: var(--os-muted); margin-top: 2px;
}
.os-card .coming-soon-overlay {
  position: absolute; inset: 0; background: rgba(28,42,68,0.55);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; letter-spacing: .5px;
  border-radius: 14px; pointer-events: none;
}

.os-card a.click-target { color: inherit; display: block; }
.os-card a.click-target:focus-visible {
  outline: 3px solid var(--os-accent); outline-offset: 2px; border-radius: 16px;
}

/* ======================== EMPTY STATE ======================== */
.os-empty {
  text-align: center; padding: 48px 20px; color: var(--os-muted);
}
.os-empty .icon { font-size: 48px; margin-bottom: 8px; }
.os-empty h3 { color: var(--os-text); margin: 0 0 4px; font-size: 18px; }

/* ======================== BOTTOM TAB BAR (mobile only) ======================== */
.os-bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #fff; border-top: 1px solid var(--os-line);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  display: flex; justify-content: space-around; align-items: stretch;
  z-index: 60;
  box-shadow: 0 -4px 16px rgba(28,42,68,0.08);
}
.os-bottom-nav .item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 8px 4px;
  background: none; border: 0; color: var(--os-muted);
  font-family: inherit; font-size: 11px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  border-radius: 10px;
}
.os-bottom-nav .item svg { width: 22px; height: 22px; }
.os-bottom-nav .item.active { color: var(--os-text); }
.os-bottom-nav .item.search-fab svg { width: 26px; height: 26px; }
@media (min-width: 900px) { .os-bottom-nav { display: none; } }

/* ======================== FOOTER ======================== */
.os-footer {
  background: var(--os-primary); color: rgba(255,255,255,0.78);
  padding: 24px 20px; text-align: center; font-size: 13px;
  margin-top: 32px;
}
.os-footer a { color: #fff; text-decoration: underline; }
.os-footer .small { opacity: 0.6; margin-top: 4px; font-size: 11px; }
@media (max-width: 899px) { .os-footer { margin-bottom: 0; } }

/* ======================== UTIL ======================== */
.os-card[hidden], .os-rail[hidden], .os-section[hidden] { display: none !important; }
/* =====================================================================
   STAGE 2.9 — Native-app mobile polish (APPEND to bottom of directory.css).
   Goals: no iOS input zoom, no gray tap-flash, no overscroll bounce on
   bottom-nav, snug edges on every phone width 320–430px.
   ===================================================================== */

/* 1. Kill iOS Safari's auto-zoom when an input is focused (font must be ≥16px). */
.os-search-hero input,
input[type="text"],
input[type="search"],
input[type="tel"],
input[type="email"],
textarea,
select { font-size: 16px; }

/* 2. Remove the gray tap-highlight flash on every interactive element. */
* { -webkit-tap-highlight-color: transparent; }
button, a, .os-pill, .os-cuisine-tile, .os-card, .os-bottom-nav .item {
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
/* Hide page scrollbar — keep scroll working */
html { scrollbar-width: none; }                /* Firefox */
html::-webkit-scrollbar { display: none; }     /* Safari / Chrome */
body { -ms-overflow-style: none; }             /* old Edge */

/* 3. No rubber-band overscroll on the body — feels native. */
html, body { overscroll-behavior-y: none; }

/* 4. Bottom-nav: pin tighter on small phones, give icons safe-area padding. */
@media (max-width: 380px) {
  .os-bottom-nav .item { font-size: 10.5px; padding: 6px 2px; }
  .os-bottom-nav .item svg { width: 20px; height: 20px; }
  .os-cuisine-tile { width: 76px; }
  .os-cuisine-tile .icon { width: 60px; height: 60px; font-size: 28px; }
  .os-cuisine-tile .icon.all-icon { font-size: 24px; }
  .os-cuisine-tile .label { font-size: 11.5px; }
}

/* 5. Search hero — pull padding tight on the smallest phones. */
@media (max-width: 380px) {
  .os-search-hero { padding: 12px 12px 18px; }
  .os-search-hero input { padding: 14px 18px 14px 48px; font-size: 16px; }
  .os-search-hero .icon { left: 18px; width: 20px; height: 20px; }
  [dir="rtl"] .os-search-hero input { padding: 14px 48px 14px 18px; }
  [dir="rtl"] .os-search-hero .icon { left: auto; right: 18px; }
}

/* 6. Card grid — keep 2 columns even on 320px iPhone SE without overflow. */
@media (max-width: 360px) {
  .os-grid { gap: 10px; padding: 0 10px; }
  .os-card .body { padding: 8px 4px 8px; }
  .os-card .name { font-size: 13.5px; }
}

/* 7. Smooth scrolling momentum on every scrollable strip. */
.os-cuisine-strip,
.os-filter-pills,
.os-rail { scroll-behavior: smooth; }

/* 8. Hide ugly URL-bar shadow when running standalone (PWA installed). */
@media all and (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top, 0px); }
  .os-topbar { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
}

