/*
 * Makerique Boutique theme for OpenCart 4
 * Copyright (c) 2026 Heliopsy. All Rights Reserved.
 * https://makerique.com
 * SPDX-License-Identifier: LicenseRef-Proprietary
 * Proprietary and confidential. Unauthorized copying, distribution, or
 * modification of this file, by any means, is strictly prohibited.
 */

/* =====================================================================
   Makerique Boutique — right-side INFO DRAWER (optional, off by default)
   A stack of vertical tab handles pinned to the right edge of every page;
   clicking a handle slides out a panel with that tab's admin-set content
   (size guide, delivery, care instructions, ...). Rendered by the block
   pasted into template/common/footer.twig when mr_drawer.enabled is true.

   Convenience drawer, NOT a blocking modal: the overlay dims but does not
   lock page scroll. All colours/shape/typography come from the --mr-* design
   tokens in makerique.css (with hard fallbacks so it degrades gracefully).
   ===================================================================== */

.mr-drawer {
  --mr-drawer-z:       1045;                 /* above content, below toasts   */
  --mr-drawer-width:   clamp(300px, 90vw, 420px);
  font-family: var(--mr-font-body, sans-serif);
}

/* ---- Handles (pinned to the right edge, vertically centered) --------- */
.mr-drawer-handles {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: var(--mr-drawer-z);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.mr-drawer-handle {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 96px;
  padding: .85rem .55rem;
  border: 0;
  border-radius: var(--mr-radius-sm, 10px) 0 0 var(--mr-radius-sm, 10px);
  background: var(--mr-primary, #B4694E);
  color: var(--mr-badge-text, #fff);
  font-family: var(--mr-font-button, inherit);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: var(--mr-shadow, 0 4px 18px rgba(0, 0, 0, .12));
  transition: background var(--mr-transition, .22s ease),
              transform var(--mr-transition, .22s ease),
              padding-right var(--mr-transition, .22s ease);
}

.mr-drawer-handle:hover,
.mr-drawer-handle:focus-visible {
  background: var(--mr-primary-600, #9E5842);
  padding-right: .9rem;
  outline: none;
}

.mr-drawer-handle-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.mr-drawer-handle-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  max-height: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Overlay (dims, does NOT lock scroll) ---------------------------- */
.mr-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: calc(var(--mr-drawer-z) + 1);
  background: rgba(33, 30, 26, .28);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--mr-transition, .22s ease),
              visibility var(--mr-transition, .22s ease);
}

/* ---- Panel (slides in from the right) -------------------------------- */
.mr-drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: calc(var(--mr-drawer-z) + 2);
  width: var(--mr-drawer-width);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--mr-surface, #fff);
  color: var(--mr-text, #2B2723);
  box-shadow: var(--mr-shadow-hover, -12px 0 34px rgba(0, 0, 0, .16));
  transform: translateX(100%);
  transition: transform var(--mr-transition, .22s ease);
  will-change: transform;
}

.mr-drawer-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--mr-border, #E7DFD5);
}

.mr-drawer-title {
  margin: 0;
  font-family: var(--mr-font-heading, serif);
  color: var(--mr-heading, #211E1A);
  font-size: 1.25rem;
  font-weight: var(--mr-heading-weight, 600);
  line-height: 1.2;
}

.mr-drawer-close {
  flex: 0 0 auto;
  width: 2.1rem;
  height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--mr-radius-pill, 999px);
  background: var(--mr-surface-2, #F4ECE3);
  color: var(--mr-heading, #211E1A);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--mr-transition, .22s ease),
              color var(--mr-transition, .22s ease);
}

.mr-drawer-close:hover,
.mr-drawer-close:focus-visible {
  background: var(--mr-primary, #B4694E);
  color: var(--mr-badge-text, #fff);
  outline: none;
}

.mr-drawer-content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.25rem;
  line-height: var(--mr-lh-base, 1.6);
}

.mr-drawer-pane { display: none; }
.mr-drawer-pane.is-active { display: block; }

/* Readable defaults for admin-authored HTML inside a pane. */
.mr-drawer-content h1,
.mr-drawer-content h2,
.mr-drawer-content h3,
.mr-drawer-content h4 {
  font-family: var(--mr-font-heading, serif);
  color: var(--mr-heading, #211E1A);
  margin: 1.1em 0 .5em;
}
.mr-drawer-content h1:first-child,
.mr-drawer-content h2:first-child,
.mr-drawer-content h3:first-child,
.mr-drawer-content p:first-child { margin-top: 0; }
.mr-drawer-content p,
.mr-drawer-content ul,
.mr-drawer-content ol { margin: 0 0 1em; }
.mr-drawer-content a { color: var(--mr-link, #9E5842); }
.mr-drawer-content img { border-radius: var(--mr-radius, 12px); }
.mr-drawer-content table {
  width: 100%;
  border-collapse: collapse;
}
.mr-drawer-content th,
.mr-drawer-content td {
  padding: .45rem .6rem;
  border: 1px solid var(--mr-border, #E7DFD5);
  text-align: left;
}

/* ---- Open state ------------------------------------------------------ */
.mr-drawer.is-open .mr-drawer-overlay {
  opacity: 1;
  visibility: visible;
}
.mr-drawer.is-open .mr-drawer-panel {
  transform: translateX(0);
}

/* ---- Responsive ------------------------------------------------------ */
@media (max-width: 991.98px) {
  /* On small screens the tall vertical-text tabs covered full-width body text
     mid-page. Move them to a bottom-right FAB-style cluster of round icon
     buttons — out of the text flow — and drop them below Bootstrap's offcanvas
     backdrop (1040) so the mobile menu overlays them. */
  .mr-drawer-handles {
    top: auto;
    bottom: 1rem;
    right: 1rem;           /* inset from the edge (they are round FABs now, not edge tabs) */
    transform: none;
    flex-direction: row;   /* sit side by side, not stacked one above the other */
    z-index: 1035;
    gap: .5rem;
  }
  .mr-drawer-handle {
    min-height: 0;
    width: 3rem;
    height: 3rem;
    padding: 0;
    gap: 0;
    border-radius: 50%;
  }
  .mr-drawer-handle-label { display: none; }
  .mr-drawer-handle-icon { font-size: 1.2rem; }
}

@media (max-width: 575.98px) {
  .mr-drawer { --mr-drawer-width: 100vw; }
}

/* ---- Reduced motion: no slide/fade ----------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .mr-drawer-panel,
  .mr-drawer-overlay,
  .mr-drawer-handle {
    transition: none;
  }
}
