/*
 * Site-wide UI polish for the Protein Engineering & Neurobiology Laboratory site.
 * Linked last in <head> on every page so it can correct theme/plugin defaults.
 * Remove the <link> to this file to revert every change it makes.
 */

:root {
    /* Site colours, nudged slightly deeper for readable text */
    --lab-focus: #2B6CB0;        /* theme palette 1 */
    --lab-nav: #007bc0;          /* was #00abff */
    --lab-nav-active: #0069a6;   /* was #04a3ed */
    --lab-footer-box: #12263a;   /* was #1a1a1a */
    --lab-footer-head: #5cc8ff;  /* was #5a6bff */
    --lab-ink: #0f172a;
}

/* ---------- Page gutter ----------
 * Theme edge padding was 0rem: text, logo and menu button touched the screen
 * edge on phones and on laptops narrower than the 1234px content width. */
:root {
    --global-content-edge-padding: 1.5rem;
}

@media (max-width: 767px) {
    :root {
        --global-content-edge-padding: 1rem;
    }
}

/* ---------- Browser surfaces ---------- */
::selection {
    background: rgba(43, 108, 176, 0.18);
    color: var(--lab-ink);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--lab-focus);
    outline-offset: 2px;
}

/* ---------- Header ----------
 * The theme only switched to the phone header below 285px, so phones and
 * tablets got the full desktop menu wrapped over several rows.
 * Use the phone header (logo + menu button + drawer) up to 1024px. */
@media (max-width: 1024px) {
    .wp-site-blocks #main-header { display: none !important; }
    .wp-site-blocks #mobile-header { display: block !important; }
}

/* ---------- Colours: same hues, nudged slightly deeper ----------
 * Menu bar #00abff -> #007bc0 so white menu text is readable (2.5:1 -> 4.6:1). */
.site-bottom-header-wrap .site-header-row-container-inner,
.main-navigation .primary-menu-container > ul > li.menu-item > a,
.header-navigation .header-menu-container ul ul.sub-menu,
.header-navigation .header-menu-container ul ul.submenu,
.header-navigation .header-menu-container ul ul li.menu-item.current-menu-item > a {
    background: var(--lab-nav);
}

.main-navigation .primary-menu-container > ul > li.menu-item > a {
    color: #ffffff;
    transition: background-color 0.2s ease;
}

.main-navigation .primary-menu-container > ul > li.menu-item > a:hover,
.main-navigation .primary-menu-container > ul > li.menu-item.current-menu-item > a,
.main-navigation .primary-menu-container > ul > li.menu-item.current-menu-ancestor > a,
.header-navigation .header-menu-container ul ul li.menu-item > a:hover {
    color: #ffffff;
    background: var(--lab-nav-active);
}

/* ---------- Footer ----------
 * Same layout: blue band around a dark box. Band matches the menu bar, box is
 * a deep navy instead of grey, headings use the site's original bright cyan.
 * The widget had a 111px bottom margin (tall empty band); removed. */
.site-middle-footer-wrap .site-footer-row-container-inner {
    background: var(--lab-nav);
}

.site-middle-footer-inner-wrap .widget {
    margin-bottom: 0;
}

.site-footer .custom-html-widget > footer {
    background: var(--lab-footer-box) !important;
    font-family: inherit !important;
    border-radius: 6px;
}

.site-footer .custom-html-widget h3 {
    color: var(--lab-footer-head) !important;
}

.site-footer .custom-html-widget p,
.site-footer .custom-html-widget li {
    line-height: 1.8;
}

.site-footer .custom-html-widget a:hover {
    text-decoration: underline !important;
    text-underline-offset: 3px;
}

/* ---------- Typography details (all pages) ---------- */
.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4 {
    text-wrap: balance;
}

.entry-content p,
.entry-content li {
    text-wrap: pretty;
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* ---------- Body text ---------- */

/* Research page: inline Verdana and justified paragraphs differed from every other page */
.entry-content p[align="justify"] {
    font-family: inherit !important;
    line-height: 1.75;
    hyphens: auto;
}

@media (max-width: 767px) {
    /* Justified text in narrow columns leaves wide gaps between words */
    .entry-content p[align="justify"],
    .entry-content .intro {
        text-align: left !important;
    }
}

/* ---------- Home ---------- */
@media (max-width: 767px) {
    .entry-content .intro-box {
        padding: 32px 20px;
        border-radius: 16px;
    }
}

/* ---------- Contact ----------
 * Icons sat at the far left of each column (one outside the content area);
 * stack each icon above its heading, centred like the text. */
.page-id-1632 .wp-block-kadence-infobox .kt-blocks-info-box-media-align-left {
    flex-direction: column;
    justify-content: flex-start;
    text-align: center;
}

.page-id-1632 .kt-row-column-wrap.kt-row-valign-middle {
    align-items: flex-start;
}

.page-id-1632 .wp-block-kadence-infobox .kt-blocks-info-box-media-container {
    margin: 0 auto 8px;
}

/* ---------- News ----------
 * The page's own CSS turns cards into an indented timeline that leaves a
 * ~150px text column on phones; titles broke mid-word. */
@media (max-width: 768px) {
    .entry-content .container::before,
    .entry-content .year-badge-container::before,
    .entry-content .card::after,
    .entry-content .list-item::after {
        display: none;
    }

    .entry-content .container {
        padding: 2rem 0;
    }

    .entry-content .news-stack,
    .entry-content .year-badge {
        margin-left: 0;
    }

    .entry-content .news-stack .card {
        display: flex;
        flex-direction: column;
    }

    .entry-content .card-content {
        padding: 1.25rem 1.25rem 1.5rem;
    }

    .entry-content .card-title {
        font-size: 1.15rem;
        overflow-wrap: normal;
        word-break: normal;
        hyphens: manual;
    }
}

/* Calm the News hover: the image zoomed 130% out of its card */
@media (hover: hover) {
    .entry-content .card:hover {
        transform: translateY(-2px);
    }

    .entry-content .card:hover img {
        transform: none;
        filter: none;
    }

    .entry-content .list-item:hover {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .entry-content .card,
    .entry-content .list-item,
    .entry-content .intro-box {
        animation: none !important;
        transition: none !important;
    }
}
