/* Castlery-style offcanvas: two-column layout with subcategory thumbnails */

.offcanvas-castlery {
  --offcanvas-castlery-bg: #f8f5f1;
  --offcanvas-castlery-text: #4a3728;
  --offcanvas-castlery-active: #b85c38;
  --offcanvas-castlery-border: #e8e4df;
  max-width: 520px !important;
  width: 92vw !important;
  background: var(--offcanvas-castlery-bg) !important;
  z-index: 1090 !important;
  box-shadow: 0.5rem 0 1rem rgba(0, 0, 0, 0.15);
}

.offcanvas-castlery .offcanvas-header {
  background: var(--offcanvas-castlery-bg);
}

.offcanvas-castlery-body {
  overflow: hidden;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
}

/* Promo banner on left edge */
.offcanvas-castlery-promo {
  position: relative;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  background: var(--bs-primary, #4a3728);
  color: #fff !important;
  padding: 1rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  width: 42px;
  min-width: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.offcanvas-castlery-promo-link {
  color: #fff !important;
  text-decoration: none;
}

.offcanvas-castlery-promo-close {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.6rem;
  opacity: 0.8;
}

/* Left panel: main categories */
.offcanvas-castlery-left {
  flex: 0 0 130px;
  min-width: 100px;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--offcanvas-castlery-border);
  padding: 0.5rem 0;
}

.offcanvas-castlery-nav {
  display: flex;
  flex-direction: column;
}

.offcanvas-castlery-dept {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--offcanvas-castlery-text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s;
}

.offcanvas-castlery-dept:hover {
  color: var(--offcanvas-castlery-active);
}

.offcanvas-castlery-dept.active {
  color: var(--offcanvas-castlery-active);
  font-weight: 600;
}

.offcanvas-castlery-extra .offcanvas-castlery-dept {
  font-size: 0.85rem;
  font-weight: 400;
}

/* Right panel: subcategories with thumbnails */
.offcanvas-castlery-right {
  flex: 1 1 0;
  min-width: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 1rem 0.5rem 0.5rem;
}

.offcanvas-castlery-panel {
  display: none;
  flex-direction: column;
}

.offcanvas-castlery-panel.active {
  display: flex;
}

.offcanvas-castlery-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  color: var(--offcanvas-castlery-text);
  text-decoration: none;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--offcanvas-castlery-border);
  gap: 0.75rem;
}

.offcanvas-castlery-item:hover {
  background: rgba(0,0,0,0.03);
  color: var(--offcanvas-castlery-text);
}

.offcanvas-castlery-item-all {
  font-weight: 600;
}

.offcanvas-castlery-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  background: #fff;
  border-radius: 4px;
  flex-shrink: 0;
}

.offcanvas-castlery-thumb-placeholder {
  display: inline-block;
  background: var(--offcanvas-castlery-border);
  min-width: 72px;
  min-height: 72px;
}

@media (min-width: 400px) {
  .offcanvas-castlery {
    width: 90vw !important;
    max-width: 580px !important;
  }
  .offcanvas-castlery-left {
    flex: 0 0 160px;
  }
  .offcanvas-castlery-right {
    flex: 1 1 0;
    min-width: 260px;
  }
}

@media (min-width: 768px) {
  .offcanvas-castlery {
    width: 600px !important;
    max-width: 600px !important;
  }
  .offcanvas-castlery-left {
    flex: 0 0 180px;
  }
}

@media (min-width: 1200px) {
  .offcanvas-castlery {
    width: 680px !important;
    max-width: 680px !important;
  }
  .offcanvas-castlery-left {
    flex: 0 0 200px;
  }
  .offcanvas-castlery-right {
    min-width: 320px;
  }
}
