.hvs-church-bulletin,
.hvs-bulletin-modal {
    box-sizing: border-box;
}

.hvs-church-bulletin *,
.hvs-bulletin-modal * {
    box-sizing: border-box;
}

.hvs-church-bulletin {
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
}

.hvs-bulletin-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.hvs-bulletin-headline {
    margin: 0;
    font-size: clamp(28px, 4vw, 44px);
    line-height: 1.1;
    font-weight: 800;
}

.hvs-bulletin-edit-button,
.hvs-bulletin-button,
.hvs-bulletin-save,
.hvs-bulletin-cancel,
.hvs-bulletin-media-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 8px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

.hvs-bulletin-edit-button {
    flex: 0 0 auto;
    padding: 10px 18px;
    border: 1px solid #d3d7dd;
    background: #fff;
    color: #222;
}

.hvs-bulletin-image-slot {
    width: 100%;
    overflow: hidden;
    border-radius: 12px;
    background: #f4f5f6;
}

.hvs-bulletin-image {
    display: block;
    width: 100%;
    height: auto;
}

.hvs-bulletin-empty-image,
.hvs-bulletin-no-pdf {
    padding: 18px;
    border: 2px dashed #cfd4da;
    border-radius: 10px;
    color: #626b75;
    text-align: center;
}

.hvs-bulletin-no-pdf {
    margin-top: 16px;
}

.hvs-bulletin-button-row {
    margin-top: 20px;
}

.hvs-bulletin-button {
    width: 100%;
    padding: 14px 22px;
    border: 0;
    background: #1f2937;
    color: #fff !important;
    text-align: center;
}

.hvs-bulletin-button:hover,
.hvs-bulletin-button:focus {
    opacity: .9;
}


.hvs-bulletin-media-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 8px 0;
}

.hvs-bulletin-media-button {
    padding: 10px 16px;
    border: 1px solid #1f2937;
    background: #fff;
    color: #1f2937;
}

.hvs-bulletin-media-button:hover,
.hvs-bulletin-media-button:focus {
    background: #f4f5f6;
}

/* Keep the native WordPress Media Library above the bulletin editor. */
body.hvs-bulletin-modal-open .media-modal-backdrop {
    z-index: 2147483500 !important;
}

body.hvs-bulletin-modal-open .media-modal {
    z-index: 2147483600 !important;
}

.hvs-bulletin-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.hvs-bulletin-modal.is-open {
    display: flex;
}

.hvs-bulletin-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .62);
}

.hvs-bulletin-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(680px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    border-radius: 14px;
    background: #fff;
    color: #222;
    box-shadow: 0 20px 70px rgba(0,0,0,.25);
}

.hvs-bulletin-modal-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}

.hvs-bulletin-modal-header h2 {
    margin: 0;
    font-size: 24px;
}

.hvs-bulletin-modal-close {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: #f0f2f4;
    color: #111;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}

.hvs-bulletin-form {
    padding: 24px;
}

.hvs-bulletin-form-section {
    margin-bottom: 22px;
}

.hvs-bulletin-label {
    display: block;
    margin-bottom: 7px;
    font-weight: 800;
}

.hvs-bulletin-help {
    margin: -2px 0 8px;
    color: #68717c;
    font-size: 14px;
}

.hvs-bulletin-input,
.hvs-bulletin-form input[type="file"] {
    width: 100%;
    min-height: 44px;
    font: inherit;
}

.hvs-bulletin-input {
    padding: 10px 12px;
    border: 1px solid #cbd0d6;
    border-radius: 7px;
    background: #fff;
    color: #222;
}

.hvs-bulletin-current-image {
    margin-bottom: 12px;
}

.hvs-bulletin-form-preview {
    display: block;
    max-width: 220px;
    height: auto;
    border-radius: 8px;
}

.hvs-bulletin-current-pdf {
    margin: 0 0 10px;
}

.hvs-bulletin-checkbox {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 12px;
}

.hvs-bulletin-checkbox input {
    width: 18px;
    height: 18px;
}

.hvs-bulletin-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 6px;
}

.hvs-bulletin-save,
.hvs-bulletin-cancel,
.hvs-bulletin-media-button {
    padding: 11px 20px;
}

.hvs-bulletin-save {
    border: 1px solid #1f2937;
    background: #1f2937;
    color: #fff;
}

.hvs-bulletin-cancel {
    border: 1px solid #cbd0d6;
    background: #fff;
    color: #222;
}

.hvs-bulletin-notice {
    margin: 18px 24px 0;
    padding: 12px 14px;
    border-radius: 7px;
    font-weight: 700;
}

.hvs-bulletin-notice--success {
    background: #ecf8ef;
    color: #175c28;
}

.hvs-bulletin-notice--error {
    background: #fff0f0;
    color: #8b1e1e;
}

.hvs-bulletin-editor-launcher .hvs-bulletin-notice {
    margin: 0 0 12px;
}


@media (max-width: 600px) {
    .hvs-bulletin-heading-row {
        align-items: flex-start;
    }

    .hvs-bulletin-edit-button {
        padding-inline: 14px;
    }

    .hvs-bulletin-modal {
        padding: 10px;
    }

    .hvs-bulletin-modal-dialog {
        max-height: calc(100vh - 20px);
    }

    .hvs-bulletin-modal-header,
    .hvs-bulletin-form {
        padding: 18px;
    }

    .hvs-bulletin-form-actions > * {
        width: 100%;
    }
}


.hvs-bulletin-sermon-title {
    margin: -6px 0 8px;
    font-size: 20px;
    line-height: 1.45;
    font-weight: 600;
}

.hvs-bulletin-sermon-title em {
    font-style: italic;
}

.hvs-bulletin-scripture {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    margin: -6px 0 18px;
    font-size: 17px;
    line-height: 1.5;
}

.hvs-bulletin-scripture-label {
    font-weight: 700;
}

.hvs-bulletin-scripture-link {
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Bulletin PDF page-flip viewer */
.hvs-bulletin-viewer,
.hvs-bulletin-viewer * {
    box-sizing: border-box;
}

.hvs-bulletin-viewer {
    position: fixed;
    inset: 0;
    z-index: 2147483200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-family: inherit;
}

.hvs-bulletin-viewer.is-open {
    display: flex;
}

.hvs-bulletin-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(13, 15, 18, .92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.hvs-bulletin-viewer-dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(1080px, 100%);
    max-height: calc(100vh - 48px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 18px;
    background: #111316;
    color: #fff;
    box-shadow: 0 30px 100px rgba(0, 0, 0, .58);
    outline: none;
}

.hvs-bulletin-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 62px;
    padding: 10px 12px 10px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    background: rgba(22, 24, 28, .98);
}

.hvs-bulletin-viewer-heading {
    min-width: 0;
}

.hvs-bulletin-viewer-heading strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 16px;
    line-height: 1.3;
    font-weight: 750;
    letter-spacing: -.01em;
}

.hvs-bulletin-viewer-header-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hvs-bulletin-viewer-original,
.hvs-bulletin-viewer-close,
.hvs-bulletin-page-control {
    font: inherit;
    font-weight: 700;
}

.hvs-bulletin-viewer-original {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 9px;
    background: rgba(255, 255, 255, .06);
    color: #f7f8fa !important;
    text-decoration: none !important;
    transition: background .16s ease, border-color .16s ease;
}

.hvs-bulletin-viewer-original:hover,
.hvs-bulletin-viewer-original:focus-visible {
    border-color: rgba(255, 255, 255, .24);
    background: rgba(255, 255, 255, .11);
}

.hvs-bulletin-viewer-original-icon {
    font-size: 15px;
    line-height: 1;
}

.hvs-bulletin-viewer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #f7f8fa;
    font-size: 27px;
    line-height: 1;
    cursor: pointer;
    transition: background .16s ease;
}

.hvs-bulletin-viewer-close:hover,
.hvs-bulletin-viewer-close:focus-visible {
    background: rgba(255, 255, 255, .1);
}

.hvs-bulletin-viewer-body {
    position: relative;
    min-height: 320px;
    overflow: auto;
    padding: 28px 26px;
    background: #0b0d10;
    scrollbar-color: rgba(255,255,255,.22) transparent;
}

.hvs-bulletin-viewer-status {
    display: flex;
    min-height: 300px;
    align-items: center;
    justify-content: center;
    color: #c9ced6;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
}

.hvs-bulletin-viewer-status[hidden] {
    display: none;
}

.hvs-bulletin-book-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    perspective: 1900px;
    touch-action: pan-y;
}

.hvs-bulletin-book-stage[hidden] {
    display: none;
}

.hvs-bulletin-book {
    position: relative;
    max-width: 100%;
    transform-style: preserve-3d;
    filter: drop-shadow(0 18px 34px rgba(0, 0, 0, .46));
}

.hvs-bulletin-page {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
    border-radius: 3px;
    background: #fff;
    backface-visibility: hidden;
    transform-style: preserve-3d;
}

.hvs-bulletin-page canvas {
    display: block;
    max-width: none;
    height: auto;
    background: #fff;
}

.hvs-bulletin-page--under {
    z-index: 1;
    opacity: 0;
    transform: translateX(0) scale(1);
}

.hvs-bulletin-page--under.is-ready {
    opacity: 1;
}

.hvs-bulletin-page--current {
    z-index: 2;
    transform: rotateY(0deg) translateZ(0);
}

/* The outgoing sheet gets a narrow moving fold shadow and a soft paper-edge
   highlight. The JS handles the actual hinge motion so the page never spins
   all the way around like a card. */
.hvs-bulletin-page--current::before,
.hvs-bulletin-page--current::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 28%;
    pointer-events: none;
    opacity: 0;
    z-index: 3;
}

.hvs-bulletin-page--current.is-flipping-next {
    transform-origin: left center;
    will-change: transform, opacity;
    box-shadow: 10px 0 22px rgba(0, 0, 0, .18);
}

.hvs-bulletin-page--current.is-flipping-prev {
    transform-origin: right center;
    will-change: transform, opacity;
    box-shadow: -10px 0 22px rgba(0, 0, 0, .18);
}

.hvs-bulletin-page--current.is-flipping-next::before {
    left: 0;
    background: linear-gradient(90deg, rgba(0,0,0,.26), rgba(0,0,0,.09) 38%, rgba(0,0,0,0));
    animation: hvs-bulletin-fold-shadow 430ms cubic-bezier(.32,.02,.18,1) both;
}

.hvs-bulletin-page--current.is-flipping-next::after {
    right: 0;
    width: 12%;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.34));
    animation: hvs-bulletin-fold-highlight 430ms cubic-bezier(.32,.02,.18,1) both;
}

.hvs-bulletin-page--current.is-flipping-prev::before {
    right: 0;
    background: linear-gradient(270deg, rgba(0,0,0,.26), rgba(0,0,0,.09) 38%, rgba(0,0,0,0));
    animation: hvs-bulletin-fold-shadow 430ms cubic-bezier(.32,.02,.18,1) both;
}

.hvs-bulletin-page--current.is-flipping-prev::after {
    left: 0;
    width: 12%;
    background: linear-gradient(270deg, rgba(255,255,255,0), rgba(255,255,255,.34));
    animation: hvs-bulletin-fold-highlight 430ms cubic-bezier(.32,.02,.18,1) both;
}

@keyframes hvs-bulletin-fold-shadow {
    0%   { opacity: 0; }
    35%  { opacity: .34; }
    72%  { opacity: .76; }
    100% { opacity: .26; }
}

@keyframes hvs-bulletin-fold-highlight {
    0%, 24% { opacity: 0; }
    66%     { opacity: .72; }
    100%    { opacity: .12; }
}

.hvs-bulletin-viewer-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    min-height: 60px;
    padding: 9px 14px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    background: rgba(22, 24, 28, .98);
}

.hvs-bulletin-viewer-controls[hidden] {
    display: none;
}

.hvs-bulletin-page-control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: fit-content;
    min-height: 40px;
    padding: 7px 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #f7f8fa;
    cursor: pointer;
    transition: background .16s ease, opacity .16s ease;
}

.hvs-bulletin-page-control:hover:not(:disabled),
.hvs-bulletin-page-control:focus-visible:not(:disabled) {
    background: rgba(255, 255, 255, .08);
}

.hvs-bulletin-page-control[data-hvs-page-next] {
    justify-self: end;
}

.hvs-bulletin-page-control:disabled {
    opacity: .28;
    cursor: default;
}

.hvs-bulletin-page-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 5px 11px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .06);
    color: #dfe3e8;
    font-size: 13px;
    font-weight: 750;
    text-align: center;
    white-space: nowrap;
}

.hvs-bulletin-viewer-fallback {
    max-width: 900px;
    margin: 0 auto;
    color: #fff;
    text-align: center;
}

.hvs-bulletin-viewer-fallback[hidden] {
    display: none;
}

.hvs-bulletin-viewer-fallback p {
    margin: 0 0 14px;
    color: #c9ced6;
}

.hvs-bulletin-viewer-fallback iframe {
    display: block;
    width: 100%;
    min-height: 620px;
    border: 0;
    border-radius: 8px;
    background: #fff;
}

body.hvs-bulletin-overlay-open {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .hvs-bulletin-page--current::before,
    .hvs-bulletin-page--current::after {
        animation: none !important;
    }
}

@media (max-width: 600px) {
    .hvs-bulletin-viewer {
        padding: 0;
    }

    .hvs-bulletin-viewer-dialog {
        width: 100%;
        max-height: 100vh;
        border: 0;
        border-radius: 0;
    }

    .hvs-bulletin-viewer-header {
        min-height: 56px;
        padding: 8px 8px 8px 14px;
    }

    .hvs-bulletin-viewer-heading strong {
        font-size: 14px;
    }

    .hvs-bulletin-viewer-original {
        width: 40px;
        padding: 0;
    }

    .hvs-bulletin-viewer-original-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .hvs-bulletin-viewer-body {
        min-height: 260px;
        padding: 14px 8px;
    }

    .hvs-bulletin-viewer-controls {
        grid-template-columns: auto 1fr auto;
        gap: 6px;
        min-height: 54px;
        padding: 7px 8px;
    }

    .hvs-bulletin-page-control {
        width: 44px;
        min-height: 40px;
        padding: 7px;
        font-size: 0;
    }

    .hvs-bulletin-page-control span {
        font-size: 20px;
    }

    .hvs-bulletin-page-count {
        font-size: 12px;
    }

    .hvs-bulletin-viewer-fallback iframe {
        min-height: 480px;
    }
}
