/* ==========================================================
   GRIDSTREAM — cyberpunk / neon-noir streaming UI
   Palette:
     --void:   #08070c   (base background)
     --panel:  #120f1c   (card/panel surface)
     --cyan:   #00f0ff   (primary neon - links, focus, play)
     --magenta:#ff2178   (secondary neon - accents, badges)
     --violet: #7b2ff7   (tertiary - gradients)
     --acid:   #d4ff00   (match % / warning accent, used sparingly)
     --ink-hi: #eef1fb   (bright text)
     --ink-lo: #8b93ab   (muted text)
   Type:
     Orbitron      -> display / logo / hero title
     Chakra Petch   -> body, nav, buttons
     Share Tech Mono-> tags, meta, terminal-style labels
   ========================================================== */

:root {
  --void: #08070c;
  --void-2: #0d0b14;
  --panel: #120f1c;
  --panel-2: #191527;
  --cyan: #00f0ff;
  --magenta: #ff2178;
  --violet: #7b2ff7;
  --acid: #d4ff00;
  --ink-hi: #eef1fb;
  --ink-lo: #8b93ab;
  --border: rgba(0, 240, 255, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--void);
  color: var(--ink-hi);
  font-family: 'Chakra Petch', sans-serif;
  overflow-x: hidden;
  position: relative;
}

a { text-decoration: none; color: inherit; }

::selection { background: var(--magenta); color: var(--void); }

/* scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--void); }
::-webkit-scrollbar-thumb { background: linear-gradient(var(--cyan), var(--magenta)); border-radius: 4px; }

/* ---------- ambient texture layers ---------- */
.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 500;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.02) 0px,
    rgba(255,255,255,0.02) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

.noise {
  position: fixed; inset: 0; pointer-events: none; z-index: 499;
  background: radial-gradient(ellipse at 20% 0%, rgba(123,47,247,0.08), transparent 50%),
              radial-gradient(ellipse at 80% 100%, rgba(255,33,120,0.08), transparent 50%);
}

/* ---------- NAV ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 48px;
  background: linear-gradient(to bottom, rgba(8,7,12,0.95), transparent);
  backdrop-filter: blur(2px);
}

.nav-left { display: flex; align-items: center; gap: 48px; }

.logo {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 1.4rem;
  letter-spacing: 0.06em;
  color: var(--ink-hi);
  text-shadow: 0 0 12px rgba(0,240,255,0.5);
}
.logo span { color: var(--magenta); text-shadow: 0 0 12px rgba(255,33,120,0.6); }

.nav-links { display: flex; gap: 28px; }
.nav-links a {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--ink-lo);
  position: relative;
  padding-bottom: 4px;
  transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--cyan); }
.nav-links a.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px;
  background: var(--cyan); box-shadow: 0 0 8px var(--cyan);
}

.nav-status {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.75rem;
  color: var(--acid);
  display: flex; align-items: center; gap: 8px;
  letter-spacing: 0.08em;
}
.dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--acid);
  box-shadow: 0 0 8px var(--acid);
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ---------- HERO ---------- */
.hero {
  position: relative;
  height: 92vh;
  min-height: 560px;
  display: flex; align-items: flex-end;
  overflow: hidden;
}

.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center 25%;
  filter: saturate(1.15) contrast(1.05);
  transition: background-image 0.6s ease;
}

.hero-gradient {
  position: absolute; inset: 0;
  background:
    linear-gradient(to top, var(--void) 5%, rgba(8,7,12,0.2) 45%, rgba(8,7,12,0.55) 100%),
    linear-gradient(to right, rgba(8,7,12,0.85) 0%, rgba(8,7,12,0.1) 55%);
}

.hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(0,240,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,240,255,0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to top, black, transparent 70%);
  opacity: 0.5;
}

.hero-content {
  position: relative; z-index: 2;
  padding: 0 48px 64px;
  max-width: 720px;
}

.hero-tags {
  display: flex; gap: 10px; margin-bottom: 18px;
}
.hero-tags span {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--cyan);
  border: 1px solid var(--border);
  padding: 4px 10px;
  background: rgba(0,240,255,0.06);
}

.hero-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(2.6rem, 6vw, 5rem);
  letter-spacing: 0.03em;
  line-height: 1;
  color: var(--ink-hi);
  position: relative;
  margin-bottom: 18px;
  text-shadow: 0 0 24px rgba(0,240,255,0.25);
}
/* glitch layers */
.hero-title::before, .hero-title::after {
  content: attr(data-text);
  position: absolute; left: 0; top: 0; width: 100%;
  overflow: hidden;
  background: transparent;
}
.hero-title::before {
  color: var(--magenta);
  clip-path: inset(0 0 0 0);
  animation: glitch-1 4.5s infinite linear;
  opacity: 0.7;
}
.hero-title::after {
  color: var(--cyan);
  clip-path: inset(0 0 0 0);
  animation: glitch-2 6s infinite linear;
  opacity: 0.6;
}
@keyframes glitch-1 {
  0%, 92%, 100% { transform: translate(0,0); clip-path: inset(0 0 0 0); opacity: 0; }
  93% { transform: translate(-3px,1px); clip-path: inset(10% 0 60% 0); opacity: 0.7; }
  94% { transform: translate(3px,-1px); clip-path: inset(50% 0 10% 0); opacity: 0.7; }
  95% { transform: translate(-2px,0); clip-path: inset(20% 0 40% 0); opacity: 0.7; }
  96% { opacity: 0; }
}
@keyframes glitch-2 {
  0%, 90%, 100% { transform: translate(0,0); clip-path: inset(0 0 0 0); opacity: 0; }
  91% { transform: translate(3px,-1px); clip-path: inset(60% 0 5% 0); opacity: 0.6; }
  92% { transform: translate(-3px,1px); clip-path: inset(15% 0 55% 0); opacity: 0.6; }
  93% { transform: translate(2px,0); clip-path: inset(35% 0 30% 0); opacity: 0.6; }
  94% { opacity: 0; }
}

.hero-tagline {
  font-size: 1.05rem;
  color: var(--magenta);
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.hero-desc {
  font-size: 0.98rem;
  color: var(--ink-lo);
  line-height: 1.6;
  margin-bottom: 18px;
  max-width: 560px;
}

.hero-meta {
  display: flex; gap: 14px; align-items: center;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.82rem;
  color: var(--ink-lo);
  margin-bottom: 28px;
}
.hero-meta .match { color: var(--acid); font-weight: 700; }
.hero-meta span:not(:last-child)::after { content: '/'; margin-left: 14px; color: rgba(255,255,255,0.2); }

.hero-buttons { display: flex; gap: 14px; }

.btn {
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 0.9rem;
  padding: 13px 30px;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: all 0.2s ease;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.btn-play {
  background: var(--cyan);
  color: var(--void);
}
.btn-play:hover { background: #6ffaff; box-shadow: 0 0 24px rgba(0,240,255,0.6); }

.btn-info {
  background: rgba(255,255,255,0.08);
  color: var(--ink-hi);
  border: 1px solid rgba(255,255,255,0.25);
}
.btn-info:hover { background: rgba(255,255,255,0.16); border-color: var(--magenta); }

/* ---------- ROWS ---------- */
.rows-container {
  position: relative; z-index: 2;
  margin-top: -80px;
  padding: 0 0 60px;
}

.row {
  margin-bottom: 46px;
}

.row-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  color: var(--cyan);
  padding: 0 48px;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px;
}
.row-label::before { content: '['; color: var(--magenta); }
.row-label::after { content: ']'; color: var(--magenta); }

.row-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 6px 48px 20px;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.row-track::-webkit-scrollbar { display: none; }

.card {
  position: relative;
  flex: 0 0 auto;
  width: 230px;
  aspect-ratio: 2 / 3;
  background: var(--panel);
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  overflow: hidden;
}

.card img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
  filter: saturate(1.05);
  transition: transform 0.4s ease, filter 0.3s ease;
}

.card-scan {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 0%, rgba(0,240,255,0.35) 50%, transparent 100%);
  transform: translateY(-100%);
  opacity: 0;
  transition: none;
  pointer-events: none;
}

.card-overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 14px 12px 12px;
  background: linear-gradient(to top, rgba(8,7,12,0.96) 20%, transparent 100%);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.card-overlay h4 {
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 6px;
  color: var(--ink-hi);
}

.card-overlay .card-tags {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.65rem;
  color: var(--ink-lo);
  display: flex; gap: 8px; flex-wrap: wrap;
}
.card-overlay .card-tags span { color: var(--acid); }

.card-play {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%) scale(0.6);
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(0,240,255,0.15);
  border: 1px solid var(--cyan);
  display: flex; align-items: center; justify-content: center;
  color: var(--cyan);
  opacity: 0;
  transition: all 0.25s ease;
  backdrop-filter: blur(4px);
}

.card:hover {
  transform: scale(1.08);
  border-color: var(--cyan);
  box-shadow: 0 0 30px rgba(0,240,255,0.35), 0 0 60px rgba(255,33,120,0.15);
  z-index: 10;
}
.card:hover img { transform: scale(1.05); }
.card:hover .card-overlay { opacity: 1; transform: translateY(0); }
.card:hover .card-play { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.card:hover .card-scan {
  opacity: 1;
  animation: scan-sweep 0.9s ease-out;
}
@keyframes scan-sweep {
  0% { transform: translateY(-100%); opacity: 0.9; }
  100% { transform: translateY(100%); opacity: 0; }
}

/* ---------- FOOTER ---------- */
.footer {
  padding: 40px 48px 60px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.75rem;
  color: var(--ink-lo);
  border-top: 1px solid rgba(255,255,255,0.06);
  text-align: center;
}

/* ---------- PLAYER MODAL ---------- */
.player-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: none;
  align-items: center; justify-content: center;
}
.player-modal.open { display: flex; }

.player-backdrop {
  position: absolute; inset: 0;
  background: rgba(4,3,8,0.92);
  backdrop-filter: blur(6px);
}

.player-box {
  position: relative;
  width: min(92vw, 980px);
  max-height: 92vh;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 0 60px rgba(0,240,255,0.25);
  z-index: 2;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- video stage: sizes itself to the video's own aspect ratio ---------- */
.video-stage {
  position: relative;
  width: 100%;
  max-height: 68vh;
  margin: 0 auto;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  aspect-ratio: 16 / 9; /* default until real metadata loads */
}
/* vertical/portrait video: cap width instead of letting it go edge-to-edge */
.video-stage.portrait {
  max-width: 420px;
  max-height: 78vh;
}

#player-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

/* ---------- custom controls overlay ---------- */
.vc-overlay {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 1;
  transition: opacity 0.25s ease;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 30%);
}
.vc-overlay.idle { opacity: 0; cursor: none; }
.vc-overlay.force-show { opacity: 1; cursor: default; }

.vc-close {
  align-self: flex-end;
  margin: 12px 14px 0 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(8,7,12,0.6);
  color: var(--ink-hi);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 5;
  transition: all 0.2s ease;
}
.vc-close:hover { color: var(--magenta); border-color: var(--magenta); box-shadow: 0 0 12px rgba(255,33,120,0.5); }

.vc-big-play {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(0,240,255,0.15);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
}
.vc-big-play:hover { background: rgba(0,240,255,0.3); box-shadow: 0 0 24px rgba(0,240,255,0.5); }
.vc-big-play.hidden { display: none; }

.vc-bottom {
  padding: 8px 14px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.75), transparent);
}

.vc-progress {
  position: relative;
  height: 5px;
  background: rgba(255,255,255,0.15);
  cursor: pointer;
  margin-bottom: 10px;
  border-radius: 2px;
}
.vc-progress-buffered {
  position: absolute; top: 0; left: 0; height: 100%;
  background: rgba(255,255,255,0.25);
  width: 0%;
  border-radius: 2px;
}
.vc-progress-played {
  position: absolute; top: 0; left: 0; height: 100%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  width: 0%;
  border-radius: 2px;
}
.vc-progress-handle {
  position: absolute; top: 50%; left: 0%;
  width: 12px; height: 12px;
  background: var(--cyan);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px var(--cyan);
}

.vc-row {
  display: flex; align-items: center; gap: 12px;
}

.vc-btn {
  background: none; border: none;
  color: var(--ink-hi);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 4px;
  transition: color 0.2s ease;
}
.vc-btn:hover { color: var(--cyan); }

.vc-volume {
  width: 70px;
  accent-color: var(--cyan);
  cursor: pointer;
}

.vc-time {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.78rem;
  color: var(--ink-lo);
  white-space: nowrap;
}

.vc-spacer { flex: 1; }

.vc-quality {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--ink-hi);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.72rem;
  padding: 5px 8px;
  cursor: pointer;
}
.vc-quality:focus { outline: none; border-color: var(--cyan); }
.vc-quality.hidden { display: none; }

/* fullscreen: the whole player-box (video-stage + close button) goes fullscreen,
   so the close button always stays reachable — this fixes the native-fullscreen bug */
.player-box:fullscreen,
.player-box:-webkit-full-screen {
  width: 100vw; height: 100vh; max-height: 100vh;
  background: #000;
}
.player-box:fullscreen .video-stage,
.player-box:-webkit-full-screen .video-stage {
  max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh;
  aspect-ratio: unset;
}
.player-box:fullscreen .player-info,
.player-box:-webkit-full-screen .player-info {
  display: none;
}

.player-info { padding: 20px 26px 28px; overflow-y: auto; }
.player-info h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.3rem;
  margin-bottom: 8px;
}
.player-meta {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.8rem;
  color: var(--acid);
  margin-bottom: 12px;
  display: flex; gap: 14px;
}
.player-info p { color: var(--ink-lo); line-height: 1.6; font-size: 0.92rem; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 800px) {
  .nav { padding: 14px 20px; }
  .nav-links { display: none; }
  .hero-content, .row-label, .row-track { padding-left: 20px; padding-right: 20px; }
  .card { width: 150px; }
  .hero-title { font-size: 2.4rem; }
  .btn { padding: 11px 20px; font-size: 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
