/* Theme-wide customizations */

/* Override the global content width */
.wp-site-blocks {
    --wp--style--global--content-size: 1024px;
}

/* Ensure the content area width for templates */
.site-content, 
.wp-block-template-part,
.wp-block-post-content,
.entry-content,
.wp-block-group.alignwide,
.wp-block-query {
    max-width: 1024px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Ensure theme background color is applied */
body, 
.wp-site-blocks,
.block-editor-block-list__layout {
    background-color: var(--site-bg);
}

/* Fix content padding */
@media (min-width: 1024px) {
    .wp-site-blocks {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Fix for inconsistent width issues */
.has-global-padding {
    padding-right: 0 !important;
    padding-left: 0 !important;
}

/* Fix for the alignfull elements that are causing tablet/mobile issues */
.has-global-padding > .alignfull {
    margin-right: 0 !important;
    margin-left: 0 !important;
}

/* Add consistent container width and centered alignment */
.wp-site-blocks,
header.wp-block-template-part,
footer.wp-block-template-part,
.entry-content,
.wp-block-post-content {
    max-width: 1024px !important;
    width: auto !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Add proper spacing on the sides for all viewports */
body {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

/* Remove margin-top from main element */
main.wp-block-group {
    margin-top: 0 !important;
}

/* Increase padding on larger screens */
@media (min-width: 781px) {
    body {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }
}

/* Header Styles */
.site-header {
    margin: 1rem 0rem;
}

.site-header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    width: 100%;
    flex-wrap: nowrap !important; /* Prevent wrapping at all costs */
}

.site-branding {
    display: flex;
    align-items: center;
    flex-shrink: 1; /* Allow branding to shrink if needed */
}

.site-branding figure.site-logo {
    margin: 0;
    display: flex;
    align-items: center;
    flex-shrink: 1; /* Allow logo to shrink */
}

/* Logo styling for both header and footer */
.site-logo img,
.footer-logo-wrapper img {
    display: block;
    width: auto;
    min-width: 0; /* Ensure the image can shrink */
}

.site-logo img {
    max-height: 40px;
}

.footer-logo-wrapper img {
    max-height: 30px;
}

/* Default state (light mode) */
.logo-light {
    display: block !important;
}

.logo-dark {
    display: none !important;
}

/* Dark mode state */
html.dark-mode .logo-light {
    display: none !important;
}

html.dark-mode .logo-dark {
    display: block !important;
}

.site-title-container {
    display: flex;
    align-items: center;
    flex-shrink: 1; /* Allow container to shrink if needed */
    margin-left: auto; /* Push to right */
}

.site-title {
    font-size: clamp(1rem, 5vw, 1.5rem); /* Responsive font size */
    font-weight: 600;
    margin: 0;
    color: var(--black);
    white-space: nowrap; /* Prevent title from wrapping */
    overflow: hidden; /* Hide overflow */
    text-overflow: ellipsis; /* Add ellipsis for very small screens */
    max-width: 100%; /* Allow text to be truncated */
}

/* Footer Styles */
.site-footer {
    margin: 1rem 0rem;
}

.site-footer-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.footer-link {
    color: var(--black);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--primary);
}

.footer-separator {
    color: var(--gray-text);
}

.footer-copyright {
    color: var(--gray-text);
    font-size: 0.875rem;
}

/* Remove focus ring/outline from buttons */
button:focus,
button:active {
    outline: none !important;
    box-shadow: none !important;
}

/* Specifically for the theme toggle button */
#theme-toggle:focus,
#theme-toggle:active {
    outline: none !important;
    box-shadow: none !important;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .site-logo img {
        max-height: 30px;
        max-width: 150px; /* Limit logo width on smaller screens */
    }
    
    .site-title {
        font-size: 1rem; /* Smaller font on mobile */
    }
    
    #theme-toggle {
        margin-right: 3px; /* Even smaller margin on mobile */
    }
    
    .theme-icon {
        width: 20px; /* Slightly smaller icon */
        height: 20px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .site-logo img {
        max-height: 25px;
        max-width: 125px; /* Further limit logo width */
    }
    
    .site-title {
        font-size: 0.9rem; /* Even smaller font on very small devices */
    }
    
    .site-header-wrapper {
        padding: 0.25rem 0; /* Less padding for tighter fit */
    }
}

/* Extra extra small devices */
@media (max-width: 340px) {
    .site-logo img {
        max-width: 90px; /* Further limit logo width */
    }
}