/*
 * Frontend stylesheet for PB Boilerplate theme
 * Loaded only on frontend (not in admin)
 * Contains styles that might interfere with WordPress admin UI
 * The Publishing Bureau
 */

/* ========================================
   CSS RESET
======================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    line-height: var(--wp--custom--typography--line-height);
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

input,
button,
textarea,
select {
    font: inherit;
}
p:empty {
    display: none;
}

/* ========================================
   BASE TYPOGRAPHY
======================================== */
h1 {
    font-size: clamp(50px, 6vw, 120px);
}
h2 {
    font-size: clamp(36px, 4.5vw, 72px);
}
h3 {
    font-size: clamp(28px, 3.5vw, 56px);
}
h4 {
    font-size: clamp(22px, 2.5vw, 40px);
}
h5 {
    font-size: clamp(18px, 1.8vw, 28px);
}
h6 {
    font-size: clamp(16px, 1.2vw, 22px);
}

/* ========================================
   WORDPRESS OVERRIDES
======================================== */
:root {
    --wp--style--global--content-size: 100% !important;
}

/* ========================================
   HEADER & NAVIGATION
======================================== */
.site-header {
    background-color: var(--header--background-colour);
    border-bottom: var(--header--bottom-border);
    height: var(--header--height);
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Main Navigation Container */
.main-navigation {
    height: var(--header--height);
    position: relative;
}

.main-navigation .container {
    align-items: center;
    display: flex;
    height: var((--header--height));
    justify-content: space-between;
    padding: var(--wp--preset--spacing--md);
}

/* Site Branding */
.site-branding {
    flex-shrink: 0;
}

.site-logo img {
    height: auto;
    width: 120px; /* Mobile default */
    max-width: 100%;
}

.site-title {
    margin: 0;
    font-size: var(--wp--preset--font-size--xlarge);
    font-weight: var(--font-weight--bold);
}

.site-title a {
    color: var(--colour--text);
    text-decoration: none;
}

.site-title a:hover {
    color: var(--colour--link);
}

/* Desktop Navigation */
.nav-menu--desktop {
    display: none; /* Hidden on mobile by default */
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-item {
    position: relative;
    padding: 0 calc(var(--wp--preset--spacing--md) / 2);
}

.nav-item:first-child {
    padding-left: 0;
}

.nav-item:last-child {
    padding-right: 0;
}

.nav-link {
    color: var(--colour--link);
    text-decoration: none;
    font-size: var(--wp--preset--font-size--medium);
    font-weight: var(--font-weight--regular);
    display: flex;
    align-items: center;
    padding: var(--wp--preset--spacing--xs) 0;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--colour--link);
}

.nav-link--active {
    color: var(--colour--link);
    font-weight: var(--font-weight--bold);
}

/* Dropdown Arrow */
.nav-dropdown-icon {
    margin-left: var(--wp--preset--spacing--xs);
    transition: transform 0.3s ease;
}

.nav-item--dropdown:hover .nav-dropdown-icon {
    transform: rotate(180deg);
}

/* Dropdown Menus */
.nav-item--dropdown {
    position: static;
}

.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--color--link);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 999;
}

.nav-dropdown.show {
    display: block;
}

.nav-dropdown__inner {
    padding: var(--wp--preset--spacing--xl) 0;
}

.nav-dropdown__content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--wp--preset--spacing--xl);
    align-items: start;
}

.nav-dropdown__heading {
    margin: 0 0 var(--wp--preset--spacing--lg) 0;
    font-size: var(--wp--preset--font-size--large);
    font-weight: var(--font-weight--bold);
    color: var(--colour--text);
}

.nav-dropdown__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--wp--preset--spacing--md);
}

.nav-dropdown__item {
    margin: 0;
}

.nav-dropdown__link {
    color: var(--colour--text);
    text-decoration: none;
    font-size: var(--wp--preset--font-size--medium);
    display: block;
    padding: var(--wp--preset--spacing--xs) 0;
    transition: color 0.3s ease;
}

.nav-dropdown__link:hover {
    color: var(--colour--link);
}

.nav-dropdown__link--active {
    color: var(--colour--link);
    font-weight: var(--font-weight--bold);
}

.nav-dropdown__image {
    display: none; /* Hidden on mobile */
}

.nav-dropdown__image img {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--wp--preset--spacing--xs);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    position: relative;
}

.mobile-menu-toggle:focus {
    outline: 2px solid var(--colour--link);
    outline-offset: 2px;
}

.mobile-menu-toggle__line {
    width: 24px;
    height: 2px;
    background-color: var(--colour--text);
    transition: all 0.3s ease;
    transform-origin: center;
}

.mobile-menu-toggle__line:not(:last-child) {
    margin-bottom: 4px;
}

/* Hamburger Animation */
.mobile-menu-toggle.active .mobile-menu-toggle__line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.mobile-menu-toggle.active .mobile-menu-toggle__line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .mobile-menu-toggle__line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Mobile Navigation */
.mobile-navigation {
    display: none;
    background-color: var(--header--background-colour);
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-navigation.fade-in {
    display: block;
    animation: fadeInDown 0.3s ease forwards;
}

.mobile-navigation .container {
    padding: var(--wp--preset--spacing--xl) var(--wp--preset--spacing--md);
}

.mobile-nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav-item {
    border-bottom: 1px solid var(--colour--link);
    margin-bottom: var(--wp--preset--spacing--md);
    padding-bottom: var(--wp--preset--spacing--md);
}

.mobile-nav-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.mobile-nav-link {
    color: var(--colour--text);
    text-decoration: none;
    font-size: var(--wp--preset--font-size--large);
    font-weight: var(--font-weight--regular);
    display: block;
    padding: var(--wp--preset--spacing--xs) 0;
}

.mobile-nav-link--active {
    color: var(--colour--link);
    font-weight: var(--font-weight--bold);
}

/* Mobile Submenu */
.mobile-nav-submenu {
    list-style: none;
    margin: var(--wp--preset--spacing--md) 0 0 var(--wp--preset--spacing--md);
    padding: 0;
}

.mobile-nav-subitem {
    margin-bottom: var(--wp--preset--spacing--sm);
}

.mobile-nav-subitem:last-child {
    margin-bottom: 0;
}

.mobile-nav-sublink {
    color: var(--colour--text);
    text-decoration: none;
    font-size: var(--wp--preset--font-size--medium);
    display: block;
    padding: var(--wp--preset--spacing--xs) 0;
    opacity: 0.8;
}

.mobile-nav-sublink--active {
    color: var(--colour--link);
    font-weight: var(--font-weight--bold);
    opacity: 1;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Prevent body scroll when mobile menu is open */
body.menu-open {
    overflow: hidden;
}

/* ========================================
   Footer
======================================== */
footer {
    background-color: var(--footer--background-colour);
    color: var(--footer--colour);
}
footer a {
    color: var(--footer--link--colour);
}

/* ========================================
   UTILITY CLASSES
======================================== */
.fe-hidden {
    display: none;
}

/* ========================================
   SITE SPECIFIC STYLES
======================================== */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {

}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .site-logo img {
        width: 150px;
    }
    
    .nav-dropdown__image {
        display: block;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    /* Show desktop navigation */
    .nav-menu--desktop {
        display: flex;
    }
    
    /* Hide mobile elements */
    .mobile-menu-toggle {
        display: none;
    }
    
    /* Larger logo on desktop */
    .site-logo img {
        width: 175px;
    }
    
    /* Better dropdown spacing */
    .nav-dropdown__content {
        gap: calc(var(--wp--preset--spacing--xl) * 1.5);
    }
    
    .nav-item {
        padding: 0 var(--wp--preset--spacing--md);
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {

}

/* Extra xl large devices (large desktops, 1400px and up) */
@media (min-width: 1400px) {

}

/* Publishing Bureau xxl large devices (large desktops, 1600px and up) */
@media (min-width: 1600px) {

}

/* ========================================
   RESPONSIVE VISIBILITY CLASSES
======================================== */
/* Default: all elements visible */

/* Phone only - hide on tablet and desktop */
@media (min-width: 768px) {
    .pb-display-phone-only {
        display: none !important;
    }
}

/* Tablet only - hide on phone and desktop */  
@media (max-width: 767px), (min-width: 1025px) {
    .pb-display-tablet-only {
        display: none !important;
    }
}

/* Phone and Tablet only - hide on desktop */
@media (min-width: 1025px) {
    .pb-display-phone-tablet-only {
        display: none !important;
    }
}

/* Desktop only - hide on phone and tablet */
@media (max-width: 1024px) {
    .pb-display-desktop-only {
        display: none !important;
    }
}
