
:root {
    --ink: #18243a;
    --gold: #b68438;
    --gold-soft: #d4bc8d;
    --paper: #fffdf8;
    --paper-edge: #e9e1d3;
    --muted: #7d7468;
    --screen-bg: #e9ecef;
    --toolbar: #ffffff;
    --shadow: 0 18px 55px rgba(23, 30, 41, .18);
    --physical-width: 7in;
    --physical-height: 8.5in;
    --margin-top: .5in;
    --margin-right: .5in;
    --margin-bottom: .5in;
    --margin-left: .5in;
    --printable-width: 6in;
    --printable-height: 7.5in;
    --divider-left: 3.5in;
    --page-width: 6in;
    --page-height: 7.5in;
    --artboard-width: 6.64in;
    --zoom: .72;
    --split-primary-height: calc(100px * var(--zoom));
    --split-full-height: calc(100px * var(--zoom));
    --split-side-width: 47%;
    --split-center-gap: 6%;
    --ruled-line-step: 20px;
    --notes-inline-heading-height: 20px;

    /*
       AJUSTE RÁPIDO DEL ESPACIO INTERNO DEL MARCO
       Menor porcentaje = más espacio útil para escribir.
    */
    --frame-outer-inset: 1.35%;
    --frame-inner-inset: 1.90%;
    --content-top-side-gap: 4.00%;
    --content-main-side-gap: 4.20%;
    --content-notes-header-gap: 4.20%;
    --content-bottom-right-gap: 5.00%;

    /*
       IMÁGENES DECORATIVAS — CERO "OXÍGENO" REAL.
       gap = 0 significa: la caja gráfica llega hasta el borde interior del marco.
       El aire visual lo crea el difuminado, no un margin/padding físico.
    */
    --church-art-gap: 0%;
    --wheat-art-gap: 0%;
    --church-art-scale: 0.96;

    /*
       DIFUMINADO DE LA IGLESIA EN LOS 4 LADOS
       Norte / Sur / Este / Oeste
    */
    --church-art-opacity: 0.98;
    --church-fade-top: 10px;
    --church-fade-right: 10px;
    --church-fade-bottom: 10px;
    --church-fade-left: 10px;
    --wheat-art-width: 18.5%;
    --wheat-art-height: 26.5%;

    --journal-top-height: 23.5%;
    --journal-meta-top: 26.2%;

    /* PÁGINA IZQUIERDA · CONTROLES VERTICALES ESTABLES */
    --primary-notes-top: 35.2%;
    --primary-notes-bottom: 2.6%;
    --primary-meta-min-height: 27px;
    /*
       ESCALA TIPOGRÁFICA DEL MODELO.
       Ajustes separados para poder afinar sin rehacer el layout.
    */
    --title-size: 54px;
    --subtitle-size: 9.2px;
    --verse-size: 13.5px;
    --verse-ref-size: 7px;
    --bottom-left-size: 8.8px;
    --bottom-verse-size: 12.2px;
    --bottom-ref-size: 6.2px;

    /*
       PÁGINA DERECHA · ENCABEZADO DE SEMANA V2
       Ajustes rápidos para afinarlo sin rehacer el layout.
    */
    --notes-card-width: 88%;
    --notes-card-height: 104px;
    --notes-week-script-size: 21px;
    --notes-week-label-size: 22px;
    --notes-week-number-size: 58px;
    --notes-card-border: 1px;
    --notes-left-column: 66%;
    --notes-right-column: 34%;
    --notes-header-gap: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: #18202d;
    background: var(--screen-bg);
    font-family: "Montserrat", Arial, sans-serif;
}
button, select { font: inherit; }

.studio-header {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 34px;
    align-items: center;
    padding: 22px clamp(18px, 4vw, 54px);
    background: #fcfaf6;
    border-bottom: 1px solid rgba(24,36,58,.12);
}
.studio-brand {
    min-width: 250px;
    padding-right: 30px;
    border-right: 1px solid rgba(182,132,56,.35);
    text-align: center;
}
.studio-brand span {
    display: block;
    color: #1a1d22;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 1.8rem;
    letter-spacing: .08em;
}
.studio-brand small {
    display: block;
    margin-top: 5px;
    color: #756b60;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: .66rem;
    letter-spacing: .28em;
}
.studio-title-block { min-width: 0; }
.studio-kicker {
    color: var(--gold);
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .18em;
}
.studio-title-block h1 {
    margin: 3px 0 2px;
    color: var(--ink);
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: clamp(1.7rem, 3vw, 2.8rem);
    font-weight: 600;
}
.studio-title-block p {
    margin: 0;
    color: #6f6a64;
    font-size: .8rem;
}

.studio-toolbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px clamp(12px, 3vw, 34px);
    background: rgba(255,255,255,.96);
    border-bottom: 1px solid rgba(24,36,58,.14);
    box-shadow: 0 8px 22px rgba(24,36,58,.08);
    backdrop-filter: blur(8px);
}
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
}
.toolbar-group label {
    color: #6d645b;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.toolbar-group select {
    min-height: 38px;
    padding: 0 30px 0 10px;
    color: #253044;
    background: #fff;
    border: 1px solid #d5d0c8;
    border-radius: 3px;
}
.paper-toolbar-group select { min-width: 250px; }
.studio-btn-orientation {
    min-width: 116px;
    min-height: 38px;
    padding: 0 12px;
    cursor: pointer;
    color: #4d4b48;
    background: #fff;
    border: 1px solid #d2ccc3;
    border-radius: 3px;
    font-size: .67rem;
    font-weight: 700;
    letter-spacing: .055em;
}
.studio-btn-orientation:hover { border-color: var(--gold); }
.studio-btn-orientation.is-active {
    color: #fff;
    background: var(--ink);
    border-color: var(--ink);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.studio-btn-orientation.is-locked,
.studio-btn-orientation:disabled {
    cursor: default;
    opacity: 1;
}

.margin-toolbar-group select { min-width: 164px; }
.custom-margin-box {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 7px;
    background: #fbfaf7;
    border: 1px solid #d5d0c8;
    border-radius: 4px;
}
.custom-margin-box[hidden] { display: none !important; }
.custom-margin-title {
    color: #6d645b;
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: .06em;
}
.custom-margin-box label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #6d645b;
    font-size: .55rem;
    font-weight: 700;
}
.custom-margin-box input {
    width: 48px;
    min-height: 28px;
    padding: 2px 4px;
    color: #253044;
    background: #fff;
    border: 1px solid #d5d0c8;
    border-radius: 3px;
    font: 600 .62rem/1 "Montserrat", Arial, sans-serif;
    text-align: center;
}
.custom-margin-box input:focus {
    outline: 2px solid rgba(182,132,56,.25);
    border-color: var(--gold);
}
.custom-margin-unit {
    color: #8b8177;
    font-size: .58rem;
    font-weight: 700;
}
.toolbar-group-label {
    color: #6d645b;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.layout-toolbar-group { align-items: center; }
.layout-segmented {
    display: inline-flex;
    overflow: hidden;
    background: #fff;
    border: 1px solid #cfc8be;
    border-radius: 4px;
}
.layout-choice {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 11px;
    cursor: pointer;
    color: #4e4b47;
    background: #fff;
    border: 0;
    border-right: 1px solid #d8d1c7;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .04em;
}
.layout-choice:last-child { border-right: 0; }
.layout-choice:hover { background: #faf7f1; }
.layout-choice.is-active {
    color: #fff;
    background: var(--ink);
}
.layout-glyph {
    width: 18px;
    height: 22px;
    position: relative;
    flex: 0 0 auto;
    display: block;
    border: 1px solid currentColor;
    background: transparent;
}
.layout-glyph-two::after {
    content: "";
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: calc(var(--divider-left) * var(--zoom));
    width: 1px;
    background: currentColor;
}

    /* La hoja física cambia a horizontal; el diseño del Jornal conserva su proporción editorial. */

.toolbar-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    padding: 0;
    cursor: pointer;
    color: var(--ink);
    background: #fff;
    border: 1px solid #d5d0c8;
    border-radius: 3px;
}
.toolbar-icon:hover { border-color: var(--gold); }
.toolbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-left: auto;
}
.studio-btn {
    min-height: 38px;
    padding: 0 13px;
    cursor: pointer;
    border-radius: 3px;
    font-size: .67rem;
    font-weight: 700;
    letter-spacing: .055em;
}
.studio-btn-soft {
    color: #4d4b48;
    background: #fff;
    border: 1px solid #d2ccc3;
}
.studio-btn-toggle {
    min-width: 156px;
    color: #fff;
    background: #75603f;
    border: 1px solid #75603f;
    transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}
.studio-btn-toggle.is-active {
    color: #fff;
    background: #8f6b32;
    border-color: #8f6b32;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.studio-btn-toggle.is-off {
    color: #5d5851;
    background: #f6f3ee;
    border-color: #c9c1b6;
    box-shadow: none;
}
.studio-btn-dark {
    color: #fff;
    background: var(--ink);
    border: 1px solid var(--ink);
}
.studio-btn-gold {
    color: #fff;
    background: #9f7434;
    border: 1px solid #9f7434;
}
.studio-btn:hover { filter: brightness(.96); }

.paper-advice {
    width: min(1180px, calc(100% - 28px));
    margin: 16px auto 0;
    padding: 11px 14px;
    color: #6b6257;
    background: #fffaf0;
    border: 1px solid #e0c999;
    border-left: 3px solid var(--gold);
    box-shadow: 0 6px 18px rgba(24,36,58,.04);
    font-size: .72rem;
    line-height: 1.55;
}
.paper-advice strong { color: var(--ink); }

.studio-help {
    width: min(1180px, calc(100% - 28px));
    margin: 10px auto 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    overflow: hidden;
    background: #d8d2ca;
    border: 1px solid #d8d2ca;
    box-shadow: 0 8px 22px rgba(24,36,58,.05);
}
.studio-help > div {
    padding: 12px 14px;
    color: #6b645c;
    background: #f8f6f2;
    font-size: .72rem;
    line-height: 1.55;
}
.studio-help strong { color: var(--ink); }

.journal-document {
    width: 100%;
    padding: 34px 16px 68px;
    overflow-x: auto;
}
.journal-spread {
    width: max-content;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: calc(18px * var(--zoom));
    margin: 0 auto 48px;
    padding: calc(12px * var(--zoom));
    border-radius: 8px;
    background: rgba(255,255,255,.2);
}
.journal-spread::before {
    content: "";
    position: sticky;
}

/* El modo de pantalla replica la hoja física que se enviará al diálogo universal. */
body[data-layout="one"] .journal-document {
    display: flex;
    flex-direction: column;
    align-items: center;
}
body[data-layout="one"] .journal-spread { display: contents; }
body[data-layout="one"] .journal-sheet {
    width: calc(var(--physical-width) * var(--zoom));
    height: calc(var(--physical-height) * var(--zoom));
    margin: 0 auto 48px;
    padding:
        calc(var(--margin-top) * var(--zoom))
        calc(var(--margin-right) * var(--zoom))
        calc(var(--margin-bottom) * var(--zoom))
        calc(var(--margin-left) * var(--zoom));
}

body[data-layout="two"] .journal-spread {
    position: relative;
    width: calc(var(--physical-width) * var(--zoom));
    height: calc(var(--physical-height) * var(--zoom));
    gap: 0;
    margin: 0 auto 48px;
    padding:
        calc(var(--margin-top) * var(--zoom))
        calc(var(--margin-right) * var(--zoom))
        calc(var(--margin-bottom) * var(--zoom))
        calc(var(--margin-left) * var(--zoom));
    overflow: hidden;
    border-radius: 0;
    background: #fff;
    box-shadow: var(--shadow);
}
body[data-layout="two"] .journal-spread::after {
    content: "";
    position: absolute;
    z-index: 45;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    pointer-events: none;
    background: rgba(24,36,58,.16);
}
body[data-layout="two"] .journal-sheet {
    margin: 0;
    box-shadow: none;
}
.journal-sheet {
    position: relative;
    flex: 0 0 auto;
    width: calc(var(--page-width) * var(--zoom));
    height: calc(var(--page-height) * var(--zoom));
    display: grid;
    place-items: center;
    background: #fff;
    box-shadow: var(--shadow);
    transform-origin: top center;
}
.journal-sheet[data-side="left"] { border-right: 1px solid rgba(24,36,58,.08); }
.journal-sheet[data-side="right"] { border-left: 1px solid rgba(24,36,58,.08); }
.screen-page-label {
    position: absolute;
    top: 9px;
    right: 10px;
    z-index: 30;
    padding: 5px 8px;
    color: #fff;
    background: rgba(24,36,58,.88);
    border-radius: 999px;
    font-size: calc(.58rem * var(--zoom));
    font-weight: 700;
    letter-spacing: .04em;
    white-space: nowrap;
}

/*
   El marco decorativo NO define el área de escritura.
   Los gaps útiles se controlan arriba en :root con:
   --content-top-side-gap
   --content-main-side-gap
   --content-notes-header-gap
*/
.journal-artboard {
    position: relative;
    width: calc(var(--artboard-width) * var(--zoom));
    aspect-ratio: 584 / 711;
    overflow: hidden;
    color: #1d2534;
    background:
        radial-gradient(circle at 84% 12%, rgba(231,213,179,.12), transparent 20%),
        linear-gradient(#fffdf9, #fffdf9);
    box-shadow: inset 0 0 0 1px rgba(172,147,107,.12);
}
.journal-outer-border,
.journal-inner-border {
    position: absolute;
    pointer-events: none;
    z-index: 20;
}
.journal-outer-border {
    inset: var(--frame-outer-inset);
    border: calc(1.25px * var(--zoom)) solid #b38a4e;
}
.journal-inner-border {
    inset: var(--frame-inner-inset);
    border: calc(.75px * var(--zoom)) solid #d8c5a1;
}

.journal-top {
    position: absolute;

    top: calc(var(--frame-inner-inset) + var(--church-art-gap));
    left: calc(var(--frame-inner-inset) + var(--church-art-gap));
    right: var(--frame-inner-inset);

    height: var(--journal-top-height);

    display: grid;
    grid-template-columns: 32% 68%;
    align-items: center;
}
.church-art {
    width: 100%;
    height: auto;

    margin: 0;
    padding: 0;

    display: flex;
    align-items: flex-start;
    justify-content: flex-start;

    overflow: visible;
}
.church-art img {
    display: block;

    width: 100%;
    height: auto;

    margin: 0;
    padding: 0;

    object-fit: initial;
    object-position: top left;

    transform: scale(var(--church-art-scale));
    transform-origin: top left;

    mix-blend-mode: multiply;
    opacity: var(--church-art-opacity);

    /*
       DIFUMINADO EN LOS 4 COSTADOS
       Arriba, derecha, abajo e izquierda.
       El ancho base es 10px por lado, ajustable con variables.
    */
    -webkit-mask-image:
        linear-gradient(
            to bottom,
            transparent 0,
            #000 var(--church-fade-top),
            #000 calc(100% - var(--church-fade-bottom)),
            transparent 100%
        ),
        linear-gradient(
            to right,
            transparent 0,
            #000 var(--church-fade-left),
            #000 calc(100% - var(--church-fade-right)),
            transparent 100%
        );
    mask-image:
        linear-gradient(
            to bottom,
            transparent 0,
            #000 var(--church-fade-top),
            #000 calc(100% - var(--church-fade-bottom)),
            transparent 100%
        ),
        linear-gradient(
            to right,
            transparent 0,
            #000 var(--church-fade-left),
            #000 calc(100% - var(--church-fade-right)),
            transparent 100%
        );
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
}
.journal-title-area {
    padding: 0 0.8% 0 1.4%;
    text-align: center;
}
.journal-title-area h2 {
    margin: 0;
    color: #132139;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: calc(var(--title-size) * var(--zoom));
    font-weight: 600;
    line-height: .92;
    white-space: nowrap;
}
.journal-title-area h2 em { color: #a57229; font-weight: 600; }
.title-ornament {
    margin: 1.2% 0 3.2%;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 4px;
    align-items: center;
    color: #a88961;
}
.title-ornament i { height: 1px; background: linear-gradient(to right, transparent, #b78a48); }
.title-ornament i:last-child { background: linear-gradient(to left, transparent, #b78a48); }
.title-ornament b {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: calc(var(--subtitle-size) * var(--zoom));
    letter-spacing: .27em;
    white-space: nowrap;
}
.journal-title-area blockquote {
    margin: 0;
    color: #3e4045;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: calc(var(--verse-size) * var(--zoom));
    font-style: italic;
    font-weight: 600;
    line-height: 1.2;
}
.journal-title-area cite {
    display: block;
    margin-top: 2.2%;
    color: #4f5156;
    font-family: "Montserrat", Arial, sans-serif;
    font-size: calc(var(--verse-ref-size) * var(--zoom));
    font-style: normal;
    font-weight: 700;
    letter-spacing: .14em;
}

.journal-meta {
    position: absolute;

    top: var(--journal-meta-top);

    left: var(--content-main-side-gap);
    right: var(--content-main-side-gap);
}

.meta-row { display: grid; margin-bottom: .8%; }
.meta-row-split { grid-template-columns: 68% 32%; }
.meta-field {
    min-height: calc(var(--primary-meta-min-height) * var(--zoom));
    display: flex;
    align-items: center;
    overflow: hidden;
    border: calc(1px * var(--zoom)) solid #3d4854;
    background: rgba(255,255,255,.3);
}
.meta-field + .meta-field { border-left: 0; }
.meta-field strong {
    flex: 0 0 auto;
    padding-left: 2.1%;
    color: #27303b;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: calc(10.4px * var(--zoom));
    font-weight: 700;
    white-space: nowrap;
}
.meta-field .print-editable {
    flex: 1;
    min-width: 0;
    min-height: calc(22px * var(--zoom));
    padding: calc(4px * var(--zoom)) calc(6px * var(--zoom));
    color: #17243a;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: calc(10.4px * var(--zoom));
    font-weight: 600;
    line-height: 1.15;
    outline: none;
    white-space: nowrap;
    overflow: hidden;
}

.notes-section {
    position: absolute;
    /*
       PÁGINA IZQUIERDA:
       comienza DESPUÉS del bloque Pastor/Fecha + Título/Tema.
       El final permanece fijo cerca del borde inferior.
    */
    top: var(--primary-notes-top);
    bottom: var(--primary-notes-bottom);
    left: var(--content-main-side-gap);
    right: var(--content-main-side-gap);
    height: auto;
}
.notes-heading {
    /*
       La cabecera "Notas" vive EXACTAMENTE entre:
       1) las primeras N líneas segmentadas
       2) las líneas continuas
    */
    position: absolute;
    top: var(--split-primary-height);
    left: 0;
    right: 0;
    z-index: 6;
    transform: translateY(calc(10px * var(--zoom)));

    height: calc(var(--notes-inline-heading-height) * var(--zoom));
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: calc(12px * var(--zoom));
    align-items: center;
    margin: 0 25%;
    padding: 0;
    color: #a36f2a;
    background: linear-gradient(
        to bottom,
        rgba(255,253,249,.98),
        rgba(255,253,249,.98)
    );
    pointer-events: none;
}
.notes-heading i { height: 1px; background: #c3a36d; }
.notes-heading h3 {
    margin: 0;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: calc(15px * var(--zoom));
    font-weight: 700;
    line-height: 1;
}
.notes-writing-area {
    width: 100%;
    height: 100%;
    padding: calc(4px * var(--zoom)) calc(3px * var(--zoom)) 0;
    color: #273142;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: calc(10.2px * var(--zoom));
    font-weight: 600;
    line-height: calc(var(--ruled-line-step) * var(--zoom));
    outline: none;
    overflow: hidden;
    white-space: pre-wrap;
    /*
       PRIMERAS N LÍNEAS EN DOS SEGMENTOS, COMO LIBRETA ABIERTA.
       N se controla en Javascript-Print.js con FIRST_SPLIT_RULED_LINES.
       Después de esa zona, las líneas vuelven a ser completas.
    */
    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent calc(var(--ruled-line-step) * var(--zoom) - 1px),
            rgba(67,76,82,.48) calc(var(--ruled-line-step) * var(--zoom) - 1px),
            rgba(67,76,82,.48) calc(var(--ruled-line-step) * var(--zoom))
        ),
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent calc(var(--ruled-line-step) * var(--zoom) - 1px),
            rgba(67,76,82,.48) calc(var(--ruled-line-step) * var(--zoom) - 1px),
            rgba(67,76,82,.48) calc(var(--ruled-line-step) * var(--zoom))
        ),
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent calc(var(--ruled-line-step) * var(--zoom) - 1px),
            rgba(67,76,82,.42) calc(var(--ruled-line-step) * var(--zoom) - 1px),
            rgba(67,76,82,.42) calc(var(--ruled-line-step) * var(--zoom))
        );
    background-size:
        var(--split-side-width) var(--split-primary-height),
        var(--split-side-width) var(--split-primary-height),
        100% calc(
            100% - var(--split-primary-height)
            - (var(--notes-inline-heading-height) * var(--zoom))
            + (var(--ruled-line-step) * var(--zoom))
        );
    background-position:
        left top,
        right top,
        left calc(
            var(--split-primary-height)
            + (var(--notes-inline-heading-height) * var(--zoom))
            - (var(--ruled-line-step) * var(--zoom))
        );
    background-repeat: no-repeat;
}
.print-editable:empty::before {
    content: attr(data-placeholder);
    color: rgba(41,48,58,.35);
    font-weight: 500;
}
.print-editable:focus {
    background-color: rgba(240,224,189,.18);
    box-shadow: inset 0 0 0 calc(1px * var(--zoom)) rgba(182,132,56,.52);
}


/* ==========================================================
   PÁGINA IZQUIERDA · ESTABILIZACIÓN FINAL
   Todo queda scopeado a .journal-sheet-primary para no alterar
   la página derecha.
   ========================================================== */

.journal-sheet-primary .journal-top {
    height: var(--journal-top-height);
}

.journal-sheet-primary .journal-title-area {
    min-width: 0;
    align-self: center;
}

.journal-sheet-primary .journal-meta {
    top: var(--journal-meta-top);
}

.journal-sheet-primary .meta-field {
    min-width: 0;
}

.journal-sheet-primary .notes-section {
    top: var(--primary-notes-top);
    bottom: var(--primary-notes-bottom);
    height: auto;
}

/* Página derecha de notas adicionales */
.journal-artboard-notes {
    background:
        radial-gradient(circle at 13% 88%, rgba(231,213,179,.13), transparent 22%),
        linear-gradient(#fffdf9, #fffdf9);
}
/* =========================
   PÁGINA DERECHA · HEADER LIMPIO
   Estructura HTML actual:

   .notes-premium-card
      .notes-premium-left
         .notes-premium-copy
            .notes-premium-subtitle
            .notes-page-ornament
      .notes-premium-divider
      .notes-premium-right
         .notes-week-block
            .notes-premium-week-script
            .notes-page-week

   Los textos estructurales usan Flex/Grid normal.
   NO usan position:absolute.
   ========================= */

:root {
    --notes-premium-navy: #0b2b50;
    --notes-premium-gold: #c79b4a;
    --notes-premium-gold-soft: #dfc895;
    --notes-premium-cream: #fbf4e7;
    --notes-premium-terracotta: #92502e;
}

.notes-page-header {
    position: absolute;
    top: 3.9%;
    left: 3.2%;
    right: 3.2%;
    text-align: center;
}

.notes-page-header-premium {
    color: var(--ink);
}

/* ---------- CONTENEDOR PRINCIPAL ---------- */

.notes-premium-card {
    width: var(--notes-card-width);
    min-height: calc(var(--notes-card-height) * var(--zoom));
    margin: 0 auto;

    display: grid;
    grid-template-columns:
        var(--notes-left-column)
        calc(var(--notes-card-border) * var(--zoom))
        var(--notes-right-column);

    align-items: stretch;

    overflow: hidden;
    background: transparent;

    border: none;

    box-shadow: none;

    transform: translateY(calc(-10px * var(--zoom)));

    border:#ff0000 0px solid;
}

/* ---------- COLUMNA IZQUIERDA ---------- */

.notes-premium-left {
    min-width: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding:
        calc(8px * var(--zoom))
        calc(16px * var(--zoom));

        border:#0037ff 0px solid;
}

.notes-premium-copy {
    width: 100%;
    min-width: 0;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: calc(var(--notes-header-gap) * var(--zoom));

    margin: 0;
    padding: 0;
}

.notes-premium-subtitle {
    margin: 0;
    padding: 0;

    color: var(--notes-premium-navy);
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(var(--notes-week-label-size) * var(--zoom));
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
    text-align: center;
    transform: translateY(calc(-10px * var(--zoom)));
}

/* DÍA DEL SEÑOR forma parte del flujo natural del DIV izquierdo. */
.notes-page-ornament,
.notes-page-ornament-premium {
    width: 68%;
    margin: 0 auto;
    padding: 0;

    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;

    gap: calc(10px * var(--zoom));
}

.notes-page-ornament-premium i {
    width: 100%;
    height: 1px;
    border: 0;
    background: rgba(199,155,74,.92);
}

.notes-page-ornament-premium b {
    color: #aa8240;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: calc(8px * var(--zoom));
    font-weight: 600;
    line-height: 1;
    letter-spacing: .28em;
    white-space: nowrap;
    text-align: center;
}

.notes-page-ornament-premium::after {
    display: none;
    content: none;
}

/* ---------- DIVISOR ---------- */

.notes-premium-divider {
    width: calc(var(--notes-card-border) * var(--zoom));
    min-width: calc(var(--notes-card-border) * var(--zoom));
    height: 100%;
    
}

/* ---------- COLUMNA DERECHA ---------- */

.notes-premium-right {
    min-width: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 0;
    padding: 0;
}

.notes-week-block {
    width: 100%;
    height: 100%;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: calc(0px * var(--zoom));

    margin: 0;
    padding:
        calc(2px * var(--zoom))
        calc(4px * var(--zoom));
    /* SUBIR SEMANA + NÚMERO JUNTOS */
    transform: translateY(calc(-14px * var(--zoom)));

    overflow: visible;   
    
}
/* ---------- Semana y Numero ---------- */

.notes-premium-week-script {
    display: block;

    width: auto;
    height: auto;
    margin: 0;
    padding: 0;

    color: var(--notes-premium-navy);

    font-family:
        "Edwardian Script ITC",
        "Edwardian Script",
        "Snell Roundhand",
        "Brush Script MT",
        cursive;

    font-size: calc(var(--notes-week-script-size) * var(--zoom));
    font-style: normal;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0;

    white-space: nowrap;
    text-align: center;
    text-shadow: none;    
}

.notes-page-week {
    display: block;

    margin: 0;
    padding: 0;

    color: var(--notes-premium-navy);
    font-family: Georgia, "Times New Roman", serif;

    font-size: calc(var(--notes-week-number-size) * var(--zoom));
    font-style: normal;
    font-weight: 400;
    font-synthesis: none;

    line-height: .38;
    letter-spacing: 0;

    -webkit-text-stroke: 0;
    text-shadow: none;
}

/* Elementos de versiones anteriores ya no forman parte del HTML actual. */
.notes-premium-frame,
.notes-premium-wheat,
.notes-premium-rays,
.notes-premium-midrule,
.notes-premium-divider-diamond {
    display: none;
}

/* ---------- ÁREA DE ESCRITURA DE LA PÁGINA DERECHA ---------- */

.notes-continuation-section {
    position: absolute;

    top: 15%;
    bottom: 1.6%;

    left: var(--content-main-side-gap);
    right: var(--content-main-side-gap);

    height: auto;
    border: #06b700 solid 0px;
}

.notes-writing-area-full {
    height: 100%;
    line-height: calc(var(--ruled-line-step) * var(--zoom));

    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent calc(var(--ruled-line-step) * var(--zoom) - 1px),
            rgba(67,76,82,.42) calc(var(--ruled-line-step) * var(--zoom) - 1px),
            rgba(67,76,82,.42) calc(var(--ruled-line-step) * var(--zoom))
        );

    background-size: 100% 100%;
    background-position: left top;
    background-repeat: no-repeat;
}

.wheat-art {
    position: absolute;

    /*
       CERO GAP desde el borde interior del marco.
       El "oxígeno" ya no se crea con left/bottom: lo crea el difuminado.
    */
    left: calc(var(--frame-inner-inset) + var(--wheat-art-gap));
    bottom: calc(var(--frame-inner-inset) + var(--wheat-art-gap));
    width: var(--wheat-art-width);
    height: var(--wheat-art-height);
    margin: 0;
    padding: 0;
    overflow: visible;
    opacity: .96;
    pointer-events: none;
}
.wheat-art img {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    object-fit: contain;
    object-position: bottom left;
    mix-blend-mode: multiply;

    /*
       Conserva el anclaje fuerte abajo/izquierda y difumina hacia arriba/derecha.
    */
    -webkit-mask-image: radial-gradient(
        ellipse at 0% 100%,
        #000 0%,
        #000 58%,
        rgba(0,0,0,.90) 72%,
        rgba(0,0,0,.48) 87%,
        transparent 100%
    );
    mask-image: radial-gradient(
        ellipse at 0% 100%,
        #000 0%,
        #000 58%,
        rgba(0,0,0,.90) 72%,
        rgba(0,0,0,.48) 87%,
        transparent 100%
    );
}
.wheat-art-notes {
    width: var(--wheat-art-width);
    height: var(--wheat-art-height);
    opacity: .96;
}
.bottom-left-copy {
    position: absolute;
    left: 20.0%;
    bottom: 5.4%;
    color: #b38d5f;
}
.bottom-left-copy strong {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: calc(var(--bottom-left-size) * var(--zoom));
    letter-spacing: .19em;
    line-height: 1.5;
}
.bottom-left-copy i {
    display: block;
    width: 22%;
    height: 1px;
    margin-top: 8%;
    background: #d4b880;
}
.bottom-right-copy {
    position: absolute;
    right: var(--content-bottom-right-gap);
    bottom: 5.4%;
    text-align: right;
}
.bottom-right-copy em {
    display: block;
    color: #252b34;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: calc(var(--bottom-verse-size) * var(--zoom));
    font-weight: 600;
}
.bottom-right-copy small {
    display: block;
    margin-top: 5%;
    color: #4a4c51;
    font-family: "Montserrat", Arial, sans-serif;
    font-size: calc(var(--bottom-ref-size) * var(--zoom));
    font-weight: 700;
    letter-spacing: .13em;
}
.bottom-left-copy-notes { left: 20%; }
.bottom-right-copy-notes { right: var(--content-bottom-right-gap); }

.printed-page-number {
    position: absolute;
    left: 50%;
    bottom: 2.35%;
    z-index: 25;
    min-width: 22px;
    transform: translateX(-50%);
    color: #4e5360;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: calc(9px * var(--zoom));
    font-weight: 700;
    line-height: 1;
    text-align: center;
}
body.hide-page-numbers .printed-page-number {
    display: none !important;
}

.studio-footer {
    padding: 0 20px 42px;
    color: #77716a;
    text-align: center;
    font-size: .72rem;
}
.danger-link {
    padding: 7px 0;
    cursor: pointer;
    color: #8b4b44;
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(139,75,68,.35);
    font-size: .7rem;
}
.studio-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 100;
    max-width: min(90vw, 540px);
    padding: 12px 16px;
    color: #fff;
    background: rgba(24,36,58,.96);
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 4px;
    box-shadow: 0 15px 35px rgba(0,0,0,.25);
    font-size: .78rem;
    line-height: 1.45;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 14px);
    transition: .22s ease;
}
.studio-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
    .studio-help { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    .studio-header { grid-template-columns: 1fr; gap: 12px; }
    .studio-brand { border-right: 0; border-bottom: 1px solid rgba(182,132,56,.3); padding: 0 0 14px; }
    .studio-title-block { text-align: center; }
    .studio-help { grid-template-columns: 1fr; }
    .toolbar-actions { width: 100%; margin-left: 0; }
    .studio-btn { flex: 1 1 130px; }
}
@media (max-width: 620px) {
    .studio-toolbar { align-items: stretch; }
    .toolbar-group { flex: 1 1 100%; }
    .toolbar-group select { flex: 1; min-width: 0; }
    .journal-document { padding-left: 6px; padding-right: 6px; }
}

/* ========================= PRINT ========================= */
@page { size: 7in 8.5in; margin: 0; }


/* =========================
   DOS PÁGINAS / PÁGINA LÓGICA ESTRECHA
   Ajuste compacto del header derecho.
   ========================= */

body[data-layout="two"][data-page-density="compact"] .notes-premium-card {
    width: 90%;
    min-height: calc(88px * var(--zoom));
}

body[data-layout="two"][data-page-density="compact"] .notes-premium-left {
    padding:
        calc(6px * var(--zoom))
        calc(10px * var(--zoom));
}

body[data-layout="two"][data-page-density="compact"] .notes-premium-copy {
    gap: calc(7px * var(--zoom));
}

body[data-layout="two"][data-page-density="compact"] .notes-premium-subtitle {
    font-size: calc(17px * var(--zoom));
}

body[data-layout="two"][data-page-density="compact"] .notes-page-ornament,
body[data-layout="two"][data-page-density="compact"] .notes-page-ornament-premium {
    width: 66%;
}

body[data-layout="two"][data-page-density="compact"] .notes-page-ornament-premium b {
    font-size: calc(6.8px * var(--zoom));
}

body[data-layout="two"][data-page-density="compact"] .notes-week-block {
    gap: calc(1px * var(--zoom));
    padding:
        calc(4px * var(--zoom))
        calc(6px * var(--zoom));
}

body[data-layout="two"][data-page-density="compact"] .notes-premium-week-script {
    font-size: calc(17px * var(--zoom));
}

body[data-layout="two"][data-page-density="compact"] .notes-page-week {
    font-size: calc(46px * var(--zoom));
}

@media print {
    :root { --zoom: 1 !important; }

    html, body {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .studio-header,
    .studio-toolbar,
    .paper-advice,
    .studio-help,
    .studio-footer,
    .studio-toast,
    .screen-page-label {
        display: none !important;
    }

    .journal-document {
        display: block !important;
        width: auto !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    .journal-artboard {
        width: var(--artboard-width) !important;
        box-shadow: none !important;
    }

    .print-editable:empty::before { content: "" !important; }
    .print-editable:focus { box-shadow: none !important; background: transparent !important; }

    /* UNA PÁGINA DEL JORNAL = UNA HOJA FÍSICA */
    body[data-layout="one"] .journal-spread {
        display: contents !important;
    }
    body[data-layout="one"] .journal-sheet {
        width: var(--physical-width) !important;
        height: var(--physical-height) !important;
        margin: 0 !important;
        padding:
            var(--margin-top)
            var(--margin-right)
            var(--margin-bottom)
            var(--margin-left) !important;
        border: 0 !important;
        overflow: hidden !important;
        box-shadow: none !important;
        page-break-after: always;
        break-after: page;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    body[data-layout="one"] .journal-sheet[data-page="104"] {
        page-break-after: auto;
        break-after: auto;
    }
    body[data-layout="one"].print-selection .journal-sheet:not(.is-print-target) {
        display: none !important;
    }
    body[data-layout="one"].print-selection .journal-sheet.is-print-last {
        page-break-after: auto !important;
        break-after: auto !important;
    }

    /* DOS PÁGINAS DEL JORNAL = UNA SOLA HOJA FÍSICA.
       El navegador recibe ya la imposición terminada; por eso en el diálogo
       universal debe quedar Pages per sheet / Páginas por hoja = 1. */
    body[data-layout="two"] .journal-spread {
        display: flex !important;
        flex-direction: row !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        width: var(--physical-width) !important;
        height: var(--physical-height) !important;
        gap: 0 !important;
        margin: 0 !important;
        padding:
            var(--margin-top)
            var(--margin-right)
            var(--margin-bottom)
            var(--margin-left) !important;
        overflow: hidden !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: #fff !important;
        box-shadow: none !important;
        page-break-after: always;
        break-after: page;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    body[data-layout="two"] .journal-spread::after { display: none !important; }
    body[data-layout="two"] .journal-spread[data-week="52"] {
        page-break-after: auto;
        break-after: auto;
    }
    body[data-layout="two"] .journal-sheet {
        flex: 0 0 var(--page-width) !important;
        width: var(--page-width) !important;
        height: var(--page-height) !important;
        margin: 0 !important;
        border: 0 !important;
        overflow: hidden !important;
        box-shadow: none !important;
        page-break-after: auto !important;
        break-after: auto !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    body[data-layout="two"].print-selection .journal-spread:not(.is-print-target) {
        display: none !important;
    }
    body[data-layout="two"].print-selection .journal-spread.is-print-last {
        page-break-after: auto !important;
        break-after: auto !important;
    }
}
