/* ==========================================================
   Faithful SMP
   ========================================================== */

:root {
  --fondo: #14181a;
  --fondo-2: #1d2326;
  --piedra: #2c3438;
  --texto: #e9efe4;
  --texto-suave: #a9b5ab;
  --pasto: #6aad43;
  --pasto-oscuro: #4f8a31;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Figtree', system-ui, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  line-height: 1.65;
  font-size: 1.05rem;
}

a { color: var(--pasto); text-underline-offset: 3px; }
a:hover { color: #8fd161; }
:focus-visible { outline: 3px solid var(--pasto); outline-offset: 3px; }

.contenedor { width: min(1080px, 100% - 2.5rem); margin-inline: auto; }

/* ---------- Encabezado ---------- */
header.sitio { padding: 1.25rem 0; border-bottom: 4px solid var(--piedra); background: var(--fondo); }
header.sitio .contenedor {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap;
}
.marca {
  font-family: 'Pixelify Sans', monospace; font-weight: 700;
  font-size: 1.4rem; color: var(--texto); text-decoration: none;
}
nav { display: flex; gap: 1.5rem; }
nav a { color: var(--texto-suave); text-decoration: none; font-weight: 500; }
nav a:hover { color: var(--texto); }

/* ---------- Portada con imagen de fondo ----------
   La imagen la define index.php en --imagen (carpeta /img, archivo "fondo.*").
   Si no hay imagen, se ve el color liso. El degradado oscuro mantiene el texto legible. */
.portada {
  display: flex; align-items: center;
  min-height: min(78vh, 720px);
  padding: clamp(3rem, 8vw, 6rem) 0;
  background-color: var(--fondo-2);
  background-image:
    linear-gradient(90deg, rgba(10,13,14,.88) 0%, rgba(10,13,14,.6) 55%, rgba(10,13,14,.35) 100%),
    var(--imagen, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.portada .contenedor { max-width: 1080px; }
.portada h1 {
  font-family: 'Pixelify Sans', monospace; font-weight: 700;
  font-size: clamp(1.9rem, 4.6vw, 3.1rem); line-height: 1.2; letter-spacing: 0.01em;
  max-width: 22ch;
  text-shadow: 0 2px 12px rgba(0,0,0,.5);
}
.portada p { margin-top: 1.5rem; color: #d3dccf; max-width: 52ch; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.portada .nombre { color: #fff; font-weight: 700; }

.ip {
  display: inline-block; margin-top: 2rem; padding: 0.9rem 1.4rem;
  background: var(--pasto-oscuro); color: #fff;
  font-family: 'Pixelify Sans', monospace; font-weight: 700; font-size: 1.3rem;
  border: 3px solid #0e1a09; cursor: pointer;
  box-shadow: inset -4px -4px 0 rgba(0,0,0,.3), inset 4px 4px 0 rgba(255,255,255,.2);
}
.ip:hover { background: var(--pasto); }
.ip:active {
  box-shadow: inset 4px 4px 0 rgba(0,0,0,.3), inset -4px -4px 0 rgba(255,255,255,.2);
}
.ip-nota { display: block; margin-top: .6rem; font-size: .9rem; color: #d3dccf; min-height: 1.4em; }

/* ---------- Contador de lanzamiento ---------- */
.cuenta { margin-top: 2rem; width: 100%; max-width: 560px; }
.cuenta[hidden], #ip-bloque[hidden] { display: none; }
.cuenta-titulo { margin: 0 0 1rem; color: #fff; font-weight: 700; line-height: 1.4; }

/* 4 columnas que siempre caben, sin importar el ancho del teléfono */
.cuenta-cajas {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(.4rem, 2vw, .8rem);
}
.caja {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center;
  padding: clamp(.8rem, 4vw, 1.2rem) .25rem clamp(.6rem, 3vw, .9rem);
  background: rgba(10,13,14,.78);
  border: 3px solid #0e1a09;
  box-shadow: inset -4px -4px 0 rgba(0,0,0,.35), inset 4px 4px 0 rgba(255,255,255,.12);
  opacity: 0;
  animation: entra .65s cubic-bezier(.2,.9,.3,1.25) forwards;
}
.caja:nth-child(1) { animation-delay: .05s; }
.caja:nth-child(2) { animation-delay: .17s; }
.caja:nth-child(3) { animation-delay: .29s; }
.caja:nth-child(4) { animation-delay: .41s; }

/* Brillo que cruza cada caja una vez, después de entrar */
.caja::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.18), transparent);
  transform: skewX(-18deg);
  animation: brillo 1.1s ease-out forwards;
  animation-delay: calc(.7s + var(--n, 0) * .15s);
  pointer-events: none;
}
.caja:nth-child(1) { --n: 0; }
.caja:nth-child(2) { --n: 1; }
.caja:nth-child(3) { --n: 2; }
.caja:nth-child(4) { --n: 3; }

.caja .num {
  display: block;
  font-family: 'Pixelify Sans', monospace; font-weight: 700;
  font-size: clamp(1.8rem, 10vw, 2.8rem); line-height: 1; color: var(--pasto);
  font-variant-numeric: tabular-nums;
}
.caja .etq { margin-top: .45rem; font-size: clamp(.68rem, 3vw, .85rem); color: #d3dccf; }

/* Último minuto: las cajas laten */
.cuenta.final .caja {
  opacity: 1; border-color: var(--pasto);
  animation: latido 1s ease-in-out infinite;
}
.cuenta.final .caja::after { display: none; }

@keyframes entra {
  from { opacity: 0; transform: translateY(22px) scale(.88); }
  to   { opacity: 1; transform: none; }
}
@keyframes brillo {
  from { left: -60%; }
  to   { left: 130%; }
}
@keyframes latido {
  0%, 100% { transform: scale(1); box-shadow: inset -4px -4px 0 rgba(0,0,0,.35), inset 4px 4px 0 rgba(255,255,255,.12), 0 0 0 rgba(106,173,67,0); }
  50%      { transform: scale(1.05); box-shadow: inset -4px -4px 0 rgba(0,0,0,.35), inset 4px 4px 0 rgba(255,255,255,.12), 0 0 18px rgba(106,173,67,.55); }
}

/* IP y botón: cómodos para el pulgar en el celular */
@keyframes aparece {
  from { opacity: 0; transform: translateY(14px) scale(.95); }
  to   { opacity: 1; transform: none; }
}
#ip-bloque:not([hidden]) { animation: aparece .6s cubic-bezier(.2,.9,.3,1.2); }
@media (max-width: 560px) {
  .ip { width: 100%; text-align: center; padding: 1.1rem 1rem; font-size: 1.4rem; }
  .portada h1 { font-size: clamp(1.6rem, 7.2vw, 2rem); }
}

/* ---------- Secciones de texto ---------- */
section.texto { padding: clamp(3rem, 6vw, 5rem) 0; border-top: 4px solid var(--piedra); }
section.texto.pagina { border-top: 0; }
.columna { max-width: 70ch; }

h2, .titulo-pagina {
  font-family: 'Pixelify Sans', monospace; font-weight: 700;
  font-size: 2rem; margin-bottom: 1.5rem;
}
h3 { font-size: 1.1rem; font-weight: 700; margin: 1.75rem 0 .4rem; }
.columna p { color: var(--texto-suave); }
.columna p + p { margin-top: .8rem; }
.columna strong { color: var(--texto); }
.actualizado { font-size: .9rem; margin-bottom: 1rem; }
.correo { font-size: 1.25rem; font-weight: 700; word-break: break-all; }

/* ---------- Pie ---------- */
footer {
  padding: 2.5rem 0; border-top: 4px solid var(--piedra);
  color: var(--texto-suave); font-size: .95rem;
}
footer .contenedor { display: grid; gap: .5rem; }

@media (max-width: 820px) {
  .portada {
    min-height: 70vh;
    background-image:
      linear-gradient(180deg, rgba(10,13,14,.8) 0%, rgba(10,13,14,.6) 100%),
      var(--imagen, none);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .caja, .cuenta.final .caja, #ip-bloque:not([hidden]) { animation: none; opacity: 1; }
  .caja::after { display: none; }
}
