/* ==============================================================================
   STAGGERED MENU — REACT BITS PORT (VANILLA JS + CSS + GSAP)
   UniFLOWs Label Navigation System
   ============================================================================== */

:root {
  --sm-accent: #00d2ff;
  --sm-violet: #5227FF;
  --sm-lilac: #B497CF;
}

/* Fixed container holding overlay and panel */
.staggered-menu-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9990;
  pointer-events: none;
  overflow: hidden;
}

/* Dim backdrop for click-away closing */
.sm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.staggered-menu-wrapper[data-open] .sm-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* Staggered Pre-Layers (Colors Curtain) */
.sm-prelayers {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: clamp(320px, 42vw, 540px);
  pointer-events: none;
  z-index: 9992;
}

[data-position='left'] .sm-prelayers {
  right: auto;
  left: 0;
}

.sm-prelayer {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 100%;
  will-change: transform;
}

[data-position='left'] .sm-prelayer {
  right: auto;
  left: 0;
}

/* Main Sliding Drawer Panel */
.staggered-menu-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: clamp(320px, 42vw, 540px);
  height: 100%;
  background: #0d0d12;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  padding: 5rem 3vw 3rem 3.5vw;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 9995;
  pointer-events: auto;
  box-shadow: -20px 0 50px rgba(0, 0, 0, 0.6);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

[data-position='left'] .staggered-menu-panel {
  right: auto;
  left: 0;
  box-shadow: 20px 0 50px rgba(0, 0, 0, 0.6);
  border-left: none;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sm-panel-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  min-height: 100%;
}

/* Header inside Panel (Close icon or header brand) */
.sm-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sm-panel-brand {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-transform: uppercase;
  color: #fff;
}

.sm-panel-brand small {
  display: block;
  font: 10px 'DM Mono', monospace;
  letter-spacing: 2px;
  color: var(--sm-accent, #00d2ff);
}

.sm-panel-close-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: all 0.25s ease;
}

.sm-panel-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--sm-accent, #00d2ff);
  color: var(--sm-accent, #00d2ff);
  transform: rotate(90deg);
}

/* Navigation List */
.sm-panel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sm-panel-itemWrap {
  position: relative;
  overflow: hidden;
  line-height: 1.25;
}

.sm-panel-item {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  color: #ffffff;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(20px, 2.5vw, 32px);
  font-weight: 700;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.25s ease, transform 0.25s ease;
  width: 100%;
}

.sm-panel-item:hover {
  color: var(--sm-accent, #00d2ff);
  transform: translateX(6px);
}

.sm-panel-itemLabel {
  display: inline-block;
  will-change: transform;
  transform-origin: 0% 100%;
}

/* Numbering (01, 02, 03...) */
.sm-panel-list[data-numbering] {
  counter-reset: smItem;
}

.sm-panel-list[data-numbering] .sm-panel-item::before {
  counter-increment: smItem;
  content: counter(smItem, decimal-leading-zero);
  display: inline-block;
  width: 2.2rem;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 400;
  color: var(--sm-accent, #00d2ff);
  letter-spacing: 0.5px;
  user-select: none;
  opacity: var(--sm-num-opacity, 0);
  transition: opacity 0.3s ease;
}

.sm-panel-item.is-highlight {
  color: #38bdf8;
}

.sm-panel-item.is-special {
  font-size: clamp(14px, 1.4vw, 18px);
  font-family: 'DM Mono', monospace;
  letter-spacing: 1px;
  color: #bbf451;
  margin-top: 0.5rem;
}

.sm-panel-item.is-special::before {
  content: '✦ ' !important;
  color: #bbf451 !important;
}

/* Social links at bottom */
.sm-socials {
  margin-top: auto;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sm-socials-title {
  margin: 0;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--sm-accent, #00d2ff);
}

.sm-socials-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.2rem;
}

.sm-socials-link {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color 0.25s ease, opacity 0.25s ease;
}

.sm-socials-list:hover .sm-socials-link {
  opacity: 0.4;
}

.sm-socials-list:hover .sm-socials-link:hover {
  opacity: 1;
  color: var(--sm-accent, #00d2ff);
}

/* ==============================================================================
   TOGGLE BUTTON (StaggeredMenu Trigger Button in Header)
   ============================================================================== */
.sm-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  color: inherit;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  line-height: 1.2;
  overflow: hidden;
  z-index: 10000;
  transition: border-color 0.25s ease, background-color 0.25s ease, color 0.25s ease;
}

.sm-toggle:hover {
  background: rgba(128, 128, 128, 0.12);
}

.sm-toggle:focus-visible {
  outline: 2px solid var(--sm-accent, #00d2ff);
  outline-offset: 2px;
}

.sm-toggle-textWrap {
  position: relative;
  display: inline-block;
  height: 1.2em;
  overflow: hidden;
  white-space: nowrap;
  min-width: 42px;
  text-align: left;
}

.sm-toggle-textInner {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sm-toggle-line {
  display: block;
  height: 1.2em;
  line-height: 1.2;
}

/* Morphing Icon (+ to ✕) */
.sm-icon {
  position: relative;
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
}

.sm-icon-line {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transform: translate(-50%, -50%);
  will-change: transform;
}

/* Custom layout for site header when StaggeredMenu is active */
.nav.staggered-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 3vw;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 9980;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.nav.staggered-nav .nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .staggered-menu-panel,
  .sm-prelayers {
    width: 100vw;
  }

  .staggered-menu-panel {
    padding: 5rem 6vw 2.5rem;
  }

  .sm-panel-item {
    font-size: 23px;
  }
}
