/*
 * Frontend rendering for plugin-managed Pages (About Us, Staff, Join the
 * Publication, future institutional pages). Wrapped in .enterprise-publication
 * by includes/page-builder.php, so it already inherits the site's existing
 * --enterprise-brand/-ink/-serif/-sans design tokens (assets/css/frontend.css)
 * rather than redefining the visual identity a second time.
 */

.cp-managed-page {
    max-width: 860px;
    margin: 0 auto;
    padding: 48px 24px 72px;
}

.cp-page-heading-block {
    font-family: var(--enterprise-serif);
    color: var(--enterprise-brand);
    line-height: 1.25;
    margin: 0 0 20px;
}

h1.cp-page-heading-block {
    font-size: 40px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 32px;
}

h2.cp-page-heading-block {
    font-size: 26px;
    border-bottom: 3px solid var(--enterprise-accent);
    padding-bottom: 10px;
    margin-top: 40px;
}

h3.cp-page-heading-block,
h4.cp-page-heading-block,
h5.cp-page-heading-block,
h6.cp-page-heading-block {
    font-size: 20px;
}

.cp-page-richtext-block {
    font-size: 17px;
    line-height: 1.75;
    color: var(--enterprise-ink);
    margin: 0 0 22px;
}

.cp-page-richtext-block p {
    margin: 0 0 1em;
}

.cp-page-richtext-block a {
    color: var(--enterprise-brand);
}

.cp-page-image-block {
    margin: 0 0 28px;
    text-align: center;
}

.cp-page-image-block-img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.cp-page-image-block figcaption {
    margin-top: 8px;
    font-size: 13px;
    color: var(--enterprise-muted);
}

.cp-page-button-block {
    text-align: center;
    margin: 32px 0;
}

.cp-page-cta {
    display: inline-block;
    padding: 14px 32px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 13px;
    text-decoration: none;
    transition: opacity 140ms ease, box-shadow 140ms ease;
}

.cp-page-cta:hover {
    opacity: 0.85;
}

/*
 * Explicit :link/:visited/:hover/:focus/:active coverage, and a slightly
 * more specific selector (element + two classes, .cp-page-button-block
 * ancestor) than a bare ".cp-page-cta-primary" would give - a defensive
 * margin against Astra's own generic anchor-color rules (a{color:...},
 * .entry-content wraps this since it renders through the_content()) and
 * the browser's own default :visited link color, neither of which should
 * ever be allowed to compete with this specific button's own color again.
 * Scoped to this exact class combination only - never a global "a" rule.
 */
.cp-page-button-block a.cp-page-cta.cp-page-cta-primary,
.cp-page-button-block a.cp-page-cta.cp-page-cta-primary:link,
.cp-page-button-block a.cp-page-cta.cp-page-cta-primary:visited,
.cp-page-button-block a.cp-page-cta.cp-page-cta-primary:hover,
.cp-page-button-block a.cp-page-cta.cp-page-cta-primary:focus,
.cp-page-button-block a.cp-page-cta.cp-page-cta-primary:active {
    background-color: var(--enterprise-brand);
    color: #ffffff;
}

.cp-page-button-block a.cp-page-cta.cp-page-cta-primary:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.cp-page-button-block a.cp-page-cta.cp-page-cta-outline,
.cp-page-button-block a.cp-page-cta.cp-page-cta-outline:link,
.cp-page-button-block a.cp-page-cta.cp-page-cta-outline:visited,
.cp-page-button-block a.cp-page-cta.cp-page-cta-outline:hover,
.cp-page-button-block a.cp-page-cta.cp-page-cta-outline:focus,
.cp-page-button-block a.cp-page-cta.cp-page-cta-outline:active {
    background-color: transparent;
    color: var(--enterprise-brand);
    border: 2px solid var(--enterprise-brand);
}

.cp-page-button-block a.cp-page-cta.cp-page-cta-outline:focus-visible {
    outline: 2px solid var(--enterprise-brand);
    outline-offset: 2px;
}

.cp-page-divider-block {
    border: none;
}

.cp-page-divider-small { height: 16px; }
.cp-page-divider-medium { height: 40px; }
.cp-page-divider-large { height: 80px; }

/* ---- Staff Grid ---- */

.cp-staff-grid {
    margin-top: 8px;
}

.cp-staff-section {
    margin-bottom: 48px;
}

.cp-staff-section-title {
    font-family: var(--enterprise-serif);
    font-size: 22px;
    color: var(--enterprise-brand);
    text-align: center;
    margin: 0 0 28px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--enterprise-soft-line);
}

/*
 * Row sizing rule (CLAUDE.md 11.3): 1-3 people keep a normal, capped card
 * width and center as a group rather than stretching; 4-6 people use an
 * even CSS Grid that fills the section width, so the cards themselves
 * enlarge as the row gets fuller. Never more than 6 columns. Which
 * behavior applies is decided purely by how many cards ended up in a row
 * (assigned server-side via array_chunk() in cp_render_staff_section()),
 * not by any hardcoded name/position.
 */
.cp-staff-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 28px;
    margin-bottom: 32px;
}

.cp-staff-row-4,
.cp-staff-row-5,
.cp-staff-row-6 {
    display: grid;
    gap: 24px;
}

.cp-staff-row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cp-staff-row-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cp-staff-row-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.cp-staff-row-1 .cp-staff-card,
.cp-staff-row-2 .cp-staff-card,
.cp-staff-row-3 .cp-staff-card {
    flex: 0 0 auto;
    width: 190px;
}

.cp-staff-row-4 .cp-staff-card,
.cp-staff-row-5 .cp-staff-card,
.cp-staff-row-6 .cp-staff-card {
    width: 100%;
}

.cp-staff-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.cp-staff-portrait {
    width: 100%;
    max-width: 160px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    overflow: hidden;
    background: var(--enterprise-faint);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.cp-staff-portrait-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cp-staff-portrait-placeholder {
    width: 55%;
    height: 55%;
    display: flex;
}

.cp-staff-portrait-placeholder svg {
    width: 100%;
    height: 100%;
    fill: var(--enterprise-line);
}

.cp-staff-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--enterprise-ink);
    line-height: 1.3;
}

.cp-staff-position {
    font-size: 12px;
    color: var(--enterprise-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 2px;
}

@media (max-width: 900px) {
    .cp-staff-row-5,
    .cp-staff-row-6 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .cp-staff-row-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .cp-managed-page {
        padding: 32px 16px 56px;
    }
    h1.cp-page-heading-block {
        font-size: 30px;
    }
    .cp-staff-row-4,
    .cp-staff-row-5,
    .cp-staff-row-6 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .cp-staff-row-1 .cp-staff-card,
    .cp-staff-row-2 .cp-staff-card,
    .cp-staff-row-3 .cp-staff-card {
        width: 140px;
    }
}
