/* ========================================
   FONT
   ======================================== */
@font-face {
  font-family: 'Norsebold';
  src: url('Norsebold.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ========================================
   IMPORTS & RESET
   ======================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ========================================
   BASE
   ======================================== */
html {
  height: 100%;
}

body {
  min-height: 100%;
  background-color: #1a0d06;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Overflow hidden en body - el scroll ocurre dentro del pergamino */
  overflow: hidden;
}

/* ========================================
   SCENE — contenedor principal con ratio fijo
   La imagen original es 894 x 1330 px → ratio ≈ 0.672 (ancho/alto)
   Escalamos para llenar la pantalla manteniendo el ratio.
   ======================================== */
.scene {
  /*
    Usamos vmin para que siempre quepa en la pantalla.
    La imagen tiene ratio w:h = 894:1330 ≈ 67.2%
    Si height = 100vh, width = 100vh * 0.672
    Si width  = 100vw, height = 100vw / 0.672

    Con contain: la imagen entera es visible sin recorte.
    Preferimos esto para que el marco no se corte.
  */
  position: relative;
  width: min(100vw, calc(100vh * 0.6721));
  height: min(100vh, calc(100vw / 0.6721));
  /* Asegurar que no se salga */
  max-width: 100vw;
  max-height: 100vh;

  container-type: inline-size;

  background-image: url('background.png');
  background-size: 100% 100%;   /* Estira para cubrir exactamente el contenedor */
  background-repeat: no-repeat;
  background-position: center center;

  /* Sombra exterior para profundidad */
  box-shadow:
    0 0 60px rgba(0, 0, 0, 0.9),
    0 0 120px rgba(0, 0, 0, 0.5);
}

/* ========================================
   TÍTULO DEL TABLERO (Madera superior)
   ======================================== */
.title-board {
  position: absolute;
  top: 1.5%;
  height: 10%;
  left: 13%;
  right: 13%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.title-board h1 {
  font-family: 'Norsebold', 'Palatino Linotype', serif;
  font-size: clamp(16px, 8cqw, 70px);
  color: #f6b93b; /* Amarillo/dorado estilo Warcraft */
  text-shadow: 
    2px 2px 0px rgba(0,0,0,0.8),
    0 0 12px rgba(0,0,0,0.9),
    0 0 4px rgba(0,0,0,0.6);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: -2%; /* Ajuste fino visual */
}

/* ========================================
   ÁREA DEL PERGAMINO
   Según análisis de la imagen background.png:
   - Horizontal: ~13% desde izquierda, termina al ~87% → ancho ~74%
   - Vertical:   ~19% desde arriba,   termina al ~84% → alto  ~65%
   ======================================== */
.parchment-text-area {
  position: absolute;
  left:   13%;
  right:  13%;
  top:    19%;
  bottom: 16%;

  /* Permite scroll interno si el texto supera el área */
  overflow-y: auto;
  overflow-x: hidden;

  /* Scroll invisible pero funcional */
  scrollbar-width: none;
  -ms-overflow-style: none;

  /* Centrado del contenido */
  display: flex;
  align-items: center;
  justify-content: center;
}

.parchment-text-area::-webkit-scrollbar {
  display: none;
}

/* ========================================
   LÍNEAS DE TEXTO
   ======================================== */
.text-lines {
  width: 100%;
  padding: 6cqw 8cqw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2cqw; /* Espaciado estricto basado en el ancho, manteniendo siempre la misma proporción */
}

.scroll-line {
  font-family: 'Norsebold', 'Palatino Linotype', serif;
  /*
    Tamaño de fuente relativo al contenedor de la imagen usando cqw (container query width).
    Así el texto escala en perfecta proporción con el pergamino de fondo.
  */
  font-size: clamp(12px, 5.5cqw, 42px);
  color: #3a1e06;
  text-align: center;
  letter-spacing: 0.06em;
  line-height: 1.3;
  width: 100%;

  /* Efecto tinta sobre pergamino */
  text-shadow:
    1px 1px 0px rgba(255, 220, 150, 0.3),
    0px 0px 6px rgba(80, 40, 5, 0.15);

  /* Animación de aparición escalonada */
  opacity: 0;
  animation: inkAppear 0.5s ease forwards;
  animation-delay: calc(var(--i) * 0.08s + 0.2s);

  /* Línea separadora tipo caligrafía */
  position: relative;
}



/* Hover: resalta la línea ligeramente */
.scroll-line:hover {
  color: #5a2e08;
  text-shadow:
    1px 1px 0px rgba(255, 220, 150, 0.5),
    0px 0px 10px rgba(120, 60, 10, 0.3);
  cursor: default;
  transition: color 0.2s, text-shadow 0.2s;
}

/* ========================================
   ANIMACIÓN ENTRADA TINTA
   ======================================== */
@keyframes inkAppear {
  from {
    opacity: 0;
    transform: translateY(4px);
    filter: blur(1.5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

/* ========================================
   RESPONSIVE — ajuste para pantallas anchas
   En landscape el contenedor puede ser más bajo
   ======================================== */
@media (orientation: landscape) and (max-height: 600px) {
  .parchment-text-area {
    /* En landscape pequeño, reducir gaps */
    overflow-y: auto;
  }

  .text-lines {
    gap: clamp(4px, 1.5%, 12px);
    padding: 4% 8%;
  }
}

/* Para pantallas muy pequeñas en portrait */
@media (max-width: 380px) {
  .scroll-line {
    font-size: 12px;
    letter-spacing: 0.03em;
  }
}
