/* =====================================================================
   Шапка (десктоп): тонкая верхняя полоса + логотип, меню и поиск
   ===================================================================== */
.topbar, .header-search, .search-panel { display: none; }

@media (min-width: 821px) {
  body .site-header,
  body .site-header.scrolled,
  body .site-header.solid,
  body .site-header:not(.scrolled):not(.solid) {
    position: fixed; top: 0; left: 0; right: 0;
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: 36px 86px;
    grid-template-areas: "top top top" "brand nav actions";
    align-items: center; gap: 0;
    height: 123px; padding: 0 clamp(20px, 3.5vw, 72px);
    background: #000; backdrop-filter: none; -webkit-backdrop-filter: none;
    border-bottom: 1px solid rgba(255,255,255,.075);
    font-family: 'Montserrat', 'Manrope', var(--sf-pro);
  }

  /* верхняя полоса */
  .topbar {
    grid-area: top; display: flex; align-items: center; justify-content: flex-end;
    height: 36px; font-size: clamp(12px, .98vw, 15px); line-height: 1; letter-spacing: .01em; white-space: nowrap;
  }
  .topbar-tag { color: #9d9d9d; padding-left: 1px; }
  .topbar-links { display: flex; align-items: center; gap: clamp(20px, 1.9vw, 34px); }
  .topbar-phone { color: #fafafa; font-weight: 500; transition: color .25s; }
  .topbar-phone:hover { color: #e7ceaf; }
  .topbar-link { display: inline-flex; align-items: center; gap: 7px; color: #e7ceaf; font-weight: 500; transition: color .25s, opacity .25s; }
  .topbar-link svg { width: clamp(13px, 1vw, 16px); height: clamp(13px, 1vw, 16px); flex: 0 0 auto; }
  .topbar-link:hover { color: #fff; }
  .topbar-phone { margin-right: -6px; }

  /* логотип */
  .brand { grid-area: brand; display: block; width: 66px; height: 46px; overflow: hidden; margin: 0 0 0 4px; padding: 0; }
  body .site-header .brand img,
  body .site-header.scrolled .brand img,
  body .site-header.solid .brand img {
    display: block; width: 68px; height: 48.2px; max-width: none; margin: -1px 0 0 -1px; transition: none;
  }

  /* меню */
  body .site-header .desktop-nav {
    grid-area: nav; display: flex; justify-content: center; align-items: center;
    height: 100%; border: 0; gap: clamp(16px, 2.1vw, 40px); padding: 0 0 0 12px;
    font: 500 clamp(12px, 1.12vw, 17px)/1 'Montserrat', 'Manrope', var(--sf-pro); letter-spacing: 0; color: #e9e6df;
  }
  body .site-header.scrolled .desktop-nav, body .site-header.solid .desktop-nav { height: 100%; }
  .desktop-nav > a, .desktop-nav .nav-item { height: 100%; align-self: stretch; display: flex; align-items: center; }
  .desktop-nav > a::after, .nav-item > a::after { bottom: 24px; }
  .desktop-nav a:hover, .desktop-nav a.active { color: #e7ceaf; }
  .desktop-nav .caret { display: none; }

  /* «Новые устройства» и «Б/У устройства» — обычные пункты меню, без кнопок */
  body .site-header .desktop-nav .nav-item > a,
  body .site-header .desktop-nav .nav-item > a:hover,
  body .site-header .desktop-nav .nav-item > a.active,
  body .site-header .desktop-nav > a[href="used.html"],
  body .site-header.scrolled .desktop-nav .nav-item > a,
  body .site-header.solid .desktop-nav .nav-item > a,
  body .site-header.scrolled .desktop-nav > a[href="used.html"],
  body .site-header.solid .desktop-nav > a[href="used.html"] {
    height: 100%; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; transform: none;
    color: inherit; font: inherit; font-weight: 500; align-self: stretch;
  }
  body .site-header .desktop-nav a:hover,
  body .site-header .desktop-nav .nav-item:hover > a,
  body .site-header .desktop-nav > a[href="used.html"]:hover,
  body .site-header .desktop-nav a.active { color: #e7ceaf; background: none; }
  body .site-header .desktop-nav > a::after, body .site-header .desktop-nav .nav-item > a::after { display: block; }

  /* правая часть: поиск (+ корзина, когда в ней что-то есть) */
  body .site-header .header-actions { grid-area: actions; display: flex; align-items: center; gap: 6px; justify-self: end; margin-right: 0; }
  .header-search {
    display: inline-grid; place-items: center; width: 38px; height: 38px; margin-right: 0;
    color: #cfcfcf; background: none; border: 0; border-radius: 50%; cursor: pointer; transition: color .25s;
  }
  .header-search svg { width: 16px; height: 16px; }
  .header-search:hover, .header-search[aria-expanded="true"] { color: #e7ceaf; }
  body .site-header .cart-trigger {
    display: none; padding: 6px 12px; font: 500 13px 'Montserrat', 'Manrope', var(--sf-pro);
    color: #e7ceaf; background: none; border: 1px solid rgba(231,206,175,.4); box-shadow: none; border-radius: 999px;
  }
  body .site-header .cart-trigger.has-items { display: inline-flex; }
  body .site-header .cart-trigger span { width: 18px; height: 18px; margin-left: 8px; font-size: 11px; background: #e7ceaf; color: #1a1208; }

  /* выпадающее окно поиска */
  .search-panel {
    position: absolute; top: 100%; left: clamp(20px, 3.5vw, 72px); right: clamp(20px, 3.5vw, 72px);
    background: #000; border: 1px solid rgba(255,255,255,.1); border-top: 0; border-radius: 0 0 16px 16px;
    padding: 14px 16px 16px; box-shadow: 0 30px 60px rgba(0,0,0,.6); z-index: 5;
  }
  .search-panel:not([hidden]) { display: block; }
  .search-panel input {
    width: 100%; height: 44px; padding: 0 16px; color: #fff; font: 500 15px var(--sf-pro);
    background: rgba(255,255,255,.06); border: 1px solid rgba(231,206,175,.3); border-radius: 12px; outline: none;
  }
  .search-panel input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
  .search-panel input:focus { border-color: #e7ceaf; }
  .search-results { display: grid; gap: 2px; margin-top: 8px; max-height: 60vh; overflow: auto; }
  .search-results a { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 12px; border-radius: 10px; color: #e9e6df; font-size: 14px; }
  .search-results a:hover { background: rgba(231,206,175,.1); color: #fff; }
  .search-results small { color: #9d9d9d; font-size: 12px; white-space: nowrap; }
  .search-results .search-empty { padding: 12px; color: #9d9d9d; font-size: 14px; }

  /* контент не прячется под шапкой */
  main > .section:first-child { padding-top: 190px; }
}

@media (min-width: 821px) and (max-width: 1100px) {
  body .site-header .desktop-nav { gap: 10px; padding: 0 0 0 6px; font-size: 11.5px; }
}

/* =====================================================================
   Подвал: логотип без пустых полей, вровень с текстом, чуть крупнее
   ===================================================================== */
.site-footer .footer-main .footer-logo {
  display: block; width: 118px; height: auto; margin: 0 0 24px 0; padding: 0; object-fit: contain; object-position: left center;
}
@media (max-width: 820px) { .site-footer .footer-main .footer-logo { width: 100px; } }
@media (min-width: 1000px) {
  .site-footer .footer-main { grid-template-columns: minmax(410px, 2fr) 1fr 1.2fr 1fr; }
}

/* =====================================================================
   Контакты: две строки заголовка и текста без лишних переносов,
   «Задать вопрос» по ширине вровень с кнопками Telegram + Instagram
   ===================================================================== */
.contact-block .contact-info > p { max-width: none; }
.contact-block .display { font-size: clamp(30px, 3.7vw, 72px); }
.contact-block .display span { white-space: nowrap; }
.contact-actions { display: flex; flex-direction: column; align-items: stretch; width: fit-content; max-width: 100%; }
.contact-actions .contact-ask { width: 100%; }
@media (max-width: 820px) { .contact-block .display { font-size: clamp(27px, 7.8vw, 40px) !important; } }
.contact-block .contact-info > p { font-size: clamp(13px, 1.15vw, 17px); }
@media (max-width: 820px) { .contact-block .contact-info > p { font-size: 14px; } }

/* Соцсети в верхней строке — наш золотой градиент */
.topbar-link { color: #c9a06c; background: linear-gradient(100deg, #f3d9b8 0%, #c9a06c 45%, #a67c3c 75%, #e3c39c 100%); background-size: 100% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; font-weight: 600; }
.topbar-link svg path { fill: url(#ea-svg-grad); }
.topbar-link[aria-label="Instagram"] svg { stroke: url(#ea-svg-grad); }
.topbar-link[aria-label="Instagram"] svg path { fill: none; }
.topbar-link:hover { color: #c9a06c; filter: brightness(1.2); }

/* соцсети: запас по высоте, чтобы градиент не обрезал нижние выносные элементы (g, p, _) */
.topbar-link { padding: 4px 1px 7px; line-height: 1.5; overflow: visible; }

/* ---------- Кнопка корзины: иконка + шрифт сайта (ПК и телефон) ---------- */
body .site-header .cart-trigger {
  align-items: center; gap: 8px;
  font-family: var(--sf-pro); font-weight: 700; letter-spacing: .01em; line-height: 1;
  -webkit-font-smoothing: antialiased;
}
body .site-header .cart-trigger .cart-label { font: inherit; letter-spacing: inherit; }
body .site-header .cart-trigger .cart-ico { flex: none; width: 19px; height: 19px; display: block; }
body .site-header .cart-trigger #cart-count {
  margin-left: 0; display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box;
  border-radius: 999px; font: 700 11px/1 var(--sf-pro); font-variant-numeric: tabular-nums;
}
@media (max-width: 820px) {
  body .site-header .cart-trigger { display: inline-flex; padding: 9px 12px 9px 11px; font-size: 13px; gap: 7px; min-height: 40px; }
  body .site-header .cart-trigger .cart-ico { width: 18px; height: 18px; }
  body .site-header .cart-trigger #cart-count { background: #1a1208; color: #f3d9b8; }
}
@media (min-width: 821px) {
  body .site-header .cart-trigger { padding: 8px 14px 8px 12px; font-size: 14px; font-weight: 600; transition: color .25s, border-color .25s, background .25s; }
  body .site-header .cart-trigger:hover { color: #f3d9b8; border-color: rgba(243,217,184,.8); background: rgba(231,206,175,.08); transform: none; box-shadow: none; }
  body .site-header .cart-trigger #cart-count { background: #e7ceaf; color: #1a1208; }
}

/* ---------- Кнопка корзины: тот же градиент, что у «Смотреть товары» (ПК и телефон) ---------- */
body .site-header .cart-trigger,
body .site-header .cart-trigger.has-items {
  position: relative; overflow: hidden; isolation: isolate;
  color: #1a1208; border: 0;
  background: linear-gradient(120deg, #f3d9b8 0%, #d3ad7a 40%, #b98a45 100%);
  background-size: 100% 100%; background-position: 0 0;
  box-shadow: 0 0 0 1px rgba(243,217,184,.5), 0 10px 30px rgba(201,160,108,.35), 0 0 40px rgba(201,160,108,.18);
  transition: transform .3s ease, box-shadow .3s ease, filter .3s ease;
}
body .site-header .cart-trigger > * { position: relative; z-index: 1; }
body .site-header .cart-trigger::before {
  content: ""; position: absolute; top: -20%; bottom: -20%; left: 0; width: 38%; z-index: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 0%, rgba(255,255,255,.65) 50%, transparent 100%);
  transform: translateX(-160%) skewX(-18deg); animation: ctaSweep 3.6s ease-in-out 1.2s infinite;
}
body .site-header .cart-trigger .cart-ico { stroke-width: 2; }
body .site-header .cart-trigger #cart-count,
body .site-header .cart-trigger span#cart-count { background: #1a1208; color: #f3d9b8; }
body .site-header .cart-trigger:hover {
  color: #1a1208; border: 0; transform: translateY(-2px); filter: brightness(1.06);
  background: linear-gradient(120deg, #f3d9b8 0%, #d3ad7a 40%, #b98a45 100%);
  box-shadow: 0 0 0 1px rgba(243,217,184,.7), 0 14px 36px rgba(201,160,108,.5), 0 0 50px rgba(201,160,108,.3);
}
body .site-header .cart-trigger:hover::before { animation-duration: 1.2s; animation-delay: 0s; }
body .site-header .cart-trigger:active { transform: scale(.96); filter: none; }
@media (prefers-reduced-motion: reduce) { body .site-header .cart-trigger::before { animation: none !important; } }

/* ПК: корзина видна всегда, даже когда пуста (как на телефоне) */
@media (min-width: 821px) {
  body .site-header .cart-trigger,
  body .site-header .cart-trigger:not(.has-items) { display: inline-flex; margin-left: 8px; }
}

/* =====================================================================
   Средние окна (половина экрана, планшет в альбомной ориентации):
   меню уходит на вторую строку шапки и не налезает на логотип, поиск и корзину
   ===================================================================== */
@media (min-width: 821px) and (max-width: 1180px) {
  body .site-header,
  body .site-header.scrolled,
  body .site-header.solid,
  body .site-header:not(.scrolled):not(.solid) {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: 36px 58px 46px;
    grid-template-areas: "top top top" "brand . actions" "nav nav nav";
    height: 140px; padding: 0 clamp(16px, 2.6vw, 32px);
  }
  body .site-header .desktop-nav {
    height: 46px; justify-content: center; padding: 0;
    gap: clamp(10px, 1.7vw, 22px); font-size: clamp(11.5px, 1.3vw, 13px);
    border-top: 1px solid rgba(255,255,255,.075);
  }
  body .site-header.scrolled .desktop-nav, body .site-header.solid .desktop-nav { height: 46px; }
  .desktop-nav > a::after, .nav-item > a::after { bottom: 8px; }
  main > .section:first-child { padding-top: 200px; }
}

/* чуть уже обычного окна ноутбука: меню плотнее, чтобы не упиралось в корзину */
@media (min-width: 1181px) and (max-width: 1380px) {
  body .site-header .desktop-nav { gap: clamp(12px, 1.2vw, 16px); font-size: 12px; padding-left: 0; }
}
