/**
 * [Think-Open] Journal 3.2 Slide Mobile Menu (v2.1.0)
 * Full-width clean drill-down slide drawer.
 * Automatically inherits the store's theme colors via CSS custom properties set by JS.
 */

:root {
  --smm-header-bg: #1a1a1a;
  --smm-header-color: #ffffff;
  --smm-bar-bg: #f3f3f3;
  --smm-bar-color: #222222;
  --smm-bg: #ffffff;
  --smm-color: #222222;
  --smm-border: #ebebeb;
  --smm-hover-bg: #f7f7f7;
  --smm-accent: #1a1a1a;
  --smm-accent-color: #ffffff;
  --smm-backdrop: rgba(0, 0, 0, 0.45);
  --smm-thumb-size: 46px;
  --smm-speed: 0.3s;
  --smm-ease: cubic-bezier(0.25, 0.8, 0.25, 1);
  --smm-z-index: 2147483000;
}

/* Hide source markup inside Journal's default mobile container */
.smm-source {
  display: none !important;
}

/* Lock body scroll when drawer is open */
html.smm-open,
body.smm-open {
  overflow: hidden !important;
  touch-action: none;
}

/* Root drawer overlay (above cookie banners, chat widgets, etc.) */
.smm-nav {
  position: fixed;
  inset: 0;
  z-index: var(--smm-z-index);
  visibility: hidden;
  pointer-events: none;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.smm-nav.smm-is-open {
  visibility: visible;
  pointer-events: auto;
}

/* Dimmed backdrop (visible on tablets/wider screens) */
.smm-backdrop {
  position: absolute;
  inset: 0;
  background: var(--smm-backdrop);
  opacity: 0;
  transition: opacity var(--smm-speed) var(--smm-ease);
}

.smm-nav.smm-is-open .smm-backdrop {
  opacity: 1;
}

/* Full-width stage on phones; capped cleanly at 420px on tablets */
.smm-stage {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  background: var(--smm-bg);
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
  transform: translate3d(-100%, 0, 0);
  transition: transform var(--smm-speed) var(--smm-ease);
  will-change: transform;
}

.smm-nav.smm-is-open .smm-stage {
  transform: translate3d(0, 0, 0);
}

/* Individual full-width level panel (NO overlapping side strips) */
.smm-panel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--smm-bg);
  color: var(--smm-color);
  transform: translate3d(100%, 0, 0);
  visibility: hidden;
  pointer-events: none;
  transition:
    transform var(--smm-speed) var(--smm-ease),
    visibility 0s linear var(--smm-speed);
  will-change: transform;
  overflow: hidden;
}

/* Active (currently visible) panel */
.smm-panel.smm-panel-active {
  transform: translate3d(0, 0, 0);
  visibility: visible;
  pointer-events: auto;
  transition:
    transform var(--smm-speed) var(--smm-ease),
    visibility 0s linear 0s;
}

/* Parent panel that slid cleanly away to the left */
.smm-panel.smm-panel-prev {
  transform: translate3d(-30%, 0, 0);
  visibility: hidden;
  pointer-events: none;
  transition:
    transform var(--smm-speed) var(--smm-ease),
    visibility 0s linear var(--smm-speed);
}

/* Header bar using the store's theme color */
.smm-header {
  flex: 0 0 auto;
  background: var(--smm-header-bg);
  color: var(--smm-header-color);
  padding: 16px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  box-sizing: border-box;
}

.smm-header-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--smm-header-color);
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}

.smm-header-close {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--smm-header-color);
  position: relative;
  border-radius: 50%;
}

.smm-header-close:active {
  background: rgba(255, 255, 255, 0.15);
}

.smm-header-close::before,
.smm-header-close::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 2px;
  background: currentColor;
}

.smm-header-close::before {
  transform: rotate(45deg);
}

.smm-header-close::after {
  transform: rotate(-45deg);
}

/* Sublevel Back bar */
.smm-bar-btn {
  flex: 0 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--smm-bar-bg);
  color: var(--smm-bar-color);
  border: 0;
  border-bottom: 1px solid var(--smm-border);
  padding: 0 16px;
  min-height: 46px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  transition: background-color 0.15s ease;
}

.smm-bar-btn:active {
  filter: brightness(0.95);
}

.smm-bar-icon-left {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.smm-bar-icon-left::before {
  content: '';
  display: block;
  width: 9px;
  height: 9px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-left: 3px;
}

.smm-bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}

/* Scrollable menu items list */
.smm-list {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
  list-style: none;
  margin: 0;
  padding: 0 0 32px 0;
}

.smm-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--smm-border);
  background: var(--smm-bg);
}

.smm-link {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 14px 10px 16px;
  color: var(--smm-color);
  text-decoration: none;
  font-size: 15px;
  line-height: 1.35;
  box-sizing: border-box;
  transition: background-color 0.15s ease;
}

.smm-link:hover,
.smm-link:active {
  background: var(--smm-hover-bg);
  color: var(--smm-color);
  text-decoration: none;
}

/* Circular category thumbnail (shown only when category has an image) */
.smm-thumb {
  flex: 0 0 var(--smm-thumb-size);
  width: var(--smm-thumb-size);
  height: var(--smm-thumb-size);
  border-radius: 50%;
  overflow: hidden;
  background: #f5f5f5;
  border: 1px solid var(--smm-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.smm-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Soft-tinted circular SVG icon for Level 1 items without a photo */
.smm-thumb.smm-thumb-icon {
  background: #eef5f4;
  background: color-mix(in srgb, var(--smm-accent) 10%, #ffffff);
  border-color: #d6e6e4;
  border-color: color-mix(in srgb, var(--smm-accent) 22%, #ffffff);
  color: var(--smm-accent);
}

.smm-thumb.smm-thumb-icon svg {
  width: 22px;
  height: 22px;
  display: block;
  stroke: currentColor;
  stroke-width: 1.65;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.smm-text-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.smm-title {
  display: block;
  width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
}

.smm-badge {
  display: inline-block;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  border-radius: 4px;
  background: var(--smm-accent);
  color: var(--smm-accent-color);
  max-width: 100%;
}

/* Right chevron button (>) to drill into submenu */
.smm-next-btn {
  flex: 0 0 48px;
  width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-left: 1px solid var(--smm-border);
  cursor: pointer;
  padding: 0;
  color: var(--smm-color);
  transition: background-color 0.15s ease;
}

.smm-next-btn:hover,
.smm-next-btn:active {
  background: var(--smm-hover-bg);
}

.smm-next-btn::before {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
  margin-right: 3px;
  opacity: 0.75;
}

/* "View all" row inside submenus */
.smm-row-view-all .smm-link {
  font-weight: 600;
  color: var(--smm-accent);
  background: var(--smm-hover-bg);
}
