/* ==========================================================================
   SECTION 1: DESIGN TOKENS & VARIABLES (:root)
   ========================================================================== */

:root {
  /* Dark wood background tone for primary UI surfaces */
  --bg-wood-dark: #1a0f0a;

  /* Mid wood background tone for secondary depth elements */
  --bg-wood-mid: #2c1a12;

  /* Primary gold accent color for borders and structural frames */
  --border-gold: #c89d38;

  /* Highlight gold accent color for inner borders and active states */
  --border-gold-light: #f3d078;

  /* Primary gold color for titles and key typography */
  --text-gold: #e2b755;

  /* Deep dark background color for the loading bar track channel */
  --track-bg: #120a06;
}


/* ==========================================================================
   SECTION 2: PAGE CONTAINER & STATE MANAGERS (#initscreen-page, .hidden)
   ========================================================================== */

/* 
 * Main Initialization Screen Container
 * Fills entire viewport/container and centers child elements dynamically.
 * Uses 4cqw (4% of Container Query Width) for fluid responsive padding.
 */
#initscreen-page {
  /* 1. Positioning */
  position: relative;
  z-index: 10;

  /* 2. Display & Flexbox/Grid */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  /* 3. Box Model & Dimensions */
  width: 100%;
  height: 100%;
  padding: 4cqw;

  /* 4. Typography */
  text-align: center;

  /* 5. Visual Styles */
  background-color: transparent;

  /* 6. Transitions & Animations */
  transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
}

/* 
 * Hidden State Modifier
 * Hides the container completely, disables interaction events,
 * and forces display: none for screen readers and layout flow.
 */
#initscreen-page.hidden {
  /* 2. Display & Flexbox/Grid */
  display: none !important;

  /* 5. Visual Styles */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}


/* ==========================================================================
   SECTION 3: CONTENT WRAPPER (.initscreen-content)
   ========================================================================== */

/* 
 * Main Content Container
 * Wraps title, subtitle, and progress bar components.
 * Width is set to a fluid 72cqw (72% of container width) with an 88cqw upper cap.
 */
.initscreen-content {
  /* 2. Display & Flexbox/Grid */
  display: flex;
  flex-direction: column;
  align-items: center;

  /* 3. Box Model & Dimensions */
  width: 72cqw;
  max-width: 88cqw;
}


/* ==========================================================================
   SECTION 4: TYPOGRAPHY (.initscreen-subtitle, .initscreen-title)
   ========================================================================== */

/* 
 * Screen Subtitle Text
 * Uses clamp() to fluidly scale font size between 0.825rem and 1.65rem based on 3.3cqw.
 * Uses 1cqh (1% container height) for dynamic bottom spacing.
 * Note: Do NOT add !important to `color` here, or it will block @keyframes color interpolation.
 */
.initscreen-subtitle {
  /* 3. Box Model & Dimensions */
  margin-bottom: 1cqh;

  /* 4. Typography */
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.825rem, 3.3cqw, 1.65rem);
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  text-shadow: 0 0.2cqh 0.4cqh rgba(0, 0, 0, 0.85);
  color: #8a6820;

  /* 6. Transitions & Animations */
  animation: subtitleGoldGlow 2.4s ease-in-out infinite alternate;
}

/* 
 * Main Game Title Typography
 * Scaled fluidly between 1.75rem and 3.8rem based on 8.5cqw (container width).
 * Uses background-clip: text with a multi-stop metallic gold gradient and specular
 * highlight sweep, paired with filter: drop-shadow() so depth shadows render cleanly
 * behind the transparent text fill.
 */
.initscreen-title {
  /* 3. Box Model & Dimensions */
  margin-bottom: 3cqh;

  /* 4. Typography */
  font-family: 'Cinzel', 'MedievalSharp', serif;
  font-size: clamp(1.75rem, 8.5cqw, 3.8rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-shadow: none;

  /* 5. Visual Styles (Metallic Shining Gold Gradient) */
  background-image: linear-gradient(
    110deg,
    #c89d38 0%,
    #e2b755 25%,
    #f3d078 42%,
    #fff5cc 50%,
    #f3d078 58%,
    #e2b755 75%,
    #c89d38 100%
  );
  background-size: 250% auto;
  background-position: 0% center;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent !important;
  filter: drop-shadow(0 0.5cqh 1.2cqh rgba(0, 0, 0, 0.92))
    drop-shadow(0 0 1cqw rgba(200, 157, 56, 0.35));

  /* 6. Transitions & Animations */
  animation: titleGoldShine 3.6s ease-in-out infinite;
}


/* ==========================================================================
   SECTION 5: LOADING BAR COMPONENT (.loading-track-wrapper, .loading-bar-fill)
   ========================================================================== */

/* 
 * Outer Track Channel for Loading Bar
 * Height is clamped between 8px and 20px scaling with 1.6cqh (container height).
 * Uses inset box-shadow to simulate an embedded track groove.
 */
.loading-track-wrapper {
  /* 3. Box Model & Dimensions */
  width: 100%;
  height: clamp(8px, 1.6cqh, 20px);
  padding: 0.3cqw;
  margin-bottom: 1.2cqh;
  overflow: hidden;

  /* 5. Visual Styles */
  background-color: var(--track-bg);
  border: 1px solid rgba(200, 157, 56, 0.3);
  border-radius: 9999px;
  box-shadow: inset 0 0.25cqh 0.5cqh rgba(0, 0, 0, 0.8);
}

/* 
 * Inner Progress Fill Bar
 * Scales smoothly via transition when width percentage updates.
 * Features a bright gold horizontal gradient and glowing outer shadow.
 */
.loading-bar-fill {
  /* 3. Box Model & Dimensions */
  height: 100%;

  /* 5. Visual Styles */
  background: linear-gradient(90deg, #c89d38 0%, #f3d078 100%);
  border-radius: 9999px;
  box-shadow: 0 0 1cqw rgba(243, 208, 120, 0.6);

  /* 6. Transitions & Animations */
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}


/* ==========================================================================
   SECTION 6: STATUS TEXT (.loading-status-text)
   ========================================================================== */

/* 
 * Dynamic Loading Status Message Text
 * Uses fixed-width monospace font to prevent layout jitter during text updates.
 * Font size scales fluidly via clamp(0.6rem, 2.6cqw, 1.1rem).
 */
.loading-status-text {
  /* 4. Typography */
  font-family: monospace;
  font-size: clamp(0.6rem, 2.6cqw, 1.1rem);
  letter-spacing: -0.025em;
  text-shadow: 0 0.15cqh 0.3cqh rgba(0, 0, 0, 0.9);
  color: rgba(200, 157, 56, 0.85);
}


/* ==========================================================================
   SECTION 7: ANIMATIONS & KEYFRAMES (@keyframes titleGoldShine, subtitleGoldGlow)
   ========================================================================== */

/* 
 * Title Metallic Gold Shine Sweep Keyframe Animation
 * Sweeps the specular gold highlight band smoothly across .initscreen-title
 * while subtly pulsing the golden outer drop-shadow aura at peak gleam.
 */
@keyframes titleGoldShine {
  0% {
    background-position: 200% center;
    filter: drop-shadow(0 0.5cqh 1.2cqh rgba(0, 0, 0, 0.92))
      drop-shadow(0 0 0.8cqw rgba(200, 157, 56, 0.3));
  }
  50% {
    filter: drop-shadow(0 0.5cqh 1.4cqh rgba(0, 0, 0, 0.95))
      drop-shadow(0 0 1.6cqw rgba(243, 208, 120, 0.65));
  }
  100% {
    background-position: -50% center;
    filter: drop-shadow(0 0.5cqh 1.2cqh rgba(0, 0, 0, 0.92))
      drop-shadow(0 0 0.8cqw rgba(200, 157, 56, 0.3));
  }
}

/* 
 * Subtitle Glowing Gold Recolor Keyframe Animation
 * Smoothly transitions .initscreen-subtitle font color from deep antique bronze-gold
 * to radiant luminous gold accompanied by a warm golden outer text-shadow glow.
 */
@keyframes subtitleGoldGlow {
  0% {
    color: #8a6820;
    text-shadow: 0 0.2cqh 0.4cqh rgba(0, 0, 0, 0.9);
  }
  100% {
    color: #fff3c4;
    text-shadow: 0 0.2cqh 0.4cqh rgba(0, 0, 0, 0.95),
      0 0 0.8cqw rgba(243, 208, 120, 0.85),
      0 0 1.6cqw rgba(200, 157, 56, 0.55);
  }
}

/* ========================================================================== */
/* LOADING ANIMATION ON INDEX.HTML LOAD                                       */
/* ========================================================================== */

/* Animated Shimmer across loading bar track before progress begins */
.loading-track-wrapper {
  position: relative;
  overflow: hidden;
}

.loading-track-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(243, 208, 120, 0.35) 50%,
    transparent 100%
  );
  animation: loading-shimmer 1.4s infinite linear;
}

@keyframes loading-shimmer {
  0% { transform: translateX(0%); }
  100% { transform: translateX(200%); }
}

/* Pulsing opacity for status text */
.loading-status-text {
  animation: loading-pulse 1.2s ease-in-out infinite alternate;
}

@keyframes loading-pulse {
  from { opacity: 0.5; }
  to { opacity: 1.0; }
}