/* ============================================================
   base.css — reset, page canvas, typography, keyframes, utilities
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-1);
  background:
    radial-gradient(1100px 700px at 12% -8%, rgba(242, 193, 78, 0.06), transparent 60%),
    radial-gradient(900px 600px at 108% 112%, rgba(120, 90, 255, 0.05), transparent 55%),
    var(--bg-0);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Ambient glow layer, repainted by js/search.js when a poster is found */
.ambient {
  position: fixed;
  inset: 0;
  z-index: var(--z-ambient);
  pointer-events: none;
  background:
    radial-gradient(1000px 620px at 25% 8%, rgba(242, 193, 78, 0.09), transparent 62%),
    radial-gradient(900px 560px at 85% 95%, rgba(242, 193, 78, 0.06), transparent 62%);
  transition: background 0.7s ease;
}

.app-shell {
  position: relative;
  z-index: 1;
}

/* Film grain overlay for a cinematic texture */
.grain {
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.7'/%3E%3C/svg%3E");
}

/* ---- Typography ---- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

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

button {
  font-family: inherit;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--bg-3);
  border-radius: 99px;
  border: 2px solid var(--bg-0);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-border);
}

/* ---- Focus ring ---- */
:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---- Keyframes ---- */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

@keyframes spotlightIn {
  from { opacity: 0; transform: translateY(22px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

@keyframes toastProgress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50%      { box-shadow: 0 0 0 5px transparent; }
}

/* ---- Utilities ---- */
/* The hidden attribute always wins over any display utility/component style */
[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.star-glyph {
  color: var(--star);
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
