/* wisper — home (drop) page
   Builds on site.css. A tilted tray lit from above; files land in it as
   floating glass cards, the tray's front edge fills with foil as the upload
   runs, and the cards flip to their foil backs when the link is ready. */

:root {
  --tray-w:  min(860px, 100%);
  --tray-h:  clamp(210px, 36vh, 350px);
  /* Cards scale with the tray so they always sit inside the well. */
  --card-h:  min(192px, calc(var(--tray-h) * 0.62));
  --card-w:  calc(var(--card-h) * 0.77);
  --spread:  0.8;
}

/* ── Main column ────────────────────────────────────────────────────────── */

.main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(4px, 2vh, 24px) var(--gutter) clamp(16px, 3vh, 32px);
  min-width: 0;
}

.intro-copy { text-align: center; max-width: 680px; }

.title {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(28px, 1.2rem + 2.2vw, 50px);
  line-height: 1.08;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.lede {
  margin: 12px auto 0;
  max-width: 66ch;
  font-size: clamp(15px, 0.9rem + 0.25vw, 17px);
  color: var(--muted);
  text-wrap: balance;
}

/* ── The drop tray (scene pieces live in site.css) ──────────────────────── */

.scene { margin-top: clamp(26px, 5vh, 52px); }
.tray-face { cursor: pointer; }
.tray-face:hover::after { opacity: 0.4; }

.prompt {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  text-align: center;
  transition: opacity 260ms var(--ease), transform 420ms var(--ease-out);
}
.shell:not([data-state="idle"]) .prompt { opacity: 0; transform: scale(0.94); pointer-events: none; }

.prompt-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-bottom: 6px;
  border-radius: 18px;
  color: var(--text);
  background: linear-gradient(180deg, #2B2838 0%, #1B1924 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 10px 24px -8px rgba(0, 0, 0, 0.8),
    0 2px 0 #0B0A10;
  transition: transform 500ms var(--spring);
}
.tray-face:hover .prompt-icon { transform: translateY(-3px); }
.shell.dragging .prompt-icon { transform: translateY(-6px) scale(1.06); }

.prompt-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(19px, 0.9rem + 1vw, 26px);
  letter-spacing: -0.03em;
}
.prompt-sub { font-size: 15px; color: var(--muted); }

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  background: #1E1C27;
  box-shadow: inset 0 -1.5px 0 rgba(0, 0, 0, 0.5), inset 0 0 0 1px var(--line-hi);
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  vertical-align: 1px;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */

.cards {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  pointer-events: none;
}

.card {
  /* --o: signed fan offset, --ao: its absolute value (set per card in JS) */
  --x: calc(var(--o, 0) * var(--card-w) * var(--spread));
  --y: calc(var(--ao, 0) * 10px);
  --z: 56px;
  --rz: 0deg;
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--card-w);
  height: var(--card-h);
  margin: calc(var(--card-h) / -2) 0 0 calc(var(--card-w) / -2);
  transform-style: preserve-3d;
  transform: translate3d(var(--x), var(--y), var(--z)) rotateZ(var(--rz));
  transition: transform 700ms var(--spring);
  animation: card-in 820ms var(--spring) both;
  animation-delay: calc(var(--i) * 70ms);
}
.shell[data-state="uploading"] .card { --z: 84px; }
.shell[data-state="done"] .card { --z: 70px; }

@keyframes card-in {
  0% {
    opacity: 0;
    transform: translate3d(var(--x), calc(var(--y) - 90px), 340px) rotateZ(calc(var(--rz) * 3)) rotateX(-28deg);
  }
  35% { opacity: 1; }
  100% {
    opacity: 1;
    transform: translate3d(var(--x), var(--y), var(--z)) rotateZ(var(--rz));
  }
}

.card.settled { animation: none; }
.card.leaving {
  animation: card-out 260ms var(--ease) forwards;
}
@keyframes card-out {
  to {
    opacity: 0;
    transform: translate3d(var(--x), calc(var(--y) - 30px), 200px) rotateZ(var(--rz));
  }
}

.card-float {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}
.shell[data-state="uploading"] .card-float {
  animation: bob 2.4s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.4s);
}
@keyframes bob {
  0%, 100% { transform: translateZ(0); }
  50%      { transform: translateZ(10px); }
}

.card-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 1000ms var(--ease-out);
  transition-delay: calc(var(--i) * 90ms);
}
.shell[data-state="done"] .card-inner { transform: rotateY(180deg); }

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

.card-front {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 16px 14px;
  background: linear-gradient(160deg, #2D293B 0%, #1C1926 46%, #141219 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}
.card-front::before {
  /* foil rim */
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: var(--holo);
  background-size: 220% 220%;
  background-position: calc(50% + var(--nx) * 60%) calc(50% + var(--ny) * 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.5;
}

.card-ext {
  font-family: var(--display);
  font-weight: 700;
  font-size: calc(var(--card-w) * 0.2);
  line-height: 1;
  letter-spacing: -0.03em;
  background: var(--holo);
  background-size: 260% 260%;
  background-position: calc(50% + var(--nx) * 70%) calc(50% + var(--ny) * 70%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}
.card-ext.long { font-size: calc(var(--card-w) * 0.15); }

.card-name {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: clamp(11px, calc(var(--card-w) * 0.088), 13px);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  overflow-wrap: anywhere;
}
.card-size {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.card-glare {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at calc(50% + var(--nx) * 60%) calc(30% + var(--ny) * 50%), rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 55%);
  pointer-events: none;
}

.card-back {
  transform: rotateY(180deg);
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  color: #120F1A;
  background: var(--holo);
  background-size: 240% 240%;
  background-position: calc(50% + var(--nx) * 60%) calc(50% + var(--ny) * 60%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.card-back svg { width: calc(var(--card-w) * 0.23); height: calc(var(--card-w) * 0.23); }
.card-back span {
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.02em;
}

.card-count {
  position: absolute;
  top: -10px;
  right: -10px;
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--text);
  color: #120F1A;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 6px 14px -4px rgba(0, 0, 0, 0.7);
  transform: translateZ(2px);
}

.card-shadow {
  position: absolute;
  inset: 12% 8% 4%;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.6);
  filter: blur(14px);
  transform: translateZ(calc(var(--z) * -1 + 2px));
  transition: transform 700ms var(--spring);
}

/* ── Dock: status + actions under the tray ──────────────────────────────── */

.dock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: var(--tray-w);
  /* Tall enough for the done state (status + link box + links) so the
     column never re-centres when content swaps in. */
  min-height: 158px;
  margin-top: clamp(40px, 6vh, 64px);
}

.status {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 4px 18px;
  min-height: 24px;
  font-size: 16px;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.status strong { color: var(--text); font-weight: 600; }
.status .pct {
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--text);
  min-width: 3.4ch;
  text-align: right;
}
.status .err { color: var(--danger); }
.status .name {
  max-width: 34ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
.actions.stack {
  flex-direction: column;
  width: 100%;
  gap: 8px;
}
.actions-row {
  display: flex;
  justify-content: center;
  gap: 4px;
}
.shell:not([data-state="idle"]) .recent { display: none; }

/* Recent uploads (signed in, idle) */
.recent {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}
.recent li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 260px;
  height: 36px;
  padding: 0 4px 0 12px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 14px;
}
.recent a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text);
}
.recent a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-hi); }
.recent .icon-btn { width: 28px; height: 28px; }
.recent-label { font-size: 14px; color: var(--dim); }

.shell[data-state="uploading"] .seg { opacity: 0.45; pointer-events: none; }

/* ── Page load: the tray settles into place once ────────────────────────── */

@keyframes tray-settle {
  from { opacity: 0; transform: perspective(1400px) translateY(46px) rotateX(34deg) scale(0.94); }
  to   { opacity: 1; transform: perspective(1400px) translateY(0) rotateX(0deg) scale(1); }
}
.shell.intro .scene { animation: tray-settle 1100ms var(--ease-out) both; }
.shell.intro .intro-copy { animation: lift-in 800ms var(--ease-out) both; }
.shell.intro .foot { animation: lift-in 800ms var(--ease-out) 300ms both; }

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 760px) {
  :root {
    --tray-h: clamp(200px, 32vh, 280px);
    --card-h: min(150px, calc(var(--tray-h) * 0.56));
    --spread: 0.68;
  }
  .scene { perspective: 1100px; }
  .main { justify-content: flex-start; padding-top: 20px; }
  .dock { min-height: 0; margin-top: 44px; }
  .card-front { padding: 12px 12px 11px; }
  .card-name { -webkit-line-clamp: 2; }
  .seg { display: flex; }
  .seg-opt { flex: 1; justify-content: center; padding: 0 4px; }
  .actions { width: 100%; }
  .actions .btn { flex: 1 1 0; padding: 0 14px; }
  .actions .btn-solid,
  .actions .btn:only-child { flex: 1 1 100%; }
}

@media (max-height: 820px) and (min-width: 761px) {
  :root { --tray-h: clamp(190px, 30vh, 300px); }
  .title { font-size: clamp(26px, 1rem + 1.9vw, 42px); }
  .lede { margin-top: 8px; }
  .scene { margin-top: 24px; }
  .dock { margin-top: 36px; }
}
