/* ArteSílex · página "en construcción"
   Paleta de la web principal (src/styles/proto.css) + marrones de cueva. */

@font-face {
  font-family: "Alegreya";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/alegreya-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Alegreya Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/alegreya-sans-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Alegreya Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/alegreya-sans-latin-500-normal.woff2") format("woff2");
}

:root {
  --parchment: #f0d9ad;
  --parchment-light: #f8e8c8;
  --bison: #bf3a14;
  --bison-dark: #922b12;
  --ochre: #d58d45;
  --cave: #140b07;        /* = el tono más oscuro de los sprites */
  --cave-warm: #2a170d;
  --muted: #b89a74;
  --faint: #a1845f;

  --serif: "Alegreya", ui-serif, Georgia, serif;
  --sans: "Alegreya Sans", ui-sans-serif, system-ui, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --clip-btn: polygon(6% 8%, 89% 0, 100% 21%, 97% 86%, 86% 100%, 8% 94%, 0 72%, 2% 22%);

  /* escala entera de los sprites (160x96 px de escena) */
  --s: 2;

  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background:
    radial-gradient(ellipse 70% 45% at 50% 30%, var(--cave-warm), transparent 70%),
    var(--cave);
  color: var(--parchment);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 1.125rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.pagina {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 4vh, 40px);
  padding: clamp(24px, 6vh, 56px) 16px clamp(20px, 4vh, 32px);
  text-align: center;
}

/* ------------------------------------------------------------- escena */

.escena {
  position: relative;
  flex: none;
  width: calc(160px * var(--s));
  height: calc(96px * var(--s));
  background: url("/img/cueva.png") 0 0 / 100% 100% no-repeat;
  image-rendering: pixelated;
  overflow: hidden;
  /* funde los bordes de la cueva con el fondo de la página */
  --fundido:
    linear-gradient(to right, transparent, #000 16%, #000 84%, transparent),
    linear-gradient(to bottom, transparent, #000 14%, #000 88%, transparent);
  -webkit-mask-image: var(--fundido);
  -webkit-mask-composite: source-in;
  mask-image: var(--fundido);
  mask-composite: intersect;
  animation: aparece 900ms var(--ease-out) both;
}

.capa {
  position: absolute;
  overflow: hidden;
}
.capa--tallador {
  left: calc(38px * var(--s));
  top: calc(32px * var(--s));
  width: calc(72px * var(--s));
  height: calc(56px * var(--s));
  --frames: 14;
  --quieto: 4; /* percutor en alto */
}
.capa--fuego {
  left: calc(103px * var(--s));
  top: calc(46px * var(--s));
  width: calc(28px * var(--s));
  height: calc(38px * var(--s));
  --frames: 12;
  --quieto: 3;
}

/* Hoja de sprites: tan ancha como N fotogramas; steps(N) la desplaza
   exactamente un fotograma (un número entero de píxeles) por paso. */
.hoja {
  width: calc(100% * var(--frames));
  height: 100%;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  image-rendering: pixelated;
  will-change: transform;
}
.capa--tallador .hoja {
  background-image: url("/img/tallador.png");
  animation: hoja 1.4s steps(14) infinite;
}
.capa--fuego .hoja {
  background-image: url("/img/fuego.png");
  animation: hoja 0.96s steps(12) infinite;
}

@keyframes hoja {
  to { transform: translateX(-100%); }
}

/* luz cálida de la hoguera que tiembla sobre la pared */
.resplandor {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 73% 79%, rgb(255 150 60 / 0.16), rgb(255 120 40 / 0.05) 32%, transparent 55%);
  pointer-events: none;
  animation: tiembla 2.6s steps(1, end) infinite;
}

@keyframes tiembla {
  0%   { opacity: 0.85; }
  11%  { opacity: 1; }
  19%  { opacity: 0.7; }
  33%  { opacity: 0.95; }
  46%  { opacity: 0.8; }
  58%  { opacity: 1; }
  71%  { opacity: 0.75; }
  84%  { opacity: 0.92; }
}

/* -------------------------------------------------------------- texto */

.texto {
  max-width: 34rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.antetitulo {
  margin: 0 0 0.5rem;
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ochre);
}

.marca {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.875rem, 11vw, 4.75rem);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--parchment-light);
}

.lema {
  margin: 1rem 0 0;
  max-width: 34ch;
  font-size: clamp(1.1875rem, 2.8vw, 1.375rem);
  line-height: 1.5;
  text-wrap: balance;
  color: var(--parchment);
}

.aviso {
  margin: 1.5rem 0 0;
  font-size: 1rem;
  color: var(--muted);
}

/* botón del correo y selector: /comun/correo.css */
.contacto { --correo-foco: var(--parchment-light); color: var(--parchment-light); }

.pie {
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
  color: var(--faint);
}

/* entrada escalonada, solo al cargar */
.texto > *, .pie { animation: sube 700ms var(--ease-out) both; }
.antetitulo { animation-delay: 150ms; }
.marca { animation-delay: 210ms; }
.lema { animation-delay: 270ms; }
.aviso { animation-delay: 330ms; }
.contacto { animation-delay: 380ms; }
.pie { animation-delay: 450ms; }

@keyframes aparece { from { opacity: 0; } }
@keyframes sube { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------- escalas */

@media (min-width: 560px) {
  :root { --s: 3; }
}
@media (min-width: 900px) and (min-height: 960px) {
  :root { --s: 4; }
}

/* ------------------------------------------------ movimiento reducido */

@media (prefers-reduced-motion: reduce) {
  .escena, .resplandor, .texto > *, .pie { animation: none; }
  .hoja {
    animation: none !important;
    transform: translateX(calc(-100% * var(--quieto) / var(--frames)));
  }
}
