/* ==========================================================================
   BERGHAUS — Alpine Technical Performance Custom Stylesheet
   CSS Design Tokens, Motion, Micro-Interactions & Component Polish
   ========================================================================== */

:root {
  --bh-obsidian: #111111;
  --bh-obsidian-soft: #1c1b1b;
  --bh-crimson: #d63c31;
  --bh-crimson-bright: #e22332;
  --bh-lime: #d9f743;
  --bh-surface: #faf8ff;
  --bh-surface-card: #ffffff;
  --bh-surface-slate: #f1f5f9;
  --bh-surface-low: #f2f3ff;
  --bh-ink: #131b2e;
  --bh-ink-muted: #444748;
  --bh-border: #e2e8f0;
  --bh-glass: rgba(250, 248, 255, 0.88);
  --bh-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

html {
  scroll-behavior: smooth;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: clip;
  overflow-y: auto;
  height: auto;
}

body {
  width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: clip;
  overflow-y: visible;
  height: auto;
  background-color: var(--bh-surface);
  color: var(--bh-ink);
}

.pb-safe {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.pt-safe {
  padding-top: env(safe-area-inset-top, 0px);
}

main > :first-child {
  margin-top: 0 !important;
}

main > :last-child {
  margin-bottom: 0 !important;
}

/* Hide scrollbars only on horizontal carousels, keep vertical page scrollbar working */
.scrollbar-none::-webkit-scrollbar,
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.scrollbar-none,
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* --------------------------------------------------------------------------
   Header Scroll Glassmorphism & Progress Bar
   -------------------------------------------------------------------------- */
header {
  transition: background-color 0.28s var(--bh-ease-out),
              box-shadow 0.28s var(--bh-ease-out),
              border-color 0.28s var(--bh-ease-out);
  border-bottom: 1px solid transparent;
}

header.is-scrolled {
  background-color: var(--bh-glass) !important;
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 8px 28px -8px rgba(19, 27, 46, 0.12);
  border-bottom-color: rgba(226, 232, 240, 0.85);
}

#bh-scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2.5px;
  width: 0%;
  background: linear-gradient(90deg, var(--bh-crimson) 0%, var(--bh-lime) 100%);
  z-index: 95;
  pointer-events: none;
  transition: width 0.08s linear;
}

.bh-ticker-text {
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.bh-ticker-text.is-switching {
  opacity: 0;
  transform: translateY(-4px);
}

/* --------------------------------------------------------------------------
   Hero Expedition Motion & CTA Sweep
   -------------------------------------------------------------------------- */
@keyframes bhHeroKenBurns {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.06);
  }
}

@keyframes bhFadeSlideUp {
  0% {
    opacity: 0;
    transform: translateY(16px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.bh-hero-img {
  animation: bhHeroKenBurns 18s ease-in-out infinite alternate;
  will-change: transform;
}

.bh-hero-stagger > * {
  animation: bhFadeSlideUp 0.65s var(--bh-ease-out) both;
}

.bh-hero-stagger > *:nth-child(1) { animation-delay: 0.05s; }
.bh-hero-stagger > *:nth-child(2) { animation-delay: 0.14s; }
.bh-hero-stagger > *:nth-child(3) { animation-delay: 0.22s; }
.bh-hero-stagger > *:nth-child(4) { animation-delay: 0.30s; }

/* Primary CTA Shine Sweep */
.bh-btn-shine {
  position: relative;
  overflow: hidden;
}

.bh-btn-shine::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.22) 50%, transparent 100%);
  transition: left 0.55s var(--bh-ease-out);
  pointer-events: none;
}

.bh-btn-shine:hover::after {
  left: 140%;
}

/* --------------------------------------------------------------------------
   Product Cards, Swatches & Quick-View Enhancements
   -------------------------------------------------------------------------- */
.bh-product-card {
  border: 1px solid rgba(226, 232, 240, 0.75);
  transition: transform 0.28s var(--bh-ease-out),
              box-shadow 0.28s var(--bh-ease-out),
              border-color 0.28s var(--bh-ease-out);
}

.bh-product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px -10px rgba(19, 27, 46, 0.14);
  border-color: #cbd5e1;
}

.bh-quick-bar {
  position: absolute;
  left: 0.45rem;
  right: 0.45rem;
  bottom: 0.45rem;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: 0.35rem;
  padding: 0.35rem 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.22s var(--bh-ease-out), transform 0.22s var(--bh-ease-out);
  z-index: 15;
}

@media (hover: hover) and (pointer: fine) {
  .bh-product-card:hover .bh-quick-bar,
  .bh-product-card:focus-within .bh-quick-bar {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
}

@media (hover: none) {
  .bh-quick-bar {
    display: none;
  }
}

.bh-quick-size {
  font-family: "Space Grotesk", sans-serif;
  font-size: 10px;
  font-weight: 700;
  padding: 0.15rem 0.35rem;
  border-radius: 0.2rem;
  color: var(--bh-ink);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.bh-quick-size:hover {
  background-color: var(--bh-obsidian);
  color: #ffffff;
}

.bh-swatch-btn {
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.bh-swatch-btn:hover {
  transform: scale(1.2);
}

/* Official Berghaus Product Badges (On Sale / Best seller / Trending) */
.bh-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.55rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.03em;
  border-radius: 1px;
  white-space: nowrap;
}

.bh-badge-sale {
  background-color: #ffffff;
  color: #d63c31;
  border: 1px solid #d63c31;
}

.bh-badge-bestseller {
  background-color: #111111;
  color: #ffffff;
  border: 1px solid #111111;
}

.bh-badge-trending {
  background-color: #d9f743;
  color: #111111;
  border: 1px solid #d9f743;
}

/* Gear Focus Editorial Cards */
.bh-gear-card {
  transition: transform 0.3s var(--bh-ease-out), box-shadow 0.3s var(--bh-ease-out);
}

.bh-gear-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 34px -12px rgba(0, 0, 0, 0.35);
}

.bh-gear-card .material-symbols-outlined {
  transition: transform 0.25s var(--bh-ease-out);
}

.bh-gear-card:hover .material-symbols-outlined {
  transform: translateX(4px);
}

/* --------------------------------------------------------------------------
   Scroll Reveal Transitions
   -------------------------------------------------------------------------- */
.bh-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s var(--bh-ease-out), transform 0.55s var(--bh-ease-out);
}

.bh-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Accordions & Floating Back-to-Top Button
   -------------------------------------------------------------------------- */
details[open] > div {
  animation: bhFadeSlideUp 0.25s var(--bh-ease-out);
}

#bh-back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 5.25rem;
  z-index: 45;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  background-color: var(--bh-obsidian);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 24px -6px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.92);
  transition: opacity 0.25s ease, transform 0.25s var(--bh-ease-out), background-color 0.2s ease;
}

@media (min-width: 1024px) {
  #bh-back-to-top {
    bottom: 1.75rem;
    right: 1.75rem;
  }
}

#bh-back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

#bh-back-to-top:hover {
  background-color: var(--bh-crimson);
  transform: translateY(-2px) scale(1.04);
}

/* Out-of-stock diagonal slash utility from DESIGN.md */
.size-oos {
  position: relative;
  opacity: 0.45;
  cursor: not-allowed;
}

.size-oos::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom right,
    transparent calc(50% - 1px),
    #64748b 50%,
    transparent calc(50% + 1px)
  );
  pointer-events: none;
}

/* Smooth drawer transitions */
.drawer-panel {
  transition: transform 0.28s var(--bh-ease-out), opacity 0.22s ease;
}

.modal-backdrop {
  transition: opacity 0.22s ease;
}

/* Material Symbols crisp alignment */
.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
  user-select: none;
}

.material-symbols-filled {
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
}

/* Product zoom effect */
.zoomed-view {
  transform: scale(1.65);
  cursor: zoom-out;
}

/* Sitewide Desktop Navigation Dropdowns */
.bh-nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.bh-nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  padding-top: 10px;
  min-width: 230px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.18s var(--bh-ease-out), transform 0.18s var(--bh-ease-out), visibility 0.18s;
  z-index: 90;
}

.bh-nav-item:hover .bh-nav-dropdown,
.bh-nav-item:focus-within .bh-nav-dropdown,
.bh-nav-item.is-open .bh-nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.bh-nav-dropdown-panel {
  background: #ffffff;
  border: 1px solid var(--bh-border);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 18px 36px rgba(17, 17, 17, 0.12);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bh-nav-dropdown-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bh-obsidian);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.bh-nav-dropdown-link:hover {
  background: var(--bh-surface-slate);
  color: var(--bh-crimson);
}

/* Respect user reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .bh-hero-img,
  .bh-hero-stagger > *,
  .bh-reveal,
  .bh-product-card,
  .bh-gear-card {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
