/* ─────────────────────────────────────────────────────────────────
   Baygush windows — chrome styling for the movable popup framework
   in /js/bg-windows.js.

   Non-modal, draggable, multi-stack on desktop / iPad landscape;
   collapses to a full-screen sheet on phones / iPad portrait.
   ───────────────────────────────────────────────────────────── */

.bg-win {
  position: fixed;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #FFFFFF;
  border: 1px solid rgba(74, 58, 38, 0.10);
  border-radius: 14px;
  box-shadow:
    0 1px 2px rgba(74, 58, 38, 0.04),
    0 24px 60px -20px rgba(74, 58, 38, 0.30);
  font-family: 'Source Serif 4', Georgia, serif;
  color: #2A1F12;
  /* Above page UI (tops out near z=100), below sticky toast/splash
     layers conventionally at 10000+. JS overrides this per-window
     to maintain a z-stack across multiple open windows. */
  z-index: 9000;
}
.bg-win.is-dragging { user-select: none; cursor: grabbing; }

.bg-win-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px 11px 18px;
  background: #FAF6EE;
  border-bottom: 1px solid rgba(74, 58, 38, 0.08);
  cursor: grab;
  user-select: none;
  /* Stops the browser from intercepting touch gestures on the
     drag header (otherwise iPad treats the swipe as a scroll). */
  touch-action: none;
}
.bg-win-head:active { cursor: grabbing; }

.bg-win-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #2A1F12;
  letter-spacing: 0.02em;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bg-win-close {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: #5C4A35;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 180ms, color 180ms;
  flex-shrink: 0;
}
.bg-win-close:hover {
  background: rgba(74, 58, 38, 0.08);
  color: #2A1F12;
}
.bg-win-close svg { display: block; }

.bg-win-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  background: #FFFFFF;
}

/* Mobile / iPad portrait — full-screen sheet, no drag. The break-
   point matches the rule in bg-windows.js's _isMobile() so JS and
   CSS agree on which form the window takes. */
@media (max-width: 719px) {
  .bg-win {
    left:   0 !important;
    top:    0 !important;
    width:  100vw !important;
    height: 100vh !important;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
  .bg-win-head {
    cursor: default;
    padding: 14px 16px;
  }
}
