/*
Theme Name: EEi Blog
Theme URI: https://eeiblog.com
Author: MuseGroup
Author URI: https://eeiblog.com
Description: A clean WordPress theme matching the EEi Blog design — dark header, white content area, list-style blog posts.
Version: 1.0.20
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: eeiblog
Tags: blog, education, music, minimal, custom-header, custom-menu, featured-images
*/

/* =========================================================
   CSS Custom Properties
   ========================================================= */
:root {
    --color-header-bg:   #1e1e1e;
    --color-header-text: #ffffff;
    --color-nav-hover:   #cccccc;
    --color-body-bg:     #ffffff;
    --color-text:        #2d2d2d;
    --color-text-muted:  #777777;
    --color-accent:      #005a9e;
    --color-accent-hover:#003d6e;
    --color-border:      #e5e5e5;
    --color-light-bg:    #f8f8f8;
    --color-footer-bg:   #1e1e1e;
    --color-footer-text: #cccccc;

    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-base: 16px;
    --line-height-base: 1.7;

    --container-width: 1100px;
    --container-padding: 24px;
    --header-height: 64px;
}

/* =========================================================
   Reset & Base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: var(--font-size-base); scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: var(--line-height-base);
    color: var(--color-text);
    background: var(--color-body-bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--color-accent-hover); text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.5em;
}

p { margin-bottom: 1.25em; }
ul, ol { margin-bottom: 1.25em; padding-left: 1.5em; }
li { margin-bottom: 0.35em; }

/* =========================================================
   Layout Helpers
   ========================================================= */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

.screen-reader-text {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}

/* =========================================================
   Site Header
   ========================================================= */
.site-header {
    background: var(--color-header-bg);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-height);
    gap: 24px;
}

/* Logo / Site Title */
.site-branding { display: flex; align-items: center; }

.site-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
}

.site-title a {
    color: var(--color-header-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-title a:hover { color: #dddddd; text-decoration: none; }

.site-logo { height: 40px; width: auto; }

/* =========================================================
   Primary Navigation
   ========================================================= */
.main-navigation {
    display: flex;
    align-items: center;
}

.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.main-navigation li { position: relative; }

.main-navigation a {
    display: block;
    padding: 8px 14px;
    color: var(--color-header-text);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.main-navigation a:hover,
.main-navigation .current-menu-item > a,
.main-navigation .current-menu-ancestor > a {
    background: rgba(255,255,255,0.12);
    color: #ffffff;
}

/* Dropdown arrow indicator */
.main-navigation .menu-item-has-children > a::after {
    content: ' ▾';
    font-size: 0.7em;
    opacity: 0.8;
}

/* Dropdowns
   No gap between parent <li> and the submenu — a visual gap creates a
   dead zone where cursor exits both, killing :hover. The submenu sits
   flush under the parent and a transparent ::before extends the hover
   bridge upward to forgive small cursor wiggles. JS adds a 250ms
   hover-intent close delay (.is-open-hover); see navigation.js. */
.main-navigation .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--color-header-bg);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    min-width: 200px;
    flex-direction: column;
    gap: 0;
    padding: 6px 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 200;
}

.main-navigation .sub-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
    /* invisible hover bridge */
}

.main-navigation .sub-menu li { width: 100%; }

.main-navigation .sub-menu a {
    text-transform: none;
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
    padding: 8px 16px;
    border-radius: 0;
    width: 100%;
}

.main-navigation .menu-item-has-children:hover > .sub-menu,
.main-navigation .menu-item-has-children:focus-within > .sub-menu,
.main-navigation .menu-item-has-children.is-open-hover > .sub-menu {
    display: flex;
    flex-direction: column;
}

/* Mobile hamburger */
.menu-toggle {
    display: none;
    background: none;
    border: 2px solid rgba(255,255,255,0.5);
    color: var(--color-header-text);
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
}

/* =========================================================
   Hero / Banner (Front Page)
   ========================================================= */
.hero-banner {
    position: relative;
    background: var(--color-header-bg);
    color: #fff;
    text-align: center;
    overflow: hidden;
    min-height: 380px;
    display: flex;
    align-items: center;
}

.hero-banner img.hero-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.55;
}

.hero-banner .hero-content {
    position: relative;
    z-index: 1;
    padding: 60px var(--container-padding);
    max-width: var(--container-width);
    margin: 0 auto;
}

.hero-banner h1 {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 800;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.2;
    margin-bottom: 16px;
}

.hero-banner p {
    font-size: 1.0625rem;
    color: rgba(255,255,255,0.88);
    max-width: 640px;
    margin: 0 auto 28px;
}

.hero-banner .btn {
    display: inline-block;
    padding: 12px 28px;
    background: var(--color-accent);
    color: #fff;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-decoration: none;
    transition: background 0.2s;
}

.hero-banner .btn:hover { background: var(--color-accent-hover); text-decoration: none; }

/* =========================================================
   Feature Boxes (Front Page CTA blocks)
   ========================================================= */
.feature-boxes {
    background: var(--color-light-bg);
    padding: 60px 0;
}

.feature-boxes .container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 28px;
}

.feature-box {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 36px 28px;
    text-align: center;
    transition: box-shadow 0.2s;
}

.feature-box:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.08); }

.feature-box h2 {
    font-size: 1.125rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
    color: var(--color-header-bg);
}

.feature-box .tagline {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-accent);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.feature-box p { font-size: 0.9rem; color: var(--color-text-muted); margin-bottom: 20px; }

.feature-box a.btn {
    display: inline-block;
    padding: 10px 22px;
    background: var(--color-accent);
    color: #fff;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-decoration: none;
    transition: background 0.2s;
}

.feature-box a.btn:hover { background: var(--color-accent-hover); text-decoration: none; }

/* =========================================================
   Main Content Area
   ========================================================= */
.site-main { padding: 48px 0 64px; }

.content-area { width: 100%; }

/* Content + Sidebar layout */
.has-sidebar .content-sidebar-wrap {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 48px;
    align-items: start;
}

/* =========================================================
   Page Title Banner
   ========================================================= */
.page-header {
    background: var(--color-light-bg);
    border-bottom: 1px solid var(--color-border);
    padding: 36px 0;
    margin-bottom: 40px;
}

.page-header .page-title {
    font-size: 2rem;
    margin: 0;
    color: var(--color-header-bg);
}

.page-header .page-subtitle {
    font-size: 0.9375rem;
    color: var(--color-text-muted);
    margin: 8px 0 0;
}

/* =========================================================
   Blog Post List (archive / home)
   ========================================================= */
.posts-list { list-style: none; margin: 0; padding: 0; }

.post-item {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 28px;
    border-bottom: 1px solid var(--color-border);
    padding: 36px 0;
    align-items: start;
}

.post-item:first-child { padding-top: 0; }

.post-thumbnail {
    border-radius: 6px;
    overflow: hidden;
    background: var(--color-light-bg);
    aspect-ratio: 16/10;
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.post-item:hover .post-thumbnail img { transform: scale(1.03); }

.post-thumbnail-placeholder {
    width: 100%;
    height: 100%;
    min-height: 150px;
    background: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 2rem;
}

.post-content { display: flex; flex-direction: column; gap: 10px; }

.post-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.post-meta .post-category a {
    background: var(--color-accent);
    color: #fff;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-decoration: none;
}

.post-meta .post-category a:hover { background: var(--color-accent-hover); text-decoration: none; }

.post-meta .post-date-label {
    color: var(--color-text-muted);
    margin-right: 0.25rem;
}

.post-title {
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
}

.post-title a { color: var(--color-text); text-decoration: none; }
.post-title a:hover { color: var(--color-accent); }

.post-excerpt {
    font-size: 0.9375rem;
    color: #555;
    line-height: 1.65;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.read-more {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-decoration: none;
}

.read-more:hover { color: var(--color-accent-hover); text-decoration: underline; }

/* No posts */
.no-posts { padding: 48px 0; text-align: center; color: var(--color-text-muted); }

/* =========================================================
   Pagination
   ========================================================= */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 48px;
    padding-top: 36px;
    border-top: 1px solid var(--color-border);
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--color-text);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pagination a:hover { background: var(--color-accent); border-color: var(--color-accent); color: #fff; text-decoration: none; }
.pagination .current { background: var(--color-accent); border-color: var(--color-accent); color: #fff; }
.pagination .dots { border: none; color: var(--color-text-muted); }

/* =========================================================
   Single Post
   ========================================================= */
.single-post-header { margin-bottom: 36px; }

.single-post-header .post-meta { margin-bottom: 14px; }

.single-post-header .post-title {
    font-size: clamp(1.6rem, 3vw, 2.5rem);
    line-height: 1.2;
    margin-bottom: 16px;
}

.single-post-footer {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border, #e5e5e5);
}

.single-post-footer .post-meta {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

/* Jetpack related-posts block at the bottom of single posts */
.post-related-jetpack {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
}

.post-related-jetpack .jp-relatedposts-headline {
    font-size: 0.875rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-header-bg);
    margin-bottom: 16px;
}

.post-featured-image {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 40px;
    max-height: 480px;
}

.post-featured-image img { width: 100%; height: 100%; object-fit: cover; }

/* Post content typography */
.post-content-body {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--color-text);
    max-width: 760px;
}

.post-content-body h2 { font-size: 1.5rem; margin: 2em 0 0.75em; }
.post-content-body h3 { font-size: 1.25rem; margin: 1.75em 0 0.6em; }
.post-content-body h4 { font-size: 1.0625rem; margin: 1.5em 0 0.5em; }

.post-content-body p { margin-bottom: 1.4em; }

.post-content-body a { color: var(--color-accent); }
.post-content-body a:hover { color: var(--color-accent-hover); }

.post-content-body img {
    border-radius: 6px;
    margin: 1.5em auto;
    display: block;
}

.post-content-body ul, .post-content-body ol { margin: 0 0 1.4em 1.5em; }
.post-content-body li { margin-bottom: 0.4em; }

.post-content-body blockquote {
    border-left: 4px solid var(--color-accent);
    background: var(--color-light-bg);
    padding: 16px 20px;
    margin: 1.5em 0;
    border-radius: 0 4px 4px 0;
    font-style: italic;
    color: #555;
}

.post-content-body pre, .post-content-body code {
    font-family: 'SF Mono', Consolas, Monaco, monospace;
    font-size: 0.875em;
    background: var(--color-light-bg);
    border: 1px solid var(--color-border);
    border-radius: 4px;
}

.post-content-body code { padding: 2px 6px; }
.post-content-body pre { padding: 16px; overflow-x: auto; margin-bottom: 1.4em; }
.post-content-body pre code { background: none; border: none; padding: 0; }

.post-content-body iframe, .post-content-body video {
    max-width: 100%;
    border-radius: 6px;
    margin: 1.5em 0;
}

/* Tags */
.post-tags {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.post-tags .label { font-size: 0.8125rem; font-weight: 700; color: var(--color-text-muted); }

.post-tags a {
    padding: 4px 12px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}

.post-tags a:hover { border-color: var(--color-accent); color: var(--color-accent); text-decoration: none; }

/* Post navigation (prev/next) */
.post-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 48px;
    padding-top: 36px;
    border-top: 1px solid var(--color-border);
}

.nav-previous, .nav-next { display: flex; flex-direction: column; gap: 6px; }
.nav-next { text-align: right; }

.nav-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
}

.nav-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-accent);
    line-height: 1.4;
    text-decoration: none;
}

.nav-title:hover { color: var(--color-accent-hover); text-decoration: underline; }

/* =========================================================
   Sidebar
   ========================================================= */
.widget-area {
    position: sticky;
    top: calc(var(--header-height) + 24px);
}

.widget {
    background: var(--color-light-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.widget-title {
    font-size: 0.875rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-header-bg);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--color-accent);
}

.widget ul { list-style: none; margin: 0; padding: 0; }
.widget ul li { padding: 6px 0; border-bottom: 1px solid var(--color-border); font-size: 0.9rem; }
.widget ul li:last-child { border-bottom: none; }
.widget ul li a { color: var(--color-text); text-decoration: none; }
.widget ul li a:hover { color: var(--color-accent); }

/* Search widget */
.widget.widget_search .search-form {
    display: flex;
    gap: 8px;
}

.widget.widget_search input[type="search"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.9rem;
    outline: none;
}

.widget.widget_search input[type="search"]:focus { border-color: var(--color-accent); }

.widget.widget_search button {
    padding: 8px 14px;
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.2s;
}

.widget.widget_search button:hover { background: var(--color-accent-hover); }

/* =========================================================
   Static Page
   ========================================================= */
.page-content { max-width: 820px; }
.page-content h2 { margin-top: 2em; }
.page-content img { border-radius: 6px; margin: 1.5em 0; }

/* =========================================================
   404 Page
   ========================================================= */
.error-404 { text-align: center; padding: 80px 0; }
.error-404 .error-code { font-size: 7rem; font-weight: 900; color: var(--color-border); line-height: 1; }
.error-404 h1 { font-size: 2rem; margin: 16px 0 12px; }
.error-404 p { color: var(--color-text-muted); margin-bottom: 32px; }
.error-404 .btn {
    display: inline-block;
    padding: 12px 28px;
    background: var(--color-accent);
    color: #fff;
    border-radius: 4px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s;
}
.error-404 .btn:hover { background: var(--color-accent-hover); text-decoration: none; }

/* =========================================================
   Site Footer
   ========================================================= */
.site-footer {
    background: var(--color-footer-bg);
    color: var(--color-footer-text);
    padding: 40px 0;
    margin-top: auto;
}

.site-footer .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-logo { height: 36px; width: auto; opacity: 0.85; }
.footer-logo:hover { opacity: 1; }

.footer-info { text-align: center; }

.site-footer .copyright {
    font-size: 0.8125rem;
    color: rgba(255,255,255,0.55);
    margin: 0;
}

.footer-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.footer-links a {
    font-size: 0.8125rem;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover { color: #ffffff; text-decoration: none; }

/* =========================================================
   Block: Separator (<hr>)
   WP core constrains the default-style separator to
   max-width: 100px via `.wp-block-separator:not(.is-style-wide):not(.is-style-dots)`
   (specificity 0,3,0). We need at least 0,3,1 to override.
   ========================================================= */
.entry-content hr.wp-block-separator:not(.is-style-dots),
.post-content-body hr.wp-block-separator:not(.is-style-dots) {
    border: 0;
    border-top: 1px solid var(--color-border);
    width: 100%;
    max-width: 100%;
    margin: 3rem auto;
    opacity: 1;
}

.entry-content hr.wp-block-separator.is-style-dots,
.post-content-body hr.wp-block-separator.is-style-dots {
    border: 0;
    background: none;
    text-align: center;
    line-height: 1;
    height: auto;
    margin: 3rem auto;
}

.entry-content hr.wp-block-separator.is-style-dots::before,
.post-content-body hr.wp-block-separator.is-style-dots::before {
    content: "···";
    font-size: 1.5rem;
    letter-spacing: 1rem;
    color: var(--color-text-muted);
}

/* =========================================================
   Block: Buttons (CTA)
   ========================================================= */
.wp-block-button {
    margin: 1rem 0;
}

.wp-block-buttons {
    margin: 2rem 0;
}

.wp-block-button__link.wp-element-button,
.wp-block-button__link {
    background-color: var(--color-header-bg);
    color: #ffffff;
    border-radius: 0;
    padding: 1rem 2.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    line-height: 1.2;
    transition: background-color 0.15s ease;
}

.wp-block-button__link.wp-element-button:hover,
.wp-block-button__link:hover {
    background-color: var(--color-accent);
    color: #ffffff;
}

.wp-block-button.is-style-outline .wp-block-button__link {
    background-color: transparent;
    color: var(--color-header-bg);
    border: 2px solid var(--color-header-bg);
}

.wp-block-button.is-style-outline .wp-block-button__link:hover {
    background-color: var(--color-header-bg);
    color: #ffffff;
}

/* =========================================================
   Block: Gallery
   Force grid layout based on .columns-N — core's is-layout-flex
   needs theme.json registration which this classic theme doesn't ship.
   ========================================================= */
.entry-content .wp-block-gallery,
.post-content-body .wp-block-gallery {
    margin: 2rem 0;
    padding: 0;
    list-style: none;
}

.entry-content .wp-block-gallery.has-nested-images:not(.eei-carousel),
.post-content-body .wp-block-gallery.has-nested-images:not(.eei-carousel) {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(var(--gallery-columns, 3), 1fr);
}

/* Galleries we leave as a grid (e.g. linkTo:custom navigation galleries
   like post 203's correlated collections) but where we want to disable
   WP core's `is-cropped` aspect-ratio squashing. Portrait images (book
   covers) need to stay un-cropped. */
.entry-content .wp-block-gallery.eei-no-crop figure.wp-block-image,
.post-content-body .wp-block-gallery.eei-no-crop figure.wp-block-image {
    aspect-ratio: auto;
    height: auto;
}
.entry-content .wp-block-gallery.eei-no-crop figure.wp-block-image img,
.post-content-body .wp-block-gallery.eei-no-crop figure.wp-block-image img {
    object-fit: contain;
    height: auto;
    width: 100%;
    aspect-ratio: auto;
}

/* =========================================================
   Block: Gallery — Squarespace-style carousel
   Activated by gallery-carousel.js on multi-image galleries.
   See assets/js/gallery-carousel.js for behaviour.
   ========================================================= */
.entry-content .wp-block-gallery.eei-carousel,
.post-content-body .wp-block-gallery.eei-carousel,
.entry-content .image-gallery-wrapper.eei-carousel,
.post-content-body .image-gallery-wrapper.eei-carousel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 100%;
    margin: 2rem 0;
    padding: 0;
}

.eei-carousel:focus-visible {
    outline: 2px solid var(--color-header-bg, #c00);
    outline-offset: 4px;
}

.eei-carousel__main {
    position: relative;
    background: var(--color-card-bg, #f5f5f5);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
}

.eei-carousel__main-img {
    max-width: 100%;
    max-height: 60vh;
    width: auto;
    height: auto;
    object-fit: contain; /* fixes portrait-book-cover cropping */
    cursor: zoom-in;
    transition: opacity 200ms ease;
    display: block;
}

.eei-carousel__main-img.is-swapping { opacity: 0.4; }

.eei-carousel__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.eei-carousel__nav--prev { left: 0.75rem; }
.eei-carousel__nav--next { right: 0.75rem; }
.eei-carousel__nav:hover { background: rgba(0, 0, 0, 0.8); }
.eei-carousel__nav:focus-visible {
    outline: 2px solid var(--color-header-bg, #c00);
    outline-offset: 2px;
}

.eei-carousel__thumbs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
}

.eei-carousel__thumb {
    flex: 0 0 auto;
    width: 80px;
    height: 80px;
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 0;
    background: var(--color-card-bg, #f5f5f5);
    cursor: pointer;
    transition: transform 150ms, border-color 150ms;
    overflow: hidden;
}

.eei-carousel__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* thumbs may crop — they're previews */
    display: block;
}

.eei-carousel__thumb.is-active {
    border-color: var(--color-header-bg, #c00);
    transform: scale(1.04);
}

.eei-carousel__thumb:focus-visible {
    outline: 2px solid var(--color-header-bg, #c00);
    outline-offset: 2px;
}

.eei-carousel__source { display: none !important; }

@media (max-width: 600px) {
    .eei-carousel__main-img { max-height: 50vh; }
    .eei-carousel__thumb    { width: 64px; height: 64px; }
    .eei-carousel__nav      { width: 36px; height: 36px; font-size: 1.4rem; }
}

.entry-content .wp-block-gallery.columns-2,
.post-content-body .wp-block-gallery.columns-2 { --gallery-columns: 2; }

.entry-content .wp-block-gallery.columns-3,
.post-content-body .wp-block-gallery.columns-3 { --gallery-columns: 3; }

.entry-content .wp-block-gallery.columns-4,
.post-content-body .wp-block-gallery.columns-4 { --gallery-columns: 4; }

.entry-content .wp-block-gallery.columns-5,
.post-content-body .wp-block-gallery.columns-5 { --gallery-columns: 5; }

.entry-content .wp-block-gallery.columns-6,
.post-content-body .wp-block-gallery.columns-6 { --gallery-columns: 6; }

/* Override WP block-library widths intended for flex layout — we use grid,
   so figure should size to its cell. The :not(#individual-image) selector
   matches WP core's specificity tier so this rule wins via source order. */
.entry-content .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image),
.post-content-body .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image) {
    width: auto;
}

.entry-content .wp-block-gallery .wp-block-image,
.post-content-body .wp-block-gallery .wp-block-image {
    margin: 0;
    overflow: hidden;
    border-radius: 6px;
    transition: transform 0.18s ease;
    aspect-ratio: 16 / 10;
}

.entry-content .wp-block-gallery .wp-block-image:hover,
.post-content-body .wp-block-gallery .wp-block-image:hover {
    transform: translateY(-2px);
}

.entry-content .wp-block-gallery .wp-block-image img,
.post-content-body .wp-block-gallery .wp-block-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 900px) {
    .entry-content .wp-block-gallery.has-nested-images,
    .post-content-body .wp-block-gallery.has-nested-images {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 540px) {
    .entry-content .wp-block-gallery.has-nested-images,
    .post-content-body .wp-block-gallery.has-nested-images {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   Lightbox (vanilla JS — see assets/js/lightbox.js)
   ========================================================= */
.eei-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.eei-lightbox.is-open {
    display: flex;
    animation: eei-lightbox-fade 0.18s ease;
}

@keyframes eei-lightbox-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.eei-lightbox__figure {
    margin: 0;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.eei-lightbox__img {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    background: #1a1a1a;
}

.eei-lightbox__caption {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    margin-top: 0.75rem;
    text-align: center;
    max-width: 80vw;
    line-height: 1.4;
}

.eei-lightbox__close,
.eei-lightbox__prev,
.eei-lightbox__next {
    position: absolute;
    background: rgba(0, 0, 0, 0.5);
    border: 0;
    color: #fff;
    cursor: pointer;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.15s ease, transform 0.15s ease;
    font-family: -apple-system, system-ui, sans-serif;
}

.eei-lightbox__close:hover,
.eei-lightbox__prev:hover,
.eei-lightbox__next:hover {
    background: rgba(0, 0, 0, 0.85);
    transform: scale(1.05);
}

.eei-lightbox__close {
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.75rem;
}

.eei-lightbox__prev,
.eei-lightbox__next {
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.25rem;
}

.eei-lightbox__prev:hover,
.eei-lightbox__next:hover {
    transform: translateY(-50%) scale(1.05);
}

.eei-lightbox__prev { left: 1.5rem; }
.eei-lightbox__next { right: 1.5rem; }

.eei-lightbox__counter {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.55);
    padding: 0.4rem 0.85rem;
    border-radius: 1rem;
    letter-spacing: 0.05em;
}

@media (max-width: 600px) {
    .eei-lightbox { padding: 1rem; }
    .eei-lightbox__close,
    .eei-lightbox__prev,
    .eei-lightbox__next {
        width: 2.5rem;
        height: 2.5rem;
    }
    .eei-lightbox__close {
        top: 0.75rem;
        right: 0.75rem;
        font-size: 1.4rem;
    }
    .eei-lightbox__prev { left: 0.5rem; font-size: 1.85rem; }
    .eei-lightbox__next { right: 0.5rem; font-size: 1.85rem; }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 900px) {
    .has-sidebar .content-sidebar-wrap {
        grid-template-columns: 1fr;
    }

    .widget-area { position: static; }
}

@media (max-width: 768px) {
    :root { --container-padding: 16px; }

    .site-header .container { flex-wrap: nowrap; }

    .menu-toggle { display: block; }

    .main-navigation {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0; right: 0;
        background: var(--color-header-bg);
        border-top: 1px solid rgba(255,255,255,0.1);
        padding: 12px 0;
    }

    .main-navigation.is-open { display: block; }

    .main-navigation ul {
        flex-direction: column;
        gap: 0;
        padding: 0 16px;
    }

    .main-navigation a { padding: 12px 4px; font-size: 0.9375rem; }

    .main-navigation .sub-menu {
        display: none;
        position: static;
        background: rgba(255,255,255,0.05);
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding: 4px 0 4px 16px;
        margin-top: 4px;
    }

    .main-navigation .menu-item-has-children.is-open > .sub-menu { display: flex; }

    .main-navigation .menu-item-has-children > a::after { float: right; }

    .post-item {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .post-thumbnail { max-height: 220px; }

    .post-navigation { grid-template-columns: 1fr; }
    .nav-next { text-align: left; }

    .site-footer .container { flex-direction: column; align-items: center; text-align: center; }
    .footer-links { justify-content: center; }
}

@media (max-width: 480px) {
    .hero-banner { min-height: 260px; }
    .feature-boxes { padding: 40px 0; }
    .site-main { padding: 32px 0 48px; }
    .post-item { padding: 24px 0; }
    .post-navigation { gap: 16px; }
}
