/* FILE: site/drawer.css */
/* Isolated drawer/widget styles to maintain parity and avoid drift */
:root {
  --mb-z: 2000;
  --mb-overlay: rgba(0,0,0,0.5);
  --mb-panel-bg: var(--surface, #ffffff);
  --mb-text: var(--text, #0f2630);
  --mb-muted: var(--muted, #48606a);
  --mb-border: var(--divider, #e7f3ee);
  --mb-radius: var(--radius, 14px);
  --mb-shadow: var(--shadow-lg, 0 12px 34px rgba(0,0,0,0.35));
  --mb-gap: 12px;
}

/* Prevent background scroll when drawer open */
.body--no-scroll { overflow: hidden; }

/* Closed state */
.mb-drawer[aria-hidden="true"] { display: none; }

.mb-drawer {
  position: fixed;
  inset: 0;
  z-index: var(--mb-z);
  display: grid;
  grid-template-rows: 1fr;
  grid-template-columns: 1fr;
}

/* Overlay covers full viewport */
.mb-drawer__overlay {
  position: absolute;
  inset: 0;
  background: var(--mb-overlay);
  backdrop-filter: saturate(120%) blur(2px);
  -webkit-backdrop-filter: saturate(120%) blur(2px);
}

/* Panel: bottom sheet on mobile, right sheet on desktop */
.mb-drawer__panel {
  position: absolute;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: var(--mb-gap);
  background: var(--mb-panel-bg);
  color: var(--mb-text);
  box-shadow: var(--mb-shadow);
  border: 1px solid var(--mb-border);
  border-radius: var(--mb-radius);
  max-height: 85vh;
  width: 100%;
  left: 0;
  right: 0;
  bottom: 0;

  /* Bottom-sheet: slide up */
  transform: translateY(100%);
  transition: transform 180ms ease;
  will-change: transform;
}

.mb-drawer:not([aria-hidden="true"]) .mb-drawer__panel,
.mb-drawer.open .mb-drawer__panel {
  transform: translateY(0);
}

/* Desktop/right-side sheet */
@media (min-width: 900px) {
  .mb-drawer__panel {
    top: 0;
    bottom: 0;
    max-height: 100vh;
    height: 100%;
    width: min(520px, 92vw);
    left: auto;
    right: 0;
    border-radius: 0;
    border-left: 1px solid var(--mb-border);

    /* Slide in from right on desktop */
    transform: translateX(100%);
  }
  .mb-drawer:not([aria-hidden="true"]) .mb-drawer__panel,
  .mb-drawer.open .mb-drawer__panel {
    transform: translateX(0);
  }
}

/* Header row inside panel */
.mb-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--mb-gap);
  padding: 12px 12px 0 12px;
}

.mb-drawer__title {
  margin: 0;
  font-weight: 800;
  font-size: 18px;
  color: var(--mb-text);
}

/* Content area */
.mb-drawer__content {
  overflow: auto;
  padding: 0 12px 12px 12px;
  color: var(--mb-text);
}

/* Close button */
.mb-drawer__close {
  border: 1px solid var(--mb-border);
  background: var(--mb-panel-bg);
  color: var(--mb-text);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
}
.mb-drawer__close:hover {
  background: #f4f7fb;
}

/* Utility: hidden */
[hidden] { display: none !important; }
