/* This stylesheet is enqueued only for the in-scope server-rendered brands.
   Set shared gutters before paint, including the header's global padding. */
body[class*="agrilife-branding-"] {
    --wp--style--root--padding-left: clamp(1.5rem, 3vw, 3rem);
    --wp--style--root--padding-right: clamp(1.5rem, 3vw, 3rem);
}
/* Only server-rendered agency, College, and department footers opt into this. */
.global-footer.agrilife-server-footer .agrilife-footer-content {
    max-width: var(--wp--style--global--wide-size, 80rem);
    margin-inline: auto;
}
.global-footer.agrilife-server-footer .agrilife-footer-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
    align-items: start;
    gap: clamp(1.5rem, 3vw, 3rem);
}
.global-footer.agrilife-server-footer .agrilife-footer-brand {
    display: block !important;
    width: min(100%, 11rem) !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 0 1.5rem !important;
}
.global-footer.agrilife-server-footer .agrilife-footer-brand .agrilife-footer-logo {
    display: block;
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important;
    margin: 0 !important;
    object-fit: contain;
    object-position: left center;
}
.global-footer.agrilife-server-footer .agrilife-footer-column {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 2;
    row-gap: 1rem;
    min-width: 0;
    overflow-wrap: anywhere;
}
.global-footer.agrilife-server-footer a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 4px;
    text-decoration: underline;
}
@media (max-width: 58rem) {
    .global-footer.agrilife-server-footer .agrilife-footer-columns {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 37.5rem) {
    .global-footer.agrilife-server-footer .agrilife-footer-columns {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Align each row's headings and list starts, independently of logo placement. */
.global-footer.agrilife-server-footer .agrilife-footer-column > h2 {
    margin-block: 0 !important;
}
.global-footer.agrilife-server-footer .agrilife-footer-column-body > :first-child {
    margin-block-start: 0 !important;
}

.global-footer.agrilife-server-footer .agrilife-footer-affiliation {
    display: grid;
}

/* One centered content width and equal browser-edge gutters for both bands. */
.agrilife-server-member-bar,
.global-footer.agrilife-server-footer {
    box-sizing: border-box;
    padding-left: var(--wp--style--root--padding-left, 1.5rem) !important;
    padding-right: var(--wp--style--root--padding-right, 1.5rem) !important;
}
.agrilife-server-member-bar > .alignwide {
    width: 100%;
    max-width: var(--wp--style--global--wide-size, 80rem);
    margin-inline: auto !important;
    justify-content: center;
}
.agrilife-server-member-bar .agrilife-bar-title {
    flex-shrink: 0;
}
.agrilife-server-member-bar .agrilife-bar-nav {
    flex: 1;
    min-width: 0;
    width: 100%;
    padding-inline: 0;
    justify-content: center;
}
.agrilife-server-member-bar .agrilife-bar-nav li {
    min-width: 0;
    max-width: 100%;
}
.agrilife-server-member-bar .agrilife-bar-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    max-width: 100%;
    box-sizing: border-box;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
}
.global-footer.agrilife-server-footer .agrilife-footer-required ul {
    justify-content: center;
    text-align: center;
}
.global-footer.agrilife-server-footer .agrilife-footer-copyright {
    text-align: center;
}
.global-footer.agrilife-server-footer .agrilife-footer-social-links a {
    min-height: 1.5rem;
    align-items: flex-start;
}
@media (max-width: 37.5rem) {
    .agrilife-server-member-bar > .alignwide {
        flex-direction: column;
    }
    .agrilife-server-member-bar .agrilife-bar-title {
        border-right: 0;
        padding-right: 0;
        text-align: center;
    }
    .agrilife-bar.agrilife-server-member-bar .agrilife-bar-nav li {
        width: 100%;
        margin: 0;
        padding: 0;
        border-right: 0;
        text-align: center;
    }
}

/* Restore the native four-column proportions instead of compressing the
   university affiliation to the width of its image. */
@media (min-width: 58.001rem) {
    .global-footer.agrilife-server-footer .agrilife-footer-columns:has(> .agrilife-footer-affiliation:nth-child(4):last-child) {
        grid-template-columns: minmax(0, 1.3fr) repeat(3, minmax(0, 1fr));
    }
}
/* Keep body and policy text readable without changing the column layout. */
.global-footer.agrilife-server-footer .agrilife-footer-columns,
.global-footer.agrilife-server-footer .agrilife-footer-required,
.global-footer.agrilife-server-footer .agrilife-footer-required ul,
.global-footer.agrilife-server-footer .agrilife-footer-copyright {
    font-size: 1rem !important;
}
.global-footer.agrilife-server-footer .agrilife-footer-affiliation {
    width: auto;
    max-width: 100%;
    justify-self: stretch;
}
.global-footer.agrilife-server-footer .agrilife-member-logo {
    width: min(100%, 8.75rem);
    height: auto;
}
.agrilife-server-member-bar .agrilife-bar-nav {
    font-family: var(--wp--preset--font-family--oswald, oswald, sans-serif);
    font-size: 1rem !important;
}

.global-footer.agrilife-server-footer .agrilife-footer-university-link {
    margin: 0 0 1rem;
}
.global-footer.agrilife-server-footer .agrilife-footer-system-link {
    display: block;
    width: fit-content;
    margin-inline-start: 0;
}


body[class*="agrilife-branding-"] .agrilife-site-header > .has-global-padding {
    padding-left: var(--wp--style--root--padding-left);
    padding-right: var(--wp--style--root--padding-right);
}

/* TAMUSA retains its own institutional content with the shared gutters. */
.global-footer.agrilife-tamusa-footer {
    box-sizing: border-box;
    padding-inline: var(--wp--style--root--padding-left, 1.5rem) !important;
}
.global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__inner {
    width: 100%;
    max-width: var(--wp--style--global--wide-size, 80rem);
    margin-inline: auto !important;
    padding-inline: 0;
}
.global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__columns {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    text-align: left;
    gap: 1rem clamp(1.5rem, 3vw, 3rem);
    align-items: start;
}
.global-footer.agrilife-tamusa-footer .wp-block-column {
    min-width: 0;
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 2;
    gap: 1rem;
    overflow-wrap: anywhere;
}
.global-footer.agrilife-tamusa-footer h2 { margin-block: 0 !important; }
.global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__body > :first-child { margin-top: 0 !important; }
.global-footer.agrilife-tamusa-footer a { display: inline-flex; align-items: center; min-height: 1.5rem; }
.global-footer.agrilife-tamusa-footer a:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
.global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__system-logo {
    width: min(100%, 8.75rem); margin: 1.5rem 0 0 !important;
}
.global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__system-logo img {
    display: block; width: 100%; height: auto; max-width: 100%;
}
.global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__legal {
    display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem 1rem; padding: 0; text-align: center;
}
.global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__copyright { text-align: center; }
@media (max-width: 58rem) {
    .global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 37.5rem) {
    .global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__columns { grid-template-columns: minmax(0, 1fr); }
}

/* Legacy clearfix pseudo-elements must not occupy a footer grid track. */
.global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__columns::before,
.global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__columns::after { content: none !important; display: none !important; }

/* Match the content wrapper to the gutters used by native alignfull blocks. */
body.agrilife-branding-tamusa .entry-content.has-global-padding {
    padding-left: var(--wp--style--root--padding-left) !important;
    padding-right: var(--wp--style--root--padding-right) !important;
}

/* Override legacy per-column centering so text and System mark share an edge. */
.global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__columns > .wp-block-column { text-align: left !important; }

/* Keep the TAMUSA university lockup in its own leading column. */
.global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__brand { display: block; }
.global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__unit-logo { width: 100% !important; max-width: 15rem !important; margin: 0 !important; }
.global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__unit-logo img.agl-tamusa-footerlogo { display: block; width: 100% !important; height: auto !important; max-width: 100% !important; max-height: none !important; }

/* Preserve the approved stacked lockup at a readable size in its own column. */
.global-footer.agrilife-tamusa-footer[data-footer-logo="stacked"] .agrilife-tamusa-footer__unit-logo { max-width: 18rem !important; }

/* The approved PNG includes transparent canvas padding. Clip only that padding
   so the visible lockup shares the heading row without modifying the asset. */
.global-footer.agrilife-tamusa-footer[data-footer-logo="stacked"] .agrilife-tamusa-footer__unit-logo {
    position: relative;
    aspect-ratio: 1650 / 903;
    overflow: hidden;
    padding: 0 !important;
}
.global-footer.agrilife-tamusa-footer[data-footer-logo="stacked"] .agrilife-tamusa-footer__unit-logo img.agl-tamusa-footerlogo {
    position: absolute;
    width: 109.151515% !important;
    max-width: none !important;
    left: -4.606061%;
    top: -16.389812%;
}

/* TAMUSA shares the approved readable footer body size. */
.global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__body,
.global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__body p,
.global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__body ul,
.global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__legal,
.global-footer.agrilife-tamusa-footer .agrilife-tamusa-footer__copyright {
    font-size: 1rem !important;
}

/* Readable text in the middle institutional membership band. */
.agrilife-server-member-bar .agrilife-bar-title,
.agrilife-server-member-bar .agrilife-bar-nav a {
    font-size: 1rem !important;
}

/* Full-width block margins must use the same gutters as their parent.
   Explicit block padding remains owned by the editor. */
body[class*="agrilife-branding-"] .entry-content.has-global-padding,
body[class*="agrilife-branding-"] .entry-content .wp-block-group.has-global-padding:not([style*="padding-left"]):not([style*="padding-right"]) {
    padding-left: var(--wp--style--root--padding-left) !important;
    padding-right: var(--wp--style--root--padding-right) !important;
}
.global-breadcrumbs .yoast-breadcrumbs {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
}

/* Institutional naming and search remain white even when the information
   panel is disabled. TAMUSA keeps its own approved header color palette. */
body:not(.agrilife-branding-tamusa) .global-header-bar .wp-block-happyprime-toggle-block {
    color: #fff !important;
    opacity: 1 !important;
}
body:not(.agrilife-branding-tamusa) #search-panel .wp-block-search__label,
body:not(.agrilife-branding-tamusa) #search-panel .wp-block-search__input,
body:not(.agrilife-branding-tamusa) #search-panel .wp-block-search__button {
    color: #fff !important;
    border-color: #fff;
}
body:not(.agrilife-branding-tamusa) #search-panel .wp-block-search__input {
    background-color: #333;
    min-width: 0;
}
body:not(.agrilife-branding-tamusa) #search-panel .wp-block-search__input::placeholder {
    color: #fff;
    opacity: 1;
}
body:not(.agrilife-branding-tamusa) .global-header-bar button:focus-visible,
body:not(.agrilife-branding-tamusa) #search-panel :focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}
