/* Card stack on the account page (stack.js): your cards stacked like a wallet, the one you're
   using in front, and an outline at the back for adding another Discord account. */

.cstack {
  --peek: 30px;
  --add-lift: 22px;                  /* how far the outline rises on hover */
  position: relative;
  margin-top: calc(var(--add-lift) + 10px);   /* room above for it, clear of the heading */
  padding-top: calc(var(--slots) * var(--peek));
}
.cstack-space { aspect-ratio: 1.586; }

.cstack-item {
  position: absolute;
  left: 0; right: 0;
  top: calc(var(--slot) * var(--peek));
  z-index: var(--slot);
  transform: translateY(var(--lift, 0px)) scale(calc(1 - var(--depth) * 0.03));
  transform-origin: 50% 0;
  transition: top .5s cubic-bezier(.2, .8, .2, 1), transform .5s cubic-bezier(.2, .8, .2, 1), filter .3s ease;
}
.cstack-item.back { cursor: pointer; filter: brightness(calc(1 - var(--depth) * 0.06)); }
.cstack-item.back .mcard { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 -6px 18px -10px rgba(11, 31, 75, 0.45); }
.cstack-item.back:hover, .cstack-item.back:focus-visible { --lift: -8px; filter: none; }
.cstack-item:focus-visible { outline: none; }
.cstack-item.back:focus-visible .mcard { outline: 3px solid rgba(255, 255, 255, 0.9); outline-offset: 2px; }
.cstack-item.front { cursor: default; }

/* who's on each card behind the front one, readable in its peeking strip */
.cstack-tag {
  position: absolute; top: 7px; right: 14px; z-index: 5;
  display: flex; align-items: center; gap: 7px;
  max-width: 60%;
  padding: 3px 10px 3px 3px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.92); color: var(--navy);
  font-size: 12px; font-weight: 700; line-height: 1;
  box-shadow: 0 2px 8px rgba(11, 31, 75, 0.18);
  opacity: 0; transition: opacity .25s ease;
  pointer-events: none;
}
.cstack-item.back .cstack-tag { opacity: 1; }
.cstack-tag img, .cstack-tag i {
  width: 18px; height: 18px; border-radius: 50%; flex: none; object-fit: cover;
  display: grid; place-items: center; font-style: normal; font-size: 10px;
  background: var(--accent); color: #fff;
}
.cstack-tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cstack-tag.locked { background: rgba(255, 237, 213, 0.95); color: #9a3412; }

/* the outline at the back: add another account */
.cstack-add {
  aspect-ratio: 1.586;
  border-radius: 26px;
  border: 2px dashed rgba(31, 111, 224, 0.55);
  background: rgba(255, 255, 255, 0.32);
  display: flex; flex-direction: column; justify-content: flex-start;   /* the row sits in the peeking strip */
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: var(--navy);
  font: inherit; text-align: left;
  width: 100%; padding: 0;
  cursor: pointer;
  transition: background .25s ease, border-color .25s ease;
}
.cstack-add-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  height: var(--peek);
  padding: 0 22px;
  transition: transform .3s ease;
  font-size: 14px; font-weight: 700;
}
.cstack-add .plus {
  width: 20px; height: 20px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: #fff; color: var(--accent);
  font-size: 16px; font-weight: 800; line-height: 1;
  box-shadow: 0 2px 8px rgba(11, 31, 75, 0.18);
}
.cstack-add .msg { opacity: 0; transform: translateY(4px); transition: opacity .25s ease, transform .25s ease; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cstack-add .msg small { font-weight: 600; color: var(--navy-soft); margin-left: 6px; }
.cstack-item.adder:hover, .cstack-item.adder:focus-within { --lift: calc(-1 * var(--add-lift)); filter: none; }
/* keep the text centred in the band that's showing once it has risen */
.cstack-item.adder:hover .cstack-add-row, .cstack-add:focus-visible .cstack-add-row { transform: translateY(calc(var(--add-lift) / 2)); }
.cstack-item.adder:hover .cstack-add, .cstack-add:focus-visible { background: rgba(255, 255, 255, 0.72); border-color: var(--accent); outline: none; }
.cstack-item.adder:hover .msg, .cstack-add:focus-visible .msg { opacity: 1; transform: none; }
.cstack-add.full .plus { color: #9a3412; }
.cstack-add.busy { cursor: progress; }

/* under the stack: which card this is, its colour, remove */
.card-tools {
  display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px 18px;
  margin-top: 16px;
}
.card-who { font-size: 14px; color: var(--navy-soft); }
.card-who strong { color: var(--navy); }
.card-who .pill-mini {
  margin-left: 6px; padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  background: rgba(31, 111, 224, 0.12); color: var(--accent);
}
.card-who .pill-mini.locked { background: rgba(234, 88, 12, 0.12); color: #c2410c; }
.card-tools-right { display: flex; align-items: center; gap: 14px; }
.swatches { display: flex; align-items: center; gap: 8px; }
.swatches > span { font-size: 13px; font-weight: 600; color: var(--navy-soft); margin-right: 2px; }
.swatch {
  width: 26px; height: 26px; border-radius: 50%; padding: 0; cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(11, 31, 75, 0.15), 0 3px 8px rgba(11, 31, 75, 0.2);
  transition: transform .15s ease, box-shadow .15s ease;
}
.swatch:hover { transform: scale(1.08); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--accent), 0 3px 8px rgba(11, 31, 75, 0.2); }
.swatch:disabled { cursor: not-allowed; opacity: .35; transform: none; }
.swatch.blue { background: linear-gradient(135deg, #0b1f4b, #16348a 55%, #3884ff); }
.swatch.black { background: linear-gradient(135deg, #0a0a0a, #2a2f38 55%, #64748b); }
.swatch.gold { background: linear-gradient(135deg, #8a6212, #d4a52a 50%, #fff1b8); }
.card-tools .link-btn { font-size: 14px; }
.card-tools .link-btn.danger { color: #b91c1c; }

@media (max-width: 520px) {
  .cstack { --peek: 24px; }
  .cstack-tag { top: 4px; right: 10px; font-size: 11px; }
  .cstack { --add-lift: 18px; }
  .cstack-add-row { font-size: 13px; padding: 0 14px; }
  .cstack-add .msg small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cstack-item { transition: none; }
}

/* Send dialog: which card is being sent */
.sending-as { margin-top: -2px; font-size: 14px; color: var(--navy-soft); }
.sending-as b { color: var(--navy); }

/* Remove-account dialog (account page) */
.remove-dialog { width: min(460px, calc(100vw - 32px)); }
.remove-dialog .dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.btn-danger { background: #dc2626; color: #fff; box-shadow: 0 8px 18px -6px rgba(220, 38, 38, 0.55); }
.btn-danger:hover { background: #b91c1c; }
@media (max-width: 420px) { .remove-dialog .dlg-actions .btn { flex: 1; } }

/* Blue button (Remove under the card, and its confirm) */
.btn.btn-blue { background: var(--accent); color: #fff; box-shadow: 0 8px 18px -6px rgba(31, 111, 224, 0.55); }
.btn.btn-blue:hover { background: #1a5fc2; }
