/*
 * <DemoCard> styles. Each demo is a framed card: the screenshot fills the top
 * edge to edge at its own 16:9, and the title and description sit in the
 * padded body under it. Hover and the keyboard cursor mark the frame and the
 * title.
 */
.demo-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--bg);
  transition:
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}

.demo-card:hover,
.demo-card.is-selected {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--bg));
  box-shadow: var(--shadow-md);
}

/* The keyboard cursor owns the highlight while j and k are in use. */
.is-keyboard-mode .demo-card:hover:not(.is-selected) {
  border-color: var(--rule);
  box-shadow: none;
}

.demo-card-stage { display: block; }

.demo-card-shot {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
  background: #fff;
}

.demo-card-shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
}

.demo-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5) var(--space-5);
}

.demo-card-title {
  font-weight: var(--weight-medium);
  color: var(--ink);
  line-height: 1.35;
  /* Two lines reserved and two shown; the full title is in the tooltip. */
  min-height: calc(2em * 1.35);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--duration-fast) var(--ease-out);
}

.demo-card:hover .demo-card-title,
.demo-card.is-selected .demo-card-title {
  color: var(--accent);
}

.is-keyboard-mode .demo-card:hover:not(.is-selected) .demo-card-title {
  color: var(--ink);
}

.demo-card-desc {
  min-height: calc(2em * 1.5);
  font-size: var(--text-sm);
  color: var(--ink-dim);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .demo-card-shot {
    background: #1b1d21;
  }
}

:root[data-theme="dark"] .demo-card-shot {
  background: #1b1d21;
}
