/* Media gallery (/media) — video cards with YouTube lite-embed + platform icons. */

.afb-media {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.afb-media-head {
  text-align: center;
  margin-bottom: 1.75rem;
}

.afb-media-title {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  font-weight: 800;
  margin: 0 0 .35rem;
}

.afb-media-title .fa-play {
  color: #c00;
  margin-right: .4rem;
}

.afb-media-sub {
  color: var(--bs-secondary-color, #6c757d);
  margin: 0 auto;
  max-width: 48rem;
}

/* Filter toolbar: keyword search + date range + type toggle. */
.afb-media-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .6rem .9rem;
  max-width: 1000px;
  margin: 0 auto 1.6rem;
}

.afb-media-search {
  position: relative;
  flex: 1 1 240px;
  max-width: 360px;
}

.afb-media-search .fa-magnifying-glass {
  position: absolute;
  left: .7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bs-secondary-color, #6c757d);
  pointer-events: none;
}

.afb-media-search .afb-media-input {
  width: 100%;
  padding-left: 2rem;
}

.afb-media-input {
  border: 1px solid var(--bs-border-color, #ced4da);
  border-radius: 8px;
  padding: .4rem .6rem;
  font-size: .9rem;
  background: var(--bs-body-bg, #fff);
  color: var(--bs-body-color, #212529);
}

.afb-media-input:focus-visible {
  outline: 2px solid #4c8bf5;
  outline-offset: 0;
  border-color: #4c8bf5;
}

.afb-media-dates {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.afb-media-datelabel {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
  color: var(--bs-secondary-color, #6c757d);
}

.afb-media-toggle {
  display: inline-flex;
  border: 1px solid var(--bs-border-color, #ced4da);
  border-radius: 999px;
  overflow: hidden;
}

.afb-media-tab {
  border: 0;
  background: transparent;
  padding: .42rem .95rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--bs-body-color, #212529);
  cursor: pointer;
}

.afb-media-tab + .afb-media-tab {
  border-left: 1px solid var(--bs-border-color, #ced4da);
}

.afb-media-tab.is-active {
  background: var(--afbytes-navy, #0b1f3a);
  color: #fff;
}

/* Dynamic responsive grid: reflows by card count + viewport width instantly
   (pure CSS). Reading order is left-to-right, top-to-bottom = newest first. */
.afb-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 1.25rem;
  align-items: start;
}

.afb-media-cell {
  min-width: 0;
}

.afb-media-cell.is-hidden {
  display: none;
}

.afb-media-cell > .afb-media-card,
.afb-media-cell > .afb-xpost {
  width: 100%;
  height: 100%;
}

.afb-media-noresults {
  text-align: center;
  color: var(--bs-secondary-color, #6c757d);
  padding: 2.5rem 1rem;
}

.afb-media-card {
  display: flex;
  flex-direction: column;
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-border-color, #e5e7eb);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
  transition: box-shadow .15s ease, transform .15s ease;
}

.afb-media-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
  transform: translateY(-2px);
}

/* 16:9 thumbnail frame */
.afb-media-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0b0b0b;
}

.afb-media-thumb .afb-yt-thumb,
.afb-media-thumb .afb-media-out {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: #0b0b0b;
  position: relative;
}

.afb-media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.afb-media-thumb iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.afb-thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #555;
  font-size: 2.5rem;
}

/* Play overlay */
.afb-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .55);
  background: rgba(0, 0, 0, .12);
  transition: background .15s ease, transform .15s ease;
  pointer-events: none;
}

.afb-yt-thumb .afb-play .fa-youtube { color: #ff0000; }

.afb-yt-thumb:hover .afb-play,
.afb-media-out:hover .afb-play {
  background: rgba(0, 0, 0, .28);
  transform: scale(1.06);
}

.afb-yt-thumb:focus-visible,
.afb-media-out:focus-visible {
  outline: 3px solid #4c8bf5;
  outline-offset: -3px;
}

.afb-media-body {
  padding: .85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  flex: 1 1 auto;
}

.afb-media-card-title {
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

.afb-media-meta {
  font-size: .82rem;
  color: var(--bs-secondary-color, #6c757d);
  margin: 0;
}

/* Platform icon row */
.afb-media-links {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: auto;
  padding-top: .35rem;
}

.afb-media-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--bs-tertiary-bg, #f1f3f5);
  color: var(--bs-body-color, #212529);
  font-size: 1.05rem;
  text-decoration: none;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}

.afb-media-link:hover {
  background: #111;
  color: #fff;
  transform: translateY(-1px);
}

.afb-media-empty {
  text-align: center;
  color: var(--bs-secondary-color, #6c757d);
  padding: 4rem 1rem;
}

.afb-media-empty .fa-film {
  font-size: 3rem;
  opacity: .5;
  margin-bottom: .75rem;
}
