/* Kodumarket Julge — site header
   Two-row header:
   1. Top info strip (dark, mono uppercase) — §5.1 p.1
   2. Main header (logo, nav, search/user/cart) — §5.1 p.2
   On the homepage, the header sits over the dark hero — on other pages it has a light treatment. */

/* ---------- Hide GeneratePress default header; we build our own ---------- */
.site-header {
  display: none;
}

/* ---------- Custom header wrapper ---------- */
.km-header-wrap {
  position: relative;
  z-index: 10;
}

/* Default (no dark hero behind the header): light treatment */
.km-header-wrap {
  background: #fff;
  color: var(--km-ink);
  border-bottom: 1px solid var(--km-line);
}

/* When body has .km-has-dark-hero (set per-page where a full-bleed dark hero
   is rendered right after the header — e.g. the homepage when Stage 2 ships) */
body.km-has-dark-hero .km-header-wrap {
  background: transparent;
  border-bottom: 0;
  /* text stays dark — headers are above the white area until hero begins */
  color: var(--km-ink);
}

/* ---------- Top info strip ---------- */
.km-topstrip {
  padding: 14px 48px 0;
  font: 400 11px/1 "Geist Mono", ui-monospace, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--km-ink-3);
  opacity: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.km-topstrip__left,
.km-topstrip__right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.km-topstrip__left > span,
.km-topstrip__right > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.km-topstrip__left > span + span::before,
.km-topstrip__right > span + span::before {
  content: "·";
  margin-right: 10px;
  opacity: .6;
}
.km-topstrip .km-dot {
  width: 6px; height: 6px;
  border-radius: 999px;
  display: inline-block;
  background: var(--km-green-500);
  margin-right: 6px;
  vertical-align: middle;
}

/* ---------- Main header ---------- */
.km-mainhead {
  padding: 20px 48px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 32px;
}

/* Logo slot */
.km-mainhead__logo {
  display: inline-flex;
  align-items: center;
}
.km-mainhead__logo img,
.km-mainhead__logo svg {
  display: block;
  height: 52px;
  width: auto;
}

/* Note: the .km-has-dark-hero logo white plate rule was removed in
 * v1.7.8 — header no longer overlaps the dark hero, so there's no
 * need for a white plate around the logo. */

/* ---------- Primary nav ---------- */
.km-nav {
  display: flex;
  justify-content: center;
}
.km-nav ul {
  list-style: none;
  padding: 0; margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 28px;
}
.km-nav a {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: inherit;
  text-decoration: none;
  padding: 6px 0;
  position: relative;
  transition: opacity .15s;
}
.km-nav a:hover { opacity: .75; }
.km-nav .current-menu-item > a,
.km-nav .current_page_item > a {
  font-weight: 600;
}

/* ---------- Header actions (right side) ---------- */
.km-headactions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.km-headactions__icon {
  width: 36px; height: 36px;
  border-radius: 999px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  color: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

/* Light-page treatment (default) */
.km-headactions__icon {
  background: var(--km-surface-2);
  border-color: var(--km-line);
}
.km-headactions__icon:hover {
  background: var(--km-surface-3);
}

.km-headactions__icon svg {
  width: 18px; height: 18px;
  stroke-width: 1.75;
}

/* Cart pill */
.km-cartpill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  font: 600 13px/1 "Geist", sans-serif;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: transform .12s ease, background .15s;
}
.km-cartpill:hover { transform: translateY(-1px); }

/* Light pages (default) — black pill */
.km-cartpill {
  background: var(--km-ink);
  color: #fff;
}
.km-cartpill:hover {
  background: #000;
  color: #fff;
}

.km-cartpill__count {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  opacity: .8;
  padding-left: 10px;
  border-left: 1px solid currentColor;
  margin-left: 2px;
}

/* ===========================================================
 * v1.7.42: search-as-wide-pill + cart-as-icon variants.
 * Aleksei wants the search trigger to read "Otsi / Поиск /
 * Search" rather than just a magnifier icon, AND sit BEFORE the
 * language switcher. Cart is reduced to icon + counter to
 * compensate for the extra header width.
 * =========================================================== */

/* Wide search button — pill with text label, no glyph */
.km-headactions__search--wide {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 22px;
  border: 1px solid var(--km-line);
  border-radius: 999px;
  background: var(--km-surface-2);
  color: var(--km-ink);
  font: 600 12px/1 "Geist Mono", ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: .12em;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
  /* Make sure it doesn't get squashed by the lang switcher next to it */
  flex-shrink: 0;
}
.km-headactions__search--wide:hover {
  background: var(--km-surface-3);
  transform: translateY(-1px);
}
.km-headactions__search--wide:focus-visible {
  outline: 2px solid var(--km-green-500);
  outline-offset: 2px;
}
.km-headactions__search-label {
  pointer-events: none;
}

/* Cart pill — icon-only variant (no "Korv" word) */
.km-cartpill--icon {
  gap: 8px;
  padding: 0 16px;
}
.km-cartpill__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
/* Counter divider must be removed when no text precedes it */
.km-cartpill--icon .km-cartpill__count {
  padding-left: 0;
  border-left: none;
  margin-left: 0;
}

/* ---------- Mobile (<1024px) ---------- */
@media (max-width: 1024px) {
  .km-topstrip { padding: 10px 16px 0; font-size: 10px; letter-spacing: .08em; }
  .km-topstrip__right { display: none; }
  .km-mainhead {
    padding: 14px 16px;
    gap: 12px;
    grid-template-columns: auto 1fr auto;
  }
  .km-nav { display: none; } /* mobile menu handled in mobile.css */
  .km-headactions__icon.km-headactions__user { display: none; }
  .km-cartpill { height: 40px; padding: 0 14px; }
  .km-cartpill__count { padding-left: 8px; }

  /* v1.7.42: tighten search button on mobile so all 3 elements
   * (search + lang switcher + cart) fit. Hide the wide search
   * entirely on mobile — there's a 'Otsi' tab in the bottom-bar
   * that takes over its role on phones. */
  .km-headactions__search--wide { display: none; }
}

/* Hamburger (visible only on mobile) */
.km-hamburger {
  display: none;
  width: 40px; height: 40px;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
@media (max-width: 1024px) {
  .km-hamburger { display: inline-flex; }
}
.km-hamburger svg { width: 22px; height: 22px; }
