/* ShortVdo — public site
 * Dark, glassmorphic, mobile-first. Neon magenta/violet accents on true black.
 */
:root {
  --bg: #05050a;
  --bg-elev-1: #0d0d16;
  --bg-elev-2: #14141f;
  --ink: #f5f5fa;
  --ink-dim: #a6a6b4;
  --ink-mute: #6a6a78;
  --line: rgba(255,255,255,0.08);
  --line-strong: rgba(255,255,255,0.16);
  --glass: rgba(20,20,30,0.55);
  --shadow-glow: 0 20px 60px -20px rgba(255,46,136,0.35);
  --font-display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
html { color-scheme: dark; }
body {
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
::selection { background: color-mix(in oklab, var(--brand-primary), transparent 60%); color: #fff; }

a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
button { font: inherit; border: none; background: none; color: inherit; cursor: pointer; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 8px; top: 8px; background: var(--brand-primary); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 200; }

/* -------- Header -------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), rgba(0,0,0,0));
  pointer-events: none;
}
.site-header > * { pointer-events: auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.01em; }
.brand__mark {
  width: 28px; height: 28px; border-radius: 8px;
  background:
    radial-gradient(circle at 30% 30%, var(--brand-primary), transparent 60%),
    radial-gradient(circle at 70% 70%, var(--brand-secondary), transparent 55%),
    #111;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}
.brand__name { font-size: 15px; }
.site-nav { display: flex; gap: 6px; }
.site-nav__link {
  padding: 8px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  transition: background 200ms ease, transform 150ms ease;
}
.site-nav__link:hover { background: rgba(255,255,255,0.08); transform: translateY(-1px); }

/* -------- Feed -------- */
.feed {
  height: 100dvh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.feed::-webkit-scrollbar { display: none; }
.feed { scrollbar-width: none; }

.reel {
  position: relative;
  height: 100dvh;
  width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: grid;
  place-items: center;
  background: #000;
  overflow: hidden;
  contain: layout paint;
}
.reel__video {
  width: 100%; height: 100%;
  /* contain = show the whole video, centered, no cropping — matches
     TikTok / Instagram Reels behaviour for non-9:16 clips. Any empty
     space is filled by the parent's solid black background. */
  object-fit: contain;
  background: #000;
}
.reel__gradient {
  position: absolute; inset: auto 0 0 0; height: 55%;
  background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0));
  pointer-events: none;
}
.reel__top-gradient {
  position: absolute; inset: 0 0 auto 0; height: 25%;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55), rgba(0,0,0,0));
  pointer-events: none;
}
.reel__meta {
  position: absolute; left: 16px; right: 96px; bottom: calc(24px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 8px;
  z-index: 3;
}
.reel__category {
  display: inline-flex; align-self: flex-start;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.06);
  text-transform: uppercase;
}
.reel__title {
  font-size: 22px; line-height: 1.15; font-weight: 800; margin: 0;
  text-shadow: 0 2px 20px rgba(0,0,0,0.55);
}
.reel__desc {
  font-size: 13px; color: var(--ink-dim); margin: 0; max-width: 62ch;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.reel__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.reel__tag { font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); }
.reel__tag::before { content: '#'; color: var(--brand-primary); margin-right: 2px; }

.reel__actions {
  position: absolute; right: 12px; bottom: calc(24px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 18px; align-items: center;
  z-index: 3;
}
.reel-action {
  display: grid; place-items: center; gap: 4px;
  width: 52px;
}
.reel-action__btn {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  display: grid; place-items: center;
  transition: transform 220ms cubic-bezier(.2,.9,.3,1.4), background 200ms;
}
.reel-action__btn:hover { background: rgba(255,255,255,0.12); }
.reel-action__btn:active { transform: scale(.9); }
.reel-action__btn svg { width: 26px; height: 26px; }
.reel-action__btn[data-active="true"] { color: var(--brand-primary); border-color: color-mix(in oklab, var(--brand-primary), transparent 40%); }
.reel-action__btn[data-active="true"] svg { fill: currentColor; }
.reel-action__count { font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); }

.reel__playpause {
  position: absolute; inset: 0; display: grid; place-items: center;
  z-index: 2; pointer-events: none;
}
.reel__playpause svg {
  width: 80px; height: 80px; opacity: 0; transform: scale(.6);
  transition: opacity 220ms ease, transform 220ms cubic-bezier(.2,.9,.3,1.4);
  filter: drop-shadow(0 6px 20px rgba(0,0,0,.6));
}
.reel[data-paused="true"] .reel__playpause svg { opacity: .95; transform: scale(1); }

.reel__heart-burst {
  position: absolute; inset: 0; display: grid; place-items: center;
  pointer-events: none; z-index: 4;
}
.reel__heart-burst svg { width: 140px; height: 140px; color: var(--brand-primary); fill: currentColor;
  opacity: 0; transform: scale(.3); }
.reel__heart-burst.animate svg { animation: heartburst 700ms cubic-bezier(.2,.9,.3,1.2) forwards; }
@keyframes heartburst {
  0% { opacity: 0; transform: scale(.3) rotate(-8deg); }
  40% { opacity: 1; transform: scale(1.15) rotate(2deg); }
  100% { opacity: 0; transform: scale(1.35) rotate(0deg); }
}

/* Skeleton loading between reels */
.reel--skeleton { background: linear-gradient(120deg, #0a0a12 0%, #14141f 40%, #0a0a12 80%);
  background-size: 200% 100%; animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Between-reels ad */
.reel--ad {
  background: #0b0b14;
  display: grid; place-items: center;
  padding: 20px;
  text-align: center;
}
.reel--ad .ad-inner {
  width: min(100%, 640px);
  padding: 24px; border-radius: 20px;
  background: linear-gradient(160deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-glow);
}
.ad-slot__label { font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em; color: var(--ink-mute); text-transform: uppercase; margin-bottom: 8px; }

/* Anchor / banner ads */
.ad-slot { padding: 8px 12px; background: #0a0a12; border-top: 1px solid var(--line); }
.ad-slot--top-anchor { position: fixed; top: 0; left: 0; right: 0; z-index: 50; }
.ad-slot--bottom-anchor { position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; }
.ad-slot--sticky { position: fixed; bottom: calc(12px + var(--safe-bottom)); right: 12px; z-index: 55; max-width: 320px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.ad-slot__close { position: absolute; top: 4px; right: 8px; color: var(--ink-dim); font-size: 20px; line-height: 1; }
.ad-slot--footer, .ad-slot--header { position: static; }

/* -------- Static pages -------- */
.app--page { padding-top: calc(72px + var(--safe-top)); background:
  radial-gradient(80% 60% at 50% -10%, rgba(139,92,246,0.15), transparent 60%),
  #05050a;
}
.page-main { max-width: 780px; margin: 0 auto; padding: 32px 20px 64px; }
.prose { font-size: 16px; line-height: 1.7; color: var(--ink); }
.prose h1 { font-size: clamp(30px, 5vw, 42px); line-height: 1.05; margin: 0 0 20px; letter-spacing: -0.02em; }
.prose h2 { font-size: 22px; margin: 28px 0 10px; }
.prose p, .prose li { color: var(--ink-dim); }
.prose a { color: var(--brand-primary); text-decoration: underline; text-underline-offset: 3px; }
.page-back { margin-top: 32px; }
.page-back a { color: var(--brand-primary); font-weight: 600; }

/* -------- Footer -------- */
.site-footer {
  position: absolute; left: -9999px; top: -9999px; /* SR-only for feed page */
}
.app--page .site-footer {
  position: static; left: auto; top: auto;
  border-top: 1px solid var(--line);
  padding: 32px 20px; text-align: center; color: var(--ink-mute); font-size: 13px;
  display: grid; gap: 12px;
}
.app--page .site-footer nav { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }
.app--page .site-footer nav a { color: var(--ink-dim); }
.app--page .site-footer nav a:hover { color: var(--ink); }

/* -------- Ad wait -------- */
.ad-wait {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center;
}
.ad-wait__ring {
  width: 96px; height: 96px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--brand-primary);
  display: grid; place-items: center;
  font-size: 30px; font-weight: 800;
  animation: spin 1.2s linear infinite;
}
.ad-wait__text { margin-top: 14px; color: var(--ink-dim); font-size: 13px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* -------- Scroll-up hint (TikTok / Reels style) --------
 * Small pulsing chevron at the bottom of the first reel. Fades out
 * gracefully as soon as the user scrolls or after a short timeout.
 */
.scroll-hint {
  position: absolute; left: 50%; bottom: calc(96px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 4;
  display: inline-flex; flex-direction: column; align-items: center; gap: 4px;
  color: #fff; opacity: .95;
  pointer-events: none;
  animation: hintFade 400ms ease-out both;
}
.scroll-hint__arrow {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.28);
  display: grid; place-items: center;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: hintBounce 1.5s cubic-bezier(.5,0,.5,1) infinite;
}
.scroll-hint__arrow svg { width: 18px; height: 18px; }
.scroll-hint__label {
  font-size: 11px; letter-spacing: .06em; font-weight: 600;
  text-shadow: 0 1px 8px rgba(0,0,0,.6);
  opacity: .85;
}
.scroll-hint.is-hiding { animation: hintFadeOut 260ms ease-in forwards; }
@keyframes hintFade { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: .95; transform: translate(-50%, 0); } }
@keyframes hintFadeOut { to { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes hintBounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-6px); }
}

/* -------- Ad "Wait" chip --------
 * Small non-overlay pill shown on ad slides. Highlights + shakes if the
 * user tries to scroll during the wait period. The ad itself stays fully
 * visible; the chip lives inside the ad slide.
 */
.ad-wait-chip {
  position: absolute; top: calc(76px + var(--safe-top)); left: 50%;
  transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 12px;
  border-radius: 999px;
  background: rgba(20,20,30,0.72);
  border: 1px solid rgba(255,255,255,0.18);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  z-index: 5;
  transition: transform 200ms cubic-bezier(.2,.9,.3,1.4), background 200ms, border-color 200ms, box-shadow 200ms;
}
.ad-wait-chip__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand-primary);
  box-shadow: 0 0 0 rgba(255,46,136,0.6);
  animation: waitDot 1.2s ease-out infinite;
}
.ad-wait-chip__count { font-family: var(--font-mono); font-weight: 700; }
@keyframes waitDot {
  0% { box-shadow: 0 0 0 0 rgba(255,46,136,0.7); }
  100% { box-shadow: 0 0 0 10px rgba(255,46,136,0); }
}
.ad-wait-chip.is-pulse {
  background: color-mix(in oklab, var(--brand-primary), #000 20%);
  border-color: rgba(255,255,255,0.5);
  box-shadow: 0 12px 40px -12px var(--brand-primary), 0 0 0 4px color-mix(in oklab, var(--brand-primary), transparent 75%);
  animation: waitShake 420ms cubic-bezier(.36,.07,.19,.97);
}
.ad-wait-chip.is-done {
  background: rgba(20,20,30,0.6);
  border-color: rgba(255,255,255,0.14);
}
.ad-wait-chip.is-done .ad-wait-chip__dot { animation: none; background: #4ade80; box-shadow: none; }
@keyframes waitShake {
  10%, 90% { transform: translate(calc(-50% - 1px), 0); }
  20%, 80% { transform: translate(calc(-50% + 2px), 0); }
  30%, 50%, 70% { transform: translate(calc(-50% - 4px), 0); }
  40%, 60% { transform: translate(calc(-50% + 4px), 0); }
}

/* Video error fallback (codec / network) */
.reel__video-error {
  position: absolute; inset: 0; z-index: 2;
  display: grid; place-items: center;
  padding: 40px 24px; text-align: center;
  background: linear-gradient(180deg, rgba(0,0,0,0.4), rgba(0,0,0,0.75));
  color: var(--ink);
  pointer-events: none;
}
.reel__video-error > div { max-width: 320px; }
.reel__video-error p { margin: 0 0 8px; font-size: 14px; line-height: 1.5; color: var(--ink-dim); }
.reel__video-error p strong { color: var(--ink); }

/* Tap-for-sound floating cue (fallback when browser blocks audio autoplay) */
.unmute-cue {
  position: fixed;
  top: calc(72px + var(--safe-top));
  right: 12px;
  z-index: 45;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55); color: #fff;
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  font-size: 13px; font-weight: 600;
  box-shadow: 0 10px 30px -12px rgba(0,0,0,0.7);
  animation: pulseCue 2.2s ease-in-out infinite;
}
@keyframes pulseCue { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-2px) } }

/* -------- Reduced motion -------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media (min-width: 900px) {
  .reel__meta { left: 40px; right: 120px; }
  .reel__actions { right: 32px; }
  .reel__title { font-size: 26px; }
}
