/* =====================================================================
   Algaita — Site header
   All classes are prefixed sh- so they never clash with page styles
===================================================================== */

.sh,
.sh-skip {
  --sh-bg: rgba(11, 13, 18, 0.88);
  --sh-surface: #141822;
  --sh-surface-2: #1c2130;
  --sh-line: rgba(255, 255, 255, 0.08);
  --sh-text: #f4f5f7;
  --sh-muted: #9aa3b5;
  --sh-accent: #f5b301;
  --sh-accent-hover: #ffc933;
  --sh-accent-ink: #15130c;
  --sh-accent-soft: rgba(245, 179, 1, 0.14);
  --sh-danger: #f87171;
  --sh-radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.sh *,
.sh *::before,
.sh *::after {
  box-sizing: border-box;
}

.sh-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.sh-icon {
  width: 20px;
  height: 20px;
  flex: none;
  display: block;
}

/* Skip link (visible only when tabbed to) */
.sh-skip {
  position: absolute;
  top: -60px;
  left: 12px;
  z-index: 10000;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--sh-accent);
  color: var(--sh-accent-ink);
  font-weight: 700;
  text-decoration: none;
  transition: top 0.2s;
}

.sh-skip:focus {
  top: 12px;
}

/* =====================================================================
   BAR
===================================================================== */
.sh {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--sh-bg);
  border-bottom: 1px solid var(--sh-line);
  color: var(--sh-text);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
}

.sh a:focus-visible,
.sh button:focus-visible {
  outline: 2px solid var(--sh-accent);
  outline-offset: 2px;
}

.sh-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 12px;
}

/* Brand */
.sh-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
  color: #fff;
  text-decoration: none;
}

.sh-brand img {
  width: 38px;
  height: 38px;
  display: block;
  object-fit: contain;
  border-radius: 10px;
  background: var(--sh-surface);
}

.sh-brand-name {
  display: none;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* =====================================================================
   SEARCH
===================================================================== */
.sh-search {
  flex: 1;
  min-width: 0;
}

.sh-search-form {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--sh-line);
  border-radius: 999px;
  background: var(--sh-surface);
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.sh-search-form:focus-within {
  border-color: rgba(245, 179, 1, 0.6);
  background: var(--sh-surface-2);
  box-shadow: 0 0 0 4px rgba(245, 179, 1, 0.12);
}

.sh-search-icon {
  display: none;
  padding-left: 8px;
  color: var(--sh-muted);
}

.sh-search-icon .sh-icon {
  width: 18px;
  height: 18px;
}

/* 16px stops iPhones zooming in when the box is tapped */
.sh-search-input {
  flex: 1;
  min-width: 0;
  height: 36px;
  margin: 0;
  padding: 0 4px 0 10px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--sh-text);
  font: inherit;
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}

.sh-search-input::placeholder {
  color: var(--sh-muted);
  opacity: 1;
}

.sh-search-input::-webkit-search-cancel-button,
.sh-search-input::-webkit-search-decoration {
  -webkit-appearance: none;
  display: none;
}

.sh-search-clear,
.sh-search-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: none;
  height: 36px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.sh-search-clear {
  width: 32px;
  height: 32px;
  padding: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--sh-muted);
}

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

.sh-search-clear:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.sh-search-clear .sh-icon {
  width: 16px;
  height: 16px;
}

.sh-search-submit {
  width: 40px;
  padding: 0;
  background: var(--sh-accent);
  color: var(--sh-accent-ink);
  font-size: 14px;
  font-weight: 700;
}

.sh-search-submit:hover {
  background: var(--sh-accent-hover);
}

.sh-search-submit .sh-icon {
  width: 18px;
  height: 18px;
}

.sh-search-submit span {
  display: none;
}

/* Suggestions dropdown (full width of the bar on phones) */
.sh-suggest {
  position: absolute;
  top: calc(100% + 2px);
  left: 10px;
  right: 10px;
  z-index: 1100;
  max-height: min(70vh, 480px);
  overflow-y: auto;
  border: 1px solid var(--sh-line);
  border-radius: var(--sh-radius);
  background: var(--sh-surface);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
}

.sh-suggest.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.sh-suggest-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--sh-line);
  color: var(--sh-text);
  text-decoration: none;
  transition: background-color 0.15s;
}

.sh-suggest-item:hover,
.sh-suggest-item:focus-visible {
  background: var(--sh-surface-2);
  outline: none;
}

.sh-suggest-item img {
  width: 40px;
  height: 54px;
  display: block;
  object-fit: cover;
  border-radius: 8px;
  background: var(--sh-surface-2);
}

.sh-suggest-title {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sh-suggest-meta {
  margin-top: 3px;
  color: var(--sh-muted);
  font-size: 12px;
}

.sh-suggest-price {
  color: var(--sh-accent);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.sh-suggest-empty {
  padding: 18px 14px;
  color: var(--sh-muted);
  font-size: 14px;
  text-align: center;
}

.sh-suggest-all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 13px 14px;
  background: var(--sh-surface-2);
  color: var(--sh-accent);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.sh-suggest-all:hover,
.sh-suggest-all:focus-visible {
  background: #232a3c;
  outline: none;
}

.sh-suggest-all strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--sh-text);
  font-size: 13px;
}

.sh-suggest-all .sh-icon {
  width: 16px;
  height: 16px;
}

/* =====================================================================
   DESKTOP NAV
===================================================================== */
.sh-nav {
  display: none;
  align-items: center;
  gap: 2px;
  flex: none;
}

.sh-nav-link {
  position: relative;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--sh-muted);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s, background-color 0.2s;
}

.sh-nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.sh-nav-link.is-active {
  color: #fff;
}

.sh-nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: var(--sh-accent);
}

/* =====================================================================
   CART + MENU BUTTONS
===================================================================== */
.sh-icon-btn,
.sh-menu-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--sh-line);
  border-radius: 12px;
  background: var(--sh-surface);
  color: var(--sh-text);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, transform 0.15s;
}

.sh-icon-btn:hover,
.sh-menu-btn:hover {
  background: var(--sh-surface-2);
  color: #fff;
}

.sh-menu-btn:active {
  transform: scale(0.96);
}

.sh-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 2px solid #0b0d12;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

/* Animated hamburger */
.sh-burger {
  position: relative;
  display: block;
  width: 20px;
  height: 14px;
}

.sh-burger span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.22s ease, opacity 0.18s ease, top 0.22s ease;
}

.sh-burger span:nth-child(1) { top: 0; }
.sh-burger span:nth-child(2) { top: 6px; }
.sh-burger span:nth-child(3) { top: 12px; }

.sh-menu-btn.is-active {
  border-color: rgba(245, 179, 1, 0.5);
  color: var(--sh-accent);
}

.sh-menu-btn.is-active .sh-burger span:nth-child(1) { top: 6px; transform: rotate(45deg); }
.sh-menu-btn.is-active .sh-burger span:nth-child(2) { opacity: 0; }
.sh-menu-btn.is-active .sh-burger span:nth-child(3) { top: 6px; transform: rotate(-45deg); }

/* =====================================================================
   ACCOUNT MENU
===================================================================== */
.sh-account {
  position: relative;
  flex: none;
}

.sh-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 1100;
  width: min(300px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid var(--sh-line);
  border-radius: var(--sh-radius);
  background: var(--sh-surface);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.sh-menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.sh-menu-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--sh-line);
  background: linear-gradient(135deg, rgba(245, 179, 1, 0.12), rgba(245, 179, 1, 0) 70%);
}

.sh-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 999px;
  background: var(--sh-accent);
  color: var(--sh-accent-ink);
  font-size: 17px;
  font-weight: 800;
}

.sh-menu-name {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

.sh-menu-email {
  margin-top: 2px;
  color: var(--sh-muted);
  font-size: 13px;
  word-break: break-word;
}

.sh-menu-section {
  padding: 6px;
  border-bottom: 1px solid var(--sh-line);
}

.sh-menu-section:last-child {
  border-bottom: 0;
}

.sh-menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--sh-text);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.sh-menu-link > .sh-icon:first-child {
  color: var(--sh-muted);
}

.sh-menu-link span {
  flex: 1;
}

.sh-menu-chev {
  width: 16px;
  height: 16px;
  color: var(--sh-muted);
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
}

.sh-menu-link:hover {
  background: var(--sh-surface-2);
  color: #fff;
}

.sh-menu-link:hover .sh-menu-chev {
  opacity: 1;
  transform: translateX(2px);
}

.sh-menu-link.is-active {
  background: var(--sh-accent-soft);
  color: var(--sh-accent);
}

.sh-menu-link.is-active > .sh-icon:first-child {
  color: var(--sh-accent);
}

.sh-menu-link.is-accent,
.sh-menu-link.is-accent > .sh-icon:first-child {
  color: var(--sh-accent);
}

.sh-menu-link.is-danger,
.sh-menu-link.is-danger > .sh-icon:first-child {
  color: var(--sh-danger);
}

/* =====================================================================
   CATEGORY BAR
===================================================================== */
.sh-cats {
  max-width: 1240px;
  margin: 0 auto;
  border-top: 1px solid var(--sh-line);
}

.sh-cats ul {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 8px 12px;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
}

.sh-cats ul::-webkit-scrollbar {
  display: none;
}

.sh-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 14px;
  border: 1px solid var(--sh-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--sh-muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.sh-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sh-chip.is-active {
  border-color: var(--sh-accent);
  background: var(--sh-accent);
  color: var(--sh-accent-ink);
}

/* =====================================================================
   RESPONSIVE
===================================================================== */
@media (min-width: 600px) {
  .sh-bar {
    gap: 12px;
    padding: 12px 20px;
  }

  .sh-brand img {
    width: 40px;
    height: 40px;
  }

  .sh-brand-name { display: inline; }

  .sh-search-icon { display: inline-flex; }

  .sh-search-input {
    padding-left: 4px;
  }

  .sh-search-submit {
    width: auto;
    padding: 0 16px;
  }

  .sh-search-submit .sh-icon { display: none; }
  .sh-search-submit span { display: inline; }

  .sh-cats ul { padding: 8px 20px; }
}

/* From tablet up the suggestions sit right under the search box */
@media (min-width: 768px) {
  .sh-search { position: relative; }

  .sh-suggest {
    top: calc(100% + 8px);
    left: 0;
    right: 0;
  }
}

@media (min-width: 960px) {
  .sh-nav {
    display: flex;
    margin-left: auto;
  }

  .sh-search { max-width: 520px; }

  .sh-search-input { font-size: 14.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .sh *,
  .sh *::before,
  .sh *::after,
  .sh-skip {
    transition: none !important;
  }
}
