/* Scoped header styles for PL Trade Hub */

.pth-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #ffffff;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(12px);
}

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

.pth-header__brand {
  display: flex;
  align-items: center;
  min-width: 0;
}

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

.pth-header__logo-mark {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #1d4ed8, #22c55e);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
}

.pth-header__site-text {
  display: flex;
  flex-direction: column;
}

.pth-header__site-name {
  font-weight: 600;
  font-size: 1.05rem;
  color: #0f172a;
}

.pth-header__site-tagline {
  font-size: 0.75rem;
  color: #64748b;
}

.pth-header__nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.pth-header__nav-list {
  display: flex;
  align-items: center;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pth-header__nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.1rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: #0f172a;
  text-decoration: none;
}

.pth-header__nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1d4ed8, #22c55e);
  transition: width 0.18s ease-out;
}

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

.pth-header__nav-link:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 3px;
  border-radius: 4px;
}

.pth-header__cta-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pth-header__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.pth-header__cta--primary {
  background: #1d4ed8;
  color: #ffffff;
}

.pth-header__cta--primary:hover {
  background: #1e40af;
}

.pth-header__cta--primary:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 3px;
}

.pth-header__cta--secondary {
  background: rgba(148, 163, 184, 0.12);
  color: #0f172a;
}

.pth-header__cta--secondary:hover {
  background: rgba(148, 163, 184, 0.22);
}

.pth-header__cta--secondary:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 3px;
}

/* Mobile menu toggle */
.pth-header__menu-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
}

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

.pth-header__menu-toggle-bar {
  width: 1.1rem;
  height: 2px;
  border-radius: 999px;
  background: #0f172a;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.pth-header__menu-toggle-text {
  font-size: 0.85rem;
  font-weight: 500;
}

.pth-header__menu-toggle:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 3px;
}

/* Mobile / tablet layout */
@media (max-width: 768px) {
  .pth-header__inner {
    padding-inline: 1rem;
  }

  .pth-header__nav {
    position: fixed;
    inset-inline: 0;
    top: 3.5rem;
    background: #ffffff;
    border-top: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 14px 45px rgba(15, 23, 42, 0.16);
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem 1rem 1rem;
    max-height: calc(100vh - 3.5rem);
    overflow-y: auto;
    transform: translateY(-110%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.18s ease-out, opacity 0.18s ease-out;
  }

  .pth-header__nav-list {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .pth-header__nav-link {
    padding-block: 0.4rem;
    width: 100%;
  }

  .pth-header__cta-group {
    margin-top: 0.75rem;
    flex-direction: column;
    align-items: stretch;
  }

  .pth-header__cta {
    width: 100%;
    justify-content: center;
  }

  .pth-header__menu-toggle {
    display: inline-flex;
  }

  .pth-header__nav--open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  /* Animate hamburger to X */
  .pth-header__menu-toggle[aria-expanded="true"] .pth-header__menu-toggle-bar:nth-child(1) {
    transform: translateY(4px) rotate(45deg);
  }
  .pth-header__menu-toggle[aria-expanded="true"] .pth-header__menu-toggle-bar:nth-child(2) {
    opacity: 0;
  }
  .pth-header__menu-toggle[aria-expanded="true"] .pth-header__menu-toggle-bar:nth-child(3) {
    transform: translateY(-4px) rotate(-45deg);
  }
}

/* Reduce header stickiness on very small viewports if needed */
@media (max-width: 480px) {
  .pth-header__site-tagline {
    display: none;
  }
}
