/* ============================================================
   AllTheMuse — Muse Vault page styles
   Palette: white / black / warm cream (#FAF6EF) /
            soft purple (#7C6CF0) / gold (#C9A227)
   All colors via CSS vars; dark mode uses html[data-theme="dark"].
   No hardcoded surface/background colors.
   ============================================================ */

:root {
  --vault-cream: #FAF6EF;
  --vault-cream-2: #F3EAD9;
  --vault-gold: #C9A227;
  --vault-gold-ink: #7A5E10;
  --vault-gold-soft: #FBF3DC;
  --vault-purple: #7C6CF0;
  --vault-purple-deep: #5B4BD6;
  --vault-purple-soft: #EDEBFE;
  --vault-glow-gold: 0 0 0 1px rgba(201, 162, 39, 0.45), 0 6px 24px rgba(201, 162, 39, 0.35);
}

html[data-theme="dark"] {
  --vault-cream: #171410;
  --vault-cream-2: #211c14;
  --vault-gold: #E3BE55;
  --vault-gold-ink: #F0D68A;
  --vault-gold-soft: #2B2312;
  --vault-purple: #9B85FF;
  --vault-purple-deep: #7C6CF0;
  --vault-purple-soft: #211D3A;
  --vault-glow-gold: 0 0 0 1px rgba(227, 190, 85, 0.5), 0 6px 28px rgba(227, 190, 85, 0.30);
}

/* ---------- Layout ---------- */

.vault-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, var(--vault-cream) 0%, var(--surface) 78%);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  box-shadow: var(--sh-md);
  padding: clamp(1.4rem, 4vw, 2.4rem);
  margin-bottom: 1.6rem;
}
.vault-hero::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 60%;
  aspect-ratio: 1;
  background: radial-gradient(circle, var(--vault-purple-soft) 0%, transparent 70%);
  opacity: 0.7;
  pointer-events: none;
}
.vault-hero-inner {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
  align-items: center;
}

/* ---------- Progress ring ---------- */

.vault-ring {
  flex: 0 0 auto;
  position: relative;
  width: 168px;
  height: 168px;
}
.vault-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.vault-ring .ring-track {
  fill: none;
  stroke: var(--line);
  stroke-width: 12;
}
.vault-ring .ring-fill {
  fill: none;
  stroke: url(#vaultRingGrad);
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.4s var(--ease);
}
.vault-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.vault-ring-num {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.vault-ring-num small {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
}
.vault-ring-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.35rem;
}

/* ---------- Hero copy + level ---------- */

.vault-hero-copy { flex: 1 1 240px; min-width: 0; }
.vault-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--vault-purple);
  margin: 0 0 0.4rem;
}
.vault-hero-copy h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 4.5vw, 2.1rem);
  letter-spacing: -0.03em;
  color: var(--ink);
}
.vault-hero-copy p {
  margin: 0 0 1rem;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.95rem;
  max-width: 34rem;
}

.vault-level {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 0.8rem 1rem;
  box-shadow: var(--sh-sm);
  max-width: 30rem;
}
.vault-level-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--vault-gold-ink);
  background: var(--vault-gold-soft);
  border: 1px solid rgba(201, 162, 39, 0.4);
  border-radius: var(--r-pill);
  padding: 0.35rem 0.8rem;
  white-space: nowrap;
}
.vault-xp { flex: 1 1 140px; min-width: 120px; }
.vault-xp-track {
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--line);
  overflow: hidden;
}
.vault-xp-fill {
  height: 100%;
  width: 0;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--vault-purple), var(--vault-gold));
  transition: width 1.2s var(--ease);
}
.vault-xp-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.35rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- Rarity tiers row ---------- */

.vault-tiers {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.7rem;
  margin: 0 0 1.8rem;
  padding: 0;
  list-style: none;
}
.vault-tier {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 0.9rem 0.5rem 0.8rem;
  text-align: center;
  box-shadow: var(--sh-sm);
}
.vault-tier-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin: 0 auto 0.5rem;
  background: var(--tier, #9aa0a6);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--tier, #9aa0a6) 18%, transparent);
}
.vault-tier-count {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.vault-tier-name {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.25rem;
}
/* Shimmer sweep when a tier is complete */
.vault-tier.complete { border-color: rgba(201, 162, 39, 0.55); box-shadow: var(--vault-glow-gold); }
.vault-tier.complete::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 244, 214, 0.85) 50%, transparent 60%);
  transform: translateX(-120%);
  animation: vault-shimmer 2.8s var(--ease) 0.6s 2;
  pointer-events: none;
}
@keyframes vault-shimmer {
  to { transform: translateX(120%); }
}

/* ---------- Vault grid ---------- */

.vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.9rem;
  margin: 0 0 2rem;
}
.vault-card { position: relative; }
.vault-card .muse-card { height: 100%; }

/* Locked / undiscovered silhouette */
.vault-locked {
  position: relative;
  border-radius: var(--r-lg);
  border: 1px dashed var(--line);
  background: var(--surface-2);
  aspect-ratio: 3 / 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  overflow: hidden;
}
.vault-locked .lock-q {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--faint);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-inner);
}
.vault-locked p {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.vault-locked::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, 0.35) 50%, transparent 58%);
  transform: translateX(-110%);
  animation: vault-shimmer 5s ease-in-out infinite;
  pointer-events: none;
}
html[data-theme="dark"] .vault-locked::after {
  background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, 0.07) 50%, transparent 58%);
}
.vault-more {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.4rem 0 0;
}

/* Rarity badges for the two tiers the old badge CSS lacks.
   Track 7: token-sourced so light/dark flip with the shared system
   (styles.css defines --rarity-mythic-*/--rarity-divine-* and always
   loads before this file). Divine stays vault-gold by design. */
.badge-rarity-mythic { background: var(--rarity-mythic-bg); color: var(--rarity-mythic-ink); box-shadow: var(--rarity-mythic-glow); }
.badge-rarity-divine { background: var(--vault-gold-soft); color: var(--vault-gold-ink); box-shadow: var(--vault-glow-gold); }

/* ---------- Achievements ---------- */

.vault-achievements {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.9rem;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}
.achievement {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.2rem 0.8rem 1rem;
  text-align: center;
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.achievement-medal {
  width: 64px;
  height: 64px;
  margin: 0 auto 0.7rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
}
.achievement.locked .achievement-medal {
  background: var(--surface-2);
  border: 1px solid var(--line);
  filter: grayscale(1);
  opacity: 0.55;
}
.achievement.unlocked { border-color: rgba(201, 162, 39, 0.55); box-shadow: var(--vault-glow-gold); }
.achievement.unlocked .achievement-medal {
  background: radial-gradient(circle at 35% 30%, #ffe9a8, var(--vault-gold) 72%);
  color: #fff;
  text-shadow: 0 1px 4px rgba(122, 94, 16, 0.5);
  box-shadow: 0 6px 18px rgba(201, 162, 39, 0.45);
}
.achievement-name {
  display: block;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.achievement-desc {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 0.3rem;
  font-variant-numeric: tabular-nums;
}
.achievement-date {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--vault-gold-ink);
  margin-top: 0.5rem;
}

/* Unlock celebration overlay */
.vault-celebrate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  background: rgba(10, 8, 4, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
}
.vault-celebrate.show { opacity: 1; pointer-events: auto; }
.vault-celebrate-card {
  background: var(--surface);
  border: 1px solid rgba(201, 162, 39, 0.6);
  border-radius: var(--r-2xl);
  box-shadow: var(--vault-glow-gold), var(--sh-xl);
  padding: 2.2rem 2rem 1.8rem;
  text-align: center;
  max-width: 340px;
  width: 100%;
  transform: scale(0.85) translateY(14px);
  transition: transform 0.45s var(--ease-spring);
}
.vault-celebrate.show .vault-celebrate-card { transform: scale(1) translateY(0); }
.vault-celebrate-medal {
  width: 92px;
  height: 92px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, var(--vault-gold) 72%);
  color: #fff;
  text-shadow: 0 2px 6px rgba(122, 94, 16, 0.5);
  box-shadow: 0 10px 34px rgba(201, 162, 39, 0.55);
}
.vault-celebrate-card h3 { margin: 0 0 0.3rem; color: var(--ink); letter-spacing: -0.02em; }
.vault-celebrate-card p { margin: 0 0 1.4rem; color: var(--muted); font-size: 0.92rem; line-height: 1.55; }


/* Coin burst particles (kept; used by wallet claim bursts) */
.vault-burst {
  position: fixed;
  z-index: 300;
  width: 26px;
  height: 26px;
  pointer-events: none;
  animation: vault-burst-fly 0.9s var(--ease) forwards;
}
@keyframes vault-burst-fly {
  to { transform: translate(var(--bx), var(--by)) scale(0.4) rotate(200deg); opacity: 0; }
}

/* ---------- Login gate ---------- */

.vault-gate {
  text-align: center;
  padding: clamp(2rem, 8vw, 4rem) 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  box-shadow: var(--sh-md);
}
.vault-gate-art { width: 96px; height: 96px; margin: 0 auto 1.2rem; }
.vault-gate-art img { width: 100%; height: 100%; object-fit: contain; }
.vault-gate h2 { margin: 0 0 0.6rem; letter-spacing: -0.02em; color: var(--ink); }
.vault-gate p { color: var(--muted); max-width: 26rem; margin: 0 auto 1.6rem; line-height: 1.65; }

/* ---------- Section headings ---------- */

.vault-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  margin: 0 0 1rem;
}
.vault-section-head h2 {
  margin: 0;
  font-size: 1.35rem; /* track 7: was 1.15rem — smaller than the h3s beneath it */
  letter-spacing: -0.02em;
  color: var(--ink);
}
.vault-section-head .link-quiet {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--vault-purple);
  white-space: nowrap;
}

/* ---------- Skeleton ---------- */

.vault-skel {
  border-radius: var(--r-lg);
  background: linear-gradient(100deg, var(--skel-base) 40%, var(--skel-hi) 50%, var(--skel-base) 60%);
  background-size: 200% 100%;
  animation: vault-skel 1.8s ease-in-out infinite;
  min-height: 120px;
}
@keyframes vault-skel { to { background-position: -200% 0; } }

/* ---------- Responsive ---------- */

@media (max-width: 560px) {
  .vault-tiers { grid-template-columns: repeat(3, 1fr); }
  .vault-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 0.7rem; }
  .vault-achievements { grid-template-columns: repeat(2, 1fr); }
  .vault-hero-inner { gap: 1.2rem; }
  .vault-ring { width: 138px; height: 138px; margin: 0 auto; }
}

/* ---------- Museum wings (Track C) ---------- */

#vault-wings { margin-bottom: 2.2rem; }
.wing-curated {
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--faint); white-space: nowrap;
}
.wing { margin-bottom: 1.8rem; }
.wing:last-child { margin-bottom: 0; }
.wing-head { margin: 0 0 0.9rem; }
.wing-head h3 {
  margin: 0 0 0.15rem;
  font-size: 1.3rem; font-weight: 800; letter-spacing: -0.025em; color: var(--ink);
  font-variant: small-caps;
}
.wing-head p { margin: 0; font-size: 0.85rem; color: var(--muted); }

/* Horizontal snap rail — generous touch targets, native momentum scroll */
.wing-rail {
  display: flex; gap: 0.9rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 0.4rem 0.2rem 0.9rem;
  margin: 0 -0.2rem;
  scrollbar-width: thin;
}
.wing-rail .wing-card {
  flex: 0 0 clamp(150px, 42vw, 190px);
  scroll-snap-align: start;
  min-height: 44px;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.wing-rail .wing-card:hover { transform: translateY(-4px); }
/* Rarity glow — soft museum lighting, never neon */
.wing-card.glow-rare    { box-shadow: 0 0 0 1px rgba(59, 130, 196, 0.35), 0 8px 24px rgba(59, 130, 196, 0.18); }
.wing-card.glow-epic    { box-shadow: 0 0 0 1px rgba(124, 108, 240, 0.40), 0 8px 24px rgba(124, 108, 240, 0.22); }
.wing-card.glow-legendary { box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.50), 0 8px 26px rgba(201, 162, 39, 0.28); }
.wing-card.glow-mythic  { box-shadow: 0 0 0 1px rgba(180, 92, 240, 0.45), 0 8px 26px rgba(180, 92, 240, 0.24); }
.wing-card.glow-divine  { box-shadow: var(--vault-glow-gold), 0 10px 30px rgba(201, 162, 39, 0.30); }
.wing-card .muse-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; }
.wing-acquired {
  font-size: 0.72rem; color: var(--faint); font-weight: 600;
  display: block; margin-top: 0.25rem;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .vault-ring .ring-fill,
  .vault-xp-fill,
  .vault-celebrate,
  .vault-celebrate-card { transition: none; }
  .vault-tier.complete::after,
  .vault-locked::after,
  .achievement.unlocked .achievement-medal { animation: none; }
}

/* ---------- Collection score (merged from /account/, M1 integration) ---------- */
.score-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  box-shadow: var(--sh-sm); padding: 1.2rem 1.4rem; margin-bottom: 2rem;
}
.score-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.score-label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.2rem; }
.score-num { font-size: clamp(2rem, 6vw, 2.8rem); font-weight: 800; letter-spacing: -0.03em; margin: 0; font-variant-numeric: tabular-nums; }
.score-how {
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--ink);
  border-radius: var(--r-pill); font: inherit; font-size: 0.85rem; font-weight: 700;
  padding: 0.6rem 1.1rem; cursor: pointer; min-height: 44px;
}
.score-how:hover { border-color: #7c6cf0; }
.score-formula { margin-top: 1.1rem; border-top: 1px solid var(--line); padding-top: 1.1rem; }
.score-eq { margin: 0 0 0.9rem; font-size: 0.92rem; color: var(--ink); }
.score-eq code { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; padding: 0.3rem 0.6rem; font-size: 0.85rem; }
.score-lines { list-style: none; margin: 0 0 0.9rem; padding: 0; display: grid; gap: 0.45rem; }
.score-lines li { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.9rem; color: var(--muted); }
.score-lines li strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.score-weights { font-size: 0.8rem; color: var(--faint); margin: 0; line-height: 1.6; }
