/*
Theme Name: Upward Brand
Theme URI: https://example.com/upward-brand
Author: Elite UI/UX Designer
Author URI: https://example.com
Description: A minimalist, ultra-premium, Fortune 500 style WordPress theme with a drawer-exclusive architecture, flawless dark mode, and fluid design tokens.
Version: 1.7.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: upward-brand
*/

/**
 * UPWARD BRAND - THE MASTER ENGINE
 * --------------------------------------
 * TABLE OF CONTENTS:
 * 1.   DESIGN SYSTEM & MASTER TOKENS
 * 2.   MODERN CSS RESET & GLOBAL DEFAULTS
 * 3.   ACCESSIBILITY & UTILITY CLASSES
 * 4.   TYPOGRAPHY ENGINE (Fluid Scales)
 * 5.   CORE LAYOUT & GRID ARCHITECTURE
 * 6.   HEADER: DRAWER-EXCLUSIVE SYSTEM
 * 7.   NAVIGATION: CINEMATIC SIDEBAR UI (OPTIMIZED UX)
 * 8.   SEARCH: PREMIUM OVERLAY & MODAL
 * 9.   INTERACTIVE: BUTTONS, LINKS & CTAS
 * 10.  FORMS: HIGH-END INPUT STYLING
 * 11.  ARCHIVES: DYNAMIC BLOG LAYOUTS
 * 11.1 Premium Grid Layout
 * 11.2 Horizontal List Layout
 * 12.  SINGLE POST: CONTENT EXPERIENCE
 * 12.1 Premium Hero (Split, Wide, Full)
 * 12.2 Breadcrumbs (Forced Horizontal)
 * 12.3 Table of Contents (Auto-TOC)
 * 12.4 Metadata, Author Box & Biography
 * 13.  CONVERSION: POST FUNNEL & SIDEBAR CTAS
 * 14.  DISCUSSION: THREADED COMMENTS UI
 * 15.  SIDEBAR: STICKY WIDGET ENGINE
 * 16.  FOOTER: SOCKET, GRID & CONTRAST
 * 17.  PAGE TEMPLATES: CANVAS & NARROW
 * 18.  GUTENBERG: EXHAUSTIVE BLOCK SUPPORT
 * 19.  DARK MODE: SEMANTIC MAPPING
 * 20.  ANIMATIONS: MOTION & MICRO-INTERACTIONS
 * 21.  CORE WP CLASSES & ALIGNMENTS
 */

/* ==========================================================================
   1. DESIGN SYSTEM & MASTER TOKENS
   ========================================================================== */
:root {
    /* --- COLOR PALETTE: LIGHT (Base) --- */
    --color-primary: #000000;
    --color-accent: #007AFF;
    --color-accent-hover: #005BB5;
    --color-accent-soft: rgba(0, 122, 255, 0.08);
    --color-success: #34C759;
    --color-error: #FF3B30;
    
    --bg-main: #FFFFFF;
    --bg-alt: #F9F9FB;
    --bg-surface: #FFFFFF;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --bg-drawer: #FFFFFF;
    
    --color-headings: #000000;
    --color-body: #424245;
    --color-meta: #86868B;
    --color-border: #E5E5E7;
    --color-border-subtle: #F2F2F7;
    --color-white: #FFFFFF;

    /* Footer Variable Control */
    --color-footer-text: #424245;
    --color-footer-heading: #000000;
    
    /* --- TYPOGRAPHY SCALE (Fluid clamp() System) --- */
    --fs-xs: clamp(0.75rem, 0.72rem + 0.15vw, 0.875rem);
    --fs-sm: clamp(0.875rem, 0.85rem + 0.13vw, 1rem);
    --fs-base: clamp(1rem, 0.98rem + 0.1vw, 1.125rem);
    --fs-md: clamp(1.25rem, 1.2rem + 0.25vw, 1.5rem);
    --fs-lg: clamp(1.5rem, 1.4rem + 0.5vw, 2.25rem);
    --fs-xl: clamp(2.25rem, 2rem + 1vw, 3.5rem);
    --fs-xxl: clamp(3rem, 2.5rem + 2vw, 5rem);
    --fs-display: clamp(3.5rem, 3rem + 5vw, 7.5rem);

    /* --- SPACING SYSTEM --- */
    --space-unit: 1rem;
    --space-xxs: calc(var(--space-unit) * 0.25);
    --space-xs: calc(var(--space-unit) * 0.5);
    --space-sm: calc(var(--space-unit) * 1);
    --space-md: calc(var(--space-unit) * 2);
    --space-lg: calc(var(--space-unit) * 4);
    --space-xl: calc(var(--space-unit) * 8);
    --space-section: clamp(4rem, 10vh, 12rem);

    /* --- DEPTH & RADIUS --- */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 32px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --shadow-premium: 0 40px 80px -20px rgba(0,0,0,0.2);

    /* --- TRANSITIONS --- */
    --transition-base: 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --blur-glass: 25px;

    /* --- LAYOUT --- */
    --container-max: 1380px;
    --container-narrow: 780px;
    --header-height: 90px;
    --header-height-scrolled: 72px;
    --drawer-width: 520px;
}

/* ==========================================================================
   2. MODERN CSS RESET & DEFAULTS
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
    text-rendering: optimizeLegibility;
    -webkit-text-size-adjust: 100%;
    /* Fixes global horizontal scrolling */
    max-width: 100vw;
    overflow-x: hidden;
}

body {
    margin: 0; padding: 0;
    background-color: var(--bg-main);
    color: var(--color-body);
    font-family: var(--font-body), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: var(--fs-base);
    line-height: 1.7;
    transition: background-color var(--transition-base), color var(--transition-base);
    /* Strict overflow control to prevent sideways scrolling */
    max-width: 100%;
    overflow-x: hidden;
    overflow-wrap: break-word; /* Prevents long unbreakable strings from pushing layout */
    word-wrap: break-word;
}

::selection {
    background-color: var(--color-accent);
    color: var(--color-white);
}

img {
    max-width: 100%; height: auto; display: block;
    border-radius: var(--radius-md);
}

iframe, video, canvas {
    max-width: 100%; border-radius: var(--radius-md);
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover { opacity: 0.75; }

/* ==========================================================================
   3. ACCESSIBILITY & UTILITY CLASSES
   ========================================================================== */
.screen-reader-text {
    position: absolute !important; width: 1px !important; height: 1px !important;
    padding: 0 !important; margin: -1px !important; overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.m-0 { margin: 0 !important; }
.p-0 { padding: 0 !important; }

.desktop-only { display: none !important; }
@media (min-width: 1024px) { .desktop-only { display: flex !important; } }

.mobile-only { display: block !important; }
@media (min-width: 1024px) { .mobile-only { display: none !important; } }

/* ==========================================================================
   4. TYPOGRAPHY: FLUID SCALING SYSTEM
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--color-headings);
    line-height: 1.1;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: var(--space-sm);
    letter-spacing: -0.04em;
}

h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
h4 { font-size: var(--fs-base); text-transform: uppercase; letter-spacing: 0.1em; }

p { margin-bottom: 2rem; }

strong, b { font-weight: 700; color: var(--color-headings); }

small { font-size: var(--fs-xs); }

blockquote {
    font-size: 1.5rem;
    font-style: italic;
    color: var(--color-headings);
    border-left: 5px solid var(--color-accent);
    padding: 2.5rem 3.5rem;
    background: var(--bg-alt);
    margin: 4rem 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* ==========================================================================
   5. CORE LAYOUT & GRID ARCHITECTURE
   ========================================================================== */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding-left: clamp(1.5rem, 6vw, 5rem);
    padding-right: clamp(1.5rem, 6vw, 5rem);
}

.container-narrow {
    max-width: var(--container-narrow);
    margin: 0 auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.site-main {
    padding-top: var(--space-section);
    padding-bottom: var(--space-section);
    min-height: 60vh;
}

.grid {
    display: grid;
    gap: var(--space-md);
}

/* ==========================================================================
   6. HEADER: DRAWER-EXCLUSIVE SYSTEM
   ========================================================================== */
.site-header {
    height: var(--header-height);
    position: fixed;
    top: 0; left: 0; width: 100%; z-index: 1000;
    display: flex; align-items: center;
    transition: var(--transition-base);
    border-bottom: 1px solid transparent;
}

.site-header.is-scrolled {
    height: var(--header-height-scrolled);
    background-color: var(--bg-glass);
    backdrop-filter: blur(var(--blur-glass));
    border-bottom: 1px solid var(--color-border);
}

.header-container {
    display: flex; justify-content: space-between; align-items: center; width: 100%;
}

/* Branding */
.site-branding { display: flex; align-items: center; }
.site-branding .custom-logo { max-height: 40px; width: auto; border-radius: 0 !important; }
.site-branding .site-title {
    font-size: 1.5rem; font-weight: 800; letter-spacing: -0.06em; color: var(--color-headings); margin: 0; line-height: 1;
}

.site-branding .site-title span { color: var(--color-accent); }

.header-actions {
    display: flex; align-items: center; gap: 1.75rem;
}

/* Updated Icons: No Boxes, No Containers */
.theme-toggle, 
.icon-btn.search-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-headings);
    border: none;
    background: none !important;
    padding: 0;
    width: 32px;
    height: 32px;
    box-shadow: none !important;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.theme-toggle:hover, 
.icon-btn.search-trigger:hover {
    background: none !important;
    opacity: 0.6;
    transform: translateY(-1px);
}

.theme-toggle svg, 
.icon-btn.search-trigger svg { 
    width: 22px; 
    height: 22px; 
    display: block; 
    stroke-width: 2.5;
}

[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: block; }

/* Menu Trigger */
.drawer-trigger {
    background: none; border: none; cursor: pointer; display: flex; align-items: center; gap: 0.75rem;
    padding: 0.5rem; color: var(--color-headings); border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.drawer-trigger:hover { color: var(--color-accent); }

.trigger-label {
    font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.15em;
}

/* ==========================================================================
   7. NAVIGATION: CINEMATIC SIDEBAR UI (OPTIMIZED UX)
   ========================================================================== */

/* Lock the body from scrolling when drawer is open */
body.drawer-is-open {
    overflow: hidden;
    touch-action: none; /* Prevents mobile swipe-to-scroll on the background */
}

.side-drawer {
    position: fixed; top: 0; right: 0; width: 100%; height: 100%; z-index: 2000;
    visibility: hidden; overflow: hidden;
}

.side-drawer.is-active { visibility: visible; }

.drawer-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5); backdrop-filter: blur(10px); opacity: 0;
    transition: opacity var(--transition-base);
}

.side-drawer.is-active .drawer-overlay { opacity: 1; }

/* The Sliding Panel */
.drawer-content {
    position: absolute; top: 0; right: -100%; /* Start off-screen */
    width: 100%; max-width: 450px; /* Optimized mobile width */
    height: 100vh; height: 100dvh; /* Uses dynamic viewport height for iOS Safari */
    background-color: var(--bg-surface);
    box-shadow: var(--shadow-premium);
    transition: right 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    padding: 2rem;
    display: flex; flex-direction: column;
}

.side-drawer.is-active .drawer-content { right: 0; }

/* Drawer Header */
.drawer-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem;
    padding-bottom: 2rem; border-bottom: 1px solid var(--color-border-subtle);
}

.drawer-logo { font-size: 1.5rem; font-weight: 800; color: var(--color-headings); letter-spacing: -0.05em; }
.drawer-logo span { color: var(--color-accent); }

.drawer-close {
    background: transparent; border: none; box-shadow: none; border-radius: 0;
    cursor: pointer; color: var(--color-headings); width: 44px; height: 44px; padding: 0;
    display: flex; align-items: center; justify-content: center; transition: all 0.3s ease;
}
.drawer-close:hover { background: transparent; color: var(--color-accent); transform: rotate(90deg) scale(1.1); }

/* Drawer Navigation Container (UX Refined: Top Aligned with padding) */
.drawer-nav { 
    flex-grow: 1; 
    display: flex; 
    align-items: flex-start; /* Removed center alignment to bring items closer to top */
    padding-top: 1.5rem; /* Elegant breathing room from the header */
    overflow-y: auto; 
    padding-right: 1rem; 
    margin-right: -1rem; 
}
.drawer-nav::-webkit-scrollbar { width: 4px; }
.drawer-nav::-webkit-scrollbar-track { background: transparent; }
.drawer-nav::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }

.drawer-menu-list { 
    list-style: none; padding: 0; margin: 0; width: 100%; 
    display: flex; flex-direction: column; gap: 0.5rem; 
}

.drawer-menu-list > .menu-item {
    opacity: 0; transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Staggered fade in animation when drawer is open */
.side-drawer.is-active .drawer-menu-list > .menu-item { opacity: 1; transform: translateY(0); }
.side-drawer.is-active .drawer-menu-list > .menu-item:nth-child(1) { transition-delay: 0.1s; }
.side-drawer.is-active .drawer-menu-list > .menu-item:nth-child(2) { transition-delay: 0.15s; }
.side-drawer.is-active .drawer-menu-list > .menu-item:nth-child(3) { transition-delay: 0.2s; }
.side-drawer.is-active .drawer-menu-list > .menu-item:nth-child(4) { transition-delay: 0.25s; }
.side-drawer.is-active .drawer-menu-list > .menu-item:nth-child(5) { transition-delay: 0.3s; }
.side-drawer.is-active .drawer-menu-list > .menu-item:nth-child(6) { transition-delay: 0.35s; }

/* Fluid Typography for Menu Links (Optimized to prevent breaking on 3 words) */
.drawer-menu-list > .menu-item > a {
    display: flex; justify-content: space-between; align-items: center;
    color: var(--color-headings);
    text-decoration: none;
    font-weight: 800;
    /* Min 1.125rem on mobile, max 1.5rem on desktop for crisp, readable UI */
    font-size: clamp(1.125rem, 3.5vw, 1.5rem); 
    line-height: 1.3;
    padding: 0.75rem 0;
    background: transparent;
    transition: color 0.3s ease, padding-left 0.3s ease;
    word-wrap: break-word;
    white-space: normal; /* Ensures long menu items wrap naturally onto next line */
}

.drawer-menu-list > .menu-item > a:hover {
    color: var(--color-accent);
    padding-left: 10px; /* Slight nudge effect on hover */
}

/* Submenu Accordion Logic */
.sub-menu { 
    list-style: none; padding: 0.5rem 0 1.5rem 2rem; display: none; 
    border-left: 2px solid var(--color-border-subtle); margin-left: 1.5rem; margin-top: 0.5rem; 
}
.menu-item-has-children.is-open > .sub-menu { display: block; animation: fadeInUp 0.4s ease forwards; }

.sub-menu > .menu-item > a { 
    display: block; padding: 0.85rem 1.25rem; color: var(--color-body); 
    font-weight: 600; font-size: 1.05rem; border-radius: var(--radius-sm); transition: all 0.2s ease; 
    position: relative;
}
.sub-menu > .menu-item > a::before {
    content: ''; position: absolute; left: -2rem; top: 50%; transform: translateY(-50%);
    width: 1rem; height: 2px; background: var(--color-border-subtle); transition: all 0.2s ease;
}
.sub-menu > .menu-item > a:hover { background: var(--bg-alt); color: var(--color-headings); transform: translateX(6px); }
.sub-menu > .menu-item > a:hover::before { background: var(--color-accent); width: 1.5rem; }

.submenu-trigger { 
    transition: transform var(--transition-base), background var(--transition-fast), color var(--transition-fast); 
    background: var(--bg-alt); width: 36px; height: 36px; display: flex; 
    align-items: center; justify-content: center; border-radius: 50%; color: var(--color-meta);
    border: 1px solid transparent;
}
.submenu-trigger:hover { background: var(--color-border-subtle); color: var(--color-headings); }
.is-open > a .submenu-trigger { transform: rotate(180deg); background: var(--color-headings); color: var(--bg-main); border-color: var(--color-headings); }

.drawer-footer {
    padding-top: 2rem; border-top: 1px solid var(--color-border-subtle);
}

.drawer-cta {
    margin-bottom: 1.5rem;
}
.drawer-cta .btn-primary {
    width: 100%;
    padding: 1.15rem;
}

.drawer-tagline { font-size: 0.9rem; color: var(--color-meta); margin: 0; }

/* ==========================================================================
   8. SEARCH: PREMIUM OVERLAY & MODAL
   ========================================================================== */
.search-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg-glass); backdrop-filter: blur(var(--blur-glass));
    z-index: 3000; visibility: hidden; opacity: 0;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition-base);
}

.search-overlay.is-active { visibility: visible; opacity: 1; }

/* Search UI Responsiveness Refined */
.search-modal-inner { 
    width: 100%; 
    max-width: 900px; 
    padding: clamp(1.5rem, 5vw, 3rem); 
    text-align: center; 
}

.search-field-modal {
    width: 100%; border: none; border-bottom: 3px solid var(--color-border);
    background: transparent; 
    /* Perfectly scaled down to fit standard device widths */
    font-size: clamp(1.25rem, 5vw, 2.5rem); 
    font-weight: 800;
    color: var(--color-headings); outline: none; 
    padding: clamp(1rem, 3vw, 1.5rem) 0;
    text-align: center; transition: border-color var(--transition-fast);
}

.search-field-modal:focus { border-color: var(--color-accent); }

/* Clean, Unboxed Close Icon */
.search-close { 
    position: absolute; 
    top: clamp(1.5rem, 4vw, 3rem); 
    right: clamp(1.5rem, 4vw, 3rem); 
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--color-headings);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
    z-index: 10;
}
.search-close:hover {
    color: var(--color-accent);
    transform: rotate(90deg) scale(1.1);
}

/* ==========================================================================
   9. INTERACTIVE: BUTTONS, LINKS & CTAS
   ========================================================================== */
.btn-primary, 
.search-submit,
input[type="submit"],
.comment-form .submit {
    background-color: var(--color-primary);
    color: var(--color-white) !important;
    border: none; padding: 1rem 2.75rem; border-radius: var(--radius-full);
    font-size: 0.9375rem; font-weight: 700; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: var(--transition-base); box-shadow: var(--shadow-sm);
    text-transform: none; text-decoration: none;
    white-space: nowrap;
}

.btn-primary:hover {
    transform: translateY(-4px); box-shadow: var(--shadow-lg); background-color: var(--color-accent);
}

.btn-secondary, .btn-outline {
    background: transparent; color: var(--color-headings); border: 1px solid var(--color-border);
    padding: 1rem 2.75rem; border-radius: var(--radius-full); font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}

.btn-secondary:hover { background: var(--bg-alt); border-color: var(--color-headings); }

.btn-text {
    font-weight: 700; font-size: var(--fs-sm); color: var(--color-accent);
    display: inline-flex; align-items: center; gap: 0.5rem;
}

.btn-text:hover { gap: 0.75rem; opacity: 1; }

/* ==========================================================================
   10. FORMS: HIGH-END INPUT STYLING
   ========================================================================== */
input[type="text"], input[type="email"], input[type="url"], input[type="password"], textarea, select {
    width: 100%; padding: 1.25rem; background-color: var(--bg-alt); border: 1px solid var(--color-border);
    border-radius: var(--radius-sm); font-family: inherit; font-size: 1rem; color: var(--color-body);
    transition: var(--transition-fast);
}

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

/* ==========================================================================
   11. ARCHIVES: DYNAMIC BLOG LAYOUTS
   ========================================================================== */

/* 11.1 Premium Grid Layout */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 3.5rem;
}

.post-card {
    background-color: var(--bg-surface); border-radius: var(--radius-md);
    border: 1px solid var(--color-border-subtle); overflow: hidden;
    transition: var(--transition-base); display: flex; flex-direction: column;
}

.post-card:hover { transform: translateY(-15px); box-shadow: var(--shadow-premium); }

.post-card-thumb { aspect-ratio: 16 / 10; overflow: hidden; }
.post-card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s ease; }
.post-card:hover .post-card-thumb img { transform: scale(1.1); }

.post-card-content { padding: 3rem; flex-grow: 1; display: flex; flex-direction: column; }

.post-meta {
    font-size: var(--fs-xs); color: var(--color-meta); text-transform: uppercase;
    letter-spacing: 0.12em; margin-bottom: 1.25rem; font-weight: 700;
}

.post-card-title { font-size: var(--fs-md); margin-bottom: 1.5rem; line-height: 1.25; }
.post-card-title a { color: var(--color-headings); }

/* 11.2 Horizontal List Layout */
.post-list-horizontal { display: flex; flex-direction: column; gap: 3.5rem; }

.post-card-horizontal {
    display: grid; grid-template-columns: 480px 1fr; gap: 0;
    background-color: var(--bg-surface); border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-subtle); overflow: hidden;
    transition: var(--transition-base);
}

.post-card-horizontal .post-card-thumb { height: 100%; min-height: 320px; border-radius: 0; }
.post-card-horizontal .post-card-content { padding: clamp(2rem, 5vw, 4.5rem); align-self: center; }

@media (max-width: 1100px) {
    .post-card-horizontal { grid-template-columns: 1fr; }
    .post-card-horizontal .post-card-thumb { min-height: 280px; }
}

/* ==========================================================================
   12. SINGLE POST: CONTENT EXPERIENCE
   ========================================================================== */

/* 12.1 Premium Hero Presentation */
.premium-single-post { padding-bottom: 8rem; }

.post-hero {
    padding: calc(var(--header-height) + 4rem) 0 6rem;
    background: var(--bg-alt);
    margin-bottom: 6rem;
}

.hero-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 5rem; align-items: center;
}

.hero-text-content { max-width: 650px; }
.entry-title { font-size: var(--fs-xl); line-height: 1.05; margin-bottom: 2rem; }

.hero-img-main {
    border-radius: var(--radius-lg); box-shadow: var(--shadow-premium);
    width: 100%; height: 520px; object-fit: cover;
}

/* 12.2 Breadcrumbs (Fluid Wrapping to prevent X-Scrolling) */
.breadcrumb-container { margin-bottom: 2.5rem; }
.breadcrumbs {
    display: flex !important; flex-wrap: wrap !important; /* Forces wrap on small screens */
    list-style: none !important;
    padding: 0 !important; margin: 0 !important; gap: 0.75rem !important;
    font-size: var(--fs-xs); font-weight: 800; color: var(--color-meta);
    text-transform: uppercase; letter-spacing: 0.05em;
}
.breadcrumbs li { display: flex; align-items: center; white-space: normal; word-break: break-word; }
.breadcrumbs li a { color: var(--color-meta); }
.breadcrumbs li.separator { opacity: 0.3; margin: 0 0.25rem; }

/* 12.3 Table of Contents (Auto-TOC) */
.toc-sidebar-box {
    background-color: var(--bg-alt); border-radius: var(--radius-md);
    padding: 3rem; margin: 4rem 0; border: 1px solid var(--color-border);
}

.toc-label { display: block; font-weight: 800; text-transform: uppercase; font-size: 0.75rem; margin-bottom: 1.5rem; color: var(--color-accent); border-bottom: 1px solid var(--color-border-subtle); padding-bottom: 1rem; }
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-item { margin-bottom: 0.75rem; font-weight: 600; font-size: 0.95rem; line-height: 1.4; }
.toc-item a { color: var(--color-body); transition: color 0.2s ease; }
.toc-item a:hover { color: var(--color-accent); }

/* 12.4 Metadata & Author Box */
.entry-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 1.5rem; margin-bottom: 3rem; color: var(--color-meta); font-size: var(--fs-xs); font-weight: 800; text-transform: uppercase; }

.author-box {
    display: flex; gap: 3rem; background-color: var(--bg-alt); padding: clamp(2.5rem, 6vw, 5rem);
    border-radius: var(--radius-lg); margin: 6rem 0; align-items: flex-start;
    border: 1px solid var(--color-border-subtle);
}

.author-avatar img { width: 120px; height: 120px; border-radius: var(--radius-full); box-shadow: var(--shadow-md); }
.author-info h4 { font-size: 1.5rem; margin-bottom: 0.75rem; }

/* Post Layout Wrapper */
.single-layout-wrapper { display: grid; grid-template-columns: 1fr 340px; gap: 7rem; }

.entry-content { font-size: 1.25rem; line-height: 1.85; color: var(--color-body); }
.entry-content p { margin-bottom: 2.75rem; }

/* ==========================================================================
   13. CONVERSION: POST FUNNEL & SIDEBAR CTAS
   ========================================================================== */
.post-funnel {
    background-color: var(--color-primary);
    background-image: radial-gradient(circle at 80% 20%, var(--color-accent), transparent 60%);
    color: var(--color-white); padding: clamp(4rem, 10vw, 8.5rem);
    border-radius: var(--radius-lg); text-align: center; margin: 8rem 0;
    position: relative; overflow: hidden; box-shadow: var(--shadow-lg);
}

.post-funnel h2 { color: var(--color-white); font-size: 3rem; margin-bottom: 2rem; letter-spacing: -0.05em; }
.post-funnel p { font-size: 1.35rem; opacity: 0.9; max-width: 760px; margin: 0 auto 3.5rem; line-height: 1.5; }

.post-funnel .btn-primary {
    background-color: var(--color-white) !important; color: var(--color-primary) !important;
    padding: 1.35rem 5rem; font-size: 1.125rem;
}

/* Sidebar Premium CTA */
.premium-sidebar-cta {
    background: var(--color-primary); color: var(--color-white); padding: 3.5rem 2.5rem;
    border-radius: var(--radius-md); text-align: center; box-shadow: var(--shadow-lg);
}
.premium-sidebar-cta h3 { color: var(--color-white); margin-bottom: 1.25rem; font-size: 1.5rem; }
.premium-sidebar-cta p { font-size: 0.95rem; opacity: 0.8; margin-bottom: 2.25rem; }
.premium-sidebar-cta .btn-primary { width: 100%; background: var(--color-white) !important; color: var(--color-primary) !important; }

/* ==========================================================================
   14. DISCUSSION: THREADED COMMENTS UI
   ========================================================================== */
#comments { padding-top: var(--space-lg); border-top: 1px solid var(--color-border); }

.comment-list { list-style: none; padding: 0; }
.comment-body { padding: 3.5rem 0; border-bottom: 1px solid var(--color-border-subtle); display: flex; gap: 2rem; }

.comment-author img { border-radius: var(--radius-full); width: 72px; height: 72px; }
.comment-metadata { font-size: var(--fs-xs); color: var(--color-meta); font-weight: 800; margin-bottom: 1rem; text-transform: uppercase; }

.comment-form {
    background-color: var(--bg-alt); padding: clamp(2.5rem, 6vw, 5rem);
    border-radius: var(--radius-lg); margin-top: 6rem;
}

/* ==========================================================================
   15. SIDEBAR: STICKY WIDGET ENGINE
   ========================================================================== */
.widget { margin-bottom: 5.5rem; }
.widget-title {
    font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.2em;
    padding-bottom: 0.75rem; border-bottom: 3px solid var(--color-accent);
    display: inline-block; margin-bottom: 3rem; font-weight: 800;
}

.sticky-sidebar { position: relative; }
.is-sticky-enabled #secondary { position: sticky; top: 120px; align-self: start; }

/* ==========================================================================
   16. FOOTER ARCHITECTURE
   ========================================================================== */
.site-footer {
    padding: var(--space-xl) 0 4rem; border-top: 1px solid var(--color-border);
    color: var(--color-footer-text);
}

/* FIXED: Target the actual .footer-grid class from footer.php */
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 4rem;
    margin-bottom: 4rem;
}

.footer-widget-title, .widget-title { color: var(--color-footer-heading); margin-bottom: 2.75rem; font-size: 1.35rem; }

/* Target lists inside footer columns */
.footer-column ul, .footer-widget ul { list-style: none; padding: 0; margin: 0; }
.footer-column ul li, .footer-widget ul li { margin-bottom: 1rem; }
.footer-column ul li a, .footer-widget ul li a { color: var(--color-footer-text); transition: color var(--transition-fast); }
.footer-column ul li a:hover, .footer-widget ul li a:hover { color: var(--color-accent); }

/* Default Branding Column Styling */
.footer-logo { font-size: 1.5rem; font-weight: 800; color: var(--color-headings); margin-bottom: 1rem; line-height: 1; }
.footer-logo span { color: var(--color-accent); }

.footer-socket {
    margin-top: 7rem; padding-top: 4rem; border-top: 1px solid var(--color-border);
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 3rem; font-size: var(--fs-xs); color: var(--color-meta);
    font-weight: 600; text-transform: uppercase;
}

.footer-info p { margin: 0; }

.footer-menu { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 2rem; }
.footer-menu a { color: var(--color-meta); }
.footer-menu a:hover { color: var(--color-accent); }

/* Mobile Footer Fixes */
@media (max-width: 768px) {
    .footer-grid { grid-template-columns: 1fr; gap: 3rem; text-align: center; }
    .site-footer { padding-bottom: 6rem; }
    .footer-socket { flex-direction: column; text-align: center; gap: 3rem; }
    .footer-menu { justify-content: center; }
}

/* ==========================================================================
   17. PAGE TEMPLATES: CANVAS & NARROW

/* ==========================================================================
   17. PAGE TEMPLATES: CANVAS & NARROW
   ========================================================================== */

/* Narrow Reading Layout */
.template-narrow .content-area { max-width: var(--container-narrow); margin: 0 auto; }

/* Builder Canvas Fix: Edge-to-edge content, but structured footer */
.page-template-page-canvas .site-main { padding: 0 !important; }
.page-template-page-canvas .site-footer .container {
    max-width: var(--container-max); margin: 0 auto; padding: 0 5rem;
}

/* ==========================================================================
   18. GUTENBERG: EXHAUSTIVE BLOCK SUPPORT
   ========================================================================== */
.wp-block-columns { gap: 3.5rem; margin-bottom: 5rem; }
.wp-block-column { margin-bottom: 2.5rem; }

.wp-block-quote {
    border-left: 6px solid var(--color-accent); padding: 3rem 4rem;
    font-size: 1.75rem; font-style: italic; background-color: var(--bg-alt);
    margin: 5rem 0; border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.wp-block-cover { border-radius: var(--radius-lg); margin: 6rem 0; min-height: 500px; }

/* Fixes Alignfull horizontal overflow safely */
.wp-block-image.alignfull { 
    margin: 7rem 0; 
    width: 100vw; 
    max-width: 100vw;
    position: relative; 
    left: 50%; right: 50%; 
    margin-left: -50vw; margin-right: -50vw; 
}
.wp-block-image.alignfull img { border-radius: 0; }

.wp-block-button__link {
    border-radius: var(--radius-full) !important; padding: 1.25rem 4rem !important;
    font-weight: 800 !important; font-size: 1.1rem !important; transition: transform 0.3s ease !important;
}
.wp-block-button__link:hover { transform: scale(1.05); }

.wp-block-table { margin: 4rem 0; border-collapse: collapse; width: 100%; }
.wp-block-table th, .wp-block-table td { padding: 1.5rem; border: 1px solid var(--color-border); text-align: left; }

/* ==========================================================================
   19. DARK MODE: SEMANTIC MAPPING & OVERRIDES
   ========================================================================== */
[data-theme="dark"] {
    --bg-main: #050505;
    --bg-alt: #0D0D0E;
    --bg-surface: #121214;
    --bg-glass: rgba(10, 10, 12, 0.9);
    --bg-drawer: #0A0A0B;
    
    --color-headings: #F5F5F7;
    --color-body: #A1A1A6;
    --color-meta: #6E6E73;
    --color-border: #2C2C2E;
    --color-border-subtle: #1C1C1E;
    
    --color-footer-text: #A1A1A6;
    --color-footer-heading: #F5F5F7;
    
    --color-primary: #FFFFFF;
    --shadow-premium: 0 40px 80px -20px rgba(0,0,0,0.7);
}

[data-theme="dark"] .site-header.is-scrolled { background-color: rgba(10, 10, 12, 0.9); }
[data-theme="dark"] .btn-primary { background-color: var(--color-white); color: #000 !important; }
[data-theme="dark"] .btn-primary:hover { background-color: var(--color-accent); color: #FFF !important; }
[data-theme="dark"] .post-funnel .btn-primary { background-color: var(--color-white); color: #000 !important; }
[data-theme="dark"] .premium-sidebar-cta { background-color: var(--bg-alt); border: 1px solid var(--color-border); }

/* ==========================================================================
   20. ANIMATIONS: MOTION & MICRO-INTERACTIONS
   ========================================================================== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

.post-card, .post-hero, .post-funnel, .widget {
    animation: fadeInUp 1.2s var(--transition-base) forwards;
}

.post-card-thumb img { transition: transform 1.2s cubic-bezier(0.2, 1, 0.3, 1); }

/* ==========================================================================
   21. CORE WP CLASSES & ALIGNMENTS
   ========================================================================== */
.alignleft { float: left; margin: 0.5rem 3rem 2rem 0; }
.alignright { float: right; margin: 0.5rem 0 2rem 3rem; }
.aligncenter { display: block; margin: 3rem auto; text-align: center; }

.wp-caption { background: var(--bg-alt); border: 1px solid var(--color-border); padding: 1.25rem; border-radius: var(--radius-sm); max-width: 100%; }
.wp-caption-text { font-size: var(--fs-xs); color: var(--color-meta); font-style: italic; margin-top: 1rem; text-align: center; }

/* Responsive Overrides */
@media (max-width: 1024px) {
    .hero-grid { grid-template-columns: 1fr; gap: 3rem; text-align: center; }
    .hero-text-content { max-width: 100%; }
    .single-layout-wrapper { grid-template-columns: 1fr; gap: 5rem; }
    .hero-img-main { height: 400px; }
}

@media (max-width: 768px) {
    :root { --drawer-width: 100%; --header-height: 72px; }
    .site-footer { padding-bottom: 6rem; }
    .footer-socket { flex-direction: column; text-align: center; gap: 3rem; }
    .post-funnel h2 { font-size: 2.25rem; }
    .post-funnel { padding: 4rem 2rem; }
    /* Added safety for full-width grid alignments on mobile */
    .wp-block-image.alignfull { margin-left: -1.5rem; margin-right: -1.5rem; width: calc(100% + 3rem); max-width: none; left: auto; right: auto; }
}