/*
 * tv-nav.css: television overrides and the TV listbox.
 *
 * Everything in here sits under html[data-tvnav], which scripts/tv-nav.js
 * sets only when it detects a television (or ?tv=1). On phones and desktops
 * this file changes nothing.
 */

/* A television sits across the room: type steps up, and nothing scrolls
   smoothly against the remote. */
html[data-tvnav] { font-size: 112.5%; }
html[data-tvnav],
html[data-tvnav] * { scroll-behavior: auto !important; }

/* The focus ring is the cursor on a TV. Five pixels, offset well clear. */
html[data-tvnav] :focus-visible {
  outline: 5px solid var(--tg-purple);
  outline-offset: 4px;
  border-radius: 10px;
}

/* The focused card grows a little so the choice reads from the couch. */
html[data-tvnav] .tv-card:focus-visible,
html[data-tvnav] .station:focus-visible,
html[data-tvnav] .song-hit:focus-visible {
  transform: scale(1.06);
}

/* Remote targets, not mouse targets. */
html[data-tvnav] .tv-ctl,
html[data-tvnav] .tg-mode,
html[data-tvnav] .radio-more-btn,
html[data-tvnav] .tvnav-select,
html[data-tvnav] .tvnav-opt {
  min-height: 56px;
}
html[data-tvnav] .tv-ctl { min-width: 56px; }

/* Native selects are replaced by a button plus a listbox dialog (see
   tv-nav.js). The original stays in the DOM so the app's change handlers
   keep working, but it is never shown and never focusable. */
html[data-tvnav] select[data-tvnav-replaced] { display: none; }

/* The replacement button wears the same pill the selects wore. */
.tvnav-select {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: var(--tg-ink);
  border: 1px solid var(--tg-rule-strong);
  border-radius: 999px;
  padding: 11px 16px;
  font: inherit;
  font-size: 14px;
  max-width: 100%;
}
.tvnav-select::after {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-right: 2.5px solid var(--tg-ink-soft);
  border-bottom: 2.5px solid var(--tg-ink-soft);
  transform: rotate(45deg) translateY(-2px);
}
.tvnav-select-val {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Nobody types an email address on a television. */
html[data-tvnav] .store-notify { display: none; }

/* ── the listbox dialog ─────────────────────────────────────────────────── */

.tvnav-listbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vmin;
  background: rgba(11, 11, 18, 0.72);
}

.tvnav-listbox-card {
  background: #fff;
  color: var(--tg-ink);
  border-radius: 18px;
  width: 100%;
  max-width: 720px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  padding: 28px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.tvnav-listbox-card h2 {
  margin: 0 0 16px;
  font-size: 1.6rem;
  line-height: 1.2;
}

.tvnav-listbox-opts {
  overflow-y: auto;
  display: grid;
  gap: 8px;
  padding: 4px;
  margin: -4px;
}

.tvnav-opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1.3;
  color: var(--tg-ink);
  background: #fff;
  border: 2px solid var(--tg-rule);
  border-radius: 12px;
}

.tvnav-opt[data-current] {
  border-color: var(--tg-purple);
  font-weight: 700;
}

.tvnav-cancel {
  margin-top: 16px;
  text-align: center;
  border-color: var(--tg-rule-strong);
}
