/* ═══════════════════════════════════════════════════════════
   VideoVault — Premium SaaS frontend
   Dark by default · Pinterest masonry · Glassmorphism accents
   ═══════════════════════════════════════════════════════════ */

:root {
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.2);
  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --container: 1280px;

  /* Dark theme (default) */
  --bg: #07080c;
  --bg-elevated: #0e1018;
  --bg-soft: #141824;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f4f5f8;
  --text-muted: #9aa3b5;
  --text-dim: #6b7385;
  --primary: #6366f1;
  --primary-2: #8b5cf6;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --accent: #22d3ee;
  --danger: #f43f5e;
  --success: #34d399;
  --warning: #fbbf24;
  --glass: rgba(16, 18, 28, 0.65);
  --header-bg: rgba(7, 8, 12, 0.72);
}

[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-elevated: #ffffff;
  --bg-soft: #eef0f6;
  --surface: rgba(15, 23, 42, 0.03);
  --surface-2: rgba(15, 23, 42, 0.06);
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --text: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --primary-glow: rgba(79, 70, 229, 0.25);
  --accent: #0891b2;
  --glass: rgba(255, 255, 255, 0.72);
  --header-bg: rgba(246, 247, 251, 0.8);
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(99, 102, 241, 0.22), transparent 60%),
    radial-gradient(700px 400px at 90% 0%, rgba(139, 92, 246, 0.16), transparent 55%),
    radial-gradient(600px 400px at 50% 100%, rgba(34, 211, 238, 0.08), transparent 50%);
}

/* Immersive pure-player mode: no page chrome, no scroll, pure black */
body.is-immersive {
  background: #000;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  touch-action: manipulation;
  overscroll-behavior: none;
}

body.is-immersive::before {
  display: none;
}

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

img,
video {
  max-width: 100%;
  display: block;
}

/* Immersive root fills the viewport including safe areas */
.immersive-root {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

.container {
  width: min(100% - 1.25rem, var(--container));
  margin-inline: auto;
}

@media (min-width: 640px) {
  .container {
    width: min(100% - 2rem, var(--container));
  }
}

/* ── Glass ── */
.glass {
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow-sm);
}

/* ── Visually hidden SEO (DOM present for crawlers) ── */
.seo-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 0.75rem;
  position: relative;
}

@media (min-width: 768px) {
  .header-inner {
    height: 68px;
    gap: 1rem;
  }
}

.nav-burger {
  display: grid;
  gap: 5px;
  width: 42px;
  height: 42px;
  place-content: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  padding: 0;
}

.nav-burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

@media (min-width: 900px) {
  .nav-burger {
    display: none;
  }
}

.nav-links {
  display: none;
  align-items: center;
  gap: 0.25rem;
}

.nav-links.is-open {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  left: 0;
  padding: 0.65rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 60;
}

@media (min-width: 900px) {
  .nav-links {
    display: flex;
    position: static;
    flex-direction: row;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
}

.nav-link.is-active {
  background: var(--surface-2);
  color: var(--text);
}

.theme-toggle {
  border: 0;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  background: transparent;
}

[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark { display: none; }

.footer-links {
  display: flex;
  gap: 1rem;
}

.footer-links a {
  color: var(--text-dim);
  font-size: 0.88rem;
}

.footer-links a:hover {
  color: var(--text);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 8px 24px var(--primary-glow);
}

.brand-mark.large {
  width: 48px;
  height: 48px;
  border-radius: 14px;
}

.brand-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.brand-text {
  font-size: 1.05rem;
}

.nav-link {
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.92rem;
  transition: background var(--transition), color var(--transition);
  text-align: left;
  border: 0;
  background: transparent;
  font-family: inherit;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ── Main ── */
.site-main {
  min-height: calc(100vh - 160px);
  padding-bottom: 3rem;
}

/* ── Hero ── */
.hero {
  padding: 1.75rem 0 1.1rem;
}

@media (min-width: 768px) {
  .hero {
    padding: 2.75rem 0 1.5rem;
  }
}

.hero-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-title {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.75rem);
  letter-spacing: -0.04em;
  line-height: 1.1;
  background: linear-gradient(135deg, #fff 0%, #c7d2fe 50%, #a5b4fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

[data-theme="light"] .hero-title {
  background: linear-gradient(135deg, #0f172a 0%, #4f46e5 70%);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-sub {
  margin: 0.75rem 0 0;
  max-width: 38rem;
  color: var(--text-muted);
  font-size: 1.02rem;
}

.hero-stats {
  display: flex;
  gap: 1.5rem;
  padding: 1rem 1.35rem;
  border-radius: var(--radius);
}

.hero-stats .stat {
  display: flex;
  flex-direction: column;
  min-width: 72px;
}

.stat-value {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Filters / chips ── */
.filters {
  padding: 0.5rem 0 1.25rem;
}

.chip-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.15rem;
  margin-inline: -0.15rem;
  padding-inline: 0.15rem;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

@media (min-width: 768px) {
  .chip-row {
    flex-wrap: wrap;
    overflow: visible;
  }
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface-2);
}

.chip.is-active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px var(--primary-glow);
}

.chip-count {
  font-size: 0.75rem;
  opacity: 0.75;
}

/* ── Pinterest masonry ── */
.gallery {
  padding: 0.5rem 0 2rem;
}

.masonry {
  column-count: 2;
  column-gap: 0.65rem;
}

@media (min-width: 480px) {
  .masonry {
    column-gap: 0.85rem;
  }
}

@media (min-width: 640px) {
  .masonry {
    column-count: 3;
    column-gap: 1rem;
  }
}

@media (min-width: 960px) {
  .masonry {
    column-count: 4;
    column-gap: 1.15rem;
  }
}

@media (min-width: 1200px) {
  .masonry {
    column-count: 5;
  }
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 0.65rem;
  position: relative;
}

@media (min-width: 640px) {
  .masonry-item {
    margin-bottom: 1rem;
  }
}

.video-card {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 640px) {
  .video-card {
    border-radius: var(--radius);
  }
}

.video-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.video-thumb {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #1a1d2b, #0d0f16);
}

/* Aspect ratios for masonry variety */
.ratio-1 .video-thumb { aspect-ratio: 3 / 4; }
.ratio-2 .video-thumb { aspect-ratio: 4 / 5; }
.ratio-3 .video-thumb { aspect-ratio: 1 / 1; }
.ratio-4 .video-thumb { aspect-ratio: 3 / 5; }
.ratio-5 .video-thumb { aspect-ratio: 9 / 16; }

.thumb-img,
.thumb-video,
.thumb-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Native #t=1.0 frame thumbs — non-interactive, looks like a still */
.thumb-video {
  pointer-events: none;
  background: #0d0f16;
  /* Hide any accidental native chrome */
  object-fit: cover;
}

.thumb-video::-webkit-media-controls {
  display: none !important;
}

.thumb-placeholder {
  background:
    radial-gradient(circle at 30% 30%, rgba(99, 102, 241, 0.35), transparent 50%),
    linear-gradient(145deg, #1a1d2b, #0d0f16);
}

.thumb-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent 45%);
  opacity: 0;
  transition: opacity var(--transition);
}

.video-card:hover .thumb-overlay {
  opacity: 1;
}

.play-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(8px);
  color: #fff;
  transform: scale(0.9);
  transition: transform var(--transition);
}

.video-card:hover .play-btn {
  transform: scale(1);
}

.card-cat {
  position: absolute;
  left: 0.7rem;
  bottom: 0.7rem;
  z-index: 2;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  backdrop-filter: blur(8px);
}

/* ── Empty / pagination ── */
.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  border-radius: var(--radius);
}

.empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-size: 1.2rem;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}

.page-btn {
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 500;
  transition: all var(--transition);
}

.page-btn:hover {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
}

.page-info {
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════════════
   Pure immersive player — Reels mobile / cinema desktop
   ═══════════════════════════════════════════════════════════ */

.pure-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* Desktop blurred backdrop layer */
.pure-bg {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #0a0a0f;
}

.pure-video-bg {
  position: absolute;
  inset: -8%;
  width: 116% !important;
  height: 116% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover;
  object-position: center;
  filter: blur(48px) saturate(1.35) brightness(0.55);
  transform: scale(1.12);
  pointer-events: none;
}

.pure-bg-tint {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 20%, rgba(0, 0, 0, 0.35) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.35));
  pointer-events: none;
}

/*
 * Main video layers (double-buffer for SPA transitions)
 * Mobile: object-fit cover (full-screen reels)
 * Desktop: object-fit contain (no crop) over blurred bg
 */
.pure-video {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover;
  object-position: center center;
  background: transparent;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.pure-video.is-active {
  opacity: 1;
  z-index: 2;
  pointer-events: none;
}

.pure-missing {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 500;
  z-index: 1;
}

/* Soft edge gradients so floating UI stays readable */
.pure-veil {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 3;
  pointer-events: none;
}

.pure-veil-top {
  top: 0;
  height: 120px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent);
}

.pure-veil-bottom {
  bottom: 0;
  height: 160px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);
}

/* Full-stage tap target under chrome */
.pure-tap-zone {
  position: absolute;
  inset: 0;
  z-index: 4;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Floating minimal chrome above tap zone */
.pure-ui {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding:
    max(0.75rem, env(safe-area-inset-top))
    max(0.75rem, env(safe-area-inset-right))
    0.5rem
    max(0.75rem, env(safe-area-inset-left));
  pointer-events: none;
}

.pure-ui > *,
.pure-ui-right {
  pointer-events: auto;
}

.pure-ui-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pure-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease, border-color 160ms ease;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  text-decoration: none;
}

.pure-btn:hover,
.pure-btn:focus-visible {
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.32);
  outline: none;
}

.pure-btn:active {
  transform: scale(0.96);
}

/* Continuous Auto-Play toggle */
.pure-autoplay {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 44px;
  padding: 0 0.75rem 0 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.pure-autoplay input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.pure-autoplay-track {
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  position: relative;
  transition: background 160ms ease;
  flex-shrink: 0;
}

.pure-autoplay-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transition: transform 160ms ease;
}

.pure-autoplay input:checked + .pure-autoplay-track {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.pure-autoplay input:checked + .pure-autoplay-track .pure-autoplay-knob {
  transform: translateX(14px);
}

.pure-autoplay-text {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.92;
}

/* Next — prominent glass pill, SPA click */
.pure-next {
  position: absolute;
  z-index: 7;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1.35rem, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.15rem 0.8rem 1.25rem;
  min-height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  transition: background 160ms ease, transform 160ms ease, border-color 160ms ease, opacity 160ms ease;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  font-family: inherit;
}

.pure-next:hover,
.pure-next:focus-visible {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.42);
  outline: none;
}

.pure-next:active {
  transform: scale(0.97);
}

.pure-next.is-loading {
  opacity: 0.65;
  pointer-events: none;
}

.pure-next[hidden] {
  display: none !important;
}

.pure-next-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.2);
}

.pure-seo {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Desktop: contain + blurred cover backdrop (no crop) */
@media (min-width: 768px) {
  .pure-bg {
    display: block;
  }

  .pure-video {
    object-fit: contain;
    background: transparent;
  }

  .pure-next {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    bottom: max(1.85rem, env(safe-area-inset-bottom));
    padding: 0.85rem 1.4rem 0.85rem 1.5rem;
  }

  .pure-next:hover {
    transform: translateX(-50%) scale(1.03);
  }

  .pure-next:active {
    transform: translateX(-50%) scale(0.98);
  }

  .pure-veil-top {
    height: 140px;
  }

  .pure-veil-bottom {
    height: 180px;
  }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .pure-video {
    transition: none;
  }
}

.section-title {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ── Nav user / Google ── */
.nav-user {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.5rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.nav-user-name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-link-google {
  background: var(--surface-2);
  border: 1px solid var(--border);
}

/* ── Card likes ── */
.video-card-wrap {
  position: relative;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.15rem 0.1rem;
}

.card-actions-right {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

.share-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.heart-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.35rem 0.4rem;
  border-radius: 999px;
  transition: color 150ms ease, transform 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

.heart-btn:hover {
  color: #f43f5e;
}

.heart-btn.is-liked {
  color: #f43f5e;
}

.heart-btn.is-liked .heart-icon {
  transform: scale(1.08);
}

.heart-btn:active {
  transform: scale(0.96);
}

.card-views {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* Creator credit — small, left corner, transparent (mobile-first) */
.pure-credit {
  position: absolute;
  z-index: 7;
  /* True bottom-left of the video stage */
  left: max(0.5rem, env(safe-area-inset-left));
  bottom: max(0.55rem, env(safe-area-inset-bottom));
  right: auto;
  top: auto;
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.28rem;
  max-width: min(42vw, 150px);
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  color: #fff;
  pointer-events: auto;
  /* ~30% visual scale vs previous chip */
  transform: scale(0.85);
  transform-origin: left bottom;
  line-height: 1.15;
}

.pure-credit[hidden] {
  display: none !important;
}

.pure-credit-label {
  font-size: 0.48rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.75;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

.pure-credit-name {
  font-weight: 700;
  font-size: 0.62rem;
  color: #fff;
  text-decoration: none;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.pure-credit-name:hover {
  text-decoration: underline;
}

.pure-credit-cta {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.35rem;
  border-radius: 999px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 0.52rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.pure-credit-cta:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Slightly larger only on wide desktop — still compact */
@media (min-width: 768px) {
  .pure-credit {
    left: max(0.75rem, env(safe-area-inset-left));
    bottom: max(0.85rem, env(safe-area-inset-bottom));
    max-width: min(28vw, 180px);
    transform: scale(0.95);
    gap: 0.35rem;
  }

  .pure-credit-label {
    font-size: 0.55rem;
  }

  .pure-credit-name {
    font-size: 0.72rem;
    max-width: 96px;
  }

  .pure-credit-cta {
    font-size: 0.58rem;
    padding: 0.15rem 0.42rem;
  }
}

/* ── Player social rail (Reels style) ── */
.pure-rail {
  position: absolute;
  z-index: 7;
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: max(5.5rem, calc(env(safe-area-inset-bottom) + 5rem));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  pointer-events: none;
}

.pure-rail > * {
  pointer-events: auto;
}

.rail-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  font: inherit;
}

.rail-btn svg {
  width: 32px;
  height: 32px;
}

.rail-btn.is-liked {
  color: #fb7185;
}

.rail-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.rail-views {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  color: rgba(255, 255, 255, 0.9);
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}

/* ── Comments bottom sheet ── */
.comments-sheet {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  visibility: hidden;
}

.comments-sheet.is-open {
  pointer-events: auto;
  visibility: visible;
}

.comments-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 200ms ease;
}

.comments-sheet.is-open .comments-backdrop {
  opacity: 1;
}

.comments-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(72vh, 640px);
  background: #12141c;
  border-radius: 18px 18px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 0;
  display: flex;
  flex-direction: column;
  transform: translateY(105%);
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.4);
  padding-bottom: env(safe-area-inset-bottom);
}

.comments-sheet.is-open .comments-panel {
  transform: translateY(0);
}

.comments-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.comments-handle {
  position: absolute;
  top: 0.4rem;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.2);
}

.comments-head h2 {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.comments-close {
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  margin-top: 0.25rem;
}

.comments-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  -webkit-overflow-scrolling: touch;
}

.comments-empty {
  text-align: center;
  padding: 1.5rem 0.5rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
}

.comment-item {
  display: flex;
  gap: 0.7rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.comment-avatar img,
.avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

.comment-body {
  min-width: 0;
  flex: 1;
}

.comment-body strong {
  display: block;
  color: #fff;
  font-size: 0.86rem;
  margin-bottom: 0.15rem;
}

.comment-body p {
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
}

.comment-body time {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.4);
}

.comments-compose {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.75rem 1rem 1rem;
  background: #0e1016;
}

.compose-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.85rem;
  font-weight: 600;
}

.compose-user img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.compose-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.compose-form textarea {
  flex: 1;
  resize: none;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  padding: 0.65rem 0.75rem;
  font: inherit;
  min-height: 44px;
}

.compose-form textarea:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.55);
}

.compose-login {
  text-align: center;
  padding: 0.35rem 0;
}

.btn-google {
  display: inline-flex;
  width: 100%;
  justify-content: center;
  min-height: 46px;
}

@media (min-width: 768px) {
  .pure-rail {
    right: max(1.25rem, env(safe-area-inset-right));
    bottom: max(6rem, calc(env(safe-area-inset-bottom) + 5.5rem));
  }

  .comments-panel {
    left: 50%;
    right: auto;
    width: min(480px, 100%);
    transform: translate(-50%, 105%);
    border-radius: 18px 18px 0 0;
  }

  .comments-sheet.is-open .comments-panel {
    transform: translate(-50%, 0);
  }
}

/* ── Share sheet ── */
.share-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  visibility: hidden;
}

.share-sheet.is-open {
  pointer-events: auto;
  visibility: visible;
}

body.is-immersive .share-sheet {
  position: absolute;
  z-index: 25;
}

.share-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 200ms ease;
}

.share-sheet.is-open .share-backdrop {
  opacity: 1;
}

.share-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #12141c;
  border-radius: 18px 18px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 0;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  transform: translateY(105%);
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.35);
  color: #fff;
}

.share-sheet.is-open .share-panel {
  transform: translateY(0);
}

.share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.share-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.share-close {
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
}

.share-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
}

@media (min-width: 480px) {
  .share-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.share-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.8rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 150ms ease, border-color 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

.share-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

.share-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.1);
}

.share-icon.wa { background: #25d366; color: #fff; }
.share-icon.ig {
  background: linear-gradient(135deg, #f58529, #dd2a7b 50%, #8134af);
  color: #fff;
}
.share-icon.fb { background: #1877f2; color: #fff; }
.share-icon.x { background: #111; color: #fff; border: 1px solid rgba(255,255,255,0.2); }
.share-icon.tg { background: #2aabee; color: #fff; }

.share-whatsapp {
  border-color: rgba(37, 211, 102, 0.35);
  background: rgba(37, 211, 102, 0.1);
}

.share-instagram {
  border-color: rgba(221, 42, 123, 0.35);
  background: rgba(221, 42, 123, 0.1);
}

.share-hint {
  margin: 0.85rem 0 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.65);
  text-align: center;
}

@media (min-width: 768px) {
  .share-panel {
    left: 50%;
    right: auto;
    width: min(420px, calc(100% - 2rem));
    bottom: 1.5rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: translate(-50%, 20px) scale(0.98);
    opacity: 0;
  }

  .share-sheet.is-open .share-panel {
    transform: translate(-50%, 0) scale(1);
    opacity: 1;
  }
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2rem;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--text-dim);
  font-size: 0.88rem;
}

.footer-copy,
.footer-meta {
  margin: 0;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.15rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 10px 24px var(--primary-glow);
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.35);
  color: #fda4af;
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.22);
}

.btn-block {
  width: 100%;
}

.btn-xs {
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  border-radius: 8px;
}

/* ── 404 ── */
.error-page {
  padding: 5rem 0;
}

.error-card {
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
  padding: 2.5rem 1.75rem;
  border-radius: calc(var(--radius) + 4px);
}

.error-code {
  margin: 0;
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.error-card h1 {
  margin: 0.25rem 0 0.5rem;
  letter-spacing: -0.03em;
}

.error-card p {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
}

/* ── Utility ── */
.muted {
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  word-break: break-all;
}

/* ═══════════════════════════════════════════════════════════
   News — Instagram-style feed + article
   ═══════════════════════════════════════════════════════════ */

.news-hero {
  padding: 1.75rem 0 0.75rem;
}

.news-hero-title {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.news-hero-sub {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
  max-width: 36rem;
}

.news-feed {
  padding: 1rem 0 3rem;
}

.news-feed-inner {
  max-width: 640px;
}

.ig-feed {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.ig-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.ig-card-media {
  display: block;
  background: var(--bg-soft);
}

.ig-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

@media (min-width: 640px) {
  .ig-image {
    aspect-ratio: 4 / 5;
  }
}

.ig-image-placeholder {
  background:
    radial-gradient(circle at 30% 30%, rgba(99, 102, 241, 0.3), transparent 55%),
    linear-gradient(145deg, #1a1d2b, #0d0f16);
}

.ig-card-body {
  padding: 1rem 1.1rem 1.15rem;
}

.ig-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 0.45rem;
}

.ig-cat {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
}

.ig-headline {
  margin: 0 0 0.45rem;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.ig-headline a:hover {
  color: var(--primary);
}

/* ~2-line excerpt */
.ig-excerpt {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ig-read-more {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary);
}

/* Full article */
.article-page {
  padding: 1.25rem 0 3.5rem;
}

.article-narrow {
  max-width: 720px;
}

.article-back {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
}

.article-back:hover {
  color: var(--text);
}

.article-header {
  margin-bottom: 1.25rem;
}

.article-title {
  margin: 0 0 0.65rem;
  font-size: clamp(1.6rem, 4vw, 2.35rem);
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.article-byline {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.article-hero-img {
  margin: 0 0 1.5rem;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.article-feature {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  display: block;
}

.article-content {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
}

.article-content p {
  margin: 0 0 1rem;
}

.article-content h2 {
  margin: 1.5rem 0 0.6rem;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.article-content h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.15rem;
}

.article-content ul,
.article-content ol {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.article-content a {
  color: var(--primary);
  text-decoration: underline;
}

.article-content img {
  max-width: 100%;
  border-radius: 12px;
  margin: 0.75rem 0;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.75rem;
}

.article-share {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.article-share-label {
  margin: 0;
  font-weight: 700;
}
