/* D-profil: адаптив для планшетов и телефонов. Подключается после всех остальных стилей. */

html{-webkit-tap-highlight-color:rgba(138,97,28,.15);-webkit-text-size-adjust:100%}
a,button,input,select,summary,label{touch-action:manipulation}
body{overflow-wrap:break-word}
img,video,iframe{max-width:100%}
.nav-toggle,.search-toggle,.phone-link,.filters-btn,.nav__contact,.sticky-buy{display:none}
.woocommerce-tabs,.related.products,.upsells.products,.summary,.woocommerce-product-gallery{min-width:0}

/* ============ Планшет и узкие окна (до 1100 px) ============ */
@media (max-width:1100px){
  /* каталог */
  .cat{gap:20px}
  .filters-btn{display:flex;flex:1 1 100%;align-items:center;justify-content:center;gap:10px;height:48px;border:1px solid var(--ink);border-radius:4px;background:transparent;font-size:16px;font-weight:500}
  .filters-btn[aria-expanded="true"]{background:var(--ink);color:var(--field)}
  .filters{flex:1 1 100%}
  .has-js .filters{display:none}
  .has-js .filters.is-open{display:flex}
  .cat-head h1{font-size:44px}
  ul.products,ul.products.columns-4{grid-template-columns:repeat(2,minmax(0,1fr))}

  /* главная */
  .hero h1{font-size:48px}
  .hero__img{height:400px}
  .bento{grid-template-columns:repeat(2,minmax(0,1fr))}
  .terms-row{grid-template-columns:1fr}

  /* карточка товара */
  .single-product div.product{gap:40px}
}

/* ============ Шапка и меню (до 900 px) ============ */
@media (max-width:900px){
  .header{position:sticky;top:0;z-index:60}
  .admin-bar .header{top:32px}
  .header__top{gap:0 2px;min-height:64px}
  .nav-toggle{display:flex;order:1;flex-direction:column;align-items:center;justify-content:center;gap:5px;width:48px;height:48px;margin-left:-10px;padding:0;border:0;background:none}
  .nav-toggle span{display:block;width:22px;height:2px;background:var(--ink);border-radius:2px;transition:transform .3s ease,opacity .2s ease}
  .nav-toggle[aria-expanded="true"] span:nth-child(1){transform:translateY(7px) rotate(45deg)}
  .nav-toggle[aria-expanded="true"] span:nth-child(2){opacity:0}
  .nav-toggle[aria-expanded="true"] span:nth-child(3){transform:translateY(-7px) rotate(-45deg)}
  .logo{order:2;flex:1 1 auto;min-width:0;gap:10px;padding-left:4px}
  .logo svg,.logo img{width:40px;height:40px}
  .logo__name{font-size:22px}
  .header__tools{order:3;flex:0 0 auto;gap:0}
  .contact{display:none}
  .search-toggle,.phone-link{display:flex}
  .search-toggle{align-items:center;justify-content:center;width:48px;height:48px;padding:0;border:0;background:none}
  .icon-link{width:44px}
  .site-search{order:4;flex:1 1 100%;margin:0 0 12px}
  .has-js .site-search{display:none}
  .has-js .site-search.is-open{display:flex}
  .site-search input[type=search]{height:48px}

  /* меню-панель */
  .nav{padding:0}
  .has-js .nav{display:none;max-height:calc(100vh - 64px);max-height:calc(100dvh - 64px);overflow-y:auto;border-top:1px solid var(--line);background:var(--bg)}
  .has-js .nav.is-open{display:block}
  .nav__list{flex-direction:column;flex-wrap:nowrap;gap:0;min-height:0;padding:0 var(--gut)}
  .nav__list a{width:100%;min-height:56px;padding:0;font-size:18px;color:var(--ink);box-shadow:inset 0 -1px 0 var(--line);border-bottom:0!important}
  .nav__list a::after{display:none}
  .nav__list .current-menu-item>a,.nav__list .current-menu-ancestor>a,.nav__list .current_page_item>a{padding-left:14px;box-shadow:inset 3px 0 0 var(--accent),inset 0 -1px 0 var(--line)}
  html:not(.has-js) .nav{overflow-x:auto}
  html:not(.has-js) .nav__list{flex-direction:row;overflow-x:auto;padding:0}
  html:not(.has-js) .nav__list a{width:auto;padding:0 16px;box-shadow:none;font-size:16px}
  .nav__contact{display:flex;flex-direction:column;gap:4px;padding:20px var(--gut) 24px;background:var(--panel)}
  .nav__contact a{font-size:20px;font-weight:600}
  .nav__contact span{font-size:14px;color:var(--muted)}
  html:not(.has-js) .nav__contact{display:none}
}
@media (max-width:782px){.admin-bar .header{top:46px}}
@media (max-width:600px){.admin-bar .header{top:0}}

/* ============ Телефон (до 640 px) ============ */
@media (max-width:640px){
  body{font-size:16px}
  .section{margin-top:64px}
  .section>h2,.section h2{font-size:28px}

  /* страницы */
  .site-page{padding-block:32px 0}
  .site-page>article>h1,.site-page>h1{font-size:32px;margin-bottom:20px}
  .crumbs{padding-top:20px;font-size:14px;gap:6px}
  .crumbs a{padding-block:6px}

  /* главная */
  .hero{padding-top:24px}
  .hero__in{gap:28px}
  .hero__text{gap:20px}
  .hero h1{font-size:36px;max-width:none}
  .hero p{font-size:17px}
  .hero__actions{flex-direction:column}
  .hero__actions .btn{width:100%}
  .hero__img{flex-basis:auto;width:100%;height:240px}
  .bento{gap:12px;margin-top:24px}
  .bento__card{padding:10px 10px 12px;gap:6px;border-radius:8px}
  .bento__media{aspect-ratio:4/3}
  .bento__name{font-size:16px;line-height:1.25}
  .bento__count{font-size:13px}
  .bento__go{width:30px;height:30px;right:12px;bottom:12px;font-size:15px}
  .tasks{margin-top:24px}
  .tasks a{padding:18px 0;gap:6px 16px}
  .tasks b{flex-basis:100%;font-size:19px}
  .tasks span{flex:1 1 0;font-size:15px}
  .choose{margin-top:64px;padding:48px 0}
  .choose h2{font-size:28px;margin-bottom:28px}
  .choose__in{gap:32px}
  .choose__img{height:220px;flex-basis:auto;width:100%}
  .steps{gap:22px}
  .steps li{grid-template-columns:36px 1fr}
  .steps li::before{font-size:26px}
  .terms-row{gap:24px}

  /* каталог */
  .cat-head{margin:12px 0 24px;gap:8px}
  .cat-head h1{font-size:30px}
  .cat-head__desc{font-size:16px}
  .toolbar{flex-direction:column;align-items:stretch;gap:12px;padding-bottom:16px}
  .toolbar .woocommerce-ordering,.toolbar select{width:100%}
  .woocommerce-result-count{font-size:15px}
  ul.products,ul.products.columns-4{grid-template-columns:repeat(2,minmax(0,1fr));gap:28px 12px;margin-top:24px}
  .card{gap:10px}
  .card__body{gap:4px}
  .card__name{font-size:16px;line-height:1.25}
  .card__spec{font-size:13px}
  .card__price{font-size:17px;margin-top:2px}
  .card__price del{display:block}
  .price-suffix{display:block;margin:0;font-size:12px}
  .card .button{height:44px;padding:0 8px;font-size:15px}
  .onsale{top:8px;left:8px;font-size:12px}
  .woocommerce-pagination{margin-top:40px}
  .page-numbers{min-width:44px;height:44px}

  /* карточка товара */
  .single-product div.product{gap:28px;margin-top:12px}
  .woocommerce-product-gallery{flex-basis:100%}
  .flex-control-thumbs{gap:8px}
  .single-product .summary{flex-basis:100%;gap:18px}
  .product_title{font-size:28px}
  .summary .price{font-size:30px;padding:14px 0}
  .summary .price .price-suffix{font-size:16px;display:inline}
  table.variations select{height:52px;font-size:16px}
  .dp-pill{min-width:76px;height:46px;padding:0 14px}
  .quantity .qty{width:80px}
  form.cart .single_add_to_cart_button{flex:1 1 160px}
  .product_meta{padding:16px 18px}
  .woocommerce-tabs,.related.products,.upsells.products{margin-top:32px}
  .woocommerce-tabs ul.tabs{max-width:100%}
  .woocommerce-tabs ul.tabs{flex-wrap:nowrap;overflow-x:auto;gap:24px;margin-bottom:24px;scrollbar-width:none}
  .woocommerce-tabs ul.tabs a{white-space:nowrap;font-size:17px}
  .shop_attributes th{width:42%;padding-right:12px}
  .related.products>h2,.upsells.products>h2{font-size:26px}

  /* липкая панель покупки */
  .sticky-buy{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:55;align-items:center;gap:12px;padding:10px var(--gut) calc(10px + env(safe-area-inset-bottom));background:var(--bg);border-top:1px solid var(--line);box-shadow:0 -6px 20px rgba(39,34,29,.08);transform:translateY(110%);transition:transform .3s ease}
  .sticky-buy.is-visible{transform:none}
  .sticky-buy__price{flex:1 1 auto;min-width:0;font-size:19px;font-weight:700;line-height:1.15}
  .sticky-buy__price del{display:none}
  .sticky-buy__price ins{text-decoration:none}
  .sticky-buy__price .price-suffix{display:block;font-size:12px;font-weight:400}
  .sticky-buy .btn{flex:0 0 auto;height:48px;padding:0 22px}
  .single-product{padding-bottom:72px}

  .woocommerce-MyAccount-content table,.woocommerce-orders-table{display:block;overflow-x:auto}
  .woocommerce-info,.woocommerce-message,.woocommerce-error{padding:14px 16px;font-size:15px}

  /* подвал */
  .footer{margin-top:72px}
  .footer__main{gap:28px;padding-block:48px 16px}
  .footer__brand .logo__name{font-size:26px}
  .footer__col{flex-basis:100%;gap:0}
  .footer__col b{margin-bottom:6px}
  .footer__col a,.footer__menu a{display:flex;align-items:center;min-height:44px}
  .footer__menu{gap:0}
  .footer__legal{flex-direction:column;gap:8px;padding-block:20px 28px}

  /* поля форм: 16px, чтобы iPhone не приближал страницу при вводе */
  input,select,textarea{font-size:16px}
}

/* ============ Маленькие телефоны (до 380 px) ============ */
@media (max-width:380px){
  .hero h1{font-size:32px}
  .logo__name{font-size:20px}
  .cat-head h1{font-size:27px}
  .card__name{font-size:15px}
  .sticky-buy .btn{padding:0 16px}
}

@media (max-width:640px){
  .footer__map{margin-bottom:24px}
  .footer__mapframe iframe{height:280px}
  .footer__mapcard{position:static;max-width:none;margin-top:12px;padding:16px;box-shadow:none;border:1px solid var(--line)}
  .footer__mapcard .btn{width:100%}
}
