/* ═══════════════════ CSS Variables ═══════════════════ */
:root {
  --bg-primary: #0A0908;
  --bg-secondary: #131211;
  --bg-tertiary: #1C1A18;
  --bg-map: #161412;
  --accent-red: #8B1A1A;
  --accent-gold: #C8A45C;
  --accent-amber: #D4953A;
  --text-primary: #E8E2D9;
  --text-secondary: #9A9590;
  --text-dim: #5C5854;
  --border-subtle: #2A2725;
  --border-glow: #3D3530;
  --radius: 0.25rem;
}

/* ═══════════════════ Base ═══════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  border-color: var(--border-subtle);
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: 'Playfair Display', serif;
  color: var(--text-primary);
  margin: 0;
}

h4, h5, h6 {
  font-family: 'Inter', sans-serif;
  margin: 0;
}

p {
  margin: 0;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ═══════════════════ Typography helpers ═══════════════════ */
.font-display { font-family: 'Playfair Display', serif; }
.font-body { font-family: 'Inter', sans-serif; }
.font-mono { font-family: 'IBM Plex Mono', monospace; }

/* ═══════════════════ Buttons ═══════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  background-color: var(--accent-gold);
  color: var(--bg-primary);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: var(--radius);
  transition: all 0.2s ease-out;
}

.btn-primary:hover {
  background-color: #D4B76A;
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(200, 164, 92, 0.2);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background-color: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: var(--radius);
  transition: all 0.2s ease-out;
}

.btn-secondary:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

/* ═══════════════════ Cards ═══════════════════ */
.card-episode {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all 0.3s ease-out;
}

.card-episode:hover {
  border-color: #3D3530;
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* ═══════════════════ Film grain overlay ═══════════════════ */
.film-grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.08;
  mix-blend-mode: overlay;
}

.film-grain-overlay::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  animation: film-grain 0.5s steps(3) infinite;
}

/* ═══════════════════ Animations ═══════════════════ */
@keyframes film-grain {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(-2%, -2%); }
  66% { transform: translate(2%, 1%); }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes gradientPulse {
  0%, 100% { opacity: 0.06; }
  50% { opacity: 0.1; }
}

.animate-fade-in {
  animation: fadeInUp 0.6s ease-out forwards;
}

.animate-gradient-pulse {
  animation: gradientPulse 4s infinite;
}

/* Scroll reveal base state */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* FAQ accordion */
.faq-answer {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.25s ease-out, opacity 0.25s ease-out;
}

.faq-item.open .faq-answer {
  max-height: 500px;
  opacity: 1;
}

.faq-item.open .faq-chevron {
  transform: rotate(180deg);
}

.faq-chevron {
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-color: rgba(6, 6, 8, 0.85);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: 100%;
  max-width: 420px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  padding: 1.5rem;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.modal-backdrop.active .modal-content {
  transform: scale(1);
}

/* Form inputs */
.form-input {
  width: 100%;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease;
}

.form-input::placeholder {
  color: var(--text-dim);
}

.form-input:focus {
  border-color: var(--accent-gold);
}

/* Utility */
.text-balance {
  text-wrap: balance;
}

/* Mobile menu */
.mobile-menu {
  display: none;
}

.mobile-menu.open {
  display: block;
}

/* Responsive helpers */
@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .hide-desktop {
    display: none !important;
  }
}

/* Line clamp fallback for older Tailwind CDN builds */
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

/* Performance cards: image visible, content on hover (desktop) / below (mobile) */
.card-performance {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-glow);
}

.card-image {
  position: relative;
  aspect-ratio: 1 / 1;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease-out;
}

.card-content {
  padding: 1.25rem;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
}

@media (hover: hover) and (pointer: fine) {
  .card-performance {
    aspect-ratio: 1 / 1;
  }

  .card-content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(10, 9, 8, 0.98) 0%, rgba(10, 9, 8, 0.92) 55%, rgba(10, 9, 8, 0.6) 80%, transparent 100%);
    border-top: none;
    padding-top: 4.5rem;
    transform: translateY(100%);
    transition: transform 0.35s ease-out;
  }

  .card-performance:hover .card-content,
  .card-performance:focus-within .card-content {
    transform: translateY(0);
  }

  .card-performance:hover .card-image img,
  .card-performance:focus-within .card-image img {
    transform: scale(1.05);
  }
}

/* Mobile adaptations */
@media (max-width: 767px) {
  .card-content {
    padding: 1rem;
  }
}
