/*
 * recetario.css
 * Recetarios temáticos para pacientes (recetarios.html y recetarios/*.html,
 * generados por scripts/generate-recetarios.mjs).
 *
 * Acabado editorial: portada a sangre con foto y velo oscuro, Playfair Display
 * para los títulos e Inter para el texto, filetes finos en oro y mucho aire.
 * Dos recetas por hoja A4. Vale igual para leerlo en el móvil.
 */

:root {
    --rc-papel:     #fbf9f6;   /* blanco cálido                      */
    --rc-papel-2:   #f4f0e9;   /* fondos suaves                      */
    --rc-tinta:     #1c1a17;
    --rc-tinta-2:   #454039;
    --rc-tenue:     #6f6a62;
    --rc-oro:       #b08d3f;
    --rc-oro-suave: rgba(176, 141, 63, 0.34);
    --rc-linea:     rgba(28, 26, 23, 0.13);
    --rc-oscuro:    #14120f;   /* portada                            */
    --rc-display:   'Playfair Display', Georgia, 'Times New Roman', serif;
    --rc-texto:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: var(--rc-texto);
    background: var(--rc-papel);
    color: var(--rc-tinta);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; }

/* Versalitas: el recurso que más se repite (rótulos, pies, macros). */
.vers {
    font-size: 9.5px; font-weight: 600;
    letter-spacing: 0.18em; text-transform: uppercase;
}

/* === Barra de acciones (no se imprime) ================================= */

.barra {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 11px 18px;
    background: rgba(251, 249, 246, 0.92);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--rc-linea);
}
.volver { font-size: 13px; color: var(--rc-tenue); text-decoration: none; }
.volver:hover { color: var(--rc-tinta); }
.btn-print {
    font-family: inherit; font-size: 10px; font-weight: 600; text-decoration: none;
    display: inline-block; line-height: 1;
    letter-spacing: 0.16em; text-transform: uppercase;
    background: var(--rc-tinta); color: var(--rc-papel);
    border: 0; border-radius: 2px; padding: 11px 22px; cursor: pointer;
}
.btn-print:hover { background: #000; }

/* === Portada a sangre ================================================== */

/* Ojo: el relleno va en .portada-txt, no en .portada. Un hijo absoluto se
   coloca contra la caja de RELLENO del padre, así que con el padding aquí la
   foto y el velo se quedaban encogidos dentro del margen. */
.portada {
    position: relative; overflow: hidden;
    background: var(--rc-oscuro);
    min-height: 78vh;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    text-align: center;
    color: #fff;
}
.portada-txt {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; align-items: center;
    padding: 64px 30px;
}
.portada-foto {
    position: absolute; inset: 0;
    width: 100%; height: 100%; object-fit: cover;
    opacity: 0.58;
}
/* Velo: sin él la tipografía se pierde sobre la foto. */
.portada::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(20,18,15,0.78) 0%, rgba(20,18,15,0.42) 42%, rgba(20,18,15,0.86) 100%);
}

.portada-marca { color: rgba(255, 255, 255, 0.75); }
.portada-filete {
    width: 46px; height: 1px; background: var(--rc-oro);
    margin: 20px auto 22px;
}
.portada h1 {
    font-family: var(--rc-display);
    font-size: clamp(38px, 9vw, 62px); font-weight: 700;
    line-height: 1.06; letter-spacing: -0.015em;
    max-width: 12em;
}
.portada-sub {
    margin-top: 18px; font-size: 14px; line-height: 1.7;
    color: rgba(255, 255, 255, 0.82); max-width: 28em;
}
.portada-pie {
    margin-top: 34px; color: var(--rc-oro);
    display: flex; align-items: center; gap: 12px;
}
.portada-pie::before, .portada-pie::after {
    content: ""; width: 26px; height: 1px; background: var(--rc-oro-suave);
}

/* === Contenido (índice) ================================================ */

.libro { max-width: 720px; margin: 0 auto; padding: 0 22px 60px; }

.contenido { padding: 46px 0 10px; }
.contenido h2 {
    font-family: var(--rc-display); font-size: 30px; font-weight: 700;
    text-align: center; letter-spacing: -0.01em;
}
.contenido-nota {
    margin: 14px auto 0; max-width: 34em; text-align: center;
    font-size: 12.5px; line-height: 1.75; color: var(--rc-tenue);
}
.contenido-nota strong { color: var(--rc-tinta); font-weight: 600; }
.contenido-nota a { color: var(--rc-oro); font-weight: 500; }

.sumario { margin-top: 30px; }
.sumario li {
    list-style: none; display: flex; align-items: baseline; gap: 10px;
    padding: 9px 0; border-bottom: 1px solid var(--rc-linea);
    font-size: 13px;
}
.sumario li:first-child { border-top: 1px solid var(--rc-linea); }
.sum-n {
    font-family: var(--rc-display); font-size: 13px; color: var(--rc-oro);
    min-width: 22px;
}
.sum-t { color: var(--rc-tinta-2); }
/* Puntitos de guía hasta las kcal, como en un índice de libro. */
.sum-guia {
    flex: 1; height: 1px; margin: 0 4px 4px;
    background-image: radial-gradient(circle, var(--rc-linea) 1px, transparent 1px);
    background-size: 5px 1px; background-repeat: repeat-x;
}
.sum-kcal { color: var(--rc-tenue); font-size: 11.5px; white-space: nowrap; }

/* === Ficha de receta =================================================== */

.receta { padding: 34px 0; border-top: 1px solid var(--rc-linea); }
.receta:first-of-type { border-top: 0; }

.receta-cab { margin-bottom: 20px; }
.receta-num {
    font-family: var(--rc-display); font-size: 13px; color: var(--rc-oro);
    display: block; margin-bottom: 7px; letter-spacing: 0.06em;
}
.receta-num i { font-style: normal; color: var(--rc-oro-suave); }
.receta-cab h3 {
    font-family: var(--rc-display); font-size: clamp(21px, 4.4vw, 26px);
    font-weight: 700; line-height: 1.2; letter-spacing: -0.015em;
}

.receta-cuerpo { display: grid; grid-template-columns: 1fr; gap: 22px; }
/* Las fotos del banco son cuadradas y con el plato centrado: recortarlas a
   vertical se lleva medio plato por delante. */
.receta-foto img {
    width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
    border-radius: 2px; background: var(--rc-papel-2); display: block;
}

/* Ficha de macros bajo la foto, como una tabla de datos. */
.ficha { margin-top: 12px; }
.ficha div {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 5px 0; border-bottom: 1px solid var(--rc-linea);
}
.ficha div:first-child { border-top: 1px solid var(--rc-linea); }
.ficha dt { color: var(--rc-tenue); }
.ficha dd {
    font-size: 12px; font-weight: 500; color: var(--rc-tinta);
    font-variant-numeric: tabular-nums;
}

.rotulo {
    color: var(--rc-oro); margin-bottom: 10px;
    display: flex; align-items: center; gap: 10px;
}
/* Filete que sale del rótulo y corre hasta el margen. */
.rotulo::after {
    content: ""; flex: 1; height: 1px; background: var(--rc-oro-suave);
}
.bloque {
    font-size: 12.5px; color: var(--rc-tinta-2); line-height: 1.75;
}
.bloque + .rotulo { margin-top: 22px; }

.pasos { list-style: none; counter-reset: paso; }
.pasos li {
    counter-increment: paso; position: relative;
    padding: 0 0 11px 26px;
    font-size: 12.5px; color: var(--rc-tinta-2); line-height: 1.7;
}
.pasos li:last-child { padding-bottom: 0; }
/* Numeral dorado colgando: más fino que la bolita de color. */
.pasos li::before {
    content: counter(paso, decimal-leading-zero);
    position: absolute; left: 0; top: 0;
    font-family: var(--rc-display); font-size: 11.5px; color: var(--rc-oro);
}

/* === Cierre ============================================================ */

.cierre {
    margin-top: 40px; padding: 34px 20px 0;
    border-top: 1px solid var(--rc-linea);
    text-align: center; font-size: 11.5px; color: var(--rc-tenue); line-height: 1.75;
}
.cierre-marca { color: var(--rc-oro); margin-bottom: 12px; }
.cierre a { color: var(--rc-tinta); font-weight: 500; }

/* === Índice de recetarios (recetarios.html) ============================ */

.indice-libros { max-width: 1040px; margin: 0 auto; padding: 0 22px 60px; }
.indice-header {
    text-align: center; padding: 56px 20px 40px;
}
.indice-header h1 {
    font-family: var(--rc-display); font-size: clamp(34px, 7vw, 52px);
    font-weight: 700; letter-spacing: -0.02em; margin-top: 18px;
}
.indice-header p {
    font-size: 13px; color: var(--rc-tenue); max-width: 36em;
    margin: 16px auto 0; line-height: 1.75;
}

.libros-grid {
    display: grid; gap: 28px 24px;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}
.libro-card {
    text-decoration: none; display: flex; flex-direction: column;
}
.libro-portada {
    position: relative; overflow: hidden; background: var(--rc-oscuro);
    aspect-ratio: 3 / 4; border-radius: 3px;
}
.libro-portada img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; opacity: 0.45;
    transition: transform 0.4s ease, opacity 0.4s ease;
}
.libro-card:hover .libro-portada img { transform: scale(1.04); opacity: 0.55; }
.libro-portada-txt {
    position: absolute; inset: 0; z-index: 1;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    text-align: center; padding: 26px 20px; color: #fff;
    background: linear-gradient(180deg, rgba(20,18,15,0.7) 0%, rgba(20,18,15,0.45) 50%, rgba(20,18,15,0.8) 100%);
}
.libro-portada-txt h2 {
    font-family: var(--rc-display); font-size: 24px; font-weight: 700;
    line-height: 1.15; letter-spacing: -0.01em;
}
.libro-filete { width: 34px; height: 1px; background: var(--rc-oro); margin: 14px 0; }
.libro-portada-txt .vers { color: rgba(255, 255, 255, 0.78); }
.libro-portada-txt h2 + .vers { margin-top: 14px; }
.libro-info { padding: 14px 2px 0; flex: 1; display: flex; flex-direction: column; }
.libro-info p { font-size: 12.5px; color: var(--rc-tenue); line-height: 1.65; }
.libro-cta { margin-top: auto; padding-top: 12px; color: var(--rc-oro); }

/* === Pantallas anchas ================================================== */

@media (min-width: 700px) {
    .receta-cuerpo { grid-template-columns: 5fr 7fr; gap: 30px; }
    .sumario { columns: 2; column-gap: 40px; }
    .sumario li { break-inside: avoid; }
}

/* === Impresión / PDF =================================================== */

@page { size: A4; margin: 16mm 15mm; }
/* La portada va a sangre: sin márgenes en la primera hoja. */
@page :first { margin: 0; }

@media print {
    body { background: #fff; }
    .no-print { display: none !important; }
    .libro, .indice-libros { max-width: none; padding: 0; }

    /* Sin esto la impresión se come el velo de la portada y el oro. */
    .portada, .portada::after, .portada-foto, .libro-portada, .libro-portada-txt,
    .sum-guia, .receta-foto img {
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }

    .portada {
        width: 210mm; height: 297mm; min-height: 0;
        break-after: page;
    }
    .portada-txt { padding: 40mm 26mm; }
    .portada h1 { font-size: 40pt; }
    .portada-sub { font-size: 11pt; }

    .contenido { padding: 0 0 6mm; break-after: page; }
    .contenido h2 { font-size: 24pt; }
    .sumario { columns: 2; column-gap: 12mm; }
    .sumario li { break-inside: avoid; font-size: 9.5pt; }

    /* Las fichas fluyen y nunca se parten: entran 2-3 por hoja según lo larga
       que sea cada receta. Forzar un corte cada dos dejaba medias páginas en
       blanco cuando la primera receta era larga. */
    .receta {
        break-inside: avoid;
        padding: 0 0 9mm;
        margin-bottom: 9mm;
        border-top: 0; border-bottom: 1px solid var(--rc-linea);
    }
    .receta:last-of-type { border-bottom: 0; }
    .receta-cab { margin-bottom: 5mm; }
    .receta-cab h3 { font-size: 17pt; }
    .receta-cuerpo { grid-template-columns: 4fr 8fr; gap: 9mm; }
    .receta-foto img { aspect-ratio: 1 / 1; }
    .bloque, .pasos li { font-size: 9pt; orphans: 2; widows: 2; }
    .ficha dd { font-size: 8.5pt; }
    .vers { font-size: 7.5pt; }

    .cierre { break-inside: avoid; }
    .libro-card { break-inside: avoid; }
}
