/* ==========================================================================
   QRİO — menu.css
   Публичная страница меню. 6 шаблонов задаются классом body.tpl-*,
   фирменный цвет — классом body.accent-*.
   ========================================================================== */

.menu-page {
    --m-bg: #F7F3EC;
    --m-page: #EDE7DC;
    --m-surface: #FFFFFF;
    --m-text: #1C1917;
    --m-muted: #7C746B;
    --m-line: #ECE5D9;
    --m-soft: #F3EEE5;
    --m-head: "Cormorant Garamond", Georgia, serif;
    --m-head-weight: 700;
    --m-hero: linear-gradient(160deg, #3B2A20, #1C1410);
    --accent: #143A2C;
    --accent-ink: #FFFFFF;
    --m-radius: 20px;

    margin: 0;
    background: var(--m-page);
    color: var(--m-text);
    font-family: var(--font);
}

/* ---------- Шаблоны ---------- */
.tpl-luna {
    --m-bg: #F8F4ED;
    --m-page: #ECE5D8;
}

.tpl-verde {
    --m-bg: #10291F;
    --m-page: #0A1D15;
    --m-surface: #173628;
    --m-text: #F4EFE3;
    --m-muted: rgba(244, 239, 227, 0.62);
    --m-line: rgba(255, 255, 255, 0.1);
    --m-soft: rgba(255, 255, 255, 0.06);
    --m-hero: linear-gradient(160deg, #1F4636, #0B2019);
}

.tpl-oliva {
    --m-bg: #F5F5EE;
    --m-page: #E6E6DA;
    --m-line: #E5E5D8;
    --m-soft: #EEEEE3;
    --m-head: var(--font);
    --m-head-weight: 800;
    --m-hero: linear-gradient(160deg, #6B7A3A, #2E3A1C);
}

.tpl-sakura {
    --m-bg: #0E0E10;
    --m-page: #050506;
    --m-surface: #19191C;
    --m-text: #F3EDE4;
    --m-muted: rgba(243, 237, 228, 0.55);
    --m-line: rgba(255, 255, 255, 0.08);
    --m-soft: rgba(255, 255, 255, 0.05);
    --m-head: var(--font);
    --m-head-weight: 800;
    --m-hero: linear-gradient(160deg, #3A1020, #0E0E10);
}

.tpl-terra {
    --m-bg: #21160F;
    --m-page: #140D09;
    --m-surface: #2E2017;
    --m-text: #F6E9D8;
    --m-muted: rgba(246, 233, 216, 0.6);
    --m-line: rgba(255, 255, 255, 0.09);
    --m-soft: rgba(255, 255, 255, 0.05);
    --m-hero: linear-gradient(160deg, #6A3A1F, #21160F);
}

.tpl-noir {
    --m-bg: #0B0B0B;
    --m-page: #000;
    --m-surface: #161514;
    --m-text: #EFE7DA;
    --m-muted: rgba(239, 231, 218, 0.55);
    --m-line: rgba(212, 175, 105, 0.16);
    --m-soft: rgba(255, 255, 255, 0.04);
    --m-hero: linear-gradient(160deg, #2A2317, #0B0B0B);
}

/* ---------- Фирменный цвет ---------- */
.accent-143a2c { --accent: #143A2C; }
.accent-10231b { --accent: #10231B; }
.accent-a0543c { --accent: #A0543C; }
.accent-b8860b { --accent: #B8860B; }
.accent-1d4ed8 { --accent: #1D4ED8; }
.accent-7c3aed { --accent: #7C3AED; }
.accent-be185d { --accent: #BE185D; }
.accent-0f766e { --accent: #0F766E; }

/* На тёмных шаблонах слишком тёмный акцент заменяется светлым */
.tpl-verde.accent-143a2c,
.tpl-verde.accent-10231b { --accent: #E9C46A; --accent-ink: #1C1917; }
.tpl-sakura.accent-143a2c,
.tpl-sakura.accent-10231b { --accent: #E0607E; }
.tpl-terra.accent-143a2c,
.tpl-terra.accent-10231b { --accent: #E4B06A; --accent-ink: #1C1917; }
.tpl-noir.accent-143a2c,
.tpl-noir.accent-10231b { --accent: #D4AF69; --accent-ink: #1C1917; }

/* ---------- Каркас ---------- */
.menu-shell {
    position: relative;
    max-width: 560px;
    min-height: 100vh;
    margin: 0 auto;
    background: var(--m-bg);
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

@media (min-width: 600px) {
    .menu-shell {
        box-shadow: 0 0 80px rgba(0, 0, 0, 0.18);
    }
}

.menu-preview-bar {
    position: sticky;
    top: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 14px;
    padding: 8px 14px;
    background: #7A5A12;
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: center;
}

.menu-preview-bar span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.menu-preview-bar .icon {
    width: 15px;
    height: 15px;
}

.menu-preview-bar a {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Внутри предпросмотра кабинета: отступ под «чёлку» телефона */
.is-embed .m-hero {
    padding-top: 78px;
}

.is-embed .m-langs {
    top: 44px;
}

/* ---------- Шапка заведения ---------- */
.m-hero {
    position: relative;
    display: grid;
    min-height: 280px;
    padding: 64px 20px 44px;
    background: var(--m-hero);
    color: #fff;
    text-align: center;
    overflow: hidden;
    isolation: isolate;
}

.m-hero.has-cover {
    min-height: 320px;
}

.m-hero__cover {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: m-zoom 14s ease-out both;
}

@keyframes m-zoom {
    from { transform: scale(1.12); }
    to { transform: scale(1); }
}

.m-hero__shade {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.55) 100%);
}

.m-hero__brand {
    display: grid;
    justify-items: center;
    align-content: end;
    gap: 10px;
    animation: m-rise 0.9s var(--ease-out) both 0.1s;
}

@keyframes m-rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
}

.m-hero__logo {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: #fff;
    color: #1C1917;
    font-family: var(--m-head);
    font-size: 2rem;
    font-weight: 700;
    font-style: italic;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.m-hero__logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.m-hero__name {
    color: #fff;
    font-family: var(--m-head);
    font-weight: var(--m-head-weight);
    font-size: clamp(2rem, 8vw, 2.6rem);
    letter-spacing: -0.01em;
    line-height: 1.05;
}

.m-hero__desc {
    max-width: 34ch;
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.82);
}

.m-hero__badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.m-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-size: 0.8125rem;
    font-weight: 600;
}

.m-badge__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.m-badge--open .m-badge__dot {
    background: #4ADE80;
    box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.25);
    animation: m-pulse 2s ease-in-out infinite;
}

.m-badge--closed .m-badge__dot {
    background: #F87171;
}

@keyframes m-pulse {
    50% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); }
}

.m-langs {
    position: absolute;
    top: 14px;
    right: 14px;
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.35);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.m-langs__item {
    display: grid;
    place-items: center;
    min-width: 34px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.8);
}

.m-langs__item.is-active {
    background: #fff;
    color: #1C1917;
}

/* ---------- Тело ---------- */
.m-body {
    position: relative;
    margin-top: -22px;
    padding: 6px 0 20px;
    border-radius: 24px 24px 0 0;
    background: var(--m-bg);
}

/* ---------- Вкладки категорий ---------- */
.m-tabs {
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 12px 0;
    background: var(--m-bg);
    transition: box-shadow 0.3s ease;
}

.m-tabs.is-stuck {
    box-shadow: 0 8px 20px -12px rgba(0, 0, 0, 0.35);
}

.m-tabs__track {
    display: flex;
    gap: 8px;
    padding: 0 16px;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-behavior: smooth;
}

.m-tabs__track::-webkit-scrollbar {
    display: none;
}

.m-tabs__tab {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 18px;
    border-radius: 999px;
    background: var(--m-soft);
    color: var(--m-muted);
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.3s var(--ease-spring);
}

.m-tabs__tab.is-active {
    background: var(--accent);
    color: var(--accent-ink);
}

.m-tabs__tab:active {
    transform: scale(0.95);
}

/* ---------- Категория и позиции ---------- */
.m-section {
    padding: 18px 16px 8px;
    scroll-margin-top: 70px;
}

.m-section__title {
    margin-bottom: 4px;
    color: var(--m-text);
    font-family: var(--m-head);
    font-weight: var(--m-head-weight);
    font-size: 1.75rem;
    letter-spacing: -0.01em;
}

.m-section__desc {
    margin-bottom: 8px;
    color: var(--m-muted);
    font-size: 0.875rem;
}

.m-items {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.m-item {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s var(--ease-out), transform 0.7s var(--ease-out);
}

.m-item.is-in,
.no-js .m-item {
    opacity: 1;
    transform: none;
}

.m-item__btn {
    display: flex;
    gap: 14px;
    width: 100%;
    padding: 12px;
    border-radius: var(--m-radius);
    background: var(--m-surface);
    border: 1px solid var(--m-line);
    color: inherit;
    text-align: left;
    transition: transform 0.25s ease, box-shadow 0.3s ease;
}

.m-item__btn:active {
    transform: scale(0.985);
}

.m-item__media {
    position: relative;
    flex-shrink: 0;
    width: 104px;
    height: 104px;
    border-radius: 16px;
    overflow: hidden;
    background: var(--m-soft);
}

.m-item__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.m-item__sale {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 3px 7px;
    border-radius: 7px;
    background: #DC2626;
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 800;
}

.m-item__sale--inline {
    position: static;
}

.m-item__sale--inline:empty {
    display: none;
}

.m-item__body {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 0;
    padding: 2px 2px 0 0;
}

.m-item__name {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    color: var(--m-text);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.m-item__star {
    display: inline-grid;
    color: #F2B23A;
}

.m-item__star .icon {
    width: 15px;
    height: 15px;
}

.m-item__desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--m-muted);
    font-size: 0.8125rem;
    line-height: 1.45;
}

.m-item__foot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 4px;
}

.m-item__price {
    color: var(--m-text);
    font-size: 1rem;
    font-weight: 800;
}

.m-item__price s {
    margin-right: 6px;
    color: var(--m-muted);
    font-size: 0.8125rem;
    font-weight: 500;
}

.m-item__meta {
    color: var(--m-muted);
    font-size: 0.75rem;
}

.m-item__soldout {
    padding: 3px 8px;
    border-radius: 7px;
    background: var(--m-soft);
    color: var(--m-muted);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.m-item__soldout[hidden] {
    display: none;
}

.m-item.is-soldout .m-item__media,
.m-item.is-soldout .m-item__name,
.m-item.is-soldout .m-item__price {
    opacity: 0.45;
}

.m-item.is-soldout .m-item__media img {
    filter: grayscale(1);
}

/* ---------- Этикетки ---------- */
.m-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.m-labels:empty {
    display: none;
}

.m-label {
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--m-soft);
    color: var(--m-text);
    font-size: 0.6875rem;
    font-weight: 700;
}

.m-label--spicy { background: #FDE7DC; color: #B4380C; }
.m-label--vegetarian,
.m-label--vegan { background: #E0F2E7; color: #1B6B43; }
.m-label--sugar_free { background: #DFF3F7; color: #0E6475; }
.m-label--gluten_free { background: #FBF1D6; color: #8A5A0B; }
.m-label--new { background: #EFE7FD; color: #6D28D9; }
.m-label--hit { background: #FEF0C7; color: #92400E; }

/* ---------- Пусто ---------- */
.m-empty {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 60px 20px;
    color: var(--m-muted);
    text-align: center;
}

.m-empty__icon .icon {
    width: 34px;
    height: 34px;
}

/* ---------- Информация ---------- */
.m-info {
    display: grid;
    gap: 12px;
    padding: 28px 16px 8px;
    scroll-margin-top: 16px;
}

.m-card {
    display: grid;
    gap: 12px;
    padding: 18px;
    border-radius: var(--m-radius);
    background: var(--m-surface);
    border: 1px solid var(--m-line);
}

.m-card__title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--m-text);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0;
}

.m-card__title .icon {
    width: 19px;
    height: 19px;
    color: var(--accent);
}

.m-card__text {
    color: var(--m-muted);
    font-size: 0.9375rem;
}

.m-hours {
    display: grid;
    gap: 2px;
}

.m-hours__row {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--m-muted);
    font-size: 0.875rem;
}

.m-hours__row.is-today {
    background: var(--m-soft);
    color: var(--m-text);
    font-weight: 700;
}

.m-wifi__data {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 16px;
    margin: 0;
    font-size: 0.9375rem;
}

.m-wifi__data dt {
    color: var(--m-muted);
}

.m-wifi__data dd {
    margin: 0;
    color: var(--m-text);
    font-weight: 700;
}

.m-wifi__data code {
    font-family: inherit;
    letter-spacing: 0.03em;
}

.m-map {
    width: 100%;
    height: 190px;
    border: 0;
    border-radius: 14px;
    background: var(--m-soft);
}

.m-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    height: 46px;
    padding: 0 18px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 0.9375rem;
    font-weight: 700;
    white-space: nowrap;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

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

.menu-btn .icon {
    width: 18px;
    height: 18px;
}

.menu-btn--ghost {
    background: var(--m-soft);
    color: var(--m-text);
}

.m-socials {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.m-social {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border-radius: 16px;
    background: var(--m-surface);
    border: 1px solid var(--m-line);
    color: var(--m-text);
    font-size: 0.875rem;
    font-weight: 600;
}

.m-social .icon {
    width: 20px;
    height: 20px;
    color: var(--accent);
}

.m-footer {
    padding: 28px 16px 12px;
    text-align: center;
}

.m-footer a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--m-muted);
    font-size: 0.8125rem;
}

.m-footer strong {
    color: var(--m-text);
    font-weight: 800;
    letter-spacing: -0.03em;
}

/* ---------- Нижняя навигация ---------- */
.m-bottom {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 40;
    display: flex;
    justify-content: space-around;
    width: 100%;
    max-width: 560px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: var(--m-surface);
    border-top: 1px solid var(--m-line);
    transform: translateX(-50%);
}

.m-bottom__link {
    display: grid;
    justify-items: center;
    gap: 3px;
    flex: 1;
    padding: 6px 4px;
    border-radius: 12px;
    color: var(--m-muted);
    font-size: 0.6875rem;
    font-weight: 600;
    transition: color 0.2s ease;
}

.m-bottom__link .icon {
    width: 21px;
    height: 21px;
}

.m-bottom__link.is-active {
    color: var(--accent);
}

.tpl-verde .m-bottom__link.is-active,
.tpl-sakura .m-bottom__link.is-active,
.tpl-terra .m-bottom__link.is-active,
.tpl-noir .m-bottom__link.is-active {
    color: var(--m-text);
}

/* ---------- Карточка блюда (bottom sheet) ---------- */
.m-sheet {
    position: fixed;
    inset: 0;
    z-index: 100;
    visibility: hidden;
    pointer-events: none;
}

.m-sheet.is-open {
    visibility: visible;
    pointer-events: auto;
}

.m-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.m-sheet.is-open .m-sheet__backdrop {
    opacity: 1;
}

.m-sheet__panel {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 100%;
    max-width: 560px;
    max-height: 92vh;
    overflow-y: auto;
    border-radius: 26px 26px 0 0;
    background: var(--m-surface);
    color: var(--m-text);
    transform: translate(-50%, 100%);
    transition: transform 0.45s var(--ease-out);
}

.m-sheet.is-open .m-sheet__panel {
    transform: translate(-50%, 0);
}

.m-sheet__close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
}

.m-sheet__close .icon {
    width: 18px;
    height: 18px;
}

.m-sheet__img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.m-sheet__img[hidden] {
    display: none;
}

.m-sheet__body {
    display: grid;
    gap: 10px;
    padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
}

.m-sheet__title {
    color: var(--m-text);
    font-family: var(--m-head);
    font-weight: var(--m-head-weight);
    font-size: 1.75rem;
    line-height: 1.1;
    padding-right: 40px;
}

.m-sheet__desc {
    color: var(--m-muted);
    font-size: 0.9375rem;
    line-height: 1.55;
}

.m-sheet__desc:empty,
.m-sheet__attrs:empty {
    display: none;
}

.m-sheet__attrs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.m-sheet__attrs li {
    padding: 5px 10px;
    border-radius: 8px;
    background: var(--m-soft);
    font-size: 0.8125rem;
}

.m-sheet__foot {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.m-sheet__price {
    font-size: 1.4rem;
    font-weight: 800;
}

.m-sheet__price s {
    margin-right: 8px;
    color: var(--m-muted);
    font-size: 1rem;
    font-weight: 500;
}

/* ---------- Toast ---------- */
.m-toast {
    position: fixed;
    left: 50%;
    bottom: 90px;
    z-index: 120;
    padding: 10px 16px;
    border-radius: 999px;
    background: #1C1917;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 0;
    transform: translate(-50%, 10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.m-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---------- Меню недоступно ---------- */
.menu-unavailable {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 14px;
    min-height: 100vh;
    padding: 24px;
    background: var(--m-bg);
    text-align: center;
}

.menu-unavailable__icon {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 22px;
    background: var(--m-soft);
    color: var(--accent);
}

.menu-unavailable__icon .icon {
    width: 32px;
    height: 32px;
}

.menu-unavailable h1 {
    font-size: 1.6rem;
}

.menu-unavailable p {
    max-width: 36ch;
    color: var(--m-muted);
}

.menu-unavailable .menu-btn {
    flex: 0;
}

@media (prefers-reduced-motion: reduce) {
    .m-item {
        opacity: 1;
        transform: none;
    }
}
