/* Global styles */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
  overscroll-behavior-y: none;
}

body::-webkit-scrollbar {
  display: none;
}

body {
  scroll-snap-type: y mandatory;
  scroll-snap-stop: always;
  max-height: 100dvh;
}

/* Section layout */
.section {
  position: relative;
  width: 100vw;
  min-height: 100dvh;
  height: auto;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  overflow: hidden;
}

.section:nth-child(even) {
  background: #d0e0ff;
}
.section:nth-child(odd) {
  background: #f0f0f0;
}

/* Parallax layers */
.parallax-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  pointer-events: none;
  will-change: transform;
}

.parallax-layer.background {
  z-index: 0;
}
.parallax-layer.midground {
  z-index: 1;
}
.parallax-layer.foreground {
  z-index: 2;
}

.section-content {
  position: relative;
  z-index: 3;
  opacity: 0.3;
  transform: scale(0.95);
  transition: opacity 0.5s ease, transform 0.5s ease;
  will-change: opacity, transform;
}

.section.active .section-content {
  opacity: 1 !important;
  transform: scale(1) !important;
}

/* Foreground parallax elements */
.parallax {
  position: relative;
  z-index: 4;
  font-size: 3rem;
  opacity: 0.7;
  pointer-events: none;
  transition: transform 0.3s ease-out;
}

/* Grid toggle button */
#gridToggle {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: #000;
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 1000;
  transition: transform 0.3s ease, background-color 0.3s ease;
}

#gridToggle:hover {
  transform: scale(1.1) rotate(5deg);
  background-color: #333;
}

/* Blur sections when grid is open */
body.grid-open .section,
body.grid-open #gridToggle {
  filter: blur(5px);
  pointer-events: none;
  user-select: none;
}

/* Grid overlay */
#sectionGrid {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  place-content: center;
  place-items: center;
  padding: 2rem;
  gap: 2rem;
  z-index: 999;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  backdrop-filter: blur(5px);
  animation: fadeInGrid 0.4s ease forwards;
}

#sectionGrid.active {
  display: grid;
}

@keyframes fadeInGrid {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.grid-item {
  width: 150px;
  height: 150px;
  background: #fff;
  color: #000;
  border-radius: 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.3s ease;
}

.grid-item:hover {
  transform: scale(1.08);
}

.preview-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.preview-label {
  font-size: 0.9rem;
}

#gridClose {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  color: white;
  font-size: 2rem;
  border: none;
  cursor: pointer;
  z-index: 1001;
  transition: transform 0.2s ease;
}

#gridClose:hover {
  transform: scale(1.2);
}

/* Section loader spinner */
.section-loader {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.scroll-note {
  position: fixed;
  z-index: 500; /* Ensure it's above other content */
  color: black; /* Set text color to black */
  padding: 1rem;
  font-size: 1.2rem;
  font-weight: bold;
  display: none; /* Hidden by default, shown when needed */
  text-align: center;
  line-height: 1.2;
  top: 1rem;
  right: 1rem;
  cursor: default;
}

/* Stack words vertically */
.bounce-word {
  display: block; /* Stack the words vertically */
  animation: bounceUp 1s ease-in-out infinite; /* Apply bounce animation */
}

/* Adjusted bounce up animation without affecting opacity */
@keyframes bounceUp {
  0% {
    transform: translateY(0); /* Start position */
  }
  50% {
    transform: translateY(-10px); /* Move up */
  }
  100% {
    transform: translateY(0); /* Return to original position */
  }
}

/* Positioning for scroll notes */
#scrollNoteUp {
  top: 1rem;
  right: 1rem;
}

#scrollNoteDown {
  bottom: 1rem;
  right: 1rem;
}



