/* ============================================================
   Чайхана Узген — стили публичной части (mobile-first)
   Палитра: тёмный тёплый фон, кремовый текст, золото, терракота
   ============================================================ */

:root {
    --bg: #16110D;
    --bg-2: #1E1710;
    --card: #241B13;
    --card-2: #2B2118;
    --text: #F3E9D7;
    --muted: #B8A98F;
    --gold: #C9A24B;
    --gold-soft: rgba(201, 162, 75, .18);
    --terra: #B4552D;
    --terra-hi: #C8643A;
    --line: rgba(201, 162, 75, .16);
    --radius: 16px;
    --radius-sm: 12px;
    --shadow: 0 6px 24px rgba(0, 0, 0, .35);
    --app-w: 520px;
    /* Тонкий этно-узор (ромбики) для шапки/футера */
    --ornament: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='20' viewBox='0 0 40 20'%3E%3Cg fill='none' stroke='%23C9A24B' stroke-opacity='.35' stroke-width='1'%3E%3Cpath d='M10 2l6 8-6 8-6-8z'/%3E%3Cpath d='M30 2l6 8-6 8-6-8z'/%3E%3Ccircle cx='20' cy='10' r='1.4'/%3E%3C/g%3E%3C/svg%3E");
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Атрибут hidden всегда скрывает (важно для flex-элементов) */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    min-height: 100vh;
}

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; }

/* ---------- Desktop: колонка-приложение на тёмном фоне ---------- */
.app {
    width: 100%;
    max-width: var(--app-w);
    margin: 0 auto;
    background: var(--bg-2);
    min-height: 100vh;
    position: relative;
}
@media (min-width: 600px) {
    body { background: #0D0A07; }
    .app { box-shadow: 0 0 60px rgba(0, 0, 0, .6); }
}

/* ===================== ШАПКА ===================== */
.hero {
    position: relative;
    min-height: 240px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    background: radial-gradient(ellipse at 50% 0%, #2E2318 0%, var(--bg) 75%);
}
.hero__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(22, 17, 13, .45) 0%, rgba(22, 17, 13, .35) 40%, rgba(22, 17, 13, .92) 100%);
}
.hero__content {
    position: relative;
    z-index: 1;
    padding: 64px 20px 26px;
    text-align: center;
}
.hero__title {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
    font-size: clamp(26px, 7.5vw, 36px);
    letter-spacing: .14em;
    color: var(--text);
    text-shadow: 0 2px 12px rgba(0, 0, 0, .6);
}
.hero__title::after {
    content: "";
    display: block;
    width: 72px;
    height: 2px;
    margin: 12px auto 10px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.hero__tagline {
    color: var(--muted);
    font-size: 14px;
    letter-spacing: .06em;
}
.hero__ornament {
    position: relative;
    z-index: 1;
    height: 16px;
    background: var(--ornament) repeat-x center / auto 16px;
    opacity: .5;
}

/* ===================== АКЦИЯ ===================== */
.promo { padding: 14px 14px 0; }
.promo__card {
    background: linear-gradient(135deg, #2B1E12 0%, var(--card) 100%);
    border: 1px solid var(--gold-soft);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}
.promo__title {
    font-family: Georgia, serif;
    color: var(--gold);
    font-size: 18px;
    margin-bottom: 4px;
}
.promo__text { font-size: 15px; margin-bottom: 10px; }
.promo__prices { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.promo__old {
    color: var(--muted);
    text-decoration: line-through;
    font-size: 15px;
}
.promo__new {
    color: var(--gold);
    font-size: 24px;
    font-weight: 700;
    font-family: Georgia, serif;
}
.promo__note {
    display: inline-block;
    margin-left: auto;
    background: var(--terra);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    letter-spacing: .03em;
}

/* ===================== ЛИПКАЯ ПАНЕЛЬ КАТЕГОРИЙ ===================== */
.cats {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(30, 23, 16, .96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    margin-top: 14px;
}
.cats__track {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 14px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.cats__track::-webkit-scrollbar { display: none; }
.cat-chip {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--card);
    border: 1px solid transparent;
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
    transition: color .2s, border-color .2s, background .2s;
}
.cat-chip__icon { font-size: 17px; }
.cat-chip.active {
    color: var(--gold);
    border-color: var(--gold-soft);
    background: #2E2214;
    font-weight: 600;
}

/* ===================== ПОИСК ===================== */
.search { padding: 12px 14px 0; }
.search__box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 14px;
    min-height: 46px;
}
.search__icon { font-size: 15px; opacity: .8; }
.search__input {
    flex: 1;
    background: none;
    border: 0;
    outline: 0;
    color: var(--text);
    min-height: 46px;
    font-size: 16px; /* против зума на iOS */
}
.search__input::placeholder { color: var(--muted); }
.search__input::-webkit-search-cancel-button { display: none; }
.search__clear {
    color: var(--muted);
    font-size: 15px;
    min-width: 44px;
    min-height: 44px;
}

/* Результаты поиска */
.search-results { padding: 10px 14px 0; }
.search-results__title {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin: 6px 0 10px;
}
.search-results mark {
    background: var(--gold-soft);
    color: var(--gold);
    border-radius: 3px;
    padding: 0 1px;
}
.search-results__empty { color: var(--muted); padding: 16px 4px; }

/* ===================== СЕКЦИИ МЕНЮ ===================== */
.menu { padding-bottom: 8px; }
.menu__section { padding: 20px 14px 0; scroll-margin-top: 64px; }
.menu__section-title {
    font-family: Georgia, serif;
    font-size: 21px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.menu__section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--line), transparent);
}
.menu__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 430px) {
    .menu__grid { grid-template-columns: 1fr 1fr; }
    /* Плоский список результатов поиска — всегда в одну колонку */
    .search-results .menu__grid { grid-template-columns: 1fr; }
}

/* ===================== КАРТОЧКА БЛЮДА ===================== */
.dish {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .15s ease, border-color .2s;
    position: relative;
}
.dish:active { transform: scale(.985); }
.dish__photo {
    position: relative;
    aspect-ratio: 3 / 2;
    background: var(--card-2);
    overflow: hidden;
}
.dish__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* Элегантный плейсхолдер, если нет фото */
.dish__placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(201, 162, 75, .12), transparent 70%),
        var(--card-2);
    color: var(--gold);
}
.dish__placeholder span:first-child { font-size: 34px; opacity: .9; }
.dish__placeholder span:last-child {
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
}
.dish__body {
    padding: 12px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}
.dish__name {
    font-size: 15.5px;
    font-weight: 600;
    line-height: 1.3;
}
.dish__desc {
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.dish__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
}
.dish__weight { color: var(--muted); font-size: 12px; }
.dish__price {
    color: var(--gold);
    font-family: Georgia, serif;
    font-size: 19px;
    font-weight: 700;
    white-space: nowrap;
}
.dish__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    background: rgba(22, 17, 13, .85);
    border: 1px solid var(--gold-soft);
    color: var(--gold);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .03em;
    padding: 4px 10px;
    border-radius: 999px;
    backdrop-filter: blur(4px);
}
.dish__add {
    margin: 4px 12px 12px;
    min-height: 44px;
    border-radius: var(--radius-sm);
    background: var(--terra);
    color: var(--text);
    font-weight: 600;
    font-size: 15px;
    transition: background .2s, opacity .2s;
}
.dish__add:active { background: var(--terra-hi); }
.dish__add[disabled] {
    background: #3A2E22;
    color: var(--muted);
    cursor: not-allowed;
}
/* Состояние «в корзине»: счётчик на кнопке */
.dish__add.in-cart { background: #3E2C1B; border: 1px solid var(--terra); }

/* Нет в наличии (режим dim) */
.dish--out .dish__photo img,
.dish--out .dish__placeholder { filter: grayscale(.7) brightness(.55); }
.dish--out .dish__body { opacity: .55; }
.dish__out {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    background: rgba(22, 17, 13, .9);
    color: var(--muted);
    border: 1px solid var(--line);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    padding: 4px 10px;
    border-radius: 999px;
}

/* ===================== МОДАЛКА БЛЮДА ===================== */
.dish-modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
.dish-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 7, 5, .75);
    backdrop-filter: blur(3px);
}
.dish-modal__card {
    position: relative;
    width: 100%;
    max-width: var(--app-w);
    max-height: 92vh;
    overflow-y: auto;
    background: var(--bg-2);
    border-radius: 20px 20px 0 0;
    border: 1px solid var(--line);
    border-bottom: 0;
    animation: sheetUp .25s ease;
}
@media (min-width: 600px) {
    .dish-modal { align-items: center; }
    .dish-modal__card { border-radius: 20px; border-bottom: 1px solid var(--line); margin: 20px; }
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.dish-modal__photo {
    position: relative;
    aspect-ratio: 3 / 2;
    background: var(--card-2);
}
.dish-modal__photo img { width: 100%; height: 100%; object-fit: cover; }
.dish-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(22, 17, 13, .8);
    color: var(--text);
    font-size: 17px;
    border: 1px solid var(--line);
}
.dish-modal__body { padding: 18px 18px 24px; display: flex; flex-direction: column; gap: 10px; }
.dish-modal__name { font-family: Georgia, serif; font-size: 22px; }
.dish-modal__desc { color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.dish-modal__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dish-modal__weight { color: var(--muted); font-size: 13px; }
.dish-modal__price { color: var(--gold); font-family: Georgia, serif; font-size: 26px; font-weight: 700; }
.dish-modal__badge {
    align-self: flex-start;
    border: 1px solid var(--gold-soft);
    color: var(--gold);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 999px;
}
.dish-modal__add {
    min-height: 50px;
    border-radius: var(--radius-sm);
    background: var(--terra);
    font-weight: 700;
    font-size: 16px;
    margin-top: 6px;
}
.dish-modal__add:active { background: var(--terra-hi); }
.dish-modal__add[disabled] { background: #3A2E22; color: var(--muted); cursor: not-allowed; }

/* ===================== КОРЗИНА ===================== */
.cart-fab {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 18px;
    border-radius: 999px;
    background: var(--terra);
    color: var(--text);
    box-shadow: 0 8px 24px rgba(180, 85, 45, .45);
    font-weight: 700;
    font-size: 15px;
    animation: sheetUp .25s ease;
}
@media (min-width: 600px) {
    /* Привязка к колонке приложения на десктопе */
    .cart-fab { right: calc(50% - var(--app-w) / 2 + 16px); }
}
.cart-fab__icon { font-size: 18px; }
.cart-fab__badge {
    background: var(--bg);
    color: var(--gold);
    min-width: 24px;
    height: 24px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    padding: 0 6px;
}

.overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(10, 7, 5, .7);
}
.cart {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    width: 100%;
    max-width: var(--app-w);
    background: var(--bg-2);
    border-left: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    animation: cartIn .22s ease;
}
@media (min-width: 600px) {
    .cart { right: calc(50% - var(--app-w) / 2); }
}
@keyframes cartIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.cart__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--line);
}
.cart__head h2 { font-family: Georgia, serif; font-size: 20px; }
.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 16px;
}
.cart__body { flex: 1; overflow-y: auto; padding: 12px 16px; }
.cart__empty { color: var(--muted); text-align: center; padding: 48px 0; }
.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.cart-item__info { flex: 1; min-width: 0; }
.cart-item__name { font-size: 14.5px; font-weight: 600; }
.cart-item__price { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.cart-item__qty { display: flex; align-items: center; gap: 8px; }
.qty-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
}
.qty-btn:active { border-color: var(--gold); }
.cart-item__count { min-width: 22px; text-align: center; font-weight: 700; }
.cart-item__sum { min-width: 64px; text-align: right; color: var(--gold); font-weight: 700; font-size: 14.5px; }
.cart-item__del { color: var(--muted); font-size: 14px; width: 40px; height: 40px; }
.cart__foot { padding: 16px; border-top: 1px solid var(--line); }
.cart__total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
    font-size: 16px;
}
.cart__total b { color: var(--gold); font-family: Georgia, serif; font-size: 24px; }
.cart__order {
    width: 100%;
    min-height: 52px;
    border-radius: var(--radius-sm);
    background: var(--terra);
    color: var(--text);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: .05em;
}
.cart__order:active { background: var(--terra-hi); }

/* ===================== КОНТАКТЫ ===================== */
.contacts { padding: 28px 14px 8px; }
.contacts__card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 18px;
    box-shadow: var(--shadow);
}
.contacts__title {
    font-family: Georgia, serif;
    font-size: 20px;
    color: var(--gold);
    margin-bottom: 12px;
    text-align: center;
}
.contacts__line {
    display: flex;
    gap: 10px;
    padding: 7px 0;
    font-size: 14.5px;
    align-items: baseline;
}
.contacts__line span:first-child { flex: 0 0 auto; }
.contacts__line .muted { color: var(--muted); }
.contacts__btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}
.contact-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--card-2);
    color: var(--text);
    font-size: 14.5px;
    font-weight: 600;
    text-decoration: none;
    transition: border-color .2s;
}
.contact-btn:active { border-color: var(--gold); }
.contacts__map {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 50px;
    margin-top: 10px;
    border-radius: var(--radius-sm);
    background: var(--terra);
    color: var(--text);
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    letter-spacing: .04em;
}
.contacts__map:active { background: var(--terra-hi); }

/* ===================== FOOTER ===================== */
.footer { padding: 26px 14px 100px; text-align: center; color: var(--muted); font-size: 13px; }
.footer__ornament {
    height: 16px;
    background: var(--ornament) repeat-x center / auto 16px;
    opacity: .4;
    margin-bottom: 16px;
}

/* Скелетон загрузки */
.loading { padding: 60px 20px; text-align: center; color: var(--muted); }
.loading::after {
    content: "";
    display: block;
    width: 34px;
    height: 34px;
    margin: 16px auto 0;
    border-radius: 50%;
    border: 3px solid var(--line);
    border-top-color: var(--gold);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Уважение к reduced motion */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
