/* =================================================================
   Video Vault — self-hosted, chaptered, download-resistant player
   Built on the Programming Ocean Academy ocean / sand / night tokens
   defined in index.css (:root). Prefixed "vv-" to avoid collisions.
   ================================================================= */

.vv-section{
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: linear-gradient(165deg, var(--night-surface) 0%, var(--night-panel) 55%, var(--night-page) 100%);
  padding: clamp(3rem, 2rem + 4vw, 5rem) var(--gutter) clamp(3.5rem, 2.5rem + 3vw, 5.5rem);
}
.vv-section::after{
  content: "";
  position: absolute; z-index: -1; right: 6%; top: -60px;
  width: 440px; height: 340px;
  background: radial-gradient(ellipse at center, rgba(34,184,216,.28) 0%, rgba(246,178,60,.18) 35%, transparent 72%);
  filter: blur(14px);
}

.vv-head{ max-width: var(--container); margin: 0 auto clamp(2rem, 1.5rem + 1.5vw, 3rem); text-align: center; }
.vv-head .vv-eyebrow{
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .35rem .9rem; border-radius: var(--radius-pill);
  background: rgba(246,178,60,.12); border: 1px solid rgba(246,178,60,.35);
  color: var(--sand); font-size: .78rem; font-weight: 700; letter-spacing: .02em;
  margin-bottom: 1rem;
}
.vv-head h2{
  font-family: var(--font-display); color: #fff;
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); margin-bottom: .7rem;
}
.vv-head p{ color: var(--night-soft); max-width: 640px; margin: 0 auto; font-size: .98rem; }

.vv-stack{
  max-width: var(--container); margin: 0 auto;
  display: flex; flex-direction: column; gap: clamp(1.75rem, 1.3rem + 1.5vw, 2.75rem);
}

/* ---------- One video "row" ---------- */
.vv-card{
  background: var(--night-card);
  border: 1px solid var(--night-line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-2);
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
}
@media (max-width: 980px){
  .vv-card{ grid-template-columns: 1fr; }
}

/* ---------- Player ---------- */
.vv-player{
  position: relative;
  background: #000;
  aspect-ratio: 16 / 9;
  user-select: none;
  -webkit-user-select: none;
}
.vv-player video{
  position: absolute; inset: 0; width: 100%; height: 100%;
  background: #000; display: block;
  pointer-events: none; /* all interaction goes through our controls / tap-zone */
}

/* Poster shown before first play (no native thumbnail) */
.vv-poster{
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; text-align: center; padding: 1.5rem;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(34,184,216,.28), transparent 55%),
    radial-gradient(ellipse at 80% 85%, rgba(246,178,60,.22), transparent 55%),
    linear-gradient(160deg, var(--abyss), var(--night-page));
  cursor: pointer;
  z-index: 3;
  transition: opacity .35s ease;
}
.vv-poster.is-hidden{ opacity: 0; pointer-events: none; }
.vv-poster .vv-badge{
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .8rem; border-radius: var(--radius-pill);
  background: var(--sand); color: var(--abyss); font-weight: 700; font-size: .76rem;
}
.vv-poster-title{
  font-family: var(--font-display); color: #fff;
  font-size: clamp(1.05rem, .9rem + .8vw, 1.5rem); max-width: 90%;
}
.vv-poster-meta{ color: var(--night-soft); font-size: .85rem; }
.vv-play-btn{
  width: 74px; height: 74px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.5);
  color: #fff; font-size: 1.5rem;
  transition: transform .25s ease, background .25s ease, border-color .25s ease;
}
.vv-poster:hover .vv-play-btn{
  transform: scale(1.08); background: var(--sand); border-color: var(--sand); color: var(--abyss);
}
.vv-play-btn i{ transform: translateX(3px); }

/* Tap zone over the video, for click-to-toggle + double-click fullscreen */
.vv-tapzone{ position: absolute; inset: 0; z-index: 1; cursor: pointer; }

/* Center play/pause flash icon */
.vv-flash{
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.vv-flash i{
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(6,37,63,.55); color: #fff; font-size: 1.6rem;
  opacity: 0; transform: scale(.7);
}
.vv-flash.is-active i{ animation: vvFlash .55s ease forwards; }
@keyframes vvFlash{
  0%{ opacity: 0; transform: scale(.6); }
  35%{ opacity: 1; transform: scale(1); }
  100%{ opacity: 0; transform: scale(1.15); }
}

/* Buffering spinner */
.vv-spinner{
  position: absolute; inset: 0; z-index: 2;
  display: none; align-items: center; justify-content: center;
}
.vv-player.is-waiting .vv-spinner{ display: flex; }
.vv-spinner i{
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.25); border-top-color: var(--sand);
  animation: vvSpin .8s linear infinite;
}
@keyframes vvSpin{ to{ transform: rotate(360deg); } }

/* ---------- Controls bar ---------- */
.vv-controls{
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  padding: .5rem .75rem .65rem;
  background: linear-gradient(to top, rgba(6,37,63,.92) 0%, rgba(6,37,63,.55) 60%, transparent 100%);
  opacity: 0; transform: translateY(6px);
  transition: opacity .25s ease, transform .25s ease;
}
.vv-player.is-active .vv-controls,
.vv-player:focus-within .vv-controls,
.vv-player.is-paused .vv-controls{ opacity: 1; transform: translateY(0); }

/* Seek bar */
.vv-seek{
  position: relative; height: 14px; display: flex; align-items: center;
  cursor: pointer; margin-bottom: .4rem;
}
.vv-seek-track{
  position: relative; width: 100%; height: 4px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,.22); overflow: visible;
}
.vv-seek-buffered, .vv-seek-fill{
  position: absolute; top: 0; right: 0; height: 100%; border-radius: var(--radius-pill);
}
.vv-seek-buffered{ background: rgba(255,255,255,.3); }
.vv-seek-fill{ background: var(--sand); }
.vv-seek-thumb{
  position: absolute; top: 50%; width: 13px; height: 13px; border-radius: 50%;
  background: var(--sand); box-shadow: 0 0 0 4px rgba(246,178,60,.25);
  transform: translate(50%, -50%); right: 0;
}
.vv-seek:hover .vv-seek-track{ height: 6px; }

/* Chapter tick marks on the seek track */
.vv-chapter-tick{
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: rgba(6,37,63,.65);
}

/* Hover preview time bubble */
.vv-seek-tip{
  position: absolute; bottom: 16px; transform: translateX(50%);
  background: var(--abyss); color: #fff; font-size: .72rem; font-weight: 700;
  padding: .25rem .5rem; border-radius: var(--radius-sm);
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s ease;
}
.vv-seek:hover .vv-seek-tip{ opacity: 1; }

/* Buttons row */
.vv-row{ display: flex; align-items: center; gap: .35rem; }
.vv-row .vv-spacer{ flex: 1; }
.vv-btn{
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: grid; place-items: center; background: transparent; border: 0;
  color: #fff; font-size: .92rem; cursor: pointer; transition: background .2s ease, color .2s ease;
}
.vv-btn:hover{ background: rgba(255,255,255,.14); }
.vv-btn.is-on{ color: var(--sand); }

.vv-time{
  color: #fff; font-size: .78rem; font-variant-numeric: tabular-nums;
  padding: 0 .3rem; white-space: nowrap; direction: ltr; display: inline-block;
}

/* Volume */
.vv-volume{ display: flex; align-items: center; gap: .3rem; }
.vv-volume input[type="range"]{
  width: 72px; accent-color: var(--sand); cursor: pointer;
}
@media (max-width: 560px){ .vv-volume input[type="range"]{ display: none; } }

/* Speed + chapters menus */
.vv-menu-wrap{ position: relative; }
.vv-menu{
  position: absolute; bottom: 42px; left: 50%; transform: translateX(-50%);
  background: var(--night-card); border: 1px solid var(--night-line);
  border-radius: var(--radius-md); box-shadow: var(--shadow-2);
  min-width: 140px; padding: .4rem; display: none; z-index: 6;
}
.vv-menu.is-open{ display: block; }
.vv-menu button{
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  width: 100%; padding: .45rem .6rem; border-radius: var(--radius-sm);
  background: transparent; border: 0; color: var(--night-ink); font-size: .85rem;
  text-align: right; cursor: pointer; font-family: var(--font-body);
}
.vv-menu button:hover{ background: rgba(255,255,255,.08); }
.vv-menu button.is-active{ color: var(--sand); font-weight: 700; }

/* ---------- Meta / chapters panel (right column) ---------- */
.vv-meta{
  padding: clamp(1.1rem, 1rem + .5vw, 1.6rem);
  display: flex; flex-direction: column; min-height: 0;
}
.vv-meta-badge{
  display: inline-flex; align-self: flex-start; align-items: center; gap: .4rem;
  padding: .28rem .7rem; border-radius: var(--radius-pill);
  background: var(--sand); color: var(--abyss); font-size: .72rem; font-weight: 700;
  margin-bottom: .7rem;
}
.vv-meta h3{
  font-family: var(--font-display); color: #fff; font-size: 1.1rem;
  line-height: 1.5; margin-bottom: .5rem;
}
.vv-meta-stats{
  display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: .8rem;
}
.vv-meta-stats span{
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .78rem; color: var(--night-soft);
}
.vv-meta-stats i{ color: var(--lagoon); }
.vv-meta-desc{ font-size: .88rem; color: var(--night-soft); line-height: 1.8; margin-bottom: 1rem; }

.vv-tabs{ display: flex; gap: .4rem; margin-bottom: .7rem; }
.vv-tab{
  padding: .4rem .85rem; border-radius: var(--radius-pill); font-size: .8rem; font-weight: 700;
  background: rgba(255,255,255,.06); color: var(--night-soft); border: 1px solid var(--night-line);
  cursor: pointer;
}
.vv-tab.is-active{ background: var(--sand); color: var(--abyss); border-color: var(--sand); }

.vv-chapters{
  list-style: none; margin: 0; padding: 0;
  max-height: 320px; overflow-y: auto;
  display: flex; flex-direction: column; gap: .25rem;
  scrollbar-width: thin; scrollbar-color: var(--night-line) transparent;
}
.vv-chapters::-webkit-scrollbar{ width: 6px; }
.vv-chapters::-webkit-scrollbar-thumb{ background: var(--night-line); border-radius: var(--radius-pill); }

.vv-chapter{
  display: flex; align-items: center; gap: .6rem;
  width: 100%; padding: .5rem .55rem; border-radius: var(--radius-sm);
  background: transparent; border: 0; color: var(--night-soft);
  font-family: var(--font-body); font-size: .84rem; text-align: right; cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.vv-chapter:hover{ background: rgba(255,255,255,.06); color: #fff; }
.vv-chapter.is-current{ background: rgba(246,178,60,.14); color: var(--sand); }
.vv-chapter .vv-chapter-num{
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: .7rem; font-weight: 700;
  background: rgba(255,255,255,.08); color: inherit;
}
.vv-chapter.is-current .vv-chapter-num{ background: var(--sand); color: var(--abyss); }
.vv-chapter .vv-chapter-time{
  flex-shrink: 0; font-variant-numeric: tabular-nums; font-size: .74rem;
  color: var(--night-soft); direction: ltr;
}
.vv-chapter .vv-chapter-label{ flex: 1; line-height: 1.5; }

.vv-soon{
  display: flex; align-items: center; gap: .6rem;
  padding: .8rem .9rem; border-radius: var(--radius);
  background: rgba(255,255,255,.05); border: 1px dashed var(--night-line);
  color: var(--night-soft); font-size: .82rem; margin-bottom: .9rem;
}

.vv-papers{ list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.vv-paper{
  padding: .6rem .7rem; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.04); border: 1px solid var(--night-line);
}
.vv-paper .vv-paper-top{ display: flex; align-items: baseline; gap: .5rem; margin-bottom: .2rem; }
.vv-paper .vv-paper-year{
  flex-shrink: 0; font-size: .7rem; font-weight: 700; color: var(--abyss);
  background: var(--lagoon); padding: .08rem .45rem; border-radius: var(--radius-pill);
}
.vv-paper .vv-paper-title{ font-size: .86rem; color: #fff; font-weight: 600; line-height: 1.5; }
.vv-paper .vv-paper-desc{ font-size: .78rem; color: var(--night-soft); line-height: 1.6; }

/* Protection: no drag, no selection, no native save affordances */
.vv-player video,
.vv-player img{
  -webkit-user-drag: none;
  user-drag: none;
}

@media (max-width: 640px){
  .vv-card{ border-radius: var(--radius); }
  .vv-chapters{ max-height: 240px; }
}
