/*
 * Creator Live Studio — looping product demo for the marketing home page.
 *
 * Follows the same contract as the Influxx site-demo kit: the mock is built
 * from the product's own tokens (transcribed from src/pages/creator-studio.tsx
 * — #0f0f0f/#18181b surfaces, #2f2f35 hairlines, #efeff1/#adadb8 type, #a855f7
 * accent) plus the Whistlr LIVE pink from wls-brand.js. Nothing here is an
 * eyeballed colour.
 *
 * Motion lives in wls-studio-demo.js and is a pure function of loop time, so
 * the last frame equals frame 0.
 */

.wsd {
  --wsd-bg: #0f0f0f;
  --wsd-panel: #18181b;
  --wsd-panel-2: #121214;
  --wsd-line: #2f2f35;
  --wsd-text: #efeff1;
  --wsd-dim: #adadb8;
  --wsd-accent: #a855f7;
  --wsd-accent-soft: #bf94ff;
  --wsd-live: #f91880;

  width: 100%;
  /* Sit tight under the About media block; stage owns the visual weight. */
  margin-top: clamp(-36px, -3.5vw, -12px);
  padding: clamp(12px, 2vw, 28px) clamp(12px, 2.5vw, 40px) clamp(48px, 7vw, 100px);
  background: #0a0e11;
  color: var(--wsd-text);
  font-family: var(--an-sans, 'PPNeueMontreal', 'PPNeueMontreal Fallback', system-ui, sans-serif);
  box-sizing: border-box;
  /* MediaContainer uses z-index:2 + overflow:hidden; without this the intro
     is painted under that block and the headline looks clipped. */
  position: relative;
  z-index: 3;
  overflow: visible;
}

.wsd *,
.wsd *::before,
.wsd *::after {
  box-sizing: border-box;
}

/* ---------------------------------------------------------------- intro */

.wsd__intro {
  max-width: 860px;
  margin: 0 auto clamp(16px, 2.2vw, 28px);
  text-align: center;
  overflow: visible;
}

.wsd__eyebrow {
  margin: 0 0 14px;
  font-family: 'PPNeueMontrealMono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wsd-dim);
  overflow: visible;
}

.wsd__title {
  margin: 0 0 14px;
  font-size: clamp(26px, 4vw, 44px);
  /* 1.08 was clipping descenders (y/g) on PPNeueMontreal display sizes. */
  line-height: 1.18;
  letter-spacing: -0.01em;
  color: #fff;
  text-transform: none;
  overflow: visible;
  padding-block: 0.06em;
}

.wsd__sub {
  margin: 0;
  font-size: clamp(14px, 1.5vw, 17px);
  line-height: 1.5;
  color: var(--wsd-dim);
  overflow: visible;
}

/* ---------------------------------------------------------------- shell */

.wsd__stage {
  max-width: min(1480px, 100%);
  margin: 0 auto;
}

.wsd__app {
  border: 1px solid var(--wsd-line);
  border-radius: 16px;
  background: var(--wsd-bg);
  overflow: hidden;
  box-shadow: 0 36px 100px rgba(0, 0, 0, 0.58);
}

/* ------------------------------------------------------------- titlebar */

.wsd__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--wsd-panel);
  border-bottom: 1px solid var(--wsd-line);
}

.wsd__mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: block;
  flex: none;
}

.wsd__app-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--wsd-text);
  white-space: nowrap;
}

/* The titlebar carries no LIVE pill — the badge lives on the broadcast, where
   a viewer would actually look for it. */

.wsd__bar-spacer {
  flex: 1 1 auto;
}

.wsd__stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--wsd-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.wsd__stat b {
  color: var(--wsd-text);
  font-weight: 600;
}

.wsd__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--wsd-live);
  display: inline-block;
}

/* ----------------------------------------------------------------- body */

.wsd__body {
  display: grid;
  grid-template-columns: minmax(200px, 220px) minmax(0, 1fr) minmax(260px, 300px);
  /* Overall chrome height — roomy, but stage width stays capped at 1480. */
  min-height: min(68svh, 720px);
  align-items: stretch;
}

.wsd__rail,
.wsd__chat {
  background: var(--wsd-panel-2);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.wsd__rail {
  border-right: 1px solid var(--wsd-line);
}

.wsd__chat {
  border-left: 1px solid var(--wsd-line);
}

.wsd__panel-h {
  margin: 0;
  padding: 12px 14px 10px;
  font-family: 'PPNeueMontrealMono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--wsd-dim);
  border-bottom: 1px solid var(--wsd-line);
}

/* --------------------------------------------------- live earnings feed */

/*
 * Mirrors the chat column's rhythm on purpose: same list behaviour, same
 * bottom-anchored fill, so the two rails read as one product surface rather
 * than a feed next to a stat panel.
 */
.wsd__feed {
  list-style: none;
  margin: 0;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  overflow: hidden;
  justify-content: flex-end;
}

.wsd__tip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(168, 85, 247, 0.1);
  border-left: 2px solid var(--wsd-accent);
}

.wsd__tip img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  display: block;
  flex: none;
}

.wsd__tip-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.wsd__tip-user {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wsd__tip-gem {
  font-size: 11px;
  color: var(--wsd-dim);
  line-height: 1.15;
}

.wsd__tip-amt {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--wsd-accent-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: none;
}

.wsd__earn {
  padding: 12px 14px;
  border-top: 1px solid var(--wsd-line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wsd__earn span {
  font-family: 'PPNeueMontrealMono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--wsd-dim);
}

.wsd__earn b {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.wsd__payout {
  font-size: 10px;
  color: var(--wsd-accent-soft);
}

/* --------------------------------------------------------------- stream */

.wsd__stream {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #000;
  overflow: hidden;
  min-width: 0;
}

.wsd__frame {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wsd__scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 26%),
    linear-gradient(to top, rgba(0, 0, 0, 0.62) 0%, rgba(0, 0, 0, 0) 34%);
  pointer-events: none;
}

.wsd__badges {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wsd__pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.wsd__pill--live {
  background: var(--wsd-live);
  /* wls-brand.js repaints anything reading "LIVE" pink. The element opts out
     via data-wls-live, and this keeps the type white regardless. */
  color: #fff !important;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.wsd__pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  display: block;
  flex: none;
}

/* audio meter — cheap, and it reads as "this is actually running" */
.wsd__meter {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
}

.wsd__meter i {
  width: 3px;
  border-radius: 2px;
  background: var(--wsd-accent-soft);
  display: block;
  height: 20%;
}

.wsd__caption {
  position: absolute;
  right: 12px;
  bottom: 12px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.72);
  font-family: 'PPNeueMontrealMono', ui-monospace, monospace;
  letter-spacing: 0.06em;
}

/* gem toast — the moment a Gem lands on the broadcast */
.wsd__toast {
  position: absolute;
  left: 50%;
  bottom: 44px;
  transform: translate(-50%, 14px);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px 8px 9px;
  border-radius: 999px;
  background: rgba(15, 15, 15, 0.9);
  border: 1px solid var(--wsd-accent);
  box-shadow: 0 10px 34px rgba(168, 85, 247, 0.35);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.wsd__toast img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  display: block;
}

.wsd__toast-text {
  font-size: 13px;
  color: #fff;
}

.wsd__toast-text b {
  color: var(--wsd-accent-soft);
  font-weight: 600;
}

/* ----------------------------------------------------------------- chat */

.wsd__chat-list {
  list-style: none;
  margin: 0;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1 1 auto;
  overflow: hidden;
  justify-content: flex-end;
}

.wsd__msg {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--wsd-text);
  word-break: break-word;
}

.wsd__msg b {
  font-weight: 600;
}

.wsd__msg--gem {
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(168, 85, 247, 0.14);
  border-left: 2px solid var(--wsd-accent);
  color: var(--wsd-accent-soft);
}

.wsd__msg--sys {
  font-size: 11.5px;
  color: var(--wsd-dim);
}

.wsd__composer {
  border-top: 1px solid var(--wsd-line);
  padding: 9px 12px;
  font-size: 12px;
  color: #6f6f78;
}

/* --------------------------------------------------------------- footer */

.wsd__note {
  max-width: min(1480px, 100%);
  margin: 18px auto 0;
  text-align: center;
  font-size: 12px;
  color: #6f6f78;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 900px) {
  .wsd {
    margin-top: 0;
    padding-top: clamp(24px, 5vw, 40px);
  }

  .wsd__body {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .wsd__rail {
    border-right: 0;
    border-bottom: 1px solid var(--wsd-line);
    order: 2;
  }

  /* Stacked layout has no tall column to fill — cap the feed and let it
     stay bottom-anchored so the newest Gem is always the visible one. */
  .wsd__feed {
    max-height: 200px;
    padding: 10px;
  }

  .wsd__body {
    min-height: 0;
  }

  .wsd__stream {
    order: 1;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .wsd__chat {
    border-left: 0;
    border-top: 1px solid var(--wsd-line);
    order: 3;
    max-height: 210px;
  }
}

@media (max-width: 560px) {
  .wsd__app-name,
  .wsd__caption {
    display: none;
  }
}

/* Reduced motion keeps the composed frame, drops the animation entirely. */
@media (prefers-reduced-motion: reduce) {
  .wsd__toast {
    transition: none !important;
  }
}
