:root {
  /* Colors */
  --bg-base: #0a0a0a;
  --bg-overlay: rgba(10, 10, 10, 0.95);
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0a0;
  --accent-crimson: #8b0000;
  --accent-purple: #4b0082;
  --accent-slate: #708090;
  --border-subtle: rgba(255, 255, 255, 0.1);

  /* Effects */
  --glow-crimson: 0 0 20px rgba(139, 0, 0, 0.4);
  --glow-purple: 0 0 20px rgba(75, 0, 130, 0.4);
  --glow-slate: 0 0 20px rgba(112, 128, 144, 0.4);

  /* Layout */
  --nav-height: 80px;
  --content-width: 800px;
  --header-zIndex: 1000;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: "Inter", system-ui, sans-serif;
  line-height: 1.7;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Cinematic Atmosphere Overlays */
body::before {
  content: ""; /* Vignette */
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, transparent 40%, #000 100%);
  pointer-events: none;
  z-index: 900;
  opacity: 0.8;
}

body::after {
  content: ""; /* Film Grain */
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 901;
  opacity: 0.05;
}

/* Typography */
h1,
h2,
h3,
h4,
.story-text,
.drop-cap {
  font-family: "Playfair Display", serif;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

h2 {
  font-size: 2rem;
  margin-top: 3rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

p {
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
  color: #d3d3d3;
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: #ffffff;
}

/* Navigation */
header {
  position: fixed;
  top: 0;
  width: 100%;
  height: var(--nav-height);
  z-index: var(--header-zIndex);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5%;
  transition: background 0.4s ease, backdrop-filter 0.4s ease;
  border-bottom: 1px solid transparent;
}

header.scrolled {
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.logo {
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 700;
}

.logo a {
  display: flex;
  align-items: center;
  gap: 15px;
  text-decoration: none;
  color: inherit;
}

.logo img {
  height: 40px;
  width: auto;
  border-radius: 2px;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 2rem;
}

nav a {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.7;
}

nav a:hover {
  opacity: 1;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

/* Hero Section */
.hero {
  height: 100vh;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 120%; /* For parallax */
  background-size: cover;
  background-position: center;
  z-index: -1;
  transform: translateZ(0); /* Optimize rendering */
  transition: transform 0.1s linear;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(10, 10, 10, 0.3),
    rgba(10, 10, 10, 1)
  );
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  padding: 2rem;
  opacity: 0; /* Animated in JS */
}

/* Category Cards */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  padding: 4rem 5%;
  max-width: 1400px;
  margin: 0 auto;
}

.card {
  position: relative;
  height: 400px;
  border-radius: 4px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  transition: transform 0.5s ease, box-shadow 0.5s ease;
}

.card-bg {
  position: absolute;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transition: transform 0.7s ease;
}

.card-overlay {
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
  z-index: 1;
}

.card-content {
  position: absolute;
  bottom: 0;
  padding: 2rem;
  z-index: 2;
  transform: translateY(10px);
  transition: transform 0.5s ease;
}

.card:hover {
  transform: translateY(-5px);
}

.card:hover .card-bg {
  transform: scale(1.1);
}

.card:hover .card-content {
  transform: translateY(0);
}

.card h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* Glowing Borders for Categories */
.card.crime:hover {
  box-shadow: var(--glow-crimson);
  border-color: var(--accent-crimson);
}
.card.horror:hover {
  box-shadow: var(--glow-purple);
  border-color: var(--accent-purple);
}
.card.mystery:hover {
  box-shadow: var(--glow-slate);
  border-color: var(--accent-slate);
}

/* Story Reading Layout */
.story-container {
  max-width: var(--content-width);
  margin: -100px auto 5rem; /* Overlap hero */
  padding: 3rem;
  position: relative;
  z-index: 10;
  background: var(--bg-base);
  box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-subtle);
}

.drop-cap {
  float: left;
  font-size: 5rem;
  line-height: 0.8;
  padding-right: 1rem;
  padding-top: 0.5rem;
  color: var(--text-primary);
}

/* Progress Bar */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--accent-crimson);
  width: 0%;
  z-index: 2000;
  transition: width 0.1s linear;
}

/* Footer */
footer {
  border-top: 1px solid var(--border-subtle);
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.footer-links {
  margin-bottom: 2rem;
}

.footer-links a {
  margin: 0 1rem;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
}

/* Mobile */
@media (max-width: 768px) {
  h1 {
    font-size: 2.5rem;
  }
  .hero-content {
    padding: 1rem;
  }
  .story-container {
    padding: 1.5rem;
    margin-top: -50px;
  }
  nav ul {
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
  }
}
