/* Proprietary - All rights reserved, Big Laser Co.
 * Shared header styles for biglaser.co subdomains (cherrypick / signgen).
 *
 * All rules scoped under #blc-shared-header so we cannot leak into the host
 * app. Tokens are inlined (not pulled from the host page's :root) so the
 * snippet looks right on CherryPick (dark) and SignGen (dark) without any
 * per-host CSS work. A [data-theme="dark"] block under the same scope is
 * applied automatically by header.js when it detects a dark host.
 *
 * Visual reference: apps/storefront/components/site-nav.tsx +
 * apps/storefront/app/globals.css site-nav__* rules.
 */

#blc-shared-header {
  /* Inline tokens so the snippet doesn't depend on the host page's
   * globals.css. Mirrors apps/storefront/app/globals.css. */
  --blc-paper: #ffffff;
  --blc-ink: #14120f;
  --blc-ink-muted: #6e6a60;
  --blc-rule: #e4dfd3;
  --blc-ruby: #ff2833;
  --blc-ruby-bright: #ff4654;
  --blc-ruby-deep: #c81f28;

  /* Dark-host fallback tokens — overridden by [data-theme="dark"] below. */
  --blc-bg: var(--blc-paper);
  --blc-fg: var(--blc-ink);
  --blc-fg-muted: var(--blc-ink-muted);
  --blc-border: var(--blc-rule);

  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  background: color-mix(in srgb, var(--blc-bg) 92%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--blc-border);
  color: var(--blc-fg);
  font-family: "Inter", "Manrope", "Helvetica Neue", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  box-sizing: border-box;
}

#blc-shared-header *,
#blc-shared-header *::before,
#blc-shared-header *::after {
  box-sizing: border-box;
}

#blc-shared-header .blc-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 24px;
  height: 48px;
}

@media (min-width: 768px) {
  #blc-shared-header .blc-bar {
    height: 56px;
    padding: 0 40px;
    gap: 20px;
  }
}

#blc-shared-header .blc-left {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

@media (min-width: 1024px) {
  #blc-shared-header .blc-left {
    gap: 32px;
  }
}

/* ── Brand ────────────────────────────────────────────────────────────── */

#blc-shared-header .blc-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-family: "Fraunces", "Playfair Display", Georgia, serif;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--blc-fg);
  text-decoration: none;
  white-space: nowrap;
}

@media (min-width: 768px) {
  #blc-shared-header .blc-brand {
    font-size: 0.82rem;
  }
}

/* The real horizontal logo (logo-horizontal.png), matching site-nav.tsx's
   .site-nav__brand-logo. The text wordmark below is the hidden fallback. */
#blc-shared-header .blc-brand__logo {
  display: block;
  width: auto;
  height: 2rem;
  object-fit: contain;
}

@media (min-width: 768px) {
  #blc-shared-header .blc-brand__logo {
    height: 2.4rem;
  }
}

/* Wordmark is a hidden fallback only — the logo image is the brand (mirrors
   site-nav.tsx, where .site-nav__brand-wordmark is display:none). */
#blc-shared-header .blc-brand__text,
#blc-shared-header .blc-brand__suffix {
  display: none;
}

/* ── Nav links (desktop) ──────────────────────────────────────────────── */

#blc-shared-header .blc-nav {
  display: none;
  align-items: center;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 1280px) {
  #blc-shared-header .blc-nav {
    display: flex;
  }
}

@media (min-width: 1024px) {
  #blc-shared-header .blc-nav {
    gap: 28px;
  }
}

#blc-shared-header .blc-nav__link {
  position: relative;
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--blc-fg);
  text-decoration: none;
  padding: 2px 0;
  transition: color 200ms ease;
}

#blc-shared-header .blc-nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(255, 40, 51, 0) 0%,
    rgba(255, 40, 51, 0.35) 36%,
    rgba(255, 40, 51, 0.82) 68%,
    var(--blc-ruby) 92%,
    var(--blc-ruby) 100%
  );
  box-shadow:
    0 0 8px rgba(255, 40, 51, 0.46),
    0 0 18px rgba(255, 40, 51, 0.28),
    0 0 28px rgba(255, 40, 51, 0.16);
  transform-origin: center;
  transform: scaleX(0);
  transition: transform 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

#blc-shared-header .blc-nav__link:hover {
  color: var(--blc-ruby);
}

#blc-shared-header .blc-nav__link:focus-visible {
  color: var(--blc-ruby);
  outline: none;
}

#blc-shared-header .blc-nav__link:hover::after,
#blc-shared-header .blc-nav__link:focus-visible::after {
  transform: scaleX(1);
}

#blc-shared-header .blc-nav__link[data-active="true"] {
  color: var(--blc-ruby);
  font-weight: 600;
}

#blc-shared-header .blc-nav__link[data-active="true"]:hover::after,
#blc-shared-header .blc-nav__link[data-active="true"]:focus-visible::after {
  transform: scaleX(0);
}

/* ── Right side actions ──────────────────────────────────────────────── */

#blc-shared-header .blc-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  #blc-shared-header .blc-right {
    gap: 24px;
  }
}

/* ── Theme toggle ─────────────────────────────────────────────────────
 * Mirrors globals.css .theme-toggle / .theme-toggle--nav. BOTH glyphs are
 * rendered; CSS shows the right one based on the header root's [data-theme].
 * The button NEVER moves — there is no track/translate; only which glyph is
 * display:inline changes. ("we don't move.") */
#blc-shared-header .blc-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  flex-shrink: 0;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--blc-border);
  background: transparent;
  color: var(--blc-fg-muted);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

#blc-shared-header .blc-theme-toggle:hover {
  color: var(--blc-fg);
  border-color: var(--blc-fg-muted);
}

/* Light theme: show moon (offer to switch to dark). Dark theme: show sun. */
#blc-shared-header .blc-theme-toggle__sun {
  display: none;
}
#blc-shared-header[data-theme="dark"] .blc-theme-toggle__sun {
  display: inline;
}
#blc-shared-header[data-theme="dark"] .blc-theme-toggle__moon {
  display: none;
}

/* ── Laser toggle ─────────────────────────────────────────────────────
 * Mirrors globals.css .laser-toggle, but is visible in BOTH light and dark
 * (no [data-theme="light"] display:none) per requirement. */
#blc-shared-header .blc-laser-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 8.1rem;
  height: 2.1rem;
  flex-shrink: 0;
  padding: 0 0.72rem;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--blc-border);
  background: transparent;
  color: var(--blc-fg-muted);
  transition: color 0.15s, border-color 0.15s, background 0.15s, opacity 0.15s;
}

#blc-shared-header .blc-laser-toggle__icon {
  width: 22px;
  height: 22px;
  display: inline-block;
  flex-shrink: 0;
}

#blc-shared-header .blc-laser-toggle__label {
  font-size: 0.82rem;
  white-space: nowrap;
}

#blc-shared-header .blc-laser-toggle[aria-pressed="true"] {
  color: var(--blc-ruby);
  border-color: color-mix(in srgb, var(--blc-ruby) 56%, transparent);
  background: color-mix(in srgb, var(--blc-ruby) 10%, transparent);
}

#blc-shared-header .blc-laser-toggle[aria-pressed="false"] {
  opacity: 0.45;
}

#blc-shared-header .blc-laser-toggle:hover {
  color: var(--blc-ruby);
}

/* Collapse the laser label to an icon-only chip on narrow viewports,
 * matching globals.css @media (max-width: 760px). */
@media (max-width: 760px) {
  #blc-shared-header .blc-laser-toggle {
    width: 2.5rem;
    min-width: 2.5rem;
    padding: 0;
  }
  #blc-shared-header .blc-laser-toggle__label {
    display: none;
  }
}

#blc-shared-header .blc-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--blc-fg);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  position: relative;
  transition: color 200ms ease;
}

#blc-shared-header .blc-action:hover {
  color: var(--blc-ruby);
}

#blc-shared-header .blc-action__label {
  display: none;
}

@media (min-width: 768px) {
  #blc-shared-header .blc-action__label {
    display: inline;
  }
}

#blc-shared-header .blc-action__icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  flex-shrink: 0;
}

#blc-shared-header .blc-cart {
  position: relative;
}

#blc-shared-header .blc-cart__badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: var(--blc-ruby);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transform-origin: center;
}

#blc-shared-header .blc-cart__badge.is-pulsing {
  animation: blcCartPop 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes blcCartPop {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(233, 69, 96, 0);
  }
  46% {
    transform: scale(1.24);
    box-shadow: 0 0 18px rgba(233, 69, 96, 0.42);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(233, 69, 96, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  #blc-shared-header .blc-cart__badge.is-pulsing {
    animation: none;
  }
}

@media (min-width: 768px) {
  #blc-shared-header .blc-cart__badge {
    position: static;
    margin-left: 4px;
  }
}

/* ── Mobile hamburger ─────────────────────────────────────────────────── */

#blc-shared-header .blc-hamburger {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  margin-right: -8px;
  background: transparent;
  border: 0;
  cursor: pointer;
}

@media (min-width: 768px) {
  #blc-shared-header .blc-hamburger {
    display: none;
  }
}

#blc-shared-header .blc-hamburger__bar {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--blc-fg);
  transition: transform 200ms ease, opacity 200ms ease;
}

#blc-shared-header.is-open .blc-hamburger__bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
#blc-shared-header.is-open .blc-hamburger__bar:nth-child(2) {
  opacity: 0;
}
#blc-shared-header.is-open .blc-hamburger__bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ── Mobile menu panel ────────────────────────────────────────────────── */

#blc-shared-header .blc-mobile {
  display: none;
  border-top: 1px solid var(--blc-border);
  padding: 16px 24px 20px;
  flex-direction: column;
  gap: 12px;
}

#blc-shared-header.is-open .blc-mobile {
  display: flex;
}

@media (min-width: 768px) {
  #blc-shared-header .blc-mobile,
  #blc-shared-header.is-open .blc-mobile {
    display: none;
  }
}

#blc-shared-header .blc-mobile__link {
  display: block;
  padding: 4px 0;
  font-size: 1rem;
  color: var(--blc-fg);
  text-decoration: none;
}

#blc-shared-header .blc-mobile__link[data-active="true"] {
  color: var(--blc-ruby);
  font-weight: 600;
}

/* ── Skeleton (degraded / loading state) ─────────────────────────────── */

#blc-shared-header .blc-skeleton {
  display: inline-block;
  width: 80px;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--blc-fg) 8%, transparent) 0%,
    color-mix(in srgb, var(--blc-fg) 16%, transparent) 50%,
    color-mix(in srgb, var(--blc-fg) 8%, transparent) 100%
  );
  background-size: 200% 100%;
  animation: blc-shimmer 1.4s ease-in-out infinite;
}

@keyframes blc-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ── Dark theme — auto-applied when host has data-theme="dark" ───────── */

#blc-shared-header[data-theme="dark"] {
  --blc-bg: #0c0d12;
  --blc-fg: #f5efe4;
  --blc-fg-muted: #d5cfbf;
  --blc-border: #2a2c3d;
  --blc-ruby: #ff2833;
  --blc-ruby-bright: #ff4654;
}

#blc-shared-header[data-theme="dark"] .blc-brand,
#blc-shared-header[data-theme="dark"] .blc-nav__link,
#blc-shared-header[data-theme="dark"] .blc-action,
#blc-shared-header[data-theme="dark"] .blc-mobile__link {
  color: var(--blc-fg);
}

/* The horizontal logo is dark ink, so on the dark bar it sits on a cream
   rounded chip — identical treatment to site-nav.tsx's dark brand logo. */
#blc-shared-header[data-theme="dark"] .blc-brand__logo {
  background: #f5efe4;
  border-radius: 7px;
  padding: 4px 9px;
  box-sizing: content-box;
}

#blc-shared-header[data-theme="dark"] .blc-nav__link:hover,
#blc-shared-header[data-theme="dark"] .blc-action:hover,
#blc-shared-header[data-theme="dark"] .blc-nav__link[data-active="true"],
#blc-shared-header[data-theme="dark"] .blc-mobile__link[data-active="true"] {
  color: var(--blc-ruby-bright);
}

#blc-shared-header[data-theme="dark"] .blc-theme-toggle {
  color: var(--blc-fg-muted);
}
#blc-shared-header[data-theme="dark"] .blc-theme-toggle:hover {
  color: var(--blc-fg);
}
#blc-shared-header[data-theme="dark"] .blc-laser-toggle[aria-pressed="true"] {
  color: var(--blc-ruby-bright);
  border-color: color-mix(in srgb, var(--blc-ruby-bright) 56%, transparent);
  background: color-mix(in srgb, var(--blc-ruby-bright) 12%, transparent);
}
#blc-shared-header[data-theme="dark"] .blc-laser-toggle:hover {
  color: var(--blc-ruby-bright);
}

#blc-shared-header[data-theme="dark"] .blc-hamburger__bar {
  background: var(--blc-fg);
}
