/* Header styles for MiindPuzzleHub */

.mph-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(250, 247, 242, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(187, 160, 132, 0.2);
}

.mph-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.mph-header__brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.mph-header__logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  gap: 0.6rem;
}

.mph-header__logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #f3ebe1;
  border: 2px solid #bba084;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.mph-header__logo-piece {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 6px;
}

.mph-header__logo-piece--one {
  background: #8cb9a2;
  top: 4px;
  left: 4px;
}

.mph-header__logo-piece--two {
  background: #9cc6e3;
  bottom: 4px;
  right: 4px;
}

.mph-header__brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.mph-header__site-name {
  font-family: "Quicksand", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 600;
  letter-spacing: 0.03em;
  font-size: 1.1rem;
  color: #4f3827;
}

.mph-header__tagline {
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.75rem;
  color: #7b6650;
}

/* Navigation */

.mph-header__nav {
  flex: 1 1 auto;
}

.mph-header__nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

.mph-header__nav-link {
  position: relative;
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  color: #5b4632;
  padding: 0.25rem 0;
}

.mph-header__nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #9cc6e3, #8cb9a2);
  transition: width 0.2s ease-out;
}

.mph-header__nav-link:hover::after,
.mph-header__nav-link:focus-visible::after {
  width: 100%;
}

.mph-header__nav-link:focus-visible {
  outline: 2px solid #8cb9a2;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Actions */

.mph-header__actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.mph-header__action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 999px;
  border: 1px solid rgba(91, 70, 50, 0.18);
  background: #ffffff;
  color: #5b4632;
  text-decoration: none;
  transition: background-color 0.15s ease-out, transform 0.12s ease-out, box-shadow 0.12s ease-out;
}

.mph-header__action:hover {
  background-color: #f3ebe1;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(90, 70, 50, 0.12);
}

.mph-header__action:focus-visible {
  outline: 2px solid #9cc6e3;
  outline-offset: 3px;
}

.mph-header__cart-count {
  position: absolute;
  top: -0.1rem;
  right: -0.15rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.15rem;
  border-radius: 999px;
  background: #d98365;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Mobile nav toggle */

.mph-header__nav-toggle {
  display: none;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(91, 70, 50, 0.22);
  background: #ffffff;
  color: #4f3827;
  cursor: pointer;
}

.mph-header__nav-toggle-box {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.18rem;
}

.mph-header__nav-toggle-line {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #4f3827;
  transition: transform 0.18s ease-out, opacity 0.18s ease-out;
}

.mph-header__nav-toggle-text {
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85rem;
}

.mph-header__nav-toggle:focus-visible {
  outline: 2px solid #9cc6e3;
  outline-offset: 2px;
}

/* Toggle open state (JS adds class) */

.mph-header--nav-open .mph-header__nav-toggle-line:nth-child(1) {
  transform: translateY(4px) rotate(45deg);
}

.mph-header--nav-open .mph-header__nav-toggle-line:nth-child(2) {
  opacity: 0;
}

.mph-header--nav-open .mph-header__nav-toggle-line:nth-child(3) {
  transform: translateY(-4px) rotate(-45deg);
}

/* Responsive layout */

@media (max-width: 768px) {
  .mph-header__inner {
    padding: 0.55rem 1rem;
  }

  .mph-header__tagline {
    display: none;
  }

  .mph-header__nav-toggle {
    display: inline-flex;
  }

  .mph-header__nav {
    position: absolute;
    inset-inline: 0;
    top: 100%;
    background: rgba(250, 247, 242, 0.98);
    border-bottom: 1px solid rgba(187, 160, 132, 0.35);
    transform-origin: top;
    transform: scaleY(1);
    opacity: 1;
    max-height: none;
  }

  .mph-header__nav-list {
    flex-direction: column;
    align-items: stretch;
    padding: 0.35rem 1rem 0.8rem;
    gap: 0.15rem;
  }

  .mph-header__nav-link {
    padding: 0.55rem 0.25rem;
  }

  /* JS will add data attribute to hide menu initially while keeping links accessible without JS */
  .mph-header[data-js-enabled="true"] .mph-header__nav {
    transform: scaleY(0);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: transform 0.18s ease-out, opacity 0.18s ease-out, max-height 0.18s ease-out;
  }

  .mph-header[data-js-enabled="true"].mph-header--nav-open .mph-header__nav {
    transform: scaleY(1);
    opacity: 1;
    max-height: 320px;
  }
}

@media (max-width: 480px) {
  .mph-header__site-name {
    font-size: 1rem;
  }

  .mph-header__actions {
    gap: 0.4rem;
  }
}
