/*
Theme Name: Dessert First
Theme URI: https://lifesuncertain.com
Author: Sean Kelley
Author URI: https://seankelleys.com
Description: An accessibility-first WordPress theme for Life's Uncertain blog. Features include theme switching (dim/dark/light/high-contrast), adjustable text size, reading guide and mask, reduced motion support, strong focus indicators, and full keyboard/screen reader compatibility. Built with assistive technology users in mind.
Version: 1.2.0
Requires at least: 6.0
Tested up to: 6.4
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: dessert-first
Tags: accessibility-ready, blog, one-column, two-columns, custom-colors, custom-menu, featured-images, full-width-template, sticky-post, threaded-comments, translation-ready
*/

/* ===========================================================
   DESSERT FIRST - Accessibility-First WordPress Theme
   
   Accessibility Features:
   - Skip link for keyboard navigation
   - ARIA landmarks and semantic HTML
   - Theme switching (dim/dark/light/high-contrast)
   - Adjustable text size (16-28px)
   - Font options (system/easier-to-read/mono)
   - Spacing options (normal/relaxed)
   - Link underline toggle
   - Strong focus indicators
   - Reduced motion support
   - Reading guide (follows pointer/focus)
   - Reading mask (dims surrounding content)
   - Windows High Contrast Mode support
   - 200-400% zoom reflow support
   =========================================================== */

/* ===== CSS Custom Properties (Theme Variables) ===== */
:root {
    /* Life's Uncertain Brand Colors */
    --lu-dark-blue: #2D3448;
    --lu-mid-blue: #47506B;
    --lu-light-blue: #7C86A1;
    --lu-pale-blue: #D7DBE5;
    --lu-gold: #FFD800;
    --lu-gold-hover: #e6c200;
    --lu-off-white: #EEEEEE;
    --lu-white: #ffffff;
    
    /* Reading aids */
    --reading-mask-darkness: 0.55;
    --reading-mask-band: 2.4rem;
    --reading-guide: 0;
    --reading-mask: 0;
    --a11y-track-y: 50vh;
    --mask-height: 100vh;
    --chrome-top: 0px;
    
    /* Theme defaults (Life's Uncertain branded) */
    --bg: var(--lu-off-white);
    --panel: var(--lu-white);
    --header-bg: var(--lu-dark-blue);
    --text: #333333;
    --text-light: var(--lu-mid-blue);
    --muted: var(--lu-light-blue);
    --border: var(--lu-pale-blue);
    --accent: var(--lu-gold);
    --accent-hover: var(--lu-gold-hover);
    --accent-text: var(--lu-dark-blue);
    
    /* Focus styles */
    --focus: var(--lu-gold);
    --focus-ring: 3px solid var(--focus);
    --focus-offset: 3px;
    
    /* Links */
    --link: var(--lu-dark-blue);
    --link-hover: var(--lu-mid-blue);
    --visited: #5a4080;
    --link-underline: none;
    
    /* Buttons */
    --btn-bg: var(--lu-dark-blue);
    --btn-hover: var(--lu-mid-blue);
    --btn-text: var(--lu-off-white);
    
    /* Layout */
    --radius: 4px;
    --max-width: 1400px;
    --sidebar-width: 280px;
    --shadow: 0 2px 4px rgba(0,0,0,0.05);
    
    /* Typography */
    --base-font: 18px;
    --line: 1.6;
    --para-gap: 0.9rem;
    --space-mult: 1;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --heading-font: "Times New Roman", Times, serif;
    --tagline-font: "Segoe Script", "Snell Roundhand", "Brush Script MT", cursive;
}

/* ===== THEME VARIANTS ===== */

/* Dim Theme (Low Glare - Good for light sensitivity) */
html[data-theme="dim"] {
    --bg: #1a1d24;
    --panel: #22262f;
    --header-bg: #141720;
    --text: #e9eef2;
    --text-light: #b7c3cc;
    --muted: #8a96a3;
    --border: #3a4150;
    --accent: var(--lu-gold);
    --accent-text: #1a1d24;
    --link: var(--lu-gold);
    --link-hover: #ffe44d;
    --visited: #c7a6ff;
    --focus: var(--lu-gold);
    --btn-bg: #2d3340;
    --btn-hover: #3a4150;
    --btn-text: #e9eef2;
    --shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Dark Theme */
html[data-theme="dark"] {
    --bg: #0a0c10;
    --panel: #12151c;
    --header-bg: #070a0d;
    --text: #f0f6fb;
    --text-light: #c4d0d9;
    --muted: #8a96a3;
    --border: #2a3040;
    --accent: var(--lu-gold);
    --accent-text: #0a0c10;
    --link: var(--lu-gold);
    --link-hover: #ffe44d;
    --visited: #d3b5ff;
    --focus: var(--lu-gold);
    --btn-bg: #1a1f28;
    --btn-hover: #252c38;
    --btn-text: #f0f6fb;
    --shadow: 0 4px 15px rgba(0,0,0,0.5);
}

/* Light Theme (Original Life's Uncertain) */
html[data-theme="light"] {
    --bg: var(--lu-off-white);
    --panel: var(--lu-white);
    --header-bg: var(--lu-dark-blue);
    --text: #333333;
    --text-light: var(--lu-mid-blue);
    --muted: var(--lu-light-blue);
    --border: var(--lu-pale-blue);
    --accent: var(--lu-gold);
    --accent-text: var(--lu-dark-blue);
    --link: var(--lu-dark-blue);
    --link-hover: var(--lu-mid-blue);
    --visited: #5a4080;
    --focus: var(--lu-gold);
    --btn-bg: var(--lu-dark-blue);
    --btn-hover: var(--lu-mid-blue);
    --btn-text: var(--lu-off-white);
    --shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* High Contrast Theme */
html[data-theme="hc"] {
    --bg: #000000;
    --panel: #000000;
    --header-bg: #000000;
    --text: #ffffff;
    --text-light: #ffffff;
    --muted: #ffffff;
    --border: #ffffff;
    --accent: #ffff00;
    --accent-text: #000000;
    --link: #00ffff;
    --link-hover: #ffffff;
    --visited: #ff00ff;
    --focus: #ffff00;
    --btn-bg: #000000;
    --btn-hover: #333333;
    --btn-text: #ffffff;
    --shadow: none;
    --link-underline: underline;
}

/* ===== FONT VARIANTS ===== */
html[data-font="system"] { 
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; 
}
html[data-font="dyslexic"] { 
    --font-family: ui-rounded, "Trebuchet MS", Verdana, Arial, sans-serif; 
}
html[data-font="mono"] { 
    --font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; 
}

/* ===== SPACING VARIANTS ===== */
html[data-spacing="relaxed"] {
    --line: 1.85;
    --para-gap: 1.1rem;
    --space-mult: 1.15;
}

/* ===== LINK UNDERLINE TOGGLE ===== */
html[data-links="underline"] { 
    --link-underline: underline; 
}

/* ===== FOCUS STRENGTH TOGGLE ===== */
html[data-focus="strong"] {
    --focus-ring: 4px solid var(--focus);
    --focus-offset: 4px;
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

html[data-motion="reduce"] *,
html[data-motion="reduce"] *::before,
html[data-motion="reduce"] *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}

/* ===== BASE STYLES ===== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    font-size: var(--base-font);
    line-height: var(--line);
    background-color: var(--bg);
    color: var(--text);
    letter-spacing: calc(0.01em * var(--space-mult));
    min-height: 100vh;
}

/* ===== SKIP LINK (Accessibility Essential) ===== */
.skip-link {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateY(-120%);
    background: var(--panel);
    color: var(--text);
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    z-index: 99999;
    font-weight: 600;
    text-decoration: none;
}

.skip-link:focus {
    transform: translateY(0.5rem);
    outline: var(--focus-ring);
    outline-offset: var(--focus-offset);
}

/* ===== FOCUS STYLES ===== */
:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-offset);
    border-radius: var(--radius);
}

/* Remove default outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* ===== LINKS ===== */
a {
    color: var(--link);
    text-decoration: var(--link-underline);
    text-underline-offset: 0.18em;
    transition: color 0.2s ease;
}

a:visited {
    color: var(--visited);
}

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

/* ===== HEADER ===== */
.site-header {
    background-color: var(--header-bg);
    padding: 10px 20px;  /* Reduced vertical padding */
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.site-title {
    margin: 0;
    font-family: var(--heading-font);
    font-weight: 400;
    color: var(--lu-off-white);
    letter-spacing: 0.2px;
    font-size: clamp(1.25rem, 2.2vw + 0.5rem, 2rem);
}

.site-title a {
    color: inherit;
    text-decoration: none;
}

.site-title a:hover {
    color: var(--lu-gold);
}

.tagline {
    margin: 0;
    font-family: var(--tagline-font);
    font-weight: 400;
    color: var(--lu-gold);
    font-size: clamp(1rem, 1.1vw + 0.6rem, 1.35rem);
    opacity: 0.95;
}

/* ===== HEADER NAVIGATION ===== */
.header-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: var(--max-width);
    margin: 0 auto;
}

.primary-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.primary-nav a {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.7rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,0.2);
    background: transparent;
    color: var(--lu-off-white);
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.2s ease;
}

.primary-nav a:hover,
.primary-nav a[aria-current="page"] {
    background: rgba(255,255,255,0.1);
}

/* Floating Accessibility Button (FAB) */
.accessibility-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 2px solid var(--lu-gold);
    border-radius: 50px;
    background: var(--lu-dark-blue);
    color: var(--lu-gold);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.accessibility-fab svg {
    flex-shrink: 0;
}

.accessibility-fab:hover {
    background: var(--lu-mid-blue);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}

.accessibility-fab:focus {
    outline: 3px solid var(--lu-gold);
    outline-offset: 3px;
}

.accessibility-fab:active {
    transform: translateY(0);
}

/* Hide label on smaller screens, show icon only */
@media (max-width: 600px) {
    .accessibility-fab {
        padding: 0.75rem;
        border-radius: 50%;
    }
    .accessibility-fab .fab-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0,0,0,0);
        border: 0;
    }
}

/* Theme variations for FAB */
[data-theme="dim"] .accessibility-fab {
    background: #1e222a;
    border-color: var(--lu-gold);
}

[data-theme="dark"] .accessibility-fab {
    background: #0d0f12;
    border-color: var(--lu-gold);
}

[data-theme="high-contrast"] .accessibility-fab {
    background: #000;
    border-color: #fff;
    color: #fff;
}

[data-theme="high-contrast"] .accessibility-fab:focus {
    outline-color: #ffff00;
}

/* ===== DECORATIVE STRIPES ===== */
.stripes {
    display: flex;
    flex-direction: column;
}

.stripe-1 {
    background-color: var(--lu-dark-blue);
    height: 10px;
}

.stripe-2 {
    background-color: var(--lu-mid-blue);
    height: 10px;
}

.stripe-3 {
    background-color: var(--lu-light-blue);
    height: 10px;
}

.stripe-4 {
    background-color: var(--lu-pale-blue);
    height: 10px;
}

/* Dim/Dark themes - adjust stripe colors */
html[data-theme="dim"] .stripes,
html[data-theme="dark"] .stripes {
    opacity: 0.6;
}

html[data-theme="hc"] .stripes {
    display: none;
}

/* ===== MOBILE MENU TOGGLE ===== */
.mobile-menu-toggle {
    display: none;
    background-color: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 15px 20px;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background 0.2s ease;
    font-weight: 600;
    border-radius: var(--radius);
}

.mobile-menu-toggle:hover {
    background: var(--panel);
}

.close-menu {
    display: none;
    position: fixed;
    top: 150px;
    right: 20px;
    background-color: var(--panel);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.2s ease;
    align-items: center;
    justify-content: center;
}

.close-menu:hover {
    background-color: var(--accent);
    color: var(--accent-text);
}

/* ===== MAIN LAYOUT ===== */
.main-container {
    display: flex;
    max-width: var(--max-width);
    margin: 0 auto;
    min-height: calc(100vh - 180px);
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    padding: 30px 20px;
    background-color: var(--bg);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
}

/* Search Section */
.search-section {
    margin-bottom: 30px;
}

.search-section h3,
.subscribe-section h3,
.nav-menu h3,
.categories h3,
.widget-title {
    color: var(--text);
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
}

/* Search Form - Inline layout like Seth's blog */
.search-form {
    display: flex;
    flex-direction: row;
    gap: 0;
}

.search-input,
.search-field {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius) 0 0 var(--radius);
    border-right: none;
    font-size: 14px;
    background: var(--panel);
    color: var(--text);
    min-width: 0;
}

.search-input:focus,
.search-field:focus {
    border-color: var(--accent);
    outline: none;
}

.search-submit {
    padding: 10px 14px;
    background-color: var(--lu-dark-blue);
    color: var(--lu-off-white);
    border: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
}

.search-submit:hover {
    background-color: var(--lu-mid-blue);
}

.search-submit svg {
    display: block;
}

.ai-search-option {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 10px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.ai-search-option:hover {
    color: var(--text);
}

.ai-search-option small {
    display: block;
    margin-top: 2px;
    opacity: 0.7;
    font-size: 11px;
}

/* Subscribe Section - Inline layout like Seth's blog */
.subscribe-section {
    margin-bottom: 30px;
}

.subscribe-section h3 {
    margin-bottom: 10px;
}

.subscribe-form {
    display: flex;
    flex-direction: row;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.email-input {
    flex: 1;
    padding: 10px 12px;
    border: none;
    font-size: 14px;
    background: var(--panel);
    color: var(--text);
    min-width: 0;
}

.email-input:focus {
    outline: none;
}

.subscribe-btn {
    padding: 10px 14px;
    background-color: var(--accent);
    color: var(--accent-text);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.subscribe-btn:hover {
    background-color: var(--accent-hover);
}

.privacy-link {
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    margin-top: 8px;
}

.privacy-link a {
    color: inherit;
    text-decoration: underline;
}

/* Navigation Menu */
.nav-menu {
    margin-bottom: 30px;
}

.nav-menu ul,
.widget ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu li,
.widget li {
    margin-bottom: 8px;
}

.nav-menu a,
.widget a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 15px;
    transition: all 0.2s ease;
    display: block;
    padding: 5px 0;
}

.nav-menu a:hover,
.widget a:hover {
    color: var(--text);
    padding-left: 5px;
}

/* Categories */
.categories {
    margin-bottom: 30px;
}

.category-item {
    background-color: var(--panel);
    padding: 12px;
    margin-bottom: 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: var(--text-light);
}

.category-item:hover {
    background-color: var(--border);
    transform: translateX(5px);
}

.category-item a {
    color: inherit;
    text-decoration: none;
    display: block;
}

.category-count {
    opacity: 0.6;
    font-size: 12px;
}

/* ===== CONTENT AREA ===== */
.content,
.site-main {
    flex: 1;
    padding: 30px;
    background-color: var(--panel);
    margin: 20px;
    border-radius: 4px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

/* ===== BLOG POSTS ===== */
.blog-post,
.hentry,
article.post,
article.page {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border);
}

.blog-post:last-child,
.hentry:last-child,
article:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.post-date,
.entry-meta {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.post-title,
.entry-title {
    color: var(--text);
    font-size: 24px;
    margin: 0 0 15px 0;
    font-weight: 600;
    line-height: 1.3;
}

.post-title a,
.entry-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.post-title a:hover,
.entry-title a:hover {
    color: var(--text-light);
}

.post-excerpt,
.entry-summary,
.entry-content {
    color: var(--text-light);
    line-height: var(--line);
    font-size: 15px;
    margin-bottom: 15px;
}

/* Page tagline/subtitle - apply class "page-tagline" in WordPress block editor */
.page-tagline {
    display: inline-block;
    background-color: var(--lu-dark-blue);
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 500;
    padding: 0.5em 1em;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.entry-content p {
    margin-bottom: var(--para-gap);
}

.read-more,
.more-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-block;
    background-color: var(--btn-bg);
    padding: 8px 16px;
    border-radius: var(--radius);
}

.read-more:hover,
.more-link:hover {
    background-color: var(--btn-hover);
    transform: translateX(5px);
    color: var(--accent);
}

/* Hero/CTA buttons - apply class "home-hero-btn" in WordPress block editor */
.home-hero-btn,
.wp-block-button.is-style-outline .wp-block-button__link,
.entry-content a.home-hero-btn {
    display: inline-block;
    background-color: var(--lu-dark-blue);
    color: #ffffff !important;  /* White text */
    border: 2px solid var(--lu-gold);  /* Gold border */
    padding: 12px 24px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}

/* Ensure visited state maintains same styling */
.home-hero-btn:visited,
.wp-block-button.is-style-outline .wp-block-button__link:visited,
.entry-content a.home-hero-btn:visited {
    color: #ffffff !important;  /* Keep white text on visited */
    border-color: var(--lu-gold);
}

.home-hero-btn:hover,
.home-hero-btn:focus,
.wp-block-button.is-style-outline .wp-block-button__link:hover,
.entry-content a.home-hero-btn:hover {
    background-color: var(--lu-mid-blue);
    transform: translateY(-2px);
    color: #ffffff !important;
}

.home-hero-btn:focus,
.wp-block-button.is-style-outline .wp-block-button__link:focus {
    outline: 3px solid var(--lu-gold);
    outline-offset: 2px;
}

/* ===== PAGINATION ===== */
.pagination,
.nav-links {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.pagination a,
.nav-links a,
.page-numbers {
    padding: 8px 16px;
    background: var(--btn-bg);
    color: var(--btn-text);
    border-radius: var(--radius);
    text-decoration: none;
    transition: background 0.2s ease;
}

.pagination a:hover,
.nav-links a:hover {
    background: var(--btn-hover);
}

.page-numbers.current {
    background: var(--accent);
    color: var(--accent-text);
}

/* ===== COMMENTS ===== */
.comments-area {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
}

.comments-title {
    font-size: 20px;
    margin-bottom: 20px;
}

.comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.comment {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.comment-author {
    font-weight: 600;
    margin-bottom: 5px;
}

.comment-meta {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 10px;
}

.comment-content p {
    margin: 0;
}

.comment-reply-link {
    font-size: 13px;
    color: var(--link);
}

/* Comment Form */
.comment-respond {
    margin-top: 30px;
}

.comment-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: inherit;
    margin-bottom: 15px;
}

.comment-form input:focus,
.comment-form textarea:focus {
    border-color: var(--accent);
}

.comment-form .submit {
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.comment-form .submit:hover {
    background: var(--accent-hover);
}

/* ===== FOOTER ===== */
.site-footer {
    background-color: var(--header-bg);
    color: var(--lu-off-white);
    padding: 30px 20px;
    text-align: center;
}

.site-footer a {
    color: var(--lu-gold);
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.footer-nav a {
    color: var(--lu-off-white);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-nav a:hover {
    color: var(--lu-gold);
}

.copyright {
    font-size: 14px;
    color: var(--lu-light-blue);
}

/* ===== BACK TO TOP BUTTON ===== */
.back-to-top {
    position: fixed;
    bottom: 90px;  /* Positioned above the accessibility FAB */
    right: 25px;
    background-color: var(--accent);
    color: var(--accent-text);
    border: none;
    border-radius: 50%;
    width: 46px;
    height: 46px;
    font-size: 22px;
    cursor: pointer;
    display: none;
    z-index: 9998;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    align-items: center;
    justify-content: center;
}

.back-to-top:hover {
    background-color: var(--accent-hover);
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
}

.back-to-top.visible {
    display: flex;
}

/* ===== READING GUIDE ===== */
.reading-guide {
    position: fixed;
    left: 0;
    right: 0;
    height: 3px;
    top: 50%;
    z-index: 9999;
    background: var(--accent);
    opacity: var(--reading-guide);
    pointer-events: none;
}

/* ===== READING MASK ===== */
.reading-mask {
    position: fixed;
    inset: 0;  /* Cover entire viewport including header/footer */
    z-index: 9998;
    pointer-events: none;
    opacity: var(--reading-mask);
    /* 
     * Gradient creates a "window" effect:
     * - Dark from top to (track-y - band)
     * - Clear from (track-y - band) to (track-y + band)
     * - Dark from (track-y + band) to bottom
     * 
     * Using max(0px, ...) and min(100vh, ...) to handle edge cases
     * when cursor is near top or bottom of viewport
     */
    background: linear-gradient(to bottom,
        rgba(0,0,0,var(--reading-mask-darkness)) 0%,
        rgba(0,0,0,var(--reading-mask-darkness)) max(0px, calc(var(--a11y-track-y) - var(--reading-mask-band))),
        rgba(0,0,0,0) max(0px, calc(var(--a11y-track-y) - var(--reading-mask-band))),
        rgba(0,0,0,0) min(100vh, calc(var(--a11y-track-y) + var(--reading-mask-band))),
        rgba(0,0,0,var(--reading-mask-darkness)) min(100vh, calc(var(--a11y-track-y) + var(--reading-mask-band))),
        rgba(0,0,0,var(--reading-mask-darkness)) 100%
    );
}

/* ===== ACCESSIBILITY MODAL ===== */
.accessibility-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 10000;
}

.accessibility-modal {
    position: fixed;
    inset: 5% 5%;
    max-width: 900px;
    max-height: 90vh;
    margin: auto;
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 8px;
    z-index: 10001;
    overflow: auto;
    padding: 0;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 1;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-close {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--btn-bg);
    color: var(--btn-text);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.modal-close:hover {
    background: var(--btn-hover);
}

.modal-body {
    padding: 1.5rem;
}

/* ===== ACCESSIBILITY TOOLBAR ===== */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    margin-bottom: 1rem;
}

.toolbar-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.toolbar label {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 600;
}

.toolbar select {
    font: inherit;
    font-size: 0.9rem;
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.6rem;
    cursor: pointer;
}

.toolbar select:focus {
    border-color: var(--accent);
}

.toolbar input[type="range"] {
    width: 80px;
    cursor: pointer;
}

.toolbar output {
    min-width: 3ch;
    text-align: right;
    color: var(--text-light);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.toolbar .btn {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    background: var(--btn-bg);
    color: var(--btn-text);
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.toolbar .btn:hover {
    background: var(--btn-hover);
}

.toolbar .btn[aria-pressed="true"] {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255,216,0,0.3) inset;
    background: var(--btn-hover);
}

.range-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
}

/* ===== SCREEN READER ONLY ===== */
.sr-only,
.screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== WINDOWS HIGH CONTRAST MODE ===== */
@media (forced-colors: active) {
    :focus-visible {
        outline: 2px solid Highlight;
    }
    
    .site-header,
    .site-footer,
    .stripes {
        forced-color-adjust: none;
        background: Canvas;
        border: 1px solid CanvasText;
    }
    
    .content,
    .sidebar,
    .toolbar,
    .accessibility-modal,
    .btn,
    select,
    input {
        forced-color-adjust: auto;
        border: 1px solid CanvasText;
        background: Canvas;
        color: CanvasText;
        box-shadow: none;
    }
    
    a {
        color: LinkText;
    }
    
    .back-to-top,
    .subscribe-btn,
    .read-more {
        border: 2px solid CanvasText;
    }
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 900px) {
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: fixed;
        top: 120px;
        left: -100%;
        height: calc(100vh - 120px);
        background-color: var(--bg);
        transition: left 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        border-right: none;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .sidebar.active ~ .close-menu {
        display: flex;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .content,
    .site-main {
        margin: 10px;
        padding: 20px;
    }
    
    .post-title,
    .entry-title {
        font-size: 20px;
    }
    
    .header-nav {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .primary-nav {
        width: 100%;
        justify-content: flex-start;
        margin-top: 10px;
    }
    
    .accessibility-modal {
        inset: 2%;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-group {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .brand {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .site-header {
        padding: 15px;
    }
    
    .content,
    .site-main {
        padding: 15px;
        margin: 5px;
    }
    
    .back-to-top {
        bottom: 75px;  /* Above the FAB on mobile */
        right: 20px;
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
}

/* ===== WORDPRESS SPECIFIC ===== */

/* Alignment classes */
.alignleft {
    float: left;
    margin-right: 1.5rem;
    margin-bottom: 1rem;
}

.alignright {
    float: right;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 1rem;
}

.alignwide {
    margin-left: -2rem;
    margin-right: -2rem;
    max-width: calc(100% + 4rem);
}

.alignfull {
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    max-width: 100vw;
    width: 100vw;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
}

figure {
    margin: 0 0 1rem 0;
}

figcaption {
    font-size: 0.9rem;
    color: var(--muted);
    text-align: center;
    margin-top: 0.5rem;
}

/* Galleries */
.wp-block-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

/* Quotes */
blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--accent);
    background: var(--bg);
    font-style: italic;
}

blockquote cite {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-style: normal;
    color: var(--muted);
}

/* Code */
code {
    background: var(--bg);
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
}

pre {
    background: var(--bg);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    border: 1px solid var(--border);
}

pre code {
    background: transparent;
    padding: 0;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

th, td {
    padding: 0.75rem;
    border: 1px solid var(--border);
    text-align: left;
}

th {
    background: var(--bg);
    font-weight: 600;
}

/* Forms */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--text);
    font-family: inherit;
    font-size: inherit;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    outline: none;
}

button,
input[type="submit"],
input[type="button"] {
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    transition: background 0.2s ease;
}

button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
    background: var(--accent-hover);
}

/* WordPress admin bar adjustment */
body.admin-bar .site-header {
    top: 32px;
}

@media (max-width: 782px) {
    body.admin-bar .site-header {
        top: 46px;
    }
}

/* Widget areas */
.widget {
    margin-bottom: 30px;
}

.widget-title {
    color: var(--text);
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

/* 404 Page */
.error-404 {
    text-align: center;
    padding: 60px 20px;
}

.error-404 h1 {
    font-size: 4rem;
    color: var(--accent);
    margin-bottom: 1rem;
}

.error-404 p {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* Sticky posts */
.sticky .entry-title::before {
    content: "★ ";
    color: var(--accent);
}

/* Post thumbnails */
.post-thumbnail {
    margin-bottom: 1rem;
    border-radius: var(--radius);
    overflow: hidden;
}

.post-thumbnail img {
    display: block;
    width: 100%;
}

/* Post navigation */
.post-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.post-navigation a {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.post-navigation .nav-subtitle {
    font-size: 0.85rem;
    color: var(--muted);
}

.post-navigation .nav-title {
    font-weight: 600;
}

/* Archives and categories */
.archive-header,
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.archive-title,
.page-title {
    font-size: 1.5rem;
    margin: 0 0 0.5rem 0;
}

.archive-description,
.taxonomy-description {
    color: var(--text-light);
}
