/*
 * The tutorial library as a ruled index rather than a wall of thumbnails.
 *
 * Blueprint 04 asked for poster-first lite embeds. A YouTube poster is served
 * by Google, which would contact youtube's image host on page load and make
 * the privacy notice's promise ("YouTube receives no request until you open a
 * video") untrue. So each row is a record — code, title, duration, language,
 * year — and activating it mounts the youtube-nocookie player in place. The
 * facade therefore costs nothing, keeps the promise exactly, and matches the
 * SYSTEM OF RECORD direction better than a thumbnail grid would.
 */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-bottom: var(--s6);
}

.filter {
  min-height: 36px;
  padding: var(--s1) var(--s3);
  background: none;
  border: var(--hairline) solid var(--rule-strong);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: var(--step-mono);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition:
    border-color var(--t-colour) linear,
    background-color var(--t-colour) linear,
    color var(--t-colour) linear;
}

.filter:hover {
  border-color: var(--ink);
}

.filter[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/*
 * The count was dimmed with opacity, which quietly drops it below 4.5:1.
 * An explicit colour per state keeps it readable on both grounds.
 */
.count {
  margin-left: var(--s2);
  color: var(--muted);
}

.filter[aria-pressed="true"] .count {
  color: var(--muted-2);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: var(--hairline) solid var(--rule);
}

.item {
  border-bottom: var(--hairline) solid var(--rule);
}

.row {
  display: grid;
  grid-template-columns: 3.5ch minmax(0, 1fr) auto;
  gap: var(--s4);
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: var(--s3) var(--s3);
  text-align: left;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background-color var(--t-colour) linear;
}

.row:hover {
  background: var(--paper-2);
}

.code {
  font-family: var(--font-mono);
  font-size: var(--step-mono);
  color: var(--muted);
}

.title {
  font-size: var(--step-small);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.meta {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: var(--step-label);
  letter-spacing: 0.04em;
  color: var(--ink-2);
  text-transform: uppercase;
}

.play {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-family: var(--font-mono);
  font-size: var(--step-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  border: var(--hairline) solid var(--rule-strong);
  padding: var(--s2) var(--s3);
  white-space: nowrap;
}

.row:hover .play {
  border-color: var(--ink);
}

.frame {
  border-top: var(--hairline) solid var(--rule);
  background: var(--mat);
  padding: var(--s3);
}

.aspect {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--ink);
}

.aspect iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.frameFoot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s2) var(--s4);
  margin-top: var(--s3);
  font-family: var(--font-mono);
  font-size: var(--step-label);
  letter-spacing: 0.04em;
  color: var(--ink-2);
}

.frameFoot a {
  color: var(--ink);
}

.privacy {
  margin: var(--s4) 0 0;
  font-family: var(--font-mono);
  font-size: var(--step-label);
  letter-spacing: 0.02em;
  color: var(--muted);
}

.empty {
  padding: var(--s6) 0;
  color: var(--ink-2);
}

@media (max-width: 599px) {
  .row {
    grid-template-columns: 3.5ch minmax(0, 1fr);
    row-gap: var(--s2);
  }

  .play {
    grid-column: 2;
    justify-self: start;
  }
}
