/* Top bar, sticky header (logo · search · actions) and category navigation. */

/* Announcement bar: festive gradient, centred messages. Wide screens show all messages
   in a row; narrow screens rotate one at a time (see src/ui/views/topbar.js). */
.topbar {
  position: relative; overflow: hidden; color: #fff; font-size: 14px;
  background: linear-gradient(90deg, #9f0e23 0%, #d0282f 32%, #e8492f 62%, #f07a1f 100%);
}
.topbar::before { /* faint sparkle texture */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .22;
  background: radial-gradient(rgba(255, 255, 255, .9) 1px, transparent 1.4px) 0 0 / 26px 26px;
}
.topbar__messages { position: relative; display: flex; align-items: center; justify-content: center; min-height: 42px; }
.topbar__msg { display: flex; align-items: center; gap: 8px; padding: 0 24px; font-weight: 600; white-space: nowrap; }
.topbar__msg + .topbar__msg { border-left: 1px solid rgba(255, 255, 255, .35); }
.topbar__msg[hidden] { display: none !important; }
.topbar__msg .icon { width: 18px; height: 18px; stroke-width: 1.9; }
.topbar b { font-weight: 800; }
.topbar [data-countdown] { font-variant-numeric: tabular-nums; }
.topbar__msg--deal a { display: flex; align-items: center; gap: 8px; }
.topbar__cta { padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .2); font-size: 13px; font-weight: 700; }
.topbar__msg--deal a:hover .topbar__cta { background: rgba(255, 255, 255, .32); }
/* WhatsApp link: a white pill so the green reads clearly on the red bar */
.topbar__msg--wa a {
  display: flex; align-items: center; gap: 6px; padding: 4px 12px 4px 10px;
  border-radius: 999px; background: #fff; color: var(--color-wa); font-weight: 800;
  transition: background-color .2s;
}
.topbar__msg--wa a:hover { background: var(--color-wa-soft); }
@media (max-width: 1280px) and (min-width: 1100px) {
  .topbar__msg { padding: 0 14px; }
}

@media (min-width: 1100px) {
  /* the countdown lives in the header chip on wide screens */
  .topbar__msg--deal { display: none; }
  .topbar__msg--deal + .topbar__msg { border-left: 0; }
}
/* Tablets/phones: one rotating message on the left, "Order on WhatsApp →" pinned on the right */
@media (max-width: 1099px) {
  .topbar__messages { justify-content: space-between; gap: 12px; }
  .topbar__msg { display: none; min-width: 0; border-left: 0 !important; padding: 0; }
  .topbar__msg.is-active { display: flex; animation: rise-in .5s var(--ease); }
  .topbar__msg--wa { display: flex; flex: none; margin-left: auto; }
  .topbar__cta { display: none; } /* the whole campaign message is already a link */
  .topbar__msg--deal a { min-width: 0; }
  /* last resort only: each message has a short form below, so this rarely kicks in */
  .topbar__msg > span, .topbar__msg a > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
/* Phones: short forms. "Black November: up to 18% off", "Free Nairobi delivery", "Pay with M-Pesa",
   "Delivery to 47 counties" (the countdown and the details are in the hero and the page). */
@media (max-width: 600px) {
  .topbar { font-size: 12.5px; }
  .topbar__messages { min-height: 38px; gap: 10px; }
  .topbar__more, .topbar__msg--deal [data-role="ends"] { display: none; }
  .topbar__msg .icon { width: 16px; height: 16px; }
  .topbar__msg--wa a { gap: 5px; padding: 3px 10px 3px 8px; }
}
@media (max-width: 440px) {
  .topbar__wa-long { display: none; } /* "WhatsApp →" */
}
@media (max-width: 400px) {
  .topbar__msg:not(.topbar__msg--deal):not(.topbar__msg--wa) > .icon { display: none; }
}
/* the smallest phones: the deal message becomes just "🏷 Up to 18% off" */
@media (max-width: 360px) {
  .topbar__msg--deal [data-role="name"], .topbar__msg--deal [data-role="sep"] { display: none; }
  .topbar__msg--deal [data-role="offer"] { display: inline-block; }
  .topbar__msg--deal [data-role="offer"]::first-letter { text-transform: uppercase; }
}

/* Campaign countdown chip in the header: compact, so it sits in line with search and cart */
.deal-chip {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  height: 40px; padding: 4px 14px 4px 4px; border-radius: 999px;
  background: linear-gradient(135deg, #a50f25 0%, #e8492f 58%, #f07a1f 100%);
  color: #fff; box-shadow: 0 3px 10px rgba(208, 40, 47, .2);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.deal-chip:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(208, 40, 47, .3); }
.deal-chip[hidden] { display: none; }
.deal-chip__icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.deal-chip__icon .icon { width: 16px; height: 16px; stroke-width: 2; animation: gift-wiggle 4s ease-in-out infinite; }
@keyframes gift-wiggle {
  0%, 82%, 100% { transform: rotate(0); }
  86% { transform: rotate(-12deg); }
  90% { transform: rotate(10deg); }
  94% { transform: rotate(-6deg); }
}
.deal-chip__text { display: grid; line-height: 1.15; }
.deal-chip__text small { font-size: 11px; font-weight: 600; opacity: .9; }
.deal-chip__text b { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (max-width: 1099px) {
  .deal-chip { display: none; }
}

.header {
  position: sticky; top: 0; z-index: 40;
  background: #fff;
  border-bottom: 1px solid var(--color-line);
  transition: transform .3s var(--ease), box-shadow .3s;
}
/* Tablets/phones: the header is three rows tall, so it tucks away while scrolling down
   and slides back the moment you scroll up (see bindAutoHide in header.js). */
@media (max-width: 1099px) {
  .header.is-away { transform: translateY(-100%); }
  .header.is-floating { box-shadow: 0 6px 20px rgba(21, 23, 27, .08); }
}
.header__main { display: flex; align-items: center; gap: 24px; min-height: 76px; }

/* logo */
.logo { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.logo__mark {
  display: grid; place-items: center; width: 38px; height: 38px;
  background: var(--color-brand); border-radius: 10px;
}
/* mark: cyclist glyph (Material Icons "directions_bike", Apache-2.0) */
.logo__mark svg { width: 25px; height: 25px; fill: #fff; }
/* wordmark: "Toys" in ink, "Kenya" in brand red over a black · red · green flag stripe */
.logo__word { font-size: 25px; font-weight: 800; letter-spacing: -.04em; line-height: 1; color: var(--color-ink); }
.logo__kenya { position: relative; margin-left: 1px; color: var(--color-brand); }
.logo__kenya::after {
  content: ''; position: absolute; left: 2px; right: 1px; bottom: -6px; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg,
    var(--flag-black, #141414) 0 31%, transparent 31% 34.5%,
    var(--flag-red, #bb0000) 34.5% 65.5%, transparent 65.5% 69%,
    var(--flag-green, #006b3f) 69% 100%);
}
.logo--light .logo__word { color: #fff; }
.logo--light .logo__kenya { color: #ff6a4d; }
.logo--light .logo__kenya::after { --flag-black: #fff; } /* black would vanish on the dark footer */

/* search */
.search {
  flex: 1; max-width: 620px;
  display: flex; align-items: center;
  height: 48px; padding: 0 6px 0 18px;
  background: var(--color-surface); border: 1px solid transparent; border-radius: 999px;
  transition: border-color .2s, background-color .2s, box-shadow .2s;
}
.search:focus-within { background: #fff; border-color: var(--color-line-strong); box-shadow: var(--shadow); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font-size: 15px; }
.search input::placeholder { color: var(--color-muted); }
.search__btn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: var(--color-ink); color: #fff; transition: background-color .2s;
}
.search__btn:hover { background: var(--color-brand); }
.search__btn .icon { width: 18px; height: 18px; stroke-width: 2; }

/* actions */
.header__actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.header-action {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 14px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: var(--color-ink);
  transition: background-color .2s;
}
.header-action:hover { background: var(--color-surface); }
.header-action--cart { background: var(--color-ink); color: #fff; padding: 0 18px; }
.header-action--cart:hover { background: var(--color-brand); }
.count {
  position: absolute; top: 2px; left: 26px;
  min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center;
  border-radius: 999px; background: var(--color-brand); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1;
  box-shadow: 0 0 0 2px #fff;
}
.header-action--cart .count { box-shadow: 0 0 0 2px var(--color-ink); }
.count[hidden] { display: none; }

/* category nav */
.nav { --nav-pad: 14px; }
.nav__list {
  display: flex; gap: 4px; height: 48px; align-items: center;
  overflow-x: auto; scrollbar-width: none;
  margin-left: calc(var(--nav-pad) * -1); /* first link's text lines up with the logo */
}
.nav__list::-webkit-scrollbar { display: none; }
.nav__list button, .nav__list a {
  position: relative;
  display: inline-flex; align-items: center; height: 36px; padding: 0 var(--nav-pad);
  border-radius: 999px; white-space: nowrap;
  font-size: 14px; font-weight: 600; color: var(--color-text);
  transition: background-color .2s, color .2s;
}
.nav__list button:hover, .nav__list a:hover { background: var(--color-surface); color: var(--color-ink); }

/* Current page: bold text with a slim red bar underneath, same footprint as the other links */
.nav__list a[aria-current="page"] { font-weight: 700; color: var(--color-ink); }
.nav__list a[aria-current="page"]::after {
  content: ''; position: absolute; left: var(--nav-pad); right: var(--nav-pad); bottom: 1px;
  height: 3px; border-radius: 3px; background: var(--color-brand);
}
.nav__list a[aria-current="page"]:hover { background: transparent; }

/* Fit the whole menu on laptops: tighter spacing from 1480px down... */
@media (max-width: 1480px) and (min-width: 901px) {
  .nav { --nav-pad: 10px; }
  .nav__list { gap: 2px; }
}
/* ...and on narrow desktops and landscape tablets, drop the two secondary links
   (both sections are still on the home page and in the footer), so Gift finder stays visible. */
@media (max-width: 1260px) and (min-width: 901px) {
  .nav__secondary { display: none; }
}
/* landscape tablets: a touch smaller still, so every link (Gift finder included) fits on one line */
@media (max-width: 1080px) and (min-width: 901px) {
  .nav { --nav-pad: 8px; }
  .nav__list button, .nav__list a { font-size: 13px; }
}
.nav__list .nav__accent { gap: 6px; color: var(--color-brand); }
.nav__list .nav__accent:hover { background: var(--color-brand-soft); color: var(--color-brand-hover); }
.nav__accent .icon { width: 17px; height: 17px; }
.nav__list .nav__accent[aria-current="page"] { color: var(--color-brand); }
.nav__list .nav__home { gap: 6px; }
.nav__home .icon { width: 17px; height: 17px; }

/* ☰ menu and 🔍 search buttons: tablets/phones only */
.header-icon {
  display: none; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%;
  color: var(--color-ink); transition: background-color .2s;
}
.header-icon:hover { background: var(--color-surface); }
.header-icon .icon { width: 24px; height: 24px; stroke-width: 1.8; }

/* Tablets: a single row (☰ · logo · search bar · wishlist · cart). The category row moves
   into the menu drawer, so the sticky header is one compact bar. */
@media (max-width: 900px) {
  .nav { display: none; }
  .header__main { gap: 12px; min-height: 64px; padding: 10px 0; }
  .header-icon--menu { display: grid; margin-left: -10px; } /* the lines sit on the page gutter */
  .search { height: 44px; }
  /* icon-only actions: matching 44px circles, light for wishlist, ink for cart, count on the edge */
  .header-action__label { display: none; }
  .header-action, .header-action--cart { width: 44px; padding: 0; justify-content: center; }
  .header-action { background: var(--color-surface); }
  .header-action--cart { background: var(--color-ink); }
  .header__actions { gap: 8px; }
  .count { top: -3px; left: auto; right: -3px; }
}
/* Phones: ☰ · logo · 🔍 · cart (wishlist lives in the menu). 🔍 opens the search bar as its own row. */
@media (max-width: 600px) {
  .header__main { flex-wrap: wrap; gap: 0 4px; min-height: 60px; padding: 8px 0; }
  .header-icon--search { display: grid; }
  .header-action--wish { display: none; }
  .header__actions { gap: 4px; }
  .logo { gap: 8px; }
  .logo__mark { width: 34px; height: 34px; border-radius: 9px; }
  .logo__mark svg { width: 22px; height: 22px; }
  .logo__word { font-size: 21px; }
  .search { display: none; order: 3; flex-basis: 100%; max-width: none; margin: 6px 0 4px; }
  .header.is-searching .search { display: flex; animation: rise-in .25s var(--ease); }
  .header.is-searching .header-icon--search { background: var(--color-surface); }
}
