/* ==========================================================================
   Sergio Moramago — hoja de estilos
   Paleta: tinta, papel, café y madera.
   ========================================================================== */

:root {
  /* Oscuros (portada) */
  --espresso: #15100c;
  --madera: #2a1d14;
  /* Papel (páginas interiores) */
  --papel: #f2ebdf;
  --papel-2: #e9e0d0;
  --tinta: #251c16;
  --tinta-suave: #5b4c40;
  --tinta-tenue: #8a7a6b;
  /* Acentos */
  --cafe: #8b5a36;
  --azul-pluma: #26406a;
  --crema: #efe5d3;

  --f-titulo: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --f-texto: "Newsreader", "Iowan Old Style", Georgia, serif;
  --f-maquina: "Courier Prime", "Courier New", monospace;

  --ancho-lectura: 40rem;
  --gutter: clamp(1rem, 4vw, 3rem);
}

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

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

body {
  margin: 0;
  font-family: var(--f-texto);
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--tinta);
  background: var(--papel);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

::selection { background: rgba(139, 90, 54, .25); }

/* Grano de papel (SVG inline, sin peticiones) */
.grano::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: .09;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .2 0 0 0 0 .1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Etiqueta de máquina de escribir */
.maquina {
  font-family: var(--f-maquina);
  font-size: .78rem;
  letter-spacing: .22em;
  text-transform: uppercase;
}

/* Animación de "tinta que aparece" */
@keyframes tinta {
  from { opacity: 0; filter: blur(6px); transform: translateY(10px); }
  to   { opacity: 1; filter: blur(0); transform: none; }
}
@keyframes trazo {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}
.aparece { animation: tinta 1.3s cubic-bezier(.2, .7, .2, 1) both; }
.d1 { animation-delay: .15s; } .d2 { animation-delay: .4s; }
.d3 { animation-delay: .7s; }  .d4 { animation-delay: 1s; }
.d5 { animation-delay: 1.3s; }

/* ==========================================================================
   PORTADA
   ========================================================================== */

.portada {
  min-height: 100vh;
  min-height: 100svh;
  background: var(--espresso);
  color: var(--crema);
  position: relative;
  overflow: hidden;
  display: grid;
}

.portada .grano::after,
.portada.grano::after { mix-blend-mode: overlay; opacity: .18; }

.portada__foto {
  position: absolute;
  inset: 0;
  margin: 0;
}
.portada__foto img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 35%;
  filter: sepia(.28) saturate(.75) contrast(1.03) brightness(.9);
  animation: revela 2.4s ease-out both;
}
@keyframes revela {
  from { opacity: 0; transform: scale(1.06); }
  to   { opacity: 1; transform: scale(1); }
}
/* Velo cálido: como luz de lámpara sobre un escritorio */
.portada__foto::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 50% 30%, transparent 30%, rgba(21, 16, 12, .55) 100%),
    linear-gradient(180deg, rgba(21, 16, 12, .25) 0%, rgba(21, 16, 12, 0) 30%, rgba(21, 16, 12, .75) 62%, rgba(21, 16, 12, .97) 100%);
}

.portada__contenido {
  position: relative;
  z-index: 2;
  align-self: end;
  padding: 0 1rem calc(2.5rem + env(safe-area-inset-bottom));
  text-align: center;
}

.portada__oficio { color: #cdb89b; margin: 0 0 1.1rem; }

.portada__nombre {
  font-family: var(--f-titulo);
  font-weight: 400;
  font-size: clamp(2.9rem, 13vw, 7.5rem);
  line-height: .92;
  letter-spacing: -.01em;
  margin: 0;
  color: #f6eee1;
}
.portada__nombre em {
  font-style: italic;
  font-weight: 400;
  color: #e3cfae;
}

.filete {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .9rem;
  margin: 1.5rem auto 1.3rem;
  color: #b89a74;
  max-width: 18rem;
}
.filete::before,
.filete::after {
  content: "";
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: .6;
  transform-origin: center;
  animation: trazo 1.4s .7s cubic-bezier(.6, 0, .2, 1) both;
}
.filete svg { width: 18px; height: 18px; flex: none; }

.portada__frase {
  font-family: var(--f-titulo);
  font-style: italic;
  font-size: clamp(1.25rem, 4.6vw, 1.7rem);
  line-height: 1.35;
  margin: 0 auto 2.2rem;
  max-width: 26ch;
  color: #e9dcc7;
}

.portada__botones {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .9rem;
}

.boton {
  --bc: #e9dcc7;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  min-width: 10.5rem;
  padding: 1rem 1.6rem;
  font-family: var(--f-maquina);
  font-size: .82rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--bc);
  border: 1px solid rgba(233, 220, 199, .55);
  background: rgba(21, 16, 12, .25);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overflow: hidden;
  isolation: isolate;
  transition: color .45s ease, border-color .45s ease;
}
.boton::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: #efe5d3;
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform .45s cubic-bezier(.6, 0, .2, 1);
}
.boton:hover,
.boton:focus-visible { color: var(--espresso); border-color: #efe5d3; }
.boton:hover::before,
.boton:focus-visible::before { transform: scaleY(1); }
.boton:focus-visible { outline: 2px solid #e3cfae; outline-offset: 3px; }
.boton .flecha { transition: transform .45s ease; }
.boton:hover .flecha { transform: translateX(4px); }

.portada__pie {
  position: absolute;
  z-index: 2;
  left: 0; right: 0; top: 0;
  display: flex;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 0;
  color: rgba(233, 220, 199, .7);
  font-size: .68rem;
}

/* Escritorio: foto a la derecha, texto sobre la madera a la izquierda */
@media (min-width: 900px) {
  .portada { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .portada__foto { left: 38%; }
  .portada__foto img {
    object-position: 50% 30%;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,.35) 22%, #000 58%);
    mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,.35) 22%, #000 58%);
  }
  .portada__foto::after {
    background:
      linear-gradient(90deg, rgba(21, 16, 12, 0) 0%, rgba(21, 16, 12, .15) 45%, rgba(21, 16, 12, .1) 70%, rgba(21, 16, 12, .45) 100%),
      linear-gradient(180deg, rgba(21, 16, 12, .2) 0%, transparent 25%, transparent 70%, rgba(21, 16, 12, .6) 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,.35) 22%, #000 58%);
    mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,.35) 22%, #000 58%);
  }
  /* Luz de lámpara sobre el lado del texto */
  .portada::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(60% 70% at 18% 55%, rgba(139, 90, 54, .22), transparent 70%);
    z-index: 1;
    pointer-events: none;
  }
  .portada__contenido {
    align-self: center;
    text-align: left;
    padding: 0 0 0 clamp(3rem, 8vw, 8rem);
  }
  .portada__nombre { font-size: clamp(4.5rem, 7.4vw, 8rem); }
  .filete { margin-left: 0; justify-content: flex-start; }
  .portada__frase { margin-left: 0; }
  .portada__botones { justify-content: flex-start; }
  .portada__pie { top: auto; bottom: 0; padding: 0 2rem 1.6rem clamp(3rem, 8vw, 8rem); }
}

/* ==========================================================================
   PÁGINAS INTERIORES (papel)
   ========================================================================== */

.pagina {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(100% 60% at 50% 0%, #f7f1e7 0%, transparent 70%),
    var(--papel);
}

.cabecera {
  padding: 1.4rem var(--gutter) 0;
  max-width: 72rem;
  width: 100%;
  margin: 0 auto;
}
.cabecera__fila {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--tinta);
  box-shadow: 0 3px 0 -2px var(--tinta); /* doble filete de periódico */
}
.cabecera__firma {
  font-family: var(--f-titulo);
  font-size: 1.55rem;
  line-height: 1;
  text-decoration: none;
  letter-spacing: .01em;
}
.cabecera__firma em { color: var(--cafe); }
.menu { display: flex; gap: 1.6rem; }
.menu a {
  text-decoration: none;
  color: var(--tinta-suave);
  padding: .25rem 0;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .35s ease, color .35s ease;
}
.menu a:hover,
.menu a[aria-current="page"] { color: var(--tinta); background-size: 100% 1px; }

main { flex: 1; }

.pie {
  max-width: 72rem;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 2rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  color: var(--tinta-tenue);
  font-size: .68rem;
}
.pie a { text-decoration: none; }
.pie a:hover { color: var(--tinta); }

/* Encabezado de sección tipo cabecera de periódico */
.titular {
  text-align: center;
  padding: clamp(3rem, 9vw, 6rem) var(--gutter) clamp(2rem, 5vw, 3rem);
}
.titular .maquina { color: var(--cafe); margin: 0 0 1rem; }
.titular h1 {
  font-family: var(--f-titulo);
  font-weight: 400;
  font-size: clamp(3rem, 11vw, 6rem);
  line-height: .95;
  margin: 0;
  letter-spacing: -.01em;
}
.titular p.entradilla {
  font-family: var(--f-titulo);
  font-style: italic;
  font-size: clamp(1.15rem, 3.5vw, 1.45rem);
  color: var(--tinta-suave);
  margin: 1rem auto 0;
  max-width: 40ch;
  line-height: 1.4;
}

/* ---------- NOVELAS: Muy pronto ---------- */
.pronto {
  position: relative;
  text-align: center;
  padding: clamp(2rem, 8vw, 5rem) var(--gutter) clamp(4rem, 10vw, 7rem);
  overflow: hidden;
}
/* Cerco de taza de café, apenas insinuado */
.pronto::before {
  content: "";
  position: absolute;
  width: 15rem; height: 15rem;
  right: max(-4rem, calc(50% - 30rem));
  top: -2rem;
  border-radius: 50%;
  border: 9px solid rgba(139, 90, 54, .07);
  box-shadow: inset 0 0 0 2px rgba(139, 90, 54, .05), 0 0 0 3px rgba(139, 90, 54, .035);
  transform: rotate(-12deg) scaleX(1.03);
  pointer-events: none;
}
.pronto__hoja {
  position: relative;
  max-width: 34rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 4rem) clamp(1.5rem, 6vw, 3.5rem);
  background:
    repeating-linear-gradient(180deg, transparent 0 2.05rem, rgba(38, 64, 106, .09) 2.05rem calc(2.05rem + 1px)),
    #faf6ef;
  box-shadow: 0 1px 2px rgba(37, 28, 22, .08), 0 18px 40px -18px rgba(37, 28, 22, .35);
  transform: rotate(-.6deg);
}
.pronto__hoja::before { /* margen rojo de cuaderno */
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: clamp(1rem, 4vw, 2rem);
  width: 1px;
  background: rgba(160, 60, 50, .25);
}
.pronto__texto {
  font-family: var(--f-maquina);
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  margin: 0;
  color: var(--tinta);
  letter-spacing: .02em;
  min-height: 1.4em;
}
.cursor {
  display: inline-block;
  width: .55em;
  height: 1.05em;
  margin-left: .08em;
  vertical-align: -.15em;
  background: var(--tinta);
  animation: parpadeo 1.05s steps(1) infinite;
}
@keyframes parpadeo { 50% { opacity: 0; } }
.pronto__nota {
  font-family: var(--f-titulo);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--azul-pluma);
  margin: 1.6rem 0 0;
  line-height: 1.5;
}

/* ---------- ARTÍCULOS: índice ---------- */
.indice {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 var(--gutter) 3rem;
}
.indice__lista { list-style: none; margin: 0; padding: 0; }

.entrada {
  border-top: 1px solid rgba(37, 28, 22, .18);
}
.entrada:last-child { border-bottom: 1px solid rgba(37, 28, 22, .18); }
.entrada a {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
  padding: 2rem 0;
  text-decoration: none;
}
.entrada__fecha { color: var(--cafe); margin: 0; font-size: .72rem; }
.entrada__titulo {
  font-family: var(--f-titulo);
  font-weight: 500;
  font-size: clamp(1.7rem, 5vw, 2.3rem);
  line-height: 1.1;
  margin: .45rem 0 .6rem;
  transition: color .3s ease;
}
.entrada__resumen { margin: 0; color: var(--tinta-suave); font-size: 1.05rem; line-height: 1.6; }
.entrada__leer {
  display: inline-block;
  margin-top: 1rem;
  color: var(--tinta);
  font-size: .72rem;
}
.entrada__leer span { display: inline-block; transition: transform .3s ease; }
.entrada__img {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--papel-2);
}
.entrada__img img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: sepia(.25) saturate(.8);
  transition: transform .8s cubic-bezier(.2, .7, .2, 1), filter .8s ease;
}
.entrada a:hover .entrada__titulo { color: var(--azul-pluma); }
.entrada a:hover .entrada__img img { transform: scale(1.04); filter: sepia(0) saturate(1); }
.entrada a:hover .entrada__leer span { transform: translateX(5px); }

@media (min-width: 720px) {
  .entrada a { grid-template-columns: 1fr 15rem; gap: 2.5rem; align-items: center; }
  .entrada--sin-img a { grid-template-columns: 1fr; }
}

.vacio {
  text-align: center;
  padding: 3rem 1rem 4rem;
  border-top: 1px solid rgba(37, 28, 22, .18);
  border-bottom: 1px solid rgba(37, 28, 22, .18);
}
.vacio p {
  font-family: var(--f-titulo);
  font-style: italic;
  font-size: 1.4rem;
  color: var(--tinta-suave);
  margin: 0;
}

/* ---------- ARTÍCULO: lectura ---------- */
.articulo {
  max-width: var(--ancho-lectura);
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 4.5rem) var(--gutter) 2rem;
}
.volver {
  display: inline-block;
  color: var(--tinta-tenue);
  text-decoration: none;
  font-size: .7rem;
  margin-bottom: 2.2rem;
  transition: color .3s;
}
.volver:hover { color: var(--tinta); }
.articulo__cab { text-align: center; margin-bottom: 2.5rem; }
.articulo__fecha { color: var(--cafe); margin: 0 0 1rem; }
.articulo__titulo {
  font-family: var(--f-titulo);
  font-weight: 500;
  font-size: clamp(2.3rem, 8vw, 3.6rem);
  line-height: 1.04;
  margin: 0;
  letter-spacing: -.005em;
}
.articulo__sub {
  font-family: var(--f-titulo);
  font-style: italic;
  font-size: clamp(1.2rem, 3.6vw, 1.45rem);
  color: var(--tinta-suave);
  line-height: 1.4;
  margin: 1rem 0 0;
}
.articulo__cab .filete { color: var(--cafe); margin: 1.8rem auto 0; max-width: 10rem; }

.figura { margin: 2.5rem 0; }
.figura--ancha {
  margin-left: calc(-1 * min(8vw, 6rem));
  margin-right: calc(-1 * min(8vw, 6rem));
}
@media (max-width: 720px) { .figura--ancha { margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); } }
.figura img { width: 100%; height: auto; }
.figura figcaption {
  font-family: var(--f-titulo);
  font-style: italic;
  font-size: 1rem;
  color: var(--tinta-tenue);
  text-align: center;
  margin-top: .7rem;
  padding: 0 1rem;
}

.texto p { margin: 0 0 1.35em; hyphens: auto; }
.texto > p:first-of-type::first-letter {
  font-family: var(--f-titulo);
  float: left;
  font-size: 4.6em;
  line-height: .8;
  padding: .08em .1em 0 0;
  color: var(--cafe);
}
.texto h2 {
  font-family: var(--f-titulo);
  font-weight: 500;
  font-size: 1.75rem;
  line-height: 1.2;
  margin: 2.2em 0 .7em;
}
.texto blockquote {
  margin: 2em 0;
  padding: 0 0 0 1.4rem;
  border-left: 2px solid var(--cafe);
  font-family: var(--f-titulo);
  font-style: italic;
  font-size: 1.45rem;
  line-height: 1.45;
  color: var(--azul-pluma);
}
.texto blockquote p { margin: 0; }
.texto a { color: var(--azul-pluma); text-underline-offset: 3px; }
.texto hr {
  border: 0;
  text-align: center;
  margin: 2.5em 0;
}
.texto hr::before { content: "* * *"; letter-spacing: .6em; color: var(--tinta-tenue); }

.articulo__fin {
  text-align: center;
  margin: 3rem 0 0;
  color: var(--cafe);
}
.articulo__fin svg { width: 22px; height: 22px; display: inline-block; }
.articulo__nav {
  margin-top: 3rem;
  padding-top: 1.6rem;
  border-top: 1px solid rgba(37, 28, 22, .18);
  text-align: center;
}
.articulo__nav a { text-decoration: none; font-size: .72rem; color: var(--tinta-suave); }
.articulo__nav a:hover { color: var(--tinta); }

.aviso-borrador {
  background: #f5dfc0;
  color: #6b3f1d;
  text-align: center;
  padding: .5rem 1rem;
  font-size: .68rem;
}

@media (max-width: 520px) {
  body { font-size: 1.0625rem; }
  .cabecera__fila { flex-direction: column; align-items: center; gap: .7rem; }
}

/* Móvil: la foto ocupa la parte alta y el texto descansa debajo, sin taparte la cara */
@media (max-width: 899px) {
  .portada__foto { bottom: 30%; }
  .portada__foto img { object-position: 50% 30%; }
  .portada__foto::after {
    background:
      linear-gradient(180deg, rgba(21, 16, 12, .35) 0%, rgba(21, 16, 12, 0) 18%, rgba(21, 16, 12, 0) 55%, rgba(21, 16, 12, .85) 85%, var(--espresso) 100%);
  }
  .portada__contenido { padding-top: 54vh; }
  .portada__botones { flex-wrap: nowrap; gap: .7rem; }
  .boton { min-width: 0; flex: 1 1 0; max-width: 11rem; padding: .95rem .6rem; letter-spacing: .16em; font-size: .76rem; }
}
@media (max-width: 899px) and (max-height: 700px) {
  .portada__foto { bottom: 20%; }
  .portada__contenido { padding-top: 50vh; }
}

/* ---------- Redes sociales ---------- */
.redes { display: flex; align-items: center; gap: 1.1rem; }
.redes a {
  display: inline-flex;
  width: 2.25rem; height: 2.25rem;           /* zona táctil cómoda */
  align-items: center; justify-content: center;
  margin: -.6rem;
  color: inherit;
  opacity: .8;
  transition: opacity .3s ease, transform .3s ease, color .3s ease;
}
.redes a:hover, .redes a:focus-visible { opacity: 1; transform: translateY(-2px); }
.redes svg { width: 17px; height: 17px; }
.redes a[title="X"] svg { width: 15px; height: 15px; }

.redes-grupo { display: inline-flex; align-items: center; gap: 1.6rem; }
.portada__pie .redes a:hover { color: #f6eee1; }
.pie .redes { color: var(--tinta-suave); }
.pie .redes a:hover { color: var(--azul-pluma); }
.pie { align-items: center; }

@media (max-width: 899px) {
  .portada__pie { align-items: center; }
  .redes__usuario { display: none; }
}
@media (max-width: 520px) {
  .pie { flex-direction: column; align-items: center; text-align: center; gap: 1.2rem; }
}

/* Móvil: pie con redes abajo, sobre fondo oscuro, para que se lea bien */
@media (max-width: 899px) {
  .portada__pie { top: auto; bottom: 0; padding: 0 1.25rem calc(1.1rem + env(safe-area-inset-bottom)); }
  .portada__contenido { padding-top: 50vh; padding-bottom: calc(4.6rem + env(safe-area-inset-bottom)); }
}
