/* ============================================
   ULSE PAPYRUS2 — Auto Height, Realistic Mode
============================================ */

.ulse-papyrus2 {
    position: relative;
    margin: 40px auto;
    --papyrus-base: 600px;
    --papyrus-scale: 1;
    --papyrus-width: calc(var(--papyrus-base) * var(--papyrus-scale));
    max-width: var(--papyrus-width);
    width: min(100%, var(--papyrus-width));
    overflow: visible; /* ensure background pseudo-element not clipped */
    z-index: 0; /* create stacking context so ::before sits behind content */

    /* Transparent base; single papyrus image handled via ::before */
    background: transparent;

    /* Text zone padding INSIDE the papyrus */
    padding:
        calc(140px * var(--papyrus-scale))
        calc(70px * var(--papyrus-scale))
        calc(120px * var(--papyrus-scale));
    color: #3b2a1a;
    font-family: Georgia, serif;
    line-height: 1.85;

    /* Edge slice heights (match papyrus-top/bottom images) */
    --papyrus-top: calc(200px * var(--papyrus-scale));
    --papyrus-bottom: calc(200px * var(--papyrus-scale));

    /* Center inner flow */
    display: grid;
    place-items: center;
    text-align: center;
}

/* Papyrus background layers (top + seamless middle + bottom) */
.ulse-papyrus2::before {
    content: "";
    position: absolute;
    top: var(--papyrus-top);
    bottom: var(--papyrus-bottom);
    left: 0;
    right: 0;
    background-image: url('../img/papyrus-mid2.webp');
    background-size: 100% auto;
    background-repeat: repeat-y;
    background-position: top center;
    opacity: 1;
    pointer-events: none;
    z-index: -2; /* middle layer behind edges */
}

.ulse-papyrus2::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url('../img/papyrus-top2.webp'), url('../img/papyrus-bottom2.webp');
    background-size: 100% var(--papyrus-top), 100% var(--papyrus-bottom);
    background-repeat: no-repeat, no-repeat;
    background-position: top center, bottom center;
    opacity: 1;
    pointer-events: none;
    z-index: -1; /* edge layers above middle, behind text */
}

/* Headings */
.ulse-papyrus2 h1,
.ulse-papyrus2 h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #2b1c0e;
}

/* Paragraphs */
.ulse-papyrus2 p {
    margin-bottom: 18px;
    font-size: 19px;
    text-align: center !important;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.ulse-papyrus2 a {
    overflow-wrap: anywhere;
    word-break: break-word;
    display: inline-block;
}

/* Constrain text width inside the papyrus without shrinking the image */
.ulse-papyrus2 article {
    max-width: 90%;
    width: 100%;
    margin: 0 auto;
}

.ulse-papyrus2 article * {
    max-width: 100%;
}

@media (max-width: 700px) {
    .ulse-papyrus2 {
        padding: calc(110px * var(--papyrus-scale)) calc(40px * var(--papyrus-scale)) calc(100px * var(--papyrus-scale));
    }
    .ulse-papyrus2 article {
        max-width: 95%;
    }
}
