/* ═══════════════════════════════════════════════════════════
   Página de libro — La transmisión del precio (Putin → kebab)
   Tono: marfil moderno, serif Caslon-ish (Instrument Serif).
   Diseño A4-ish: 720×1008+ (la altura crece según contenido).
   ═══════════════════════════════════════════════════════════ */

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

html, body {
  background: #14110d;
  color: #1a1410;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Source Serif 4 — transitional moderno, optimizado para body de prensa.
   * Eje optical size (8..60) → mejor balance grosor/contraste a 17.5 px. */
  font-family: 'Source Serif 4', 'PT Serif', Georgia, 'Times New Roman', serif;
  font-optical-sizing: auto;
}

body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 32px 16px;
  min-height: 100vh;
}
html.embedded body { padding: 24px 8px; min-height: auto; }

/* ── Página ─────────────────────────────────────────────── */
.page {
  width: 720px;
  max-width: 100%;
  background: #f1ead8;
  /* Sutil textura de papel: gradiente diagonal vibrando entre dos
   * tonos casi idénticos. Imperceptible cerca, da "calor" al fondo. */
  background-image:
    linear-gradient(135deg, rgba(180, 150, 90, 0.04) 0%, transparent 40%),
    radial-gradient(ellipse at 30% 20%, rgba(232, 211, 161, 0.2) 0%, transparent 60%);
  color: #1a1410;
  padding: 84px 96px 72px;
  position: relative;
  box-shadow:
    0 24px 80px -20px rgba(0, 0, 0, 0.6),
    0 8px 24px -8px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(0, 0, 0, 0.04) inset;
}

/* Sutil "lomo" en el borde izquierdo — sombra interior que evoca
 * página recién arrancada de un libro encuadernado. */
.page::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 6px;
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.08),
    rgba(0, 0, 0, 0)
  );
  pointer-events: none;
}

/* ── Cuerpo ────────────────────────────────────────────── */
.body {
  font-size: 17px;
  line-height: 1.55;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  /* Source Serif 4 trae ligaduras + onum + tnum — activamos kerning y
   * old-style figures para que los números (24, 2022, 1.80) lean bien
   * sin romper el flow editorial. */
  font-feature-settings: "kern", "liga", "onum";
  font-weight: 400;
}
.body p {
  margin: 0 0 13px;
  text-indent: 1.4em;
  /* Evita huérfanas/viudas — un libro real nunca corta así. */
  orphans: 2;
  widows: 2;
}
.body p.lead { text-indent: 0; }
.body p:last-child { margin-bottom: 0; }

.body em {
  font-style: italic;
  color: #1a1410;
}

/* ── Drop cap — bold romana, no italic, estilo periódico clásico ── */
.dropcap {
  float: left;
  font-family: 'Source Serif 4', 'PT Serif', Georgia, serif;
  font-weight: 700;
  font-size: 58px;
  line-height: 0.9;
  padding: 6px 12px 0 0;
  color: #1a1410;
}

/* ── Botón "Descargar PNG" — solo visible en standalone ── */
.page-capture-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(241, 234, 216, 0.78);
  background: rgba(241, 234, 216, 0.08);
  border: 1px solid rgba(241, 234, 216, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.page-capture-btn svg {
  flex-shrink: 0;
  opacity: 0.85;
}
.page-capture-btn:hover:not(:disabled) {
  color: #f1ead8;
  background: rgba(241, 234, 216, 0.14);
  border-color: rgba(241, 234, 216, 0.32);
}
.page-capture-btn:disabled {
  opacity: 0.55;
  cursor: progress;
}
.page-capture-btn:focus-visible {
  outline: 2px solid #c9a84c;
  outline-offset: 2px;
}
/* En embedded (iframe del post) NO mostramos el botón — es chrome
 * del widget standalone, no contenido para el lector de la newsletter. */
html.embedded .page-capture-btn { display: none; }

/* ── Embedded mode (iframe en posts) ─────────────────────
 * Heredamos el fondo transparente de widget-common.css → la página
 * marfil flota sobre el fondo del propio post.
 *
 * Salimos del display: flex / min-height: 100vh del body base — en un
 * iframe con auto-resize, el flex+vh dejaba un colchón de altura
 * fantasma debajo de la página. Block + margin auto centra igual sin
 * inflar el alto del documento. */
html.embedded body {
  display: block;
  padding: 0;
  min-height: 0;
}
html.embedded .page {
  margin: 0 auto;
  /* En embedded no hace falta tanta sombra exterior — el iframe
   * recorta. Mantenemos solo el "lomo" interior para autenticidad. */
  box-shadow:
    0 12px 40px -16px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.04) inset;
}

/* ── Responsive ──────────────────────────────────────────
 * Por debajo de 720 px el ancho de la página se reduce y los
 * paddings se aprietan. La tipografía baja para no romper el
 * justify en líneas muy estrechas. */
@media (max-width: 760px) {
  body { padding: 16px 8px; }
  .page {
    width: 100%;
    padding: 48px 32px 56px;
  }
  .body { font-size: 16px; line-height: 1.55; }
  .dropcap { font-size: 48px; padding: 4px 10px 0 0; }
}

/* Tema dark del widget-common — la página marfil NO se invierte.
 * Solo el fondo del iframe. */
html[data-theme="light"] body { background: #d8c8a6 !important; }
