/* Add this new style for the staged link animation */
.book-link {
    display: inline-block;
    color: #00ffff;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 16px;
    padding: 20px 45px;
    border: 3px solid #00ffff;
    background: rgba(3, 5, 7, 0.85);
    transition: all 0.4s ease;
    text-shadow: 0 0 15px #00ffff, 0 0 30px #00ffff;
    box-shadow: 0 0 40px rgba(0, 255, 255, 0.3);
    animation: linkPulse 2.5s infinite;
    backdrop-filter: blur(5px);
    font-weight: 800;
    border-radius: 10px;
    
    /* Start at stage 1 - small but readable */
    font-size: 0.5rem;
    transform: scale(0.3);
    opacity: 0.9;
}

.book-link.stage-1 {
    font-size: 0.5rem;
    transform: scale(0.3);
    letter-spacing: 4px;
    padding: 8px 16px;
}

.book-link.stage-2 {
    font-size: 0.7rem;
    transform: scale(0.45);
    letter-spacing: 6px;
    padding: 10px 20px;
}

.book-link.stage-3 {
    font-size: 0.9rem;
    transform: scale(0.6);
    letter-spacing: 8px;
    padding: 12px 25px;
}

.book-link.stage-4 {
    font-size: 1.1rem;
    transform: scale(0.75);
    letter-spacing: 10px;
    padding: 14px 30px;
}

.book-link.stage-5 {
    font-size: 1.3rem;
    transform: scale(0.9);
    letter-spacing: 12px;
    padding: 16px 35px;
}

.book-link.stage-6 {
    font-size: 1.6rem;
    transform: scale(1);
    letter-spacing: 14px;
    padding: 18px 40px;
}

.book-link.stage-7 {
    font-size: 1.8rem;
    transform: scale(1);
    letter-spacing: 15px;
    padding: 19px 42px;
}

.book-link.stage-8 {
    font-size: 2rem;
    transform: scale(1);
    letter-spacing: 16px;
    padding: 20px 45px;
}

/* ============== SYNTAX - DARK LIGHT BEAM EFFECT ============== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #030507;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(100, 0, 200, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(0, 100, 200, 0.08) 0%, transparent 45%),
        radial-gradient(circle at 40% 20%, rgba(200, 0, 100, 0.05) 0%, transparent 35%);
    min-height: 100vh;
    font-family: 'Courier New', monospace;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.loading-message{
  position: fixed;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 120;
  pointer-events: none;
  white-space: nowrap;
  font-size: clamp(12px, 1.4vw, 18px);
  letter-spacing: .28em;
  text-transform: uppercase;
  color: rgba(180, 130, 255, 0.9);
  text-shadow:
    0 0 8px rgba(140, 0, 255, 0.55),
    0 0 18px rgba(100, 0, 255, 0.45);
  animation: darkBlink 2.2s infinite;
  background: rgba(3, 5, 7, 0.85);
  padding: 10px 16px;
  border-radius: 16px;
  border: 1px solid rgba(180, 130, 255, 0.40);
  box-shadow: 0 0 26px rgba(140, 0, 255, 0.25);
  backdrop-filter: blur(6px);
}

@keyframes darkBlink {
    0%, 100% { 
        opacity: 1; 
        text-shadow: 0 0 15px #b082ff, 0 0 30px #8a5cff, 0 0 60px #4a1aff;
        border-color: rgba(180, 130, 255, 0.7);
    }
    50% { 
        opacity: 0.5; 
        text-shadow: 0 0 8px #6a3bc0, 0 0 15px #4a1a9e;
        border-color: rgba(120, 70, 200, 0.3);
    }
}

@media (max-width: 520px){
  .loading-message{
    white-space: normal;
    text-align: center;
    max-width: calc(100vw - 28px);
  }
}

.image-container {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(12, 1fr);
    width: 100%;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    gap: 1px;
    background-color: #000000;
}

/* SYNTAX DARK LIGHT BEAM EFFECT - Core piece styling */
.grid-piece {
    background-size: cover;
    background-repeat: no-repeat;
    opacity: 0;
    transform: scale(0.98);
    transition: opacity 0.9s cubic-bezier(0.19, 1, 0.22, 1), 
                transform 0.9s cubic-bezier(0.19, 1, 0.22, 1),
                filter 0.8s ease;
    filter: brightness(0.3) saturate(0.8) contrast(1.2) blur(2px);
    border: 1px solid rgba(180, 130, 255, 0);
    box-shadow: 0 0 5px rgba(180, 130, 255, 0);
    will-change: transform, opacity, filter;
    position: relative;
    overflow: hidden;
}

/* The beam effect - dark light reveal */
.grid-piece.visible {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1.1) saturate(1.4) contrast(1.15) blur(0px);
    border: 1px solid rgba(180, 130, 255, 0.4);
    box-shadow: 0 0 20px rgba(180, 130, 255, 0.5),
                inset 0 0 15px rgba(255, 255, 255, 0.1);
    animation: darkLightPulse 4s infinite;
}

/* Dark light pulse animation */
@keyframes darkLightPulse {
    0%, 100% { 
        filter: brightness(1.1) saturate(1.4) contrast(1.15);
        border-color: rgba(180, 130, 255, 0.4);
        box-shadow: 0 0 20px rgba(180, 130, 255, 0.5);
    }
    50% { 
        filter: brightness(1.2) saturate(1.6) contrast(1.2);
        border-color: rgba(220, 180, 255, 0.7);
        box-shadow: 0 0 35px rgba(200, 150, 255, 0.7);
    }
}

/* Add a subtle beam overlay effect */
.grid-piece.visible::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, 
                rgba(200, 180, 255, 0.1) 0%, 
                rgba(100, 50, 200, 0.05) 50%,
                transparent 80%);
    pointer-events: none;
    opacity: 0.7;
    animation: beamShift 8s infinite alternate;
}

@keyframes beamShift {
    0% { opacity: 0.4; background-position: 0% 0%; }
    100% { opacity: 0.8; background-position: 100% 100%; }
}

/* Size classes remain the same */
.grid-piece.size-2x2 {
    grid-column: span 2;
    grid-row: span 2;
}

.grid-piece.size-2x1 {
    grid-column: span 2;
    grid-row: span 1;
}

.grid-piece.size-1x2 {
    grid-column: span 1;
    grid-row: span 2;
}

.grid-piece.size-3x2 {
    grid-column: span 3;
    grid-row: span 2;
}

.grid-piece.size-2x3 {
    grid-column: span 2;
    grid-row: span 3;
}

.grid-piece.size-3x3 {
    grid-column: span 3;
    grid-row: span 3;
}

.loaded-content {
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 200;
}

.book-link:hover {
    background: #b082ff;
    color: #030507;
    box-shadow: 0 0 80px #b082ff, 0 0 120px rgba(180, 130, 255, 0.5);
    letter-spacing: 22px;
    border-color: #ffffff;
    transform: scale(1.08);
}

@keyframes linkPulse {
    0%, 100% { 
        box-shadow: 0 0 40px rgba(180, 130, 255, 0.3);
        border-color: #b082ff;
    }
    50% { 
        box-shadow: 0 0 70px rgba(200, 150, 255, 0.6);
        border-color: #d8b2ff;
    }
}

.hidden {
    opacity: 0 !important;
    pointer-events: none;
    transition: opacity 1s;
    display: block !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .loading-message {
        font-size: 1.8rem;
        letter-spacing: 6px;
        padding: 15px 25px;
        white-space: normal;
        text-align: center;
        width: 90%;
    }
    
    .image-grid {
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: repeat(6, 1fr);
    }
    
    .book-link.stage-1 {
        font-size: 0.4rem;
        letter-spacing: 2px;
        padding: 6px 12px;
    }
    
    .book-link.stage-2 {
        font-size: 0.5rem;
        letter-spacing: 3px;
        padding: 7px 14px;
    }
    
    .book-link.stage-3 {
        font-size: 0.6rem;
        letter-spacing: 4px;
        padding: 8px 16px;
    }
    
    .book-link.stage-4 {
        font-size: 0.8rem;
        letter-spacing: 5px;
        padding: 10px 18px;
    }
    
    .book-link.stage-5 {
        font-size: 0.9rem;
        letter-spacing: 6px;
        padding: 12px 20px;
    }
    
    .book-link.stage-6 {
        font-size: 1.0rem;
        letter-spacing: 7px;
        padding: 13px 22px;
    }
    
    .book-link.stage-7 {
        font-size: 1.1rem;
        letter-spacing: 7px;
        padding: 14px 23px;
    }
    
    .book-link.stage-8 {
        font-size: 1.2rem;
        letter-spacing: 8px;
        padding: 15px 25px;
    }
}

@media (min-width: 1920px) {
    .loading-message {
        font-size: 4rem;
        letter-spacing: 16px;
    }
    
    .book-link.stage-8 {
        font-size: 2.5rem;
        letter-spacing: 20px;
    }
}

.audio-controls{
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 300;
  display: flex;
  gap: 10px;
}

.audio-btn{
  border: 2px solid rgba(180,130,255,.45);
  background: rgba(3,5,7,.75);
  color: #b082ff;
  padding: 10px 14px;
  border-radius: 6px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 25px rgba(180,130,255,.15);
}

.audio-btn.ghost{
  background: transparent;
}

.audio-btn:hover{
  box-shadow: 0 0 45px rgba(180,130,255,.35);
}

.dom-title{
  position: fixed;
  left: 50%;
  top: 34%;
  transform: translate(-50%, -50%);
  z-index: 230;
  text-align: center;
  pointer-events: none;
  padding: 28px 40px;
  border-radius: 22px;
  background: rgba(3,5,7,.65);
  border: 1px solid rgba(180,130,255,.25);
  backdrop-filter: blur(10px);
  box-shadow: 0 0 50px rgba(180,130,255,.15);
  transition: opacity 1.5s ease, transform 1.5s ease;
}

.dom-title-main{
  font-weight: 800;
  letter-spacing: .30em;
  text-transform: uppercase;
  font-size: clamp(28px, 4.2vw, 64px);
  color: rgba(255,255,255,.92);
  text-shadow: 0 0 30px rgba(180,130,255,.25);
}

.dom-title-main:first-of-type {
    color: rgba(220, 190, 255, 0.95);
    text-shadow: 0 0 30px rgba(180, 130, 255, 0.5);
}

.dom-title-sub{
  margin-top: 10px;
  font-size: 12px;
  letter-spacing: .30em;
  text-transform: uppercase;
  color: rgba(200,180,255,.72);
}

#loadedContent{
  opacity: 0;
  transform: translate(-50%, -50%) translateY(14px);
  transition: opacity 900ms ease, transform 900ms ease;
  will-change: opacity, transform;
}

#loadedContent.show{
  opacity: 1;
  transform: translate(-50%, -50%) translateY(0);
}
/* ============== VISIBLE DARK LIGHT BEAM ============== */
.dark-beam {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, 
        rgba(180, 130, 255, 0.25) 0%,
        rgba(140, 80, 220, 0.15) 25%,
        rgba(100, 50, 180, 0.08) 50%,
        rgba(60, 30, 120, 0.03) 75%,
        transparent 100%
    );
    box-shadow: 
        0 0 80px rgba(180, 130, 255, 0.3),
        0 0 150px rgba(140, 80, 220, 0.2),
        inset 0 0 60px rgba(200, 160, 255, 0.2);
    animation: beamBreath 3s infinite alternate;
    mix-blend-mode: screen;
}

.dark-beam::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(220, 190, 255, 0.4) 0%,
        rgba(180, 130, 255, 0.2) 50%,
        transparent 100%
    );
    filter: blur(10px);
}

@keyframes beamBreath {
    0% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

/* Make the beam more intense on visible pieces near it */
.grid-piece.visible {
    box-shadow: 0 0 30px rgba(180, 130, 255, 0.6);
    transition: box-shadow 0.3s ease;
}