/* tokens.css підключається окремим <link> у base.html — без @import (перекривав би theme.css). */

.site-chrome {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--color-beige);
}

.topbar {
  background: var(--color-beige);
  font-size: 0.78rem;
  color: var(--color-muted);
  padding: 8px 0;
  padding-top: calc(8px + var(--safe-top));
  overflow: hidden;
  max-height: calc(3.25rem + var(--safe-top));
  transition:
    max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-chrome.is-topbar-hidden .topbar {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

.site-chrome.is-topbar-hidden .site-header {
  padding-top: var(--safe-top);
}

@media (prefers-reduced-motion: reduce) {
  .topbar,
  .site-header {
    transition: none;
  }
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar__promo {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__nav {
  display: none;
  align-items: center;
  gap: 18px;
}

.topbar__nav a:hover {
  color: var(--color-graphite);
}

.lang {
  display: inline-flex;
  gap: 6px;
  font-weight: 600;
  color: var(--color-graphite);
}

.lang__form {
  display: contents;
}

.lang__btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--color-graphite);
  cursor: pointer;
}

.lang__btn:hover {
  color: var(--color-graphite);
}

.lang__btn[aria-current="true"] {
  color: var(--color-accent-hover);
}

.mobile-panel__lang {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-divider);
}

@media (min-width: 900px) {
  .topbar__nav {
    display: flex;
  }
}

.site-header {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-divider);
  position: relative;
  z-index: 1;
  transition: padding-top var(--transition);
}

.site-header__row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  min-height: var(--header-h);
  padding: 10px 0;
}

.logo {
  display: block;
  width: min(108px, 30vw);
  flex-shrink: 0;
  line-height: 0;
  justify-self: center;
  grid-column: 2;
}

.logo img {
  width: 100%;
  height: auto;
  max-height: 36px;
  object-fit: contain;
  object-position: center;
}

.logo--text {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--color-graphite);
}

.btn-menu {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  aspect-ratio: 1 / 1;
  padding: 0;
  flex-shrink: 0;
  align-self: center;
  justify-self: start;
  grid-column: 1;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--color-graphite);
  -webkit-tap-highlight-color: transparent;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-self: end;
  grid-column: 3;
}

.header-actions__link {
  position: relative;
  width: var(--tap);
  height: var(--tap);
  display: grid;
  place-items: center;
  color: var(--color-graphite);
  border-radius: var(--radius-sm);
}

.header-actions__link:hover {
  background: var(--color-milky);
}

.header-actions__count {
  position: absolute;
  top: 6px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--color-accent);
  color: var(--color-white);
  font-size: 0.65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.header-actions__search {
  display: grid;
}

.header-search {
  display: none;
  align-items: center;
  gap: 10px;
  position: relative;
}

.header-search__close {
  display: none;
  width: var(--tap);
  height: var(--tap);
  flex-shrink: 0;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--color-graphite);
  -webkit-tap-highlight-color: transparent;
}

.search-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 45;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: var(--color-white);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  max-height: min(60vh, 320px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.search-suggest[hidden] {
  display: none;
}

.search-suggest__link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: var(--tap);
  padding: 8px 14px;
  justify-content: center;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.search-suggest__item.is-active .search-suggest__link,
.search-suggest__link:hover {
  background: var(--color-milky);
}

.search-suggest__name {
  font-size: 0.92rem;
  line-height: 1.3;
  color: var(--color-graphite);
}

.search-suggest__brand {
  font-size: 0.78rem;
  color: var(--color-muted);
}

.header-search__input-wrap {
  position: relative;
  flex: 1;
}

.header-search__input-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-muted);
  pointer-events: none;
}

.header-search .form-control {
  padding-left: 40px;
  background: var(--color-milky);
  border-color: transparent;
}

.btn-catalog {
  display: none;
  min-height: var(--tap);
  padding: 0 16px;
  border: none;
  background: var(--color-accent);
  color: var(--color-white);
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 500;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-catalog:hover,
.btn-catalog[aria-expanded="true"] {
  background: var(--color-accent-hover);
}

.btn-menu svg {
  width: 36px;
  height: 36px;
  display: block;
}

/* <400: 4 іконки + лого в один ряд (320) — стиснути тап-зони й віддати місце правій колонці */
@media (max-width: 399px) {
  .site-header__row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 4px;
    padding: 8px 0;
  }

  .logo {
    width: min(84px, 26vw);
  }

  .logo img {
    max-height: 32px;
  }

  .header-actions {
    gap: 0;
  }

  .header-actions__link {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  .header-actions__link svg {
    width: 18px;
    height: 18px;
  }

  .header-actions__count {
    top: 2px;
    right: 0;
  }
}

@media (max-width: 899px) {
  .site-header.is-search-open .header-search {
    display: flex;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    z-index: 3;
    min-height: 100%;
    box-sizing: border-box;
    padding: 10px 16px;
    background: var(--color-white);
    border-bottom: 1px solid var(--color-divider);
  }

  .site-header.is-search-open .header-search__close {
    display: grid;
  }
}

@media (min-width: 768px) and (max-width: 899px) {
  .site-header.is-search-open .header-search {
    padding-left: 24px;
    padding-right: 24px;
  }
}

@media (min-width: 900px) {
  .site-header__row {
    grid-template-columns: auto auto 1fr auto;
    gap: 16px;
  }

  .btn-menu {
    display: none;
  }

  .header-actions__search {
    display: none;
  }

  .logo {
    width: min(128px, 34vw);
    justify-self: start;
    grid-column: auto;
    margin-inline-end: 12px;
  }

  .logo img {
    max-height: 44px;
    object-position: left center;
  }

  .header-actions {
    justify-self: end;
    grid-column: auto;
  }

  .btn-catalog {
    display: inline-flex;
    align-items: center;
  }

  .header-search {
    display: flex;
  }
}

.cat-nav {
  display: none;
  border-top: 1px solid var(--color-divider);
  background: var(--color-white);
}

.cat-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  padding: 12px 0;
  font-size: 0.9rem;
}

.cat-nav__list a:hover {
  color: var(--color-accent-hover);
}

.cat-nav__list a.is-sale {
  color: var(--color-sale);
  font-weight: 600;
}

@media (min-width: 900px) {
  .cat-nav {
    display: block;
  }
}

.mobile-panel {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  visibility: hidden;
}

.mobile-panel.is-open {
  pointer-events: auto;
  visibility: visible;
}

.mobile-panel__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(41, 39, 37, 0.42);
  opacity: 0;
  transition: opacity var(--transition);
}

.mobile-panel.is-open .mobile-panel__backdrop {
  opacity: 1;
}

.mobile-panel__sheet {
  position: absolute;
  top: 0;
  left: 0;
  width: min(320px, 88vw);
  height: 100%;
  background: var(--color-white);
  padding: calc(18px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
  transform: translateX(-100%);
  transition: transform var(--transition);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-panel.is-open .mobile-panel__sheet {
  transform: translateX(0);
}

.mobile-panel__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.mobile-panel__top h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 0;
}

.mobile-panel__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: var(--tap);
  height: var(--tap);
  min-height: var(--tap);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mobile-panel__close:hover,
.mobile-panel__close:focus-visible {
  background: var(--color-bg);
}

.mobile-panel__link,
.mobile-panel__parent,
.mobile-panel__sub {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: var(--tap);
  border: 0;
  border-bottom: 1px solid var(--color-divider);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mobile-panel__parent {
  justify-content: space-between;
  gap: 12px;
  padding: 0;
}

.mobile-panel__chevron {
  flex: 0 0 auto;
  width: 0.55em;
  height: 0.55em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.mobile-panel__group.is-open .mobile-panel__chevron {
  transform: rotate(225deg);
}

.mobile-panel__children {
  display: none;
}

.mobile-panel__group.is-open .mobile-panel__children {
  display: block;
}

.mobile-panel__sub {
  padding-left: 18px;
  color: var(--color-muted);
  font-size: 0.92rem;
}

.site-footer {
  background: var(--color-footer);
  color: #e8e2db;
  padding: 48px 0 calc(28px + var(--safe-bottom));
  margin-top: 24px;
}

.site-footer a {
  color: #cfc7bf;
}

.site-footer a:hover {
  color: var(--color-white);
}

.footer-grid {
  display: grid;
  gap: 28px;
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: 24px;
  }
}

.footer-brand__logo {
  display: block;
  width: 150px;
  height: auto;
  max-height: 64px;
  margin-bottom: 12px;
  object-fit: contain;
  object-position: left center;
}

/* Якщо в адмінці темне лого на світлому фоні — інвертуємо лише його */
.footer-brand__logo[src*="/media/"] {
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

.footer-brand p {
  color: #a8a19a;
  font-size: 0.88rem;
  max-width: 260px;
}

.footer-col h4 {
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
  color: var(--color-white);
}

.footer-col ul {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
}

.footer-col a {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  -webkit-hyphens: auto;
  hyphens: auto;
}

.footer-bottom {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #a8a19a;
}

.footer-bottom__meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

@media (min-width: 600px) {
  .footer-bottom__meta {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }
}

.footer-bottom__copy {
  display: block;
}

/* Кредит PrometeyLabs — палітра агенції (orange / purple); специфічність > .site-footer a */
.site-footer__credit {
  --pl-orange: #e65100;
  --pl-purple: #7b2cbf;
  margin: 0;
  color: #cfc7bf;
  font-size: 0.95rem;
  line-height: 1.45;
}

.site-footer .site-footer__credit-link,
.site-footer .site-footer__credit-name {
  color: var(--pl-orange);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-footer .site-footer__credit-link:hover,
.site-footer .site-footer__credit-link:focus-visible {
  color: var(--pl-purple);
}

@media (max-width: 640px) {
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-bottom__meta {
    width: 100%;
  }
}

.pay-icons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pay-icons span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 28px;
  padding: 0 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.68rem;
  font-weight: 600;
  color: #ddd6ce;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 0.82rem;
  color: var(--color-muted);
  padding: 18px 0 8px;
}

.breadcrumbs a:hover {
  color: var(--color-accent-hover);
}

.breadcrumbs span[aria-current="page"] {
  color: var(--color-graphite);
}
