/* ==========================================================================
   Talia — ОДНОРЯДНА шапка (desktop) + логотип у мобільній шапці.
   Підключати ПІСЛЯ style.css і mobile.css.
   Працює у парі з assets/js/header.js — розмітку HTML міняти не треба:
   скрипт переносить пошук, телефон і мову з .topbar усередину .header.
   ========================================================================== */

.logo .logo__mark {
  display: block; width: auto; height: 46px; object-fit: contain;
  opacity: .8;
  transition: filter .2s ease, opacity .2s ease;
}
/* img-SVG не фарбується через fill — тонуємо у фірмовий --c-accent (#eda150) */
.logo:hover .logo__mark,
.logo:focus-visible .logo__mark {
  opacity: 1;
  filter: brightness(0) saturate(100%) invert(59%) sepia(24%) saturate(656%)
    hue-rotate(351deg) brightness(92%) contrast(125%);
}

/* ---------- DESKTOP: один рівень ------------------------------------- */
@media (min-width: 901px) {
  .topbar { display: none; }

  .m-navhead, .m-navcontacts, .m-navfoot, .m-scrim, .tcontacts { display: none !important; }

  .header__in { gap: 26px; min-height: 76px; align-items: stretch; }
  .header .logo { display: flex; align-self: center; }
  .header .logo .logo__mark { height: 48px; }
  .header__cta, .header__tools { align-self: center; }

  .nav {
    flex: 1;
    display: flex;
    align-items: stretch;
    position: static;
    visibility: visible;
    transform: none;
    width: auto;
    max-height: none;
    overflow: visible;
    inset: auto;
    padding: 0;
    box-shadow: none;
    background: transparent;
    transition: opacity .2s ease;
  }
  .nav__list { width: 100%; height: 100%; align-items: stretch; }
  .nav__list > li { display: flex; align-items: center; height: 100%; }

  .header__tools { display: flex; align-items: center; gap: 16px; flex: none; position: relative; }

  /* Пошук — кругла кнопка, поле виїжджає вліво */
  /* display:block — перебиває `.search{display:none}` зі style.css (max-width:1100) */
  .header__tools .search { display: block; position: static; flex: none; max-width: none; }
  .header__tools .search input {
    position: absolute; right: 0; top: 50%; transform: translateY(-50%);
    width: 0; padding: 10px 0; opacity: 0; pointer-events: none;
    border-color: var(--c-line); background: #fff;
    transition: width .26s ease, opacity .2s ease, padding .26s ease;
  }
  .header__tools .search.is-open input {
    width: clamp(220px, 24vw, 320px); padding: 10px 46px 10px 15px;
    opacity: 1; pointer-events: auto; z-index: 3;
  }
  .header__tools .search > svg { display: none; }
  .header__tools .search.is-open ~ .lang,
  .header__tools .search.is-open ~ .topbar__phone { opacity: 0; pointer-events: none; }

  /* Відкрите поле: лупа стає іконкою біля правого краю поля, а не висить посередині */
  .header__tools .search.is-open ~ .search-toggle {
    position: absolute; right: 0; top: 50%; margin-top: -20px;
    border-color: transparent; background: transparent; color: var(--c-ink-mute);
  }
  .header__tools .search.is-open ~ .search-toggle:hover { color: var(--c-accent); }
  .header__tools .search-suggest {
    left: auto; right: 0; top: calc(50% + 26px);
    width: clamp(280px, 32vw, 400px);
  }

  .search-toggle {
    width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--c-line); border-radius: 50%; background: #fff;
    color: var(--c-ink); cursor: pointer; padding: 0; transition: .2s; z-index: 4;
  }
  .search-toggle:hover { border-color: var(--c-accent); color: var(--c-accent); }
  .search-toggle svg { width: 17px; height: 17px; }

  .header__tools .topbar__phone { text-align: right; transition: opacity .2s ease; }
  .header__tools .topbar__phone a { font-size: 16px; font-weight: 600; white-space: nowrap; }
  .header__tools .topbar__phone small { display: none; }

  /* Мова — активна кнопка + випадашка */
  .header__tools .lang { position: relative; gap: 0; transition: opacity .2s ease; }
  .header__tools .lang a {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; padding: 0; border-radius: 50%;
    border: 1px solid transparent; font-size: 12.5px; font-weight: 600;
  }
  .header__tools .lang a.is-active { background: #fff; border-color: var(--c-line); color: var(--c-ink); }
  .header__tools .lang a:not(.is-active) {
    position: absolute; top: calc(100% + 6px); left: 0;
    background: #fff; border-color: var(--c-line);
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: .2s; box-shadow: var(--shadow-md);
  }
  .header__tools .lang.is-open a:not(.is-active) { opacity: 1; visibility: visible; transform: none; }
}

/* ---------- Вузький десктоп: звільняємо місце, щоб шапка не «вилазила» -- */
@media (min-width: 901px) and (max-width: 1100px) {
  .header__in { gap: 16px; }
  .header__tools { gap: 12px; }
  .header__tools .topbar__phone { display: none; }
  /* поле пошуку тут ширше за вільне місце — ховаємо меню на час пошуку */
  .header__in.is-search .nav { opacity: 0; pointer-events: none; }
}

/* ---------- MOBILE / TABLET: одна шапка замість двоповерхової --------- */
@media (max-width: 900px) {
  /* верхню панель прибрано повністю — лишається тільки закріплена .header */
  .topbar { display: none !important; }
  /* лого лишається там, де й стояло — по центру шапки */
  .header .logo .logo__mark { height: 44px; }
  /* десктопні інструменти сюди не потрапляють */
  .header__tools, .search-toggle { display: none !important; }
}

/* ---------- Швидкі посилання в шапці планшета ------------------------- */
/* Будуються скриптом (mobile.js) з пунктів меню — розмітку сторінок
   міняти не треба. На інших ширинах приховані. */
.header__quick { display: none; }

@media (min-width: 761px) and (max-width: 900px) {
  .header__quick {
    display: flex; order: 1; align-items: center; gap: 22px;
    margin-left: 8px; min-width: 0;
  }
  .header__quick a {
    font-size: 15px; line-height: 1.2; color: var(--c-ink);
    white-space: nowrap; padding: 10px 2px; transition: color .2s;
  }
  .header__quick a:hover,
  .header__quick a.is-current { color: var(--c-accent); }
}

/* дуже вузькі екрани: лого і кнопка трохи компактніші, щоб не стикались */
@media (max-width: 380px) {
  .header .logo .logo__mark { height: 36px; }
  .header__cta .btn { padding: 8px 14px; min-height: 38px; font-size: 13.5px; }
}
