/* =============================================================
   Header — two rows, no overlay menu
   =============================================================
   Row 1 (`.header__main`): white bar, logo centre, search + lang right.
   Row 2 (`.header__nav`): BLACK bar matching the footer, white uppercase
   category links, horizontally scrollable on narrow viewports.

   No hamburger button. No left-side drawer. No backdrop. The category
   row is always visible and always reachable.
   ============================================================= */

:root {
  --accent-color: #ff4cfa;
  --accent-hover: #e63de0;
  --header-gap: 0px;
  --header-main-height: 80px;
  --header-nav-height: 52px;
  --header-ticker-height: 0px;
  --font-brutal: "Helvetica Neue", "Helvetica", "Arial", system-ui, sans-serif;
}

/* ─── Header shell ─── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: #ffffff;
}

/* ─── Row 1: white main bar ─── */
.header__main {
  background-color: #ffffff;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: var(--header-main-height, 80px);
  min-height: var(--header-main-height, 80px);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1002;
  box-sizing: border-box;
  border-bottom: 1px solid #e5e5e5;
}

.header__main.header__main--hidden {
  transform: translateY(calc(-1 * var(--header-main-height, 80px)));
}

.header__main-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 8px 36px;
  /* TWO columns: brand on the LEFT, everything else on the RIGHT. */
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
  height: 100%;
  box-sizing: border-box;
}

.header__right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

/* ─── Hamburger button — three thin black lines, animates to X ─── */
.header__menu-btn {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  min-height: 0;
  transition: opacity 0.2s ease;
}

.header__menu-btn:hover {
  opacity: 0.7;
}

.header__menu-line {
  display: block;
  width: 28px;
  height: 2px;
  background: #000;
  transform-origin: center;
  transition: transform 0.32s cubic-bezier(0.65, 0, 0.35, 1),
              opacity 0.22s ease;
}

.header__menu-btn[aria-expanded="true"] .header__menu-line:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.header__menu-btn[aria-expanded="true"] .header__menu-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.header__menu-btn[aria-expanded="true"] .header__menu-line:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.header__logo {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}

.header__logo-text {
  font-size: clamp(28px, 4.2vw, 48px);
  font-weight: 900;
  letter-spacing: -0.04em;
  color: #000;
  font-family: var(--font-brutal);
  font-stretch: condensed;
  text-transform: uppercase;
  line-height: 0.95;
  white-space: nowrap;
}

/* ─── Search ─── */
.header__search-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header__search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  color: #000;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
}

.header__search-btn:hover {
  opacity: 0.7;
}

.header__icon {
  width: 22px;
  height: 22px;
  stroke-width: 2.5;
}

.header__search-form {
  width: 0;
  overflow: hidden;
  opacity: 0;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.header__search-form.header__search-form--active {
  width: 260px;
  opacity: 1;
}

.header__search-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: none;
  border-bottom: 2px solid #000;
  font-size: 15px;
  font-weight: 600;
  /* See base.html — inputs use the neutral OS sans for legibility. */
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", "Helvetica Neue", "Alk Life", sans-serif;
  color: #000;
  caret-color: var(--accent-color);
  background-color: transparent;
}

.header__search-input::placeholder {
  color: #999;
  font-weight: 500;
}

.header__search-input:focus {
  outline: none;
  border-bottom-color: var(--accent-color);
}

/* ─── Language toggle ─── */
.header__lang-wrapper {
  display: flex;
  align-items: center;
  gap: 2px;
}

.header__lang-option {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #999;
  background: none;
  border: 1px solid transparent;
  padding: 8px 10px;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease;
  min-height: 0;
}

.header__lang-option:hover {
  color: #000;
}

.header__lang-option[aria-pressed="true"] {
  color: #000;
  border-color: #000;
}

/* ─── Row 2: BLACK nav bar (footer match) ─── */
.header__nav {
  background-color: #000000;
  color: #ffffff;
  position: fixed;
  top: calc(var(--header-main-height, 80px) + var(--header-gap, 0px));
  left: 0;
  right: 0;
  width: 100%;
  height: var(--header-nav-height, 52px);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              top 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1001;
}

/* When the main row hides on scroll, the nav slides up to take its place. */
.header__main--hidden ~ .header__nav {
  top: 0;
}

.header__nav.header__nav--hidden {
  transform: translateY(calc(-1 * var(--header-nav-height, 52px)));
}

.header__nav-container {
  max-width: 1600px;
  margin: 0 auto;
  height: 100%;
  padding: 0 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  /* Horizontal scroll on narrow viewports — categories never collapse
   * behind a hamburger. Scrollbar hidden for cleanliness. */
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.header__nav-container::-webkit-scrollbar {
  display: none;
}

.header__nav-link {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  min-height: 0;
  transition: color 0.18s ease;
}

/* Animated centre-out underline, matching the footer's title underline. */
.header__nav-link::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 10px;
  height: 1px;
  background: #ffffff;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.25s cubic-bezier(0.65, 0, 0.35, 1);
  pointer-events: none;
}

.header__nav-link:hover,
.header__nav-link:focus-visible {
  color: #ffffff;
  outline: none;
}

.header__nav-link:hover::after,
.header__nav-link:focus-visible::after {
  transform: scaleX(1);
}

/* Apply Georgian font for Georgian-language nav text (Sticky middleware
 * means most users land in ka — this just tightens up rendering). */
.font-georgian .header__nav-link,
.header__nav-link[lang="ka"] {
  font-family: var(--font-georgian), serif;
  letter-spacing: -0.01em;
  font-weight: 700;
}

/* =============================================================
   Responsive
   ============================================================= */
@media (max-width: 1024px) {
  .header__main-container {
    padding: 8px 24px;
  }
  .header__nav-container {
    padding: 0 24px;
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  :root {
    --header-main-height: 56px;
    --header-nav-height: 0px;
    --header-ticker-height: 36px;
  }

  /* ── Mobile main row: black background, footer-aesthetic ── */
  .header__main {
    background-color: #000000;
    border-bottom: none;
  }

  /* White wordmark — same font weight/size as footer title. */
  .header__logo-text {
    font-size: clamp(26px, 7.5vw, 36px);
    font-weight: 900;
    letter-spacing: -0.04em;
    color: #ffffff;
    background: #000000;
    position: relative;
    overflow: hidden;
    display: inline-block;
  }

  /* White overlay — same mechanic as footer title (white on white hides,
   * then sweeps away to reveal). JS drives --reveal-width. */
  .header__logo-text::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 100%;
    background: #ffffff;
    z-index: 1;
    transition: none;
    pointer-events: none;
  }

  .header__logo-text.animating::after {
    width: var(--reveal-width);
  }

  .header__logo-text.covering::after {
    right: auto;
    left: 0;
  }

  /* Icons switch to white so they read on the black bar. */
  .header__search-btn { color: #ffffff; }
  .header__icon { width: 18px; height: 18px; stroke: #ffffff; }
  .header__menu-line { width: 22px; background: #ffffff; }

  /* Search input on dark background. */
  .header__search-input {
    height: 36px;
    font-size: 14px;
    border-bottom-color: rgba(255, 255, 255, 0.5);
    color: #ffffff;
    caret-color: #ff4cfa;
  }
  .header__search-input::placeholder { color: rgba(255, 255, 255, 0.45); }
  .header__search-input:focus { border-bottom-color: #ff4cfa; }

  .header__main-container { padding: 4px 12px; gap: 8px; }
  .header__right { gap: 4px; }
  .header__lang-wrapper { display: none; }
  .header__search-btn, .header__menu-btn { padding: 6px; }
  .header__search-form.header__search-form--active { width: 140px; }

  /* No category nav on mobile — ticker takes that slot. */
  .header__nav { display: none; }

  /* Header never hides on mobile — nav is the primary wayfinding. */
  .header__main.header__main--hidden { transform: none; }
}

@media (max-width: 374px) {
  .header__logo-text {
    font-size: 22px;
  }
  .header__nav-link {
    padding: 0 10px;
    font-size: 9px;
  }
}

/* Push <main> below the fixed header rows so content never sits
 * underneath them. No ticker on desktop, so only main + nav rows count. */
body > main {
  padding-top: calc(var(--header-main-height, 80px)
                  + var(--header-nav-height, 52px)
                  + var(--header-gap, 0px));
  transition: padding-top 0.28s ease;
}

@media (max-width: 768px) {
  body > main {
    /* nav hidden on mobile (0px), ticker is 36px. */
    padding-top: calc(var(--header-main-height, 56px)
                    + var(--header-ticker-height, 36px)
                    + var(--header-gap, 0px));
  }
}

/* =============================================================
   Side drawer + backdrop — opens from the left on hamburger click.
   Same drawer on desktop and mobile (width caps at 380px on desktop,
   88vw on phones). Footer-aesthetic: black bg, white text, animated
   centre-out underlines.
   ============================================================= */
/* Backdrop sits BEHIND the drawer, IN FRONT of the page content.
 * `backdrop-filter: blur()` blurs whatever's visible THROUGH the element,
 * which means the page content behind it — exactly the effect we want.
 * The dark wash (rgba 0.35) is dialled back so the blur reads as the
 * dominant treatment rather than fighting it.
 *
 * `-webkit-backdrop-filter` is the Safari prefix (still required at the
 * time of writing). Firefox supports `backdrop-filter` since 103, no
 * prefix needed. Browsers without support gracefully degrade to just
 * the dim wash — no glitch, no JS fallback required. */
.header__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(10px) saturate(110%);
  backdrop-filter: blur(10px) saturate(110%);
  z-index: 1099;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.32s ease, visibility 0.32s linear,
              backdrop-filter 0.32s ease, -webkit-backdrop-filter 0.32s ease;
  pointer-events: none;
}

.header__backdrop[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Drawer slides in from the RIGHT — matches the hamburger position on
 * the right side of the header, so the panel appears under the cursor
 * rather than on the opposite edge of the screen. */
.side-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  height: 100dvh;
  width: min(380px, 88vw);
  background: #000000;
  color: #ffffff;
  z-index: 1100;
  transform: translateX(100%);
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.side-drawer[aria-hidden="false"] {
  transform: translateX(0);
}

/* Close button sits in the TOP-LEFT corner of the right-side drawer
 * so it doesn't fight the hamburger position on the page itself. */
.side-drawer__close {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  cursor: pointer;
  color: #ffffff;
  min-height: 0;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.side-drawer__close:hover {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.side-drawer__close svg {
  width: 16px;
  height: 16px;
}

.side-drawer__content {
  padding: 80px 32px 40px;
}

.side-drawer__brand {
  font-family: var(--font-brutal);
  font-stretch: condensed;
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 0.9;
  text-transform: uppercase;
  margin-bottom: 32px;
  color: #ffffff;
}

.side-drawer__search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 36px;
}

.side-drawer__search-input {
  flex: 1;
  height: 44px;
  padding: 0 44px 0 0;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 15px;
  font-weight: 500;
  background: transparent;
  color: #ffffff;
  caret-color: var(--accent-color);
  letter-spacing: 0.02em;
}

.side-drawer__search-input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.side-drawer__search-input:focus {
  outline: none;
  border-bottom-color: #ffffff;
}

.side-drawer__search-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.7);
  min-height: 0;
  transition: color 0.18s ease;
}

.side-drawer__search-btn:hover {
  color: #ffffff;
}

.side-drawer__search-btn svg {
  width: 18px;
  height: 18px;
}

.side-drawer__section {
  margin-bottom: 30px;
}

.side-drawer__section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.side-drawer__nav {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.side-drawer__link {
  position: relative;
  display: block;
  padding: 12px 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: padding-left 0.22s ease, color 0.18s ease;
  min-height: 0;
}

.side-drawer__link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 0;
  height: 1px;
  background: #ffffff;
  transform: translateY(-50%);
  transition: width 0.22s ease;
}

.side-drawer__link:hover,
.side-drawer__link:focus-visible {
  padding-left: 22px;
  outline: none;
}

.side-drawer__link:hover::before,
.side-drawer__link:focus-visible::before {
  width: 14px;
}

.side-drawer__lang {
  display: flex;
  gap: 8px;
}

.side-drawer__lang-option {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 9px 16px;
  cursor: pointer;
  min-height: 0;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.side-drawer__lang-option:hover {
  color: #000000;
  background: #ffffff;
  border-color: #ffffff;
}

.side-drawer__lang-option[aria-pressed="true"] {
  color: #000000;
  background: #ffffff;
  border-color: #ffffff;
}

/* Body scroll lock — prevent background from scrolling while drawer open. */
html.drawer-open,
body.drawer-open {
  overflow: hidden;
  height: 100%;
}

/* =============================================================
   Ticker strip — infinite CSS marquee pinned below the header.
   Position is driven entirely by CSS variables so it responds to
   the scroll-hide behaviour and the mobile breakpoint automatically.
   ============================================================= */

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  /* Items are doubled in the HTML, so -50% = one full set width —
   * the loop is perfectly seamless. */
  to   { transform: translateX(-50%); }
}

.header__ticker {
  position: fixed;
  top: calc(var(--header-main-height, 56px)
           + var(--header-gap, 0px));
  left: 0;
  right: 0;
  height: var(--header-ticker-height, 36px);
  background-color: #ffffff;
  z-index: 1000;
  overflow: hidden;
  border-top: 2px solid #000000;
  border-bottom: 2px solid #000000;
  transition: top 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ticker is mobile-only — hide on desktop. Declared here, AFTER the mobile
 * media query above, so the mobile display:block still wins via specificity. */
@media (min-width: 769px) {
  .header__ticker { display: none; }
}

/* On mobile the header never hides — this rule is a no-op there but
 * harmless to leave in (mobile transform is locked to none above). */
.header__ticker-track {
  display: flex;
  align-items: center;
  height: 100%;
  /* will-change keeps the compositor layer stable during the loop. */
  will-change: transform;
  animation: ticker-scroll 22s linear infinite;
  /* Wide enough to hold both copies side-by-side; white-space prevents
   * individual items from wrapping to a second line. */
  white-space: nowrap;
}

.header__ticker-item {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ff4cfa;
  padding: 0 4px;
  height: 100%;
  line-height: 1;
}

.header__ticker-link {
  color: #ff4cfa;
  text-decoration: none;
  transition: color 0.18s ease;
}

.header__ticker-link:hover {
  color: #000000;
}

.header__ticker-sep {
  display: inline-block;
  margin: 0 10px;
  font-size: 8px;
  opacity: 0.55;
  vertical-align: middle;
}

/* On mobile (ticker-only breakpoint) hide the decorative separators. */
@media (max-width: 768px) {
  .header__ticker-sep { display: none; }
}

/* Accessibility: honour the reduced-motion preference by pausing the
 * animation entirely. The text remains visible and readable. */
@media (prefers-reduced-motion: reduce) {
  .header__ticker-track {
    animation-play-state: paused;
  }
}

@media print {
  .header { display: none; }
  .side-drawer { display: none; }
  .header__backdrop { display: none; }
  .header__ticker { display: none; }
  body > main { padding-top: 0 !important; }
}
