/* ════════════════════════════════════════════════════════════════════════
 * bond-inbox-stack.css — desk-of-envelopes inbox (Phase G, 2026-05-22)
 *
 * The canonical Bond inbox is NOT a list of cards or a Gmail thread. It
 * is a desk: each sender has ONE envelope on the desk, with depth-shadow
 * stacking showing how many letters they've written. The wax seal IS the
 * identity (no avatars, no initials circles). Unread envelopes wear a
 * subtle amber wax-pulse. Long-press / right-click opens an action menu.
 *
 * Sent tab uses a four-state progressive paper-darkening status chain:
 * Sent (lightest cream) → Delivered → Opened → Savored (deepest cream).
 * Color transitions are CSS custom properties; no JS animation library.
 *
 * Pure CSS — no image assets, no external SVG filter files. All textures
 * are inline (gradients, repeating-linear-gradient, box-shadow stacks).
 * ════════════════════════════════════════════════════════════════════════ */

:root {
  /* Cream cardstock palette, anchored to the bondi-* visual language. */
  --bondi-paper-cream:        #f5ede0;
  --bondi-paper-cream-light:  #f8f1e4;
  --bondi-paper-cream-deep:   #e8dcc1;
  --bondi-paper-cream-shadow: #c9b696;
  --bondi-paper-cream-edge:   #b3a07f;
  --bondi-ink-dark:           #3a2c1a;
  --bondi-ink-mid:            #5a4a36;
  --bondi-ink-soft:           #7c6a52;
  --bondi-ink-faint:          #a09887;
  --bondi-wax-amber:          #d4a04a;
  --bondi-wax-amber-glow:     rgba(212, 160, 74, 0.55);
  --bondi-wax-amber-pulse:    rgba(212, 160, 74, 0.18);

  /* Four progressive paper-darkening tints for the sender-side status
     chain. Each step darkens the cream by a perceptually-equal stop so
     the user reads it as ink soaking deeper into the page. */
  --bondi-status-sent:      #fbf5e6;
  --bondi-status-delivered: #f0e6cb;
  --bondi-status-opened:    #e2d3ad;
  --bondi-status-savored:   #c9b282;
  --bondi-status-ink-sent:      #8a7b5e;
  --bondi-status-ink-delivered: #6a5a3e;
  --bondi-status-ink-opened:    #4a3a22;
  --bondi-status-ink-savored:   #2a1f0c;
}

/* ───────────────────────────────────────────────────────────────────────
   Desk surface — wood-grain via radial-gradient + repeating-linear.
   Pure CSS, no images. The radial places a soft warm pool under the
   stack (as if a desk lamp); the repeating-linear adds the grain.
   ─────────────────────────────────────────────────────────────────────── */
.bondi-desk {
  position: relative;
  min-height: calc(100vh - 200px);
  padding: 32px 16px 160px;
  box-sizing: border-box;
  background:
    radial-gradient(ellipse 80% 60% at 50% 18%,
      rgba(255, 230, 180, 0.18) 0%,
      rgba(255, 220, 160, 0.06) 40%,
      transparent 70%),
    repeating-linear-gradient(
      92deg,
      rgba(82, 50, 24, 0.08) 0px,
      rgba(82, 50, 24, 0.04) 1px,
      transparent 2px,
      transparent 7px,
      rgba(82, 50, 24, 0.06) 8px,
      transparent 9px,
      transparent 19px
    ),
    linear-gradient(180deg, #2a1a0e 0%, #1e110a 70%, #16100a 100%);
  background-attachment: fixed;
  perspective: 1400px;
  perspective-origin: 50% 28%;
}

.bondi-desk-inner {
  position: relative;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px 22px;
  padding-top: 8px;
}

/* ───────────────────────────────────────────────────────────────────────
   Envelope stack (multi-sender mode) — one per sender, depth-shadowed.
   Up to 3 visible envelope layers behind the front face, then "+N more"
   indicator when the sender has > 3 letters in the stack.
   ─────────────────────────────────────────────────────────────────────── */
.bondi-stack-card {
  position: relative;
  width: 100%;
  min-height: 220px;
  padding: 18px 14px 14px;
  perspective: 800px;
  transform-style: preserve-3d;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 220ms cubic-bezier(.22,.7,.25,1), filter 320ms ease;
}
.bondi-stack-card:hover { transform: translateY(-4px); }
.bondi-stack-card:active { transform: scale(0.985); }

/* Recently-read envelopes recede with sepia fade. */
.bondi-stack-card.is-read-recently {
  filter: sepia(0.4) saturate(0.85) brightness(0.94);
}
.bondi-stack-card.is-read-recently:hover { filter: sepia(0.18) saturate(0.95); }

/* The three depth layers + the front envelope live inside .bondi-stack-layers.
   Each layer is absolutely positioned with progressive translate + opacity.
   When `data-count="1"` only the front face renders. */
.bondi-stack-layers {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-width: 320px;
  margin: 0 auto;
  transform-style: preserve-3d;
}
.bondi-stack-layer {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background:
    linear-gradient(135deg, var(--bondi-paper-cream-light) 0%, var(--bondi-paper-cream) 60%, var(--bondi-paper-cream-deep) 100%);
  /* Layered box-shadows give the envelope physical weight on the desk. */
  box-shadow:
    0 1px 1px rgba(60, 38, 16, 0.18),
    0 12px 22px rgba(20, 12, 4, 0.36),
    0 4px 8px rgba(20, 12, 4, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    inset 0 -1px 0 rgba(82, 50, 24, 0.08);
  border: 1px solid rgba(120, 86, 42, 0.18);
}
.bondi-stack-layer.is-back-3 {
  transform: translate(8px, 10px) rotate(-2.6deg);
  opacity: 0.62;
  z-index: 1;
}
.bondi-stack-layer.is-back-2 {
  transform: translate(5px, 6px) rotate(-1.4deg);
  opacity: 0.78;
  z-index: 2;
}
.bondi-stack-layer.is-back-1 {
  transform: translate(2px, 3px) rotate(0.6deg);
  opacity: 0.9;
  z-index: 3;
}
.bondi-stack-layer.is-front {
  z-index: 4;
  background:
    linear-gradient(135deg, var(--bondi-paper-cream-light) 0%, var(--bondi-paper-cream) 55%, var(--bondi-paper-cream-deep) 100%),
    /* Paper texture, procedural via repeating-linear-gradient. Cheap and
       reliable across browsers; no SVG filter dependency. */
    repeating-linear-gradient(
      0deg,
      rgba(120, 86, 42, 0.018) 0px,
      transparent 1px,
      transparent 3px,
      rgba(120, 86, 42, 0.024) 4px
    );
  background-blend-mode: multiply;
}

/* Flap on the front envelope only. */
.bondi-env-flap {
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 56%;
  clip-path: polygon(0 0, 100% 0, 50% 96%);
  background: linear-gradient(180deg, var(--bondi-paper-cream) 0%, var(--bondi-paper-cream-deep) 100%);
  box-shadow:
    inset 0 -2px 8px rgba(60, 38, 16, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
  pointer-events: none;
  z-index: 1;
}
.bondi-env-flap-shadow {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 48%;
  height: 6px;
  background: radial-gradient(ellipse at center, rgba(20, 12, 4, 0.28), transparent 70%);
  filter: blur(2px);
  pointer-events: none;
  z-index: 2;
}

/* Wax seal — CSS-only circular gradient driven by --bondi-seal-color
   custom properties from the entry's BondSeal payload. */
.bondi-env-seal {
  position: absolute;
  top: 46%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 78px;
  height: 78px;
  border-radius: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.34),
    inset 0 1px 2px rgba(255, 255, 255, 0.22);
  /* G2 preview-cleavage canvas overlay is positioned inside this slot
     as an absolutely-positioned child. overflow:hidden clips the
     rectangular canvas to the seal's circular footprint so the preview
     cleavage line never bleeds past the visible wax. box-shadow is
     unaffected (paint outside the box). */
  overflow: hidden;
}
/* When a BondSeal SVG is rendered into the seal slot it fills the
   circular area completely; we strip the wrapper background. */
.bondi-env-seal.has-seal-svg { background: transparent; box-shadow: none; }
.bondi-env-seal .bond-seal-svg {
  width: 100%;
  height: 100%;
  display: block;
}
/* Fallback procedural seal for entries that pre-date BondSeal payloads.
   The color is set inline as --bondi-seal-color from a hash of the
   sender uid so it's stable across reloads. */
.bondi-env-seal.is-fallback {
  background: radial-gradient(
    circle at 35% 30%,
    var(--bondi-seal-color-light, #c97b6b) 0%,
    var(--bondi-seal-color-mid,   #8a3a30) 55%,
    var(--bondi-seal-color-deep,  #4a1a14) 100%);
  color: rgba(252, 232, 208, 0.92);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* Sender name + count badge. The "From" cap is small uppercase serif so
   it reads as printed letterhead, not as a UI label. */
.bondi-env-from {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  z-index: 6;
  font-family: 'Caveat', 'Patrick Hand', cursive;
  font-size: 22px;
  color: var(--bondi-ink-dark);
  line-height: 1.12;
  text-shadow: 0.4px 0.4px 0.6px rgba(0, 0, 0, 0.06);
}
.bondi-env-from-cap {
  display: block;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bondi-ink-soft);
  margin-bottom: 1px;
}
/* Procedural postmark on the stack card — mirrors the ceremony page's
   .bondc-env-postmark treatment so the visual language carries from the
   inbox onto the desk. Position: upper-LEFT (kebab lives upper-right;
   palette tracks payload.sealColor; -8deg rotation makes it look hand-
   pressed; the drop-shadow gives ink-on-fiber depth. The SVG fills the
   slot — width:100%, height:auto. */
.bondi-env-postmark {
  position: absolute;
  top: 12px;
  left: 14px;
  z-index: 6;
  width: 64px;
  height: 64px;
  pointer-events: none;
  opacity: 0.82;
  transform: rotate(-8deg);
  transform-origin: 60% 40%;
  filter: drop-shadow(0 1px 1.2px rgba(40, 20, 5, 0.22));
}
.bondi-env-postmark svg { width: 100%; height: 100%; display: block; }
.bondi-env-postmark:empty { display: none; }

/* Demoted relative-time string — small secondary line that used to
   occupy the postmark slot. Now sits at the lower-left of the envelope
   face below the seal, ink-soft text on cream. Carries the same
   full-timestamp title attribute for hover info. */
.bondi-env-time {
  position: absolute;
  bottom: 14px;
  right: 14px;
  z-index: 6;
  font-family: 'Space Grotesk', Arial, sans-serif;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bondi-ink-soft);
  opacity: 0.72;
}
.bondi-env-count-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 7;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6a4a22 0%, #3a2410 100%);
  color: rgba(252, 232, 208, 0.96);
  font-family: 'Space Grotesk', Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  letter-spacing: 0.02em;
}
.bondi-env-more-indicator {
  position: absolute;
  bottom: -14px;
  right: 10px;
  z-index: 6;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 12px;
  color: var(--bondi-ink-soft);
  letter-spacing: 0.04em;
}

/* L1-8 — Always-visible kebab ("⋯") on every envelope card. Opens the
   same long-press action menu (Reply / Save / Delete / Report / Block)
   so trust & safety actions are discoverable on desktop / mouse without
   requiring touch long-press. Sits in the top-right of the front
   envelope face, ink-grey on cream so it reads as stationery UI and
   never as heavy app chrome. */
.bondi-env-menu-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 8;
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(120, 86, 42, 0.18);
  background: rgba(252, 246, 226, 0.62);
  color: var(--bondi-ink-soft, rgba(60, 40, 20, 0.7));
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 160ms ease, transform 140ms ease, border-color 160ms ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.bondi-env-menu-btn:hover {
  background: rgba(252, 246, 226, 0.92);
  border-color: rgba(120, 86, 42, 0.32);
  transform: scale(1.06);
}
.bondi-env-menu-btn:active { transform: scale(0.96); }
.bondi-env-menu-btn:focus-visible {
  outline: 2px solid rgba(212, 160, 74, 0.7);
  outline-offset: 2px;
}
.bondi-env-menu-btn svg { display: block; opacity: 0.85; }

/* Tiny tertiary "more" affordance inside the per-letter inline actions
   bar in the expansion sheet. Same intent (open the full menu) but sized
   to match the sibling action buttons rather than the envelope chrome. */
.bondi-letter-action-more {
  padding: 6px 8px !important;
  min-width: 32px;
  justify-content: center;
}
.bondi-letter-action-more svg { width: 14px; height: 14px; }

@media (prefers-reduced-motion: reduce) {
  .bondi-env-menu-btn { transition: none; }
  .bondi-env-menu-btn:hover { transform: none; }
}

/* Unread amber wax pulse. The pulse is on the seal itself — a soft
   amber halo that breathes. Honors prefers-reduced-motion. */
.bondi-stack-card.has-unread .bondi-env-seal {
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.34),
    0 0 0 0 var(--bondi-wax-amber-glow),
    inset 0 1px 2px rgba(255, 255, 255, 0.22);
  animation: bondiSealPulse 2.6s ease-in-out infinite;
}
@keyframes bondiSealPulse {
  0%, 100% { box-shadow: 0 4px 10px rgba(0,0,0,0.34), 0 0 0 0 var(--bondi-wax-amber-glow), inset 0 1px 2px rgba(255,255,255,0.22); }
  50%      { box-shadow: 0 4px 10px rgba(0,0,0,0.34), 0 0 18px 6px var(--bondi-wax-amber-pulse), inset 0 1px 2px rgba(255,255,255,0.22); }
}
@media (prefers-reduced-motion: reduce) {
  .bondi-stack-card.has-unread .bondi-env-seal {
    animation: none;
    box-shadow:
      0 4px 10px rgba(0, 0, 0, 0.34),
      0 0 14px 3px var(--bondi-wax-amber-pulse),
      inset 0 1px 2px rgba(255, 255, 255, 0.22);
  }
}

/* Long-press / mobile-touch feedback ring. */
.bondi-stack-card.is-pressing {
  transform: scale(1.02);
}
.bondi-stack-card.is-pressing .bondi-stack-layer.is-front {
  box-shadow:
    0 1px 1px rgba(60, 38, 16, 0.18),
    0 14px 28px rgba(20, 12, 4, 0.42),
    0 0 0 4px var(--bondi-wax-amber-pulse),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
}
@media (hover: none) {
  .bondi-stack-card:active { transform: scale(1.02); }
  .bondi-stack-card:active .bondi-stack-layer.is-front {
    box-shadow:
      0 1px 1px rgba(60, 38, 16, 0.18),
      0 14px 28px rgba(20, 12, 4, 0.42),
      0 0 0 4px var(--bondi-wax-amber-pulse),
      inset 0 1px 0 rgba(255, 255, 255, 0.42);
  }
}

/* Sender presence (e.g. "writing..."). */
.bondi-env-presence {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 12px;
  color: rgba(251, 191, 36, 0.85);
  white-space: nowrap;
  display: none;
}
.bondi-env-presence.is-active { display: block; }

/* ───────────────────────────────────────────────────────────────────────
   Sender expansion view — opened when an envelope stack is tapped.
   Vertical animated expansion of individual letters from that sender as
   smaller card variants.
   ─────────────────────────────────────────────────────────────────────── */
.bondi-expansion-overlay {
  position: fixed;
  inset: 0;
  z-index: 170;
  background: rgba(14, 10, 6, 0.78);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 16px 32px;
  overflow-y: auto;
  animation: bondiOverlayFade 280ms ease-out;
}
.bondi-expansion-overlay.is-open { display: flex; }
@keyframes bondiOverlayFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.bondi-expansion-sheet {
  position: relative;
  width: 100%;
  max-width: 560px;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%,
      rgba(255, 230, 180, 0.12), transparent 60%),
    linear-gradient(180deg, #2a1a0e 0%, #1e110a 100%);
  border-radius: 18px;
  border: 1px solid rgba(180, 140, 80, 0.22);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  padding: 24px 20px 30px;
  animation: bondiExpandIn 360ms cubic-bezier(.22,.7,.25,1);
}
@keyframes bondiExpandIn {
  from { transform: translateY(20px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.bondi-expansion-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(180, 140, 80, 0.18);
}
.bondi-expansion-header .bondi-env-seal {
  position: relative;
  inset: auto;
  transform: none;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}
.bondi-expansion-title-wrap {
  flex: 1;
  min-width: 0;
}
.bondi-expansion-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px;
  color: rgba(252, 232, 208, 0.96);
  margin: 0;
  letter-spacing: 0.02em;
}
.bondi-expansion-subtitle {
  font-family: 'Space Grotesk', Arial, sans-serif;
  font-size: 11px;
  color: rgba(252, 232, 208, 0.6);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 4px;
}
.bondi-expansion-close {
  background: transparent;
  border: 1px solid rgba(180, 140, 80, 0.3);
  color: rgba(252, 232, 208, 0.7);
  padding: 6px 14px;
  border-radius: 999px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 13px;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}
.bondi-expansion-close:hover {
  background: rgba(180, 140, 80, 0.18);
  color: rgba(252, 232, 208, 0.95);
}

/* Tabs inside the expansion (All / Received / Sent). */
.bondi-expansion-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  background: rgba(60, 42, 22, 0.4);
  border-radius: 10px;
  padding: 4px;
}
.bondi-expansion-tab {
  flex: 1;
  background: transparent;
  border: 0;
  color: rgba(252, 232, 208, 0.6);
  font-family: 'Space Grotesk', Arial, sans-serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.bondi-expansion-tab:hover { color: rgba(252, 232, 208, 0.85); }
.bondi-expansion-tab.is-active {
  background: rgba(212, 160, 74, 0.18);
  color: #fbe8c0;
}
.bondi-expansion-tab-count {
  font-size: 10px;
  opacity: 0.7;
}

/* Individual letter cards inside the expansion — vertical list, each
   card is a smaller variant of the envelope (no flap, just paper). */
.bondi-letter-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.bondi-letter-list-empty {
  text-align: center;
  padding: 28px 12px;
  color: rgba(252, 232, 208, 0.45);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 14px;
}

.bondi-letter-card {
  position: relative;
  background:
    linear-gradient(135deg, var(--bondi-paper-cream-light) 0%, var(--bondi-paper-cream) 70%, var(--bondi-paper-cream-deep) 100%);
  border-radius: 6px;
  padding: 14px 16px 12px 60px;
  min-height: 70px;
  box-shadow:
    0 1px 1px rgba(60, 38, 16, 0.18),
    0 8px 18px rgba(20, 12, 4, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(120, 86, 42, 0.18);
  cursor: pointer;
  transition: transform 220ms cubic-bezier(.22,.7,.25,1), box-shadow 200ms ease;
  -webkit-tap-highlight-color: transparent;
  animation: bondiLetterIn 360ms cubic-bezier(.22,.7,.25,1) both;
}
.bondi-letter-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 1px rgba(60, 38, 16, 0.18),
    0 12px 26px rgba(20, 12, 4, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
}
.bondi-letter-card:active { transform: scale(0.99); }
.bondi-letter-card.is-pressing { transform: scale(1.01); }
.bondi-letter-card.is-read { filter: sepia(0.18) brightness(0.97); }
@keyframes bondiLetterIn {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.bondi-letter-list .bondi-letter-card:nth-child(2) { animation-delay: 40ms; }
.bondi-letter-list .bondi-letter-card:nth-child(3) { animation-delay: 80ms; }
.bondi-letter-list .bondi-letter-card:nth-child(4) { animation-delay: 120ms; }
.bondi-letter-list .bondi-letter-card:nth-child(5) { animation-delay: 160ms; }
.bondi-letter-list .bondi-letter-card:nth-child(n+6) { animation-delay: 200ms; }

.bondi-letter-card-seal {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  /* The G2 preview-cleavage canvas overlays this circular slot. Hiding
     overflow keeps the cleavage line clipped to the seal's circular
     footprint at small sizes (36px), matching the full ceremony's seal
     mask behaviour. */
  overflow: hidden;
}

/* Letter-card postmark — smaller stamp in the upper-right of the card
   body, just above/around the right edge. Same procedural SVG palette
   as the stack-card postmark; sized to ~38px so it reads as a stamp,
   not a graphic. The action bar at the bottom is unaffected; the seal
   slot at the left is unaffected. */
.bondi-letter-card .bondi-env-postmark {
  position: absolute;
  top: 6px;
  right: 10px;
  bottom: auto;
  left: auto;
  width: 38px;
  height: 38px;
  z-index: 2;
  opacity: 0.78;
  transform: rotate(-7deg);
  transform-origin: 60% 40%;
  filter: drop-shadow(0 0.6px 0.8px rgba(40, 20, 5, 0.22));
}

/* G2 preview cleavage canvas — overlay inserted by
   BondCeremony.previewCleavage() onto a wax-seal element when the user
   taps a letter envelope. The canvas itself is positioned by the
   helper (left:0 top:0 100%); this rule clips it to the seal's
   circular footprint and sits above the seal SVG but below any
   click-blocking UI. pointer-events:none keeps the tap that started
   the preview from being captured by the canvas. */
.bondc-preview-cleavage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  border-radius: 50%;
  z-index: 9;
}
.bondi-letter-card-seal .bond-seal-svg { width: 100%; height: 100%; display: block; }
.bondi-letter-card-seal.is-fallback {
  background: radial-gradient(circle at 35% 30%,
    var(--bondi-seal-color-light, #c97b6b),
    var(--bondi-seal-color-deep, #4a1a14) 75%);
  color: rgba(252, 232, 208, 0.94);
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bondi-letter-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}
.bondi-letter-card-from {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--bondi-ink-dark);
  letter-spacing: 0.02em;
}
.bondi-letter-card-time {
  font-family: 'Space Grotesk', Arial, sans-serif;
  font-size: 10px;
  color: var(--bondi-ink-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.bondi-letter-card-preview {
  font-family: 'Caveat', 'Patrick Hand', cursive;
  font-size: 16px;
  color: var(--bondi-ink-mid);
  line-height: 1.32;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bondi-letter-card-chips {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.bondi-letter-card-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(60, 42, 22, 0.1);
  color: var(--bondi-ink-soft);
  font-family: 'Space Grotesk', Arial, sans-serif;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Sent-side status chain — four progressive paper-darkening states. The
   chain renders as a row of four pills; the reached state(s) are filled
   with the matching tint, unreached pills are skeleton outlines. */
.bondi-status-chain {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  align-items: center;
}
.bondi-status-pill {
  flex: 1;
  position: relative;
  font-family: 'Space Grotesk', Arial, sans-serif;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 6px 4px;
  border-radius: 4px;
  text-align: center;
  background: var(--bondi-pill-bg, rgba(120, 86, 42, 0.06));
  color: var(--bondi-pill-ink, rgba(120, 86, 42, 0.4));
  border: 1px solid var(--bondi-pill-border, rgba(120, 86, 42, 0.12));
  transition:
    background-color 420ms ease,
    color 420ms ease,
    border-color 420ms ease;
  cursor: help;
}
.bondi-status-pill[data-reached="true"][data-state="sent"]      { --bondi-pill-bg: var(--bondi-status-sent);      --bondi-pill-ink: var(--bondi-status-ink-sent);      --bondi-pill-border: rgba(120, 86, 42, 0.22); }
.bondi-status-pill[data-reached="true"][data-state="delivered"] { --bondi-pill-bg: var(--bondi-status-delivered); --bondi-pill-ink: var(--bondi-status-ink-delivered); --bondi-pill-border: rgba(120, 86, 42, 0.32); }
.bondi-status-pill[data-reached="true"][data-state="opened"]    { --bondi-pill-bg: var(--bondi-status-opened);    --bondi-pill-ink: var(--bondi-status-ink-opened);    --bondi-pill-border: rgba(120, 86, 42, 0.42); }
.bondi-status-pill[data-reached="true"][data-state="savored"]   { --bondi-pill-bg: var(--bondi-status-savored);   --bondi-pill-ink: var(--bondi-status-ink-savored);   --bondi-pill-border: rgba(60, 42, 22, 0.55); font-weight: 600; }
.bondi-status-pill[data-reached="false"][data-disabled="true"]  { opacity: 0.5; cursor: not-allowed; }

/* Tooltip on hover — exact timestamps for each reached phase. */
.bondi-status-pill[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e110a;
  color: rgba(252, 232, 208, 0.96);
  padding: 6px 10px;
  border-radius: 4px;
  white-space: nowrap;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: none;
  border: 1px solid rgba(180, 140, 80, 0.3);
  pointer-events: none;
  z-index: 10;
}

/* ───────────────────────────────────────────────────────────────────────
   Action menu — long-press / right-click context popup.
   ─────────────────────────────────────────────────────────────────────── */
.bondi-action-menu {
  position: fixed;
  z-index: 200;
  min-width: 200px;
  background: rgba(28, 20, 12, 0.96);
  border: 1px solid rgba(180, 140, 80, 0.3);
  border-radius: 12px;
  padding: 6px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.6);
  animation: bondiMenuIn 180ms ease-out;
}
@keyframes bondiMenuIn {
  from { transform: scale(0.94); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.bondi-action-menu-btn {
  width: 100%;
  background: transparent;
  border: 0;
  color: rgba(252, 232, 208, 0.86);
  font-family: 'Space Grotesk', Arial, sans-serif;
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 140ms ease;
}
.bondi-action-menu-btn:hover { background: rgba(180, 140, 80, 0.18); }
.bondi-action-menu-btn.is-destructive { color: rgba(255, 175, 175, 0.92); }
.bondi-action-menu-btn.is-destructive:hover { background: rgba(180, 60, 60, 0.22); }
.bondi-action-menu-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Inline action bar inside an expanded letter card (for tap+sustain). */
.bondi-letter-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.bondi-letter-action {
  background: rgba(60, 42, 22, 0.08);
  border: 1px solid rgba(120, 86, 42, 0.18);
  color: var(--bondi-ink-mid);
  font-family: 'Space Grotesk', Arial, sans-serif;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 160ms ease, color 160ms ease;
}
.bondi-letter-action:hover { background: rgba(60, 42, 22, 0.16); color: var(--bondi-ink-dark); }
.bondi-letter-action.is-destructive:hover { background: rgba(180, 60, 60, 0.15); color: #7a1f1f; }
.bondi-letter-action svg { width: 12px; height: 12px; }

/* ───────────────────────────────────────────────────────────────────────
   Empty state for the desk (no senders / no letters yet).
   ─────────────────────────────────────────────────────────────────────── */
.bondi-empty-desk {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 24px 60px;
  color: rgba(252, 232, 208, 0.7);
}
.bondi-empty-desk-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 26px;
  color: rgba(252, 232, 208, 0.85);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}
.bondi-empty-desk-desc {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 15px;
  color: rgba(252, 232, 208, 0.55);
  max-width: 380px;
  margin: 0 auto 24px;
  line-height: 1.5;
}
.bondi-empty-desk-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(212, 160, 74, 0.92), rgba(170, 120, 50, 0.92));
  color: #1e110a;
  font-family: 'Space Grotesk', Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 0;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(212, 160, 74, 0.32);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.bondi-empty-desk-cta:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(212, 160, 74, 0.42); }
.bondi-empty-desk-cta svg { width: 14px; height: 14px; }

/* Responsive — phones get a tighter desk grid. */
@media (max-width: 600px) {
  .bondi-desk { padding: 20px 12px 140px; }
  .bondi-desk-inner { grid-template-columns: 1fr; gap: 22px; }
  .bondi-stack-card { min-height: 200px; }
  .bondi-stack-layers { max-width: none; }
  .bondi-expansion-overlay { padding: 40px 10px 24px; }
  .bondi-expansion-sheet { padding: 20px 14px 24px; border-radius: 14px; }
}
