/**
 * Atlas Vertical – Video Feed page
 * Immersive full-screen vertical scroll with CSS scroll-snap.
 */

/* -----------------------------------------------------------
   Feed page body overrides
   ----------------------------------------------------------- */

.page-videos .site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);
  border-bottom: none;
}

.page-videos .site-header__logo,
.page-videos .site-nav a,
.page-videos .theme-toggle {
  color: #fff;
}

.page-videos .site-footer,
.page-videos .reading-progress-bar {
  display: none;
}

.page-videos .site-main {
  padding: 0;
}

/* -----------------------------------------------------------
   Feed container
   ----------------------------------------------------------- */

.video-feed {
  height: 100vh;
  height: 100dvh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  background: #000;
  scrollbar-width: none;
}

.video-feed::-webkit-scrollbar {
  display: none;
}

/* -----------------------------------------------------------
   Individual panel — full viewport height
   ----------------------------------------------------------- */

.video-panel {
  position: relative;
  min-height: 100vh;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

@supports (-webkit-touch-callout: none) {
  .video-panel {
    min-height: -webkit-fill-available;
  }
}

/* -----------------------------------------------------------
   Viewport — the constrained visual area (phone column on desktop)
   ----------------------------------------------------------- */

.video-panel__viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* -----------------------------------------------------------
   Media layer
   ----------------------------------------------------------- */

.video-panel__media {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-panel__poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-panel__poster--hidden {
  display: none;
}

.video-panel__placeholder {
  width: 100%;
  height: 100%;
  background: #111;
}

.video-panel__placeholder--hidden {
  display: none;
}

.video-panel__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.video-panel__video--iframe {
  object-fit: initial;
}

.video-panel__embed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.video-panel__embed blockquote {
  max-width: 100% !important;
  min-width: 0 !important;
}

.video-panel__embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* Hidden content container (JS mines this for media) */
.video-panel__body {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* -----------------------------------------------------------
   Gradient overlay
   ----------------------------------------------------------- */

.video-panel__gradient {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.3) 50%, transparent 100%);
  pointer-events: none;
  z-index: 1;
}

/* -----------------------------------------------------------
   Duration badge (top-right, populated by JS for native video)
   ----------------------------------------------------------- */

.video-panel__duration {
  display: none;
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  padding: 4px 10px;
  font-size: var(--font-size-xs);
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border-radius: 6px;
  z-index: 2;
}

.video-panel__duration.is-visible {
  display: block;
}

/* -----------------------------------------------------------
   Metadata overlay
   ----------------------------------------------------------- */

.video-panel__meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-xl) var(--space-lg);
  padding-bottom: max(var(--space-xl), env(safe-area-inset-bottom, 20px));
  color: #fff;
  z-index: 2;
}

.video-panel__title {
  margin: 0 0 var(--space-sm);
  font-size: var(--font-size-2xl);
  font-weight: 700;
  line-height: var(--line-height-tight);
  letter-spacing: -0.02em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  overflow-wrap: break-word;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-panel__title a {
  color: inherit;
  text-decoration: none;
}

.video-panel__title a:hover {
  text-decoration: underline;
}

.video-panel__title a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  border-radius: 2px;
}

.video-panel__author {
  margin: 0 0 var(--space-md);
  font-size: var(--font-size-sm);
  opacity: 0.85;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.video-panel__author:empty {
  display: none;
}

.video-panel__read {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 10px;
  text-decoration: none;
  transition: background-color 0.25s, border-color 0.25s, transform 0.2s;
  margin-top: var(--space-sm);
}

.video-panel__read:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: #fff;
  transform: translateY(-1px);
}

.video-panel__read:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* -----------------------------------------------------------
   Mute toggle — inside viewport, bottom-right above meta
   ----------------------------------------------------------- */

.video-panel__mute {
  position: absolute;
  bottom: calc(var(--space-xl) + 120px);
  right: var(--space-lg);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.video-panel__mute:hover {
  background: rgba(0, 0, 0, 0.65);
  transform: scale(1.05);
}

.video-panel__mute:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.video-panel__mute svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* -----------------------------------------------------------
   Scroll hint on first panel
   ----------------------------------------------------------- */

.video-panel__scroll-hint {
  position: absolute;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  color: rgba(255, 255, 255, 0.7);
  z-index: 2;
  animation: videoScrollPulse 2.5s ease-in-out infinite;
}

.video-panel__scroll-hint-arrow {
  font-size: var(--font-size-xl);
  line-height: 1;
}

.video-panel__scroll-hint-text {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

@keyframes videoScrollPulse {
  0%, 100% { opacity: 0.8; transform: translateX(-50%) translateY(0); }
  50% { opacity: 0.4; transform: translateX(-50%) translateY(4px); }
}

.video-panel__scroll-hint.is-hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

@media (prefers-reduced-motion: reduce) {
  .video-panel__scroll-hint {
    animation: none;
  }
}

/* -----------------------------------------------------------
   Empty state
   ----------------------------------------------------------- */

.video-feed__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  padding: var(--space-xl);
}

/* -----------------------------------------------------------
   Desktop: constrain viewport to phone-like column
   ----------------------------------------------------------- */

@media (min-width: 768px) {
  .video-panel__viewport {
    width: 420px;
    max-width: 420px;
    border-radius: 16px;
    margin: 0 auto;
  }

  .video-panel__gradient {
    border-radius: 0 0 16px 16px;
  }
}

/* -----------------------------------------------------------
   Mobile: drop expensive compositing
   ----------------------------------------------------------- */

@media (max-width: 767px) {
  .video-panel__read,
  .video-panel__mute {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(0, 0, 0, 0.5);
  }
}

/* -----------------------------------------------------------
   Reduced motion
   ----------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .video-feed {
    scroll-snap-type: none;
  }
}
