/* R2B4 FIX20: all standard iVideo video cards, fixed-height safe layout. */
/* Scope everything to tagged cards. Normal cards and the site template remain unchanged. */
.iv-keyword-card .itemBox.listBox .contentText,
.listCol.block.iv-keyword-card .itemBox.listBox .contentText {
  box-sizing: border-box !important;
  height: 148px !important;
  min-height: 148px !important;
  max-height: 148px !important;
  padding: 10px 13px 9px !important;
  display: -webkit-flex !important;
  display: flex !important;
  -webkit-flex-direction: column;
  flex-direction: column;
  overflow: hidden !important;
}
.iv-keyword-card .contentText .videoKind {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  flex: 0 0 auto;
  max-height: 22px;
}
.iv-keyword-card .contentText .videoTitle {
  flex: 0 0 auto;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.4;
  max-height: 54px;
  margin: 3px 0 0;
}
.iv-keyword-card .iv-course-tags {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 5px !important;
  margin: auto 0 0 !important;
  height: 24px !important;
  min-height: 24px !important;
  max-height: 24px !important;
  align-items: center;
  overflow: hidden !important;
  white-space: nowrap;
}
.iv-keyword-card .iv-course-tag {
  display: inline-block;
  flex: 0 1 auto;
  max-width: 85px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  line-height: 20px;
  padding: 0 7px;
  border: 1px solid #577a9d;
  border-radius: 12px;
  color: #d0e8fb !important;
  background: rgba(14,48,78,.92);
  text-decoration: none !important;
  box-sizing: border-box;
}
.iv-keyword-card .iv-course-tag:hover,
.iv-keyword-card .iv-course-tag:focus {
  color: #fff !important;
  border-color: #f4911a;
  background: #18557c;
}
/* Give label rows the same geometry even when a programme has no keywords. */
.iv-keyword-card .contentText .videoTitle:last-child { margin-bottom: 0; }
@media (max-width: 600px) {
  .iv-keyword-card .itemBox.listBox .contentText,
  .listCol.block.iv-keyword-card .itemBox.listBox .contentText {
     height: 137px !important; min-height: 137px !important; max-height: 137px !important;
     padding: 8px 9px !important;
  }
  .iv-keyword-card .iv-course-tag { max-width: 70px; }
}

/* R2B4 FIX22: reference layout - 3 keyword pills and remaining +N. */
.iv-keyword-card .iv-course-tags { justify-content: flex-start !important; }
.iv-keyword-card .iv-course-tag { flex: 0 1 auto !important; max-width: 90px; }
.iv-keyword-card .iv-course-tag-extra {
  display: inline-block;
  flex: 0 0 auto;
  color: #ff9a24;
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  white-space: nowrap;
  cursor: help;
}
@media (max-width: 600px) {
  .iv-keyword-card .iv-course-tag { max-width: 65px; }
}

/* FIX23: clickable remaining-keyword counter. Keep the card's original height. */
.iv-keyword-card .iv-course-tag-extra {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto !important;
  padding: 0 3px !important;
  border: 0 !important;
  box-shadow: none !important;
  outline-offset: 2px;
  border-radius: 4px;
  background: transparent !important;
  color: #ff9a24 !important;
  font: inherit;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 22px !important;
  cursor: pointer !important;
  -webkit-appearance: none;
  appearance: none;
}
.iv-keyword-card .iv-course-tag-extra:hover,
.iv-keyword-card .iv-course-tag-extra:focus-visible {
  color: #ffd38c !important;
  text-decoration: underline;
}
/* Reserve room for +N instead of cutting it off on narrower tiles. */
.iv-keyword-card .iv-course-tags > .iv-course-tag {
  flex: 0 1 auto !important;
  min-width: 0;
  max-width: 77px;
}
/* A popover is rendered in the browser top layer, outside overflow:hidden cards. */
.iv-course-extra-popover[popover] {
  box-sizing: border-box;
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 12px;
  width: min(280px, calc(100vw - 16px));
  max-height: min(320px, 60vh);
  overflow-y: auto;
  border: 1px solid #426783;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
  background: #0c2d4d;
  color: #e7f2fc;
  z-index: 2147483647;
  font-size: 13px;
}
.iv-course-extra-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 9px;
}
.iv-course-extra-header button {
  cursor: pointer;
  background: transparent;
  color: #e7f2fc;
  border: 0;
  padding: 0 4px;
  font-size: 20px;
  line-height: 1.1;
}
.iv-course-extra-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.iv-course-extra-list .iv-course-tag {
  display: inline-block;
  max-width: none !important;
  flex: 0 0 auto !important;
  overflow: visible !important;
  text-overflow: clip;
  padding: 2px 9px;
  border: 1px solid #587da0;
  border-radius: 16px;
  background: #143e61;
  color: #e7f2fc !important;
  white-space: nowrap;
  text-decoration: none;
  font-size: 12px;
}
.iv-course-extra-list .iv-course-tag:hover,
.iv-course-extra-list .iv-course-tag:focus {
  background: #1c527a;
  border-color: #ff9a24;
}
@media (max-width: 600px) {
  .iv-keyword-card .iv-course-tags > .iv-course-tag { max-width: 58px; }
}
