/* The Sales Stage: live mode. The projector page (stage.html), the
   "Stage open" badge in the site header and the member dashboard, and the
   admin Live page. Loaded after styles.css (and app.css on the dashboards). */

/* =====================================================================
   Projector page
   ===================================================================== */

.live-page {
  --live-pad: clamp(1.25rem, 3.4vmin, 3.5rem);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: var(--ink);
  color: var(--bone);
}

.live-page.is-idle {
  cursor: none;
}

.live-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding: var(--live-pad) var(--live-pad) 0;
}

.live-logo {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-size: clamp(1rem, 2.6vmin, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.live-logo svg {
  width: 1.35em;
  height: 1.35em;
  color: var(--orange);
}

.live-evening {
  min-width: 0;
  text-align: right;
}

.live-evening-title {
  overflow: hidden;
  max-width: 48vw;
  font-size: clamp(0.95rem, 2.5vmin, 1.9rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-room {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  margin-top: 0.25em;
  color: var(--muted);
  font-size: clamp(0.9rem, 2.3vmin, 1.75rem);
  font-variant-numeric: tabular-nums;
}

.live-dot {
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: var(--orange);
  animation: live-pulse 2s ease-in-out infinite;
}

.live-main {
  display: grid;
  min-height: 0;
  padding: var(--live-pad);
}

.live-main > [hidden] {
  display: none !important;
}

.live-label {
  font-family: var(--mono);
  font-size: clamp(0.8rem, 2.2vmin, 1.6rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---------- Open: the bracket frame ---------- */

.live-open {
  display: grid;
  place-items: center;
}

.live-frame {
  --corner: clamp(2.5rem, 11vmin, 9rem);
  --stroke: clamp(0.5rem, 1.6vmin, 1.25rem);
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: clamp(0.4rem, 1.6vmin, 1.5rem);
  width: min(100%, 150vmin);
  height: 100%;
  min-height: 60vmin;
  padding: calc(var(--corner) * 0.75) calc(var(--corner) * 0.9);
  text-align: center;
}

.live-corner {
  position: absolute;
  width: var(--corner);
  height: var(--corner);
  border: 0 solid var(--orange);
}

.live-corner.is-tl { top: 0; left: 0; border-top-width: var(--stroke); border-left-width: var(--stroke); }
.live-corner.is-tr { top: 0; right: 0; border-top-width: var(--stroke); border-right-width: var(--stroke); }
.live-corner.is-br { bottom: 0; right: 0; border-bottom-width: var(--stroke); border-right-width: var(--stroke); }
.live-corner.is-bl { bottom: 0; left: 0; border-bottom-width: var(--stroke); border-left-width: var(--stroke); }

.live-name {
  max-width: 100%;
  font-size: clamp(2.5rem, 13vmin, 11rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.98;
  overflow-wrap: anywhere;
}

.live-name[data-size="m"] {
  font-size: clamp(2.2rem, 10vmin, 8.5rem);
}

.live-name[data-size="s"] {
  font-size: clamp(1.9rem, 7.5vmin, 6.5rem);
}

.live-name.is-waiting {
  color: var(--faint);
}

.live-timer {
  margin-top: clamp(0.25rem, 1.5vmin, 1.5rem);
  font-size: clamp(4rem, 25vmin, 22rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.05em;
  line-height: 0.9;
  transition: color 0.3s ease;
}

.live-timer[data-mode="idle"] {
  color: var(--faint);
}

.live-timer[data-mode="last"],
.live-timer[data-mode="done"] {
  color: var(--orange);
}

.live-timer-note {
  min-height: 1.2em;
  color: var(--orange);
  font-family: var(--mono);
  font-size: clamp(0.9rem, 3vmin, 2.25rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------- Closed ---------- */

.live-closed {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: clamp(0.75rem, 2.5vmin, 2rem);
  width: min(100%, 150vmin);
  margin-inline: auto;
}

.live-closed-title {
  font-size: clamp(3rem, 16vmin, 14rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 0.92;
}

.live-next {
  display: grid;
  gap: 0.35em;
  margin-top: clamp(0.5rem, 3vmin, 2.5rem);
  padding-left: clamp(0.75rem, 2vmin, 1.75rem);
  border-left: clamp(0.3rem, 0.9vmin, 0.7rem) solid var(--orange);
}

.live-next-title {
  font-size: clamp(1.4rem, 5vmin, 4.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.live-next-when {
  color: var(--muted);
  font-size: clamp(1rem, 3vmin, 2.4rem);
}

.live-next-url {
  margin-top: clamp(0.5rem, 3vmin, 2.5rem);
  color: var(--faint);
  font-size: clamp(0.9rem, 2.4vmin, 1.8rem);
}

.is-loading .live-main {
  visibility: hidden;
}

/* ---------- Fullscreen button ---------- */

.live-fullscreen {
  position: fixed;
  right: var(--live-pad);
  bottom: var(--live-pad);
  padding: 0.6rem 1rem;
  border: 1px solid var(--line);
  background: var(--ink-raised);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.875rem;
  transition: opacity 0.4s ease, color 0.2s ease;
}

.live-fullscreen:hover {
  color: var(--bone);
}

.is-idle .live-fullscreen {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 640px) {
  .live-top {
    flex-direction: column;
    gap: 0.75rem;
  }

  .live-evening {
    text-align: left;
  }

  .live-evening-title {
    max-width: 88vw;
  }

  .live-fullscreen {
    display: none;
  }

  .live-frame {
    min-height: 0;
    padding: calc(var(--corner) * 0.6) calc(var(--corner) * 0.45);
  }
}

/* =====================================================================
   "Stage open" badge (site header and member dashboard)
   ===================================================================== */

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.35rem 0.7rem;
  border: 1px solid color-mix(in srgb, var(--orange) 45%, transparent);
  background: color-mix(in srgb, var(--orange) 10%, transparent);
  color: var(--bone);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.live-badge[hidden] {
  display: none;
}

.live-badge:hover {
  border-color: var(--orange);
  background: color-mix(in srgb, var(--orange) 18%, transparent);
}

.live-badge .live-dot {
  flex-shrink: 0;
}

.live-badge-room {
  color: var(--muted);
  font-weight: 500;
}

/* In the site header: sits right after the brand, the nav keeps its place. */
.site-header .live-badge {
  margin-right: auto;
}

@media (max-width: 520px) {
  .site-header .live-badge-room {
    display: none;
  }
}

/* In the member dashboard overview */
.app-page .live-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid color-mix(in srgb, var(--orange) 45%, transparent);
  border-radius: var(--app-radius);
  background: color-mix(in srgb, var(--orange) 8%, var(--app-card));
}

.app-page .live-strip[hidden] {
  display: none;
}

.app-page .live-strip p {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-page .live-strip strong {
  font-weight: 600;
}

.app-page .live-strip small {
  color: var(--muted);
  font-size: 13px;
}

/* =====================================================================
   Admin Live page
   ===================================================================== */

.app-page .live-admin-state {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.app-page .live-admin-clock {
  font-size: 56px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1;
}

.app-page .live-admin-clock[data-mode="idle"] {
  color: var(--faint);
}

.app-page .live-admin-clock[data-mode="last"],
.app-page .live-admin-clock[data-mode="done"] {
  color: var(--orange);
}

.app-page .live-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.app-page .live-presets .btn[aria-pressed="true"] {
  border-color: var(--orange);
  color: var(--orange);
}

.app-page .live-people {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.app-page .live-person {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--app-raised);
  color: var(--bone);
  cursor: pointer;
  font-size: 13px;
}

.app-page .live-person:hover,
.app-page .live-person[aria-pressed="true"] {
  border-color: var(--orange);
}

.app-page .live-person[aria-pressed="true"] {
  color: var(--orange);
}

.app-page .live-onstage-now {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

/* =====================================================================
   Motion
   ===================================================================== */

@keyframes live-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.8);
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot {
    animation: none;
  }

  .live-timer,
  .live-fullscreen,
  .live-badge {
    transition: none;
  }
}
