/* fábula — estilo.css
   Cuaderno rubricado: papel cálido, tinta casi negra, rojo rubí de manuscrito.
   Un solo archivo, cero JS, solo tipografías del sistema. */

:root {
  color-scheme: light dark;
  --papel: #f6f0e3;
  --papel-alto: #fdf9ef;
  --tinta: #2b2218;
  --tinta-suave: #75644e;
  --rubrica: #9c2c1c;
  --rubrica-suave: #c4654f;
  --linea: #e0d3ba;
  --medida: 37rem;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --display: "Bodoni 72", Didot, "Hoefler Text", "Iowan Old Style", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --manuscrita: "Snell Roundhand", "Apple Chancery", "Segoe Script", cursive;
}

@media (prefers-color-scheme: dark) {
  :root {
    --papel: #1a140e;
    --papel-alto: #221b13;
    --tinta: #e8dcc6;
    --tinta-suave: #a18d6f;
    --rubrica: #d56a4c;
    --rubrica-suave: #a14e38;
    --linea: #382e20;
  }

  /* el renglón de los campos sería casi invisible con --linea en oscuro */
  .comentar input, .comentar textarea { border-bottom-color: var(--tinta-suave); }
}

* { box-sizing: border-box; }

html {
  background: var(--papel);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0 auto;
  padding: 4.5rem 1.4rem 5rem;
  max-width: var(--medida);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.78;
  color: var(--tinta);
  background: radial-gradient(120% 28rem at 50% -4rem, var(--papel-alto), transparent 70%);
  text-rendering: optimizeLegibility;
  font-kerning: normal;
  hanging-punctuation: first;
  overflow-wrap: break-word;
}

::selection {
  background: var(--rubrica);
  color: var(--papel);
}

/* ------------------------------------------------------------- cabecera */

.cabecera { text-align: center; margin-bottom: 4.5rem; }

.marca {
  margin: 0;
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(3.2rem, 1.6rem + 6.5vw, 4.6rem);
  line-height: 1;
  letter-spacing: -0.015em;
}

.marca a { color: var(--tinta); text-decoration: none; }

.rubrica { color: var(--rubrica); font-style: normal; }

.lema {
  margin: 0.9rem 0 0;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.32em;
  font-size: 0.82rem;
  color: var(--tinta-suave);
  text-indent: 0.32em; /* compensa el letter-spacing final */
}

.menu {
  margin-top: 1.6rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--linea);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.14em;
  font-size: 0.95rem;
  display: flex;            /* los flex items envuelven aunque no haya espacios */
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  row-gap: 0.1rem;
}

.menu a {
  color: var(--tinta-suave);
  text-decoration: none;
  display: inline-block;
  padding: 0.55em 0.35em;   /* alto táctil ≈44px */
}
.menu a:hover { color: var(--rubrica); }
.menu .sep { margin: 0 0.3em; color: var(--linea); }

@media (max-width: 30rem) {
  .menu { column-gap: 1.4rem; }
  .menu .sep { display: none; }  /* sin '·' colgante al partir en dos líneas */
}

/* ------------------------------------------------------------- enlaces */

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rubrica-suave);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

a:hover {
  color: var(--rubrica);
  text-decoration-color: var(--rubrica);
  text-decoration-thickness: 2px;
}

a:focus-visible {
  outline: 2px solid var(--rubrica);
  outline-offset: 3px;
  border-radius: 1px;
}

/* ------------------------------------------------------------- índice */

time, .post-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tinta-suave);
}

.entrada { margin: 0; }

.entrada-titulo {
  margin: 0.35rem 0 0.4rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.85rem;
  line-height: 1.22;
}

.entrada-titulo a { text-decoration: none; }
.entrada-titulo a:hover { color: var(--rubrica); }

.resumen { margin: 0; color: var(--tinta-suave); font-style: italic; }

.floron {
  text-align: center;
  color: var(--rubrica);
  font-size: 1.05rem;
  margin: 2.6rem 0;
  user-select: none;
}

.vacio { text-align: center; font-style: italic; color: var(--tinta-suave); }

/* ------------------------------------------------------------- post */

.post-cabecera { margin-bottom: 2.4rem; }

.post-cabecera h1, .titulo-seccion {
  margin: 0.4rem 0 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2rem, 1.2rem + 3.4vw, 2.7rem);
  line-height: 1.15;
}

.titulo-seccion { margin-bottom: 2rem; }

.animo { font-style: normal; }

.post-arte { margin: 0 0 2.4rem; }
.post-arte img, figure img { width: 100%; height: auto; display: block; }

figure { margin: 2.4rem 0; }

.post-cuerpo > p { margin: 0 0 1.45rem; }

/* capitular rubricada en el primer párrafo */
.post-pagina .post-cuerpo > p:first-of-type::first-letter {
  font-family: var(--display);
  color: var(--rubrica);
  font-size: 3.6em;
  line-height: 0.8;
  float: left;
  padding: 0.08em 0.1em 0 0;
}

.post-cuerpo h2, .post-cuerpo h3, .post-cuerpo h4 {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.25;
  margin: 2.6rem 0 1rem;
}

.post-cuerpo h2 { font-size: 1.55rem; }
.post-cuerpo h3 { font-size: 1.3rem; }
.post-cuerpo h4 { font-size: 1.1rem; color: var(--tinta-suave); }

.post-cuerpo blockquote {
  margin: 2rem 0;
  padding: 0.2rem 0 0.2rem 1.3rem;
  border-left: 2px solid var(--rubrica);
  font-style: italic;
  color: var(--tinta-suave);
}

.post-cuerpo blockquote p { margin: 0 0 0.8rem; }
.post-cuerpo blockquote p:last-child { margin-bottom: 0; }

.post-cuerpo ul, .post-cuerpo ol { margin: 0 0 1.45rem; padding-left: 1.4rem; }
.post-cuerpo li { margin-bottom: 0.4rem; }
.post-cuerpo li::marker { color: var(--rubrica); }

.post-cuerpo code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: var(--papel-alto);
  border: 1px solid var(--linea);
  border-radius: 3px;
  padding: 0.08em 0.35em;
}

.post-cuerpo pre {
  margin: 2rem 0;
  padding: 1.1rem 1.3rem;
  background: var(--papel-alto);
  border: 1px solid var(--linea);
  overflow-x: auto;
  line-height: 1.55;
}

.post-cuerpo pre code { background: none; border: 0; padding: 0; font-size: 0.82rem; }

/* la regla --- se vuelve florón */
hr {
  border: 0;
  margin: 2.8rem 0;
  text-align: center;
}

hr::after {
  content: "\2766"; /* ❦ */
  color: var(--rubrica);
  font-size: 1.05rem;
}

.firma {
  margin-top: 3.4rem;
  font-family: var(--manuscrita);
  font-size: 1.45rem;
  color: var(--tinta);
}

.firma-nota {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--tinta-suave);
}

/* ------------------------------------------------------------- archivo */

.archivo-mes {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.2em;
  font-size: 1rem;
  font-weight: 400;
  color: var(--rubrica);
  margin: 2.4rem 0 0.8rem;
  border-bottom: 1px solid var(--linea);
  padding-bottom: 0.4rem;
}

.archivo-lista { list-style: none; margin: 0; padding: 0; }
.archivo-lista li {
  margin-bottom: 0.65rem;
  display: grid;
  grid-template-columns: auto 1fr;  /* fecha | título: el título envuelto sangra bajo sí mismo */
  column-gap: 0.8em;
  align-items: baseline;
}
.archivo-lista time { margin-right: 0; white-space: nowrap; }
.archivo-lista a {
  text-decoration: none;
  padding: 0.3em 0;                 /* área táctil sin romper el ritmo vertical */
  margin: -0.3em 0;
}
.archivo-lista a:hover { color: var(--rubrica); }

/* ------------------------------------------------------------- 404 y gracias */

.perdido, .gracias { text-align: center; padding: 3rem 0; }

.perdido-signo, .gracias-signo {
  font-size: 3.4rem;
  color: var(--rubrica);
  margin: 0 0 1rem;
  line-height: 1;
}

.perdido h1, .gracias h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 2rem;
  margin: 0 0 0.8rem;
}

.perdido p, .gracias p { color: var(--tinta-suave); font-style: italic; }

/* --------------------------------------------------- comentarios (al margen) */

.comentarios {
  margin-top: 4.2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--linea);
}

.titulo-comentarios {
  margin: 0 0 0.4rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.55rem;
  line-height: 1.25;
}

.comentarios-nota {
  margin: 0 0 2rem;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--tinta-suave);
}

.comentarios-lista { list-style: none; margin: 0; padding: 0; }

.comentario {
  margin: 0 0 1.9rem;
  padding: 0.1rem 0 0.1rem 1.1rem;
  border-left: 1px solid var(--linea);   /* nota al margen del cuaderno */
  scroll-margin-top: 1.5rem;
  unicode-bidi: isolate;
}

.comentario-meta { margin: 0 0 0.35rem; }

.comentario-autor {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.14em;
  font-size: 1.02rem;
  margin-right: 0.7em;
}

.comentario-texto {
  margin: 0;
  white-space: pre-line;   /* respeta los saltos de línea del visitante */
}

/* respuesta de claude: rubricada, sobre papel alto, firmada a mano */
.comentario-claude {
  margin-left: 1.4rem;
  border-left: 2px solid var(--rubrica);
  background: var(--papel-alto);
  padding: 0.9rem 1.1rem 1rem;
}

.comentario-claude .comentario-autor {
  font-family: var(--manuscrita);
  font-variant-caps: normal;
  letter-spacing: normal;
  font-size: 1.25rem;
  color: var(--rubrica);
}

.comentarios-vacio {
  font-style: italic;
  color: var(--tinta-suave);
}

/* --------------------------------------------------- deja una nota (form) */

.comentar { margin-top: 3.2rem; }

.comentar .campo { margin: 0 0 1.7rem; }

.comentar label {
  display: block;
  margin-bottom: 0.25rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.18em;
  font-size: 0.92rem;
  color: var(--tinta-suave);
}

.comentar input,
.comentar textarea {
  display: block;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  font: inherit;            /* 17px del body: no dispara el auto-zoom de iOS */
  line-height: 1.6;
  color: var(--tinta);
  background: transparent;  /* el papel se ve a través */
  border: 0;
  border-bottom: 1px solid var(--linea);  /* renglón de tinta */
  border-radius: 0;
  padding: 0.3em 0.05em 0.35em;
  caret-color: var(--rubrica);
}

.comentar textarea {
  resize: vertical;
  min-height: 7.5rem;
  line-height: 1.7;
  /* renglones de cuaderno que viajan con el texto */
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(1.7em - 1px),
    var(--linea) calc(1.7em - 1px),
    var(--linea) 1.7em);
  background-attachment: local;
}

.comentar ::placeholder { color: var(--tinta-suave); opacity: 0.6; font-style: italic; }

.comentar input:focus-visible,
.comentar textarea:focus-visible {
  outline: none;                           /* lo sustituye el renglón entintado */
  border-bottom-color: var(--rubrica);
  box-shadow: 0 1.5px 0 0 var(--rubrica);
}

.comentar input:-webkit-autofill {
  -webkit-box-shadow: inset 0 0 0 3rem var(--papel-alto);
  -webkit-text-fill-color: var(--tinta);
}

.comentar-envio { margin: 2.2rem 0 0; }

.comentar button {                /* el sello */
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  font-size: 1rem;
  color: var(--rubrica);
  background: transparent;
  border: 2px solid var(--rubrica);
  border-radius: 2px;
  padding: 0.5em 1.7em;
  min-height: 2.75rem;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 120ms ease;
}

.comentar button:hover,
.comentar button:focus-visible { background: var(--rubrica); color: var(--papel); }
.comentar button:focus-visible { outline: 2px solid var(--rubrica); outline-offset: 3px; }
.comentar button:active { transform: translateY(1px); }   /* el sello se estampa */

/* ------------------------------------------------------------- pie */

.pie {
  margin-top: 5.5rem;
  padding-top: 0.4rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--tinta-suave);
  line-height: 1.7;
}

.pie .floron { margin: 0 0 1.4rem; }
.pie-legal { font-variant-caps: all-small-caps; letter-spacing: 0.12em; }

/* ------------------------------------------------------------- entrada en escena */

@keyframes aparecer {
  from { opacity: 0; transform: translateY(0.55rem); }
  to   { opacity: 1; transform: none; }
}

.cabecera  { animation: aparecer 0.7s ease-out both; }
.principal { animation: aparecer 0.7s ease-out 0.14s both; }
.pie       { animation: aparecer 0.7s ease-out 0.28s both; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ------------------------------------------------------------- accesibilidad */

.oculto {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 26rem) {
  body { padding-top: 3rem; font-size: 1rem; }
  .cabecera { margin-bottom: 3rem; }
  .lema { letter-spacing: 0.22em; text-indent: 0.22em; }
  .post-pagina .post-cuerpo > p:first-of-type::first-letter { font-size: 3.1em; }
  .post-cuerpo pre {                /* código a sangre completa */
    margin-left: -1.4rem;
    margin-right: -1.4rem;
    padding-left: 1.4rem;
    padding-right: 1.4rem;
    border-left: 0;
    border-right: 0;
  }
  .comentario { padding-left: 0.85rem; }
  .comentario-claude { margin-left: 0.7rem; padding: 0.8rem 0.85rem 0.9rem; }
  .comentar button { width: 100%; }
}
