/* tyflix.net portal — design system v3
   Brand: dark base + magenta-cyan gradient. Cinematic. */
:root {
  --bg: #0a0410;
  --bg-elev: #150828;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --fg: #f5f0ff;
  --fg-muted: rgba(245, 240, 255, 0.72);
  --fg-faint: rgba(245, 240, 255, 0.45);
  --pink: #ff2e88;
  --violet: #b14bff;
  --cyan: #00e5ff;
  --gradient: linear-gradient(135deg, var(--pink) 0%, var(--violet) 50%, var(--cyan) 100%);
  --gradient-soft: linear-gradient(135deg, rgba(255,46,136,0.18), rgba(0,229,255,0.18));
  --shadow-pink: 0 18px 50px -20px rgba(255, 46, 136, 0.6);
  --shadow-cyan: 0 18px 50px -20px rgba(0, 229, 255, 0.5);
  --shadow-violet: 0 18px 50px -20px rgba(177, 75, 255, 0.55);
  --radius: 18px;
  --radius-lg: 28px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--fg); }
body {
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "ss01", "cv11";
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* Atmospheric blobs (kept) */
body::before, body::after {
  content: ''; position: fixed; pointer-events: none; z-index: 0;
  border-radius: 50%; filter: blur(110px); opacity: 0.55;
}
body::before { top: -120px; left: -100px; width: 480px; height: 480px; background: var(--pink); }
body::after  { bottom: -160px; right: -120px; width: 540px; height: 540px; background: var(--cyan); }

/* ===== Cinematic poster backdrop (behind hero only) ===== */
.poster-bg {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 760px;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 1.2s ease;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0) 100%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0) 100%);
}
.poster-bg.ready { opacity: 1; }
.poster-bg .bg-track {
  display: flex;
  gap: 20px;
  width: max-content;
  padding: 60px 0;
  animation: marquee 90s linear infinite;
  will-change: transform;
}
.poster-bg .bg-tile {
  flex: 0 0 auto;
  width: 200px;
  aspect-ratio: 2/3;
  border-radius: 14px;
  overflow: hidden;
  filter: blur(2px) saturate(1.1);
  opacity: 0.32;
  transform: translateY(calc(sin(var(--i) * 1.2rad) * 12px));
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.6);
}
.poster-bg .bg-tile img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
@keyframes marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .poster-bg .bg-track { animation: none; }
}

/* ===== Film-grain overlay ===== */
.grain {
  position: fixed; inset: 0;
  z-index: 1; pointer-events: none;
  opacity: 0.06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Layout */
.container { max-width: 1240px; margin: 0 auto; padding: 28px 24px 80px; position: relative; z-index: 2; }

/* ===== Header ===== */
.header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 56px; }
.brandmark {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 17px; letter-spacing: -0.01em;
  color: var(--fg);
}
.brand-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--gradient);
  box-shadow: 0 0 14px rgba(255, 46, 136, 0.7);
  animation: brandBreathe 3.5s ease-in-out infinite;
}
.brand-text {
  font-weight: 700; letter-spacing: -0.02em;
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
@keyframes brandBreathe {
  0%, 100% { transform: scale(1); box-shadow: 0 0 14px rgba(255, 46, 136, 0.7); }
  50%      { transform: scale(1.18); box-shadow: 0 0 22px rgba(255, 46, 136, 0.95); }
}

.user-chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 8px; border-radius: 999px;
  background: rgba(21, 8, 40, 0.6);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  font-size: 14px; color: var(--fg-muted);
}
.user-chip .avatar {
  width: 28px; height: 28px; border-radius: 999px; background: var(--gradient);
  display: grid; place-items: center; color: white; font-weight: 700; font-size: 13px;
}
.user-chip .logout {
  background: transparent; border: 0; color: var(--fg-faint); cursor: pointer;
  font-size: 12px; padding: 0; margin-left: 4px;
}
.user-chip .logout:hover { color: var(--fg); }

/* ===== Hero ===== */
.hero {
  position: relative;
  margin-bottom: 80px;
  padding: 60px 0 20px;
  min-height: 460px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 11px; letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--fg-faint); margin-bottom: 22px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(21, 8, 40, 0.6);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  width: max-content;
}
.eyebrow-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 8px rgba(0,229,255,0.85);
  animation: eyebrowPulse 1.6s ease-in-out infinite;
}
@keyframes eyebrowPulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

.hero-title {
  font-size: clamp(46px, 7.6vw, 96px);
  /* line-height >1 so descenders (g, y, p, j) aren't clipped, especially
     under -webkit-background-clip: text where the gradient is bound to
     the line-box and tight metrics chop the bottom of glyphs */
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 800;
  max-width: 16ch;
}
.hero-title .line-lead,
.hero-title .line-glow {
  display: block;
  animation: heroFadeIn 0.9s ease both;
}
.hero-title .line-glow {
  background: var(--gradient);
  background-size: 200% 200%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  /* Extra breathing room on the gradient line — descenders (g, y, p, j)
     get clipped without it because background-clip:text inherits the
     line-box, not glyph metrics */
  padding-bottom: 0.08em;
  animation: heroFadeIn 0.9s ease both, gradientShift 8s ease-in-out infinite;
  animation-delay: 0.1s, 0s;
}
@keyframes heroFadeIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.hero .lede {
  color: var(--fg-muted);
  margin-top: 22px;
  max-width: 56ch;
  font-size: 17px;
  line-height: 1.5;
  animation: heroFadeIn 0.9s ease 0.2s both;
}

/* Hero CTA — the big primary button (Open Plex) */
.cta-primary {
  display: inline-flex; align-items: center; gap: 12px;
  margin-top: 36px;
  padding: 18px 28px 18px 32px;
  background: var(--gradient); background-size: 200% 200%;
  color: white; text-decoration: none;
  font-weight: 700; font-size: 17px; letter-spacing: -0.01em;
  border-radius: 999px;
  box-shadow: var(--shadow-pink), 0 0 0 0 rgba(255, 46, 136, 0.4);
  transition: transform .2s ease, box-shadow .25s ease, filter .2s ease;
  animation: heroFadeIn 0.9s ease 0.35s both, gradientShift 8s ease-in-out infinite;
  width: max-content;
  position: relative;
  overflow: hidden;
}
.cta-primary::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}
.cta-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-pink), 0 0 0 6px rgba(255, 46, 136, 0.18);
  filter: brightness(1.05);
}
.cta-primary:hover::before { transform: translateX(100%); }
.cta-primary svg { width: 20px; height: 20px; transition: transform .25s ease; }
.cta-primary:hover svg { transform: translateX(4px); }

/* ===== Section ===== */
.section { margin-top: 56px; }
.section.quick { margin-top: 24px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 20px;
}
.section-head h2 {
  font-size: 13px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--fg-faint);
  font-weight: 600; display: inline-flex; align-items: center; gap: 10px;
}
.section-head h2 .h2-icon { width: 16px; height: 16px; opacity: 0.85; color: var(--fg-muted); flex-shrink: 0; }

/* ===== Tile grids ===== */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 880px) { .grid-2 { grid-template-columns: 1fr; } }

/* ===== Tiles ===== */
.tile {
  position: relative; display: flex; flex-direction: column; gap: 16px;
  padding: 32px;
  border-radius: var(--radius-lg);
  background: rgba(21, 8, 40, 0.55);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  text-decoration: none; color: inherit; overflow: hidden;
  transition: transform .22s ease, border-color .22s ease, background .22s ease;
  isolation: isolate;
}
.tile:hover {
  transform: translateY(-3px);
  background: rgba(21, 8, 40, 0.7);
  border-color: var(--border-strong);
}
.tile.primary { min-height: 220px; }

/* Animated gradient backgrounds inside the tile */
.tile-bg {
  position: absolute; inset: 0;
  z-index: -1;
  opacity: 0.55;
  transition: opacity .35s ease, transform .35s ease;
}
.tile-bg-pink {
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255,46,136,0.32), transparent 55%),
    radial-gradient(110% 80% at 0% 100%, rgba(177,75,255,0.22), transparent 60%);
}
.tile-bg-violet {
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(177,75,255,0.32), transparent 55%),
    radial-gradient(110% 80% at 0% 100%, rgba(0,229,255,0.18), transparent 60%);
}
.tile:hover .tile-bg { opacity: 0.85; transform: scale(1.05); }

.tile .icon-wrap {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  border-radius: 16px; background: var(--gradient); color: white;
  box-shadow: var(--shadow-pink);
  flex-shrink: 0;
}
.tile .icon-wrap svg { display: block; width: 28px; height: 28px; stroke-width: 1.7; }
.tile .icon-wrap.cyan { background: linear-gradient(135deg, var(--cyan), #1da6ff); box-shadow: var(--shadow-cyan); }
.tile .icon-wrap.pink { background: linear-gradient(135deg, var(--pink), var(--violet)); box-shadow: var(--shadow-pink); }
.tile .icon-wrap.violet { background: linear-gradient(135deg, var(--violet), #6e36ff); box-shadow: var(--shadow-violet); }

.tile h3 { font-size: 24px; letter-spacing: -0.02em; font-weight: 700; line-height: 1.2; }
.tile p { color: var(--fg-muted); font-size: 14.5px; line-height: 1.55; }
.tile .tile-cta {
  margin-top: auto; display: inline-flex; align-items: center; gap: 6px;
  color: var(--fg); font-weight: 600; font-size: 14px;
}
.tile .tile-cta svg { width: 16px; height: 16px; transition: transform .18s ease; }
.tile:hover .tile-cta svg { transform: translateX(4px); }

/* ===== Recently-added rail ===== */
.recent-rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: 180px;
  gap: 16px; overflow-x: auto; padding-bottom: 16px;
  scroll-snap-type: x mandatory; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.recent-rail::-webkit-scrollbar { height: 8px; }
.recent-rail::-webkit-scrollbar-track { background: transparent; }
.recent-rail::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.poster {
  display: block; text-decoration: none; color: inherit;
  scroll-snap-align: start;
}
.poster .art {
  position: relative; width: 100%; aspect-ratio: 2/3;
  border-radius: 14px; overflow: hidden;
  background: var(--bg-elev); border: 1px solid var(--border);
  box-shadow: 0 12px 40px -16px rgba(0,0,0,0.7);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.poster:hover .art {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--border-strong);
  box-shadow: 0 22px 50px -16px rgba(255, 46, 136, 0.35), 0 12px 40px -16px rgba(0,0,0,0.7);
}
.poster .art img { width: 100%; height: 100%; object-fit: cover; }
.poster .label { padding: 12px 4px 0; font-size: 13.5px; font-weight: 500; line-height: 1.35; color: var(--fg); }
.poster .sub { padding: 2px 4px 0; font-size: 11px; color: var(--fg-faint); letter-spacing: 0.04em; text-transform: uppercase; }
.poster .pill {
  position: absolute; top: 10px; left: 10px;
  font-size: 10px; padding: 4px 8px; border-radius: 999px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  background: rgba(0,0,0,0.55); color: white; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: 600;
}

/* ===== Login card (kept for /login route) ===== */
.login-shell {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px; position: relative; z-index: 2;
}
.login-card {
  width: min(440px, 100%); padding: 40px 36px;
  background: rgba(21, 8, 40, 0.55); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7);
}
.login-card .logo { justify-content: center; margin-bottom: 28px; }
.login-card h1 { font-size: 28px; letter-spacing: -0.02em; text-align: center; margin-top: 8px; }
.login-card p { color: var(--fg-muted); text-align: center; margin-top: 10px; font-size: 14px; }
.login-card form { margin-top: 28px; display: flex; flex-direction: column; gap: 14px; }
.login-card .field,
.login-card input[type="text"],
.login-card input[type="password"],
.login-card input[type="email"] {
  width: 100%; padding: 14px 18px;
  background: var(--bg-card); border: 1px solid var(--border-strong); color: var(--fg);
  border-radius: 14px; font: inherit; font-size: 16px;
  letter-spacing: 0; line-height: 1.2;
  appearance: none; -webkit-appearance: none; box-shadow: none;
  transition: border-color .15s ease, background .15s ease;
}
.login-card .field:focus,
.login-card input[type="text"]:focus,
.login-card input[type="password"]:focus,
.login-card input[type="email"]:focus {
  outline: none; border-color: var(--pink); background: rgba(255,46,136,0.05);
}
.login-card input:-webkit-autofill,
.login-card input:-webkit-autofill:hover,
.login-card input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--fg);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-card) inset;
  caret-color: var(--fg);
  transition: background-color 5000s ease-in-out 0s;
}
.login-card input::placeholder { color: var(--fg-faint); opacity: 1; }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 20px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--gradient); color: white; font: inherit; font-weight: 600; font-size: 15px;
  box-shadow: var(--shadow-pink);
  transition: filter .15s ease, transform .15s ease;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-primary svg { width: 16px; height: 16px; }

/* ===== Footer ===== */
.footer {
  margin-top: 80px; padding-top: 24px; border-top: 1px solid var(--border);
  color: var(--fg-faint); font-size: 12px;
  display: flex; justify-content: space-between; align-items: center;
}
.footer .links { display: flex; gap: 18px; }
.footer a { color: inherit; text-decoration: none; }
.footer a:hover { color: var(--fg); }
.footer .status-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; background: #10c878;
  box-shadow: 0 0 0 0 rgba(16,200,120,0.7);
  margin-right: 8px; vertical-align: middle;
  animation: pulse 2.5s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(16,200,120,0.55); }
  70%  { box-shadow: 0 0 0 6px rgba(16,200,120,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,200,120,0); }
}

/* ===== Just-Added skeleton ===== */
.recent-rail .poster.skel { pointer-events: none; }
.recent-rail .poster.skel .art {
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.07), rgba(255,255,255,0.04));
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border: 1px solid var(--border);
}
.recent-rail .poster.skel .label-skel {
  height: 11px; margin-top: 12px; border-radius: 3px;
  background: linear-gradient(90deg, rgba(255,255,255,0.05), rgba(255,255,255,0.09), rgba(255,255,255,0.05));
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  width: 70%;
}
#recentSection[data-state="ready"] .poster.skel { display: none; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Rail right-edge fade */
#recentSection { position: relative; }
.rail-fade {
  position: absolute; right: 0; top: 56px; bottom: 12px;
  width: 64px; pointer-events: none;
  background: linear-gradient(90deg, rgba(10,4,16,0), rgba(10,4,16,0.85));
}
@media (max-width: 720px) { .rail-fade { width: 32px; } }

/* ===== Mobile tuning ===== */
@media (max-width: 720px) {
  .container { padding: 20px 18px 60px; }
  .header { margin-bottom: 32px; }
  .hero { padding: 32px 0 12px; min-height: 360px; margin-bottom: 56px; }
  .hero-title { font-size: clamp(40px, 11vw, 60px); }
  .hero .lede { font-size: 16px; }
  .cta-primary { padding: 16px 24px 16px 28px; font-size: 16px; }
  .tile { padding: 24px; min-height: auto; }
  .tile h3 { font-size: 21px; }
  .footer { flex-direction: column; gap: 14px; }
  .poster-bg { height: 580px; }
  .poster-bg .bg-tile { width: 140px; }
}

@media (max-width: 480px) {
  .hero-title { font-size: clamp(36px, 12vw, 50px); }
}
