/*
 * Custom CSS for Medok website with mobile optimisations.
 * This file is based on the original styles.css from the med_ok repository.
 * It includes several improvements for mobile devices:
 *   - Larger tappable area for the burger menu (44×44 px and centred bars).
 *   - Reduced hero section height and more flexible heading sizes on small screens.
 *   - Smaller gaps in the products grid and additional padding within cards on mobile.
 *   - Restored sticky CTA for mobile with a fixed bar at the bottom of the screen.
 */

:root {
    --bg: #fffdf7;
    --ink: #1b1b1b;
    --muted: #6b6b6b;
    --brand: #087B04;
    --brand-dark: #066603;
    --accent: #f4b400;
    --card: #ffffff;
    --shadow: 0 8px 24px rgba(0, 0, 0, .08);
    --radius: 16px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ===== БАЗА ===== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.55;
    /* Прибираємо горизонтальний скрол */
    max-width: 100%;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
input, select, textarea { font-size: 16px; } /* iOS fix */

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.container { max-width: 1100px; margin: 0 auto; padding: 20px; }

/* ===== ВЕЛИКИЙ ЛИПКИЙ ХЕДЕР (НОВИЙ) ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    height: 90px;     /* ЗБІЛЬШЕНА висота */
    background: rgba(255, 253, 247, 0.98);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    transition: height 0.3s;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Логотип */
.header-logo img {
    height: 55px; /* Більший логотип */
    width: auto;
    display: block;
    transition: transform 0.2s;
}
.header-logo:hover img { transform: scale(1.05); }

/* Навігація (Desktop) */
.header-nav {
    display: flex;
    gap: 24px;
}
.header-link {
    font-size: 16px;
    font-weight: 600;
    color: #1b1b1b;
    padding: 10px 15px;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}
.header-link:hover {
    background: rgba(8, 123, 4, 0.08);
    color: #087B04;
}

/* Права частина */
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Кнопка "Замовити" */
.btn-header-cta {
    background: #087B04;
    color: white !important;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 15px;
    box-shadow: 0 4px 15px rgba(8, 123, 4, 0.3);
    transition: transform 0.2s, background 0.2s;
    display: inline-flex; align-items: center; justify-content: center;
}
.btn-header-cta:hover {
    background: #066603;
    transform: translateY(-2px);
}

/* Іконка кошика */
.cart-icon-btn {
    width: 48px; height: 48px;
    background: #fff;
    border: 2px solid #eee;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    cursor: pointer;
    position: relative;
    transition: border-color 0.2s;
}
.cart-icon-btn:hover { border-color: #087B04; color: #087B04; }
.cart-badge {
    position: absolute; top: -5px; right: -5px;
    background: #f4b400; color: #000;
    font-size: 12px; font-weight: 800;
    padding: 2px 6px; border-radius: 10px;
    border: 2px solid #fff;
}

/* Бургер (Мобільний) */
.burger-menu {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    /* Збільшене клікабельне поле */
    padding: 10px;
    width: 44px;
    height: 44px;
    justify-content: center;
    align-items: center;
}
.burger-menu span {
    display: block;
    width: 24px;
    height: 3px;
    background: #1b1b1b;
    border-radius: 3px;
}

/* АДАПТИВНІСТЬ ХЕДЕРА */
@media (max-width: 900px) {
    .header-nav { display: none; }
    .btn-header-cta { display: none; }
    .burger-menu { display: flex; }

    .site-header { height: 70px; } /* Трохи менше на мобільному */
    .header-logo img { height: 40px; }
}

/* Мобільне меню (Drawer) */
.mobile-nav-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 1001; opacity: 0; pointer-events: none; transition: 0.3s;
}
.mobile-nav-overlay.active { opacity: 1; pointer-events: auto; }

.mobile-nav-drawer {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 280px; background: #fff; z-index: 1002;
    padding: 25px; display: flex; flex-direction: column; gap: 20px;
    transform: translateX(100%); transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -5px 0 20px rgba(0,0,0,0.1);
}
.mobile-nav-drawer.active { transform: translateX(0); }

.mobile-link {
    font-size: 18px; font-weight: 600; padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}


/* ===== КАРТКИ / ГРИД ===== */
.card { background: var(--card); border: 1px solid #eee; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.col-12 { grid-column: span 12; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }
@media(max-width:900px){ .col-6, .col-4 { grid-column: span 12; } }

/* ===== HERO ===== */
.hero-slider { position: relative; min-height: 65vh; overflow: hidden; }
.slide {
    position: absolute; inset: 0; display: grid; grid-template-columns: 1fr; align-items: center;
    gap: 24px; padding: 24px 20px; opacity: 0; transform: translateX(6%);
    transition: opacity .55s ease, transform .6s ease; color: #fff;
    background-size: cover; background-position: center; background-repeat: no-repeat; --mask: .22;
}
.slide.active { opacity: 1; transform: translateX(0); }
.slide .left { max-width: 820px; margin-left: clamp(8px,6vw,80px); position: relative; z-index: 2; }
.slide .left::before {
    content: ""; position: absolute; inset: -10px -14px -10px -14px; z-index: -1;
    background: radial-gradient(600px 300px at 0% 10%, rgba(0,0,0,.18), transparent 60%);
    filter: saturate(.9) contrast(.95); border-radius: 22px;
}
.bigword {
    font-weight: 900; line-height: .92; letter-spacing: .01em;
    font-size: clamp(46px, 16vw, 200px); margin: 0 0 10px 0; color: #fff;
    text-shadow: 0 10px 30px rgba(0,0,0,.60), 0 3px 8px rgba(0,0,0,.70);
}
/* Mobile adjustments for hero */
@media (max-width: 480px){
    .bigword {
        font-size: clamp(28px, 10vw, 56px);
        line-height: .95;
        max-width: 92vw;
        word-break: break-word;
        hyphens: auto;
    }
    .subtitle {
        font-size: clamp(14px, 4vw, 18px);
        max-width: 90vw;
    }
    .hero-slider {
        min-height: 60vh;
        padding-top: 40px;
        padding-bottom: 40px;
    }
}
.subtitle {
    font-size: clamp(16px, 2.2vw, 28px); font-weight: 600; margin: 14px 0 18px; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.65);
}
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-actions .ghost {
    background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28);
    border-radius: 999px; padding: 12px 16px; display: inline-flex; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.6);
}
.slide[data-flavor="acacia"]    { background-image: url("assets/hero-acacia.webp");    --mask: .22; }
.slide[data-flavor="linden"]    { background-image: url("assets/hero-linden.webp");    --mask: .22; }
.slide[data-flavor="sunflower"] { background-image: url("assets/hero-sunflower.webp"); --mask: .24; }

.slide::before {
    content: ""; position: absolute; inset: 0;
    background:
            radial-gradient(1200px 500px at 20% 30%, rgba(0,0,0,.12), transparent 60%),
            radial-gradient(800px 400px at 90% 80%, rgba(0,0,0,.20), transparent 60%),
            rgba(0,0,0,var(--mask));
    pointer-events: none;
}
.navbtn {
    position: absolute; bottom: calc(18px + var(--safe-bottom));
    width: 58px; height: 58px; border-radius: 999px; border: 1px solid rgba(255,255,255,.38);
    background: rgba(0,0,0,.28); display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(4px);
    color: #fff; font-size: 28px; z-index: 6; box-shadow: 0 8px 18px rgba(0,0,0,.25);
}
.navbtn.prev { left: clamp(8px,2vw,22px); } .navbtn.next { right: clamp(8px,2vw,22px); }
.navbtn:active { transform: scale(.98); }
.hero-cta {
    position: absolute; left: 50%; transform: translateX(-50%);
    bottom: calc(30px + var(--safe-bottom));
    display: inline-block; white-space: nowrap;
    background: var(--brand); color: #fff; font-weight: 800; padding: 16px 26px; border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0,0,0,.24); transition: background .15s ease, transform .15s ease;
}
.hero-cta:hover { background: var(--accent); transform: translateX(-50%); }
.hero-cta:active { transform: translateX(-50%) scale(.98); }

/* ===== PRODUCTS GRID ===== */
.products-grid { display: flex; justify-content: center; align-items: stretch; gap: 24px; }
.products-grid .product-card { flex: 0 0 350px; max-width: 380px; }
@media (max-width: 1024px){
    .products-grid { flex-wrap: wrap; }
    .products-grid .product-card { flex: 0 0 calc(50% - 16px); max-width: calc(50% - 16px); }
}
@media (max-width: 640px){
    .products-grid { gap: 16px; }
    .products-grid .product-card { flex: 0 0 100%; max-width: 100%; }
    .product-body { padding: 20px 16px; }
}

.product-card {
    background: var(--card); border: 1px solid #eee; border-radius: 16px; box-shadow: var(--shadow);
    overflow: hidden; transition: transform .25s cubic-bezier(.2,.7,.2,1), box-shadow .25s;
}
.prod-figure { position: relative; overflow: hidden; aspect-ratio: 4/3; }
@media (max-width:640px){ .prod-figure { aspect-ratio: 3/2; } }
.prod-img { width: 100%; height: 100%; object-fit: cover; display: block; transform: scale(1.02); transition: transform .6s ease; }
.badge { position: absolute; left: 10px; top: 10px; background: #1D9A18; color: #fff; font-weight: 800; font-size: 13px; padding: 7px 11px; border-radius: 999px; opacity: .92; animation: card-bob 3s ease-in-out infinite; }
.price-badge { position: absolute; right: 10px; top: 10px; background: var(--accent); color: #111; font-weight: 800; font-size: 13px; padding: 7px 11px; border-radius: 999px; opacity: .95; }
.product-body { padding: 18px 18px 20px; }
.product-title {
    margin: 0; font-size: clamp(18px, 2.2vw, 22px);
    background-image: linear-gradient(currentColor,currentColor);
    background-size: 0 2px; background-repeat: no-repeat; background-position: 0 100%;
    transition: background-size .35s ease;
}
.p-bullets { margin: 10px 0 14px; padding-left: 18px; color: var(--muted); }
.product-bottom { display: flex; justify-content: flex-end; }
.cta {
    display: inline-block; text-align: center; padding: 12px 18px; border-radius: 999px;
    background: var(--brand); color: #fff; font-weight: 800; transition: background .15s ease, transform .02s ease;
}
.cta.small { padding: 12px 18px; }
.cta:hover { background: var(--accent); }
@keyframes card-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.product-card:hover { transform: translateY(-3px) scale(1.008); box-shadow: 0 16px 40px rgba(0,0,0,.12); }
.product-card:hover .prod-img { transform: scale(1.06); }
.prod-figure::after {
    content: ""; position: absolute; inset: 0; background: radial-gradient(600px 200px at 10% -20%, rgba(255,255,255,.85), transparent 50%);
    transform: translateX(-70%); opacity: .28; pointer-events: none; transition: transform .9s ease;
}
.product-card:hover .prod-figure::after { transform: translateX(120%); }
.product-card:hover .product-title { background-size: 100% 2px; }
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .5s, transform .6s; }
.reveal.in { opacity: 1; transform: translateY(0); }
@media (hover: none), (pointer: coarse){
    .product-card { transform: none !important; }
    .product-card:hover { transform: none; box-shadow: var(--shadow); }
    .product-card:hover .prod-img { transform: none; }
    .prod-figure::after { display: none; }
    .product-title { background-size: 0 2px !important; }
}

/* ===== FORMS & ORDER ===== */
form#order { display: grid; gap: 10px; }
input, select, textarea {
    width: 100%; padding: 12px; border-radius: 12px; border: 1px solid #ddd; background: #fff; font-size: 16px; line-height: 1.4;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(8,123,4,0.15); }
label { font-size: 14px; color: #333; font-weight: 600; margin-bottom: 4px; display: block; }
textarea { min-height: 96px; resize: vertical; }
.summary { margin: 12px 0 14px; background: #fafafa; padding: 15px; border-radius: 12px; }
.summary-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #eee; }
.summary-row:last-child { border-bottom: 0; }
.summary-row.total { font-weight: 800; font-size: 18px; color: var(--brand); margin-top: 6px; }
.actions { display: flex; justify-center; padding-top: 12px; }
.btn { display: inline-block; background: var(--brand); color: #fff; border-radius: 28px; padding: 12px 24px; font-weight: 800; border: none; cursor: pointer; transition: background .15s ease, transform .02s ease; width: 100%; font-size: 18px; }
.btn:hover { background: var(--accent); color: #111; }
.btn:active { transform: scale(.98); }
.radios { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 6px; }

/* ===== UTILITIES ===== */
.muted { color: var(--muted); }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .hidden { display: none; }
.toast { position: fixed; left: 50%; transform: translateX(-50%) translateY(20px); bottom: 24px; z-index: 2000; padding: 12px 20px; border-radius: 999px; background: #111; color: #fff; font-weight: 700; opacity: 0; pointer-events: none; box-shadow: 0 8px 24px rgba(0,0,0,.18); transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== QTY SELECTOR ===== */
#qtyMenu { position: fixed; inset: 0; z-index: 1200; display: none; }
#qtyMenu .qty-dialog { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); background: var(--card); border-radius: 16px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 20px; width: min(320px,92vw); }
#qtyMenu #qtyBackdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
#qtyMenu .qty-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
#qtyMenu .qty-head #qtyTitle { font-weight: 800; font-size: 20px; }
#qtyMenu .qty-stepper { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #eee; border-radius: 12px; padding: 8px 12px; background: #fff; margin-top: 8px; }
#qtyMenu .qty-step { width: 40px; height: 36px; border-radius: 10px; border: 1px solid #ddd; background: #fff; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 20px; }
#qtyMenu .qty-price { margin-top: 12px; text-align: right; font-weight: 700; font-size: 18px; color: var(--brand); }

/* ===== SECTIONS ===== */
.section-subtitle { margin-top: -8px; margin-bottom: 24px; font-size: 16px; color: var(--muted); font-style: italic; }

/* ABOUT */
.about-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 24px; align-items: center; }
.about-text { grid-column: span 6; background: var(--card); border: 1px solid #eee; border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.about-images { grid-column: span 6; display: grid; grid-template-columns: 60% 40%; grid-template-rows: 1fr 1fr; gap: 14px; }
.about-images img { width: 100%; height: 100%; object-fit: cover; border-radius: 18px; box-shadow: 0 8px 18px rgba(0,0,0,.08); }
.about-images img:first-child { grid-row: 1 / span 2; }
.years-counter #yearsCounter { font-size: clamp(32px,6vw,60px); font-weight: 900; color: var(--brand); }
@media (max-width:900px){ .about-text, .about-images { grid-column: span 12; } .about-images { margin-top: 20px; } }

/* WHY */
.why-grid { display: flex; gap: 24px; overflow-x: auto; padding-bottom: 14px; scroll-snap-type: x mandatory; }
.why-card { flex: 0 0 300px; background: var(--card); border: 1px solid #eee; border-radius: 16px; overflow: hidden; scroll-snap-align: start; box-shadow: var(--shadow); }
.why-img { height: 180px; width: 100%; object-fit: cover; }
.why-content { padding: 20px; }

/* ===== FOOTER ===== */
.footer { margin-top: 60px; background: linear-gradient(180deg, rgba(8,123,4,0.06) 0%, rgba(8,123,4,0.01) 60%, transparent 100%); border-top: 1px solid #e5e5e5; padding: 40px 0 24px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 30px; }
.footer-logo { display: block; height: 50px; margin-bottom: 12px; }
.footer-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chip { padding: 6px 12px; border-radius: 20px; background: rgba(8,123,4,.1); color: var(--brand-dark); font-weight: 700; font-size: 13px; }
.footer-col h4 { margin-bottom: 12px; }
.footer-col a { display: block; margin-bottom: 8px; font-weight: 600; color: #555; }
.footer-col a:hover { color: var(--brand); }
.footer-badge { display: inline-block; background: #111; color: #fff; padding: 8px 12px; border-radius: 8px; font-weight: 700; font-size: 13px; margin-top: 10px; }
.footer-bottom { margin-top: 40px; border-top: 1px solid #eee; padding-top: 20px; color: #777; font-size: 14px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* ===== EXTRAS ===== */
.mini-price { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.mini-price .pill { border-radius: 999px; padding: 6px 10px; background: #fff9e6; color: #111; font-weight: 700; font-size: 14px; }
#order.card { padding: 24px; }


@media (max-width: 640px) {
    .sticky-cta {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg);
        border-top: 1px solid #eee;
        padding: 12px 20px;
        align-items: center;
        gap: 12px;
        z-index: 1000;
    }
    .sticky-cta #stickyText {
        flex-grow: 1;
        font-size: 14px;
        font-weight: 600;
    }
    .sticky-cta .cta {
        padding: 10px 16px;
        font-size: 14px;
        border-radius: 24px;
    }
}
.field-error {
    border-color: #ff4d4d !important;
    background-color: #fff5f5 !important;
}
.error-text {
    color: #ff4d4d;
    font-size: 12px;
    margin-top: 4px;
    font-weight: 600;
}
