/* ==========================================================================
   The Secret Library.
   --------------------------------------------------------------------------
   The words drift, but they stay READABLE. Text that sails across the screen
   looks clever for four seconds and then cannot be read at all, which defeats
   the point of writing any. So each line keeps its place in the page and only
   breathes: a few pixels of movement over many seconds, out of step with its
   neighbours.

   No JavaScript. The whole effect is six CSS animations.
   ========================================================================== */

.shelf {
  width: 100%;
  max-width: 36em;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 26px;
  /* Room for the drift, so nothing clips at the edges. */
  padding: 10px 6px;
}

.float {
  margin: 0;
  font-family: var(--body);
  font-size: 1.06rem;
  line-height: 1.55;
  color: #cfc4f6;
  text-wrap: pretty;
  text-shadow: 0 0 18px rgba(182, 129, 255, 0.28);
  will-change: transform, opacity;
}

/* Alternating indents, so the column reads as scattered pages rather than a
   tidy list, without any of them leaving the flow of the page. */
.float:nth-child(odd)  { margin-left: 0;    margin-right: 2.2em; }
.float:nth-child(even) { margin-left: 2.2em; margin-right: 0; text-align: right; }

/* Six slow, shallow drifts. Long periods and prime-ish durations keep them
   from falling into step with one another. */
@keyframes drift1 { 0%,100% { transform: translate3d(0,0,0);        opacity: .84 }
                    50%     { transform: translate3d(3px,-7px,0);   opacity: 1   } }
@keyframes drift2 { 0%,100% { transform: translate3d(0,0,0);        opacity: .78 }
                    50%     { transform: translate3d(-5px,5px,0);   opacity: .98 } }
@keyframes drift3 { 0%,100% { transform: translate3d(0,-4px,0);     opacity: .9  }
                    50%     { transform: translate3d(4px,4px,0);    opacity: .72 } }
@keyframes drift4 { 0%,100% { transform: translate3d(0,0,0);        opacity: .8  }
                    50%     { transform: translate3d(-3px,-6px,0);  opacity: 1   } }
@keyframes drift5 { 0%,100% { transform: translate3d(2px,0,0);      opacity: .88 }
                    50%     { transform: translate3d(-4px,-3px,0);  opacity: .7  } }
@keyframes drift6 { 0%,100% { transform: translate3d(0,3px,0);      opacity: .76 }
                    50%     { transform: translate3d(5px,-4px,0);   opacity: .96 } }

.float[data-drift="1"] { animation: drift1 17s ease-in-out infinite;    }
.float[data-drift="2"] { animation: drift2 23s ease-in-out infinite -3s; }
.float[data-drift="3"] { animation: drift3 19s ease-in-out infinite -7s; }
.float[data-drift="4"] { animation: drift4 29s ease-in-out infinite -2s; }
.float[data-drift="5"] { animation: drift5 21s ease-in-out infinite -11s;}
.float[data-drift="6"] { animation: drift6 26s ease-in-out infinite -5s; }

.aside {
  max-width: 34em;
  margin-inline: auto;
  color: var(--text-dim);
  font-size: 0.95rem;
  text-align: center;
}

@media (min-width: 480px) {
  .float { font-size: 1.14rem; }
  .float:nth-child(odd)  { margin-right: 3.5em; }
  .float:nth-child(even) { margin-left: 3.5em; }
}

/* --------------------------------------------------------------------------
   Reduced motion: the words hold still. Every line is already real text in
   the page, so nothing is lost but the movement - which is the whole point
   of doing it this way rather than with absolute positioning.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .float {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
}
