/* Vault Living Archive — distinct letter-artifacts on a cinematic shelf.
   Every card differs (paper DNA, wax seal, real voice waveform, tilt) so the
   wall never reads as tiled wallpaper. */

.vault-wall.vault-wall--rolls {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)) !important;
  grid-auto-rows: auto !important;
  grid-template-areas: unset !important;
  align-items: start !important;
  justify-items: center !important;
  gap: 28px 22px !important;
  padding: 22px 10px 48px !important;
  width: 100%;
  max-width: min(1100px, 94vw);
  margin: 0 auto;
  height: auto !important;
  min-height: 0 !important;
  overflow: visible;
}

@media (max-width: 560px) {
  .vault-wall.vault-wall--rolls {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)) !important;
    gap: 26px 18px !important;
  }
}

/* Loading skeleton — light, translucent circular placeholders matching the
   token grid (NOT the dark global .skeleton) so the first paint reads as
   faint glass discs on the marble and never shifts when tokens arrive. */
.vault-wall-skeleton--tokens {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  justify-items: center;
  gap: 28px 22px;
  width: 100%;
  max-width: min(1100px, 94vw);
  margin: 0 auto;
  padding: 22px 10px 48px;
}

.vault-token-skel {
  width: 100%;
  max-width: 122px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background:
    linear-gradient(90deg,
      rgba(255, 255, 255, 0.10) 25%,
      rgba(16, 158, 183, 0.16) 50%,
      rgba(255, 255, 255, 0.10) 75%);
  background-size: 200% 100%;
  box-shadow:
    inset 0 1px 4px rgba(255, 255, 255, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    0 6px 16px -8px rgba(18, 44, 50, 0.3);
  animation: skeletonShimmer 1.6s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .vault-token-skel { animation: none; }
}

@media (max-width: 560px) {
  .vault-wall-skeleton--tokens {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 22px 14px;
  }
}

.vault-artifact {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transform: rotate(var(--art-rot, 0deg));
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), filter 0.28s ease;
  perspective: 1000px;
}

.vault-artifact:hover {
  transform: rotate(var(--art-rot, 0deg)) translateY(-3px) scale(1.008);
}

.vault-artifact:focus-visible {
  outline: 2px solid rgba(150, 115, 45, 0.6);
  outline-offset: 6px;
  border-radius: 8px;
}

/* ════════════════════════════════════════════════════════════════════
   Homepage token — translucent teal "glass-bottle-bottom" disc.
   Pure CSS (no Bond paper/wax, no canvas). Seeded per-token variation
   in teal depth (--tok-teal) and specular angle (--tok-spin).
   ════════════════════════════════════════════════════════════════════ */
.vault-token {
  position: relative;
  display: block;
  width: 100%;
  max-width: 122px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  /* The token is TRANSPARENT: no solid disc behind the gem, so the marble
     sits directly behind the glass and shows through it. The gold rim +
     drop shadow live on the gem itself (.vault-token__glass). */
  background: transparent;
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.vault-token:hover { transform: translateY(-3px) scale(1.02); z-index: 3; }

.vault-token:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(255, 240, 200, 0.9),
    0 0 0 5px rgba(168, 121, 40, 0.7),
    0 14px 26px -9px rgba(46, 30, 10, 0.5);
}

.vault-token__glass {
  position: absolute;
  inset: 0;                    /* fills the transparent token; gold rim is a box-shadow */
  border-radius: 50%;
  overflow: hidden;
  /* TRANSLUCENT teal glass: a LOW-alpha tint so the marble clearly shows
     through (translucency via real alpha — does not depend on the fragile
     backdrop-filter). Light layers: top dome sheen + bright bottom caustic
     just inside the rim, which sells a 3D glass cabochon. backdrop-filter
     (when supported AND not isolated by an ancestor transform) adds a soft
     refractive blur as a bonus. */
  background:
    radial-gradient(ellipse 56% 40% at 40% 24%,
      rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 60%),
    radial-gradient(ellipse 86% 32% at 50% 106%,
      rgba(185, 250, 244, 0.5), rgba(120, 220, 224, 0) 70%),
    radial-gradient(circle at 50% 60%,
      rgba(30, 162, 184, 0.26),
      rgba(13, 112, 134, 0.32) 64%,
      rgba(9, 90, 110, 0.4) 100%);
  background-color: rgba(20, 140, 165, 0.16);
  -webkit-backdrop-filter: blur(5px) saturate(1.5);
  backdrop-filter: blur(5px) saturate(1.5);
  /* Refined thin gold rim (was a heavy 2+4px double ring that read as a
     coin) + glass gloss + grounding shadow, all on the gem. */
  box-shadow:
    0 0 0 1px rgba(214, 170, 70, 0.95),
    0 0 0 2.5px rgba(122, 88, 22, 0.9),
    inset 0 4px 10px rgba(255, 255, 255, 0.5),
    inset 0 -14px 24px -10px rgba(2, 26, 34, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.28),
    0 8px 15px -7px rgba(46, 30, 10, 0.4);
  transition: filter 0.26s ease;
}

/* convex underside shadow — the lower half of the gem falls into shadow,
   which (with the bright caustic just inside the rim) reads as a 3D dome */
.vault-token__glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(ellipse 72% 52% at 50% 118%,
    rgba(2, 24, 30, 0.5), rgba(2, 24, 30, 0) 58%);
  pointer-events: none;
}

/* crisp specular hotspot — the polished-glass glint */
.vault-token__glass::after {
  content: "";
  position: absolute;
  top: 9%;
  left: 20%;
  width: 34%;
  height: 22%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%,
    rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}

/* the name sits INSIDE the bubble, centered, etched into the glass */
.vault-token__face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 16%;
  text-align: center;
  pointer-events: none;
  z-index: 2;
}

/* Name INCISED into the glass (frosted-letterpress): a soft frosted fill
   with a dark recessed top edge + a light lower bevel, so it reads as cut
   into the gem rather than printed on top. Tuned to stay legible. */
.vault-token__name {
  font-family: var(--font-serif, 'Cormorant Garamond', Georgia, serif);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.16;
  /* Incised to match the tagline's chisel + light direction — deepened so
     the carve clearly reads. CSS shadows only (no per-name SVG filter). */
  color: rgba(234, 251, 251, 0.92);
  text-shadow:
    0 -1.5px 1px rgba(0, 18, 24, 0.72),
    0 1.5px 0 rgba(242, 254, 254, 0.62),
    0 2px 3px rgba(0, 16, 22, 0.3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
}

.vault-token__meta {
  font-family: var(--font-body, 'Space Grotesk', sans-serif);
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  /* Brighter frost + a darker backing shadow so the date reads cleanly on
     the mid-teal gem instead of dissolving into it. */
  color: rgba(242, 253, 253, 0.88);
  text-shadow:
    0 1px 2px rgba(0, 18, 26, 0.6),
    0 0 1px rgba(0, 16, 22, 0.5);
}

/* shows only on verified (gold) discs — dark brass for legibility on gold.
   Prefixed with a check glyph so "verified" reads as a clear status mark,
   not just a faint word. */
.vault-token__verified {
  display: inline-flex;
  align-items: center;
  gap: 0.28em;
  font-family: var(--font-body, 'Space Grotesk', sans-serif);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(64, 40, 6, 0.95);
  text-shadow: 0 1px 0 rgba(255, 246, 220, 0.6);
}
.vault-token__verified::before {
  content: "✓";
  font-size: 0.86em;
  font-weight: 900;
  line-height: 1;
}

/* ── UNHEARD MARKER ──────────────────────────────────────────────────
   One clear signal, one meaning: a luminous cyan RING hugging just inside
   the gold rim means "a voice is waiting — you haven't heard this yet."
   It's fully CONTAINED within the disc (inset), so it never collides with
   neighbours the way a corner dot did, and the bright cyan + soft glow
   reads cleanly on BOTH the teal (standard) and gold (verified) gems.
   The gem COLOUR still carries verified-vs-standard; the ring carries
   unheard. The criterion is set in js/vault-capsule-paper.js to match the
   Unread filter exactly (isReceived && !audioPlayed).
   NOTE: scoped to .is-unread ONLY. It must NOT key off .is-hero (the newest
   /featured disc), or the ring would show on the newest capsule even when it
   is already heard/sent — contradicting the "0 unread" count. */
.vault-token.is-unread::after {
  content: "";
  position: absolute;
  inset: 2px;                       /* sits just inside the gold rim */
  border-radius: 50%;
  border: 2.5px solid rgba(126, 246, 255, 0.95);
  box-shadow:
    0 0 9px 1px rgba(60, 220, 245, 0.65),         /* soft outer halo */
    inset 0 0 9px 1px rgba(132, 247, 255, 0.55);  /* inner glow */
  z-index: 4;
  pointer-events: none;
}

/* Verified = Truth Glow: translucent GOLD glass gem (same finish as teal). */
.vault-token.is-verified .vault-token__glass {
  background:
    radial-gradient(ellipse 58% 42% at 40% 24%,
      rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 60%),
    radial-gradient(ellipse 86% 32% at 50% 106%,
      rgba(255, 244, 200, 0.5), rgba(240, 205, 120, 0) 70%),
    radial-gradient(circle at 50% 60%,
      rgba(228, 180, 78, 0.28),
      rgba(198, 150, 48, 0.34) 64%,
      rgba(166, 118, 32, 0.42) 100%);
  background-color: rgba(216, 168, 64, 0.18);
  box-shadow:
    0 0 0 1px rgba(224, 180, 78, 0.95),
    0 0 0 2.5px rgba(126, 92, 24, 0.9),
    inset 0 4px 10px rgba(255, 250, 230, 0.52),
    inset 0 -14px 24px -10px rgba(60, 38, 8, 0.45),
    inset 0 0 0 1px rgba(255, 246, 220, 0.3),
    0 8px 15px -7px rgba(46, 30, 10, 0.4);
}

/* on the gold gem the carved name + meta flip to deep brass for contrast */
.vault-token.is-verified .vault-token__name {
  color: rgba(64, 40, 6, 0.96);
  text-shadow:
    0 1px 0 rgba(255, 248, 222, 0.65),
    0 -1px 1px rgba(40, 24, 6, 0.28);
}
.vault-token.is-verified .vault-token__meta {
  color: rgba(66, 42, 8, 0.92);
  text-shadow: 0 1px 0 rgba(255, 248, 222, 0.6);
}

/* Heard vs unheard is now shown ONLY by the dot above — heard gems are not
   dimmed, so the wall stays calm and uniform and the single dot does the
   talking. (No is-heard brightness/opacity overrides on purpose.) */

@media (prefers-reduced-motion: reduce) {
  .vault-token:hover { transform: none; }
}

/* ── The letter card ── */
.art-scene {
  position: relative;
  width: 100%;
  min-height: 98px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 16px 22px;
  border-radius: 5px;
  background-color: #ece2c8;
  background-size: 256px 256px;
  background-repeat: repeat;
  box-shadow:
    inset 0 1px 0 rgba(255, 252, 240, 0.6),
    inset 0 -14px 26px -16px rgba(60, 40, 16, 0.35),
    0 12px 26px -10px rgba(36, 22, 8, 0.5),
    0 2px 5px rgba(36, 22, 8, 0.25);
  overflow: hidden;
  transform-style: preserve-3d;
}

.art-scene--nograin {
  background-image: linear-gradient(168deg, #f4ecd6 0%, #e3d4ad 52%, #efe6cc 100%);
}

/* torn / folded sheet hairlines */
.art-edge {
  position: absolute;
  left: 0;
  right: 0;
  height: 10px;
  pointer-events: none;
  z-index: 2;
}

.art-edge--top {
  top: 0;
  background: linear-gradient(180deg, rgba(120, 92, 48, 0.18), transparent);
}

.art-edge--bottom {
  bottom: 0;
  background: linear-gradient(0deg, rgba(90, 64, 30, 0.22), transparent);
}

.art-body {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  z-index: 1;
}

.art-addressee {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
}

.art-from {
  font-family: var(--font-body, 'Cormorant Garamond', serif);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(82, 56, 26, 0.55);
  flex: 0 0 auto;
}

.art-name {
  font-family: 'Caveat', 'Segoe Print', cursive;
  font-size: 1.55rem;
  line-height: 1;
  color: #3a2a12;
  mix-blend-mode: multiply;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.art-voice {
  display: block;
  width: 100%;
  height: 26px;
}

.art-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-body, 'Cormorant Garamond', serif);
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  color: rgba(72, 50, 24, 0.72);
}

.art-meta__dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

.art-verified {
  margin-left: 2px;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9a7a2a;
}

/* ── Wax seal ── */
.art-seal {
  position: relative;
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  z-index: 1;
}

.art-wax {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.4));
}

.art-seal__mono {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display, 'Cormorant Garamond', serif);
  font-size: 1.4rem;
  font-weight: 600;
  color: rgba(255, 242, 214, 0.82);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.art-seal__crack {
  position: absolute;
  top: 8%;
  bottom: 8%;
  left: 50%;
  width: 2px;
  transform: translateX(-50%) rotate(8deg);
  background: linear-gradient(180deg, transparent, rgba(20, 8, 4, 0.55), transparent);
  pointer-events: none;
}

/* verified brass edge */
.vault-artifact.is-verified .art-scene {
  box-shadow:
    inset 0 0 0 1px rgba(190, 150, 70, 0.35),
    inset 0 1px 0 rgba(255, 252, 240, 0.6),
    inset 0 -14px 26px -16px rgba(60, 40, 16, 0.35),
    0 12px 26px -10px rgba(36, 22, 8, 0.5),
    0 2px 5px rgba(36, 22, 8, 0.25);
}

/* unread: live wax glow */
.vault-artifact.has-unread .art-seal::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 175, 70, 0.45), transparent 68%);
  z-index: -1;
  animation: artSealPulse 3.4s ease-in-out infinite;
}

@keyframes artSealPulse {
  0%, 100% { opacity: 0.5; transform: scale(0.96); }
  50% { opacity: 0.9; transform: scale(1.06); }
}

/* ── Hero (newest / unread) ── */
.vault-artifact.is-hero .art-scene {
  min-height: 134px;
  padding: 22px 26px;
  box-shadow:
    inset 0 1px 0 rgba(255, 252, 240, 0.7),
    inset 0 -18px 34px -18px rgba(60, 40, 16, 0.4),
    0 20px 40px -12px rgba(30, 18, 6, 0.6),
    0 3px 8px rgba(30, 18, 6, 0.3);
}

.vault-artifact.is-hero .art-name { font-size: 2rem; }
.vault-artifact.is-hero .art-voice { height: 34px; }
.vault-artifact.is-hero .art-seal { width: 68px; height: 68px; }

/* ── VCI larger contexts ── */
.vault-artifact--incoming,
.vault-artifact--stage {
  cursor: default;
  pointer-events: none;
  width: min(92vw, 560px);
}

.vault-artifact--incoming .art-scene,
.vault-artifact--stage .art-scene {
  min-height: 140px;
  padding: 24px 28px;
}

.vault-artifact--incoming .art-name,
.vault-artifact--stage .art-name { font-size: 2.1rem; }

.vault-artifact--incoming .art-voice,
.vault-artifact--stage .art-voice { height: 36px; }

/* ── Signature motion: deal-in ── */
.vault-wall--rolls .vault-artifact.is-entering { opacity: 0; }

.vault-wall--rolls .vault-artifact.is-entered {
  animation: artDealIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes artDealIn {
  0% {
    opacity: 0;
    transform: translateY(30px) rotate(calc(var(--art-rot, 0deg) - 5deg)) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: rotate(var(--art-rot, 0deg)) scale(1);
  }
}

/* incoming roll-out (between capsules) */
.vault-artifact.is-entering.is-from-right .art-scene {
  animation: artRiseRight 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.vault-artifact.is-entering.is-from-left .art-scene {
  animation: artRiseLeft 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes artRiseRight {
  0% { opacity: 0; transform: translateX(40px) translateY(20px) rotateZ(4deg) scale(0.92); }
  100% { opacity: 1; transform: none; }
}

@keyframes artRiseLeft {
  0% { opacity: 0; transform: translateX(-40px) translateY(20px) rotateZ(-4deg) scale(0.92); }
  100% { opacity: 1; transform: none; }
}

/* set-down (current rolls/sets down) */
.vault-artifact.is-rolling-up .art-scene,
.art-scene.is-rolling-up {
  animation: artSetDown 0.5s cubic-bezier(0.55, 0, 0.85, 0.35) forwards;
}

@keyframes artSetDown {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(34px) scale(0.9) rotateX(38deg); }
}

@media (max-width: 560px) {
  .art-scene { padding: 14px 16px; gap: 12px; min-height: 88px; }
  .vault-artifact.is-hero .art-scene { min-height: 118px; }
  .art-name { font-size: 1.4rem; }
  .vault-artifact.is-hero .art-name { font-size: 1.7rem; }
  .art-seal { width: 48px; height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .vault-wall--rolls .vault-artifact.is-entered,
  .vault-artifact.is-entering .art-scene,
  .vault-artifact.is-rolling-up .art-scene,
  .art-scene.is-rolling-up,
  .vault-artifact.has-unread .art-seal::after {
    animation: none !important;
  }
  .vault-wall--rolls .vault-artifact.is-entering { opacity: 1; }
}
