* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;

  touch-action: manipulation;

  overscroll-behavior: none;

  -webkit-overflow-scrolling: touch;
}

body {
  min-height: 100dvh;

  background: #050505;

  font-family: Georgia, serif;

  color: white;

  position: relative;
}

/* SKY */

.sky {
  position: fixed;

  inset: 0;

  background: radial-gradient(
      circle at top,
      rgba(70, 90, 140, 0.15),
      transparent 60%
    ),
    linear-gradient(to bottom, #030303, #0b0b12, #161616);

  z-index: 0;
}

/* STARS */

.stars {
  position: fixed;

  inset: 0;

  background: radial-gradient(white, rgba(255, 255, 255, 0));

  background-size: 3px 3px;

  opacity: 0.25;

  animation: moveStars 120s linear infinite;

  z-index: 1;
}

/* FOG */

.fog {
  position: fixed;

  inset: -10%;

  background: radial-gradient(rgba(255, 255, 255, 0.03), transparent);

  filter: blur(60px);

  animation: moveFog 30s ease-in-out infinite alternate;

  z-index: 2;
}

/* MOON */

.moon {
  position: fixed;

  top: 70px;
  right: 10%;

  width: 140px;
  height: 140px;

  border-radius: 50%;

  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.9),
    rgba(255, 255, 255, 0.08)
  );

  box-shadow: 0 0 60px rgba(255, 255, 255, 0.2),
    0 0 120px rgba(255, 255, 255, 0.08);

  opacity: 0.7;

  animation: moonFloat 8s ease-in-out infinite;

  z-index: 1;
}

/* MOUNTAINS */

.mountains {
  position: fixed;

  bottom: 0;

  width: 100%;
  height: 280px;

  background: linear-gradient(to top, #111, transparent);

  z-index: 2;
}

/* HERO */

.hero {
  position: relative;

  z-index: 10;

  text-align: center;

  padding-top: 60px;

  animation: fadeIn 2s ease;
}

.hero h1 {
  font-size: 4rem;

  letter-spacing: 4px;

  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2),
    0 0 30px rgba(255, 255, 255, 0.1);
}

.hero p {
  margin-top: 12px;

  opacity: 0.75;

  font-size: 1.1rem;
}

/* READING CONTROLS */

.reading-controls {
  position: sticky;

  top: 10px;

  z-index: 100;

  display: flex;
  justify-content: center;
  align-items: center;

  gap: 15px;

  flex-wrap: wrap;

  width: fit-content;

  margin: 25px auto;

  padding: 15px 20px;

  border-radius: 15px;

  background: rgba(0, 0, 0, 0.35);

  backdrop-filter: blur(12px);
}

.reading-controls button {
  background: rgba(255, 255, 255, 0.08);

  border: 1px solid rgba(255, 255, 255, 0.08);

  color: white;

  padding: 10px 18px;

  border-radius: 10px;

  cursor: pointer;

  transition: 0.3s;
}

.reading-controls button:hover {
  transform: translateY(-2px);

  background: rgba(255, 255, 255, 0.15);
}

.reading-controls label {
  display: flex;
  align-items: center;

  gap: 10px;

  color: rgba(255, 255, 255, 0.85);
}

/* BOOK */

.book-wrapper {
  position: relative;

  z-index: 5;

  display: flex;
  justify-content: center;
  align-items: center;

  padding: 20px 20px 60px;
}

#book {
  width: 90vw;
  max-width: 1000px;

  height: 80vh;

  border-radius: 15px;

  box-shadow: 0 0 40px rgba(255, 255, 255, 0.05), 0 0 120px rgba(0, 0, 0, 0.8);

  animation: floatBook 5s ease-in-out infinite;

  filter: brightness(var(--brightness, 100%)) sepia(8%) contrast(102%);

  touch-action: pan-y;

  user-select: none;

  -webkit-user-select: none;

  -webkit-touch-callout: none;
}

/* PAGE */

.page {
  background: #f5f1e8;

  overflow: hidden;

  border: 1px solid rgba(0, 0, 0, 0.08);
}

.page canvas {
  width: 100%;
  height: 100%;
}

/* READING MODE */

.reading-mode .page {
  background: #f4ecd8 !important;

  box-shadow: inset 0 0 80px rgba(255, 180, 80, 0.08);
}

/* FOCUS MODE */

.focus-active .stars,
.focus-active .particles,
.focus-active .fog,
.focus-active .meteor-container,
.focus-active .embers,
.focus-active .cupids {
  opacity: 0.08;
}

.focus-active .hero {
  opacity: 0.2;
}

/* PARTICLES */

.particles::before,
.particles::after {
  content: "";

  position: fixed;

  inset: 0;

  background-image: radial-gradient(
    rgba(255, 255, 255, 0.3) 1px,
    transparent 1px
  );

  background-size: 50px 50px;

  animation: particlesMove 50s linear infinite;

  z-index: 1;
}

.particles::after {
  animation-duration: 80s;

  opacity: 0.4;
}

/* METEORS */

.meteor-container {
  position: fixed;

  inset: 0;

  overflow: hidden;

  pointer-events: none;

  z-index: 2;
}

.meteor {
  position: absolute;

  width: 2px;
  height: 120px;

  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.9), transparent);

  transform: rotate(45deg);

  animation: meteorFall linear forwards;
}

/* EMBERS */

.embers {
  position: fixed;

  inset: 0;

  overflow: hidden;

  pointer-events: none;

  z-index: 2;
}

.ember {
  position: absolute;

  width: 4px;
  height: 4px;

  border-radius: 50%;

  background: rgba(255, 140, 80, 0.7);

  box-shadow: 0 0 10px rgba(255, 120, 60, 0.8);

  animation: emberFloat linear infinite;
}

/* CUPIDS */

.cupids {
  position: fixed;

  inset: 0;

  overflow: hidden;

  pointer-events: none;

  z-index: 2;
}

.cupid {
  position: absolute;

  font-size: 28px;

  opacity: 0.15;

  animation: cupidFly linear forwards;
}

/* ANIMATIONS */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floatBook {
  0% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-10px);
  }

  100% {
    transform: translateY(0px);
  }
}

@keyframes moveStars {
  from {
    background-position: 0 0;
  }

  to {
    background-position: -10000px 5000px;
  }
}

@keyframes moveFog {
  from {
    transform: translateX(-5%);
  }

  to {
    transform: translateX(5%);
  }
}

@keyframes particlesMove {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-1000px);
  }
}

@keyframes moonFloat {
  0% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-8px);
  }

  100% {
    transform: translateY(0px);
  }
}

@keyframes meteorFall {
  0% {
    transform: translate(0, 0) rotate(45deg);

    opacity: 0;
  }

  10% {
    opacity: 1;
  }

  100% {
    transform: translate(-800px, 800px) rotate(45deg);

    opacity: 0;
  }
}

@keyframes emberFloat {
  from {
    transform: translateY(100vh) translateX(0);

    opacity: 0;
  }

  20% {
    opacity: 1;
  }

  to {
    transform: translateY(-100px) translateX(60px);

    opacity: 0;
  }
}

@keyframes cupidFly {
  from {
    transform: translateX(110vw) translateY(0) scale(0.8);

    opacity: 0;
  }

  10% {
    opacity: 0.15;
  }

  100% {
    transform: translateX(-200px) translateY(-150px) scale(1.1);

    opacity: 0;
  }
}

/* MOBILE */

@media (max-width: 768px) {
  .hero h1 {
    font-size: 2.4rem;
  }

  #book {
    height: 70vh;

    animation: none;
  }

  .reading-controls {
    width: 95%;
  }

  .reading-controls label {
    flex-direction: column;
  }
}
