
/* Production hardening: the HTML hidden state must override modal layout rules. */
.tag-pdf-modal[hidden] { display: none !important; }
/*
 * Thoughts About God — PDF Resource Library v6.0
 * Scope: /docs/ and pages using page-docs.php.
 * Shared full-width, focus and reduced-motion rules live in tag-resource-library.css.
 */
.tag-pdf-library {
    --tag-pdf-navy: #182b3c;
    --tag-pdf-navy-2: #223b51;
    --tag-pdf-gold: #b78b32;
    --tag-pdf-cream: #f8f5ef;
    --tag-pdf-paper: #ffffff;
    --tag-pdf-text: #20252a;
    --tag-pdf-muted: #68727b;
    --tag-pdf-border: #e4ded3;
    --tag-pdf-radius: 14px;
    --tag-pdf-shadow: 0 8px 26px rgba(20, 33, 44, .08);
    color: var(--tag-pdf-text);
    background: var(--tag-pdf-cream);
    width: 100%;
    min-height: 60vh;
}

.tag-pdf-library a { text-decoration: none; }
.tag-pdf-library button,
.tag-pdf-library input { font: inherit; }

.tag-pdf-shell {
    width: min(1320px, calc(100% - 40px));
    margin-inline: auto;
}

.tag-pdf-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--tag-pdf-navy), var(--tag-pdf-navy-2));
    color: #fff;
    padding: clamp(48px, 7vw, 82px) 0;
    border-bottom: 3px solid var(--tag-pdf-gold);
}

.tag-pdf-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 15% 25%, rgba(183,139,50,.16), transparent 34%),
        radial-gradient(circle at 84% 72%, rgba(255,255,255,.06), transparent 30%);
}

.tag-pdf-hero .tag-pdf-shell { position: relative; z-index: 1; text-align: center; }

.tag-pdf-eyebrow {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 14px;
    margin-bottom: 15px;
    border: 1px solid rgba(219,178,93,.52);
    border-radius: 999px;
    color: #e2bb68;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.tag-pdf-hero h1 {
    max-width: 900px;
    margin: 0 auto 14px;
    color: #fff;
    font-size: clamp(2rem, 4vw, 3.35rem);
    line-height: 1.08;
    letter-spacing: -.025em;
}

.tag-pdf-hero-copy {
    max-width: 720px;
    margin: 0 auto;
    color: rgba(255,255,255,.82);
    font-size: clamp(.98rem, 1.5vw, 1.1rem);
    line-height: 1.75;
}

.tag-pdf-stats {
    display: flex;
    justify-content: center;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 10px;
    margin: 30px auto 0;
}

.tag-pdf-stat {
    min-width: 140px;
    padding: 12px 18px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 10px;
    background: rgba(255,255,255,.055);
}

.tag-pdf-stat strong { display: block; color: #e2bb68; font-size: 1.24rem; line-height: 1.2; }
.tag-pdf-stat span { display: block; margin-top: 3px; color: rgba(255,255,255,.65); font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; }

.tag-pdf-main { padding: 34px 0 64px; }

.tag-pdf-editor-content {
    max-width: 820px;
    margin: 0 auto 28px;
    padding: 22px 24px;
    background: var(--tag-pdf-paper);
    border: 1px solid var(--tag-pdf-border);
    border-radius: var(--tag-pdf-radius);
}

.tag-pdf-search-wrap {
    position: sticky;
    top: var(--wp-admin--admin-bar--height, 0px);
    z-index: 20;
    margin-bottom: 24px;
    padding: 14px;
    background: #f8f5ef;
    border: 1px solid var(--tag-pdf-border);
    border-radius: var(--tag-pdf-radius);
    box-shadow: 0 5px 18px rgba(20,33,44,.06);
}

.tag-pdf-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 9px;
    max-width: 820px;
    margin: 0 auto;
}

.tag-pdf-search input[type="search"] {
    min-width: 0;
    min-height: 48px;
    width: 100%;
    padding: 10px 15px;
    color: var(--tag-pdf-text);
    background: #fff;
    border: 1px solid #cfc8bc;
    border-radius: 9px;
    outline: none;
}

.tag-pdf-search input[type="search"]:focus {
    border-color: var(--tag-pdf-gold);
    box-shadow: 0 0 0 3px rgba(183,139,50,.18);
}

.tag-pdf-search button,
.tag-pdf-search-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 9px 18px;
    border-radius: 9px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.tag-pdf-search button {
    color: #fff;
    background: var(--tag-pdf-navy);
    border: 1px solid var(--tag-pdf-navy);
}

.tag-pdf-search button:hover,
.tag-pdf-search button:focus-visible { background: var(--tag-pdf-navy-2); }

.tag-pdf-search-clear {
    color: var(--tag-pdf-navy);
    background: #fff;
    border: 1px solid var(--tag-pdf-border);
}

.tag-pdf-result-note,
.tag-pdf-empty,
.tag-pdf-error {
    margin: 18px 0 24px;
    padding: 15px 18px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--tag-pdf-border);
}

.tag-pdf-error { border-left: 4px solid #a43a3a; }
.tag-pdf-admin-path { overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }

.tag-pdf-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 28px;
}

.tag-pdf-filter {
    appearance: none;
    padding: 9px 13px;
    color: #45515a;
    background: #fff;
    border: 1px solid var(--tag-pdf-border);
    border-radius: 999px;
    font-size: .86rem;
    font-weight: 700;
    cursor: pointer;
}

.tag-pdf-filter:hover,
.tag-pdf-filter:focus-visible,
.tag-pdf-filter.is-active {
    color: #fff;
    background: var(--tag-pdf-navy);
    border-color: var(--tag-pdf-navy);
}

.tag-pdf-filter span { opacity: .72; margin-left: 4px; }

.tag-pdf-section {
    margin: 0 0 34px;
    scroll-margin-top: 120px;
}

.tag-pdf-section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 14px;
    padding-left: 14px;
    border-left: 4px solid var(--tag-cat, var(--tag-pdf-gold));
}

.tag-pdf-section-head h2 { margin: 0 0 4px; color: var(--tag-pdf-navy); font-size: clamp(1.25rem, 2vw, 1.65rem); }
.tag-pdf-section-head p { margin: 0; color: var(--tag-pdf-muted); font-size: .92rem; }
.tag-pdf-section-count { flex: 0 0 auto; color: var(--tag-pdf-muted); font-size: .82rem; font-weight: 700; }

.tag-pdf-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.tag-pdf-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 18px;
    background: var(--tag-pdf-paper);
    border: 1px solid var(--tag-pdf-border);
    border-top: 3px solid var(--tag-cat, var(--tag-pdf-gold));
    border-radius: var(--tag-pdf-radius);
    box-shadow: 0 3px 14px rgba(20,33,44,.045);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.tag-pdf-card:hover { transform: translateY(-2px); box-shadow: var(--tag-pdf-shadow); }

.tag-pdf-filetype {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    min-width: 44px;
    height: 25px;
    padding: 0 8px;
    margin-bottom: 12px;
    color: #fff;
    background: #a52d32;
    border-radius: 5px;
    font-size: .69rem;
    font-weight: 800;
    letter-spacing: .06em;
}

.tag-pdf-card h3 {
    margin: 0 0 8px;
    color: var(--tag-pdf-navy);
    font-size: 1.02rem;
    line-height: 1.38;
    overflow-wrap: anywhere;
}

.tag-pdf-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 12px;
    margin: 0 0 16px;
    color: var(--tag-pdf-muted);
    font-size: .78rem;
}

.tag-pdf-path {
    margin: -4px 0 15px;
    color: #7d858b;
    font-size: .72rem;
    overflow-wrap: anywhere;
}

.tag-pdf-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: auto;
}

.tag-pdf-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 750;
}

.tag-pdf-view { color: #fff !important; background: var(--tag-pdf-navy); border: 1px solid var(--tag-pdf-navy); }
.tag-pdf-view:hover,
.tag-pdf-view:focus-visible { color: #fff !important; background: var(--tag-pdf-navy-2); }

.tag-pdf-download { color: var(--tag-pdf-navy) !important; background: #fff; border: 1px solid #cbc5ba; }
.tag-pdf-download:hover,
.tag-pdf-download:focus-visible { border-color: var(--tag-pdf-gold); color: #6d5118 !important; }

.tag-pdf-filter:focus-visible,
.tag-pdf-action:focus-visible,
.tag-pdf-search button:focus-visible,
.tag-pdf-search-clear:focus-visible {
    outline: 3px solid rgba(183,139,50,.38);
    outline-offset: 2px;
}

@media (max-width: 900px) {
    .tag-pdf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .tag-pdf-main { padding-top: 20px; }
    .tag-pdf-hero { padding: 42px 0; }
    .tag-pdf-search-wrap { position: static; padding: 10px; }
    .tag-pdf-search { grid-template-columns: 1fr 1fr; }
    .tag-pdf-search input { grid-column: 1 / -1; }
    .tag-pdf-section-head { align-items: start; flex-direction: column; gap: 5px; }
    .tag-pdf-actions { grid-template-columns: 1fr; }
    .tag-pdf-stat { min-width: 120px; flex: 1 1 120px; }
}


.tag-pdf-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.tag-pdf-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 24, 34, .84);
}

.tag-pdf-modal__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(96vw, 1200px);
    height: min(92vh, 900px);
    max-height: 92vh;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(0,0,0,.34);
}

.tag-pdf-modal__header {
    flex: 0 0 auto;
    padding: 16px 58px 14px 18px;
    border-bottom: 1px solid #e4ded3;
    background: #f8f5ef;
}

.tag-pdf-modal__eyebrow {
    margin: 0 0 4px;
    color: #7a5b20;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.tag-pdf-modal__title {
    margin: 0;
    color: #182b3c;
    font-size: clamp(1rem, 2vw, 1.35rem);
    line-height: 1.25;
}

.tag-pdf-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #d8d1c5;
    border-radius: 999px;
    color: #182b3c;
    background: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.tag-pdf-modal__viewer {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    background: #31363b;
}

.tag-pdf-modal__frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.tag-pdf-modal__actions {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 10px 14px;
    border-top: 1px solid #e4ded3;
    background: #f8f5ef;
}

.tag-pdf-modal__actions a,
.tag-pdf-modal__actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 13px;
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 750;
}

.tag-pdf-modal__page-link {
    color: #fff !important;
    background: #182b3c;
    border: 1px solid #182b3c;
}

.tag-pdf-modal__download,
.tag-pdf-modal__close-action {
    color: #182b3c !important;
    background: #fff;
    border: 1px solid #cbc5ba;
}

.tag-pdf-modal__close-action { cursor: pointer; }

@media (max-width: 640px) {
    .tag-pdf-modal { padding: 0; }
    .tag-pdf-modal__dialog {
        width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border: 0;
        border-radius: 0;
    }
    .tag-pdf-modal__header { padding: 13px 52px 11px 14px; }
    .tag-pdf-modal__actions a,
    .tag-pdf-modal__actions button { flex: 1 1 130px; }
}

/* Keep this custom library page full width even if a parent theme wrapper changes. */
.tag-pdf-page-main { width: 100% !important; max-width: none !important; margin: 0 !important; padding: 0 !important; }

@media (max-width: 680px) {
    .tag-pdf-modal { padding: 0; }
    .tag-pdf-modal__dialog {
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border: 0;
        border-radius: 0;
    }
    .tag-pdf-modal__viewer { min-height: 0; }
    .tag-pdf-modal__frame { height: 100%; min-height: 0; }
    .tag-pdf-modal__actions { display: grid; grid-template-columns: 1fr 1fr; }
    .tag-pdf-modal__actions a,
    .tag-pdf-modal__actions button { width: 100%; }
}

.tag-pdf-sections { width: 100%; }

/* ========================================================================== 
   v5.0 production isolation + live filtering + modal hardening
   ========================================================================== */
.tag-pdf-live-summary {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
    margin: -4px 0 18px;
    color: var(--tag-pdf-muted);
    font-size: .82rem;
    font-weight: 700;
}

.tag-pdf-live-summary [data-tag-pdf-live-count] {
    color: var(--tag-pdf-navy);
    font-weight: 850;
}

.tag-pdf-modal__status {
    position: absolute;
    left: 50%;
    bottom: 12px;
    z-index: 2;
    max-width: calc(100% - 32px);
    margin: 0;
    padding: 7px 10px;
    transform: translateX(-50%);
    border-radius: 8px;
    background: rgba(0, 0, 0, .72);
    color: #fff;
    font-size: .78rem;
    line-height: 1.35;
    text-align: center;
    pointer-events: none;
}

.tag-pdf-modal__status:empty { display: none; }
.tag-pdf-modal__status[data-state="error"] { background: rgba(122, 38, 50, .95); }
.tag-pdf-modal__status[data-state="success"] { background: rgba(32, 90, 62, .95); }

.tag-pdf-modal__copy {
    appearance: none;
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid #cbc5ba;
    border-radius: 8px;
    background: #fff;
    color: #182b3c;
    font: inherit;
    font-size: .82rem;
    font-weight: 750;
    cursor: pointer;
}

.tag-pdf-modal__copy:hover,
.tag-pdf-modal__copy:focus-visible {
    border-color: var(--tag-pdf-gold);
    background: #fffaf0;
}

@media (max-width: 920px) {
    .tag-pdf-shell {
        width: min(100% - 28px, 1320px);
    }

    .tag-pdf-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .tag-pdf-shell {
        width: min(100% - 20px, 1320px);
    }

    .tag-pdf-grid {
        grid-template-columns: 1fr;
    }

    .tag-pdf-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 5px;
        scrollbar-width: thin;
    }

    .tag-pdf-filter {
        flex: 0 0 auto;
        min-height: 44px;
    }

    .tag-pdf-search input,
    .tag-pdf-search button,
    .tag-pdf-search-clear {
        min-height: 44px;
    }

    .tag-pdf-modal__actions {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 430px) {
    .tag-pdf-modal__actions {
        grid-template-columns: 1fr;
    }
}

/* v5.0 client-side empty state. */
.tag-pdf-empty--client {
    margin-top: 22px;
}

/* v7 unified PDF modal presentation. */
.tag-pdf-modal[hidden],
.tag-pdf-modal[aria-hidden="true"] { display: none !important; }
body .tag-pdf-modal .tag-pdf-modal__dialog {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(1120px, calc(100vw - 40px));
    height: min(88dvh, 860px);
    max-height: calc(100dvh - 40px);
}
body .tag-pdf-modal .tag-pdf-modal__title,
body .tag-pdf-modal .tag-pdf-modal__header h2 {
    color: #182b3c !important;
    font-size: clamp(1.05rem, 1.8vw, 1.45rem) !important;
    line-height: 1.25 !important;
}
body .tag-pdf-modal .tag-pdf-modal__viewer { min-height: 0; overflow: hidden; }
body .tag-pdf-modal .tag-pdf-modal__frame { width: 100%; height: 100%; min-height: 0; }
body .tag-pdf-modal .tag-pdf-modal__actions { min-height: 60px; align-items: center; }

/* ========================================================================== 
   v8 definitive mobile layout — /docs/ and PDF modal
   ========================================================================== */
@media (max-width: 767px) {
    .tag-pdf-shell {
        width: calc(100% - 20px) !important;
        max-width: 100% !important;
    }

    .tag-pdf-hero {
        padding: 38px 0;
    }

    .tag-pdf-hero h1 {
        font-size: clamp(1.8rem, 9vw, 2.6rem);
        overflow-wrap: anywhere;
    }

    .tag-pdf-search {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .tag-pdf-search input[type="search"] {
        width: 100%;
        min-width: 0;
        font-size: 16px; /* prevents iOS focus zoom */
    }

    .tag-pdf-search button,
    .tag-pdf-search-clear {
        width: 100%;
    }

    .tag-pdf-filters {
        max-width: 100%;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
    }

    .tag-pdf-filter {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .tag-pdf-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .tag-pdf-modal {
        align-items: stretch !important;
        justify-content: stretch !important;
        padding: 0 !important;
    }

    body .tag-pdf-modal .tag-pdf-modal__dialog {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        height: 100svh !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100svh !important;
        max-height: 100dvh !important;
        grid-template-rows: auto minmax(0, 1fr) auto !important;
        border: 0 !important;
        border-radius: 0 !important;
        overflow: hidden !important;
    }

    body .tag-pdf-modal .tag-pdf-modal__header {
        max-height: 26dvh;
        overflow-y: auto;
        padding: calc(11px + env(safe-area-inset-top, 0px)) 54px 10px 14px !important;
    }

    body .tag-pdf-modal .tag-pdf-modal__title,
    body .tag-pdf-modal .tag-pdf-modal__header h2 {
        font-size: clamp(.98rem, 4.8vw, 1.2rem) !important;
        line-height: 1.24 !important;
        overflow-wrap: anywhere;
    }

    .tag-pdf-modal__close {
        top: calc(7px + env(safe-area-inset-top, 0px));
        right: calc(7px + env(safe-area-inset-right, 0px));
        width: 44px;
        height: 44px;
    }

    body .tag-pdf-modal .tag-pdf-modal__viewer {
        min-width: 0;
        min-height: 0 !important;
        height: 100%;
        overflow: hidden !important;
    }

    body .tag-pdf-modal .tag-pdf-modal__frame {
        display: block;
        width: 100% !important;
        height: 100% !important;
        min-width: 0;
        min-height: 0 !important;
    }

    body .tag-pdf-modal .tag-pdf-modal__actions {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
        gap: 8px;
        min-height: 0 !important;
        max-height: 34dvh;
        overflow-y: auto;
        padding: 9px max(10px, env(safe-area-inset-right, 0px)) calc(9px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
    }

    body .tag-pdf-modal .tag-pdf-modal__actions > * {
        width: 100% !important;
        min-width: 0;
        white-space: normal;
    }
}

@media (max-width: 430px) {
    body .tag-pdf-modal .tag-pdf-modal__actions {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}
