/*
 * components/restaurant-detail.css
 *
 * What:  The single-restaurant page (views/partials/restaurant-detail.ejs).
 *        Three columns: a sticky category menu (left), the hero + info
 *        bar + per-category product sections (center), and the cart /
 *        delivery / restaurant-info rail (right).
 * Why:   Matches the supplied mockup. Responsive down to a single
 *        column on phones (left menu becomes a horizontal scroller, the
 *        right rail drops below).
 * Used:  Loaded globally via _layout; only renders on the restaurant
 *        view (order_mode-independent).
 */

.rd {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr) 324px;
    /* Left + right rails span all three center rows; the centre column
       reads hero → info → menu top-to-bottom. */
    grid-template-areas:
        "left hero    right"
        "left infobar right"
        "left main    right";
    column-gap: var(--space-6);
    row-gap: var(--space-5);
    align-items: start;
    max-width: 1520px; margin: 0 auto;
    padding: var(--space-5) var(--space-6) var(--space-10);
}
.rd-hero     { grid-area: hero; }
.rd-info-bar { grid-area: infobar; }
.rd__left    { grid-area: left; }
.rd__main    { grid-area: main; }
.rd__right   { grid-area: right; }

/* ── Left rail ─────────────────────────────────────────────────────── */
/* Pinned beside the menu; when the category list is taller than the
   viewport it scrolls on its own instead of running off the page. */
.rd__left {
    position: sticky; top: 88px;
    max-height: calc(100dvh - 104px);
    overflow-y: auto;
    /* Explicit overflow-x:hidden — otherwise setting only overflow-y
       makes the browser compute overflow-x to `auto`, which clips a
       long category name's count off the right edge. */
    overflow-x: hidden;
    scrollbar-width: thin;
}
.rd__left::-webkit-scrollbar { width: 6px; }
.rd__left::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
.rd__back {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--color-primary); font-weight: 700; text-decoration: none;
    margin-bottom: var(--space-4);
}
.rd__back:hover { text-decoration: underline; }
.rd-menu { display: flex; flex-direction: column; gap: 2px; }
.rd-menu__item {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px; border-radius: 10px;
    color: var(--color-text); text-decoration: none;
    font-weight: 600; font-size: 0.92rem;
}
.rd-menu__item:hover { background: var(--color-bg-alt); }
.rd-menu__item.is-active { background: var(--color-primary-soft); color: var(--color-primary); }
.rd-menu__icon { color: var(--color-primary); flex: 0 0 auto; }
/* Truncate long names so the count is never pushed off / clipped. */
.rd-menu__name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-menu__count { flex: 0 0 auto; margin-left: auto; padding-left: 6px; color: var(--color-text-soft); font-weight: 700; font-size: 0.82rem; }
.rd-menu__item.is-active .rd-menu__count { color: var(--color-primary); }

/* Count beside each section heading. */
.rd-section__count { color: var(--color-text-soft); font-weight: 600; font-size: 0.95rem; }

/* ── Hero ──────────────────────────────────────────────────────────── */
.rd-hero { margin: 0; }
.rd-hero__media {
    position: relative; border-radius: var(--radius-lg); overflow: hidden;
    aspect-ratio: 16 / 6; min-height: 220px;
    background: var(--color-bg-alt);
}
.rd-hero__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rd-hero__logo {
    position: absolute; left: var(--space-5); bottom: var(--space-5); z-index: 2;
    width: 92px; height: 92px; border-radius: 16px; background: #fff;
    display: grid; place-items: center; overflow: hidden; box-shadow: var(--shadow-2);
}
.rd-hero__logo img { width: 100%; height: 100%; object-fit: cover; }
.rd-hero__logo-initial { font-size: 2rem; font-weight: 800; color: var(--color-text); }
.rd-hero__overlay {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
    padding: var(--space-5) var(--space-5) var(--space-5) 148px;
    color: #fff;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.15) 70%, transparent);
}
.rd-hero__name { display: flex; align-items: center; gap: 8px; font-size: 1.9rem; font-weight: 800; margin: 0; }
.rd-hero__verified { color: #3b82f6; }
.rd-hero__meta { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 6px 0 0; }
.rd-hero__rating { display: inline-flex; align-items: center; gap: 4px; }
.rd-hero__rating-count { font-weight: 500; opacity: 0.9; }
.rd-hero__address { margin: 6px 0 0; font-size: 0.9rem; opacity: 0.92; }

/* Heart icon — top-right of the hero (login-only). */
.rd-hero__fav {
    position: absolute; top: 14px; right: 14px; z-index: 2;
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.95); border: 0; cursor: pointer;
    display: grid; place-items: center; color: var(--color-text-soft);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
    padding: 0; line-height: 0;
    transition: transform 120ms ease, color 120ms ease;
}
.rd-hero__fav:hover { color: var(--color-primary); transform: scale(1.06); }
.rd-hero__fav.is-active { color: var(--color-primary); }
.rd-hero__fav.is-active svg { fill: currentColor; stroke: currentColor; }
.rd-hero__fav:disabled { opacity: 0.6; cursor: progress; }
.rd-hero__fav.is-pulsing { animation: fav-pulse 360ms ease; }

/* ── Info bar ──────────────────────────────────────────────────────── */
.rd-info-bar {
    background: #fff; border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-lg); padding: var(--space-4); margin: 0;
}
.rd-tabs { display: flex; gap: var(--space-2); border-bottom: 1px solid var(--color-border-soft); margin-bottom: var(--space-4); }
.rd-tab {
    display: inline-flex; align-items: center; gap: 6px;
    background: none; border: 0; padding: 10px 14px; cursor: pointer;
    font-weight: 700; color: var(--color-text-soft); border-bottom: 2px solid transparent;
}
.rd-tab.is-active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.rd-info { display: flex; align-items: center; gap: var(--space-6); flex-wrap: wrap; }
.rd-info__cell { display: flex; flex-direction: column; gap: 2px; }
.rd-info__label { font-size: 0.78rem; color: var(--color-text-soft); }
.rd-info__value { font-weight: 600; }
.rd-info__value--strong { font-weight: 800; }
.rd-info__change { background: none; border: 0; padding: 0; color: var(--color-primary); font-weight: 700; cursor: pointer; font-size: 0.82rem; text-align: left; }
.rd-info__call { color: var(--color-primary); text-decoration: none; }
.rd-info__call:hover { text-decoration: underline; }
.rd-info__warn { color: var(--color-primary); font-weight: 700; align-self: center; }
.rd-map {
    margin-left: auto; position: relative; width: 220px; height: 96px;
    border-radius: var(--radius-md); overflow: hidden;
    background-color: #eef1f4;
    background-image:
        repeating-linear-gradient(0deg,  rgba(0,0,0,0.04) 0 1px, transparent 1px 20px),
        repeating-linear-gradient(90deg, rgba(0,0,0,0.04) 0 1px, transparent 1px 20px);
}
.rd-map__home { position: absolute; left: 16px; top: 18px; width: 26px; height: 26px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: var(--shadow-1); color: var(--color-text); }
.rd-map__pin { position: absolute; right: 20px; bottom: 22px; color: var(--color-primary); }
.rd-map__pill { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); background: #fff; border-radius: 999px; padding: 3px 8px; font-size: 0.72rem; font-weight: 700; box-shadow: var(--shadow-1); white-space: nowrap; }

/* ── Offers & deals strip ──────────────────────────────────────────── */
.rd-offers { margin: 0 0 var(--space-6); }
.rd-offers__title { font-size: 1.05rem; font-weight: 800; margin: 0 0 var(--space-3); }
.rd-offers__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-3); }
.rd-offer {
    display: flex; align-items: flex-start; gap: 10px;
    border: 1px dashed var(--color-primary); border-radius: 14px;
    background: var(--color-primary-soft); padding: var(--space-3) var(--space-4);
}
.rd-offer__icon { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px; background: #fff; color: var(--color-primary); display: grid; place-items: center; }
.rd-offer__body { flex: 1 1 auto; min-width: 0; }
.rd-offer__title { font-weight: 800; margin: 0; color: var(--color-text); }
.rd-offer__sub { font-size: 0.85rem; color: var(--color-text-soft); margin: 2px 0 0; }
.rd-offer__terms { font-size: 0.76rem; color: var(--color-text-soft); margin: 3px 0 0; font-style: italic; }
.rd-offer__code { display: inline-block; color: var(--color-primary); background: #fff; border: 1px dashed var(--color-primary); border-radius: 6px; padding: 0 6px; letter-spacing: 0.04em; }

/* ── Menu sections ─────────────────────────────────────────────────── */
.rd-section { margin-bottom: var(--space-8); scroll-margin-top: 96px; }
.rd-section__title { font-size: 1.12rem; font-weight: 800; margin: 0 0 var(--space-4); }
.rd-products { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.rd-product { background: #fff; border: 1px solid var(--color-border-soft); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; cursor: pointer; transition: box-shadow 120ms ease, transform 120ms ease; }
.rd-product:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
/* Flash a dish the user arrived at from search (?highlight=). */
.rd-product.is-highlight { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(229, 37, 42, 0.28); animation: rd-pulse 0.6s ease 2; }
@keyframes rd-pulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(229, 37, 42, 0.28); } 50% { box-shadow: 0 0 0 6px rgba(229, 37, 42, 0.12); } }
.rd-product__media { position: relative; aspect-ratio: 1 / 1; background: var(--color-bg-alt); display: grid; place-items: center; font-size: 2rem; }
.rd-product__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rd-product .veg-marker { position: absolute; top: 8px; left: 8px; z-index: 2; }
.rd-product__badge { position: absolute; top: 8px; right: 8px; background: var(--color-primary); color: #fff; font-size: 0.66rem; font-weight: 700; padding: 2px 6px; border-radius: 6px; }
/* Out of stock */
.rd-product.is-soldout { opacity: 0.72; }
.rd-product__soldout { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; background: rgba(255, 255, 255, 0.66); color: var(--color-text); font-weight: 800; font-size: 0.85rem; }
.rd-product__oos { color: var(--color-text-soft); font-weight: 700; font-size: 0.85rem; }
.rd-product__stock { color: #b45309; font-weight: 700; font-size: 0.76rem; margin-left: 8px; }
/* Per-product stock line (green = available / count, red = out). */
.rd-product__stockline { display: inline-flex; align-items: center; gap: 4px; font-size: 0.74rem; font-weight: 700; }
.rd-product__stockline svg { flex: 0 0 auto; }
.rd-product__stockline--in { color: #16a34a; }
.rd-product__stockline--out { color: var(--color-primary); }
.rd-product__body { padding: var(--space-3); display: flex; flex-direction: column; gap: 5px; flex: 1 1 auto; min-width: 0; }
.rd-product__name { font-size: 0.86rem; font-weight: 700; margin: 0; line-height: 1.3; }
.rd-product__meta { margin: 0; }
.rd-product__rating { display: inline-flex; align-items: center; gap: 3px; background: var(--color-bg-alt); border-radius: 6px; padding: 2px 6px; font-size: 0.72rem; font-weight: 700; }
.rd-product__foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.rd-product__price { font-weight: 800; font-size: 0.92rem; }
.rd-product__price--na { color: var(--color-text-soft); font-weight: 600; font-size: 0.82rem; font-style: italic; }
/* Per-product discount — struck-through original + red discounted price. */
.rd-product__price-was { text-decoration: line-through; color: var(--color-text-soft); font-weight: 600; font-size: 0.82rem; margin-right: 5px; }
.rd-product__price--off { color: #dc2626; }
/* BOGOF "Buy X Get Y Free" badge. */
.rd-product__bogo { display: inline-block; margin: 4px 0 2px; padding: 2px 8px; background: #fef3c7; color: #92400e; border-radius: 6px; font-size: 0.72rem; font-weight: 800; }

/* Review & earn cashback — screenshot upload form (right rail). */
.rd-revcash__sub { margin: 0 0 12px; font-size: 0.84rem; color: var(--color-text-soft); }
.rd-revcash__form { display: flex; flex-direction: column; gap: 10px; }
.rd-revcash__file, .rd-revcash__notes { border: 1.5px solid var(--color-border, #e5e7eb); border-radius: 10px; padding: 9px 12px; font: inherit; background: #fff; }
.rd-revcash__notes { resize: vertical; }
.rd-revcash__btn { background: var(--color-primary); color: #fff; border: 0; border-radius: 10px; padding: 10px; font-weight: 700; font-size: 0.9rem; cursor: pointer; }
.rd-revcash__btn:hover { filter: brightness(0.95); }
.rd-revcash__more { display: inline-block; margin-top: 10px; font-size: 0.84rem; font-weight: 600; color: var(--color-primary-dark, #C41E22); }
.rd-revcash__more:hover { color: var(--color-primary, #E5252A); }
.rd-product__add { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--color-primary); color: var(--color-primary); border-radius: 999px; padding: 5px 11px; font-weight: 700; cursor: pointer; font-size: 0.76rem; }
.rd-product__add:hover { background: var(--color-primary); color: #fff; }

/* ── Right rail cards ──────────────────────────────────────────────── */
.rd__right { position: sticky; top: 88px; display: flex; flex-direction: column; gap: var(--space-4); max-height: calc(100dvh - 104px); overflow-y: auto; scrollbar-width: thin; }
.rd-card { background: #fff; border: 1px solid var(--color-border-soft); border-radius: var(--radius-lg); padding: var(--space-4); }
.rd-card__title { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; font-weight: 800; margin: 0 0 var(--space-3); }
.rd-card__subtitle { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; font-weight: 800; margin: 0 0 var(--space-2); }
.rd-order__empty { text-align: center; padding: var(--space-4) 0; color: var(--color-text-soft); }
.rd-order__bag { font-size: 2rem; display: block; opacity: 0.55; }
.rd-order__title { font-weight: 700; color: var(--color-text); margin: var(--space-2) 0 0; }
.rd-order__sub { font-size: 0.85rem; margin: 2px 0 0; }
.rd-deliver__addr { font-weight: 600; margin: 0 0 4px; }
.rd-deliver__change { background: none; border: 0; padding: 0; color: var(--color-primary); font-weight: 700; cursor: pointer; }
.rd-rinfo__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.rd-rinfo__row { display: flex; align-items: center; gap: 10px; color: var(--color-text); }
.rd-rinfo__row > svg { color: var(--color-text-soft); flex: 0 0 auto; }
.rd-rinfo__text { display: flex; flex-direction: column; }
.rd-rinfo__label { font-weight: 700; }
.rd-rinfo__sub { font-size: 0.82rem; color: var(--color-text-soft); }
.rd-rinfo__link { color: var(--color-text); text-decoration: none; background: none; border: 0; cursor: pointer; font: inherit; text-align: left; padding: 0; }
.rd-rinfo__link:hover { color: var(--color-primary); }
.rd-rinfo__dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.rd-rinfo__dot.is-open { background: #16a34a; }
.rd-rinfo__dot.is-closed { background: #9ca3af; }

/* Per-service Open/Closed pill (Delivery / Pickup / Pre-order rows). */
.rd-rinfo__badge {
    display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px;
    font-size: 0.7rem; font-weight: 700; vertical-align: middle;
}
.rd-rinfo__badge.is-open { background: #dcfce7; color: #15803d; }
.rd-rinfo__badge.is-closed { background: #fee2e2; color: #dc2626; }

/* Info icon button next to the "Restaurant info" heading. */
.rd-rinfo__more {
    margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border: 0; border-radius: 50%; background: var(--color-bg-alt);
    color: var(--color-text-muted); cursor: pointer; flex: 0 0 auto;
}
.rd-rinfo__more:hover { background: var(--color-primary-soft); color: var(--color-primary); }

/* ── Restaurant info + opening-hours popup ─────────────────────────── */
.rd-infomodal { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center; padding: var(--space-4); }
.rd-infomodal[hidden] { display: none; }
.rd-infomodal__backdrop { position: absolute; inset: 0; background: rgba(17, 17, 17, 0.55); }
.rd-infomodal__sheet {
    position: relative; z-index: 1; width: 100%; max-width: 460px; max-height: 88vh;
    background: #fff; border-radius: var(--radius-xl, 20px); display: flex; flex-direction: column; overflow: hidden;
    box-shadow: var(--shadow-2); animation: reviews-modal-pop 140ms ease;
}
.rd-infomodal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-5) var(--space-5) var(--space-3); }
.rd-infomodal__title { font-size: 1.2rem; font-weight: 800; margin: 0; }
.rd-infomodal__close { flex: 0 0 auto; width: 34px; height: 34px; border: 0; background: var(--color-bg-alt); border-radius: 50%; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--color-text); }
.rd-infomodal__close:hover { background: rgba(0, 0, 0, 0.08); color: var(--color-primary); }
.rd-infomodal__body { padding: 0 var(--space-5) var(--space-5); overflow-y: auto; }
.rd-infomodal__sec { padding: var(--space-4) 0; border-top: 1px solid var(--color-border-soft); }
.rd-infomodal__sec:first-child { border-top: 0; padding-top: 0; }
.rd-infomodal__h { font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-soft); margin: 0 0 8px; }
.rd-infomodal__name { font-weight: 800; font-size: 1.05rem; margin: 0 0 4px; }
.rd-infomodal__line { margin: 2px 0 0; color: var(--color-text-muted); font-size: 0.9rem; }
.rd-infomodal__link { color: var(--color-text); text-decoration: none; display: inline-block; }
.rd-infomodal__link:hover { color: var(--color-primary); }
.rd-infomodal__maps { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--color-primary); font-weight: 700; font-size: 0.9rem; text-decoration: none; }
.rd-infomodal__maps:hover { color: var(--color-primary-dark); }

/* Opening-hours table — current day highlighted. */
.rd-hours { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.rd-hours th, .rd-hours td { text-align: left; padding: 8px 6px; vertical-align: top; }
.rd-hours thead th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--color-text-soft); border-bottom: 1px solid var(--color-border-soft); }
.rd-hours td { color: var(--color-text-muted); }
.rd-hours__row { border-bottom: 1px solid var(--color-border-soft); }
.rd-hours__row:last-child { border-bottom: 0; }
.rd-hours__day { font-weight: 700; color: var(--color-text); white-space: nowrap; }
.rd-hours__row.is-today { background: var(--color-primary-soft); }
.rd-hours__row.is-today td, .rd-hours__row.is-today .rd-hours__day { color: var(--color-primary-dark); font-weight: 700; }
.rd-hours__badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--color-primary); color: #fff; font-size: 0.62rem; font-weight: 800; vertical-align: middle; }
body.rd-infomodal-open { overflow: hidden; }

/* Mobile — bottom sheet (PWA feel). */
@media (max-width: 600px) {
    .rd-infomodal { padding: 0; align-items: flex-end; }
    .rd-infomodal__sheet { max-width: none; max-height: 92vh; border-radius: 18px 18px 0 0; }
}

/* ── Responsive ────────────────────────────────────────────────────── */

/* Tablet / narrow desktop — drop to 2 columns; the right rail moves
   to a full-width row of cards under the menu. */
@media (max-width: 1200px) {
    .rd {
        grid-template-columns: 216px minmax(0, 1fr);
        grid-template-areas:
            "left hero"
            "left infobar"
            "left main"
            "right right";
        column-gap: var(--space-5);
    }
    .rd__right {
        position: static; max-height: none; overflow: visible;
        display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-4);
    }
    .rd-products { grid-template-columns: repeat(3, 1fr); }
}

/* Mobile / small tablet — single column (flex, reordered). The category
   menu becomes a sticky horizontal scroller pinned just under the
   mobile search bar (the site header scrolls away on mobile). Reading
   order: hero → order info → categories → dishes → side info. */
@media (max-width: 900px) {
    .rd {
        display: flex; flex-direction: column; grid-template-areas: none;
        width: 100%; max-width: 100%;
        padding: var(--space-3) var(--space-3) var(--space-10); gap: var(--space-4);
    }
    /* Every column becomes a full-width row; min-width:0 stops a long
       child (a wide product grid / a long name) from forcing the whole
       page wider than the screen. */
    .rd > * { min-width: 0; max-width: 100%; }
    .rd-hero     { order: 1; }
    .rd-info-bar { order: 2; }
    .rd__left    { order: 3; }
    .rd__main    { order: 4; }
    /* Full-width stacked info cards (Delivery to / Restaurant info) — they
       must span the whole row like the product cards above them, not sit
       in a narrow grid track. */
    .rd__right {
        order: 5; position: static; max-height: none; overflow: visible;
        display: flex; flex-direction: column; gap: var(--space-4);
        grid-template-columns: none; width: 100%; align-items: stretch;
    }
    .rd__right > .rd-card { width: 100%; max-width: none; }

    /* The left rail is just a plain block on mobile (no sticky, no
       negative margins — full-bleed breakouts were shifting the whole
       page left of the screen under body{overflow-x:hidden}). Only the
       category pills pin (see .rd-menu below). */
    .rd__left {
        position: static; max-height: none; overflow: visible;
        margin: 0; padding: 0; background: none; border: 0;
    }
    .rd__back { margin-bottom: var(--space-2); font-size: 0.9rem; }
    /* Category pills = a pinned horizontal SLIDE bar that stops just
       under the sticky mobile search row. Contained inside the page
       padding; pills never shrink so the row scrolls cleanly. */
    .rd-menu {
        position: sticky; top: 52px; z-index: 35;
        flex-direction: row; flex-wrap: nowrap;
        overflow-x: auto; -webkit-overflow-scrolling: touch;
        gap: var(--space-2); scrollbar-width: none;
        background: #fff; padding: var(--space-2) 0;
        border-bottom: 1px solid var(--color-border-soft);
        box-shadow: 0 6px 10px -8px rgba(0, 0, 0, 0.18);
        scroll-padding-left: var(--space-3);
    }
    .rd-menu::-webkit-scrollbar { display: none; }
    .rd-menu__item {
        flex: 0 0 auto; white-space: nowrap; gap: 6px;
        padding: 9px 16px; border: 1px solid var(--color-border-soft);
        border-radius: 999px; font-size: 0.86rem; font-weight: 600;
    }
    .rd-menu__name { flex: 0 0 auto; }
    .rd-menu__count { font-size: 0.74rem; }
    .rd-menu__item.is-active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
    .rd-menu__item.is-active .rd-menu__icon,
    .rd-menu__item.is-active .rd-menu__count { color: #fff; }

    .rd-products { grid-template-columns: repeat(2, 1fr); }
    /* Jump-links: clear the sticky search (≈52px) + category bar (≈52px). */
    .rd-section { scroll-margin-top: 120px; }
    .rd-section__title { font-size: 1.05rem; }
    .rd-map { display: none; }

    .rd-hero__media { aspect-ratio: 16 / 7; min-height: 150px; }
    .rd-hero__logo { width: 56px; height: 56px; left: var(--space-3); bottom: var(--space-3); }
    .rd-hero__overlay { padding: var(--space-4) var(--space-3) var(--space-3) 76px; }
    .rd-hero__name { font-size: 1.25rem; }
    .rd-info { gap: var(--space-4); }
    .rd-info__cell { min-width: 0; }
    .rd-info__value { overflow-wrap: anywhere; }
    .rd-rinfo__link { overflow-wrap: anywhere; word-break: break-word; }
    .rd-tabs { overflow-x: auto; scrollbar-width: none; }
    .rd-tabs::-webkit-scrollbar { display: none; }
    .rd-tab { white-space: nowrap; }
}

/* Phones — menu items become full-width horizontal rows (thumbnail
   left, details right) for a clean, tappable app-style list. */
@media (max-width: 560px) {
    .rd-products { grid-template-columns: 1fr; gap: var(--space-3); }
    /* Every menu row is the SAME height regardless of dish-name length or
       how many categories the menu has. The name is clamped to two lines
       and the card gets a fixed min-height, so a short menu's cards don't
       shrink ("chota") and a long menu's don't grow ("bada") — the
       thumbnail stretches to that one consistent height everywhere. */
    .rd-product { flex-direction: row; min-height: 148px; }
    .rd-product__media { flex: 0 0 132px; width: 132px; align-self: stretch; aspect-ratio: auto; }
    .rd-product__body { padding: var(--space-3) var(--space-4); gap: 5px; justify-content: center; overflow: hidden; }
    .rd-product__name {
        font-size: 0.98rem; line-height: 1.3;
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    }
    .rd-product__rating { font-size: 0.72rem; }
    .rd-product__price { font-size: 0.95rem; }
    .rd-hero__name { font-size: 1.15rem; }
    .rd-tab { padding: 8px 10px; font-size: 0.85rem; }
}

/* ── Customer reviews card (right rail) ─────────────────────────────── */
.rd-reviews .rd-card__subtitle { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rd-reviews__avg { color: #f5a623; font-weight: 800; }
.rd-reviews__count { color: var(--color-text-soft); font-weight: 600; font-size: 0.85rem; }
.rd-reviews__list { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.rd-review { border-top: 1px solid var(--color-border-soft); padding-top: var(--space-3); }
.rd-review:first-child { border-top: 0; padding-top: 0; }
.rd-review__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.rd-review__name { font-weight: 700; font-size: 0.9rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-review__stars { flex: 0 0 auto; letter-spacing: 1px; color: var(--color-border); font-size: 0.9rem; }
.rd-review__stars .is-on { color: #f5a623; }
.rd-review__text { margin: 6px 0 0; font-size: 0.88rem; color: var(--color-text); line-height: 1.45; }
.rd-review__photo { margin-top: 8px; width: 100%; max-height: 200px; object-fit: cover; border-radius: 12px; display: block; }

/* Reviews controls — sort tabs + star-filter chips + load more. */
.rd-reviews__sort { display: flex; gap: 6px; margin: var(--space-3) 0 8px; }
.rd-reviews__sort-btn {
    flex: 1 1 auto; border: 1px solid var(--color-border); background: #fff; color: var(--color-text-soft);
    border-radius: 999px; padding: 6px 8px; font-size: 0.78rem; font-weight: 700; cursor: pointer; white-space: nowrap;
    transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}
.rd-reviews__sort-btn:hover { border-color: var(--color-primary); }
.rd-reviews__sort-btn.is-active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

.rd-reviews__filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--space-2); }
.rd-reviews__chip {
    border: 1px solid var(--color-border); background: #fff; color: var(--color-text);
    border-radius: 999px; padding: 5px 10px; font-size: 0.78rem; font-weight: 700; cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}
.rd-reviews__chip:hover { border-color: var(--color-primary); }
.rd-reviews__chip.is-active { background: var(--color-primary-soft); border-color: var(--color-primary); color: var(--color-primary); }
.rd-reviews__chip-n { color: var(--color-text-soft); font-weight: 600; font-size: 0.72rem; }
.rd-reviews__chip.is-active .rd-reviews__chip-n { color: var(--color-primary); }

.rd-reviews__empty { margin: var(--space-3) 0 0; color: var(--color-text-soft); font-size: 0.85rem; text-align: center; }
.rd-reviews__more {
    margin-top: var(--space-3); width: 100%; border: 1px solid var(--color-border); background: #fff;
    color: var(--color-primary); border-radius: 10px; padding: 9px 12px; font-weight: 800; font-size: 0.85rem; cursor: pointer;
}
.rd-reviews__more:hover { background: var(--color-primary-soft); border-color: var(--color-primary); }
.rd-reviews__more[hidden] { display: none; }
.rd-reviews.is-loading { opacity: 0.6; pointer-events: none; }

/* Rail: "View all" button + top-5 preview list. */
.rd-reviews__viewall {
    margin-top: var(--space-3); width: 100%; border: 1px solid var(--color-border); background: #fff;
    color: var(--color-primary); border-radius: 10px; padding: 9px 12px; font-weight: 800; font-size: 0.85rem; cursor: pointer;
}
.rd-reviews__viewall:hover { background: var(--color-primary-soft); border-color: var(--color-primary); }
.rd-reviews__list--preview .rd-review__photo { max-height: 150px; }

/* Hero rating → tappable (opens the reviews modal — the phone entry). */
.rd-hero__rating--btn { cursor: pointer; }
.rd-hero__rating--btn:hover { text-decoration: underline; }

/* ── Ratings & reviews modal ────────────────────────────────────────── */
.reviews-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: var(--space-4); }
.reviews-modal[hidden] { display: none; }
.reviews-modal__backdrop { position: absolute; inset: 0; background: rgba(17,17,17,0.55); }
.reviews-modal__panel {
    position: relative; z-index: 1; width: 100%; max-width: 520px; max-height: 88vh;
    background: #fff; border-radius: var(--radius-xl, 20px); display: flex; flex-direction: column; overflow: hidden;
    box-shadow: var(--shadow-2); animation: reviews-modal-pop 140ms ease;
}
@keyframes reviews-modal-pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.reviews-modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-5) var(--space-5) var(--space-3); }
.reviews-modal__title { font-size: 1.2rem; font-weight: 800; margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.reviews-modal__close { flex: 0 0 auto; width: 34px; height: 34px; border: 0; background: var(--color-bg-alt); border-radius: 50%; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--color-text); }
.reviews-modal__close:hover { background: rgba(0,0,0,0.08); color: var(--color-primary); }
.reviews-modal__controls { padding: 0 var(--space-5) var(--space-3); border-bottom: 1px solid var(--color-border-soft); }
.reviews-modal__controls .rd-reviews__sort { margin-top: 0; }
.reviews-modal__body { padding: var(--space-4) var(--space-5) var(--space-5); overflow-y: auto; }
.reviews-modal__body .rd-reviews__list { margin-top: 0; }
.reviews-modal.is-loading { opacity: 0.85; }

/* Reviews fetch spinner (open / sort / filter / load-more). */
.rd-reviews__loader { display: flex; align-items: center; justify-content: center; gap: 8px; padding: var(--space-5) 0; color: var(--color-text-soft); font-size: 0.9rem; font-weight: 600; }
.rd-reviews__loader[hidden] { display: none; }
.rv-spinner { width: 18px; height: 18px; border: 2px solid var(--color-border); border-top-color: var(--color-primary); border-radius: 50%; animation: rv-spin 0.6s linear infinite; flex: 0 0 auto; }
@keyframes rv-spin { to { transform: rotate(360deg); } }

/* Phone: hide the rail card (hero rating opens the modal) + full-screen sheet. */
/* Mobile rating bar — sits under the search box (top of the restaurant
   content) + opens the reviews modal. Hidden on desktop (rail card + hero
   rating handle it there). */
.rd-ratingbar { display: none; }

@media (max-width: 900px) {
    .rd-reviews { display: none; }
    .rd-ratingbar {
        order: 0; display: flex; align-items: center; gap: 8px; width: 100%;
        margin: 0 0 var(--space-3); padding: 11px 14px; cursor: pointer;
        background: #fff; border: 1px solid var(--color-border-soft); border-radius: 14px;
        font: inherit; text-align: left; box-shadow: var(--shadow-1);
    }
    .rd-ratingbar:active { background: var(--color-bg-alt); }
    .rd-ratingbar__star { display: inline-flex; align-items: center; gap: 4px; color: #f5a623; font-weight: 800; flex: 0 0 auto; }
    .rd-ratingbar__star strong { color: var(--color-text); }
    .rd-ratingbar__count { flex: 1 1 auto; min-width: 0; color: var(--color-text-soft); font-weight: 600; font-size: 0.9rem; }
    .rd-ratingbar__chev { flex: 0 0 auto; color: var(--color-text-soft); }
}
@media (max-width: 600px) {
    .reviews-modal { padding: 0; align-items: stretch; }
    .reviews-modal__panel { max-width: none; max-height: none; height: 100%; border-radius: 0; }
}

/* Reward-card balance banner — top of the restaurant content (loyalty).
   Mobile-only for now (avoids the desktop grid auto-placement); desktop
   sees the balance in the Rewards wallet. */
.rd-rewardbar { display: none; }
@media (max-width: 900px) {
    .rd-rewardbar {
        order: 0; display: flex; align-items: center; gap: 10px; width: 100%;
        margin: 0 0 var(--space-3); padding: 12px 16px;
        background: #e7f6ec; border: 1px solid #b7e4c7; border-radius: 14px;
        color: #166534; font-weight: 700; font-size: 0.92rem; text-decoration: none;
    }
    .rd-rewardbar:active { background: #d8f0e0; }
    .rd-rewardbar > span { flex: 1 1 auto; min-width: 0; }
    .rd-rewardbar strong { font-weight: 800; }
    .rd-rewardbar__chev { flex: 0 0 auto; }
}

/* Order-streak progress — stamp-card dots nudging toward the next reward.
   Mobile-only (same desktop-grid reason as the reward bar). */
.rd-streakbar { display: none; }
@media (max-width: 900px) {
    .rd-streakbar {
        order: 0; display: flex; align-items: center; gap: 10px; width: 100%;
        margin: 0 0 var(--space-3); padding: 12px 16px;
        background: #fff7ed; border: 1px solid #fed7aa; border-radius: 14px;
    }
    .rd-streakbar--ready { background: #fef3c7; border-color: #fcd34d; }
    .rd-streakbar__icon { flex: 0 0 auto; font-size: 1.2rem; line-height: 1; }
    .rd-streakbar__body { flex: 1 1 auto; min-width: 0; }
    .rd-streakbar__title { margin: 0; font-size: 0.9rem; font-weight: 700; color: #9a3412; }
    .rd-streakbar--ready .rd-streakbar__title { color: #92400e; }
    .rd-streakbar__dots { display: flex; gap: 6px; margin-top: 7px; }
    .rd-streakbar__dot {
        width: 12px; height: 12px; border-radius: 50%;
        background: #fde4cb; border: 1px solid #fbbf77;
    }
    .rd-streakbar__dot.is-on { background: #ea7c1a; border-color: #ea7c1a; }
}
