/*
 * PAN layout guard (17 Nov 2026)
 * Keeps content entered in the admin (press releases, forum texts, photos)
 * inside the page design, whatever its size.
 */

/* Article/forum pages: the two-column grid must never be widened by its content. */
.details-wrapper > * {
    min-width: 0;
}

/* Press release body (text from the admin editor). */
.blog-rich-content {
    overflow-wrap: anywhere;
}

.blog-rich-content img,
.blog-rich-content video,
.blog-rich-content svg,
.blog-rich-content canvas,
.blog-rich-content embed,
.blog-rich-content object {
    max-width: 100% !important;
    height: auto !important;
}

.blog-rich-content img {
    display: block;
    margin: 1.5rem auto;
    border-radius: 12px;
}

.blog-rich-content figure {
    max-width: 100% !important;
    width: auto !important;
    margin: 1.5rem 0 !important;
}

.blog-rich-content figure img {
    margin: 0 auto;
}

.blog-rich-content figcaption {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 8px;
}

.blog-rich-content iframe {
    max-width: 100% !important;
    width: 100%;
    height: auto !important;
    aspect-ratio: 16 / 9;
    border: 0;
}

.blog-rich-content table {
    display: block;
    max-width: 100% !important;
    width: auto !important;
    overflow-x: auto;
}

.blog-rich-content pre {
    white-space: pre-wrap;
}

/* Main photo of a press release: always shown in full, never cropped. */
.pan-article-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 640px;
    object-fit: contain;
    background: var(--bg-secondary);
}

/* Cards and thumbnails crop to a fixed frame; keep heads in view by default.
   A per-post "Image focus" setting (Admin > Blog > Posts) can override this. */
.blog-card-img,
.press-release-card-image,
.pan-thumb-img {
    object-position: center 12%;
}

/* Press release list: one column on small phones instead of overflowing. */
.blog-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
}

/* Long words/links in forum texts. */
.service-text,
.blog-card-title,
.blog-card-excerpt {
    overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------
 * Mobile fixes (pages that were wider than the phone screen)
 * ------------------------------------------------------------------ */

/* Forum cards: shrink to the screen on small phones. */
.services-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
}

@media (max-width: 991px) {
    /* Two-column sections (About page, Procurement) stack on tablets and phones. */
    .pan-stack {
        grid-template-columns: 1fr !important;
        gap: 32px !important;
    }

    /* Publications filter: search on its own row, filters below. */
    .pan-stack-filters {
        grid-template-columns: 1fr 1fr !important;
    }

    .pan-stack-filters > :first-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 767px) {
    .pan-stack h2 {
        font-size: 1.9rem !important;
        overflow-wrap: anywhere;
    }

    /* Boxes with 48px padding leave too little room for text on phones. */
    .pan-stack > div[style*="padding: 48px"],
    .pan-stack > div[style*="padding: 40px"] {
        padding: 28px !important;
    }

    .pan-stack-filters {
        grid-template-columns: 1fr !important;
    }

    .pan-stack-filters > * {
        grid-column: auto;
    }

    /* Key Role Players tabs: wrap and fit on small phones. */
    .tab-container .tab-btn {
        padding: 10px 16px !important;
        font-size: 0.9rem !important;
    }

    /* About > board table: one card per board member on phones. */
    .staff-table thead {
        display: none;
    }

    .staff-table,
    .staff-table tbody,
    .staff-table tr,
    .staff-table td {
        display: block;
        width: 100%;
    }

    .staff-table tr {
        padding: 16px 4px;
        border-bottom: 1px solid var(--border-color);
    }

    .staff-table td {
        padding: 2px 0 !important;
        border: 0 !important;
    }

    .staff-table td.staff-num {
        display: none;
    }

    .staff-table td[data-label] {
        margin-top: 8px;
        font-size: 0.9rem;
    }

    .staff-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 0.7rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: var(--accent);
    }
}
