/* Portal del autor · Editorial Tepublicamos
   Mismos colores y tipografías que la web. Letra grande y botones amplios:
   buena parte de nuestros autores tiene entre 46 y 75 años. */

/* Tipografías servidas desde el propio portal (licencia SIL OFL, ver fuentes/OFL-*.txt):
   así Google no ve la dirección de quien visita el portal. */
@font-face {
  font-family: "Lora"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fuentes/Lora-wght.e71368f22122.ttf") format("truetype");
}
@font-face {
  font-family: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("fuentes/SourceSerif4-opsz-wght.c0afa3622c49.ttf") format("truetype");
}
@font-face {
  font-family: "Source Serif 4"; font-style: italic; font-weight: 200 900; font-display: swap;
  src: url("fuentes/SourceSerif4-Italic-opsz-wght.05e591090036.ttf") format("truetype");
}

:root {
  --ink: #1E1B18;
  --ink-soft: #4A443E;
  --muted: #6F675E;
  --primary: #C8641C;
  --primary-dk: #A34C10;
  --accent: #4F9D89;
  --accent-dk: #3E8473;
  --paper: #FBF6EF;
  --paper-2: #F2EADF;
  --white: #FFFFFF;
  --line: #E8DECF;
  --ok: #2E7D5B;
  --mal: #B42318;
  --espera: #8A6D00;
  --font-display: "Lora", Georgia, serif;
  --font-body: "Source Serif 4", Georgia, serif;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(30, 27, 24, .06), 0 2px 8px rgba(30, 27, 24, .05);
  --shadow: 0 6px 18px rgba(30, 27, 24, .10);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: var(--primary-dk); text-underline-offset: 3px; }
a:hover { color: var(--primary); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .5em; color: var(--ink); }
h1 { font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 1.2rem + .6vw, 1.7rem); }
h3 { font-size: 1.2rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.contenedor { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 16px; }
.principal { flex: 1; padding-top: 32px; padding-bottom: 56px; }

/* Cabecera y pie */
.cabecera { background: var(--white); border-bottom: 1px solid var(--line); }
.cabecera__fila { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.marca img { width: clamp(170px, 40vw, 230px); height: auto; }
.sesion { display: flex; align-items: center; gap: 14px; font-size: 1rem; }
.sesion__nombre { color: var(--muted); }
.sesion form { margin: 0; }
.enlace { background: none; border: 0; padding: 6px 0; font: inherit; color: var(--primary-dk); text-decoration: underline; cursor: pointer; }
.pie { border-top: 1px solid var(--line); padding: 22px 0; color: var(--muted); font-size: .95rem; text-align: center; }

/* Botones */
.boton {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 12px 24px;
  border: 2px solid var(--primary); border-radius: 999px;
  background: var(--primary); color: var(--white);
  font: 600 1.05rem/1.2 var(--font-body); text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.boton:hover { background: var(--primary-dk); border-color: var(--primary-dk); color: var(--white); }
.boton--secundario { background: var(--accent); border-color: var(--accent); }
.boton--secundario:hover { background: var(--accent-dk); border-color: var(--accent-dk); }
.boton--borde { background: transparent; color: var(--primary-dk); }
.boton--borde:hover { background: var(--paper-2); color: var(--primary-dk); }
.boton--ancho { width: 100%; }
.casilla-compartido { display: flex; gap: 12px; align-items: flex-start; margin: 18px 0 22px; font-size: 1.05rem; cursor: pointer; }
.casilla-compartido input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--primary); }
.casilla-compartido small { display: block; color: var(--muted); font-size: .95rem; margin-top: 2px; }
.botones { display: flex; flex-wrap: wrap; gap: 12px; }

/* Tarjetas y bloques */
.tarjeta, .bloque {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: clamp(20px, 4vw, 36px); margin-bottom: 24px;
}
.tarjeta--estrecha { max-width: 560px; margin: 24px auto; }
.bloque--destacado { border: 2px solid var(--primary); background: #FFFBF6; }
.bloque__cabecera { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.bloque__cabecera h2 { margin: 0; }
.entradilla { font-size: 1.2rem; color: var(--ink-soft); }
.nota { color: var(--muted); font-size: .98rem; }
.nota-equipo { background: var(--paper); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 10px 0; }
.miga { margin: 0 0 16px; font-size: 1rem; }
.lista-ayuda { padding-left: 1.2em; color: var(--ink-soft); }
.aviso-prueba { background: #FFF6D6; border: 1px dashed var(--espera); border-radius: var(--radius-sm); padding: 12px 14px; margin: 18px 0; font-size: .95rem; word-break: break-all; }

/* Mensajes */
.mensajes { margin-bottom: 20px; }
.mensaje { margin: 0 0 8px; padding: 14px 18px; border-radius: var(--radius-sm); background: var(--paper-2); border: 1px solid var(--line); }
.mensaje--success { background: #E7F4EE; border-color: #B9DFCC; color: #1D5A40; }
.mensaje--error { background: #FDECEA; border-color: #F5C2BC; color: var(--mal); }

/* Formularios */
.campo { margin-bottom: 18px; flex: 1; min-width: 0; }
.campo label { display: block; font-weight: 600; margin-bottom: 6px; }
.campo small { display: block; color: var(--muted); margin-top: 4px; }
.opcional { font-weight: 400; color: var(--muted); font-size: .92rem; }
.campo input, .campo select, .campo textarea {
  width: 100%; min-height: 50px; padding: 11px 14px;
  border: 1.5px solid #D6C9B6; border-radius: var(--radius-sm);
  background: var(--white); color: var(--ink); font: inherit;
}
.campo textarea { min-height: 120px; resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus { border-color: var(--accent); outline: 3px solid rgba(79, 157, 137, .25); outline-offset: 0; }
.campo--error input, .campo--error select, .campo--error textarea { border-color: var(--mal); }
.error { color: var(--mal); margin: 6px 0 0; font-size: .98rem; }
fieldset { border: 0; padding: 0; margin: 0 0 12px; }
legend { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; margin-bottom: 12px; }
.fila { display: flex; gap: 16px; }

/* Mis libros */
.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.libro-tarjeta {
  display: flex; gap: 16px; padding: 18px; background: var(--white);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s;
}
.libro-tarjeta:hover { box-shadow: var(--shadow); transform: translateY(-2px); color: inherit; }
.libro-tarjeta .portada { width: 92px; flex-shrink: 0; }
.libro-tarjeta__cuerpo { min-width: 0; flex: 1; }
.libro-tarjeta h2 { font-size: 1.2rem; margin-bottom: 8px; }
.fase-chip { display: inline-block; margin: 0 0 10px; padding: 3px 12px; border-radius: 999px; background: var(--paper-2); font-size: .95rem; }
.progreso { height: 8px; border-radius: 99px; background: var(--paper-2); overflow: hidden; }
.progreso span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.pendiente { margin: 10px 0 0; color: var(--primary-dk); font-weight: 600; font-size: 1rem; }

/* Portada */
.portada { aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px; box-shadow: var(--shadow); background: var(--paper-2); }
.portada--vacia {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 12px; text-align: center; background: var(--paper-2); border: 1px solid var(--line); box-shadow: none;
  color: var(--ink-soft); font-family: var(--font-display); font-size: .85rem; line-height: 1.25; overflow: hidden;
}
.portada__emoji { font-size: 2.4em; line-height: 1; }

/* Ficha del libro */
.ficha { display: flex; gap: clamp(20px, 4vw, 40px); align-items: flex-start; margin-bottom: 28px; }
.ficha > .portada { width: clamp(120px, 26vw, 220px); flex-shrink: 0; }
.ficha__texto { min-width: 0; flex: 1; }
.ficha .portada--vacia { font-size: 1.05rem; }
.subtitulo { font-size: 1.2rem; color: var(--ink-soft); margin: -4px 0 8px; font-style: italic; }
.datos { color: var(--muted); margin: 0 0 18px; }
.fase-actual { background: var(--white); border: 1px solid var(--line); border-left: 6px solid var(--accent); border-radius: var(--radius-sm); padding: 16px 20px; margin-bottom: 18px; }
.fase-actual p { margin: 0 0 6px; }
.fase-actual__etiqueta { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; color: var(--muted); }
.fase-actual__nombre { font-family: var(--font-display); font-size: 1.45rem; font-weight: 600; }

/* Pruebas */
.prueba + .prueba { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 24px; }
.version { font-family: var(--font-body); font-size: .95rem; font-weight: 400; color: var(--muted); }
.pasos { padding-left: 1.3em; }
.pasos li { margin-bottom: 10px; }

/* Línea de fases */
.linea { list-style: none; margin: 0 0 20px; padding: 0; }
.linea__paso { position: relative; display: flex; align-items: center; gap: 14px; padding: 8px 0; }
.linea__paso:not(:last-child)::after { content: ""; position: absolute; left: 17px; top: 44px; bottom: -8px; width: 2px; background: var(--line); }
.linea__paso--hecha:not(:last-child)::after { background: var(--accent); }
.linea__punto {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--line); background: var(--white); color: var(--muted); font-size: .95rem; font-weight: 600;
}
.linea__paso--hecha .linea__punto { background: var(--accent); border-color: var(--accent); color: var(--white); }
.linea__paso--hecha .linea__nombre { color: var(--ink-soft); }
.linea__paso--actual .linea__punto { background: var(--primary); border-color: var(--primary); color: var(--white); box-shadow: 0 0 0 5px rgba(200, 100, 28, .18); }
.linea__paso--actual .linea__nombre { font-weight: 700; }
.linea__paso--actual em { color: var(--primary-dk); font-style: normal; font-weight: 600; }
.linea__paso--pendiente .linea__nombre { color: var(--muted); }
.notas { list-style: none; padding: 0; margin: 0; }
.notas li { padding: 10px 0; border-top: 1px solid var(--line); }

/* Material */
.materiales { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; margin-top: 16px; }
.material { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--paper); display: flex; flex-direction: column; }
.material img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--paper-2); }
.material__icono { aspect-ratio: 4 / 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: var(--paper-2); font-family: var(--font-display); font-size: 1rem; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
.material__emoji { font-size: 2.8rem; line-height: 1; letter-spacing: 0; }
.material__texto { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }

/* Listas de estado */
.solicitudes { list-style: none; padding: 0; margin: 0; }
.solicitudes li { padding: 14px 0; border-top: 1px solid var(--line); }
.solicitudes li:first-child { border-top: 0; }
.estado { display: inline-block; margin-right: 8px; padding: 2px 10px; border-radius: 999px; font-size: .88rem; font-weight: 600; background: var(--paper-2); }
.estado--pendiente, .estado--preparando { background: #FFF3CF; color: var(--espera); }
.estado--enviada, .estado--aprobada { background: #E2F2EA; color: var(--ok); }
.estado--cancelada, .estado--cambios { background: #FDECEA; color: var(--mal); }

/* Ficha del autor */
.aviso-ficha { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; align-items: center; margin: 0 0 24px; padding: 16px 20px;
  background: #FFF6EC; border: 1.5px solid var(--primary-lt, #DD8038); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.aviso-ficha:hover { background: #FFEFDD; color: var(--ink); }
.aviso-ficha strong { font-family: var(--font-display); font-size: 1.15rem; }
.aviso-ficha span { grid-column: 1; color: var(--ink-soft); }
.aviso-ficha__flecha { grid-column: 2 !important; grid-row: 1 / span 2; font-size: 1.6rem; color: var(--primary-dk) !important; }
.ficha-autor { display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: start; }
.ficha-autor__foto img, .ficha-autor__sin-foto { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: 12px; }
.ficha-autor__sin-foto { display: flex; align-items: center; justify-content: center; background: var(--paper-2); color: var(--muted);
  font-family: var(--font-display); font-size: 3rem; letter-spacing: .05em; }
.ficha-autor__foto .campo input { min-height: 0; padding: 8px; font-size: .95rem; }
@media (max-width: 640px) { .ficha-autor { grid-template-columns: 1fr; } .ficha-autor__foto { max-width: 220px; } }

/* Libro en 3D (solo CSS). --w es el ancho de la portada; alto y lomo salen de sus proporciones. */
.visor3d { --w: clamp(150px, 26vw, 230px); --h: calc(var(--w) * var(--prop-alto)); --t: calc(var(--w) * var(--prop-lomo));
  flex-shrink: 0; width: calc(var(--w) + 90px); display: flex; flex-direction: column; align-items: center; }
.visor3d__escena { position: relative; width: 100%; height: calc(var(--h) + 60px); display: flex; align-items: center; justify-content: center;
  perspective: 1400px; cursor: grab; touch-action: none; user-select: none; }
.visor3d__escena:active { cursor: grabbing; }
.visor3d__libro { position: relative; width: var(--w); height: var(--h); transform-style: preserve-3d; }
.visor3d__cara { position: absolute; top: 0; left: 0; background-size: 100% 100%; background-color: #C9BBA8; backface-visibility: hidden; }
.visor3d__frontal, .visor3d__trasera { width: var(--w); height: var(--h); }
.visor3d__frontal { transform: translateZ(calc(var(--t) / 2)); border-radius: 0 3px 3px 0;
  box-shadow: inset 4px 0 6px -3px rgba(255, 255, 255, .45), inset -1px 0 0 rgba(0, 0, 0, .08); }
.visor3d__trasera { transform: rotateY(180deg) translateZ(calc(var(--t) / 2)); border-radius: 3px 0 0 3px; }
.visor3d__lomo { width: var(--t); height: var(--h); left: calc((var(--w) - var(--t)) / 2);
  transform: rotateY(-90deg) translateZ(calc(var(--w) / 2)); filter: brightness(.9); }
.visor3d__hojas { background: repeating-linear-gradient(90deg, #FDFAF2 0 1px, #E9E1D1 1px 2px); }
.visor3d__hojas--lado { width: calc(var(--t) - 2px); height: calc(var(--h) - 4px); top: 2px; left: calc((var(--w) - var(--t)) / 2 + 1px);
  transform: rotateY(90deg) translateZ(calc(var(--w) / 2 - 2px)); }
.visor3d__hojas--arriba, .visor3d__hojas--abajo { width: calc(var(--w) - 3px); height: calc(var(--t) - 2px); top: calc((var(--h) - var(--t)) / 2 + 1px);
  background: repeating-linear-gradient(0deg, #FDFAF2 0 1px, #E9E1D1 1px 2px); }
.visor3d__hojas--arriba { transform: rotateX(90deg) translateZ(calc(var(--h) / 2 - 2px)); }
.visor3d__hojas--abajo { transform: rotateX(-90deg) translateZ(calc(var(--h) / 2 - 2px)); }
.visor3d__sombra { position: absolute; bottom: 8px; left: 50%; width: calc(var(--w) * 1.1); height: 22px; transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(30, 27, 24, .28), transparent 70%); pointer-events: none; }
.visor3d__botones { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.visor3d__botones button { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--white);
  font: inherit; font-size: .9rem; color: var(--ink-soft); cursor: pointer; }
.visor3d__botones button:hover { border-color: var(--primary); color: var(--primary-dk); }
.visor3d__ayuda { margin: 6px 0 0; font-size: .85rem; }
@media (prefers-reduced-motion: reduce) { .visor3d__libro { transition: none !important; } }

@media (max-width: 640px) {
  body { font-size: 1.07rem; }
  .ficha { flex-direction: column; }
  .ficha > .portada { width: 150px; }
  .fila { flex-direction: column; gap: 0; }
  .botones .boton { width: 100%; }
  .sesion__nombre { display: none; }
}
