/* ============================================================================
   Cinemask — Global stylesheet (applied on web via react-native-web DOM).
   The app is built with React Native Web, which renders components to inline
   styles on real DOM elements. This file layers premium polish on top:
   focus rings for accessibility, tasteful hover transitions, custom scrollbars
   and support for prefers-reduced-motion.
   ========================================================================== */

:root {
  --cm-bg: #05070D;
  --cm-surface: #0B1126;
  --cm-surface-2: #0F172E;
  --cm-text: #ffffff;
  --cm-text-muted: #737373;
  --cm-primary: #4F7DF0;
  --cm-primary-hover: #6A91F5;
  --cm-radius: 12px;
  --cm-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --cm-focus: #8ab4ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  background-color: var(--cm-bg);
  color: var(--cm-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,
    Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* --- Custom scrollbars (cinematic dark) ---------------------------------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
  background-clip: content-box;
}
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

/* --- Focus indicators (accessibility) ------------------------------------ */
[tabindex],
button,
a,
[role='button'],
input,
textarea {
  outline: none;
}
[tabindex]:focus-visible,
button:focus-visible,
a:focus-visible,
[role='button']:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--cm-focus);
  outline-offset: 3px;
}

/* --- Hover transitions for navigable cards/buttons ----------------------- */
@media (hover: hover) {
  button:hover,
  a:hover,
  [role='button']:hover {
    transform: translateY(-2px) scale(1.01);
    filter: brightness(1.05);
  }
}

/* --- Entrance animations ------------------------------------------------- */
@keyframes cm-fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes cm-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes cm-shimmer {
  0% {
    background-position: -468px 0;
  }
  100% {
    background-position: 468px 0;
  }
}

.cm-animate-in {
  animation: cm-fade-up 0.5s var(--cm-ease) both;
}
.cm-animate-fade {
  animation: cm-fade-in 0.4s ease both;
}

/* --- Image shimmer / loading placeholder -------------------------------- */
.cm-shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.1) 40%,
    rgba(255, 255, 255, 0.04) 80%
  );
  background-size: 800px 100%;
  animation: cm-shimmer 1.4s linear infinite;
}

/* --- Top navigation (TopNav) --------------------------------------------- */
.cm-topnav {
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* Dropdown / hover polish for nav links */
@media (hover: hover) {
  .cm-nav-link:hover {
    opacity: 1 !important;
  }
  .cm-nav-link:hover .cm-nav-link-text {
    color: var(--cm-text) !important;
  }
  .cm-menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
  }
}

/* Animated dropdown menu (fade + slide down) */
.cm-dropdown-menu {
  transform-origin: top center;
  animation: cm-dropdown-in 0.16s var(--cm-ease) both;
}
@keyframes cm-dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  button:hover,
  [role='button']:hover {
    transform: none;
  }
}

/* --- TV / D-pad mode ----------------------------------------------------- */
html.tv-mode [tabindex]:focus,
html.tv-mode button:focus,
html.tv-mode a:focus,
html.tv-mode [role='button']:focus,
html.tv-mode input:focus,
html.tv-mode textarea:focus {
  outline: 3px solid var(--cm-focus);
  outline-offset: 3px;
}
html.tv-mode [tabindex]:focus {
  filter: brightness(1.08);
}
html.tv-mode button:hover,
html.tv-mode a:hover,
html.tv-mode [role='button']:hover {
  transform: none;
}
/* Hide the mouse cursor-based hover lift for focus-driven navigation */
.tv-navigable {
  transition: transform 0.15s ease, filter 0.15s ease;
}
html.tv-mode .tv-navigable:focus {
  transform: scale(1.04);
  z-index: 5;
}

/* Player controls: make focus obvious on dark video */
html.tv-mode video { outline: none !important; }
