/*
Theme Name: matt mx
Theme URI: 
Author: M A T T
Author URI: https://matt.world
Description: A minimalist, glassmorphism-focused theme with enhanced visual fidelity and refined Retro-Futurist/Geocities capabilities.
Version: 1.0.4
License: CC BY-NC-ND 4.0
License URI: https://creativecommons.org/licenses/by-nc-nd/4.0/
Text Domain: matt-mx
Tags: blog, portfolio, dark-mode, glassmorphism, retro

[TABLE OF CONTENTS]
1.  Variables & Base Styles
2.  Layout & Container
3.  Header & Navigation
4.  Posts Grid & Cards
5.  Single Post & Hero
6.  Sidebar & Widgets
7.  Footer
8.  Theme Modes (Light / Geocities)
*/

/*
--------------------------------------------------------------
1. Variables & Base Styles
--------------------------------------------------------------
*/
:root {
    /* Colors - Obsidian Palette */
    --color-bg: #050505;
    /* Deepest Black */
    --color-bg-alt: #0a0a0a;
    /* Off Black for cards/header */
    --color-text: #eaeaea;
    --color-primary: #d00000;
    /* Blood Red */
    --color-accent: #ffd700;
    /* Gold */
    --color-glass: rgba(20, 20, 20, 0.8);
    --color-glass-border: rgba(255, 255, 255, 0.05);

    /* Typography */
    --font-heading: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
    --font-body: 'Open Sans', 'Segoe UI', sans-serif;

    /* Layout */
    --container-width: 1100px;
    --header-height: auto;
    --spacing-unit: 2rem;
}

/* Reset & Base */
* {
    box-sizing: border-box;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: 0.3s ease;
}

a:hover {
    color: var(--color-accent);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/*
--------------------------------------------------------------
2. Layout & Container
--------------------------------------------------------------
*/
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-unit);
}

/*
--------------------------------------------------------------
3. Header & Navigation
--------------------------------------------------------------
*/
.site-header {
    /* Glassmorphism Effect:
       We use a semi-transparent background combined with backdrop-filter.
       'blur' creates the frosted glass look.
       'saturate' boosts colors behind the glass for vibrancy. */
    background: rgba(5, 5, 5, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 0 0.5rem;

    /* Sticky Positioning:
       Keeps the header pinned to the viewport top as user scrolls. */
    position: sticky;
    top: 0;
    z-index: 100;

    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
}

.header-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    /* Reduced gap */
    position: relative;
    width: 100%;
}

.site-branding {
    text-align: center;
}



.site-title a {
    font-family: var(--font-heading);
    font-size: 2rem;
    /* Reduced size */
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 4px;
    font-weight: 700;
}

.site-title a:hover {
    color: var(--color-primary);
}

.custom-logo-link img {
    max-height: 80px;
}

/* Compact Header on Scroll */
.site-header.scrolled {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(5, 5, 5, 0.5);
    /* Slightly more opaque when scrolled */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
}

.site-header.scrolled .site-title a {
    font-size: 1.5rem;
    /* Shrink title */
}

.site-header.scrolled .custom-logo-link img {
    max-height: 50px;
    /* Shrink logo */
}

/* Transitions for smoothness */
.site-header,
.site-title a,
.custom-logo-link img,
.menu-toggle,
.menu-close {
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.site-header.scrolled .menu-toggle,
.site-header.scrolled .menu-close {
    top: 60%;
    /* Nudge down slightly when scrolled */
}

/* Navigation Bar Style */
/* Navigation Toggle */
.menu-toggle {
    background: rgba(5, 5, 5, 0.8);
    backdrop-filter: blur(5px);
    border: 1px solid var(--color-glass-border);
    color: var(--color-primary);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    padding: 0.8rem 1.2rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;

    /* Absolute Positioning within Content */
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 0;
    margin: 0;
    z-index: 101;
    border-radius: 4px;
}

.menu-toggle:hover {
    background: var(--color-glass);
    border-color: var(--color-primary);
    box-shadow: 0 0 10px rgba(208, 0, 0, 0.4);
    color: #fff;
}

.menu-icon {
    font-size: 1.2rem;
}

/* Overlay Navigation */
.overlay-navigation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(15px);
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.overlay-navigation.open {
    opacity: 1;
    visibility: visible;
}

.overlay-content {
    text-align: center;
    transform: translateY(20px);
    transition: transform 0.4s ease;
}

.overlay-navigation.open .overlay-content {
    transform: translateY(0);
}

.overlay-navigation ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    /* Reduced from 2rem to fit screen */
}

.overlay-navigation a {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 4px;
    position: relative;
    display: inline-block;
    transition: color 0.3s ease;
}

.overlay-navigation a:hover {
    color: var(--color-primary);
    text-shadow: 0 0 20px var(--color-primary);
}

/* Close Button (Styled to match Toggle) */
.menu-close {
    background: transparent;
    border: 1px solid var(--color-glass-border);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    padding: 0.8rem 1.2rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: none;
    /* Hidden by default */
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;

    /* Match menu-toggle absolute position */
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 0;
    margin: 0;
    z-index: 1002;
    /* Higher than overlay */
    border-radius: 4px;
}

.menu-close:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: 0 0 10px rgba(208, 0, 0, 0.4);
}

.menu-open .menu-toggle {
    display: none;
}

.menu-open .menu-close {
    display: flex;
}

/* Sub-menus in Overlay */
.overlay-navigation li {
    position: relative;
    width: max-content;
    /* Ensure width fits content */
}

.overlay-navigation ul ul {
    display: none;
    position: absolute;
    left: calc(100% + 20px);
    /* Push out slightly */
    top: 50%;
    transform: translateY(-50%);
    padding-left: 0;
    text-align: left;
    width: max-content;
}

.overlay-navigation li:hover>ul {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: fadeInRight 0.4s ease forwards;
}

.overlay-navigation ul ul a {
    font-size: 1rem;
    color: #666;
    letter-spacing: 2px;
    display: block;
}

.overlay-navigation ul ul a:hover {
    color: var(--color-accent);
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

/* Responsive Menu Scaling */
@media (max-width: 768px) {
    .overlay-navigation a {
        font-size: 1.3rem;
        /* Readable but smaller */
    }

    .overlay-navigation ul {
        gap: 1rem;
        /* Compact gap for tablets */
    }
}

@media (max-width: 480px) {
    .overlay-navigation a {
        font-size: 1.1rem;
        /* Compact for mobile */
        letter-spacing: 2px;
    }

    .overlay-navigation ul {
        gap: 0.8rem;
        /* Very tight spacing */
    }

    .overlay-content {
        width: 90%;
        /* Prevent edge touching */
        margin: 0 auto;
    }

    /* Ensure submenus stack vertically on mobile */
    .overlay-navigation ul ul {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        text-align: center;
        margin-top: 0.5rem;
    }

    /* Hide MENU text, show only icon */
    .menu-toggle .menu-text,
    .menu-close .menu-text {
        display: none;
    }

    .menu-toggle,
    .menu-close {
        padding: 0.8rem;
        /* Equal padding for square/circle look */
    }
}

/* Reading Progress - Red Line */
.reading-progress-container {
    width: 100%;
    height: 2px;
    background: transparent;
    position: absolute;
    bottom: 0;
    left: 0;
}

.reading-progress-bar {
    height: 100%;
    background: var(--color-primary);
    width: 0%;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px var(--color-primary), 0 0 5px var(--color-primary);
}

/*
--------------------------------------------------------------
4. Posts Grid & Cards
--------------------------------------------------------------
*/
.posts-grid {
    display: grid;
    /* Responsive Grid Logic:
       'auto-fill' creates as many columns as will fit.
       'minmax(300px, 1fr)' ensures no column is narrower than 300px,
       but they will expand (1fr) to fill available space.
       This creates a responsive layout without media queries. */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 3rem;
    padding: 4rem 0;
}

@media (min-width: 1024px) {
    .posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.post-card {
    background: var(--color-glass);
    border: 1px solid var(--color-glass-border);
    border-radius: 12px;
    /* Rounded corners */
    overflow: hidden;
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.post-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.post-thumbnail {
    position: relative;
    overflow: hidden;
    aspect-ratio: 3/2;
    /* Taller ratio to show more image */
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease, filter 0.4s ease;
    filter: grayscale(60%);
}

.post-card:hover .post-thumbnail img {
    transform: scale(1.05);
    filter: grayscale(0%);
}

.post-content {
    padding: 2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.post-title {
    margin-top: 0;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    line-height: 1.3;
    margin-bottom: 1rem;
}

.post-title a {
    color: var(--color-text);
}

.post-title a:hover {
    color: var(--color-primary);
}

.post-excerpt {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
    color: #aaa;
}

/*
--------------------------------------------------------------
5. Single Post & Hero
--------------------------------------------------------------
*/
.single-post-container {
    padding-bottom: 4rem;
    position: relative;
    z-index: 4;
    /* Negative Margin Overlap:
       Pulls the content container UP over the hero image area.
       This creates the "floating card" effect over the background. */
    margin-top: -15vh;
}

/* Hero Header for Singles */
/* Hero Header for Singles */
.hero-header {
    height: 90vh;
    /* Taller image */
    position: relative;
    display: flex;
    align-items: center;
    /* Center content vertically */
    justify-content: center;
    overflow: hidden;
    margin-bottom: 0;
    /* Removing margin to allow overlap */
}

/* Gradient Mask for Fade Out */
.hero-bg::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    /* Fade starts lower down */
    background: linear-gradient(to bottom, transparent 0%, var(--color-bg) 100%);
    z-index: 2;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.6);
    /* Slightly brighter base */
}

.hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
    max-width: 800px;
    padding: 0 1rem;
    margin-bottom: 5rem;
    /* Push content up a bit visually within hero */
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    color: #fff;
    margin: 0 0 1rem 0;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.8);
}


.hero-meta {
    font-size: 1rem;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Responsive Scaling for Titles */
@media (max-width: 768px) {

    .entry-title,
    .hero-title,
    .page-title {
        font-size: 2rem !important;
        margin-bottom: 0.5rem;
    }
}

/* Standard Content Styles */
.entry-content {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.15rem;
    color: #ddd;
}

.entry-content p {
    margin-bottom: 1.8rem;
}

.entry-content img {
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    /* Subtle shadow for depth */
}

.entry-content h2,
.entry-content h3 {
    color: var(--color-text);
    font-family: var(--font-heading);
    margin-top: 3rem;
}

/*
--------------------------------------------------------------
6. Sidebar & Widgets
--------------------------------------------------------------
*/
.widget-area {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-glass-border);
}

@media (min-width: 1024px) {
    .single-post-container.has-sidebar {
        display: grid;
        grid-template-columns: 1fr 300px;
        gap: 4rem;
        max-width: var(--container-width);
        margin: 0 auto;
    }

    .single-post-container.has-sidebar .entry-content {
        max-width: none;
        margin: 0;
    }

    .widget-area {
        margin-top: 0;
        padding-top: 0;
        border-top: none;
        position: sticky;
        top: 150px;
    }
}

.widget {
    margin-bottom: 3rem;
}

.widget-title {
    font-family: var(--font-heading);
    color: var(--color-primary);
    border-left: 3px solid var(--color-accent);
    padding-left: 1rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/*
--------------------------------------------------------------
7. Footer
--------------------------------------------------------------
*/
.site-footer {
    background: #000;
    padding: 4rem 0;
    margin-top: 5rem;
    border-top: 1px solid var(--color-glass-border);
    text-align: center;
    font-size: 0.9rem;
    color: #666;
}

/* Retro Browser Buttons (Hidden by default) */
.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

.retro-button-left,
.retro-button-right {
    display: none;
}

.retro-button-left img,
.retro-button-right img {
    image-rendering: pixelated;
    border: 2px outset #c0c0c0;
}

/* Show in Geocities Mode */
body.geocities-mode .footer-content {
    justify-content: space-between;
}

body.geocities-mode .retro-button-left,
body.geocities-mode .retro-button-right {
    display: block;
}

/* Post Formats / Date */
.format-indicator {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: var(--color-accent);
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: normal;
    z-index: 10;
    border: 1px solid var(--color-accent);
}

/* Gallery Column Support */
.gallery,
.wp-block-gallery {
    display: grid;
    grid-gap: 1.5rem;
    margin-bottom: 2rem;
}

.gallery-columns-1 {
    grid-template-columns: 1fr;
}

.gallery-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.gallery-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.gallery-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.gallery-columns-5 {
    grid-template-columns: repeat(5, 1fr);
}

.gallery-columns-6 {
    grid-template-columns: repeat(6, 1fr);
}

.gallery-columns-7 {
    grid-template-columns: repeat(7, 1fr);
}

.gallery-columns-8 {
    grid-template-columns: repeat(8, 1fr);
}

.gallery-columns-9 {
    grid-template-columns: repeat(9, 1fr);
}

.gallery-item {
    margin: 0 !important;
    /* Override default WP margins */
    width: 100% !important;
    /* Override default WP width */
}

/* Make sure images fill the grid cells */
.gallery-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

/* Lightbox Styles */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-img-container {
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--color-glass-border);
    border-radius: 4px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    object-fit: contain;
}

.lightbox-overlay.active .lightbox-image {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: transparent;
    border: none;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 3rem;
    cursor: pointer;
    line-height: 1;
    z-index: 10001;
    transition: color 0.3s ease;
    padding: 0;
}

.lightbox-close:hover {
    color: var(--color-primary);
    text-shadow: 0 0 10px var(--color-primary);
}

/* Theme Toggle Button */
.theme-toggle {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(calc(-50% + 60px));
    /* Explicitly stacked below close button */
    background: transparent;
    border: 1px solid var(--color-glass-border);
    color: var(--color-text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    z-index: 10001;
    /* Above overlay */

    /* Initially Hidden */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Show when menu is open */
body.menu-open .theme-toggle {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.theme-toggle:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: 0 0 10px rgba(208, 0, 0, 0.3);
}

.theme-toggle .moon {
    display: none;
}

.theme-toggle .sun {
    display: block;
}

.theme-toggle .floppy {
    display: none;
}

/* Show Moon in Light Mode (to switch back to dark) */
body.light-mode .theme-toggle .sun {
    display: none;
}

body.light-mode .theme-toggle .moon {
    display: block;
}

body.light-mode .theme-toggle .floppy {
    display: none;
}

/* Show Floppy in Geocities Mode */
body.geocities-mode .theme-toggle .sun {
    display: none;
}

body.geocities-mode .theme-toggle .moon {
    display: none;
}

body.geocities-mode .theme-toggle .floppy {
    display: block;
}

/* Mobile Adjustment for Toggle */
@media (max-width: 768px) {
    .theme-toggle {
        position: fixed;
        /* Fix in place */
        top: 85px !important;
        /* Stacked BELOW the menu button (20px + 35px height + 30px gap) */
        right: 1rem !important;
        /* Aligned with menu button */
        transform: none;
        /* Remove centering transform */
        width: 35px;
        height: 35px;
        font-size: 1rem;
        z-index: 10002;
        /* Ensure on top */
    }

    .menu-close,
    .menu-toggle {
        position: fixed;
        /* Fix in place */
        top: 20px !important;
        right: 1rem !important;
        transform: none;
        z-index: 10003;
    }
}

/* Fix for Button Scrolling (Remove Containing Block) */
body.menu-open .site-header,
body.menu-open .site-header.scrolled {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transform: none !important;
    filter: none !important;
    perspective: none !important;
}

/* CHANGE: Lock Body Scroll when Menu is Open */
body.menu-open {
    overflow: hidden !important;
    height: 100vh;
    /* Force lock */
    touch-action: none;
    /* Disable touch scroll on body */
}

/* Related Content Section */
.related-content-section {
    margin-top: 4rem;
    margin-bottom: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-glass-border);
}

.related-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.related-grid {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding-bottom: 20px;
    padding-top: 10px;
    /* Space for hover lift */
    /* Space for scrollbar */
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling iOS */

    /* Hide scrollbar for cleaner look if desired, or style it. 
       Let's keep it visible but slim */
    scrollbar-width: thin;
    scrollbar-color: var(--color-primary) transparent;
}

/* Carousel Layout */
.related-carousel-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.carousel-nav {
    background: rgba(5, 5, 5, 0.8);
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
    flex-shrink: 0;
    line-height: 1;
    font-family: var(--font-heading);
    padding-bottom: 5px;
    /* Visual center adjustment */
}

.carousel-nav:hover {
    background: var(--color-primary);
    color: #000;
    box-shadow: 0 0 15px var(--color-primary);
}

/* Geocities Carousel Buttons (Desktop) */
body.geocities-mode .carousel-nav {
    background: #00FF00 !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
}

body.geocities-mode .carousel-nav:hover {
    background: #00CC00 !important;
    box-shadow: 0 0 10px #00FF00 !important;
}

.related-grid::-webkit-scrollbar {
    height: 6px;
}

.related-grid::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 3px;
}

.related-grid::-webkit-scrollbar-track {
    background: transparent;
}

.related-card {
    display: flex;
    flex-direction: column;
    background: var(--color-glass);
    border: 1px solid var(--color-glass-border);
    border-radius: 15px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;

    /* Fixed width and height for scrolling consistency */
    flex: 0 0 300px;
    min-width: 300px;
    height: 350px;
    /* Force consistent height */
    scroll-snap-align: start;
}

.related-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    border-color: var(--color-primary);
}

.related-thumbnail {
    height: 180px;
    overflow: hidden;
    flex-shrink: 0;
}

.related-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease, filter 0.5s ease;
}

.related-card:hover .related-thumbnail img {
    transform: scale(1.1);
    filter: grayscale(0%);
}

.related-card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
    /* Hide excess text */
}

.related-card-title {
    padding: 0;
    margin: 0 0 0.8rem 0;
    font-size: 1.2rem;
    color: var(--color-text);
    font-family: var(--font-heading);
    line-height: 1.3;
    /* Limit title lines if needed, but usually fine */
}

.related-card-excerpt {
    font-size: 0.9rem;
    color: #aaa;
    line-height: 1.5;
}

/* Responsive Related Content */
@media (max-width: 768px) {
    .related-carousel-wrapper {
        gap: 0;
        position: relative;
        /* Ensure containment */
    }

    .carousel-nav {
        display: flex !important;
        /* Restore buttons */
        position: absolute;
        z-index: 10;
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
        background: rgba(0, 0, 0, 0.6) !important;
        /* Semi-transparent */
        backdrop-filter: blur(5px);
    }

    .carousel-nav.prev {
        left: 0;
    }

    .carousel-nav.next {
        right: 0;
    }

    /* Move arrows up in Geocities mode to avoid covering text */
    body.geocities-mode .carousel-nav {
        top: 30% !important;
        transform: translateY(-50%);
        background: #00FF00 !important;
        /* Neon Green */
        color: #000000 !important;
        /* Black arrows */
        border: 2px solid #000000 !important;
        /* Black border */
        opacity: 1;
    }

    .related-grid {
        gap: 15px;
        padding-left: 20px;
        /* Peek spacing */
        padding-right: 20px;
    }

    .related-card {
        flex: 0 0 70vw;
        /* Reduced from 85vw to show more context */
        min-width: 70vw;
        height: auto;
        /* Allow auto height based on content */
        aspect-ratio: 0.75;
        /* Slightly shorter */
    }
}

/* Light Mode Overrides */
body.light-mode .related-card {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

body.light-mode .related-thumbnail img {
    filter: grayscale(40%);
}

body.light-mode .related-card-excerpt {
    color: #666;
}

body.light-mode .carousel-nav {
    background: #ffffff !important;
    border: 1px solid #cccccc !important;
    color: #333333 !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* High Specificity Light Mode Override */
body.light-mode section.related-content-section .related-carousel-wrapper button.carousel-nav {
    background-color: #ffffff !important;
    border: 1px solid var(--color-primary) !important;
    /* Red Border */
    color: var(--color-primary) !important;
    /* Red Arrow */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}

body.light-mode section.related-content-section .related-carousel-wrapper button.carousel-nav:hover {
    background-color: var(--color-primary) !important;
    color: #ffffff !important;
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 15px var(--color-primary) !important;
    /* GLOW */
}

body.light-mode .carousel-nav:hover {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/*
--------------------------------------------------------------
8. Theme Modes (Light / Geocities)
--------------------------------------------------------------
*/

/* --- LIGHT MODE OVERRIDES --- */
/* 
 * Light Mode Strategy:
 * Instead of rewriting every rule, we simply redefine the CSS Variables
 * (Custom Properties) within the body.light-mode scope.
 * The rest of the CSS automatically inherits these new color values.
 */
body.light-mode {
    --color-bg: #f9f9f9;
    --color-bg-alt: #ffffff;
    --color-text: #333333;
    --color-glass: rgba(255, 255, 255, 0.9);
    --color-glass-border: rgba(0, 0, 0, 0.1);
    color: #333;
}

body.light-mode .site-title a {
    color: #222;
}

body.light-mode .site-header {
    background: rgba(255, 255, 255, 0.3);
    border-bottom: 1px solid rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
}

body.light-mode .site-header.scrolled {
    background: rgba(255, 255, 255, 0.5);
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

body.light-mode .post-card {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    background: #fff;
}

body.light-mode .post-title a {
    color: #111;
    font-weight: 600;
}

body.light-mode .post-excerpt {
    color: #444;
}

body.light-mode .post-thumbnail img {
    filter: grayscale(40%) saturate(1.0);
}

body.light-mode .post-card:hover .post-thumbnail img {
    filter: grayscale(0%) saturate(1.0);
}

body.light-mode .menu-toggle {
    background: rgba(255, 255, 255, 0.8);
    color: #333;
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .menu-toggle:hover {
    background: #ffffff;
    color: var(--color-primary);
}

body.light-mode .menu-close {
    color: #333;
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .menu-close:hover {
    background: #ffffff;
    color: var(--color-primary);
}

body.light-mode .overlay-navigation {
    background: rgba(240, 240, 240, 0.95);
}

body.light-mode .overlay-navigation a {
    color: #555;
}

body.light-mode .overlay-navigation a:hover {
    color: var(--color-primary);
}

body.light-mode .entry-content {
    color: #333;
}

body.light-mode .site-footer {
    background: #eee;
    color: #666;
    border-top-color: #ddd;
}

/* Dynamic Title Switching */
.title-geocities {
    display: none;
}

body.geocities-mode .title-standard {
    display: none;
}

body.geocities-mode .title-geocities {
    display: inline;
}

/* GEOCITIES MODE (Refactored) */
/*
 * Geocities Mode Strategy:
 * 1. Brutalism: We explicitly set fonts to 'Courier New' and colors to high-contrast neon.
 * 2. Overrides: We use !important heavily here to strictly enforce the retro look
 *    over any modern styles defined elsewhere.
 * 3. Aesthetics: Boxy borders, no rounding, scrollbars, and marquee-like animations.
 */
body.geocities-mode {
    --color-bg: #050510;
    --color-bg-alt: #111122;
    --color-text: #FFFF00;
    --color-primary: #00FF00;
    --color-accent: #FF00FF;
    --color-glass: #1a1a1a;
    --color-glass-border: #00FF00;
    background-color: #020205;
    background-image: none;
    font-family: "Courier New", Courier, monospace;
    /* Emoji-Style UFO with Yellow Beam + Arrow Pointer (64px) */
    cursor: url("data:image/svg+xml,%3Csvg width='64' height='64' viewBox='0 0 64 64' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3ClinearGradient id='beam' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0%25' stop-color='%23FFFF00' stop-opacity='0.6'/%3E%3Cstop offset='100%25' stop-color='%23FFFF00' stop-opacity='0.1'/%3E%3C/linearGradient%3E%3C/defs%3E%3C!-- Arrow Pointer --%3E%3Cpolygon points='0,0 0,14 4,10 7,16 10,14 7,8 12,8' fill='%23FFFFFF' stroke='%23000000' stroke-width='1'/%3E%3C!-- Beam --%3E%3Cpolygon points='20,28 44,28 56,60 8,60' fill='url(%23beam)' stroke='none'/%3E%3C!-- Dome --%3E%3Cpath d='M18 24 Q32 4 46 24' fill='%2355AAFF' stroke='%23000' stroke-width='1.5'/%3E%3C!-- Disc --%3E%3Cellipse cx='32' cy='26' rx='18' ry='6' fill='%23E0E0E0' stroke='%23000' stroke-width='1.5'/%3E%3C!-- Lights --%3E%3Ccircle cx='22' cy='26' r='2' fill='%23FF0000' stroke='none'/%3E%3Ccircle cx='32' cy='28' r='2' fill='%2300FF00' stroke='none'/%3E%3Ccircle cx='42' cy='26' r='2' fill='%23FFFF00' stroke='none'/%3E%3C/svg%3E") 0 0, auto;
    color: #FFFF00 !important;

    /* Firefox Scrollbar Support */
    scrollbar-width: thin;
    scrollbar-color: #00FF00 #000000;

    /* Prevent Zoom-Out on Mobile */
    overflow-x: hidden;
    max-width: 100vw;
}

/* Force Full-Width Container on Mobile in Geocities */
@media (max-width: 768px) {

    body.geocities-mode .container,
    body.geocities-mode .site-content {
        max-width: 100% !important;
        width: 100% !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
}

body.geocities-mode p,
body.geocities-mode h3,
body.geocities-mode h4,
body.geocities-mode h5,
body.geocities-mode h6,
body.geocities-mode li,
body.geocities-mode span:not(.retro-letter) {
    color: #FFFF00 !important;
}

body.geocities-mode .post-title,
body.geocities-mode .post-title a,
body.geocities-mode .hero-title,
body.geocities-mode .page-title,
body.geocities-mode .widget-title,
body.geocities-mode .related-card-title {
    color: #00FF00 !important;
}

body.geocities-mode::-webkit-scrollbar {
    width: 12px;
}

body.geocities-mode::-webkit-scrollbar-track {
    background: #000;
    border-left: 1px solid #333;
}

body.geocities-mode::-webkit-scrollbar-thumb {
    background-color: #00FF00;
    border: 1px solid #000;
}

body.geocities-mode a {
    color: #00FFFF !important;
    text-decoration: underline;
    border-bottom: none !important;
}

body.geocities-mode a:visited {
    color: #00FFFF !important;
    border-bottom: none !important;
}

body.geocities-mode a:hover {
    color: #000 !important;
    background-color: #00FFFF;
    text-decoration: none;
    cursor: pointer;
    border-bottom: none !important;
}

body.geocities-mode hr {
    height: 2px;
    border: none;
    background: linear-gradient(90deg, transparent, #00FF00, transparent);
    margin: 2rem 0;
}

body.geocities-mode .overlay-navigation {
    background: #000033 !important;
    border: 4px double #00FF00;
    padding-top: 0;
    padding-bottom: 0;
    /* Prevent menu from being cut off */
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center vertically like standard mode */
    /* Ensure padding dictates start position */
    align-items: center;
    gap: 1rem;
    /* Reduced from 15px to fit screen */
    /* Tighter spacing */

    /* Scrollable Layout */
    overflow-y: auto;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
    max-height: 100vh;
    width: 100vw;
    /* Force viewport width */
    box-sizing: border-box;
    /* Include padding in height */

    /* Custom Scrollbar for Menu */
    scrollbar-width: thin;
    scrollbar-color: #00FF00 #000000;
}

body.geocities-mode .overlay-navigation::-webkit-scrollbar {
    width: 8px;
}

body.geocities-mode .overlay-navigation::-webkit-scrollbar-track {
    background: #000;
}

body.geocities-mode .overlay-navigation::-webkit-scrollbar-thumb {
    background-color: #00FF00;
    border: 1px solid #000;
}

body.geocities-mode .overlay-navigation a {
    font-family: "Courier New", Courier, monospace !important;
    color: #FFFF00 !important;
    text-shadow: 2px 2px #FF0000, -2px -2px #0000FF;
    /* Scaled down shadow */
    font-size: 1.5rem;
    /* Smaller font to fit screen */
    font-weight: bold;
    text-decoration: none;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-block;
}

/* Responsive Scaling for Geocities Menu */
@media (max-width: 768px) {
    body.geocities-mode .overlay-navigation a {
        font-size: 1.3rem !important;
    }
}

@media (max-width: 480px) {
    body.geocities-mode .overlay-navigation a {
        font-size: 1.1rem !important;
    }
}

body.geocities-mode .overlay-navigation a:hover {
    color: #FFFFFF !important;
    /* White for readability */
    transform: scale(1.2) rotate(5deg);
    text-shadow: 3px 3px 0px #000000, -1px -1px 0px #00FF00;
    /* Black outline + green glow */
}

body.geocities-mode .menu-close {
    background: #FF00FF !important;
    border: 4px ridge #ffffff !important;
    color: #000000 !important;
    font-weight: bold;
}

body.geocities-mode .site-header {
    background: #000000 !important;
    border-bottom: 4px ridge #c0c0c0 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    position: sticky !important;
    top: 0 !important;
}

body.geocities-mode .header-inner {
    position: relative;
    z-index: 2;
}

body.geocities-mode .reading-progress-container {
    bottom: 0px !important;
    height: 3px !important;
}

body.geocities-mode .reading-progress-bar {
    background-color: #00FF00 !important;
    box-shadow: 0 0 10px #00FF00, 0 0 5px #00FF00;
}

@keyframes retro-header-pulse {

    0%,
    100% {
        background-color: #000080;
    }

    25% {
        background-color: #800080;
    }

    50% {
        background-color: #008080;
    }

    75% {
        background-color: #800000;
    }
}

body.geocities-mode .site-title a {
    font-family: "Courier New", Courier, monospace;
    color: #000000 !important;
    text-shadow: 1px 1px #FFFFFF;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 3px;
    display: inline-block;
}

body.geocities-mode .site-title .retro-letter {
    display: inline-block;
    animation: retro-letter-jiggle 0.4s infinite, retro-letter-colors 2s infinite;
}

@keyframes retro-letter-jiggle {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(-1.5px, 1.5px) rotate(-3deg);
    }

    50% {
        transform: translate(1.5px, -1.5px) rotate(3deg);
    }

    75% {
        transform: translate(-1.5px, -1.5px) rotate(-1.5deg);
    }
}

/* Theme Toggle Icons */
#theme-toggle::before {
    content: "☀";
    /* Dark Mode (shows Sun) */
}

body.light-mode #theme-toggle::before {
    content: "💾";
    /* Light Mode (shows Floppy) */
}

body.geocities-mode #theme-toggle::before {
    content: "☾";
    /* Geocities Mode (shows Moon) */
}

@keyframes retro-letter-colors {
    0% {
        color: #FFFF00;
        text-shadow: 1px 1px #FF0000;
    }

    20% {
        color: #00FF00;
        text-shadow: 1px 1px #0000FF;
    }

    40% {
        color: #00FFFF;
        text-shadow: 1px 1px #FF00FF;
    }

    60% {
        color: #FF00FF;
        text-shadow: 1px 1px #00FF00;
    }

    80% {
        color: #FF0000;
        text-shadow: 1px 1px #00FFFF;
    }

    100% {
        color: #FFFF00;
        text-shadow: 1px 1px #FF0000;
    }
}

body.geocities-mode .posts-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 2rem !important;
}

@media (max-width: 768px) {
    body.geocities-mode .posts-grid {
        grid-template-columns: 1fr !important;
    }
}

body.geocities-mode .post-card {
    background: rgba(0, 0, 0, 0.8) !important;
    border: 2px solid #00FF00;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
    border-radius: 0;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: 0 !important;
}

body.geocities-mode .post-content {
    padding: 20px !important;
}

body.geocities-mode .post-thumbnail {
    aspect-ratio: 16/9 !important;
    border-bottom: 2px solid #00FF00;
}

body.geocities-mode .related-card,
body.geocities-mode .widget {
    padding: 20px;
    border-radius: 0;
    margin-bottom: 30px;
}

body.geocities-mode .post-card:active {
    border-style: solid;
}

body.geocities-mode .post-title a,
body.geocities-mode .related-card-title {
    font-family: "Courier New", monospace;
    color: #00FF00;
    font-weight: bold;
    text-decoration: none;
}

body.geocities-mode .entry-content,
body.geocities-mode .post-excerpt,
body.geocities-mode .related-card-excerpt {
    color: #E0E0E0 !important;
    font-family: "Courier New", monospace;
}

body.geocities-mode .menu-toggle,
body.geocities-mode .menu-close,
body.geocities-mode .carousel-nav {
    background: #000000;
    color: #00FF00;
    border: 1px solid #00FF00;
    border-radius: 0;
    font-family: "Courier New", monospace;
}

body.geocities-mode .menu-toggle:active,
body.geocities-mode .carousel-nav:active {
    background: #00FF00;
    color: #000000;
}

body.geocities-mode .site-footer {
    background: #000000;
    color: #00FF00;
    border-top: 1px solid #00FF00;
    text-align: center;
    font-family: "Courier New", monospace;
}

body.geocities-mode img {
    border: 1px solid #333;
    border-radius: 0 !important;
}

body.geocities-mode .related-content-section {
    border-top: 2px solid #00FF00;
    background: transparent;
    padding: 20px;
    margin-top: 40px;
}

body.geocities-mode .related-title {
    font-family: "Courier New", monospace;
    color: #FFFFFF !important;
    text-align: left;
    text-decoration: none;
    text-shadow: none;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

body.geocities-mode .hero-bg::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 40%, #000000 100%);
    display: block;
}

body.geocities-mode .hero-content {
    z-index: 2;
}

body.geocities-mode .related-card {
    background: #c0c0c0;
    border: 4px outset #ffffff !important;
    box-shadow: 2px 2px 5px #000;
    border-radius: 0;
    padding: 10px;
    display: flex;
    flex-direction: column;
    height: 350px !important;
    transition: all 0.1s;
    text-decoration: none !important;
}

body.geocities-mode .related-card:active {
    border-style: inset !important;
}

body.geocities-mode .related-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #000;
}

body.geocities-mode .related-thumbnail img {
    border: 2px solid #000;
    filter: grayscale(80%);
}

body.geocities-mode .related-card-excerpt {
    font-family: "Courier New", monospace;
    font-size: 12px;
    color: #000000 !important;
    line-height: 1.4;
    mask-image: linear-gradient(180deg, #000 70%, transparent);
    -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent);
}

body.geocities-mode .related-card-title {
    background: transparent;
    color: #0000EE !important;
    font-family: "Courier New", monospace;
    font-size: 20px;
    font-weight: bold;
    padding: 10px 0;
    margin-bottom: 5px;
    text-decoration: underline;
    white-space: normal;
    display: block;
    line-height: 1.2;
}

body.geocities-mode .related-card-title::after {
    content: none;
}

body.geocities-mode .related-card-content {
    padding: 0;
    color: #000000 !important;
}

body.geocities-mode .carousel-nav {
    background: #c0c0c0;
    border: 2px solid #000;
    color: #000000 !important;
    border-radius: 0;
    font-family: "Courier New", monospace;
    font-weight: bold;
    box-shadow: 2px 2px 0 #000;
}

body.geocities-mode .carousel-nav:active {
    box-shadow: inset 2px 2px 0 #000;
    transform: translate(2px, 2px);
}

/* Geocities Mode Image Filters (SVG-based) */
body.geocities-mode .post-thumbnail img,
body.geocities-mode .entry-content img,
body.geocities-mode .related-thumbnail img,
body.geocities-mode .widget img,
body.geocities-mode .gallery img {
    filter: url(#retro-posterize) brightness(0.95);
    transition: filter 0.3s ease;
}

body.geocities-mode .post-card:hover .post-thumbnail img,
body.geocities-mode .entry-content img:hover,
body.geocities-mode .related-card:hover .related-thumbnail img,
body.geocities-mode .gallery img:hover {
    filter: none;
}