/* ================================================================
   SUPRBAD NAVIGATION — DESKTOP MENU PANEL
   Bounded panel (not full-width). Row-based product layout.
   JS sets --sb-header-h on :root after measuring the header.
   ================================================================ */

html {
  scrollbar-gutter: stable;
}

/* ── Menu Drop-Down Panel ──────────────────────────────────────── */

.sb-nav-desktop-menu {
  position: fixed;
  top: var(--sb-header-h, 52px);
  left: 50%;
  max-width: 840px;
  width: 100%;
  z-index: var(--sb-z-menu);
  height: var(--sb-menu-panel-h);
  display: flex;
  flex-direction: column;
  background: var(--sb-color-bg);
  border-bottom: 1px solid var(--sb-color-border);
  border-right: 1px solid var(--sb-color-border);
  border-left: 1px solid var(--sb-color-border);
  box-shadow: 0 8px 40px rgb(0 0 0 / 7%);
  border-radius: 0 0 var(--sb-radius-lg) var(--sb-radius-lg); /* F2: shared radius scale */
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-16px);
  transition:
    opacity var(--sb-dur-panel-open) cubic-bezier(0.22, 0.61, 0.36, 1),
    transform var(--sb-dur-panel-open) cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: opacity, transform;
}

body[data-nav-open='true'] .sb-nav-desktop-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

body[data-nav-open='false'] .sb-nav-desktop-menu {
  transition:
    opacity var(--sb-dur-panel-close) var(--sb-ease-in),
    transform var(--sb-dur-panel-close) var(--sb-ease-in);
}

/* ── Close Button (absolute, no inner strip) ───────────────────── */

.sb-nav-menu-close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 10;
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  color: var(--sb-color-text);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.4;
  transition: opacity 120ms ease;
}

.sb-nav-menu-close:hover {
  opacity: 1;
}
.sb-nav-menu-close:focus-visible {
  outline: 2px solid var(--sb-color-text);
  outline-offset: 2px;
  border-radius: 2px;
  opacity: 1;
}
.sb-nav-menu-close svg {
  width: 16px;
  height: 16px;
}

/* ── Section Panels ────────────────────────────────────────────── */

.sb-nav-panels {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.sb-nav-panel {
  position: absolute;

  /* Longhands first for Safari 12, which has no `inset` (14.1+): without them
     the CORE / ERYTHING direct panels collapse to content height (D-F5; the
     June iPad fix, removed by the 2026-07-12 stylelint --fix). `inset` sets the
     same four values, so every other engine computes the same box. */
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--sb-dur-panel-swap) ease;
}

/* Section IDs are brand constants, not CMS-configurable.
   WP: if IDs ever change, update these selectors and the
   data-section attributes in PHP templates together.     */
body[data-active-section='core'] .sb-nav-panel[data-section='core'],
body[data-active-section='feat'] .sb-nav-panel[data-section='feat'],
body[data-active-section='subvert'] .sb-nav-panel[data-section='subvert'],
body[data-active-section='erything'] .sb-nav-panel[data-section='erything'] {
  opacity: 1;
  pointer-events: auto;
}

/* ── Panel Section Header ──────────────────────────────────────── */

.sb-nav-panel__section-header {
  display: none; /* top nav already communicates active section — no duplication */
}

.sb-nav-panel__section-hdr-name {
  font-family: var(--sb-font-primary);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--sb-color-text-muted);
  text-transform: uppercase;
  display: block;
}

.sb-nav-panel__section-hdr-desc {
  display: none; /* desktop: strip is the sole description surface */
}

/* L2-column section header (Collaboration / Theme panels) */
.sb-nav-panel__l2-section-header {
  display: none; /* top nav already communicates active section — no duplication */
}

.sb-nav-panel__l2-section-name {
  font-family: var(--sb-font-primary);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--sb-color-text-muted);
  text-transform: uppercase;
  display: block;
}

.sb-nav-panel__l2-section-desc {
  display: none; /* desktop: strip is the sole description surface */
}

/* ── Panel Body (row-based) ────────────────────────────────────── */

.sb-nav-panel__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden auto;
  min-height: 0;
}

/* Direct panels (CORE / ERYTHING): constrain + center horizontally within panel. */
.sb-nav-panel--direct .sb-nav-panel__body {
  max-width: 560px;
  align-self: center;
}

.sb-nav-item-row {
  flex: 1;
  display: flex;
  align-items: center;
  cursor: pointer;
  padding-left: var(--sb-panel-px);
  transition: opacity 150ms ease;
  min-height: 60px;

  /* <a> resets */
  text-decoration: none;
  color: inherit;
}

.sb-nav-panel__body[data-active-category]:not([data-active-category=''])
  .sb-nav-item-row:not([data-category-active='true']) {
  opacity: 0.2;
}

/* ── Row: Illustration ─────────────────────────────────────────── */

.sb-nav-item-row__illus {
  width: 140px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  padding: 8px 0;
}

.sb-nav-item-row__illus svg.sb-garment {
  width: auto;
  max-width: 100%;
  max-height: 75%;
  color: var(--sb-color-text);
}

/* Image mode (M4, additive): raster garment mirrors the SVG constraints.
   Note: raster images cannot follow currentColor/token tinting — any future
   token-colored garment state applies only in SVG mode (spec §8.5). */
.sb-nav-item-row__illus img.sb-garment--img {
  width: auto;
  max-width: 100%;
  max-height: 75%;
  object-fit: contain;
}

/* ── Row: Compact Elbow Connector ──────────────────────────────── */

.sb-nav-item-row__connector {
  width: 88px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.sb-nav-item-row__connector svg.sb-row-connector {
  width: 100%;
  height: auto;
  display: block;
  color: var(--sb-color-text);
  overflow: visible;
}

/* ── Row: Label ────────────────────────────────────────────────── */

.sb-nav-item-row__label {
  flex: 1;
  display: flex;
  align-items: center;
  align-self: stretch;
  padding: 0 24px 0 20px;
}

.sb-nav-item-label__text {
  font-family: var(--sb-font-primary);
  font-weight: var(--sb-weight-black);
  font-size: 20px;
  letter-spacing: 0.03em;
  color: var(--sb-color-text-muted);
  transition: color 150ms ease;
  text-transform: uppercase;

  /* Overflow guard: WC category names may be longer than prototype labels */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-nav-item-row[data-category-active='true'] .sb-nav-item-label__text {
  color: var(--sb-color-text);
}

/* ── L2 Layout ─────────────────────────────────────────────────── */

.sb-nav-panel__collab-layout {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.sb-nav-panel__l2-col {
  width: var(--sb-nav-l2-col-w);
  flex-shrink: 0;
  overflow: hidden auto;
  border-right: 1px solid var(--sb-color-border);
  padding: 0;
}

.sb-nav-l2-list-item {
  display: block;
  padding: 12px 28px;
  cursor: pointer;
  position: relative;
  transition: background 100ms ease;

  /* <button> resets */
  -webkit-appearance: none;
  appearance: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
}

.sb-nav-l2-list-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--sb-color-text);
  transform: scaleY(0);
  transition: transform 150ms var(--sb-ease-std);
}

.sb-nav-l2-list-item[data-l2-active='true']::before {
  transform: scaleY(1);
}
.sb-nav-l2-list-item[data-l2-active='true'] {
  background: rgb(0 0 0 / 7%);
}
.sb-nav-l2-list-item:hover {
  background: rgb(0 0 0 / 3%);
}

.sb-nav-l2-list-item__name {
  font-family: var(--sb-font-primary);
  font-weight: var(--sb-weight-black);
  font-size: 15px;
  letter-spacing: 0.03em;
  color: var(--sb-color-text-muted);
  transition: color 120ms ease;
  text-transform: uppercase;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-nav-l2-list-item[data-l2-active='true'] .sb-nav-l2-list-item__name,
.sb-nav-l2-list-item:hover .sb-nav-l2-list-item__name {
  color: var(--sb-color-text);
}

.sb-nav-l2-list-item__desc {
  display: none; /* desktop: strip carries descriptions — no inline duplication */
}

.sb-nav-panel__l3-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  overflow: hidden;
  max-width: 0;
  transition: max-width var(--sb-dur-panel-open) var(--sb-ease-out);
}

.sb-nav-panel__l3-zone[data-open='true'] {
  max-width: calc(100% - var(--sb-nav-l2-col-w) - 1px);
  transition-delay: 80ms;
}

.sb-nav-l3-pane {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--sb-dur-panel-swap) var(--sb-ease-out);
}

.sb-nav-l3-pane[data-l2-active='true'] {
  opacity: 1;
  pointer-events: auto;
}

/* ── Description Strip ─────────────────────────────────────────── */

.sb-nav-strip {
  flex-shrink: 0;
  height: var(--sb-strip-h);
  border-top: 1px solid var(--sb-color-border);
  display: flex;
  align-items: center;
  padding: 0 var(--sb-strip-px);
  overflow: hidden;
}

.sb-nav-strip__asterisk {
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  color: var(--sb-color-text-muted);
}

/* Spacing by margin, not flex `gap` (Safari 14.1+): Safari 12 ignores the
   gap and the name and description run together, "COREThe" (D-F6). The strip
   is one non-wrapping row of fixed children (asterisk; name + desc), so a
   leading margin is the same 16px on every engine. */
.sb-nav-strip__content {
  display: flex;
  align-items: baseline;
  margin-left: 16px;
  transition: opacity var(--sb-dur-strip) ease;
  flex: 1;
  min-width: 0;
}

.sb-nav-strip__content.is-transitioning {
  opacity: 0;
}

.sb-nav-strip__name {
  font-family: var(--sb-font-primary);
  font-weight: var(--sb-weight-black);
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--sb-color-text);
  white-space: nowrap;
  text-transform: uppercase;
}

.sb-nav-strip__desc {
  margin-left: 16px;
  font-family: var(--sb-font-utility);
  font-size: 12px;
  font-weight: var(--sb-weight-light);
  color: var(--sb-color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 767px) {
  .sb-nav-desktop-menu {
    display: none;
  }
}

/* ── Focus visibility ──────────────────────────────────────────── */

.sb-nav-item-row:focus-visible {
  outline: 2px solid var(--sb-color-text);
  outline-offset: -2px;
}

.sb-nav-l2-list-item:focus-visible {
  outline: 2px solid var(--sb-color-text);
  outline-offset: -2px;
  border-radius: 0;
}

/* ── Scroll Indicator Host ─────────────────────────────────────── */

/* Wraps a scrollable container so indicators stay fixed while      */

/* content scrolls. JS inserts this wrapper; it inherits the flex   */

/* slot from the original container.                                */

.sb-nav-indicator-host {
  position: relative;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sb-nav-indicator-host[data-hosting='l2-col'] {
  flex: none;
}

.sb-nav-indicator-host[data-hosting='abs'] {
  position: absolute;
  inset: 0;
  flex: none;
}

/* ── Scroll Indicators ─────────────────────────────────────────── */

/* Flow items in the indicator host: up arrow is first child (above */

/* scrollable content), down arrow is last child (below content).   */

/* Height collapses to 0 when no overflow. JS sets data-visible.    */

/* Click handlers in JS scroll the container by one visible page.   */

.sb-nav-scroll-indicator {
  flex-shrink: 0;
  width: 100%;
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 200ms ease;
  color: var(--sb-color-text-muted);
  pointer-events: none;
  cursor: default;
}

.sb-nav-scroll-indicator[data-visible='true'] {
  height: 36px;
  opacity: 0.45;
  pointer-events: auto;
  cursor: pointer;
}

.sb-nav-scroll-indicator[data-visible='true']:hover {
  opacity: 0.75;
}

.sb-nav-scroll-indicator--up[data-visible='true'] {
  border-bottom: 1px solid var(--sb-color-border);
}

.sb-nav-scroll-indicator--down[data-visible='true'] {
  border-top: 1px solid var(--sb-color-border);
}

.sb-nav-scroll-indicator svg {
  width: 14px;
  height: 9px;
  display: block;
  pointer-events: none;
}

/* ── Hide native scrollbars ────────────────────────────────────── */

/* Scroll remains functional; arrows are the only overflow cue.    */

.sb-nav-panel__body,
.sb-nav-panel__l2-col {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sb-nav-panel__body::-webkit-scrollbar,
.sb-nav-panel__l2-col::-webkit-scrollbar {
  display: none;
}

/* ── Desktop Backdrop Blur ─────────────────────────────────────── */

/* Sits at z-index 49 — below sticky header (50) and menu panel    */

/* (200). backdrop-filter blurs the page content layer only;       */

/* the header and panel are above it and are not blurred.          */

/* pointer-events: none — does not intercept any page interaction. */

/* Reduced-motion: inherits --sb-dur-panel-open → 0.01ms.         */

.sb-nav-backdrop {
  position: fixed;

  /* Longhands for Safari 12 (no `inset`), as .sb-nav-panel (D-F5). */
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  z-index: 49;
  pointer-events: none;
  background: rgb(0 0 0 / 6%);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity var(--sb-dur-panel-open) ease;
}

body[data-nav-open='true'] .sb-nav-backdrop {
  opacity: 1;
}

body[data-nav-open='false'] .sb-nav-backdrop {
  transition: opacity var(--sb-dur-panel-close) ease;
}

@media (max-width: 767px) {
  .sb-nav-backdrop {
    display: none;
  }
}

/* ── Navigation Feedback System (M7.6) ─────────────────────────── */

/* Behaviour: SBNav.commitNavigation() (sb-state.js) stamps
   data-nav-committed on the clicked row AND its menu container the
   instant a real navigation click lands. Appearance is entirely
   token-driven (--sb-color-nav-commit / -soft, --sb-dur-commit,
   --sb-opacity-nav-recede in nav-tokens.css) — re-skin the palette
   and this system follows with zero interaction-code changes.
   Composition: committed row adopts the commit accent instantly, a
   single sweep crosses it once, every other item in the open panel
   recedes, and the whole state holds until the browser unloads. */

/* No underline in ANY interaction state: the base rule sets
   text-decoration: none, but global theme/parent anchor rules
   (a:focus / a:active) can re-underline the row exactly when a click
   focuses it — i.e. the moment it commits (dashed underline seen on
   Android, occasionally desktop). Pin every state explicitly. */
a.sb-nav-item-row,
a.sb-nav-item-row:hover,
a.sb-nav-item-row:focus,
a.sb-nav-item-row:focus-visible,
a.sb-nav-item-row:active,
a.sb-nav-item-row:visited {
  text-decoration: none;
}

/* Committed row: instant accent adoption (garment, connector, label). */
.sb-nav-item-row[data-nav-committed='true'] .sb-nav-item-row__illus svg.sb-garment,
.sb-nav-item-row[data-nav-committed='true'] .sb-nav-item-row__connector svg.sb-row-connector,
.sb-nav-item-row[data-nav-committed='true'] .sb-nav-item-label__text {
  color: var(--sb-color-nav-commit);
}

/* Committed row: one-shot acknowledgment sweep, then hold. The wash lives
   on a 300%-wide background image and the animation slides the visible
   window across it (sliding-window technique: percentage background-
   position resolves as (container − image) × p, which made naive from/to
   values start with the wash already visible — the M7.6 "red flash").
   With a 300% image, `from: 100%` is guaranteed fully transparent and
   `to: 0%` (forwards, no loop) is the deliberate HOLD: the ramp peaks
   just before the row's right edge. Shape tokens: nav-tokens.css. */
.sb-nav-item-row[data-nav-committed='true'] {
  background-image: linear-gradient(
    90deg,
    transparent var(--sb-nav-commit-sweep-from),
    var(--sb-color-nav-commit-soft) var(--sb-nav-commit-sweep-peak),
    transparent var(--sb-nav-commit-sweep-end)
  );
  background-repeat: no-repeat;
  background-size: 300% 100%;
  animation: sb-nav-commit-sweep var(--sb-dur-commit) var(--sb-ease-std) 1 forwards;
}

@keyframes sb-nav-commit-sweep {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: 0% 0;
  }
}

/* Recession: with a commit active, everything else in the menu steps
   back — rows, L2 entries and group headers (FEAT/SUBVERT), section
   headers, the description strip. The committed row is exempt. */
.sb-nav-desktop-menu[data-nav-committed='true'] .sb-nav-item-row:not([data-nav-committed='true']),
.sb-nav-desktop-menu[data-nav-committed='true'] .sb-nav-l2-list-item,
.sb-nav-desktop-menu[data-nav-committed='true'] .sb-nav-panel__l2-section-header,
.sb-nav-desktop-menu[data-nav-committed='true'] .sb-nav-panel__section-header,
.sb-nav-desktop-menu[data-nav-committed='true'] .sb-nav-strip {
  opacity: var(--sb-opacity-nav-recede);
  transition: opacity var(--sb-dur-commit) var(--sb-ease-std);
}

/* The committed row always renders at full strength — including over the
   category-focus dimming rule above. */
.sb-nav-desktop-menu[data-nav-committed='true'] .sb-nav-item-row[data-nav-committed='true'] {
  opacity: 1;
}
