/*
Theme Name: UBC CDC
Theme URI: 
Author: Andrew Baxter
Author URI: 
Description: A Gutenberg WordPress theme for UBC Centre for Disease Control
Requires at least: 6.9
Tested up to: 6.9
Requires PHP: 8.1
Version: 1.0.22
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ubc-cdc
Tags: 
*/


html,
body {
	scrollbar-gutter: stable;
	overflow-x: clip;
}

a:hover,
a:focus {
    text-decoration: none;
}

.alignfull {
	position: relative;
	left: 50%;
	/* --scrollbar-width is set by main.js; subtract it from the viewport so
	   full-width blocks don't overflow past the scrollbar. Falls back to 0px
	   (i.e. plain 100dvw) before JS runs / where var() is unsupported. */
	width: 100vw;
	width: 100dvw;
	width: calc(100dvw - var(--scrollbar-width, 0px));
	max-width: 100vw;
	max-width: 100dvw;
    margin-left: 0 !important;
    margin-right: 0 !important;
	max-width: calc(100dvw - var(--scrollbar-width, 0px));
	transform: translateX(-50%);
}

.row-stack-on-mobile {
    @media screen and (max-width: 768px){
        display: grid !important;
    }
}




.is-style-gradient-text {
  background: var(--wp--preset--gradient--cdc-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.wp-block-separator {
    height: 2px;
    border: none;
}

.profile-publications,
.profile-social-links,
.profile-taxonomy-list,
.profile-education-list,
.profile-publication-links{
    margin: 0;
    padding: 0;
    list-style: none;

    /* &.profile-affiliations{
        color: var(--wp--preset--color--cdc-dark-teal);
    } */
    a {
        color: var(--wp--preset--color--cdc-dark-teal);

        &:hover,
        &:focus {
            text-decoration: none;
        }
    }
}

.profile-education-list {
    margin-top: 16px;
}

.profile-taxonomy-list li + li,
.profile-education-list li + li {
    margin-top: 10px;
}

/* Profile headshot: the template holds two copies. Desktop shows the one in
   the sidebar column; once columns stack (WP core breakpoint, 781px) the copy
   under the name shows instead, so the photo sits at the top of the page. */
.profile-headshot-mobile {
    display: none;
}

@media (max-width: 781px) {
    .profile-headshot-mobile {
        display: block;
    }

    .profile-headshot-desktop {
        display: none;
    }
}

.profile-taxonomy-sublist {
    margin: 8px 0 0;
    padding-left: 20px;
    list-style: none;
}

/*  Buttons  */

.wp-block-button__link.has-cdc-gradient-gradient-background {
    transition: all .5s ease;
    &:hover,
    &:focus {
        background: var(--wp--preset--gradient--cdc-gradient-hover) !important; 
    }
}


p {
    a:has(>img){
        display: inline-flex;
        justify-content: space-between;
        gap: 8px;
        align-items: center;
        
        img{
            position: relative;
            transition: all .5s ease;
        }

        &:hover,
        &:focus {
            img {
                left: 3px;
            }
        }
    }
}










/*  TERM STUDY LIST */
.term-studies {
    margin:  20px 0 60px;
}
.term-study {
    p {
        margin: 0;
    }
    a{
        color: var(--wp--preset--color--cdc-dark-teal);
    }
    .term-study__title {
        font-family: var(--wp--preset--font-family--public-sans);
        font-weight: 700;
        font-style: Bold;
        font-size: 18px;
        line-height: 24px;
        letter-spacing: 0%;
        color: #222222;
        margin: 0;
    }

    .term-study__label,
    .term-study__lead {
        font-family: var(--wp--preset--font-family--public-sans);
        font-style: normal;
        font-weight: 400;
        font-size: 16px;
        line-height: 24px;
        color: #222222;
        margin: 0;
    }
    .term-study__summary__label {
        margin-top: 20px;
        font-weight: 600;
    }

    .term-study__summary {
        p{
            margin-bottom: 20px;
        }
    }

    .wp-block-separator {
        margin: 20px 0;
    }
}


.term-publications__item {
    color: rgba(34, 34, 34, 1);
    max-width: 870px;

    a {
        color: var(--wp--preset--color--cdc-dark-teal);
    }
}


/* Researcher cards on a research area page lift on hover, matching
   .profile-card on the profiles archive. */
.researcher-grid .wp-block-post {
    transition: transform 0.2s ease;
}

.researcher-grid .wp-block-post:hover {
    transform: translateY(-2px);
}

/* Highlights are authored in a WYSIWYG, so each item holds paragraphs and
   lists. Drop their outer margins so the item keeps its own spacing. */
.term-highlights__item > :first-child {
    margin-top: 0;
}

.term-highlights__item > :last-child {
    margin-bottom: 0;
}

.term-highlights__item ul,
.term-highlights__item ol {
    margin: 0;
    padding-left: 1.25em;
}

.term-highlights__item {
    border-bottom: solid 1.5px rgba(0, 174, 205, 1);
    margin: 10px 0;
    padding: 0 0 10px 0;

    font-family: var(--wp--preset--font-family--public-sans);
    font-style: normal;
    font-weight: 400;
    font-size: 16px;
    line-height: 19px;

    color: #222222;


}


.term-impact-stories {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.term-impact-story__link {
    display: flex;
    align-items: center;
    gap: 30px;
    height: 100%;

    font-family: var(--wp--preset--font-family--public-sans);
    font-style: normal;
    font-weight: 400;
    font-size: 16px;
    line-height: 24px;
    /* or 150% */

    color: #374F5A;
    text-decoration: none;

    &:hover,
    &:focus {
        text-decoration: underline;
    }
}

.term-impact-story__image{
    width: 170px;
    height: 125px;
    object-fit: cover;
}

.term-impact-story__image-placeholder {
    display: block;
    width: 170px;
    height: 125px;
    background: var(--wp--preset--color--grey-light, #f0f0f0);
}

@media (max-width: 768px) {
    .term-impact-stories {
        grid-template-columns: 1fr;
    }

    .term-impact-story__link {
        display: grid;
        gap: 10px;
    }
}


/* Research area pages: every content link is dark teal, blue on hover/focus.
   Scoped to <main> so header/footer navigation keeps its own colours; the
   extra specificity beats per-block link colours set in the template. */
.tax-profile_research_area main a:not(.wp-element-button) {
    color: var(--wp--preset--color--cdc-dark-teal);

    &:hover,
    &:focus {
        color: #004cba;
    }
}


/* TERM INTRODUCTION */
/* The term introduction is authored in a WYSIWYG, so its type is set with the
   font size formats. Large carries the brand grey. */
.term-introduction .has-lg-font-size {
    color: var(--wp--preset--color--cdc-grey);
}


/* Drop the 4xl preset (68px) to 48px on mobile. WP applies the preset class
   with !important, so the override needs it too. */
@media (max-width: 768px) {
    .has-4-xl-font-size {
        font-size: 48px !important;
    }
}


.wp-block-navigation__submenu-container {
    margin-top: 50px;
    position: relative;
    &:before{
        bottom: 100%;
        height: 50px;
        left: 0;
        right: 0;
        display: block;
        content: '';
        position: absolute;
    }
}


/* ------------------------------------------------------------------------
   Mobile navigation: slide-down panel

   The core Navigation block's mobile overlay defaults to a full-screen fixed
   modal (inset: 0) that covers the header. These rules re-target the open
   state so the menu instead slides down as a panel pinned directly below the
   header, leaving the header visible. Core keeps handling the toggle, the
   page scroll-lock (has-modal-open) and the focus-trap; only the position and
   reveal are overridden here. --header-height is measured in main.js.
   ------------------------------------------------------------------------ */

/* Pin the header above the panel while the menu is open, so it stays visible
   even if the page was scrolled before opening. Scoped with :has() so the
   header is only sticky during the open state. */
header.wp-block-template-part:has(
    .wp-block-navigation__responsive-container.is-menu-open
) {
    position: sticky;
    top: 0;
    z-index: 100001;
    background-color: #fff;
}

/* Start the open overlay below the header instead of covering it, and give it
   an opaque background. The fallback covers first paint / no-JS. */
.wp-block-navigation__responsive-container.is-menu-open {
    top: var(--header-height, 136px);
    background-color: #fff;

    /* Panel is only as tall as its links, capped at the space below the
       header; core's overflow:auto scrolls a longer menu. */
    max-height: calc(100dvh - var(--header-height, 136px));

    /* Same shadow as the cards, along the panel's bottom edge. */
    box-shadow: 0 2px 12px rgba( 0, 0, 0, 0.08 );

    /* Reveal downward from the header's edge (clip the panel closed, then
       open it top-to-bottom). @starting-style sets the closed start value so
       the transition runs when the panel appears; browsers without support
       just show it instantly. The open state leaves 24px below the panel
       unclipped so the shadow shows. */
    clip-path: inset(0 0 -24px 0);
    transition: clip-path 0.3s ease;
}

@starting-style {
    .wp-block-navigation__responsive-container.is-menu-open {
        clip-path: inset(0 0 100% 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .wp-block-navigation__responsive-container.is-menu-open {
        transition: none;
    }
}

/* While the menu is open, turn the header toggle (hamburger) into a close (X)
   so the X sits in place of the hamburger. State is detected with :has() on
   the following .is-menu-open container. Core wires this button to open only,
   so main.js also makes it close; core's separate in-panel close button
   (hidden below) is no longer used. */
.wp-block-navigation__responsive-container-open:has(
    ~ .wp-block-navigation__responsive-container.is-menu-open
) {
    position: relative;
}

.wp-block-navigation__responsive-container-open:has(
    ~ .wp-block-navigation__responsive-container.is-menu-open
) svg {
    visibility: hidden;
}

.wp-block-navigation__responsive-container-open:has(
    ~ .wp-block-navigation__responsive-container.is-menu-open
)::before,
.wp-block-navigation__responsive-container-open:has(
    ~ .wp-block-navigation__responsive-container.is-menu-open
)::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 2px;
    background-color: currentColor;
}

.wp-block-navigation__responsive-container-open:has(
    ~ .wp-block-navigation__responsive-container.is-menu-open
)::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.wp-block-navigation__responsive-container-open:has(
    ~ .wp-block-navigation__responsive-container.is-menu-open
)::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* The overlay's own close button is replaced by the header toggle above.
   Custom overlays (WP 7.0) use .wp-block-navigation-overlay-close; the default
   overlay uses .wp-block-navigation__responsive-container-close. */
.wp-block-navigation__responsive-container.is-menu-open
    .wp-block-navigation-overlay-close,
.wp-block-navigation__responsive-container.is-menu-open
    .wp-block-navigation__responsive-container-close {
    display: none;
}





.wp-block-site-logo {
    max-width: calc(100vw - 100px);
}


/* Icon SVGs */
a.icon-container:hover,
a.icon-container:focus {
    color: var(--wp--preset--color--cdc-dark-teal) !important;
}





.wp-block-navigation-item {

    .wp-block-navigation__submenu-container {
        margin-top: 15px;   
        position: relative;
        left: 0;
        right: auto;
        
        &:before{
            bottom: 100%;
            height: 15px;
            left: 0;
            right: 0;
            display: block;
            content: '';
            position: absolute;
        }
    }
}


header.wp-block-template-part {
    position: relative;

    .wp-block-navigation,
    .wp-block-group {
        position: static;
    }

    .wp-block-navigation__responsive-container{
        position: absolute;
        bottom: auto;
        top: 100%;
        width: 100%;
    }
    .wp-block-navigation-item a {
        font-size: 16px;
    }

    .wp-block-navigation__submenu-container{ 
        padding-top: 0 !important;

        .wp-block-navigation-item a {
            font-size: 14px;
        }
        
        @media screen and (min-width: 600px){
            box-shadow: 0 2px 12px rgba( 0, 0, 0, 0.08 );
        }
    }

    .wp-block-navigation__responsive-container {
        .wp-block-navigation-overlay-close {
            display: none;
        }
    }



    a.wp-block-navigation-item__content:hover,
    a.wp-block-navigation-item__content:focus {
        color: #008299;
    }


}
.has-modal-open .admin-bar .is-menu-open .wp-block-navigation__responsive-dialog {
  margin-top: 0;
}

.wp-block-navigation__responsive-container.is-menu-open
  .wp-block-navigation__responsive-container-content {
    padding-top: 0;
}


.wp-block-ubccdc-linked-card{
    .wp-block-image {
        img { 
            width: 100%;
        }
    }
}


.flex-row-reversed {
    flex-direction: row-reverse;
}

/* When a reversed columns block stacks on mobile, row-reverse would put the
   second source column (the news list) on top. column-reverse keeps the
   original stacked order (news list first, featured below). */
@media (max-width: 781px) {
    .wp-block-columns.flex-row-reversed {
        flex-direction: column-reverse;
    }

    .mobile-padding-top-small {
        padding-top: 15px !important;
    }
}





.profile-archive__search {
	appearance: none;
	-webkit-appearance: none;
}

/* Mobile: smaller text, and right padding to clear the search icon (33px icon
   + 10px inset), so the placeholder doesn't run underneath it. */
@media (max-width: 781px) {
    .profile-archive__search-wrapper .profile-archive__search {
        font-size: 16px;
        padding-right: 55px;
    }
}

.profile-archive__search::-webkit-search-cancel-button,
.profile-archive__search::-webkit-search-decoration {
	-webkit-appearance: none;
	appearance: none;
	display: none;
}