/* Latest YouTube videos (homepage).
   Kept out of styles.css on purpose: that file is cached for 30 days under a
   fixed URL, so new rules there would not reach returning visitors. This file
   is loaded with a ?v= query and can change freely. */

.video-section .section-heading { align-items: end; }

.video-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.button-youtube {
  color: var(--paper);
  background: #c4302b;
}
.button-youtube:hover,
.button-youtube:focus-visible { background: #a82520; color: var(--paper); }
.button-youtube .icon { width: 1.15rem; height: 1.15rem; fill: currentColor; stroke: none; }

.video-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.video-card {
  display: flex;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.video-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.video-card:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }

.video-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--navy);
}
/* hqdefault is 4:3 with letterbox bars; cover-cropping to 16:9 removes them. */
.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.video-card:hover .video-thumb img { transform: scale(1.04); }

.video-play {
  position: absolute;
  inset: 50% auto auto 50%;
  display: grid;
  width: 3.25rem;
  height: 3.25rem;
  place-items: center;
  color: var(--paper);
  background: rgba(196, 48, 43, 0.92);
  border-radius: 50%;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  transition: transform 0.2s ease;
}
.video-play svg { width: 1.3rem; height: 1.3rem; margin-left: 3px; fill: currentColor; }
.video-card:hover .video-play { transform: translate(-50%, -50%) scale(1.08); }

.video-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1rem 1.1rem 1.15rem;
}

.video-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.video-new {
  padding: 0.18rem 0.55rem;
  color: var(--paper);
  background: var(--coral);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.video-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow-wrap: anywhere;
}

@media (max-width: 1020px) {
  .video-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Phones: a compact list (thumbnail left, title right) instead of six tall cards. */
@media (max-width: 760px) {
  .video-section .section-heading { flex-direction: column; align-items: flex-start; gap: 1.1rem; }
  .video-list { grid-template-columns: 1fr; gap: 0.75rem; }
  .video-card { flex-direction: row; align-items: stretch; border-radius: var(--radius-sm); }
  .video-card:hover { transform: none; }
  .video-thumb { flex: 0 0 42%; max-width: 11rem; aspect-ratio: 16 / 10; }
  .video-play { width: 2.2rem; height: 2.2rem; }
  .video-play svg { width: 0.95rem; height: 0.95rem; margin-left: 2px; }
  .video-body { min-width: 0; gap: 0.35rem; padding: 0.7rem 0.85rem; }
  .video-meta { font-size: 0.75rem; }
  .video-title { font-size: 0.9rem; line-height: 1.4; }
}

@media (prefers-reduced-motion: reduce) {
  .video-card,
  .video-thumb img,
  .video-play { transition: none; }
  .video-card:hover,
  .video-card:hover .video-thumb img { transform: none; }
  .video-card:hover .video-play { transform: translate(-50%, -50%); }
}
