/* =============================================================
   right-panel.css — Sliding context drawer (420px)
   ============================================================= */

.right-panel {
  display: flex;
  flex-direction: column;
  width: 0;
  min-width: 0;
  overflow: hidden;
  background: var(--surface) var(--tex-parchment) repeat;
  background-size: 512px 512px;
  border-left: 2px solid rgba(139,26,26,0.25);
  box-shadow: -4px 0 20px rgba(59,47,30,0.25);
  transition: width var(--transition-panel),
              min-width var(--transition-panel);
  position: relative;
  z-index: 90;
  /* overflow:hidden clips the decorative frame overlay — use clip-path instead */
  overflow: hidden;
}

.right-panel--open {
  width: 420px;
  min-width: 420px;
}

/* ── Decorative top frame — gold gradient line ── */
.right-panel__frame-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent 5%, var(--gold-dark) 25%, var(--gold) 50%, var(--gold-dark) 75%, transparent 95%);
  pointer-events: none;
  z-index: 5;
}

/* ── Header ───────────────────────────────────────────────────── */
.right-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 10px;
  background: rgba(217,204,172,0.6);
  border-bottom: var(--border-ornate);
  flex-shrink: 0;
  min-height: 54px;
  position: relative;
  z-index: 1; /* above frame overlay so close button is clickable */
}

.right-panel__title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--ink);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.right-panel__close {
  background: none;
  border: 1px solid transparent;
  color: var(--ink-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 7px;
  border-radius: 2px;
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.right-panel__close:hover {
  background: rgba(139,26,26,0.1);
  border-color: rgba(139,26,26,0.25);
  color: var(--blood);
}

/* ── Body ─────────────────────────────────────────────────────── */
.right-panel__body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 14px;
  background: transparent;
}

/* Scrollbar */
.right-panel__body::-webkit-scrollbar { width: 6px; }
.right-panel__body::-webkit-scrollbar-track { background: var(--surface-deep); }
.right-panel__body::-webkit-scrollbar-thumb { background: rgba(139,26,26,0.3); border-radius: 3px; }
.right-panel__body::-webkit-scrollbar-thumb:hover { background: rgba(139,26,26,0.5); }

/* ── Loading / empty state ────────────────────────────────────── */
.panel-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--ink-muted);
  font-size: 0.85rem;
  gap: 8px;
}

.panel-error {
  padding: 16px;
  background: rgba(139,26,26,0.08);
  border: var(--border-ornate);
  border-radius: 2px;
  color: var(--blood);
  font-size: 0.85rem;
  margin: 8px 0;
}

/* Mobile: full-width panel */
@media (max-width: 640px) {
  .right-panel--open {
    width: 100vw;
    min-width: 100vw;
    position: fixed;
    inset: 48px 0 0 0;
    z-index: 300;
  }
}
