/* ═══════════════════════════════════════════════════════════════
   PHASE F5 — Bond Memories tab + viewer styles
   ───────────────────────────────────────────────────────────────
   Cream stationery palette to match Phase G inbox + Phase H
   ceremony. Mobile-first; medium-width tablet/desktop adapts via
   single breakpoint at 720px. Card list lives in the new
   #sectionMemories surface; the viewer is a fullscreen overlay
   pinned to the viewport.
   ═══════════════════════════════════════════════════════════════ */

/* ── Section wrapper ─────────────────────────────────────────── */
#sectionMemories { display:none; }
#sectionMemories.active { display:block; }

.bondm-section-wrap {
  padding: 18px 16px 64px;
  max-width: 720px;
  margin: 0 auto;
  color: var(--bond-text, #f1f5f9);
}

.bondm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.bondm-header-center {
  flex: 1;
  text-align: center;
}
.bondm-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.45rem;
  color: var(--bond-gold, #fbbf24);
  letter-spacing: 0.01em;
}
.bondm-subtitle {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 0.85rem;
  color: var(--bond-muted, #94a3b8);
  margin-top: 2px;
}
.bondm-header-icon {
  color: var(--bond-gold, #fbbf24);
  opacity: 0.85;
}

/* ── List ────────────────────────────────────────────────────── */
.bondm-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bondm-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px 16px;
  background: linear-gradient(135deg, #fbf6ea 0%, #f4ebd4 100%);
  border: 1px solid rgba(120, 90, 40, 0.22);
  border-radius: 6px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 1px 2px rgba(20, 14, 6, 0.18),
    0 6px 12px rgba(20, 14, 6, 0.22),
    0 10px 22px rgba(20, 14, 6, 0.18);
  color: #2b210f;
  font-family: 'Cormorant Garamond', Georgia, serif;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: transform 160ms ease, box-shadow 160ms ease;
  overflow: hidden;
}
.bondm-card:focus { outline: 2px solid var(--bond-gold, #fbbf24); outline-offset: 3px; }
.bondm-card:hover {
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 2px 4px rgba(20, 14, 6, 0.22),
    0 10px 18px rgba(20, 14, 6, 0.28),
    0 16px 28px rgba(20, 14, 6, 0.22);
}
.bondm-card:active { transform: translateY(0); }

/* Phase 7 — paper-card chrome. The procedural paper-grain layer is
   injected as an inline background by js/bond-memory.js using the
   per-memory seed tuple; CSS reserves room for the postmark + wax
   slots and keeps the card overflow tight so the corner artwork
   sits inside the deckled paper edge. The `data-paper-dna` attribute
   is added by _applyMemoryPaper for debugging/visual QA. */
.bondm-card-paper {
  /* Subtle deckled-edge feel: the inner highlight mimics light
     catching a slightly raised paper surface, NOT a material-design
     elevation. Keep the radius small — paper has corners. */
  padding-right: 88px; /* leave room for postmark + wax stack on the right */
  min-height: 96px;
}
.bondm-card-paper::before {
  /* Faint inner shadow against the deckled edge — anchors the
     procedural grain to a real-paper depth without overpowering it. */
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(120, 90, 40, 0.10),
              inset 0 1px 8px rgba(120, 90, 40, 0.08);
}

.bondm-card-cover-wrap {
  flex: 0 0 60px;
  width: 60px; height: 60px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  background: #d9c39a;
  box-shadow: inset 0 0 0 1px rgba(120, 90, 40, 0.18),
              0 1px 2px rgba(120, 90, 40, 0.22);
}
.bondm-card-cover {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.bondm-wax-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 12px rgba(0,0,0,0.35);
}

.bondm-card-body {
  flex: 1;
  min-width: 0;
  /* Sits above the ::before inner shadow + paper texture layer. */
  position: relative;
  z-index: 1;
}
.bondm-card-title {
  font-size: 1.08rem;
  font-weight: 500;
  color: #3a2c10;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bondm-card-when {
  font-size: 0.82rem;
  color: #6b5a35;
  margin-top: 2px;
  font-style: italic;
}
.bondm-card-meta {
  font-size: 0.74rem;
  color: #8a7a55;
  margin-top: 2px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ── Phase 7: postmark stamp (top-right) + wax seal (bottom-right) ── */
.bondm-card-postmark {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 58px;
  height: 58px;
  pointer-events: none;
  transform: rotate(-7deg);
  transform-origin: 60% 40%;
  opacity: 0.78;
  /* Multiply blend so the postmark ink reads as if absorbed into the
     paper fiber rather than sitting on top as a sticker. */
  mix-blend-mode: multiply;
  z-index: 2;
}
.bondm-card-postmark svg {
  width: 100%;
  height: 100%;
  display: block;
}
.bondm-card-wax {
  position: absolute;
  bottom: 8px;
  right: 10px;
  width: 38px;
  height: 38px;
  pointer-events: none;
  filter: drop-shadow(0 1px 1.4px rgba(20, 14, 6, 0.38));
  z-index: 3;
}
.bondm-card-wax svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Empty / loading ─────────────────────────────────────────── */
.bondm-empty {
  margin-top: 24px;
  padding: 26px 18px;
  text-align: center;
  background: rgba(251, 191, 36, 0.04);
  border: 1px dashed rgba(251, 191, 36, 0.22);
  border-radius: 14px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  color: var(--bond-muted, #94a3b8);
}
.bondm-empty-icon { margin-bottom: 8px; color: var(--bond-gold, #fbbf24); opacity: 0.85; }
.bondm-empty-title {
  font-style: normal;
  font-size: 1.1rem;
  color: var(--bond-text, #f1f5f9);
  margin-bottom: 4px;
}
.bondm-empty-desc {
  font-size: 0.85rem;
  color: var(--bond-muted, #94a3b8);
  line-height: 1.45;
  max-width: 320px;
  margin: 0 auto;
}
.bondm-empty-error { color: #fca5a5; border-color: rgba(248, 113, 113, 0.3); }
.bondm-empty-loading { color: var(--bond-muted, #94a3b8); }

/* ── Viewer (fullscreen overlay) ─────────────────────────────── */
body.bondm-viewer-open { overflow: hidden; }

.bondm-viewer {
  position: fixed;
  inset: 0;
  z-index: 9050;
  background: rgba(8, 6, 2, 0.94);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  color: #fbf6ea;
  font-family: 'Cormorant Garamond', Georgia, serif;
}

.bondm-viewer-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 6px;
  flex: 0 0 auto;
}
.bondm-viewer-close, .bondm-viewer-btn {
  background: rgba(251, 191, 36, 0.1);
  color: #fbf6ea;
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.86rem;
  cursor: pointer;
  transition: background 160ms ease;
}
.bondm-viewer-close { padding: 6px; line-height: 0; }
.bondm-viewer-close:hover, .bondm-viewer-btn:hover { background: rgba(251, 191, 36, 0.18); }
.bondm-viewer-meta {
  flex: 1;
  text-align: center;
  min-width: 0;
}
.bondm-viewer-title {
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bondm-viewer-when {
  font-size: 0.78rem;
  color: rgba(251, 246, 234, 0.7);
  font-style: italic;
  margin-top: 2px;
}
.bondm-viewer-actions { display: flex; gap: 8px; }

.bondm-viewer-progress {
  display: flex;
  gap: 4px;
  padding: 0 18px 6px;
  justify-content: center;
  flex-wrap: wrap;
}
.bondm-progress-dot {
  width: 14px; height: 3px;
  border-radius: 2px;
  background: rgba(251, 246, 234, 0.18);
  transition: background 200ms ease, width 200ms ease;
}
.bondm-progress-dot.active {
  background: var(--bond-gold, #fbbf24);
  width: 22px;
}

.bondm-viewer-stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px 16px;
  min-height: 0;
  overflow: hidden;
}

.bondm-viewer-controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 18px 22px;
}
.bondm-viewer-nav {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.2);
  color: #fbf6ea;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 160ms ease;
}
.bondm-viewer-nav:hover { background: rgba(251, 191, 36, 0.16); }
.bondm-viewer-index {
  font-size: 0.85rem;
  color: rgba(251, 246, 234, 0.7);
}

/* ── Slides ──────────────────────────────────────────────────── */
.bondm-slide {
  width: 100%;
  max-width: 540px;
  max-height: 100%;
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45),
              inset 0 1px 0 rgba(255, 255, 255, 0.4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.bondm-slide-text {
  padding: 28px 26px 22px;
  color: #2b210f;
  min-height: 320px;
  justify-content: space-between;
}

.bondm-paper-text {
  font-size: 1.4rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
  flex: 1;
}

.bondm-byline {
  margin-top: 16px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  color: rgba(43, 33, 15, 0.72);
  font-size: 0.85rem;
  text-align: right;
}
.bondm-slide-photo .bondm-byline,
.bondm-slide-video .bondm-byline {
  color: rgba(251, 246, 234, 0.7);
  background: rgba(0, 0, 0, 0.35);
  padding: 6px 12px;
  text-align: left;
}

.bondm-slide-photo {
  background: #0d0a04;
  position: relative;
  align-items: center;
}
.bondm-photo {
  width: 100%;
  height: auto;
  max-height: 65vh;
  object-fit: contain;
  display: block;
  background: #000;
}
.bondm-photo-caption {
  background: rgba(0, 0, 0, 0.4);
  color: #fbf6ea;
  padding: 8px 14px;
  font-style: italic;
  font-size: 0.95rem;
  text-align: center;
}

.bondm-slide-video {
  background: #0d0a04;
}
.bondm-video {
  width: 100%;
  height: auto;
  max-height: 65vh;
  background: #000;
  display: block;
}

.bondm-slide-voice {
  padding: 24px 22px 20px;
  color: #2b210f;
  min-height: 280px;
  gap: 14px;
}
.bondm-voice-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(43, 33, 15, 0.08);
  border-radius: 999px;
  font-style: italic;
  align-self: flex-start;
  color: #3a2c10;
}
.bondm-audio {
  width: 100%;
}

/* ── Breakpoint ──────────────────────────────────────────────── */
@media (min-width: 720px) {
  .bondm-section-wrap { padding: 28px 24px 80px; }
  .bondm-card { padding: 16px 18px 18px; }
  .bondm-card-paper { padding-right: 100px; min-height: 110px; }
  .bondm-card-cover-wrap { flex-basis: 72px; width: 72px; height: 72px; }
  .bondm-card-title { font-size: 1.2rem; }
  .bondm-paper-text { font-size: 1.55rem; }
  .bondm-card-postmark { width: 68px; height: 68px; top: 8px; right: 10px; }
  .bondm-card-wax { width: 44px; height: 44px; bottom: 10px; right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .bondm-card { transition: none; }
  .bondm-card:hover { transform: none; box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 1px 2px rgba(20, 14, 6, 0.18),
    0 6px 12px rgba(20, 14, 6, 0.22),
    0 10px 22px rgba(20, 14, 6, 0.18); }
  .bondm-progress-dot { transition: none; }
}

/* Drop the procedural multiply blends when the user has asked the
   platform to reduce transparency/blending — the cream gradient
   alone still reads as paper, just without the per-memory grain
   modulation on top. The data-paper-dna attribute stays set so the
   per-memory seed remains traceable for debugging. */
@media (prefers-reduced-transparency: reduce) {
  .bondm-card-paper { background-blend-mode: normal; }
  .bondm-card-postmark { mix-blend-mode: normal; opacity: 0.86; }
}

/* WebGPU-active masking. Memory cards live in #sectionMemories and
   are NOT children of .bondc-host today, so this rule is a defensive
   safety net that mirrors the pattern used by .bondc-env-postmark
   in js/bond-ceremony.js (line 177) and the seal-photo / crack
   visibility-hidden rules (lines 456-464): when the ceremony's
   WebGPU stage is active, suppress the Canvas2D/CSS procedural
   overlay so the GPU surface wins. If a future surface ever embeds
   a memory card inside a ceremony host, the postmark + wax stop
   competing with the WebGPU render without any extra wiring. */
.bondc-host.bondc-webgpu-active .bondm-card-postmark,
.bondc-host.bondc-webgpu-active .bondm-card-wax {
  visibility: hidden;
}
