/*
 Theme Name:   GeneratePress Child
 Theme URI:    https://generatepress.com
 Description:  Default GeneratePress child theme. Maintenance Contact: Tiago Ramos - tiago.developing@gmail.com - +31 06 38613850
 Author:       Tom Usborne
 Author URI:   https://tomusborne.com
 Template:     generatepress
 Version:      0.1
*/

@import "css/colors.css";

/* Hide page titles site-wide */
.page .entry-title {
    display: none;
}

/* ==========================================================================
   Header navigation layout (desktop, 769px and up)
   - Home / Association / Calendar / Contact centred on the screen
   - logged in:  My Profile far right, Board Area just left of it
   - logged out: Login far right
   Below 769px the theme's hamburger menu is used.

   Menu items are targeted by ID (133 Home, 170 Board Area, 141 My Profile,
   162 Login). If you delete and re-add one of them in Appearance > Menus,
   its ID changes: update it here.
   ========================================================================== */

:root {
    /* width reserved for "My Profile" (text + arrow) when Board Area sits
       next to it; raise it if you rename the item to something longer */
    --nav-profile-width: 140px;
}

/* Base: menu fills the space right of the logo, middle links centred in it,
   right-hand items pushed to the end. Used as the fallback on narrow
   desktops when Board Area is shown (see below). */
@media (min-width: 769px) {
    .nav-float-right #site-navigation {
        flex: 1 1 auto;
        margin-left: 0;
    }

    #site-navigation .inside-navigation,
    #site-navigation .main-nav {
        flex: 1 1 auto;
        width: 100%;
    }

    #site-navigation .inside-navigation {
        padding: 0 !important;
    }

    #site-navigation .main-nav > ul {
        display: flex;
        width: 100%;
    }

    #site-navigation #menu-item-133,
    #site-navigation #menu-item-170,
    #site-navigation #menu-item-141,
    #site-navigation #menu-item-162 {
        margin-left: auto;
    }

    /* My Profile sits right next to Board Area when that is shown */
    #site-navigation #menu-item-170 + #menu-item-141 {
        margin-left: 0;
    }
}

/* Narrower desktops: slightly tighter links so everything fits on one line */
@media (min-width: 769px) and (max-width: 1023px) {
    #site-navigation .main-nav > ul > li:not(#menu-item-141):not(#menu-item-162) > a {
        padding-left: 12px;
        padding-right: 12px;
    }
}

@media (min-width: 769px) and (max-width: 899px) {
    #site-navigation .main-nav > ul > li:not(#menu-item-141):not(#menu-item-162) > a {
        padding-left: 9px;
        padding-right: 9px;
    }

    #site-navigation .main-nav > ul > li > a .dropdown-menu-toggle {
        padding-left: 4px;
        padding-right: 0;
    }
}

/* Centred on the screen.
   Logged out (or logged in without Board Area): from 769px up.
   With Board Area: from 1120px up - below that the middle links would run
   into Board Area, so they stay centred between the logo and Board Area. */
@media (min-width: 769px) {
    .site-header .inside-header:not(:has(#menu-item-170)) {
        position: relative;
    }

    /* logo lifted out of the row so the menu can span the full width */
    .site-header .inside-header:not(:has(#menu-item-170)) .site-logo {
        position: absolute;
        left: 40px;                             /* = header side padding */
        top: 50%;
        transform: translateY(-50%);
        z-index: 101;                           /* GeneratePress puts the menu at 100 */
    }

    .site-header .inside-header:not(:has(#menu-item-170)) #site-navigation .main-nav > ul {
        display: grid;
        grid-template-columns: minmax(0, 1fr) repeat(4, auto) minmax(0, 1fr);
    }

    .site-header .inside-header:not(:has(#menu-item-170)) #menu-item-133 {
        grid-column: 2;
        margin-left: 0;
    }

    /* Board Area, My Profile and Login share the right-hand column */
    .site-header .inside-header:not(:has(#menu-item-170)) #menu-item-170,
    .site-header .inside-header:not(:has(#menu-item-170)) #menu-item-141,
    .site-header .inside-header:not(:has(#menu-item-170)) #menu-item-162 {
        grid-row: 1;
        grid-column: 6;
        justify-self: end;
        margin-left: 0;
    }

    .site-header .inside-header:not(:has(#menu-item-170)) #menu-item-170 {
        margin-right: var(--nav-profile-width);
    }

    .site-header .inside-header:not(:has(#menu-item-170)) #menu-item-141 {
        width: var(--nav-profile-width);
        text-align: right;
    }
}

@media (min-width: 1120px) {
    .site-header .inside-header {
        position: relative;
    }

    /* logo lifted out of the row so the menu can span the full width */
    .site-header .inside-header .site-logo {
        position: absolute;
        left: 40px;                             /* = header side padding */
        top: 50%;
        transform: translateY(-50%);
        z-index: 101;                           /* GeneratePress puts the menu at 100 */
    }

    .site-header .inside-header #site-navigation .main-nav > ul {
        display: grid;
        grid-template-columns: minmax(0, 1fr) repeat(4, auto) minmax(0, 1fr);
    }

    .site-header .inside-header #menu-item-133 {
        grid-column: 2;
        margin-left: 0;
    }

    /* Board Area, My Profile and Login share the right-hand column */
    .site-header .inside-header #menu-item-170,
    .site-header .inside-header #menu-item-141,
    .site-header .inside-header #menu-item-162 {
        grid-row: 1;
        grid-column: 6;
        justify-self: end;
        margin-left: 0;
    }

    .site-header .inside-header #menu-item-170 {
        margin-right: var(--nav-profile-width);
    }

    .site-header .inside-header #menu-item-141 {
        width: var(--nav-profile-width);
        text-align: right;
    }
}

/* ==========================================================================
   Header navigation styling
   All colors come from colors.css.
   - short white bar under the hovered / current link (like the red bars
     under the section titles)
   - "My Profile" / "Login" as white outline pills (like the hero buttons)
   - dropdowns as small white cards with soft-pink hover
   ========================================================================== */

/* ---------- Bar ---------- */
.site-header,
.main-navigation,
.main-navigation ul {
    background-color: var(--color-primary) !important;
}

/* ---------- Height ----------
   Just tall enough for the logo (40px wide = ~49px tall) plus a little air.
   --nav-height is the height of the link row; the header adds 6px above
   and below it. */
:root {
    --nav-height: 52px;
}

.site-header .inside-header {
    padding-top: 6px !important;
    padding-bottom: 6px !important;
}

.site-header .site-logo {
    margin: 0 !important;
    line-height: 0;
}

.main-navigation,
.main-navigation .main-nav > ul {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* an admin stylesheet (loaded while you're logged in) adds 1em above "menu"
   lists, which pushes the links down */
.main-navigation .main-nav > ul.menu {
    padding-top: 0 !important;
}

.main-navigation .main-nav > ul > li > a,
.main-navigation .menu-toggle,
.main-navigation .menu-bar-item > a {
    line-height: var(--nav-height) !important;
}

/* soft shadow so the header floats a little above the page */
.site-header {
    position: relative;
    z-index: 50;
    box-shadow: 0 2px 16px color-mix(in srgb, var(--color-primary-dark) 30%, transparent);
}

/* ---------- Top-level links ---------- */
.main-navigation .main-nav > ul > li > a {
    position: relative;
    color: var(--color-white) !important;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    opacity: 0.88;
    background: transparent !important;
    transition: opacity 0.15s ease;
}

.main-navigation .main-nav > ul > li:hover > a,
.main-navigation .main-nav > ul > li.sfHover > a,
.main-navigation .main-nav > ul > li > a:focus-visible,
.main-navigation .main-nav > ul > li[class*="current-menu-"] > a {
    opacity: 1;
}

.main-navigation .main-nav > ul > li > a:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--color-white) 70%, transparent);
    outline-offset: -6px;
    border-radius: 8px;
}

/* dropdown arrow: slightly softer, turns on hover */
.main-navigation .main-nav > ul > li .dropdown-menu-toggle .gp-icon svg {
    transition: transform 0.2s ease;
}

@media (min-width: 769px) {
    .main-navigation .main-nav > ul {
        align-items: center;
    }

    /* the short white bar under a link */
    .main-navigation .main-nav > ul > li > a::after {
        content: '';
        position: absolute;
        left: 50%;
        bottom: 10px;
        width: 22px;
        height: 3px;
        border-radius: 3px;
        background: var(--color-white);
        transform: translateX(-50%) scaleX(0);
        transition: transform 0.2s ease;
    }

    .main-navigation .main-nav > ul > li:hover > a::after,
    .main-navigation .main-nav > ul > li.sfHover > a::after,
    .main-navigation .main-nav > ul > li > a:focus-visible::after {
        transform: translateX(-50%) scaleX(0.6);
    }

    /* current page: full bar */
    .main-navigation .main-nav > ul > li[class*="current-menu-"] > a::after {
        transform: translateX(-50%) scaleX(1);
    }

    .main-navigation .main-nav > ul > li:hover .dropdown-menu-toggle .gp-icon svg,
    .main-navigation .main-nav > ul > li.sfHover .dropdown-menu-toggle .gp-icon svg {
        transform: rotate(180deg);
    }

    /* ---------- "My Profile" and "Login" as outline pills ---------- */
    /* li keeps the full bar height so the dropdown still opens right below
       without a gap */
    #site-navigation #menu-item-141,
    #site-navigation #menu-item-162 {
        padding-block: calc((var(--nav-height) - 34px) / 2);
    }

    #site-navigation #menu-item-141 > ul {
        top: 100%;
        text-align: left;
    }

    #site-navigation #menu-item-141 > a,
    #site-navigation #menu-item-162 > a {
        display: inline-flex;
        align-items: center;
        white-space: nowrap;
        line-height: 34px !important;
        padding: 0 16px !important;
        border: 1.5px solid color-mix(in srgb, var(--color-white) 70%, transparent);
        border-radius: 999px;
        opacity: 1;
        transition: background-color 0.15s ease, border-color 0.15s ease;
    }

    #site-navigation #menu-item-141 > a .dropdown-menu-toggle {
        padding: 0 0 0 6px !important;
        line-height: 1;
        height: auto;
    }

    #site-navigation #menu-item-141 > a::after,
    #site-navigation #menu-item-162 > a::after {
        display: none;                          /* no bar under the pills */
    }

    #site-navigation #menu-item-141:hover > a,
    #site-navigation #menu-item-141.sfHover > a,
    #site-navigation #menu-item-141[class*="current-menu-"] > a,
    #site-navigation #menu-item-162:hover > a,
    #site-navigation #menu-item-162 > a:focus-visible,
    #site-navigation #menu-item-162[class*="current-menu-"] > a {
        background: color-mix(in srgb, var(--color-white) 15%, transparent) !important;
        border-color: var(--color-white);
    }

    /* ---------- Dropdowns as white cards ---------- */
    .main-navigation .main-nav ul ul {
        width: 210px;
        padding: 6px;
        background: var(--color-surface) !important;
        border: 1px solid var(--color-border);
        border-radius: 12px;
        box-shadow: var(--shadow-card-hover);
        box-sizing: border-box;
    }

    /* Calendar and Board Area: card centred under the link
       (My Profile keeps the theme's right alignment so it stays on screen) */
    .main-navigation:not(.toggled) .main-nav > ul > li:not(#menu-item-141):hover > ul,
    .main-navigation:not(.toggled) .main-nav > ul > li:not(#menu-item-141).sfHover > ul {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    .main-navigation .main-nav ul ul li {
        background: transparent !important;
    }

    .main-navigation .main-nav ul ul li a {
        padding: 10px 14px !important;
        border-radius: 8px;
        color: var(--color-text-primary) !important;
        background: transparent !important;
        font-size: 0.92rem !important;
        font-weight: 500 !important;
        line-height: 1.4 !important;
        transition: background-color 0.15s ease, color 0.15s ease;
    }

    .main-navigation .main-nav ul ul li:hover > a,
    .main-navigation .main-nav ul ul li.sfHover > a,
    .main-navigation .main-nav ul ul li a:focus-visible {
        background: var(--color-primary-soft) !important;
        color: var(--color-primary-dark) !important;
    }

    .main-navigation .main-nav ul ul li[class*="current-menu-"] > a {
        color: var(--color-primary) !important;
        font-weight: 600 !important;
    }
}

/* ---------- Mobile menu (hamburger, 768px and narrower) ---------- */
@media (max-width: 768px) {
    .main-navigation .menu-toggle {
        color: var(--color-white) !important;
        background: transparent !important;
    }

    .main-navigation.toggled .main-nav > ul {
        padding-bottom: 8px;
    }

    .main-navigation.toggled .main-nav li a {
        color: var(--color-white) !important;
        background: transparent !important;
    }

    /* thin dividers between items */
    .main-navigation.toggled .main-nav > ul > li + li {
        border-top: 1px solid color-mix(in srgb, var(--color-white) 18%, transparent);
    }

    /* sub-items slightly indented and softer */
    .main-navigation.toggled .main-nav ul ul li a {
        padding-left: 36px !important;
        font-weight: 500;
        opacity: 0.9;
    }

    /* current page: the same short white bar as on desktop, under the text */
    .main-navigation.toggled .main-nav li > a {
        position: relative;
    }

    .main-navigation.toggled .main-nav li.current-menu-item > a::after {
        content: '';
        position: absolute;
        left: 20px;                             /* = link text start */
        bottom: 10px;
        width: 22px;
        height: 3px;
        border-radius: 3px;
        background: var(--color-white);
    }

    .main-navigation.toggled .main-nav ul ul li.current-menu-item > a::after {
        left: 36px;                             /* sub-items are indented */
        bottom: 6px;
    }

    .main-navigation.toggled .main-nav li.current-menu-item > a {
        opacity: 1;
    }

    /* "My Profile" and "Login" as the same white outline pills as on desktop */
    .main-navigation.toggled #menu-item-141,
    .main-navigation.toggled #menu-item-162 {
        padding: 10px 20px;
        box-sizing: border-box;
    }

    .main-navigation.toggled #menu-item-141 > a,
    .main-navigation.toggled #menu-item-162 > a {
        display: inline-flex;
        align-items: center;
        padding: 0 16px !important;
        line-height: 38px !important;
        border: 1.5px solid color-mix(in srgb, var(--color-white) 70%, transparent);
        border-radius: 999px;
        opacity: 1;
    }

    .main-navigation.toggled #menu-item-141 > a .dropdown-menu-toggle {
        float: none;
        padding: 0 0 0 6px !important;
        line-height: 1;
    }

    .main-navigation.toggled #menu-item-141.sfHover > a,
    .main-navigation.toggled #menu-item-141.current-menu-item > a,
    .main-navigation.toggled #menu-item-162.current-menu-item > a {
        background: color-mix(in srgb, var(--color-white) 15%, transparent) !important;
        border-color: var(--color-white);
    }

    .main-navigation.toggled #menu-item-141.current-menu-item > a::after,
    .main-navigation.toggled #menu-item-162.current-menu-item > a::after {
        display: none;                          /* the filled pill already shows it */
    }

    /* its sub-items line up with the other sub-items */
    .main-navigation.toggled #menu-item-141 > ul {
        margin: 6px -20px -10px !important;
        width: calc(100% + 40px) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .main-navigation .main-nav li a,
    .main-navigation .main-nav > ul > li > a::after,
    .main-navigation .dropdown-menu-toggle .gp-icon svg {
        transition: none;
    }
}