/* Synapse store. Same tokens as the launcher (launcher/src/styles/globals.css):
   graphite surfaces, hairline borders, one light steel accent for the primary
   action. Hover scales instead of lifting, like every button in the launcher.
   Motion: one soft curve everywhere, long on the way in, short on the way out. */
:root {
  --font: "Outfit", system-ui, "Segoe UI", sans-serif;
  --bg-0: #0d0d16;
  --bg-1: #11111c;
  --bg-2: #151521;
  --bg-3: #1c1c28;
  --border: #262633;
  --border-hover: #383846;
  --text: #f5f5f7;
  --text-dim: #a0a0aa;
  --text-muted: #6f6f7a;
  --accent: #e5e5ea;
  --accent-hover: #ffffff;
  --on-accent: #14141c;
  --radius: 10px;
  --radius-lg: 16px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg-0); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 560px at 50% -220px, rgba(255, 255, 255, 0.055), transparent 70%),
    var(--bg-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
a { color: inherit; }

/* Images fade in once they have loaded instead of popping in. */
.fade-img { opacity: 0; transition: opacity 0.6s var(--ease-out), transform 1.2s var(--ease-out); }
.fade-img.loaded { opacity: 1; }

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid transparent;
  transition: background-color 0.4s var(--ease-out), border-color 0.4s var(--ease-out), backdrop-filter 0.4s var(--ease-out);
}
.topbar-wrap.scrolled {
  background: rgba(13, 13, 22, 0.72);
  border-bottom-color: var(--border);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 24px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 17px; }
.brand-sub {
  font-weight: 400;
  color: var(--text-muted);
  padding-left: 10px;
  border-left: 1px solid var(--border);
}
.top-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }
.discord-icon { flex: none; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  height: 40px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--bg-1);
  animation: appear 0.5s var(--ease-out) backwards;
}
.user-chip img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; }
.user-chip span { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.link-btn {
  border: 0;
  background: none;
  padding: 6px 10px;
  border-radius: 9999px;
  font: 400 13px var(--font);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.25s var(--ease-out), background-color 0.25s var(--ease-out);
}
.link-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }

/* ── Hero ────────────────────────────────────────────────────────────────── */
main { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.hero { text-align: center; padding: 64px 0 52px; animation: appear 0.8s var(--ease-out) backwards; }
.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(34px, 5.2vw, 52px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  text-wrap: balance;
}
.hero p { margin: 0 auto; max-width: 56ch; color: var(--text-dim); font-size: 16px; line-height: 1.65; text-wrap: pretty; }

@keyframes appear { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Tier cards ──────────────────────────────────────────────────────────── */
.tiers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 22px;
}
.tier {
  --tier: #8a8a96;
  --mx: 50%;
  --my: 0%;
  position: relative;
  isolation: isolate;
  flex: 0 1 344px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 1px 2px rgba(0, 0, 0, 0.3);
  transform: translateZ(0);
  transition:
    transform 0.45s var(--ease-out),
    border-color 0.35s var(--ease-out),
    box-shadow 0.5s var(--ease-out);
  /* backwards, not both: a finished entrance must not keep holding transform,
     or it would override the hover scale */
  animation: card-in 0.8s var(--ease-out) backwards;
}
/* Cards get their own compositor layer only while the pointer is over the grid:
   the scale then runs on the GPU, and the text is re-rasterised crisp again
   once the pointer leaves, instead of staying a slightly soft scaled bitmap. */
.tiers:hover .tier { will-change: transform; }
.tier:hover {
  transform: translateZ(0) scale(1.015);
  border-color: var(--border-hover);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 24px 48px -24px rgba(0, 0, 0, 0.75);
}
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: translateZ(0); } }

/* soft light that follows the cursor across the card */
.tier::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.055), transparent 45%);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
}
/* the same light on the border: a hairline that brightens near the cursor */
.tier::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  padding: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(260px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.28), transparent 60%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
}
.tier:hover::after, .tier:hover::before { opacity: 1; }

.tier-banner {
  position: relative;
  aspect-ratio: 1600 / 520;
  max-width: 100%;
  overflow: hidden;
  background: var(--bg-3);
}
.tier-banner img { width: 100%; height: 100%; object-fit: cover; }
/* The banner drifts in slowly on hover, like a camera pushing in: a long, even
   curve instead of the front-loaded one, so most of the zoom does not happen in
   the first moment. Leaving settles it back a little quicker. */
.tier-banner img.fade-img { transition: opacity 0.6s var(--ease-out), transform 1.1s var(--ease-in-out); }
.tier:hover .tier-banner img.loaded {
  transform: scale(1.05);
  /* starts slow and moves evenly: measured, an ease-out curve here had 85% of
     the zoom done after the first second, which reads as fast */
  transition: opacity 0.6s var(--ease-out), transform 4s cubic-bezier(0.45, 0, 0.55, 1);
}
/* the tier's own colour, as a hairline under the banner */
.tier-banner::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--tier);
  opacity: 0.85;
}
.tier-group {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  padding: 5px 11px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--on-accent);
  background: rgba(245, 245, 247, 0.94);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.tier-body { display: flex; flex-direction: column; gap: 16px; padding: 20px 22px 22px; flex: 1; }
.tier-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.tier-head h2 { margin: 2px 0 0; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; min-width: 0; }
.tier-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tier); flex: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04); }
.price { display: grid; justify-items: end; gap: 2px; white-space: nowrap; }
.price strong { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.price s { font-size: 13px; color: var(--text-muted); }
.price small { font-size: 12px; color: var(--text-muted); }
.tagline { margin: 0; color: var(--text-dim); font-size: 14px; line-height: 1.55; }
.perks {
  list-style: none;
  margin: 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 10px;
}
.perks li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text); }
.perks svg { flex: none; margin-top: 2px; color: var(--text-muted); }
.actions { display: flex; gap: 10px; margin-top: auto; padding-top: 6px; }
.actions .btn { flex: 1; }

.tier.skeleton {
  min-height: 380px;
  animation: none;
  background: linear-gradient(100deg, var(--bg-2) 30%, var(--bg-3) 50%, var(--bg-2) 70%) 0 0 / 300% 100%;
  animation: shimmer 1.8s linear infinite;
}
.tier.skeleton::before, .tier.skeleton::after { display: none; }
@keyframes shimmer { to { background-position: -150% 0; } }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: 500 14px var(--font);
  text-decoration: none;
  cursor: pointer;
  transform: translateZ(0);
  transition:
    transform 0.35s var(--ease-out),
    background-color 0.25s var(--ease-out),
    border-color 0.25s var(--ease-out),
    color 0.25s var(--ease-out);
}
.btn:hover { transform: translateZ(0) scale(1.02); }
.btn:active { transform: translateZ(0) scale(0.98); transition-duration: 0.1s; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: rgba(255, 255, 255, 0.015); border-color: var(--border); color: var(--text); }
.btn.ghost:hover { border-color: var(--border-hover); background: rgba(255, 255, 255, 0.045); }
.btn.small { height: 38px; padding: 0 14px; font-size: 13px; }
.btn:focus-visible, .icon-close:focus-visible, .link-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-0), 0 0 0 4px rgba(229, 229, 234, 0.45);
}

.state { text-align: center; color: var(--text-dim); margin: 32px 0 0; }

/* ── How it works ────────────────────────────────────────────────────────── */
.how {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  margin: 88px 0 0;
  padding: 30px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.how-num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-hover);
  font-size: 13px;
  color: var(--text-dim);
}
.how-step h3 { margin: 14px 0 6px; font-size: 16px; font-weight: 600; }
.how-step p { margin: 0; color: var(--text-dim); font-size: 14px; line-height: 1.6; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
  max-width: 1180px;
  margin: 72px auto 0;
  padding: 26px 24px 32px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
}
.footer p { margin: 0; }
.footer nav { display: flex; gap: 20px; }
.footer a { text-decoration: none; transition: color 0.25s var(--ease-out); }
.footer a:hover { color: var(--text); }

/* ── Sheets (dialogs) ────────────────────────────────────────────────────── */
.sheet {
  width: min(880px, calc(100vw - 32px));
  max-height: min(80vh, 760px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  color: var(--text);
  overflow: hidden;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.sheet[open] { display: flex; flex-direction: column; animation: sheet-in 0.45s var(--ease-out); }
.sheet.closing { animation: sheet-out 0.2s var(--ease-in-out) forwards; }
.sheet.small { width: min(440px, calc(100vw - 32px)); }
.sheet::backdrop {
  background: rgba(5, 5, 10, 0.68);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in 0.4s var(--ease-out);
}
.sheet.closing::backdrop { animation: fade-out 0.2s var(--ease-in-out) forwards; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes sheet-out { to { opacity: 0; transform: translateY(4px) scale(0.985); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 22px 22px 14px; }
.sheet-head h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.sheet > .muted { margin: 0 0 6px; padding: 0 22px; line-height: 1.6; }
.muted { color: var(--text-dim); font-size: 14px; margin: 4px 0 0; }
.muted.error { color: #e5737a; }
.sheet-foot { display: flex; justify-content: flex-end; padding: 16px 22px 22px; }
.sheet-foot:empty { display: none; }
.icon-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: transform 0.35s var(--ease-out), color 0.25s var(--ease-out), border-color 0.25s var(--ease-out);
}
.icon-close:hover { transform: scale(1.04); color: var(--text); border-color: var(--border-hover); }

.items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  /* Rows keep their full square height. Without this the grid squeezed every
     row into the sheet's height once a tier had hundreds of items: the tiles
     clip their overflow, which lets their minimum height drop to zero. */
  grid-auto-rows: max-content;
  align-content: start;
  gap: 10px;
  padding: 4px 22px 6px;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hover) transparent;
}
.item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  overflow: hidden;
  transform: translateZ(0);
  transition: transform 0.4s var(--ease-out), border-color 0.3s var(--ease-out);
}
.item:hover { transform: translateZ(0) scale(1.04); border-color: var(--border-hover); }
.item img { width: 100%; height: 100%; object-fit: contain; }
.item span {
  position: absolute;
  inset: auto 0 0 0;
  padding: 16px 6px 6px;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  background: linear-gradient(transparent, rgba(8, 8, 14, 0.92));
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

@media (max-width: 760px) {
  .topbar, main { padding-left: 16px; padding-right: 16px; }
  .hero { padding: 36px 0 32px; }
  .how { grid-template-columns: minmax(0, 1fr); padding: 24px; gap: 22px; }
  .tier { flex-basis: 100%; }
  .user-chip span { max-width: 90px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .tier:hover, .btn:hover, .item:hover { transform: translateZ(0); }
}
