/*
Theme Name: CRAIGEN
Theme URI: https://craigen.org/
Author: Ashley Bens
Description: A custom WordPress theme for CRAIGEN.
Version: 2.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: craigen-theme
Tags: responsive, custom-logo, accessibility
*/

/* Theme Variables
   These CSS variables define our color scheme and important values used throughout
   the theme. Centralizing these values makes it easier to maintain consistency
   and make theme-wide changes. */
:root {
    --primary-color: #336699;
	--primary-color-rgb: 51, 102, 153;  /* This is the RGB value of #336699 */
	--primary-color-light: color-mix(in srgb, var(--primary-color) 10%, white); /* Creates a lighter variant */
    --secondary-color: #205454;
    --text-color: #333333;
    --border-color: #dddddd;
    --transition-speed: 0.3s;
}

/* Link Hover Color */
a {
    color: var(--primary-color);
    transition: color 0.3s ease;
}

a:hover {
    color: color-mix(in srgb, var(--primary-color) 70%, black);
}

/* Base Styles
   These styles establish the foundation for the entire theme, including
   typography and basic layout elements. */
body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    line-height: 1.6;
    color: var(--text-color);
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Header Layout
   The header uses a combination of flexbox and absolute positioning to create
   a dynamic layout that accommodates both the navigation and search functionality. */
.site-header {
    background-color: #ffffff;
    padding: 15px 0;
    border-bottom: 5px solid var(--primary-color);
    z-index: 103;
    transition: background-color var(--transition-speed) ease,
                box-shadow var(--transition-speed) ease;
}

.site-header.scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Site Branding
   The branding section contains the logo or site title and is designed to
   maintain consistent spacing and alignment with other header elements. */
.site-branding {
    display: flex;
    align-items: center;
    height: 100%;
}

.site-branding a {
    text-decoration: none;
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

/* Header Right Section
   This section contains both the navigation and search elements, using
   flexbox to create proper alignment and spacing. */
.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: 20px;
}

/* Main Navigation
   The primary navigation menu uses flexbox for alignment and includes
   smooth transitions for hover states. */
.main-navigation {
    height: 100%;
    display: flex;
    align-items: center;
}

.main-navigation ul {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 20px;
    height: 100%;
}

.main-navigation ul li {
    height: 100%;
    display: flex;
    align-items: center;
}

.main-navigation ul li a {
    text-decoration: none;
    color: var(--primary-color);
    font-size: 20px;
    font-weight: 600;
    padding: 5px 10px;
    transition: color var(--transition-speed) ease;
}

.main-navigation ul li a:hover {
    color: var(--secondary-color);
}

/* Sidebar Styles */
.widget-area {
    padding: 1rem;
}

.widget {
    margin-bottom: 2rem;
}

.widget:last-child {
    margin-bottom: 0;
}

.widget-title {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: var(--primary-color);
}

@media (min-width: 992px) {
    .widget-area {
        padding-left: 2rem;
    }
}

/* Archive page styles */
.post-grid article {
    border-bottom: 1px solid #eee;
    padding-bottom: 2rem;
}

.post-grid article:last-child {
    border-bottom: none;
}

.entry-title a {
    color: var(--text-color);
    transition: color var(--transition-speed) ease;
}

.entry-title a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

/* Single post styles */
.single .entry-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.single .entry-footer hr {
    border-color: #666;
}

.single .entry-footer {
    font-size: 0.95rem;
}

.single .entry-footer i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

/* Pagination styles */
.pagination {
    margin-top: 3rem;
}

.pagination .page-numbers {
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border: 1px solid #dee2e6;
    color: var(--primary-color);
    text-decoration: none;
    transition: all var(--transition-speed) ease;
}

.pagination .page-numbers.current {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination .page-numbers:hover:not(.current) {
    background-color: #f8f9fa;
    border-color: var(--primary-color);
}

/* Typography styles from customizer */
body {
    font-family: var(--body-font-family);
    font-size: var(--body-text-size);
}

h1 { font-size: var(--h1-size); }
h2 { font-size: var(--h2-size); }
h3 { font-size: var(--h3-size); }
h4 { font-size: var(--h4-size); }
h5 { font-size: var(--h5-size); }
h6 { font-size: var(--h6-size); }

/* Principle Taxonomy Styling at top of posts */
.principle-terms-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.principle-term {
    display: inline-block;
    background-color: var(--primary-color);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.principle-term:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
}

/* Keep this responsive */
@media (max-width: 576px) {
    .principle-term {
        padding: 0.35rem 0.75rem;
        font-size: 0.8rem;
    }
}


/* Media Text Block Advanced Fixes */
.wp-block-media-text {
    margin-bottom: 2rem; /* Add space after the entire block */
}

.wp-block-media-text__content {
    padding: 0 !important; /* Remove all padding with higher specificity */
}

.wp-block-media-text__content > * {
    margin-left: 0 !important; /* Remove left margin from all direct children */
    padding-left: 0 !important; /* Remove left padding from all direct children */
    text-indent: 0 !important; /* Remove text indentation from all direct children */
}

/* Target the specific "Is this paragraph" text that appears to be indented */
.wp-block-media-text__content p {
    margin-left: 0 !important;
    padding-left: 0 !important;
    text-indent: 0 !important;
}

/* Specific selector for the Accuracy heading and following content */
.wp-block-media-text + h2,
.wp-block-media-text + h3,
.wp-block-media-text + h4 {
    margin-top: 2.5rem; /* Add extra space before the next heading */
}

/* Media Text Caption Display and Alignment */
.wp-block-media-text.show-media-caption .wp-block-media-text__media figcaption,
.wp-block-media-text.show-media-caption .wp-element-caption {
    display: block !important;
    position: relative !important;
    margin-top: 0.5rem !important;
    font-size: 0.875rem;
    color: #666;
    padding: 0.25rem 0;
}

/* Always display captions under Media & Text block images */
.wp-block-media-text .wp-block-media-text__media {
    position: relative;
    display: flex;
    flex-direction: column;
}

.wp-block-media-text .wp-block-media-text__media img,
.wp-block-media-text .wp-block-media-text__media video {
    width: 100%;
    height: auto;
}

.wp-block-media-text .wp-block-media-text__media figcaption,
.wp-block-media-text .wp-block-media-text__media .wp-element-caption {
    display: block !important;
    position: relative !important;
    margin-top: 0.5rem !important;
    text-align: center;
    font-size: 0.875rem;
    color: #666;
    font-style: italic;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Conversation Container (Optional - helps with layout) */
.wp-block-group.is-conversation {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}



/* Accessibility Improvements
   These styles ensure the theme meets accessibility standards by providing
   proper focus states and hiding elements appropriately for screen readers. */
.search-toggle:focus,
.search-field:focus,
.hamburger-menu:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}