/* Nexa guide rail — the four how-to videos, laid out horizontally across the top of the
   player and visible by default.

   It replaced a vertical drawer that hid behind a narrow "LIST" tab: users reported they
   never noticed the other guides existed. Discoverability is the whole point here, so the
   rail is up by default and only leaves while a video is actually playing.

   It sits at the TOP of the player on purpose. At the bottom it overlapped the native video
   control bar, so bringing it back mid-watch covered play/seek/volume. Top also keeps it
   clear of the centred play button. The quality picker is top-LEFT but only renders while a
   video plays, i.e. exactly when the rail is gone - so the two never share the corner.

   Single owner: the old .video-drawer / .video-list / .video-card rules were DELETED from
   nexa.css and nexa-video-note.css rather than overridden, so no earlier layer can repaint
   the old box back on top of this one. */

.video-rail {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 10px;
  /* Below the founder note (z-index 5) on purpose: the note is a gate the viewer must be
     able to read and answer, and the rail must never paint over it even if the
     hide-on-open logic in nexa-video-rail.js ever fails to fire. */
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(8, 12, 18, .74);
  border: 1px solid rgba(255, 255, 255, .1);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  backdrop-filter: blur(18px) saturate(1.15);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .3);
  opacity: 1;
  /* Only opacity + transform animate: both are compositor-only, so showing or hiding the
     rail never triggers layout or paint on the video underneath. */
  transform: translateY(0);
  transition: opacity .24s ease, transform .24s cubic-bezier(.2, .9, .25, 1), visibility .24s;
}

/* Only the playing state (or the note gate) hides the rail - never the idle/poster state.
   visibility:hidden also takes the backdrop-filter out of the compositor while a video
   plays, so the blur costs nothing during playback. */
.video-player.rail-hidden .video-rail {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-14px);
  pointer-events: none;
}

/* Peek chip: the ONLY way back to the guides mid-playback. The rail deliberately does not
   reappear on mouse move - that is what used to cover the video controls. */
.video-rail-peek {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  cursor: pointer;
  color: rgba(255, 255, 255, .86);
  background: rgba(8, 12, 18, .62);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .24);
  font: 600 10px/1 var(--grotesk, system-ui);
  letter-spacing: .12em;
  text-transform: uppercase;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.video-rail-peek svg { width: 13px; height: 13px; opacity: .9; }
.video-rail-peek:hover {
  background: rgba(12, 18, 28, .8);
  border-color: rgba(255, 255, 255, .24);
  color: #fff;
}
.video-rail-peek[hidden], .video-rail-peek.is-hidden { display: none; }

.video-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.video-rail-title {
  font: 600 10px/1 var(--grotesk, system-ui);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .6);
}
.video-rail-toggle {
  padding: 3px 9px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  color: rgba(255, 255, 255, .72);
  font: 600 10px/1.6 var(--grotesk, system-ui);
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.video-rail-toggle:hover {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .22);
  color: #fff;
}

/* Four across, equal width, each small enough to leave the video readable behind them. */
.video-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.video-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 6px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(255, 255, 255, .92);
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
/* Fixed short thumbs, not a 16/9 box: at four-across a true 16/9 thumb makes the rail
   ~38% of the player height, which buries the video it is sitting on. */
.video-card-thumb {
  width: 100%;
  height: 48px;
  border-radius: 7px;
  object-fit: cover;
  background: #0a121c;
  border: 1px solid rgba(255, 255, 255, .08);
  display: block;
}
.video-card-meta {
  display: block;
  min-width: 0;
  font-family: var(--grotesk, system-ui);
  font-style: normal;
}
.video-card-meta > span {
  display: block;
  color: #7dd3fc;
  font: italic 11px var(--serif, Georgia, serif);
  opacity: .9;
}
.video-card-meta strong {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, .94);
  font: 600 11.5px/1.3 var(--grotesk, system-ui);
  letter-spacing: -0.01em;
}
.video-card-meta small {
  display: block;
  margin-top: 1px;
  color: rgba(255, 255, 255, .48);
  font: 500 10px/1.2 var(--grotesk, system-ui);
}
.video-card:hover:not(:disabled) {
  background: rgba(255, 255, 255, .07);
  border-color: rgba(255, 255, 255, .1);
  transform: translateY(-1px);
}
.video-card.active {
  background: rgba(125, 211, 252, .14);
  border-color: rgba(125, 211, 252, .26);
}
.video-card.active .video-card-thumb {
  border-color: rgba(125, 211, 252, .38);
  box-shadow: 0 0 0 1px rgba(125, 211, 252, .18);
}
.video-card:disabled { opacity: .48; cursor: default; }

/* Tablet: the four titles stop fitting side by side, so drop the sub-labels first. */
@media (max-width: 900px) {
  .video-rail { left: 8px; right: 8px; top: 8px; padding: 8px; }
  .video-list { gap: 6px; }
  .video-card-thumb { height: 40px; }
  .video-card-meta small { display: none; }
  .video-card-meta strong { font-size: 10.5px; }
}

/* Phones: the player box is short, so the rail becomes one swipeable row of compact
   cards instead of a grid that would swallow the whole video. */
@media (max-width: 640px) {
  .video-rail { left: 6px; right: 6px; top: 6px; padding: 7px; gap: 6px; }
  .video-rail-title { font-size: 9px; letter-spacing: .1em; }
  .video-list {
    display: flex;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    /* The 4th card is clipped by design, but with no scrollbar and no fade nothing said
       the row moved - it just looked like a broken card. Both cues are cheap. */
    padding-bottom: 5px;
    scrollbar-width: thin;
    scrollbar-color: var(--blue) var(--hairline);
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 82%, transparent 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 82%, transparent 100%);
  }
  /* At the end of the row there is nothing left to hint at, so drop the fade. */
  .video-list.is-rail-end {
    -webkit-mask-image: none;
    mask-image: none;
  }
  .video-list::-webkit-scrollbar { height: 3px; }
  .video-list::-webkit-scrollbar-track { background: var(--hairline); border-radius: 2px; }
  .video-list::-webkit-scrollbar-thumb { background: var(--blue); border-radius: 2px; }
  .video-card {
    flex: 0 0 116px;
    width: 116px;
    scroll-snap-align: start;
    padding: 4px;
  }
  .video-card-thumb { height: 36px; }
  .video-card-meta > span { display: none; }
  .video-card-meta strong { font-size: 10px; line-height: 1.25; }
  .video-rail-peek { top: 6px; right: 6px; padding: 5px 8px; }
  /* The rail now occupies the top of a very short player box, so the centred play button
     has to sit in what is left underneath it instead of behind it. */
  .video-player .hero-play { inset: 96px 0 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .video-rail, .video-card { transition: none; }
}
