/*
 * Home.
 *
 * Editorial-minimal direction: one dominant action, real typographic hierarchy,
 * macro-whitespace between sections, and a live section that earns its weight.
 *
 * The previous version stacked identical rows at 32px gaps. Everything sat in one
 * plane, so nothing led the eye. This uses four distinct layout families instead
 * of one: a hero, a three-up note row, a wide live card, and a hairline index.
 */

/* ---------------------------------------------------------------- structure */

/*
 * Macro-whitespace.
 *
 * The skill's guidance is roughly double the comfortable spacing, because a page
 * with this little content needs air to feel deliberate rather than sparse.
 * Top padding is smaller than bottom: optically, a page reads as balanced when
 * the foot has slightly more room than the head.
 */
.home {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  /* Grows so the join band sits at the foot instead of leaving a void. */
  flex: 1;
  padding: clamp(32px, 5vw, 64px) var(--space-5) clamp(48px, 6vw, 80px);
  display: flex;
  flex-direction: column;
  gap: clamp(40px, 5vw, 64px);
}

/*
 * The document heading.
 *
 * Quieter than a hero: on this page the live card is the subject, and a large
 * title above it would compete. It exists to name the page for assistive tech and
 * to anchor the eye at the top of the column.
 */
/*
 * The heading and the action that adds to it, on one line.
 *
 * The row carries the negative bottom margin the bare title used to: the head
 * belongs to the section under it more than it belongs to the page, so it eats
 * most of the column gap rather than adding to it.
 */
.home-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: calc(var(--space-5) * -1);
}

.page-title {
  font-size: 13px;
  font-weight: 550;
  letter-spacing: 0.01em;
  color: var(--text-faint);
  margin-bottom: 0;
  /* The heading yields to the action rather than the action to the heading. */
  min-width: 0;
}

.btn-add {
  flex: none;
  /* A little smaller than a primary action: it adds, it does not lead. */
  height: 34px;
  padding: 0 var(--space-4);
  font-size: 13px;
}

.home-empty-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
  max-width: 36rem;
}

.home-empty-copy h1 {
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0;
}

.home-empty-copy p {
  margin: 0;
  max-width: 42ch;
}

.home-empty {
  min-height: min(72dvh, 720px);
  justify-content: center;
}

.home-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* ------------------------------------------------------------------ labels */

/*
 * Section labels are small, spaced, and quiet.
 *
 * They organise rather than announce: the content beneath is the point. Sentence
 * case rather than the all-caps eyebrow the skill warns about, except for the
 * live marker which is a status and reads faster in caps.
 */
.section-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 13px;
  font-weight: 550;
  letter-spacing: 0.01em;
  color: var(--text-muted);
}

.section-label .count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-variant-numeric: tabular-nums;
}

/* A live marker is the one thing on this page that earns a coloured dot. */
.pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  background: var(--accent);
  flex: none;
  animation: pulse 2.4s var(--ease) infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.85);
  }
}

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

/* -------------------------------------------------------------------- hero */

.hero {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  max-width: 46rem;
}

/*
 * The kicker is a plain label, not an eyebrow pill.
 *
 * The skill bans the decorative uppercase tracked eyebrow above every section.
 * This appears once, on the only page that has a hero, and carries information.
 */
.hero-kicker {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-faint);
  letter-spacing: 0.01em;
}

.hero h1 {
  /* Display scale: the page's only headline, so it carries the weight. */
  font-size: clamp(38px, 6.4vw, 68px);
  letter-spacing: -0.04em;
  line-height: 0.98;
  font-weight: 640;
  color: var(--text);
}

.hero-lede {
  font-size: clamp(16px, 1.5vw, 18px);
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 46ch;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

/* --------------------------------------------------------------- hero notes */

/*
 * Three notes, one column on a phone.
 *
 * Deliberately not the three-equal-cards row the skill bans as the most generic
 * AI layout: no borders, no backgrounds, sized by a grid that varies its columns
 * rather than three identical tracks, and separated by a hairline rather than
 * being boxed.
 */
.hero-notes {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  border-top: 1px solid var(--border);
}

@media (min-width: 760px) {
  .hero-notes {
    grid-template-columns: 1.25fr 1fr 1fr;
  }
}

.note {
  padding: var(--space-5) var(--space-5) var(--space-5) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  border-bottom: 1px solid var(--border);
}

@media (min-width: 760px) {
  .note {
    border-bottom: none;
    padding: var(--space-6) var(--space-6) 0 0;
  }

  /* Hairlines between, not around. */
  .note + .note {
    border-left: 1px solid var(--border);
    padding-left: var(--space-6);
  }
}

.note h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
}

.note p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 34ch;
}

/* --------------------------------------------------------------- live cards */

.live-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/*
 * The live surface.
 *
 * The only card on the page, because it is the only thing that needs elevation:
 * a running talk should be findable in a glance. Tinted with the accent at very
 * low strength plus an inner highlight, so it reads as lit rather than coloured.
 */
.live-card {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
  padding: var(--space-4) var(--space-5) var(--space-4) var(--space-4);
  border-radius: var(--r-lg);
  border: 1px solid var(--accent-dim);
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--accent) 7%, transparent),
      color-mix(in srgb, var(--accent) 3%, transparent)
    ),
    var(--surface);
  box-shadow:
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.live-card-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  flex: 1 1 320px;
  min-width: 0;
}

.live-card-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
}

/*
 * A prepared room is stated in muted ink, not the accent.
 *
 * The accent belongs to a running talk: a speaker scanning the page must be able to
 * tell at a glance whether the room is already in front of an audience. Colour is
 * the cheapest way to say that, and the label says it again in words.
 */
.live-badge-ready {
  color: var(--text-muted);
}

.live-card-age {
  font-size: 12px;
  color: var(--text-faint);
}

.live-card-title {
  font-size: clamp(19px, 2vw, 24px);
  font-weight: 620;
  letter-spacing: -0.025em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

/*
 * Stats sit on a baseline grid of their own.
 *
 * Key above value, monospaced values, tabular figures: the room code and the
 * slide position are both things a speaker reads out loud, so they are set to be
 * unambiguous rather than pretty.
 */
.live-card-stats {
  display: flex;
  gap: var(--space-8);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-val {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stat-val-code {
  font-size: 21px;
  letter-spacing: 0.1em;
}

.stat-sep {
  color: var(--text-faint);
  font-weight: 400;
}

.live-card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
  margin-left: auto;
}

.live-card-note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-faint);
  text-align: right;
  max-width: 22ch;
}

/* -------------------------------------------------------------- deck index */

/*
 * A hairline list, not cards.
 *
 * Cards imply every item is a destination of equal importance. This is an index,
 * and plain rows with dividers scan far faster than eight bordered boxes. Only
 * the first row has a top border, so the group reads as one object.
 */
.deck-index {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.deck-line {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  transition: background-color var(--dur-fast) var(--ease);
}

.deck-line:hover {
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}

.deck-line-title {
  font-size: 15px;
  font-weight: 550;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  flex: 1 1 240px;
  min-width: 0;
  overflow-wrap: anywhere;
  /*
   * A 44px target on a link whose text is 15px tall.
   *
   * This is the primary action of the row and it is tapped on a phone, so the
   * hit area is padded rather than the type enlarged. Removing this regressed
   * during the rewrite and the responsive sweep caught it.
   */
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/*
 * Optically centre the row.
 *
 * The title carries 44px of hit area while the meta line does not, so centring
 * by the box would push the title low. Aligning to the title's baseline keeps the
 * row looking level.
 */
.deck-line {
  align-items: center;
}

.deck-line-title:hover {
  color: var(--accent);
}

.deck-line-meta {
  font-size: 12px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}

.dot-sep {
  width: 2px;
  height: 2px;
  border-radius: 99px;
  background: var(--text-faint);
  opacity: 0.6;
  flex: none;
}

.deck-line-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
  margin-left: auto;
}

.deck-index-muted .deck-line-title {
  color: var(--text-muted);
}

/* -------------------------------------------------------------- destructive */

/*
 * Quiet until hovered.
 *
 * Deleting is destructive and must be findable when looked for and easy to miss
 * when reaching for Present. Colour appears only on interaction, so the row does
 * not read as a warning.
 */
.btn-icon-danger {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-faint);
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    color var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

.btn-icon-danger:hover {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.btn-icon-danger:active {
  transform: scale(0.94);
}

/* ------------------------------------------------------------------- notice */

.notice {
  font-size: 13px;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: var(--r-md);
  padding: var(--space-3) var(--space-4);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

/* --------------------------------------------------------------- join band */

/*
 * A distinct band, not a card in the flow.
 *
 * It serves a different person from the rest of the page, so it is separated by
 * a full-width rule and its own surface rather than sitting in the same column as
 * the speaker's work. The join input is the largest control on the page, because
 * typing six characters on a phone while a room waits is the whole job.
 */
.join-band {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: auto;
}

.join-band-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
  padding-top: var(--space-6);
  padding-bottom: var(--space-6);
  max-width: 1080px;
}

.join-band-copy h2 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.join-band-copy p {
  font-size: 13px;
  color: var(--text-muted);
}

.join-band-form {
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
}

.join-band-form .input-code {
  width: 190px;
  height: 48px;
  font-size: 20px;
  letter-spacing: 0.2em;
}

.join-band-form .btn {
  height: 48px;
  padding: 0 var(--space-4);
}

/* ------------------------------------------------------------------ buttons */

/* A tertiary style, so the page is not only filled plus ghost. */
.btn-quiet {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
  font-weight: 500;
}

.btn-quiet:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

@media (max-width: 560px) {
  .live-card {
    padding: var(--space-4);
  }

  .live-card-stats {
    gap: var(--space-6);
  }

  .live-card-actions,
  .deck-line-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }

  .join-band-form {
    width: 100%;
  }

  .join-band-form .input-code {
    flex: 1;
    width: auto;
    min-width: 0;
  }
}


/* --------------------------------------------------- slide on the live card */

/*
 * The slide the room is currently on.
 *
 * A fixed 16:9 box so the row height is stable whether or not a thumbnail exists,
 * and a dark surround so the image reads as a slide rather than as decoration.
 * Rendered at 132px wide from the cached thumbnail tier, so it costs one request
 * the browser has usually already made.
 */
.live-card-slide {
  margin: 0;
  flex: none;
  width: 132px;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-md);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.live-card-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

@media (max-width: 700px) {
  /* On a phone the slide would crowd the card, and the position number is enough. */
  .live-card-slide {
    display: none;
  }

  .live-card {
    padding: var(--space-4);
  }
}


/* ---------------------------------------------------------- solo live card */

/*
 * The one thing on the page, given the room to be the one thing.
 *
 * Vertical centring is the whole difference between whitespace and emptiness: a
 * card pinned to the top with a gap beneath reads as unfinished, while the same
 * card centred in the column reads as deliberate. The skill's whitespace
 * maximisation only works when the remaining space looks composed.
 *
 * That holds in a column wide enough to have a shape. On a phone it does not —
 * see the exception below.
 */
.live-card-solo {
  padding: var(--space-6);
  gap: var(--space-8);
  align-items: stretch;
}

.home-section-solo {
  flex: 1;
  /* Centre the section's contents in the space it was given. */
  justify-content: center;
}

/*
 * On a phone, do not.
 *
 * A solo card is full-width here, so centring it in the leftover height does not
 * balance the page — it moves the whole void from beneath the card to above it,
 * landing between the page title and "Live now" as a screenful of nothing. It
 * reads as a rendering fault rather than as breathing room, which is exactly how
 * it was reported. The space still exists; it now falls below the card, which is
 * where the join band and the rest of the page already are.
 */
@media (max-width: 700px) {
  .home-section-solo {
    justify-content: flex-start;
  }
}

/*
 * The stack must NOT stretch.
 *
 * `flex: 1` made it fill the section's height, so the card sat at the top of a
 * tall empty box and the centring had nothing to centre. Sizing to content lets
 * the section's `justify-content: center` actually move it.
 */
.home-section-solo .live-stack {
  flex: none;
}

.live-card-solo .live-card-main {
  gap: var(--space-5);
  justify-content: center;
}

.live-card-solo .live-card-title {
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.03em;
}

.live-card-solo .stat-val-code {
  font-size: 26px;
}

.live-card-solo .stat-val {
  font-size: 20px;
}

.live-card-solo .live-card-slide {
  width: clamp(180px, 26vw, 320px);
  align-self: center;
}

@media (max-width: 700px) {
  /* On a phone the card stays compact; the slide is hidden at this width. */
  .live-card-solo {
    padding: var(--space-5);
    gap: var(--space-5);
  }

  .live-card-solo .live-card-title {
    font-size: 22px;
  }
}
