/*
Theme Name: Sidebar Collapse Theme
Theme URI: https://example.com
Description: A modern WordPress theme with collapsible sidebar navigation, light/dark mode, and download functionality
Version: 1.0
Author: Your Name
Author URI: https://example.com
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sidebar-theme
*/

/* CSS Variables for Theme Colors */
:root {
    --bg-primary: #3a3a3a;   /* body + sidebar */
    --bg-secondary: #4a4a4a; /* buttons, hovers */
    --bg-content: #e0e0e0;   /* content card */
    --accent: #c49a3d;       /* brand gold — active menu item */
    --text-primary: #e0e0e0;
    --text-heading: #f0f0f0;
    --text-link: #fff;
    --text-meta: #aaa;
    --text-placeholder: #666;
    --icon-color: #2a2a2a;
    --border-color: rgba(255,255,255,0.1);
    --shadow-color: rgba(0,0,0,0.3);
    --menu-item-color: #ecf0f1;
    --menu-icon-color: #ecf0f1;
    --transition-logo-color: #fff;
    --transition-logo-opacity: 0.03;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--brand-font, 'Epilogue'), -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 60px;
    background: var(--bg-primary);
    transition: width 0.3s ease, background-color 0.3s ease;
    overflow: hidden;
    z-index: 1000;
    box-shadow: 0 2px 10px var(--shadow-color);
    display: flex;
    flex-direction: column;
}

.sidebar:hover {
    width: 280px;
}

/* Arrow indicator */
.sidebar::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 23px;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #fff;
    opacity: 1;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sidebar:hover::after {
    opacity: 0;
}

.sidebar-header {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    transition: width 0.3s ease, height 0.3s ease;
}

.sidebar:hover .sidebar-header {
    width: 280px;
    height: 280px;
}

.logo-placeholder {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.3s ease, height 0.3s ease;
}

.sidebar:hover .logo-placeholder {
    width: 200px;
    height: 200px;
}

.logo-placeholder svg {
    width: 100%;
    height: 100%;
}

.custom-logo-link {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.logo-placeholder img,
.custom-logo {
    width: 60%;
    height: 60%;
    object-fit: contain;
}

.sidebar-menu {
    list-style: none;
    padding: 30px 0;
}

.sidebar-menu li {
    margin: 0 0 8px 0;
}

.sidebar-menu > li > a .menu-text {
    font-weight: 700;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    color: var(--menu-item-color);
    text-decoration: none;
    transition: background 0.2s ease, padding-left 0.2s ease;
    white-space: nowrap;
    position: relative;
}

.sidebar-menu a:hover {
    background: transparent;
    padding-left: 25px;
}

.menu-text {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar:hover .menu-text {
    opacity: 1;
}

/* Sidebar Footer Logo */
.sidebar-footer {
    width: 60px;
    height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-top: 1px solid var(--border-color);
    transition: width 0.3s ease, height 0.3s ease;
    padding: 10px;
    margin-top: auto;
}

.sidebar:hover .sidebar-footer {
    width: 280px;
    height: 280px;
    padding: 30px 20px;
}

.sidebar-footer-logo {
    width: 29px;
    height: 29px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.3s ease, height 0.3s ease;
}

.sidebar:hover .sidebar-footer-logo {
    width: 50px;
    height: 50px;
}

.sidebar-footer-logo svg {
    width: 100%;
    height: 100%;
}

.sidebar-footer-contact {
    display: none;
    text-align: center;
    margin-top: 20px;
}

.sidebar:hover .sidebar-footer-contact {
    display: block;
}

.sidebar-footer-contact a {
    display: block;
    color: var(--text-placeholder);
    text-decoration: none;
    font-size: 0.765rem;
    line-height: 1.6;
    margin: 4px 0;
}

.sidebar-footer-contact a:hover {
    color: var(--text-placeholder);
}

/* Menu Icons */
.menu-icon {
    width: 24px;
    height: 24px;
    opacity: 1;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
}

.sidebar:hover .menu-icon {
    opacity: 0;
    width: 0;
}

.menu-icon svg {
    width: 100%;
    height: 100%;
    stroke: var(--menu-icon-color);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Active menu item */
.sidebar-menu .menu-item.active > a {
    opacity: 1;
}

/* Submenu styles */
.sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
    overflow: hidden;
}

.sidebar:hover .sub-menu {
    display: block;
}

.sub-menu li {
    margin: 0;
}

/* Hide icons in submenu */
.sub-menu .menu-icon {
    display: none;
}

.sub-menu a {
    padding: 10px 20px 10px 40px;
    font-size: 0.9rem;
    opacity: 0.7;
}

.sub-menu a:hover {
    padding-left: 45px;
    opacity: 1;
}

.sub-menu .menu-item.active a {
    opacity: 1;
}

.menu-item-has-children > a .menu-text::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--menu-item-color);
    margin-left: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar:hover .menu-item-has-children > a .menu-text::after {
    opacity: 1;
}

/* Main Content */
.main-content {
    margin-left: 60px;
    padding: 40px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.content-wrapper {
    max-width: calc(100% - 200px);
    margin: 0 auto;
    background: var(--bg-content);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-color);
    color: var(--text-primary);
    transition: background-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 20px;
    line-height: 1.3;
    color: var(--text-heading);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

p {
    margin-bottom: 15px;
}

a {
    color: var(--text-link);
}

a:hover {
    color: #ddd;
}

.entry-meta {
    color: var(--text-meta);
}

article {
    /* No border below content */
}

/* Image Grid */
.image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin: 40px 0;
}

.image-placeholder {
    background: #3a3a3a;
    aspect-ratio: 1/1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-placeholder);
    font-size: 0.9rem;
}

.image-caption {
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--text-meta);
    text-align: center;
}

/* Page Navigation */
.page-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.nav-previous,
.nav-next {
    display: flex;
    flex-direction: column;
    max-width: 45%;
}

.nav-previous {
    text-align: left;
}

.nav-next {
    text-align: right;
}

.nav-label {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 5px;
}

.nav-title {
    font-size: 1rem;
    color: var(--text-link);
    text-decoration: none;
}

.nav-title:hover {
    color: #ddd;
}

/* Responsive */
/* Desktop: sidebar permanently expanded — no hover-collapse */
@media (min-width: 769px) {
    .sidebar { width: 280px; }
    .sidebar-header { width: 280px; height: 280px; }
    .logo-placeholder { width: 200px; height: 200px; }
    .menu-text { opacity: 1; }
    .menu-icon { opacity: 0; width: 0; }
    .sub-menu { display: block; }
    .menu-item-has-children > a .menu-text::after { opacity: 1; }
    /* Footer idle: logomark only, compact; only hovering the footer itself reveals contact */
    .sidebar-footer,
    .sidebar:hover .sidebar-footer { width: 280px; height: 110px; padding: 30px 20px; transition: height 0.3s ease; }
    .sidebar-footer-logo,
    .sidebar:hover .sidebar-footer-logo { width: 50px; height: 50px; }
    .sidebar-footer-contact,
    .sidebar:hover .sidebar-footer-contact { display: none; }
    .sidebar .sidebar-footer:hover { height: 230px; }
    .sidebar .sidebar-footer:hover .sidebar-footer-contact { display: block; }
    .sidebar::after { opacity: 0; }            /* hide the "hover to expand" arrow */
    .sidebar { transition: none; }             /* no width animation, nothing to animate */
    .main-content { margin-left: 280px; }      /* content clears the wider sidebar */
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        width: 100%;
        height: 60px;
        top: 0;
        left: 0;
        right: 0;
        bottom: auto;
        overflow: visible;
        background: var(--bg-primary);
        z-index: 2000;
    }
    
    .sidebar.menu-open {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        height: 100vh;
        width: 100vw;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Show header logo, hide footer by default */
    .sidebar-header {
        display: none;
        justify-content: center;
        align-items: center;
        width: 100%;
        height: auto;
        padding: 20px 0 0;
        border-bottom: none;
        flex-shrink: 0;
    }

    .sidebar.menu-open .sidebar-header {
        display: flex;
    }

    .sidebar-footer {
        display: none;
        position: relative;
        width: 100%;
        height: auto;
        padding: 15px 10px 20px;
        margin-top: auto;
        flex-shrink: 0;
    }

    .sidebar.menu-open .sidebar-footer {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .sidebar-footer-logo,
    .sidebar.menu-open .sidebar-footer-logo {
        width: 40px;
        height: 40px;
    }

    .sidebar-footer-contact {
        display: block;
        margin-top: 10px;
    }

    .logo-placeholder,
    .sidebar.menu-open .logo-placeholder {
        width: 110px;
        height: 110px;
    }

    /* Show only arrow, hide icons */
    .menu-icon {
        display: none;
    }

    /* Arrow positioned for top bar - always visible */
    .sidebar::after {
        left: auto;
        right: 20px;
        top: 26px;
        border-left: 6px solid transparent;
        border-right: 6px solid transparent;
        border-top: 8px solid #fff;
        border-bottom: 0;
        transform: none;
        opacity: 1;
    }

    .sidebar.menu-open::after {
        transform: rotate(180deg);
        opacity: 0;
    }

    /* Menu hidden by default */
    .sidebar nav {
        display: none;
        flex: none;
        padding: 10px 0;
    }

    .sidebar.menu-open nav {
        display: block;
        margin: 0;
        width: 100%;
    }

    .sidebar-menu {
        padding: 0;
        background: transparent;
        text-align: center;
    }

    .sidebar-menu > li {
        margin: 0 0 4px 0;
    }

    .sidebar-menu a {
        padding: 9px 16px;
        justify-content: center;
        background: transparent;
        font-size: 1rem;
    }

    .sidebar-menu a:hover {
        background: transparent;
        padding-left: 16px;
    }

    .sidebar-menu .menu-text {
        opacity: 1;
    }

    /* Open menu: three centered zones — logo top, menu middle, contact bottom */
    .sidebar.menu-open {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: space-between;
        padding: 10px 0;
    }

    .sidebar.menu-open .sidebar-header {
        width: 100%;
        justify-content: center;
        align-items: center;
        margin: 0;
    }

    .sidebar.menu-open .sidebar-footer {
        width: 100%;
        justify-content: center;
        align-items: center;
        text-align: center;
        margin: 0;
    }

    /* Single column grid on mobile */
    .image-grid {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        margin-left: 0;
        margin-top: 60px;
        padding: 10px !important;
    }
    
    .content-wrapper {
        padding: 15px !important;
        max-width: 100% !important;
    }
    
    article {
        padding: 0 !important;
    }
    
    .entry-content {
        padding: 0 !important;
    }
    
    h1, h2, h3, h4, h5, h6, p {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}


/* Download All Button */
.download-all-btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px auto 30px;
    display: block;
    width: fit-content;
}

.download-all-btn:hover {
    background: #3d3d3d;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-color);
}

/* Individual Download Button */
.download-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 16px;
    background: transparent;
    color: var(--text-meta);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.download-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--text-meta);
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    transition: all 0.2s ease;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.wp-block-image img,
.image-placeholder {
    cursor: pointer;
    transition: opacity 0.2s ease;
}


/* Force all images in content to be square */
.entry-content img,
.wp-block-image img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    display: block;
    padding: 10%;
    box-sizing: border-box;
}

.wp-block-image {
    margin-bottom: 20px;
}

/* Image captions in Gutenberg */
.wp-block-image figcaption {
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--text-meta);
    text-align: center;
}

/* Transition Logo */
.transition-logo {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1700px;
    height: 1700px;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.2s ease, transform 1s ease;
}

.transition-logo.show {
    opacity: var(--transition-logo-opacity);
    transform: translate(-50%, -50%) scale(1.235);
}

.transition-logo svg {
    width: 100%;
    height: 100%;
}

/* Content wrapper transition state */
.content-wrapper.transitioning {
    background: transparent;
    box-shadow: none;
}

/* Page fade animations */
@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile menu open state */
@media (max-width: 768px) {
    .sidebar.menu-open {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        height: 100vh;
        width: 100vw;
        overflow-y: auto;
    }
    
    .sidebar.menu-open .sidebar-header {
        opacity: 1;
        pointer-events: auto;
    }
    
    .sidebar.menu-open .sidebar-footer {
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .sidebar.menu-open nav {
        display: block;
    }
}

/* ===== Brand asset figures ===== */
/* Transparent PNGs sit directly on the card, no tile background */
.wp-block-image.tile-light img,
.wp-block-image.tile-dark img {
    padding: 12%;
    width: 100%;
}

/* Row of per-format download buttons under an asset */
.download-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 10px;
}

.download-row .download-btn {
    margin-top: 0;
}

/* Active menu item — darker grey */
.sidebar-menu .menu-item.active > a > .menu-text {
    color: #9a9a9a;
}

/* Light content card — dark text inside */
.content-wrapper {
    color: #3a3a3a;
}

.content-wrapper h1, .content-wrapper h2, .content-wrapper h3,
.content-wrapper h4, .content-wrapper h5, .content-wrapper h6 {
    color: #3d3d3d;
    font-weight: 700;
    margin-top: 40px;
}

.content-wrapper h1 { font-size: 3rem; margin-top: 0; letter-spacing: -0.06em; }
.content-wrapper h2 { font-size: 2.2rem; letter-spacing: -0.04em; }

/* Roomier paragraphs */
.content-wrapper p,
.content-wrapper ul {
    margin-bottom: 28px;
}

.content-wrapper a {
    color: #2e2e2e;
}

.content-wrapper .wp-block-image figcaption,
.content-wrapper .image-caption {
    color: #777;
}

.content-wrapper .download-btn {
    color: #555;
    border-color: rgba(0, 0, 0, 0.25);
}

.content-wrapper .download-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #2e2e2e;
    border-color: rgba(0, 0, 0, 0.4);
}

/* Kicker line above page title */
.content-wrapper .kicker {
    font-weight: 300;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: #6a6a6a;
    margin-bottom: 12px;
}

/* Full-card image — the image IS the content card, text overlaid */
.entry-content .full-card {
    margin: 0;
    position: relative;
}

.entry-content .full-card img {
    width: 100%;
    display: block;
    aspect-ratio: auto;
    border-radius: 8px;
}

.entry-content .full-card-text {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 60px 40px 30px;
    border-radius: 0 0 8px 8px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
}

.entry-content .full-card-text h1,
.entry-content .full-card-text p {
    color: #fff;
    margin: 0;
}

.entry-content .full-card-text p {
    opacity: 0.85;
}

@media (max-width: 768px) {
    .entry-content .full-card-text {
        padding: 40px 15px 15px;
    }
}
