:root {
  --cream: #fff8e7;
  --soft-pink: #ffe4e1;
  --sky-blue: #e0f4ff;
  --mint: #e8f8f5;
  --coral: #ff6b6b;
  --sunshine: #ffd93d;
  --lavender: #e8d5e7;
  --forest: #6bcb77;
  --text-dark: #4a4a4a;
  --shadow-soft: rgba(0, 0, 0, 0.08);
  --page-shadow: rgba(0, 0, 0, 0.15);
}

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

.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--coral);
  color: white;
  padding: 10px 20px;
  z-index: 9999;
  font-family: 'Baloo 2', cursive;
  font-size: 1rem;
  border-radius: 0 0 8px 0;
  text-decoration: none;
}
.skip-link:focus {
  top: 0;
}

body {
  font-family: 'Fredoka', sans-serif;
  background: linear-gradient(
    135deg,
    var(--sky-blue) 0%,
    var(--soft-pink) 50%,
    var(--lavender) 100%
  );
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-x: hidden;
}

/* Floating decorations */
.decoration {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

.star {
  width: 20px;
  height: 20px;
  background: var(--sunshine);
  clip-path: polygon(
    50% 0%,
    61% 35%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2% 35%,
    39% 35%
  );
  animation: twinkle 3s ease-in-out infinite;
}
.star:nth-child(1) {
  top: 10%;
  left: 5%;
  animation-delay: 0s;
}
.star:nth-child(2) {
  top: 20%;
  right: 8%;
  animation-delay: 0.5s;
  width: 15px;
  height: 15px;
}
.star:nth-child(3) {
  top: 60%;
  left: 3%;
  animation-delay: 1s;
}
.star:nth-child(4) {
  bottom: 15%;
  right: 5%;
  animation-delay: 1.5s;
  width: 25px;
  height: 25px;
}
.star:nth-child(5) {
  top: 40%;
  right: 3%;
  animation-delay: 2s;
  width: 12px;
  height: 12px;
}

.cloud {
  background: white;
  border-radius: 50px;
  position: fixed;
  opacity: 0.4;
  animation: float 20s ease-in-out infinite;
}
.cloud::before,
.cloud::after {
  content: '';
  background: white;
  border-radius: 50%;
  position: absolute;
}
.cloud:nth-child(6) {
  width: 80px;
  height: 30px;
  top: 8%;
  left: 15%;
}
.cloud:nth-child(6)::before {
  width: 40px;
  height: 40px;
  top: -20px;
  left: 10px;
}
.cloud:nth-child(6)::after {
  width: 30px;
  height: 30px;
  top: -15px;
  left: 40px;
}

.cloud:nth-child(7) {
  width: 100px;
  height: 35px;
  top: 12%;
  right: 20%;
  animation-delay: -5s;
}
.cloud:nth-child(7)::before {
  width: 50px;
  height: 50px;
  top: -25px;
  left: 15px;
}
.cloud:nth-child(7)::after {
  width: 35px;
  height: 35px;
  top: -18px;
  left: 55px;
}

@keyframes twinkle {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.2) rotate(15deg);
    opacity: 1;
  }
}
@keyframes float {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(30px);
  }
}

/* Book container */
.book-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 970px;
  perspective: 2000px;
}

.book-title {
  font-family: 'Baloo 2', cursive;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  color: var(--coral);
  text-align: center;
  margin-bottom: 20px;
  text-shadow:
    3px 3px 0 var(--sunshine),
    5px 5px 10px var(--shadow-soft);
  animation: bounceIn 0.8s ease-out;
}
@keyframes bounceIn {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* The book */
.book {
  background: linear-gradient(145deg, #8b4513, #654321);
  border-radius: 8px 20px 20px 8px;
  padding: 15px 15px 15px 25px;
  box-shadow:
    inset -5px 0 15px rgba(0, 0, 0, 0.3),
    0 20px 60px var(--page-shadow),
    0 0 0 3px #5d3a1a;
  position: relative;
}
.book::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  background: linear-gradient(to right, #3d2817, #5d3a1a);
  border-radius: 2px;
}

@keyframes pageFlip {
  0% {
    transform: rotateY(-10deg);
    opacity: 0;
  }
  100% {
    transform: rotateY(0);
    opacity: 1;
  }
}

/* Page decorative corner */
.page::before {
  content: '';
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, transparent 50%, var(--soft-pink) 50%);
  border-radius: 0 10px 0 0;
  opacity: 0.5;
}

/* Top links */
.top-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.link-btn {
  background: white;
  border: 3px solid var(--lavender);
  color: var(--text-dark);
  padding: 10px 16px;
  font-family: 'Baloo 2', cursive;
  font-size: 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 18px var(--shadow-soft);
  transition:
    transform 0.15s ease,
    border-color 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.link-btn:hover {
  transform: translateY(-1px);
  border-color: var(--coral);
}
.link-btn:active {
  transform: translateY(2px);
}
.link-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Screen-reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Responsive - shared */
@media (max-width: 768px) {
  .book {
    padding: 10px 10px 10px 20px;
  }
}

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