/* ================================================================
   RakDelivery — Premium Redesign (Mobile-First)
   Based on example.png design reference
   ================================================================ */

:root {
    /* Primary palette — inspired by premium delivery services */
    --red: #E53935;
    --red-dark: #C62828;
    --red-light: #FFEBEE;
    --red-subtle: #FFF5F5;

    /* Neutrals */
    --white: #FFFFFF;
    --bg: #F8F9FA;
    --gray-50: #F2F3F5;
    --gray-100: #E8EAED;
    --gray-200: #DADCE0;
    --gray-300: #BDC1C6;
    --gray-400: #9AA0A6;
    --gray-500: #80868B;
    --gray-600: #5F6368;
    --gray-700: #3C4043;
    --gray-800: #202124;
    --gray-900: #171717;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 12px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);
    --shadow-xl: 0 12px 40px rgba(0,0,0,0.1), 0 6px 20px rgba(0,0,0,0.06);

    /* Radii */
    --radius: 20px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --radius-pill: 9999px;

    /* Transitions */
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --max-width: 1320px;
    --header-height: 75px;
    --container-padding: 20px;
    --line: rgba(229, 57, 53, 0.20);
}

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    font-size: 125%;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--gray-800);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
    overflow-x: hidden;
}

a {
    color: var(--red);
    text-decoration: none;
    transition: var(--transition);
}
a:hover { color: var(--red-dark); }

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

/* Main — контейнер для декора */
.main {
    position: relative;
    overflow: hidden;
    min-height: 100dvh;
}

/* Поднимаем контент над декоративными элементами */
.main .container {
    position: relative;
    z-index: 3;
}

/* ================================================================
   HEADER — compact, clean, sticky
   ================================================================ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.92);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    gap: 10px;
}

.logo {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--gray-900);
    text-decoration: none;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.logo:hover { color: var(--red); }

.header__nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ================================================================
   BUTTONS — modern, rounded, minimal
   ================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    border-radius: 12px;
    transition: var(--transition);
    font-family: inherit;
    line-height: 1;
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
}

.btn--primary {
    background: var(--red);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(229,57,53,0.25);
}
.btn--primary:hover {
    background: var(--red-dark);
    box-shadow: 0 4px 12px rgba(229,57,53,0.35);
    transform: translateY(-1px);
}
.btn--primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(229,57,53,0.2);
}

.btn--outline {
    background: transparent;
    border: 1.6px solid #878787;
    color: var(--gray-700);
}
.btn--outline:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--red-subtle);
}

.btn--icon {
    padding: 10px;
    background: transparent;
    border: none;
    color: var(--gray-600);
    position: relative;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn--icon:hover {
    background: var(--gray-50);
    color: var(--red);
}

.btn--full {
    width: 100%;
    padding: 16px 24px;
    font-size: 1rem;
}

.btn--sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* ================================================================
   HERO — premium layout with visual (MOBILE)
   ================================================================ */
.hero {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    gap: 24px;
    padding: 24px 0 16px;
    min-height: auto;
}

.hero__copy {
    position: relative;
    z-index: 2;
}

.hero__title {
    font-size: 1.65rem;
    font-weight: 800;
    margin: 0;
    line-height: 0.99;
    color: var(--gray-900);
    letter-spacing: -0.04em;
    max-width: 760px;
}

.hero__title em {
    color: var(--red);
    font-style: normal;
}

.hero__subtitle {
    max-width: 570px;
    margin: 12px 0 0;
    color: var(--gray-500);
    font-size: 0.75rem;
    line-height: 1.55;
    font-weight: 400;
}

/* Hero visual — изображение в органической форме */
.hero__visual {
    display: none;
    position: relative;
    min-height: 340px;
    place-items: center;
}

.hero__image-wrap {
    position: relative;
    width: min(750px, 100%);
    aspect-ratio: 1.25;
    transform: rotate(1deg);
    z-index: 2;
}

.hero__image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.08))
            drop-shadow(0 18px 40px rgba(0,0,0,0.12))
            drop-shadow(0 40px 80px rgba(0,0,0,0.08));
}

/* Фильтры — под hero */
.hero__filters {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    margin: 20px calc(-1 * var(--container-padding)) 20px;
    padding: 0 var(--container-padding);
}
.hero__filters::-webkit-scrollbar { display: none; }

.filter-btn {
    flex-shrink: 0;
    padding: 9px 18px;
    border-radius: var(--radius-pill);
    border: 1px solid #e8e9eb;
    background: var(--white);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    color: var(--gray-500);
    white-space: nowrap;
}
.filter-btn:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--red-subtle);
}
.filter-btn.active {
    background: var(--red);
    color: var(--white);
    border-color: var(--red);
    box-shadow: 0 2px 8px rgba(229,57,53,0.2);
}

/* ================================================================
   DECORATIVE DOTS — точечки рядом с фото в hero
   ================================================================ */
.hero__dots {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.hero__dot {
    position: absolute;
    border-radius: 50%;
    opacity: 0.82;
}

/* Размеры — чуть уменьшили */
.hero__dot--xs { width: 8px; height: 8px; }
.hero__dot--sm { width: 13px; height: 13px; }
.hero__dot--md { width: 18px; height: 18px; }

/* Цвета */
.hero__dot--red { background: #E53935; }
.hero__dot--teal { background: #8f5e25; }
.hero__dot--orange { background: #FF8A65; }
.hero__dot--pink { background: #EC407A; }
.hero__dot--gold { background: #FFB74D; }

/* Пустые (пончики) — только обводка */
.hero__dot--hollow {
    background: transparent !important;
    border-style: solid;
    border-width: 2.5px;
}
.hero__dot--hollow.hero__dot--red { border-color: #E53935; }
.hero__dot--hollow.hero__dot--teal { border-color: #8f5e25; }
.hero__dot--hollow.hero__dot--orange { border-color: #FF8A65; }
.hero__dot--hollow.hero__dot--pink { border-color: #EC407A; }
.hero__dot--hollow.hero__dot--gold { border-color: #FFB74D; }

/* Позиционирование — хаотичный разлёт от фото (брызги)
   Основные кластеры: верх-левый угол и низ-правый угол
   Случайные разбросы для ощущения, что частицы разлетаются */
.hero__dot:nth-child(1)  { top: 10%;   left: 10%; }
.hero__dot:nth-child(2)  { top: 10%;  left: 25%; }
.hero__dot:nth-child(3)  { top: 1%;   left: 14%; }
.hero__dot:nth-child(4)  { top: 17%;  left: 15%; }
.hero__dot:nth-child(5)  { bottom: 4%;  right: 3%; }
.hero__dot:nth-child(6)  { bottom: 1%;  right: 21%; }
.hero__dot:nth-child(7)  { bottom: 18%; right: 5%; }
.hero__dot:nth-child(8)  { bottom: 8%;  right: 13%; }
.hero__dot:nth-child(9)  { top: 6%;   left: 20%; }
.hero__dot:nth-child(10) { bottom: 14%; right: 20%; }
.hero__dot:nth-child(11) { top: 15%;  left: 22%; }
.hero__dot:nth-child(12) { top: 1%;   left: 28%; }
.hero__dot:nth-child(13) { bottom: 10%; right: 9%; }
.hero__dot:nth-child(14) { bottom: 25%; right: 25%; }
.hero__dot:nth-child(15) { top: 8%;   left: 3%; }

/* ================================================================
   DECOR — декоративные элементы фона (волны, точки, круги)
   ================================================================ */
.decor {
    pointer-events: none;
    position: absolute;
    z-index: 0;
}

/* Волны — плавные каллиграфические линии (как на референсе waves.png)
   Используем SVG-пути с несколькими параллельными штрихами для
   эффекта "мокрой кисти" — разной толщины и прозрачности */
.decor-wave {
    position: absolute;
    z-index: 0;
    pointer-events: none;
    opacity: 0.45;
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

/* Волна 1 — правый верх, за раками: изящная S-кривая справа налево */
.decor-wave-1 {
    top: 80px;
    left: -250px;
    width: 800px;
    height: 260px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 260'%3E%3Cpath d='M800,200 C710,50 570,240 400,130 C250,30 130,230 0,90' stroke='rgba(229,57,53,0.06)' stroke-width='28' fill='none' stroke-linecap='round'/%3E%3Cpath d='M800,200 C710,50 570,240 400,130 C250,30 130,230 0,90' stroke='rgba(229,57,53,0.18)' stroke-width='7' fill='none' stroke-linecap='round'/%3E%3Cpath d='M800,200 C710,50 570,240 400,130 C250,30 130,230 0,90' stroke='rgba(229,57,53,0.09)' stroke-width='2.5' fill='none' stroke-linecap='round'/%3E%3Cpath d='M800,190 C720,60 560,230 390,140 C260,40 120,220 10,100' stroke='rgba(229,57,53,0.05)' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}
/* Акцент-линии через псевдоэлементы для дополнительной хаотичности */
.decor-wave-1::before {
    content: '';
    position: absolute;
    inset: -8px 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 260'%3E%3Cpath d='M800,215 C680,80 550,260 380,110 C240,-10 110,250 10,70' stroke='rgba(229,57,53,0.07)' stroke-width='2' fill='none' stroke-linecap='round' stroke-dasharray='60 180 90 250 40 120'/%3E%3C/svg%3E") no-repeat center/100% 100%;
    pointer-events: none;
}
.decor-wave-1::after {
    content: '';
    position: absolute;
    inset: 12px 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 260'%3E%3Cpath d='M800,185 C690,30 580,260 410,150 C270,50 140,210 20,110' stroke='rgba(229,57,53,0.05)' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-dasharray='200 90 300 60 150 40'/%3E%3C/svg%3E") no-repeat center/100% 100%;
    pointer-events: none;
}

.decor-wave-2 {
    bottom: 20px;
    left: -350px;
    width: 200px;
    height: 60px;
    opacity: 0.1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 60'%3E%3Cpath d='M0,30 C25,5 50,55 75,30 C100,5 125,55 150,30 C175,5 200,55 220,30' stroke='rgba(229,57,53,0.12)' stroke-width='14' fill='none' stroke-linecap='round'/%3E%3Cpath d='M0,30 C25,5 50,55 75,30 C100,5 125,55 150,30 C175,5 200,55 220,30' stroke='rgba(229,57,53,0.25)' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* Волна 3 — правая нижняя, за карточками товаров */
.decor-wave-3 {
    top: 820px;
    right: -480px;
    width: 1100px;
    height: 400px;
    opacity: 0.3;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1100 400'%3E%3Cpath d='M-80,300 C120,70 320,390 500,200 C680,10 880,370 1080,160 C1200,60 1320,260 1400,130' stroke='rgba(229,57,53,0.04)' stroke-width='36' fill='none' stroke-linecap='round'/%3E%3Cpath d='M-80,300 C120,70 320,390 500,200 C680,10 880,370 1080,160 C1200,60 1320,260 1400,130' stroke='rgba(229,57,53,0.12)' stroke-width='6' fill='none' stroke-linecap='round'/%3E%3Cpath d='M-80,300 C120,70 320,390 500,200 C680,10 880,370 1080,160 C1200,60 1320,260 1400,130' stroke='rgba(229,57,53,0.06)' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}
.decor-wave-3::before {
    content: '';
    position: absolute;
    inset: -12px 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1100 400'%3E%3Cpath d='M-80,280 C130,90 310,370 490,220 C690,30 870,350 1090,180 C1210,80 1310,240 1400,150' stroke='rgba(229,57,53,0.05)' stroke-width='2' fill='none' stroke-linecap='round' stroke-dasharray='100 250 70 300 200 60'/%3E%3C/svg%3E") no-repeat center/100% 100%;
    pointer-events: none;
}

/* Волна 5 — чуть заметна, самый низ слева */
.decor-wave-5 {
    bottom: 90px;
    left: -370px;
    width: 200px;
    height: 60px;
    opacity: 0.1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 60'%3E%3Cpath d='M0,30 C25,5 50,55 75,30 C100,5 125,55 150,30 C175,5 200,55 220,30' stroke='rgba(229,57,53,0.12)' stroke-width='14' fill='none' stroke-linecap='round'/%3E%3Cpath d='M0,30 C25,5 50,55 75,30 C100,5 125,55 150,30 C175,5 200,55 220,30' stroke='rgba(229,57,53,0.25)' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* Большие акцентные точки */
.big-dot {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #cc524f;
    opacity: 0.85;
}

.big-dot-1 {
    top: 520px;
    left: -24px;
}

.big-dot-2 {
    top: 900px;
    right: 2%;
    width: 40px;
    height: 40px;
    opacity: 0.7;
}

/* Кластеры точек */
.dot-cluster {
    width: 100px;
    height: 100px;
    background-image: radial-gradient(var(--red) 2px, transparent 2.8px);
    background-size: 15px 15px;
    opacity: 0.25;
}

.dot-cluster-1 {
    top: 200px;
    right: 2%;
}

.dot-cluster-2 {
    top: 1020px;
    left: 1%;
}

/* ================================================================
   PRODUCT GRID — mobile: 1 column, tablet+: 2 columns, desktop: 3
   ================================================================ */
.products-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 0 0 40px;
}

.product-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    /* Стабильный размер до загрузки картинок */
    contain: layout style;
}
.product-card:hover {
    box-shadow: var(--shadow-xl);
    transform: scale(1.03);
}
.product-card:active {
    transform: scale(1.02);
}
@media (max-width: 767px) {
    .product-card:hover {
        transform: scale(1.02);
    }
}

.product-card__image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background: var(--gray-100);
    /* Плавное появление после загрузки */
    opacity: 0;
    transition: opacity 0.3s ease;
}
.product-card__image.loaded {
    opacity: 1;
}

.product-card__info {
    padding: 18px 20px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card__name {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--gray-800);
}

.product-card__weight,
.product-detail__weight {
    font-weight: 500;
    color: var(--gray-500);
    white-space: nowrap;
}

.product-card__weight {
    font-size: 1rem;
}

.product-detail__weight {
    font-size: 1.15rem;
}

.product-card__desc {
    font-size: 0.82rem;
    color: var(--gray-500);
    margin: 0 0 auto;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.3em;
}

.product-card__price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--red);
    margin-top: 10px;
}
.product-card__price-old {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-400);
    text-decoration: line-through;

}
.product-card__price-new {
    color: var(--red);
}

/* ================================================================
   CART SIDEBAR
   ================================================================ */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-slow);
}
.cart-overlay.open { opacity: 1; pointer-events: auto; }

.cart {
    position: fixed;
    top: 0;
    right: -100vw;
    width: 100vw;
    max-width: 480px;
    height: 100vh;
    height: 100dvh;
    background: var(--white);
    z-index: 201;
    display: flex;
    flex-direction: column;
    transition: right var(--transition-slow);
    box-shadow: -8px 0 40px rgba(0,0,0,0.1);
}
.cart.open { right: 0; }

.cart__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    flex-shrink: 0;
}
.cart__header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.cart__close {
    font-size: 1.6rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}
.cart__close:hover {
    background: var(--gray-50);
    color: var(--gray-700);
}

.cart__body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px;
    -webkit-overflow-scrolling: touch;
}

.cart__empty {
    color: var(--gray-400);
    text-align: center;
    padding: 60px 0;
    font-size: 0.95rem;
}

.cart__item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--gray-50);
}
.cart__item:last-child { border-bottom: none; }

.cart__item-info { flex: 1; min-width: 0; }
.cart__item-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-800);
}
.cart__item-desc {
    font-size: 0.78rem;
    color: var(--gray-400);
    margin-top: 2px;
}

.cart__item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.cart__qty-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1.5px solid var(--red);
    background: var(--white);
    color: var(--red);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.cart__qty-btn:hover { background: var(--red-light); }
.cart__qty-btn:active { transform: scale(0.92); }

.cart__qty {
    font-weight: 600;
    min-width: 24px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--gray-700);
}

.cart__item-price {
    font-weight: 700;
    color: var(--gray-800);
    white-space: nowrap;
    font-size: 0.95rem;
    align-self: center;
}

.cart__footer {
    padding: 16px 20px 20px;
    border-top: 1px solid var(--gray-100);
    flex-shrink: 0;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.cart__total {
    display: flex;
    justify-content: space-between;
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--gray-800);
}

.cart__bonus-row {
    margin-bottom: 12px;
}

.cart-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--red);
    color: var(--white);
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 6px rgba(229,57,53,0.3);
}

/* ================================================================
   MODAL SYSTEM
   ================================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-slow);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: translateY(100%);
    background: var(--white);
    border-radius: var(--radius) var(--radius) 0 0;
    z-index: 301;
    max-height: 85vh;
    max-height: 85dvh;
    overflow-y: auto;
    opacity: 1;
    pointer-events: none;
    transition: transform var(--transition-slow);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.12);
    -webkit-overflow-scrolling: touch;
}
.modal.open {
    transform: translateY(0);
    pointer-events: auto;
}

.modal--wide {
    max-width: 100%;
}

@media (min-width: 640px) {
    .modal {
        top: 50%;
        bottom: auto;
        left: 50%;
        right: auto;
        transform: translate(-50%, -50%) scale(0.95);
        width: 520px;
        max-width: calc(100vw - 48px);
        max-height: calc(100vh - 48px);
        border-radius: var(--radius);
        box-shadow: var(--shadow-xl);
        opacity: 0;
        transition: all var(--transition-slow);
    }
    .modal.open {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    .modal--wide { width: 960px; }
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--gray-100);
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 1;
    border-radius: inherit;
}
.modal__header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
}

.modal__close {
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}
.modal__close:hover {
    background: var(--gray-50);
    color: var(--gray-700);
}

.modal__body {
    padding: 20px;
}

.modal__switch {
    text-align: center;
    margin-top: 16px;
    font-size: 0.88rem;
    color: var(--gray-500);
}

.modal__info {
    text-align: center;
    margin: 0 0 20px;
    font-size: 0.92rem;
    color: var(--gray-600);
}

.modal__error {
    padding: 12px 16px;
    background: var(--red-light);
    color: var(--red-dark);
    border-radius: var(--radius-sm);
    margin-top: 16px;
    font-size: 0.88rem;
    text-align: center;
    border: 1px solid rgba(229,57,53,0.15);
}

/* ================================================================
   FORM ELEMENTS
   ================================================================ */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: var(--gray-600);
}
.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
    background: var(--white);
    color: var(--gray-800);
}
.form-group input:focus,
.form-group select:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(229,57,53,0.1);
}

.phone-input {
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 0 14px;
    transition: var(--transition);
    background: var(--white);
}
.phone-input:focus-within {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(229,57,53,0.1);
}
/* Убираем внутреннюю обводку у поля ввода внутри .phone-input,
   чтобы не было двойной рамки при фокусе */
.phone-input input:focus,
.phone-input input:focus-visible {
    outline: none;
    box-shadow: none;
}
/* Убираем внутреннюю обводку у поля ввода внутри .phone-input,
   чтобы не было двойной рамки при фокусе */
.phone-input input:focus,
.phone-input input:focus-visible {
    outline: none;
    box-shadow: none;
}
.phone-prefix {
    font-weight: 700;
    font-size: 1rem;
    color: var(--gray-700);
}
.phone-input input {
    flex: 1;
    border: none;
    padding: 12px 0;
    outline: none;
    font-size: 0.95rem;
    font-family: inherit;
    background: transparent;
}

/* ================================================================
   PRODUCT MODAL — detail view
   ================================================================ */
.product-detail {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media (min-width: 640px) {
    .product-detail {
        flex-direction: row;
        gap: 28px;
        align-items: stretch;
    }
}

.product-detail__image-wrap {
    position: relative;
    width: 100%;
    height: 260px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background-color: var(--gray-100);
    flex-shrink: 0;
}

@media (min-width: 640px) {
    .product-detail__image-wrap {
        width: 600px;
        height: 450px;
        flex: 0 0 600px;
    }
}

.product-detail__image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    -webkit-user-select: none;
    user-select: none;
}

/* Gallery navigation arrows */
.gallery__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.85);
    color: var(--gray-700);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    z-index: 2;
    padding: 0;
}
.gallery__arrow:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.08);
}
.gallery__arrow:active {
    transform: translateY(-50%) scale(0.95);
}
.gallery__arrow--prev { left: 10px; }
.gallery__arrow--next { right: 10px; }

.gallery__counter {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: var(--radius-pill);
    pointer-events: none;
    z-index: 2;
}

/* Swipe hint dots */
.gallery__dots {
    display: flex;
    gap: 6px;
    justify-content: center;
    padding: 6px 0 0;
}
.gallery__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gray-300);
    transition: background 0.2s;
}
.gallery__dot.active {
    background: var(--red);
    width: 18px;
    border-radius: 4px;
}
@media (min-width: 640px) {
    .gallery__dots { display: none; }
}

.product-detail__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.product-detail__info .btn--full {
    margin-top: auto;
}

@media (min-width: 640px) {
    .product-detail__info {
        padding: 4px 0;
    }
}

.product-detail__name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #3D2E2A;
    margin: 0;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.35;
}

.product-detail__name-text {
    flex: 1;
    min-width: 0;
}

/* Ingredients info button — ⓘ next to name */
.ingredients-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: var(--gray-200);
    color: var(--gray-500);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
    padding: 0;
    line-height: 1;
    margin-top: 6px;
}
.ingredients-btn:hover {
    background: var(--red);
    color: #fff;
}

.product-detail__desc {
    color: var(--gray-500);
    font-size: 0.85rem;
    margin: 6px 0 0;
    line-height: 1.45;
}

/* Ingredients popup */
.ingredients-popup {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.ingredients-popup__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.ingredients-popup__body {
    position: relative;
    max-width: 400px;
    width: 100%;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.25);
    overflow: hidden;
}
.ingredients-popup__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    font-weight: 700;
    font-size: 1rem;
    color: #3D2E2A;
    border-bottom: 1px solid var(--gray-100);
}
.ingredients-popup__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-400);
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
    padding: 0;
    line-height: 1;
}
.ingredients-popup__close:hover {
    background: var(--gray-50);
    color: var(--gray-700);
}
.ingredients-popup__content {
    padding: 18px 22px 22px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--gray-700);
}

/* Variants section */
.product-detail__variants-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 20px;
}

.variant-list__header {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--gray-500);
    margin: 0;
    line-height: 1.35;
}

.variant-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 0;
}

.variant-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}
.variant-item:hover {
    border-color: var(--red);
    background: var(--red-subtle);
}
.variant-item.selected {
    border-color: var(--red);
    background: var(--red-light);
    box-shadow: 0 0 0 1px var(--red);
}

.variant-item__size {
    font-weight: 600;
    font-size: 0.83rem;
    color: var(--gray-700);
    line-height: 1.35;
}
.variant-item__weight {
    font-size: 0.76rem;
    color: var(--gray-400);
    line-height: 1.3;
}
.variant-item__price {
    margin-left: auto;
    font-weight: 700;
    color: var(--red);
    font-size: 0.88rem;
    line-height: 1.3;
}
.variant-item__price-old {
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--gray-400);
    text-decoration: line-through;
    margin-right: 4px;
}
.variant-item__price-new {
    font-weight: 700;
    color: var(--red);
}

/* Nutrition */
.nutrition-table {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 16px 0;
}

@media (min-width: 640px) {
    .nutrition-table {
        grid-template-columns: repeat(4, 1fr);
    }
}

.nutrition-item {
    background: var(--gray-50);
    padding: 10px 8px;
    border-radius: var(--radius-sm);
    text-align: center;
}
.nutrition-item__value {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--gray-800);
}
.nutrition-item__label {
    font-size: 0.72rem;
    color: var(--gray-400);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ================================================================
   BONUS
   ================================================================ */
.bonus-balance {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--red);
    text-align: center;
    padding: 24px 0;
    letter-spacing: -0.02em;
}

.bonus-history {
    margin-top: 16px;
}

.bonus-tx {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-50);
    font-size: 0.88rem;
}
.bonus-tx:last-child { border-bottom: none; }

.bonus-tx__reason {
    color: var(--gray-400);
    font-size: 0.78rem;
    margin-top: 2px;
}

.bonus-tx__amount {
    font-weight: 700;
    flex-shrink: 0;
}
.bonus-tx__amount.positive { color: #2E7D32; }
.bonus-tx__amount.negative { color: var(--red); }

/* ================================================================
   ORDER CARDS
   ================================================================ */
.order-card {
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    padding: 16px;
    border: 1px solid var(--gray-100);
}

.order-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.order-card__id {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--gray-700);
}

.order-card__status {
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
}
.order-card__status.PROCESSING {
    background: #FFF3E0;
    color: #E65100;
}
.order-card__status.COMPLETED {
    background: #E8F5E9;
    color: #2E7D32;
}
.order-card__status.CANCELLED {
    background: var(--red-light);
    color: var(--red-dark);
}

.order-card__items {
    font-size: 0.82rem;
    color: var(--gray-500);
    margin-bottom: 8px;
    line-height: 1.4;
}

.order-card__total {
    font-weight: 700;
    color: var(--gray-800);
    font-size: 0.95rem;
}

.order-card__date {
    font-size: 0.78rem;
    color: var(--gray-400);
    margin-top: 4px;
}

.order-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}
.order-card-link + .order-card-link {
    margin-top: 12px;
}
.order-card-link:hover .order-card {
    box-shadow: var(--shadow-md, 0 4px 16px rgba(0,0,0,0.08));
    transform: translateY(-1px);
}
.order-card-link:active .order-card {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* ================================================================
   DROPDOWN (profile menu)
   ================================================================ */
.dropdown {
    position: absolute;
    top: calc(var(--header-height) - 4px);
    right: var(--container-padding);
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-xl);
    z-index: 150;
    min-width: 200px;
    overflow: hidden;
    border: 1px solid var(--gray-100);
    animation: dropdownIn 0.15s ease;
}

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dropdown__item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--gray-700);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}
.dropdown__item:hover { background: var(--gray-50); }
.dropdown__item--danger { color: var(--red); }
.dropdown__item--danger:hover { background: var(--red-light); }
.dropdown__divider { height: 1px; background: var(--gray-100); }

/* ================================================================
   TOAST NOTIFICATION
   ================================================================ */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--gray-800);
    color: var(--white);
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    font-size: 0.88rem;
    font-weight: 500;
    opacity: 0;
    transition: all var(--transition-slow);
    z-index: 400;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
    max-width: calc(100vw - 32px);
    text-align: center;
    white-space: nowrap;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ================================================================
   CHECKBOX
   ================================================================ */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    cursor: pointer;
    color: var(--gray-600);
}
.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--red);
    cursor: pointer;
}

/* ================================================================
   LOADER
   ================================================================ */
.loader {
    text-align: center;
    padding: 48px 0;
    color: var(--gray-400);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.loader::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--gray-200);
    border-top-color: var(--red);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 639px) {
    .product-detail__variants-group {
        margin-bottom: 25px;
    }
}

/* ================================================================
   RESPONSIVE — Tablet ($768px+)
   ================================================================ */


@media (min-width: 768px) {
    :root {
        --container-padding: 28px;
    }

    .header__inner {
        height: 82px;
    }

    .logo {
        font-size: 1.5rem;
    }

    /* Hero — две колонки на планшете */
    .hero {
        grid-template-columns: 0.9fr 1.1fr;
        gap: 36px;
        padding: 60px 0 36px;
        min-height: 520px;
    }

    .hero__copy {
        text-align: left;
    }

    .hero__title {
        font-size: 2.6rem;
    }

    .hero__subtitle {
        font-size: 0.85rem;
        margin-top: 18px;
    }

    .hero__visual {
        display: grid;
        min-height: 480px;
    }

    .hero__image-wrap {
        width: min(875px, 100%);
    }

    .hero__filters {
        justify-content: center;
        overflow-x: visible;
        flex-wrap: wrap;
        margin-bottom: 32px;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .product-card__image {
        height: 240px;
    }

    .modal {
        border-radius: var(--radius);
    }

    .btn--icon {
        width: 50px;
        height: 50px;
    }

    /* Декор — крупнее */
    .decor-wave {
        width: 1000px;
    }
    .decor-wave-1 {
        right: -340px;
        top: 80px;
        left: auto;
    }
    .decor-wave-2 {
        bottom: 1525px;
        left: 50px;
        width: 380px;
        height: 90px;
        opacity: 0.1;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 60'%3E%3Cpath d='M0,30 C25,5 50,55 75,30 C100,5 125,55 150,30 C175,5 200,55 220,30' stroke='rgba(229,57,53,0.12)' stroke-width='14' fill='none' stroke-linecap='round'/%3E%3Cpath d='M0,30 C25,5 50,55 75,30 C100,5 125,55 150,30 C175,5 200,55 220,30' stroke='rgba(229,57,53,0.25)' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    }

    .decor-wave-3 {
        top: 940px;
        right: -650px;
        width: 1400px;
    }
    .big-dot-1 {
        width: 90px;
        height: 90px;
        left: -32px;
        top: 590px;
        background: var(--red);
    }

    .big-dot-2 {
        width: 48px;
        height: 48px;
        top: 1010px;
    }
    .dot-cluster {
        width: 120px;
        height: 120px;
        opacity: 0.32;
    }
    .dot-cluster-1 {
        top: 70px;
    }
    .dot-cluster-2 {
        top: 1150px;
    }
    .decor-wave {
        opacity: 1;
    }
}

/* ================================================================
   RESPONSIVE — Desktop ($1024px+)
   ================================================================ */
@media (min-width: 1024px) {
    :root {
        --container-padding: 32px;
    }

    .header__inner {
        height: 88px;
    }

    .hero {
        grid-template-columns: 0.8fr 1.2fr;
        gap: 48px;
        padding: 62px 0 24px;
    }

    .hero__title {
        font-size: clamp(2.8rem, 5vw, 3.8rem);
    }

    .hero__visual {
        display: grid;
        min-height: 520px;
    }

    .hero__image-wrap {
        width: min(975px, 100%);
    }

    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }

    .product-card__image {
        height: 260px;
    }
}