/*
 * BMW YouTube Feed — Front-end Styles
 * Layout modes: sidebar (default), grid.
 * Uses CSS container queries for component-level responsiveness.
 */

/* ================================================================
   Base / shared
   ================================================================ */

.bmw-ytf-feed {
  --bmw-ytf-accent: #bc3f3e;
  --bmw-ytf-radius: 0;
  --bmw-ytf-gap: 16px;
  --bmw-ytf-title-color: #1e293b;
  --bmw-ytf-title-size: 1rem;

  container-type: inline-size;
  container-name: bmw-ytf;
  max-width: 1200px;
  margin: 0 auto;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---- Video card ---- */

.bmw-ytf-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.bmw-ytf-video {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--bmw-ytf-radius);
  background: #0f172a;
  cursor: pointer;
}

.bmw-ytf-video:focus-visible {
  outline: 3px solid var(--bmw-ytf-accent);
  outline-offset: 2px;
}

.bmw-ytf-video img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s ease;
}

.bmw-ytf-video:hover img {
  opacity: 0.85;
}

.bmw-ytf-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: var(--bmw-ytf-radius);
}

/* ---- Play button overlay ---- */

.bmw-ytf-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.bmw-ytf-play svg {
  width: 68px;
  height: 48px;
  transition: transform 0.15s ease, opacity 0.15s ease;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.bmw-ytf-video:hover .bmw-ytf-play svg {
  transform: scale(1.1);
}

.bmw-ytf-video:hover .bmw-ytf-play-bg {
  fill: #f00;
  fill-opacity: 1;
}

.bmw-ytf-video--playing .bmw-ytf-play {
  display: none;
}

/* ---- Video title ---- */

.bmw-ytf-title {
  margin: 6px 0 0;
  padding: 0;
  font-size: var(--bmw-ytf-title-size);
  font-weight: 600;
  line-height: 1.35;
  color: var(--bmw-ytf-title-color);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ================================================================
   Layout: Sidebar (default)
   Featured left (~2fr), 2 stacked right (~1fr), optional bottom row.
   The featured video + title height matches the two sidebar cards.
   ================================================================ */

.bmw-ytf-feed--sidebar .bmw-ytf-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--bmw-ytf-gap);
}

.bmw-ytf-feed--sidebar .bmw-ytf-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--bmw-ytf-gap);
}

.bmw-ytf-feed--sidebar .bmw-ytf-bottom {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--bmw-ytf-gap);
  margin-top: var(--bmw-ytf-gap);
}

.bmw-ytf-feed--sidebar .bmw-ytf-featured .bmw-ytf-title {
  font-size: 0.9375rem;
}

/* Sidebar: wide — 2-column with featured spanning full height */
@container bmw-ytf (width > 600px) {
  .bmw-ytf-feed--sidebar .bmw-ytf-main {
    grid-template-columns: 2.25fr 1fr;
    gap: calc(var(--bmw-ytf-gap) * 1.5);
  }

  .bmw-ytf-feed--sidebar .bmw-ytf-featured .bmw-ytf-title {
    font-size: 1rem;
  }

  .bmw-ytf-feed--sidebar .bmw-ytf-sidebar .bmw-ytf-play svg {
    width: 48px;
    height: 34px;
  }

  .bmw-ytf-feed--sidebar .bmw-ytf-sidebar .bmw-ytf-title {
    font-size: 0.85rem;
  }
}

/* ================================================================
   Layout: Grid
   Uniform responsive columns.
   ================================================================ */

.bmw-ytf-feed--grid .bmw-ytf-grid {
  display: grid;
  gap: var(--bmw-ytf-gap);
  grid-template-columns: repeat(2, 1fr);
}

@container bmw-ytf (width > 500px) {
  .bmw-ytf-feed--grid .bmw-ytf-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@container bmw-ytf (width > 800px) {
  .bmw-ytf-feed--grid .bmw-ytf-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ================================================================
   Shared responsive tweaks
   ================================================================ */

@container bmw-ytf (width <= 400px) {
  .bmw-ytf-play svg {
    width: 48px;
    height: 34px;
  }

  .bmw-ytf-title {
    font-size: 0.85rem;
  }
}
