/* ==========================================================================
   Mobile layer (2026-11-22). Loaded after style.css; everything that changes
   the look lives inside @media (max-width: 980px), so the desktop version is
   not affected. Behaviour (sticky header, catalog in the menu, collapsible
   category text) is in tmpl1_assets/js/mobile.js.
   ========================================================================== */

/* Floating Telegram button: markup is in index.tpl.html, shown only on mobile. */
.fab-tg { display: none; }

@media (max-width: 980px) {

  /* ---------- base ---------- */
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body { -webkit-tap-highlight-color: rgba(184, 121, 30, 0.18); }
  html.mob-menu-open { overflow: hidden; }   /* only on html: overflow on body would break the sticky header */
  .wrap {
    font-size: 16px; line-height: 1.6;
    overflow-x: clip;               /* safety net: never a sideways scroll (clip keeps position:sticky working) */
    background-image: none;
  }
  .wrap input, .wrap select, .wrap textarea { font-size: 16px; } /* < 16px makes iOS zoom in on focus */

  /* ---------- header: compact, sticky search + menu bar ---------- */
  .hero-zone {
    position: sticky; top: var(--mob-stick, -220px); z-index: 60;
    box-shadow: 0 6px 18px -10px rgba(0, 0, 0, 0.6);
  }
  .hero-zone .seo-line { font-size: 12px; line-height: 1.45; padding: 6px 14px; }
  .hero-banner img { max-height: none; height: auto; min-height: 120px; object-fit: cover; object-position: center 42%; }
  .hero-topleft { left: 10px; right: 10px; top: 10px; gap: 8px; justify-content: space-between; pointer-events: none; }
  .hero-topleft > * { pointer-events: auto; }
  .lang-select { padding: 7px 11px; font-size: 14px; gap: 7px; min-height: 38px; }
  .lang-select .lang-menu { min-width: 190px; }
  .lang-select .lang-menu a { padding: 11px 12px; font-size: 15px; }
  .hero-social { gap: 8px; }
  .hero-social a { width: 38px; height: 38px; font-size: 18px; }

  .mobile-bar {
    gap: 8px; padding: 8px 12px calc(8px);
    padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right));
  }
  .mobile-bar .search-box-side form { gap: 8px; }
  .mobile-bar .search-box-side input.search {
    height: 44px; padding: 0 14px; font-size: 16px; border-radius: 10px;
    background: rgba(255, 255, 255, 0.08); border: 1px solid var(--hdr-border); color: #fff;
  }
  .mobile-bar .search-box-side input.search:focus { outline: none; border-color: var(--hdr-accent); background: rgba(255, 255, 255, 0.12); }
  .mobile-bar .search-box-side input.searchb {
    height: 44px; padding: 0 16px; font-size: 15px; font-weight: 600; border-radius: 10px;
    background: linear-gradient(180deg, #d9962e, #b8791e); border: 0;
  }
  .burger { width: 44px; height: 44px; border-radius: 10px; }

  /* ---------- menu (drawer under the bar) ---------- */
  nav.topnav { transition: max-height 0.28s ease; }
  nav.topnav.open {
    max-height: calc(100vh - var(--mob-bar-h, 60px));
    max-height: calc(100dvh - var(--mob-bar-h, 60px));
    overflow-y: auto; overscroll-behavior: contain;
    border-top: 1px solid var(--hdr-border);
  }
  nav.topnav ul { padding: 4px 16px 20px; }
  nav.topnav a { padding: 13px 4px; min-height: 48px; }
  nav.topnav a span { font-size: 18px; }
  nav.topnav.has-cats .mob-only-item { display: none; }

  /* catalog and special offers, moved into the menu by mobile.js */
  .mob-menu-cats { padding: 14px 16px 4px; }
  .mob-menu-cats .blk { padding: 0; margin: 0 0 14px; border: 0; background: none; }
  nav.topnav .mob-menu-cats .blk-title {
    font-family: var(--serif); font-size: 13px; font-weight: bold; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--hdr-accent); background: none; border: 0; border-bottom: 1px solid var(--hdr-border);
    padding: 0 0 8px; margin: 0 0 4px; border-radius: 0; cursor: default; display: block; min-height: 0;
  }
  nav.topnav .mob-menu-cats .blk-title::after { content: none; }
  nav.topnav .mob-menu-cats .mob-acc-body { max-height: none; overflow: visible; }
  nav.topnav .mob-menu-cats .cat-list {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; row-gap: 0;
  }
  nav.topnav .mob-menu-cats .cat-list a,
  nav.topnav .mob-menu-cats #mob-categories .cat-list a.cat-toplevel,
  nav.topnav .mob-menu-cats #mob-categories .cat-list a.subcat {
    display: block; min-height: 44px; padding: 11px 0 9px;
    font-family: var(--sans); font-size: 15px; font-weight: 500; line-height: 1.3; letter-spacing: 0;
    color: var(--hdr-text); border-bottom: 1px solid rgba(255, 255, 255, 0.06); white-space: normal;
  }
  nav.topnav .mob-menu-cats .cat-list a::before { content: none; }
  nav.topnav .mob-menu-cats .cat-list a.active,
  nav.topnav .mob-menu-cats #mob-categories .cat-list a.active { color: var(--hdr-accent); font-weight: 700; }
  nav.topnav .mob-menu-cats #mob-categories .cat-list .cnt { display: inline; color: var(--hdr-text-muted); font-size: 12px; }
  nav.topnav .mob-menu-cats #mob-categories .cat-list a.subcat { padding-left: 10px; font-size: 14px; color: #bfb29c; }

  /* ---------- page grid ---------- */
  .cols { grid-template-columns: minmax(0, 1fr); }
  .col-center {
    min-width: 0; padding: 20px 16px 28px;
    padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
    background-image: linear-gradient(to bottom, var(--surface-alt), transparent 220px);
  }

  /* ---------- typography in the content ---------- */
  .col-center { font-size: 16px; line-height: 1.6; overflow-wrap: break-word; }
  .col-center :where(h1) { font-size: 26px; line-height: 1.25; margin: 0 0 12px; }
  .col-center :where(h2) { font-size: 21px; line-height: 1.3; }
  .col-center :where(h3) { font-size: 18px; line-height: 1.35; }
  .breadcrumb, .col-center a.cat { font-size: 14px; }
  .about p, .greetings-block, .greetings-block p, .greetings-block td, .cat-desc, .product-detail-desc,
  .announce li, .news-list .t { font-size: 16px; text-align: left; }
  .announce li strong { font-size: 16px; }
  .about p, .greetings-block p, .cat-desc, .product-detail-desc { line-height: 1.65; }
  /* old content with tiny inline sizes */
  .col-center :is(p, div, span, td, li, font, a, b, strong)[style*="font-size: 8"],
  .col-center :is(p, div, span, td, li, font, a, b, strong)[style*="font-size:8"],
  .col-center :is(p, div, span, td, li, font, a, b, strong)[style*="font-size: 9"],
  .col-center :is(p, div, span, td, li, font, a, b, strong)[style*="font-size:9"],
  .col-center :is(p, div, span, td, li, font, a, b, strong)[style*="font-size: 10"],
  .col-center :is(p, div, span, td, li, font, a, b, strong)[style*="font-size:10"],
  .col-center :is(p, div, span, td, li, font, a, b, strong)[style*="font-size: 11"],
  .col-center :is(p, div, span, td, li, font, a, b, strong)[style*="font-size:11"],
  .col-center :is(p, div, span, td, li, font, a, b, strong)[style*="font-size: 12"],
  .col-center :is(p, div, span, td, li, font, a, b, strong)[style*="font-size:12"],
  .col-center :is(p, div, span, td, li, font, a, b, strong)[style*="font-size: 13"],
  .col-center :is(p, div, span, td, li, font, a, b, strong)[style*="font-size:13"],
  .col-center :is(p, div, span, td, li, font, a, b, strong)[style*="font-size: 14px"],
  .col-center :is(p, div, span, td, li, font, a, b, strong)[style*="font-size:14px"],
  .col-center font[size="1"], .col-center font[size="2"] { font-size: 15px !important; line-height: 1.55; }
  .col-center [align="justify"], .col-center [style*="justify"] { text-align: left !important; }
  .col-center .mob-left { text-align: left !important; }   /* set by mobile.js on justified blocks */

  /* ---------- media and tables never wider than the screen ---------- */
  .col-center img { max-width: 100%; height: auto; }
  .col-center :is(iframe, video, embed, object) { max-width: 100%; }
  .col-center iframe[src*="youtu"], .col-center iframe[src*="rutube"], .col-center iframe[src*="vk.com"] { width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .col-center table { max-width: 100%; }
  .col-center table[width]:not([width$="%"]), .col-center :is(td, th)[width]:not([width$="%"]) { width: auto !important; }
  .col-center td, .col-center th { overflow-wrap: anywhere; }
  .col-center pre { white-space: pre-wrap; }

  /* ---------- side blocks under the content ---------- */
  .blk { padding: 18px 16px 4px; margin: 0; border-top: 1px solid var(--border); }
  .blk-title { font-size: 16px; padding: 12px 14px; border-radius: 10px; min-height: 48px; }
  .mob-acc-body { position: relative; }   /* keeps the hidden anti-spam field inside the closed block (was ~1400px of empty page) */
  .cat-list a { font-size: 16px; padding: 7px 0; min-height: 40px; }
  .blk-other-left { order: 3; }
  .blk-other-left .blk-title {
    background: none; color: #7C4F11; padding: 0 0 6px; margin: 0 0 6px; min-height: 0; border-radius: 0;
    border-bottom: 1px solid var(--border); font-size: 16px;
  }
  .blk-other-left .blk-title::after { content: none; }
  .news-list .d { font-size: 13px; }
  .news-list .t a.more { font-size: 14px; }
  .all-news a { padding: 12px; font-size: 16px; border-radius: 10px; }
  .subscribe input[type="text"], .subscribe input[type="submit"] { min-height: 46px; font-size: 16px; border-radius: 10px; }

  /* ---------- footer ---------- */
  footer.bottom { padding: 22px 16px; }
  .bottomnav { gap: 4px 18px; font-size: 15px; }
  .bottomnav a { padding: 8px 2px; }
  .copy { font-size: 13px; }
  .footer-zone .seo-line { font-size: 12px; line-height: 1.5; padding: 7px 16px; }
  .footer-zone { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

  /* ---------- home ---------- */
  .announce li { padding: 14px 14px; border-radius: 10px; }
  h2.section-h { font-size: 18px; padding: 12px 14px; border-radius: 10px; margin: 28px 0 16px; }
  .offer-card { border-radius: 12px; }
  .offer-card .pname { font-size: 15px; }
  .offer-card .oprice { font-size: 14px; }

  /* ---------- category page ---------- */
  .cat-head { flex-direction: column; gap: 12px; }
  .cat-head-img { width: 88px; }
  .cat-search { width: 100%; }
  .cat-desc.mob-collapsed { max-height: 340px; overflow: hidden; position: relative; }
  .cat-desc.mob-collapsed::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 90px; pointer-events: none;
    background: linear-gradient(to bottom, rgba(255, 253, 248, 0), var(--surface) 85%);
  }
  .mob-more {
    display: block; width: 100%; margin: 4px 0 18px; padding: 12px 16px; min-height: 46px;
    font-family: var(--sans); font-size: 15px; font-weight: 600; color: #7C4F11;
    background: var(--surface); border: 1.5px solid var(--accent); border-radius: 10px; cursor: pointer;
  }
  .cat-nav { font-size: 16px; }
  .cat-nav a, .cat-nav b { display: inline-block; min-width: 40px; padding: 8px 6px; }

  /* product cards */
  .offer-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
  .pcard { text-align: left; padding: 12px; border-radius: 14px; }
  .pcard:hover { transform: none; }
  .pcard-thumb { aspect-ratio: 7 / 5; border-radius: 10px; margin-bottom: 12px; background: #1a130b; }
  .pcard-thumb img { width: 100%; height: 100%; object-fit: cover; }
  .pcard { height: auto; }
  .pcard-name { display: block; min-height: 0; font-size: 19px; line-height: 1.3; margin-bottom: 6px; }
  .pcard-desc {
    flex: 0 0 auto; font-size: 15px; line-height: 1.5; color: var(--text-muted); margin-bottom: 10px;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  }
  .pcard-form { margin-top: 0; }
  .pcard-list-price { font-size: 14px; }
  .pcard-price { font-size: 16px; margin-bottom: 2px; }
  .pcard-price-val { font-size: 19px; }
  .pcard-price br { display: none; }
  .pcard-save { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 20px; background: #f6e4c4; font-size: 13px; font-weight: 600; }
  .pcard-more { display: block; text-align: center; padding: 12px 16px; font-size: 15px; border-radius: 10px; margin: 12px 0 0; }

  /* ---------- product page ---------- */
  .product-detail { flex-direction: column; gap: 16px; }
  .product-detail-img { width: 100%; }
  .product-detail-info h1 { font-size: 26px; }
  .pd-price { font-size: 20px; }
  .pd-related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .pd-related-name { font-size: 14px; }
  /* ru: old table layout of the product page -> one column */
  .col-center table:has(td.pd-info),
  .col-center table:has(td.pd-info) > tbody,
  .col-center table:has(td.pd-info) > tbody > tr,
  .col-center table:has(td.pd-info) > tbody > tr > td { display: block; width: 100% !important; }
  .col-center table:has(td.pd-info) > tbody > tr > td { padding: 0; }
  .col-center td.pd-info { padding: 16px 0 0 !important; line-height: 1.6; }
  .col-center td.pd-info h1 { font-size: 26px; }
  .col-center td.pd-info h1 + br { display: none; }
  .col-center td.pd-info .big { font-size: 22px; }
  .col-center table:has(td.pd-info) a.highslide img:first-child { width: 100%; height: auto; border-radius: 10px; }
  .col-center a.highslide img[src*="enlarge"], .col-center a.highslide br { display: none; }
  /* ru: breadcrumb table above the product */
  .col-center table:has(> tbody > tr > td > a.cat) { margin-bottom: 8px; }

  /* ---------- forms and popups ---------- */
  .form-modal-overlay { padding: 12px; align-items: flex-end; }
  .form-modal { padding: 26px 18px 20px; border-radius: 16px; max-height: 92vh; max-height: 92dvh; }
  .form-modal input[type=text], .form-modal input[type=email], .form-modal textarea { font-size: 16px; padding: 12px; border-radius: 10px; }
  .form-modal input[type=submit], .form-modal-trigger { min-height: 48px; font-size: 16px; border-radius: 10px; }
  .btn { min-height: 44px; font-size: 15px; }

  /* ---------- floating Telegram button ---------- */
  .fab-tg {
    display: flex; align-items: center; justify-content: center;
    position: fixed; z-index: 55; right: max(16px, env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom));
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(180deg, #2aa6e0, #1d87c4); color: #fff !important; font-size: 26px;
    box-shadow: 0 8px 22px -6px rgba(0, 0, 0, 0.55); transition: transform 0.15s ease, opacity 0.2s ease;
  }
  .fab-tg:active { transform: scale(0.94); }
  html.mob-menu-open .fab-tg { opacity: 0; pointer-events: none; }
}

@media (max-width: 600px) {
  .offer-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-zone .seo-line { font-size: 11.5px; padding: 5px 12px; }
  .col-center :where(h1) { font-size: 24px; }
}

@media (max-width: 360px) {
  .mobile-bar .search-box-side input.searchb { padding: 0 12px; }
  nav.topnav .mob-menu-cats .cat-list { grid-template-columns: minmax(0, 1fr); }
}
