/* FanFlix: ported from reference/FanFlix.dc.html on FANDEMiQ tokens.
   Raw colour values live only in :root; everything else uses tokens. */
:root {
  --ff-gutter: clamp(20px, 4vw, 48px);
  --ff-muted: #9ca3af;
  --ff-soft: #e5e7eb;
  --ff-black: #000;
  --ff-line: rgba(255, 255, 255, 0.08);
  --ff-line-strong: rgba(255, 255, 255, 0.1);
  --ff-glass: rgba(10, 10, 10, 0.7);
  --ff-glass-soft: rgba(10, 10, 10, 0.6);
  --ff-glass-strong: rgba(10, 10, 10, 0.85);
  --ff-white-08: rgba(255, 255, 255, 0.08);
  --ff-white-14: rgba(255, 255, 255, 0.14);
  --ff-white-20: rgba(255, 255, 255, 0.2);
  --ff-white-30: rgba(255, 255, 255, 0.3);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--fq-ink); color: var(--fq-white); font-family: var(--fq-font-body); -webkit-font-smoothing: antialiased; }
body.ff-locked { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--fq-ring); }

.fq-icon { font-family: 'fandemiq-icons'; font-style: normal; font-weight: normal; line-height: 1; display: inline-block; -webkit-font-smoothing: antialiased; }
.ff-rot90 { display: inline-block; transform: rotate(90deg); }
.ff-rot-90 { display: inline-block; transform: rotate(-90deg); }

/* Design-system Button and Badge (ported from components/core/Button.jsx and Badge.jsx) */
.fq-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--fq-font-body); font-weight: var(--fq-weight-semibold); font-size: var(--fq-text-xs); letter-spacing: 0.3px; text-transform: uppercase; border-radius: var(--fq-radius-md); border: 2px solid; padding: 9px 16px; line-height: 1.2; cursor: pointer; transition: background-color var(--fq-transition-fast), border-color var(--fq-transition-fast), color var(--fq-transition-fast), box-shadow var(--fq-transition-fast); }
.fq-btn--primary { background: var(--fq-purple); border-color: var(--fq-purple); color: var(--fq-white); box-shadow: var(--fq-shadow-sm); }
.fq-btn--primary:hover { background: var(--fq-purple-dark); border-color: var(--fq-purple-dark); box-shadow: var(--fq-shadow-md); }
.fq-btn--white { background: var(--fq-white); border-color: var(--fq-white); color: var(--fq-neutral-700); }
.fq-btn--white:hover { background: var(--fq-neutral-50); border-color: var(--fq-neutral-300); }
.fq-btn--big { font-size: 14px; padding: 12px 22px; }
.fq-badge { display: inline-flex; align-items: center; font-size: var(--fq-text-xs); font-weight: var(--fq-weight-semibold); line-height: 1; text-transform: uppercase; letter-spacing: 0.4px; padding: 4px 10px; border-radius: var(--fq-radius-full); background: var(--fq-purple); color: var(--fq-white); }

/* Header */
.ff-app { min-height: 100vh; display: flex; flex-direction: column; }
.ff-header { position: sticky; top: 0; z-index: 40; background: rgba(10, 10, 10, 0.86); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.ff-header__in { display: flex; align-items: center; gap: 32px; padding: 14px var(--ff-gutter); flex-wrap: wrap; }
.ff-brand { display: flex; align-items: center; gap: 10px; }
.ff-brand img { width: 32px; height: 32px; border-radius: 8px; box-shadow: 0 0 0 1px var(--ff-white-14); }
.ff-brand__words { display: flex; flex-direction: column; line-height: 1; }
.ff-brand__name { font-family: var(--fq-font-display); font-weight: 700; font-size: 20px; letter-spacing: 0.5px; }
.ff-brand__name i { font-style: normal; color: var(--fq-pink); }
.ff-brand__by { font-size: 10px; letter-spacing: 1.4px; color: var(--ff-muted); margin-top: 3px; }
.ff-nav { display: flex; gap: 22px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.ff-nav::-webkit-scrollbar { display: none; }
.ff-nav__a { position: relative; padding: 6px 0; font-size: 14px; font-weight: 500; color: var(--fq-neutral-300); white-space: nowrap; transition: color var(--fq-transition-fast); }
.ff-nav__a:hover, .ff-nav__a.is-on { color: var(--fq-white); }
.ff-nav__a.is-on::after { content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; border-radius: 2px; background: var(--fq-pink); }
.ff-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 999px; background: var(--ff-white-08); border: 1px solid var(--ff-line-strong); color: var(--ff-muted); }
.ff-search input { background: transparent; border: 0; outline: none; color: var(--fq-white); font-family: var(--fq-font-body); font-size: 13px; width: 190px; }

/* Covers: fallback tile sits underneath the poster; the poster is removed on error */
.ff-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ff-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: rgba(255, 255, 255, 0.5); }
.ff-pattern { position: absolute; inset: 0; background: url('/assets/fandemiq-bg.jpg') center / cover; opacity: 0.18; }
.ff-fallback__icon { position: relative; }
.ff-hero .ff-fallback, .ff-titlehero .ff-fallback { color: rgba(255, 255, 255, 0.22); align-items: flex-start; justify-content: flex-end; padding: 20vh 9% 0 0; }

/* Hero: a fixed-size box; every slide is stacked inside it and crossfades on opacity.
   Slide content is absolutely positioned, so text length never changes the page layout. */
.ff-hero { --ff-hero-pad: clamp(56px, 8vh, 96px); position: relative; height: clamp(520px, 78vh, 720px); overflow: hidden; isolation: isolate; background: var(--fq-ink); }
.ff-hero__slide { position: absolute; inset: 0; display: flex; align-items: flex-end; opacity: 0; transition: opacity 0.8s ease; }
.ff-hero__slide.is-active { opacity: 1; z-index: 1; }
.ff-hero .ff-cover { object-position: center 30%; }
/* Images crossfade over 0.8s; text leaves quickly and arrives a beat later, so two titles never overlap. */
.ff-hero__slide .ff-hero__body { opacity: 0; transition: opacity 0.25s ease; }
.ff-hero__slide.is-active .ff-hero__body { opacity: 1; transition: opacity 0.45s ease 0.35s; }
.ff-hero__shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10, 10, 10, 0.88) 0%, rgba(10, 10, 10, 0.35) 55%, rgba(10, 10, 10, 0) 100%), linear-gradient(0deg, var(--fq-ink) 0%, rgba(10, 10, 10, 0) 40%); }
/* Bottom-anchored: the buttons sit last, at a fixed distance from the bottom, on every slide. */
.ff-hero__body { position: relative; width: 100%; max-width: 900px; padding: 0 var(--ff-gutter) calc(var(--ff-hero-pad) + 43px); display: flex; flex-direction: column; gap: 18px; }
.ff-kicker { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ff-overline { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--fq-purple-light); }
.ff-hero__title { margin: 0; font-family: var(--fq-font-display); font-weight: 700; font-size: clamp(36px, 5.2vw, 56px); line-height: 1.05; letter-spacing: -0.5px; text-wrap: balance; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; padding-bottom: 0.08em; }
.ff-meta { font-family: var(--fq-font-mono); font-size: 13px; line-height: 1.5; min-height: 1.5em; color: var(--fq-neutral-300); display: flex; gap: 14px; flex-wrap: wrap; }
.ff-hero__desc { margin: 0; max-width: 544px; font-size: 17px; line-height: 1.55; color: var(--ff-soft); text-wrap: pretty; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ff-actions { display: flex; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
/* One shared set of dots, outside the slides, so it never moves or fades. */
.ff-hero .ff-dots { position: absolute; z-index: 2; left: var(--ff-gutter); bottom: var(--ff-hero-pad); }
.ff-dots { display: flex; gap: 8px; margin-top: 10px; }
.ff-dot { width: 28px; padding: 6px 0; border: 0; background: none; cursor: pointer; }
.ff-dot::before { content: ''; display: block; height: 3px; border-radius: 3px; background: var(--ff-white-30); transition: background-color var(--fq-transition-base); }
.ff-dot.is-on::before { background: var(--fq-pink); }

/* Rows */
.ff-rows { display: flex; flex-direction: column; gap: 44px; padding: 8px 0 64px; position: relative; margin-top: -24px; }
.ff-rowsec { display: flex; flex-direction: column; gap: 14px; }
.ff-rowhead { display: flex; align-items: baseline; gap: 14px; padding: 0 var(--ff-gutter); }
.ff-rowhead h2, .ff-more h2 { margin: 0; font-family: var(--fq-font-display); font-weight: 600; font-size: 22px; letter-spacing: -0.2px; }
.ff-rowhead span { font-size: 13px; color: var(--ff-muted); }
.ff-rowwrap { position: relative; }
.ff-row { display: flex; gap: 16px; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: none; padding: 6px var(--ff-gutter) 10px; }
.ff-row::-webkit-scrollbar { display: none; }
.ff-scroll { position: absolute; top: 0; bottom: 10px; width: 44px; border: 0; background: var(--ff-glass-soft); color: var(--fq-white); cursor: pointer; opacity: 0.35; transition: opacity var(--fq-transition-fast); display: flex; align-items: center; justify-content: center; }
.ff-scroll:hover, .ff-scroll:focus-visible { opacity: 1; }
.ff-scroll--l { left: 0; }
.ff-scroll--r { right: 0; }
@media (hover: none) { .ff-scroll { display: none; } }

/* Cards */
.ff-card { flex: none; width: 300px; display: flex; flex-direction: column; gap: 10px; transition: transform var(--fq-transition-base); }
.ff-card:hover { transform: translateY(-4px); }
.ff-grid .ff-card { width: auto; }
.ff-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; box-shadow: var(--fq-shadow-md); }
.ff-chip { position: absolute; top: 10px; left: 10px; padding: 4px 9px; border-radius: 999px; background: var(--ff-glass); font-size: 11px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; }
.ff-dur { position: absolute; bottom: 10px; right: 10px; padding: 3px 7px; border-radius: 6px; background: var(--ff-glass); font-family: var(--fq-font-mono); font-size: 11px; }
.ff-card__text { display: flex; flex-direction: column; gap: 3px; }
.ff-card__title { font-family: var(--fq-font-display); font-weight: 600; font-size: 15px; line-height: 1.3; }
.ff-card__sub { font-size: 13px; color: var(--ff-muted); }
.ff-rank { flex: none; display: flex; align-items: flex-end; transition: transform var(--fq-transition-base); }
.ff-rank:hover { transform: translateY(-4px); }
.ff-rank__n { font-family: var(--fq-font-display); font-weight: 700; font-size: 150px; line-height: 0.78; color: var(--fq-ink); -webkit-text-stroke: 2px var(--fq-purple); margin-right: -18px; letter-spacing: -8px; }
.ff-rank__poster { position: relative; width: 150px; aspect-ratio: 2 / 3; border-radius: 12px; overflow: hidden; box-shadow: var(--fq-shadow-lg); }
.ff-rank__title { position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 10px 10px; background: linear-gradient(0deg, var(--ff-glass-strong), rgba(10, 10, 10, 0)); font-family: var(--fq-font-display); font-weight: 600; font-size: 13px; line-height: 1.25; }

/* Browse and search */
.ff-browse { padding: 48px var(--ff-gutter) 72px; display: flex; flex-direction: column; gap: 28px; }
.ff-browse__head { display: flex; flex-direction: column; gap: 8px; max-width: 640px; }
.ff-browse__kicker { font-size: 12px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--fq-pink); }
.ff-browse__title { margin: 0; font-family: var(--fq-font-display); font-weight: 700; font-size: clamp(30px, 4vw, 44px); line-height: 1.1; }
.ff-browse__blurb { margin: 0; font-size: 16px; color: var(--fq-neutral-300); line-height: 1.5; }
.ff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 28px 18px; }
.ff-grid--sm { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 24px 16px; }
.ff-empty { margin: 0; color: var(--ff-muted); font-size: 15px; }

/* Title page */
.ff-titlehero { position: relative; min-height: min(72vh, 660px); display: flex; align-items: flex-end; overflow: hidden; }
.ff-titlehero__shade { position: absolute; inset: 0; background: linear-gradient(0deg, var(--fq-ink) 0%, rgba(10, 10, 10, 0.55) 45%, rgba(10, 10, 10, 0.1) 100%); }
.ff-back { position: absolute; top: 24px; left: var(--ff-gutter); z-index: 1; display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px; border-radius: 999px; border: 0; background: var(--ff-glass-soft); cursor: pointer; font-size: 13px; font-weight: 600; }
.ff-back:hover { background: var(--ff-glass-strong); }
.ff-titlehero__body { position: relative; width: 100%; padding: 0 var(--ff-gutter) 40px; display: flex; flex-direction: column; gap: 16px; max-width: 820px; }
.ff-titlehero__title { margin: 0; font-family: var(--fq-font-display); font-weight: 700; font-size: clamp(34px, 5vw, 60px); line-height: 1.05; letter-spacing: -0.5px; text-wrap: balance; }
.ff-variants { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--fq-neutral-300); }
.ff-variant { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--ff-white-20); background: var(--ff-glass-soft); cursor: pointer; font-family: var(--fq-font-mono); font-size: 12px; }
.ff-variant:hover { border-color: var(--fq-white); }
.ff-detail { padding: 12px var(--ff-gutter) 48px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 40px; align-items: start; }
.ff-detail__desc { margin: 0; max-width: 640px; font-size: 18px; line-height: 1.6; color: var(--ff-soft); text-wrap: pretty; white-space: pre-line; }
.ff-dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 12px 24px; font-size: 14px; padding: 20px 24px; border-radius: 12px; border: 1px solid var(--ff-line-strong); }
.ff-dl dt { color: var(--ff-muted); }
.ff-dl dd { margin: 0; }
.ff-mono { font-family: var(--fq-font-mono); font-size: 13px; }
.ff-more { padding: 0 var(--ff-gutter) 72px; display: flex; flex-direction: column; gap: 18px; }

/* Footer */
.ff-footer { margin-top: auto; padding: 28px var(--ff-gutter); border-top: 1px solid var(--ff-line); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ff-muted); }
.ff-footer__brand { display: flex; align-items: center; gap: 10px; }
.ff-footer img { width: 22px; height: 22px; border-radius: 6px; box-shadow: 0 0 0 1px var(--ff-white-14); }
.ff-footer a { color: var(--fq-purple-light); }
.ff-footer a:hover { color: var(--fq-white); text-decoration: underline; }

/* Player */
.ff-player { position: fixed; inset: 0; z-index: 100; background: var(--fq-ink); display: flex; flex-direction: column; }
.ff-player[hidden] { display: none; }
.ff-player__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px var(--ff-gutter); }
.ff-player__bar > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ff-player__title { font-family: var(--fq-font-display); font-weight: 600; font-size: 18px; }
.ff-player__sub { font-size: 13px; color: var(--ff-muted); }
.ff-close { width: 44px; height: 44px; flex: none; border-radius: 999px; border: 0; background: var(--ff-line-strong); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.ff-close:hover { background: var(--ff-white-20); }
.ff-player__stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 var(--ff-gutter) 32px; }
.ff-player__stage video { max-width: 100%; max-height: 100%; border-radius: 12px; background: var(--ff-black); }
.ff-player__error { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: rgba(255, 255, 255, 0.8); font-size: 14px; background: var(--ff-glass-soft); }
.ff-player__error[hidden] { display: none; }

/* Load error */
.ff-error { padding: 96px var(--ff-gutter); display: flex; flex-direction: column; align-items: flex-start; gap: 16px; font-size: 16px; color: var(--fq-neutral-300); }

@media (max-width: 640px) {
  .ff-header__in { gap: 14px 20px; }
  .ff-nav { order: 3; flex-basis: 100%; }
  .ff-search { margin-left: auto; }
  .ff-search input { width: 120px; }
  .ff-hero { height: clamp(440px, 70vh, 560px); }
  .ff-card { width: 240px; }
  .ff-rank__n { font-size: 110px; letter-spacing: -6px; }
  .ff-rank__poster { width: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
