@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400..800;1,400..800&family=Henny+Penny&family=Trade+Winds&display=swap');

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #1a1a1a url('media/background.png') no-repeat center center fixed;
  background-size: cover;
  font-family: "EB Garamond", serif;
  color: #e7e5dc;
  overflow: hidden;
  position: relative;
}

.title {
  text-align: center;
  font-family: "Trade Winds", system-ui;
  font-weight: 400;
  font-style: normal;
  font-size: 4em;
  /*letter-spacing: 4px;*/
  color: #d4af37;
  margin-top: 2em;
  opacity: 0;
  animation: fadeTitle 8s infinite alternate;
}

@keyframes fadeTitle {
  0% { opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

.overlay {
  margin: 0 auto;
  max-width: 800px;
  padding-top: 8em; /* ADDED: push content down */
  padding-bottom: 8em; /* leave room for bottom glyphs */
  text-align: center;
}

.description {
  font-family: "Henny Penny", system-ui;
  font-weight: 400;
  font-style: normal;
  font-size: 2em;
}

.line {
  opacity: 0;
  transition: opacity 5s ease;
  font-size: 1.2em;
  margin: 0.5em 0;
}

.line.visible {
  opacity: 1;
}

.books {
  margin-top: 2em;
}

.book, .future {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;

  opacity: 0;
  display: inline-block;
  margin: 0.5em;
  font-size: 1.1em;
  color: #d4af37;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.6s ease;
}

.book:hover, .future:hover {
  opacity: 1 !important;
}

.future {
  color: #aaa;
}

.glyph {
  position: absolute;
  width: 80px;
  opacity: 0;
  animation: floatGlyphs 15s infinite;
}

.glyph1 {
  top: 10%;
  left: 20%;
  animation-delay: 0s;
}

.glyph2 {
  top: 60%;
  left: 70%;
  animation-delay: 3s;
}

.glyph3 {
  top: 30%;
  left: 50%;
  animation-delay: 6s;
}

@keyframes floatGlyphs {
  0%, 100% { opacity: 0; transform: scale(0.5) rotate(0deg); }
  10% { opacity: 0.3; transform: scale(0.7) rotate(10deg); }
  50% { opacity: 0.6; transform: scale(1) rotate(360deg); }
  90% { opacity: 0.3; transform: scale(0.7) rotate(10deg); }
}

.books {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1em;
  margin-top: 2em;
}

.book, .future {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;

  display: block;
  text-align: center;
}

@media (max-width: 768px) {
  .title {
    font-size: 2em;
  }

  .line, .book, .future {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;

    font-size: 1em;
  }

  .glyph {
    width: 50px;
  }

  .overlay {
    top: 20%;
    width: 90%;
  }
}

/* Book and future text scroll reveal */
.book, .future {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;

  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-prompt {
  position: absolute;
  bottom: 2vh;
  width: 100%;
  text-align: center;
  font-size: 1rem;
  color: #aaa;
  opacity: 0.7;
  animation: fadePulse 2s infinite;
  z-index: 20;
}

@keyframes fadePulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.3; }
}

.book, .future {
  opacity: 0;
  transition: opacity 0.6s ease;
}

.book.desktop-only:hover, .future.desktop-only:hover {
  opacity: 1 !important;
}

.book.mobile-only,
.future.mobile-only {
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  .book.desktop-only,
  .future.desktop-only {
    display: none;
  }

  .book.mobile-only,
  .future.mobile-only {
    display: block;
    opacity: 0;
    animation: fadeInMobile 2s ease forwards;
    animation-delay: 3s;
  }

  .book.mobile-only:nth-child(1) {
    animation-delay: 3s;
  }

  .book.mobile-only:nth-child(2) {
    animation-delay: 4.5s;
  }

  .future.mobile-only {
    animation-delay: 6s;
  }

  @keyframes fadeInMobile {
    to {
      opacity: 1;
    }
  }
}

.book-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 1em 0;
}

.book-toggle {
  position: relative;
  width: fit-content;
}

.book-toggle .glyph-hint,
.book-toggle .book,
.book-toggle .future {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  transition: opacity 0.6s ease;
}

/* Show glyphs by default */
.book-toggle .glyph-hint {
  opacity: 1;
  z-index: 1;
}

/* Hide books initially */
.book-toggle .book,
.book-toggle .future {
  opacity: 0;
  z-index: 2;
}

/* On hover: fade glyph out, text in */
.book-wrap:hover .glyph-hint {
  opacity: 0;
}

.book-wrap:hover .book,
.book-wrap:hover .future {
  opacity: 1;
}

.glyph-hint {
  position: absolute;
  top: 0;
  font-size: 1.1em;
  color: #777;
  opacity: 0;
  transition: opacity 0.6s ease;
  animation: fadeInHint 1s ease forwards;
  pointer-events: none;
}

.hint1 {
  animation-delay: 4s;
}
.hint2 {
  animation-delay: 5.5s;
}
.hint3 {
  animation-delay: 7s;
}

@keyframes fadeInHint {
  to {
    opacity: 1;
  }
}

.book.desktop-only:hover + .glyph-hint,
.future.desktop-only:hover + .glyph-hint {
  opacity: 0 !important;
}

.book.desktop-only:hover,
.future.desktop-only:hover {
  color: #d4af37;
}

.book.desktop-only,
.future.desktop-only {
  position: relative;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.book-wrap:hover .book.desktop-only,
.book-wrap:hover .future.desktop-only {
  opacity: 1;
}

.book-wrap:hover .glyph-hint {
  opacity: 0 !important;
}

/* Line-by-line fade-in using animation delays */
.line {
  opacity: 0;
  filter: blur(6px); /* start blurred */
  animation: fadeInLine 1.5s forwards;
  transition: filter 0.6s ease, opacity 0.6s ease;
  font-size: 1.2em;
  margin: 0.5em 0;
}
.line1 { animation-delay: 3s; }
.line2 { animation-delay: 5s; }
.line3 { animation-delay: 7s; }
.line4 { animation-delay: 9s; }

@keyframes fadeInLine {
   0% {
    opacity: 0;
    filter: blur(6px);
  }
  100% {
    opacity: 1;
    filter: blur(0px);
  }
}

/* Message cycling (replaces wild/ready JS) */
.message-toggle {
  position: relative;
  height: 3em;
  overflow: hidden;
  margin-top: 1em;
  font-size: 2em !important;
    color: #d4af37;
}

.message-toggle span {
  position: absolute;
  width: 100%;
  left: 0;
  top: 0;
  opacity: 0;
  animation: toggleText 12s infinite ease-in-out;
}

.message-toggle .lineOne {
  animation-delay: 12s;
}

.message-toggle .lineTwo {
  animation-delay: 16s;
}

/* 12s cycle: 5s delay, 3s display, 4s pause before next */
@keyframes toggleText {
  0%   { opacity: 0; filter: blur(12px); }
  5%   { opacity: 1; filter: blur(0px); }
  30%  { opacity: 1; filter: blur(0px); }
  35%  { opacity: 0; filter: blur(12px); }
  100% { opacity: 0; filter: blur(12px); }
}

.scroll-area {
  position: absolute;
  top: auto;
  bottom: 0;
  left: 0;
  right: 0;
  top: 6em; /* roughly match the height of the title + margin */
  height: calc(100% - 6em);
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 8em; /* adds breathing room to reach bottom glyphs */
  z-index: 5;
}




