/* Apologetics Nigeria — video viewer (assets/js/viewer.js).
   Loaded only on pages that have videos. The picture sits in a 16:9 frame;
   the title band above and the controls band below never cover it. */

html.vw-lock, html.vw-lock body { overflow: hidden; }

.vw {
  --vw-paper: #F2EFEA; --vw-soft: #C9CCCF; --vw-faint: #8C9298; --vw-line: rgba(242,239,234,.14);
  --vw-top: 84px; --vw-bot: 124px; --vw-pad: clamp(16px, 3.2vw, 44px);
  position: fixed; inset: 0; z-index: 700;
  background: radial-gradient(1200px 700px at 50% 45%, #121316, #050506 70%);
  color: var(--vw-paper); font-family: var(--f-sans, "Jost", system-ui, sans-serif);
  opacity: 0; transition: opacity .28s ease;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
.vw.is-open { opacity: 1; }
.vw[hidden] { display: none !important; }
.vw svg { width: 100%; height: 100%; display: block; }
.vw .mono { font-family: var(--f-sans, "Jost", system-ui, sans-serif); letter-spacing: .14em; text-transform: uppercase; font-size: 11px; }

/* top band: back, title, playlist */
.vw-top {
  position: absolute; top: 0; left: 0; right: 0; height: var(--vw-top);
  display: flex; align-items: center; gap: 14px;
  padding: env(safe-area-inset-top, 0px) var(--vw-pad) 0;
  transition: opacity .35s ease;
}
.vw-heading { min-width: 0; flex: 1; }
.vw-kick { margin: 0 0 2px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--vw-faint); }
.vw-title { margin: 0; font-family: var(--f-serif, "Newsreader", Georgia, serif); font-weight: 400; font-size: clamp(20px, 2vw, 28px); line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw-sub { display: none; }
.vw-list { margin: 0; color: var(--vw-faint); white-space: nowrap; }

/* the picture */
.vw-stage { position: absolute; top: var(--vw-top); bottom: var(--vw-bot); left: 0; right: 0; display: grid; place-items: center; padding: 0 var(--vw-pad); }
.vw-frame {
  position: relative; width: min(100%, calc((100vh - var(--vw-top) - var(--vw-bot)) * 16 / 9));
  aspect-ratio: 16 / 9; background: #000; border-radius: 14px; overflow: hidden;
  box-shadow: 0 40px 120px -30px rgba(0,0,0,.9), 0 0 0 1px rgba(242,239,234,.06);
}
@supports (height: 100dvh) { .vw-frame { width: min(100%, calc((100dvh - var(--vw-top) - var(--vw-bot)) * 16 / 9)); } }
.vw-media, .vw-media iframe, .vw-hit { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vw-media iframe { pointer-events: none; }
.vw-hit { cursor: pointer; }
.vw.is-native .vw-media iframe, .vw.is-tap .vw-media iframe { pointer-events: auto; }
.vw.is-native .vw-hit, .vw.is-tap .vw-hit, .vw.is-ended .vw-hit { display: none; }

/* end of a video: our own card replaces YouTube's end screen */
.vw-end { position: absolute; inset: 0; z-index: 2; background: #000; }
.vw-end img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; filter: saturate(.9); }
.vw-end::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(5,5,6,.92) 0%, rgba(5,5,6,.55) 55%, rgba(5,5,6,.15) 100%); }
.vw-end-in { position: absolute; z-index: 1; left: clamp(20px, 5%, 56px); bottom: clamp(20px, 9%, 64px); right: 20px; max-width: 560px; }
.vw-end-k { margin: 0 0 8px; color: var(--vw-soft); }
.vw-end-t { margin: 0 0 20px; font-family: var(--f-serif, "Newsreader", Georgia, serif); font-size: clamp(24px, 3.2vw, 44px); line-height: 1.05; }
.vw-end-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.vw-pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 22px; border-radius: 999px;
  border: 1px solid rgba(242,239,234,.4); background: rgba(242,239,234,.06); color: var(--vw-paper);
  font: 500 15px/1 var(--f-sans, "Jost", system-ui, sans-serif); cursor: pointer; transition: background .2s, transform .2s;
}
.vw-pill svg { width: 18px; height: 18px; }
.vw-pill:hover { background: rgba(242,239,234,.16); }
.vw-pill--solid { background: var(--vw-paper); color: #111214; border-color: var(--vw-paper); }
.vw-pill--solid:hover { background: #fff; transform: translateY(-1px); }

/* bottom band: seek bar and controls */
.vw-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--vw-bot);
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  padding: 0 var(--vw-pad) env(safe-area-inset-bottom, 0px);
  transition: opacity .35s ease;
}
.vw-seek { position: relative; height: 24px; display: flex; align-items: center; cursor: pointer; touch-action: none; outline: none; }
.vw-rail { position: relative; flex: 1; height: 4px; border-radius: 4px; background: rgba(242,239,234,.18); transition: height .15s ease; }
.vw-buf, .vw-played { position: absolute; inset: 0; border-radius: inherit; transform-origin: 0 50%; transform: scaleX(0); }
.vw-buf { background: rgba(242,239,234,.3); }
.vw-played { background: var(--vw-paper); }
.vw-knob { position: absolute; top: 50%; left: 0; width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px; border-radius: 50%; background: var(--vw-paper); box-shadow: 0 2px 10px rgba(0,0,0,.5); transform: scale(0); transition: transform .15s ease; }
.vw-seek:hover .vw-rail, .vw.is-seeking .vw-rail, .vw-seek:focus-visible .vw-rail { height: 6px; }
.vw-seek:hover .vw-knob, .vw.is-seeking .vw-knob, .vw-seek:focus-visible .vw-knob { transform: scale(1); }
.vw-seek:focus-visible { box-shadow: 0 0 0 2px var(--vw-paper); border-radius: 6px; }
.vw-tip { position: absolute; bottom: 26px; left: 0; transform: translateX(-50%); padding: 5px 8px; border-radius: 6px; background: rgba(17,18,20,.94); border: 1px solid var(--vw-line); color: var(--vw-paper); pointer-events: none; opacity: 0; transition: opacity .15s; }
.vw-seek:hover .vw-tip, .vw.is-seeking .vw-tip { opacity: 1; }

.vw-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.vw-group { display: flex; align-items: center; gap: 6px; flex: none; }
.vw-now { flex: 1; min-width: 0; margin: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--vw-soft); font-size: 15px; }
.vw-now b { font-weight: 500; color: var(--vw-paper); }
.vw-now span { color: var(--vw-faint); }
.vw-now span::before { content: "·"; margin: 0 .5em; }
.vw-time { margin: 0 0 0 8px; color: var(--vw-soft); white-space: nowrap; font-variant-numeric: tabular-nums; letter-spacing: .08em !important; }

.vw-btn {
  position: relative; display: inline-grid; place-items: center; width: 46px; height: 46px; padding: 9px;
  border: 0; border-radius: 50%; background: transparent; color: var(--vw-paper); cursor: pointer;
  transition: transform .18s ease, background .18s ease, opacity .18s;
}
.vw-btn:hover { transform: scale(1.12); background: rgba(242,239,234,.08); }
.vw-btn:disabled { opacity: .3; cursor: default; transform: none; background: none; }
.vw-btn:focus-visible, .vw-pill:focus-visible, .vw-ep:focus-visible, .vw-pop button:focus-visible, .vw-toast-btn:focus-visible { outline: 2px solid var(--vw-paper); outline-offset: 2px; }
.vw-play { width: 54px; height: 54px; padding: 11px; }
.vw.is-buffering .vw-play svg { opacity: .25; }
.vw.is-buffering .vw-play::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; border: 2px solid rgba(242,239,234,.2); border-top-color: var(--vw-paper); animation: vw-spin .8s linear infinite; }
@keyframes vw-spin { to { transform: rotate(360deg); } }
.vw-back { width: 48px; height: 48px; flex: none; background: rgba(242,239,234,.06); border: 1px solid var(--vw-line); }

/* volume: the slider opens on hover */
.vw-vol { display: flex; align-items: center; }
.vw-range {
  --v: 100%; width: 0; opacity: 0; margin: 0; height: 4px; border-radius: 4px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background: linear-gradient(90deg, var(--vw-paper) var(--v), rgba(242,239,234,.22) var(--v));
  transition: width .2s ease, opacity .2s ease, margin .2s ease;
}
.vw-vol:hover .vw-range, .vw-range:focus-visible { width: 92px; opacity: 1; margin: 0 10px 0 4px; }
.vw-range::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--vw-paper); border: 0; }
.vw-range::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--vw-paper); border: 0; }
.vw-range:focus-visible { outline: 2px solid var(--vw-paper); outline-offset: 6px; }

/* speed */
.vw-rate { width: auto; border-radius: 999px; display: inline-flex; gap: 6px; padding: 9px 12px 9px 9px; }
.vw-rate svg { width: 28px; height: 28px; }
.vw-rate-n { font-size: 12px !important; letter-spacing: .06em !important; min-width: 2.6em; text-align: left; }
.vw-pop-wrap { position: relative; }
.vw-pop {
  position: absolute; right: 0; bottom: 56px; min-width: 150px; padding: 6px; border-radius: 14px;
  background: rgba(23,24,27,.97); border: 1px solid var(--vw-line); box-shadow: 0 24px 60px -20px rgba(0,0,0,.8);
  display: grid; gap: 2px;
}
.vw-pop[hidden] { display: none; }
.vw-pop button { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 12px; border: 0; border-radius: 9px; background: none; color: var(--vw-soft); font: 400 15px/1 var(--f-sans, "Jost", system-ui, sans-serif); text-align: left; cursor: pointer; }
.vw-pop button:hover { background: rgba(242,239,234,.08); color: var(--vw-paper); }
.vw-pop button[aria-checked="true"] { color: var(--vw-paper); }
.vw-pop button[aria-checked="true"]::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--vw-paper); }

/* all videos */
.vw-eps {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 5; width: min(440px, 92vw);
  display: flex; flex-direction: column;
  background: rgba(17,18,20,.97); border-left: 1px solid var(--vw-line);
  box-shadow: -40px 0 100px -40px rgba(0,0,0,.9);
  transform: translateX(104%); visibility: hidden; transition: transform .35s cubic-bezier(.2,.7,.2,1), visibility 0s .35s;
}
.vw.show-eps .vw-eps { transform: none; visibility: visible; transition: transform .35s cubic-bezier(.2,.7,.2,1); }
.vw-eps-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: calc(22px + env(safe-area-inset-top, 0px)) 22px 14px 26px; border-bottom: 1px solid var(--vw-line); }
.vw-eps-head h3 { margin: 0; font-family: var(--f-serif, "Newsreader", Georgia, serif); font-weight: 400; font-size: 28px; }
.vw-eps-list { list-style: none; margin: 0; padding: 12px 14px 24px; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 6px; }
.vw-ep {
  width: 100%; display: grid; grid-template-columns: 136px minmax(0,1fr); gap: 14px; align-items: center;
  padding: 10px; border: 1px solid transparent; border-radius: 14px; background: none; color: var(--vw-paper);
  text-align: left; cursor: pointer; transition: background .2s, border-color .2s;
}
.vw-ep:hover { background: rgba(242,239,234,.05); }
.vw-ep[aria-current] { background: rgba(242,239,234,.07); border-color: rgba(242,239,234,.24); }
.vw-ep-img { position: relative; aspect-ratio: 16 / 9; border-radius: 9px; overflow: hidden; background: #1E2023; }
.vw-ep-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vw-ep[aria-current] .vw-ep-img::after { content: "Now playing"; position: absolute; inset: auto 6px 6px auto; padding: 3px 7px; border-radius: 999px; background: rgba(5,5,6,.8); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.vw-ep-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(242,239,234,.25); }
.vw-ep-bar b { display: block; height: 100%; background: var(--vw-paper); }
.vw-ep-txt { display: grid; gap: 3px; min-width: 0; }
.vw-ep-k { color: var(--vw-faint); font-size: 10.5px !important; }
.vw-ep-t { font-family: var(--f-serif, "Newsreader", Georgia, serif); font-size: 19px; line-height: 1.15; }
.vw-ep-s { color: var(--vw-soft); font-size: 13.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* small messages */
.vw-toast {
  position: absolute; top: calc(var(--vw-top) + 14px); left: 50%; z-index: 4; transform: translate(-50%, -8px);
  display: flex; align-items: center; gap: 14px; padding: 9px 10px 9px 18px; border-radius: 999px;
  background: rgba(17,18,20,.95); border: 1px solid var(--vw-line); font-size: 14px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.vw-toast:not(:has(button)) { padding-right: 18px; }
.vw-toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.vw-toast-btn { border: 0; border-radius: 999px; padding: 7px 14px; background: var(--vw-paper); color: #111214; font: 500 13px/1 var(--f-sans, "Jost", system-ui, sans-serif); cursor: pointer; }

/* idle while playing: bands fade, cursor hides, the picture stays put */
.vw.is-idle { cursor: none; }
.vw.is-idle .vw-hit { cursor: none; }
.vw.is-idle .vw-top, .vw.is-idle .vw-bottom { opacity: 0; pointer-events: none; }

/* native fallback: YouTube's own controls, ours step aside */
.vw.is-native .vw-seek, .vw.is-native .vw-group:first-child, .vw.is-native .vw-pop-wrap, .vw.is-native [data-vw="fs"] { display: none; }

/* how far you got, on the page's own cards */
.course-thumb .vw-card-bar { position: absolute; z-index: 3; left: 12px; right: 12px; bottom: 12px; height: 4px; border-radius: 4px; background: rgba(242,239,234,.28); overflow: hidden; pointer-events: none; }
.course-thumb .vw-card-bar i { display: block; height: 100%; background: #F2EFEA; }
.poster .vw-card-bar, .course-thumb:has(.pf-face) .vw-card-bar { display: none; }

/* touch: no hover volume, a little more room */
@media (pointer: coarse) {
  .vw-vol .vw-range { display: none; }
  .vw-btn:not(.vw-rate) { width: 48px; height: 48px; }
  .vw-btn:hover { transform: none; background: none; }
}

/* tablets and small laptops */
@media (max-width: 980px) {
  .vw-now, .vw-list { display: none; }
}

/* phones held upright: picture on top, controls under it, the list below */
@media (max-width: 760px) and (orientation: portrait) {
  .vw { overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; background: #0B0C0E; }
  .vw-top, .vw-stage, .vw-bottom { position: static; height: auto; }
  .vw-top { padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 12px; align-items: flex-start; }
  .vw-back { width: 42px; height: 42px; }
  .vw-title { white-space: normal; font-size: 22px; }
  .vw-sub { display: block; margin: 4px 0 0; color: var(--vw-soft); font-size: 14px; }
  .vw-stage { padding: 0; display: block; }
  .vw-frame { width: 100%; border-radius: 0; box-shadow: none; }
  .vw-bottom { padding: 8px 10px 4px; gap: 2px; }
  .vw-seek { margin: 0 6px; }
  .vw-group { gap: 0; }
  .vw-time { margin-left: 4px; font-size: 10.5px; }
  .vw-rate-n { display: none; }
  .vw-vol { display: none; }
  .vw-btn:not(.vw-rate), .vw-rate { width: 44px; height: 44px; }
  .vw-play { width: 48px !important; height: 48px !important; }
  .vw-rate { padding: 9px; }
  .vw.is-idle { cursor: auto; }
  .vw.is-idle .vw-top, .vw.is-idle .vw-bottom { opacity: 1; pointer-events: auto; }
  .vw-eps { position: static; width: auto; transform: none; visibility: visible; background: none; border: 0; box-shadow: none; border-top: 1px solid var(--vw-line); margin-top: 8px; }
  .vw-eps-head { padding: 18px 16px 6px; border: 0; }
  .vw-eps-head h3 { font-size: 24px; }
  .vw-eps-x, .vw-row [data-vw="eps"] { display: none; }
  .vw-eps-list { overflow: visible; padding: 4px 6px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .vw-ep { grid-template-columns: 124px minmax(0,1fr); }
  .vw-ep-t { font-size: 17px; }
  .vw-toast { position: fixed; top: auto; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
}

/* phones on their side: the picture takes the screen, the bands float over it */
@media (max-height: 520px) and (orientation: landscape) {
  .vw { --vw-top: 0px; --vw-bot: 0px; background: #000; }
  .vw-stage { padding: 0; }
  .vw-frame { border-radius: 0; box-shadow: none; }
  .vw-top { z-index: 3; height: auto; padding: 10px max(16px, env(safe-area-inset-left, 0px)) 26px; background: linear-gradient(180deg, rgba(0,0,0,.75), transparent); }
  .vw-bottom { z-index: 3; height: auto; padding: 22px max(16px, env(safe-area-inset-right, 0px)) 6px; background: linear-gradient(0deg, rgba(0,0,0,.8), transparent); }
  .vw-toast { top: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  .vw, .vw-top, .vw-bottom, .vw-eps, .vw-btn, .vw-toast, .vw-knob, .vw-rail, .vw-range { transition: none !important; }
  .vw.is-buffering .vw-play::after { animation-duration: 2.4s; }
}
