/* Landscape stream-count layout overrides. Portrait/mobile remains controlled by styles.css. */

body:not(.single-column) .stream-grid:has(> .stream-card:only-child) {
  grid-template-columns: 1fr;
}

@media (orientation: landscape) and (min-width: 1200px) {
  /* 3 streams: one row. */
  body:not(.single-column) .stream-grid:has(> .stream-card:nth-child(3)):not(:has(> .stream-card:nth-child(4))) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* 5-6 streams: 3 x 2. */
  body:not(.single-column) .stream-grid:has(> .stream-card:nth-child(5)):not(:has(> .stream-card:nth-child(7))) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* 7-8 streams: 4 x 2. */
  body:not(.single-column) .stream-grid:has(> .stream-card:nth-child(7)) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  /* Dense landscape mode once a fifth stream is present. */
  body:has(.stream-grid > .stream-card:nth-child(5)) .topbar {
    min-height: 90px;
  }

  body:has(.stream-grid > .stream-card:nth-child(5)) .input-error-wrap {
    min-height: 8px;
    margin-top: -18px;
    margin-bottom: 4px;
  }

  body:has(.stream-grid > .stream-card:nth-child(5)) .stream-grid {
    gap: 10px;
  }

  body:has(.stream-grid > .stream-card:nth-child(5)) .stream-toolbar {
    height: 44px;
    padding-inline: 10px;
  }

  body:has(.stream-grid > .stream-card:nth-child(5)) .platform-badge {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 0.66rem;
  }

  body:has(.stream-grid > .stream-card:nth-child(5)) .stream-name {
    font-size: 0.82rem;
  }

  body:has(.stream-grid > .stream-card:nth-child(5)) .icon-button {
    width: 32px;
    height: 32px;
  }

  body:has(.stream-grid > .stream-card:nth-child(5)) .icon-button svg {
    width: 17px;
    height: 17px;
  }

  body:has(.stream-grid > .stream-card:nth-child(5)) .action-bar {
    min-height: 62px;
    margin-top: 10px;
    padding: 6px 10px;
  }

  body:has(.stream-grid > .stream-card:nth-child(5)) .stream-count-pill,
  body:has(.stream-grid > .stream-card:nth-child(5)) .action-button {
    min-height: 40px;
    height: 40px;
  }
}
