/* Side menu (☰) on every page, plus the store header's Links / Store switch. Loaded by the store pages
   and injected by shop/store-menu.js everywhere else */

/* Site pages don't load shop.css, and some never set a night ink, so the menu and header carry their
   own copy of the store colors and fonts */
.store-menu,
.store-header {
  --ink: #14151a;
  --ink-muted: #5c616b;
  --font-display: "Gloria Hallelujah", cursive;
  --font-ui: "Raleway", sans-serif;
}

.store-menu {
  --store-bg: #fbf7f1;
  --store-rule-soft: rgba(20, 21, 26, 0.14);
  --store-hover: rgba(20, 21, 26, 0.06);
  --store-accent: #89cff0;
}

html.site-night .store-menu,
html.site-night .store-header {
  --ink: #e8eef6;
  --ink-muted: #e8eef6;
}

html.site-night .store-menu {
  --store-bg: #0f141b;
  --store-rule-soft: rgba(255, 255, 255, 0.1);
  --store-hover: rgba(255, 255, 255, 0.08);
}

.store-site-toggle a {
  text-decoration: none;
}

/* Links, the side you're not on, reads in blue (baby blue is too faint on the light day header, so days use a deeper blue) */
.store-site-toggle a:not(.is-current) {
  color: #1f78b4;
}

html.site-night .store-site-toggle a:not(.is-current) {
  color: #89cff0;
}

.store-site-toggle a:not(.is-current):hover {
  background: var(--store-hover);
}

.store-site-toggle a:focus-visible {
  outline: 2px solid var(--store-accent);
  outline-offset: 2px;
}

html .store-logo::after {
  content: " Store";
}

/* Tablets / small laptops: the name has to clear the Links / Store pill and cart on the right
   (about 17 em wide in Gloria caps at the desktop letter-spacing) */
@media (min-width: 641px) {
  html .store-logo {
    font-size: min(clamp(1.35rem, 2.8vw, 2rem), calc((100vw - 28.5rem) / 17.2));
  }
}

/* Phones: the logo sits between four 38px icons on one line, so the name scales with the screen
   (about 16 em wide in Gloria caps) */
@media (max-width: 640px) {
  .store-header-bar {
    grid-template-columns: 38px 38px minmax(0, 1fr) 38px 38px;
  }

  html .store-logo {
    font-size: min(1.15rem, calc((100vw - 11.6rem) / 16.2));
    letter-spacing: 0.03em;
  }
}

.store-menu-item.is-soon {
  color: var(--ink-muted);
  cursor: default;
}

.store-menu-item.is-soon:hover {
  background: transparent;
}

.store-menu-soon {
  flex-shrink: 0;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: var(--store-hover);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
}

.store-nav-drop .is-soon {
  padding: 0.6rem 0.8rem;
  color: var(--ink-muted);
  font-family: var(--font-ui, "Raleway", sans-serif);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.7;
}

.store-nav a.is-halloween,
a.store-menu-item.is-halloween {
  color: #c2410c;
}

html.site-night .store-nav a.is-halloween,
html.site-night a.store-menu-item.is-halloween {
  color: #ff8a1f;
}

.candy-cane {
  background: repeating-linear-gradient(-45deg, #c1121f 0 4px, #fff 4px 7px, #1d4ed8 7px 11px, #fff 11px 14px);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 0.5px rgba(20, 21, 26, 0.6);
}

html.site-night .candy-cane {
  background-image: repeating-linear-gradient(-45deg, #ff4d5a 0 4px, #fff 4px 7px, #5b8cff 7px 11px, #fff 11px 14px);
  -webkit-text-stroke: 0;
}

html.store-menu-open,
html.store-menu-open body {
  overflow: hidden;
}

.store-menu {
  position: fixed;
  inset: 0;
  z-index: 1200;
}

.store-menu[hidden] {
  display: none;
}

.store-menu-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 18, 0.45);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.store-menu.is-open .store-menu-backdrop {
  opacity: 1;
}

.store-menu-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(23rem, 86vw);
  display: flex;
  flex-direction: column;
  background: var(--store-bg);
  color: var(--ink);
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.18);
  transform: translateX(-105%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.store-menu.is-open .store-menu-panel {
  transform: none;
}

.store-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: max(0.85rem, env(safe-area-inset-top)) 0.75rem 0.85rem 1.35rem;
  border-bottom: 1px solid var(--store-rule-soft);
}

.store-menu-title {
  margin: 0;
  font-family: var(--font-ui, "Raleway", sans-serif);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.store-menu-head .store-site-toggle {
  display: none;
}

/* Phones: the switch lives in the side menu's top row, not under the logo. With no toggle row, the
   header's scroll fold only has the categories bar to make room for */
@media (max-width: 640px) {
  .store-header .store-header-bar {
    grid-template-areas: "menu search logo . cart";
  }

  .store-header .store-header-bar .store-site-toggle {
    display: none;
  }

  .store-header.is-toggle-hidden {
    margin-bottom: var(--store-nav-h, 2.75rem);
  }

  .store-menu-head .store-site-toggle {
    display: inline-flex;
    /* Right up against the close button; the head's 1rem gap would otherwise sit between them */
    margin: 0 -0.85rem 0 auto;
    max-height: none;
    border-color: var(--store-rule-soft);
  }

  .store-menu-head .store-site-toggle > * {
    padding: 0.45rem 0.7rem;
  }
}

.store-menu-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 0.2s ease;
}

.store-menu-close:hover,
.store-menu-close:focus-visible {
  background: var(--store-hover);
  outline: none;
}

.store-menu-body {
  position: relative;
  flex: 1;
  overflow: hidden;
}

.store-menu-level {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.32s;
}

.store-menu-level.is-active {
  transform: none;
  visibility: visible;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.store-menu-level.is-behind {
  transform: translateX(-30%);
  visibility: hidden;
}

.store-menu-sub {
  background: var(--store-bg);
  transform: translateX(100%);
  visibility: hidden;
}

.store-menu-list,
.store-menu-more {
  list-style: none;
  margin: 0;
  padding: 0;
}

.store-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 1.05rem 1.35rem;
  border: 0;
  border-bottom: 1px solid var(--store-rule-soft);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-ui, "Raleway", sans-serif);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.store-menu-item svg {
  flex-shrink: 0;
  opacity: 0.55;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.store-menu-item:hover,
.store-menu-item:focus-visible {
  background: var(--store-hover);
  outline: none;
}

.store-menu-item:hover svg,
.store-menu-item:focus-visible svg {
  opacity: 1;
  transform: translateX(2px);
}

.store-menu-item > span,
a.store-menu-item {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.store-menu-item.is-current > span,
a.store-menu-item.is-current {
  text-decoration-color: var(--store-accent);
}

.store-menu-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.75rem 0 0 0.85rem;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font-ui, "Raleway", sans-serif);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  align-self: flex-start;
}

.store-menu-back:hover,
.store-menu-back:focus-visible {
  background: var(--store-hover);
  color: var(--ink);
  outline: none;
}

.store-menu-sub-title {
  margin: 0;
  padding: 0.5rem 1.35rem 0.9rem;
  border-bottom: 1px solid var(--store-rule-soft);
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1.2;
}

.store-menu-more {
  padding: 1rem 0 0.5rem;
}

.store-menu-minor {
  display: block;
  padding: 0.6rem 1.35rem;
  color: var(--ink-muted);
  font-family: var(--font-ui, "Raleway", sans-serif);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.2s ease;
}

.store-menu-minor:hover,
.store-menu-minor:focus-visible,
.store-menu-minor.is-current {
  color: var(--ink);
  outline: none;
}

.store-menu-social {
  margin-top: auto;
  padding: 1rem 1.35rem 0.25rem;
  border-top: 1px solid var(--store-rule-soft);
}

.store-menu-social-label {
  margin: 0 0 0.5rem;
  color: var(--ink-muted);
  font-family: var(--font-ui, "Raleway", sans-serif);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.store-menu-social-icons {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  margin: 0 -0.4rem;
}

.store-menu-social-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-width: 0;
  max-width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  opacity: 0.9;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.store-menu-social-icons a:hover,
.store-menu-social-icons a:focus-visible {
  background: var(--store-hover);
  opacity: 1;
  outline: none;
}

.store-menu-social-icons img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

html.site-night .store-menu-social-icons img {
  filter: invert(1) brightness(1.05);
}

html.site-night .store-menu-panel {
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  .store-menu-backdrop,
  .store-menu-panel,
  .store-menu-level,
  .store-menu-level.is-active,
  .store-menu-item svg {
    transition: none;
  }
}
