/* Professional UI/UX System - "Minimalist Editorial" */
:root {
    /* 1. Visual Design & Color Harmonics */
    --bg-color: #fafafa;
    /* Calming off-white */
    --panel-bg: #ffffff;
    --panel-bg: #ffffff;
    --text-main: #222222;
    /* Softened charcoal */
    --text-muted: #666666;
    --accent: #000000;
    --border-color: #e5e5e5;
    --hover-bg: #f5f5f5;

    /* Semantic Accents - Intent-driven */
    --accent-primary: #E87D6C;
    /* Brand coral from Pomelli palette */
    --accent-success: #00cc7a;
    /* Confirmation / Content */
    --accent-signal: #e6b800;
    /* Information */
    --accent-warn: #d93a00;
    /* Attention */

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-serif: 'Merriweather', serif;
    --font-mono: 'JetBrains Mono', monospace;
    --font-body: var(--font-serif);
    /* Switch body to Serif */
    --font-heading: var(--font-serif);
    --type-base: 1rem;
    --type-scale: 1.25;
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: var(--type-base);
    --text-lg: calc(var(--type-base) * var(--type-scale));
    /* ~1.25rem */
    --text-xl: calc(var(--text-lg) * var(--type-scale));
    /* ~1.56rem */
    --text-2xl: calc(var(--text-xl) * var(--type-scale));
    /* ~1.95rem */
    --text-3xl: calc(var(--text-2xl) * var(--type-scale));
    /* ~2.44rem */
    --text-4xl: calc(var(--text-3xl) * var(--type-scale));
    /* ~3.05rem */

    /* Line Heights - Optimized for Readability */
    --leading-tight: 1.1;
    --leading-snug: 1.3;
    --leading-normal: 1.6;
    --measure-optimal: 65ch;
    /* Optimal line length */

    /* 3. Layout & Structure - 8px Grid System */
    --space-unit: 8px;
    --space-1: var(--space-unit);
    /* 8px */
    --space-2: calc(var(--space-unit) * 2);
    /* 16px */
    --space-3: calc(var(--space-unit) * 3);
    /* 24px */
    --space-4: calc(var(--space-unit) * 4);
    /* 32px */
    --space-6: calc(var(--space-unit) * 6);
    /* 48px */
    --space-8: calc(var(--space-unit) * 8);
    /* 64px */
    --space-12: calc(var(--space-unit) * 12);
    /* 96px */

    --container-width: 1100px;
    /* Narrower for reading focus */
    --header-height: 64px;
    --border-radius: 8px;
    /* Softened visual edges */

    /* 4. UX Affordances */
    --shadow-subtle: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 8px 16px rgba(0, 0, 0, 0.06);
    --transition-base: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    /* Smooth micro-interactions */
    --touch-target: 48px;
    /* Interaction radius tuning */
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: var(--leading-normal);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    /* Anti-aliased font rendering */
}

/* Layout Structure */
.container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--space-3);
    gap: var(--space-6);
    /* Vertical rhythm */
}

/* Header - Modular Box Design */
header {
    background: transparent;
    border-bottom: none;
    padding: 2rem 0;
    /* Spacing above/below header */
    width: 100%;
    z-index: 2000;
    position: relative;
    /* Ensure overlay is positioned relative to header */
}

/* Reaction Button */
.reaction-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    padding: 0.5rem 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-weight: 500;
}

.reaction-btn:hover {
    border-color: var(--accent-warn);
    color: var(--accent-warn);
    background: #fff0f0;
}

.reaction-btn.reacted {
    border-color: var(--accent-warn);
    color: var(--accent-warn);
    background: #fff0f0;
}

.reaction-btn.reacted .heart-icon {
    fill: var(--accent-warn);
    stroke: var(--accent-warn);
}

.heart-icon {
    transition: all 0.2s ease;
}

.reaction-btn:active {
    transform: scale(0.95);
}

.header-modules {
    display: flex;
    gap: 2rem;
    align-items: stretch;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--space-3);
}

/* Common Module Styles */
.header-module {
    background: transparent;
    border: none;
    /* Deboxed */
    border-radius: 0;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 400;
    /* Lighter weight for elegance */
    font-size: 1rem;
    transition: opacity 0.2s ease;
    height: 56px;
    /* Fixed height for consistency */
    box-sizing: border-box;
}

.header-module:hover {
    opacity: 0.6;
    background: transparent;
    border-color: transparent;
}

/* Module 1: Logo */
.logo-module {
    flex-grow: 0;
    /* Don't expand */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    padding-bottom: 0.75rem;
    /* Space for underline */
}

.logo-text {
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
    font-weight: 800;
    /* Bolder logo */
    font-size: 1.1rem;
    /* Slightly larger */
}

.logo-underline {
    position: absolute;
    bottom: 12px;
    left: 1.5rem;
    right: 1.5rem;
    height: 2px;
    /* Thicker underline */
    background: var(--text-main);
    width: calc(100% - 3rem);
}

/* Module 2: RSS */
.rss-module {
    flex-grow: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 2rem;
}

/* Module 3: Support & Search */
.support-module {
    flex-grow: 1;
    /* Takes remaining space? Or maybe fixed width? */
    /* The image shows it taking significant space */
    justify-content: space-between;
    padding: 0 0.5rem 0 1.5rem;
    /* Less padding on right for input */
    gap: 1rem;
}

.support-trigger {
    background: none;
    border: none;
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0;
    color: var(--text-main);
    font-family: var(--font-sans);
}

.header-search-container {
    flex-grow: 1;
    display: flex;
    justify-content: flex-end;
}

.inline-search-input {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
    width: 200px;
    /* Fixed width for input */
    font-family: var(--font-sans);
    outline: none;
    transition: all 0.2s;
}

.inline-search-input:focus {
    border-color: var(--text-main);
    background: #fff;
    width: 240px;
    /* Expand on focus */
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    /* Hidden on desktop */
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    width: 56px;
    height: 56px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Mobile Nav Overlay */
/* Mobile Nav Overlay */
.mobile-nav-overlay {
    display: none;
    /* Hidden by default */
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem;
    z-index: 999;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    /* Add shadow for visibility */
}

.mobile-nav-overlay.active {
    display: block !important;
    /* Force display */
}

.mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mobile-nav a {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    padding: 1rem 0.5rem;
    /* Increased touch target */
    border-bottom: 1px solid #f0f0f0;
}

.mobile-search-container {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}

.mobile-search-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background: #fafafa;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 221, 0, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(255, 221, 0, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 221, 0, 0);
    }
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
    .header-modules {
        gap: 0.5rem;
    }

    .logo-text {
        font-size: 0.9rem;
    }

    .inline-search-input {
        width: 140px;
    }
}

@media (max-width: 768px) {

    .rss-module,
    .support-module {
        display: none;
        /* Hide desktop modules on mobile */
    }

    .mobile-menu-btn {
        display: flex;
    }

    .logo-module {
        flex-grow: 1;
    }

    .mobile-nav-overlay.active {
        display: block;
    }
}

/* Main Content */
main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
    /* Section pacing */
    padding-top: var(--space-4);
}

/* Hero - Typographic Hierarchy */
.hero {
    padding: var(--space-4) 0;
    text-align: left;
    max-width: var(--container-width);
}

.hero h1 {
    font-size: var(--text-4xl);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: var(--space-2);
    color: var(--text-main);
    line-height: var(--leading-tight);
    max-width: 20ch;
    /* Optical alignment */
}

.hero p {
    font-size: var(--text-xl);
    color: var(--text-muted);
    max-width: var(--measure-optimal);
    margin: 0;
    font-weight: 400;
    line-height: var(--leading-normal);
}

/* Magazine Layout System */
.magazine-layout {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

/* 1. Featured Hero */
.featured-hero {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--space-12);
    margin-bottom: var(--space-12);
}

.featured-card {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s;
}

.featured-card:hover {
    opacity: 0.8;
}

.featured-content {
    max-width: 900px;
}

.featured-title {
    font-size: var(--text-4xl);
    font-weight: 800;
    line-height: 1.1;
    margin: var(--space-2) 0;
    letter-spacing: -0.03em;
}

.featured-excerpt {
    font-size: var(--text-xl);
    color: var(--text-muted);
    line-height: 1.5;
    max-width: 65ch;
    margin-bottom: var(--space-3);
}

.read-more {
    font-weight: 600;
    font-size: var(--text-base);
    color: var(--text-main);
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* 2. Content Wrapper (Main + Sidebar) */
.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--space-8);
    align-items: start;
}

/* Featured Label */
.featured-label {
    display: inline-block;
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-2);
    border: 1px solid var(--accent-primary);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Main Feed Density */
.main-feed {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
    /* Increased from space-6 */
}

.feed-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--space-2);
    margin-bottom: var(--space-4);
    gap: 3rem;
    align-items: center;
}

.feed-header h2 {
    font-size: var(--text-xl);
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Feed Filters */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex-grow: 1;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 6px 12px;
    font-size: var(--text-xs);
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-btn:hover,
.filter-btn.active {
    border-color: var(--text-main);
    color: var(--text-main);
    background: #fff;
}

.sort-bar {
    margin-top: 0 !important;
}

/* Post Card Refinement */
.post-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    padding: var(--space-4);
    /* Add padding */
    border: 1px solid transparent;
    /* Invisible border */
    border-radius: 8px;
    transition: all 0.2s ease;
    margin: 0 -1rem;
    /* Negative margin to align content with header while allowing hover bg to expand */
}

.post-card:hover {
    background: #fafafa;
    border-color: var(--border-color);
}

/* Sidebar Newsletter Widget */
.sidebar-widget.newsletter-widget {
    background: #f0f4f8;
    /* Soft blue-gray */
    padding: var(--space-4);
    border-radius: 8px;
    border: 1px solid #d1d9e6;
}

.sidebar-widget.newsletter-widget h3 {
    color: var(--text-main);
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: calc(var(--header-height) + var(--space-4));
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    padding-left: var(--space-6);
    border-left: 1px solid var(--border-color);
}

.sidebar-widget h3 {
    font-size: var(--text-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 var(--space-3) 0;
}

.sidebar-widget p {
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

.sidebar-widget iframe {
    width: 100% !important;
    height: 320px;
    /* Default height */
    border: 1px solid var(--border-color) !important;
    border-radius: 8px;
}

/* Specific fix for Substack in sidebar */
.newsletter-widget iframe {
    background: white;
    /* Ensure it doesn't look cut off */
    min-width: 0;
    max-width: 100%;
}

.text-link {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
}

.text-link:hover {
    text-decoration: underline;
}

/* Collection List in Sidebar */
.collection-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.collection-link {
    display: flex;
    justify-content: space-between;
    text-decoration: none;
    color: var(--text-main);
    font-size: var(--text-base);
    padding: var(--space-1) 0;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.collection-link:hover {
    border-color: var(--border-color);
}

.collection-link .count {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* Sidebar Form */
.sidebar-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.sidebar-form input {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: var(--font-sans);
}

.sidebar-form button {
    background: var(--text-main);
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

/* Responsive Adjustments */
@media (max-width: 900px) {
    .content-wrapper {
        grid-template-columns: 1fr;
        /* Stack sidebar below */
        gap: var(--space-6);
    }

    .sidebar {
        position: static;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--border-color);
        padding-top: var(--space-6);
    }

    .featured-title {
        font-size: var(--text-3xl);
    }
}

.post-card {
    background: transparent;
    border: none;
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: opacity 0.2s ease;
    position: relative;
}

.post-card:last-child {
    border-bottom: none;
}

.post-card:hover {
    opacity: 0.7;
    transform: none;
    box-shadow: none;
}



/* Tag Color System */
.tag-color-0 {
    background: #e2e8f0;
    color: #475569;
    border-color: #cbd5e1;
}

/* Slate */
.tag-color-1 {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

/* Green */
.tag-color-2 {
    background: #e0e7ff;
    color: #3730a3;
    border-color: #c7d2fe;
}

/* Indigo */
.tag-color-3 {
    background: #ffedd5;
    color: #9a3412;
    border-color: #fed7aa;
}

/* Orange */
.tag-color-4 {
    background: #ccfbf1;
    color: #115e59;
    border-color: #99f6e4;
}

/* Teal */
.tag-color-5 {
    background: #fce7f3;
    color: #9d174d;
    border-color: #fbcfe8;
}

/* Pink */

.post-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: var(--text-xs);
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    /* For border colors to show */
    transition: all 0.2s;
}

.post-tag:hover {
    opacity: 0.9;
}

/* Series Indicator */
.series-indicator {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--accent-primary);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}



/* Related Posts */
.related-posts {
    margin-top: var(--space-12);
    border-top: 1px solid var(--border-color);
    padding-top: var(--space-8);
}

.related-header {
    font-size: var(--text-lg);
    font-weight: 700;
    margin-bottom: var(--space-6);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.related-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
}

/* Welcome Gate Overlay */
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.98);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(5px);
}

.welcome-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    max-width: 500px;
    width: 100%;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

.welcome-header h2 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.welcome-header p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.enter-btn {
    margin-top: 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: underline;
    transition: color 0.2s;
}

.enter-btn:hover {
    color: var(--text-main);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .related-grid {
        grid-template-columns: 1fr;
    }
}

/* Article Typography & Layout */
article {
    max-width: 680px;
    /* Optimal reading width */
    margin: 0 auto;
    font-size: 1.125rem;
    /* 18px base size */
    line-height: 1.8;
    color: var(--text-main);
}

article h1,
article h2,
article h3,
article h4,
article h5,
article h6 {
    font-family: var(--font-serif);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

article h1 {
    font-size: var(--text-4xl);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: var(--space-4);
    letter-spacing: -0.03em;
}

article h2 {
    font-size: var(--text-2xl);
    font-weight: 800;
    margin-top: var(--space-12);
    margin-bottom: var(--space-4);
    letter-spacing: -0.03em;
    color: var(--text-main);
}

article h3 {
    font-size: var(--text-xl);
    font-weight: 700;
    margin-top: var(--space-8);
    margin-bottom: var(--space-3);
    color: var(--text-main);
    letter-spacing: -0.02em;
}

article p {
    margin-bottom: var(--space-4);
    color: #333;
    /* Slightly softer black for reading */
}

article ul,
article ol {
    margin-bottom: var(--space-4);
    padding-left: var(--space-4);
}

article li {
    margin-bottom: var(--space-2);
    padding-left: var(--space-2);
}

article blockquote {
    border-left: 4px solid var(--accent-primary);
    margin: var(--space-6) 0;
    padding: var(--space-2) var(--space-4);
    font-style: italic;
    font-size: 1.25rem;
    color: var(--text-main);
    background: #f8f9fa;
    border-radius: 0 8px 8px 0;
}

article strong {
    font-weight: 700;
    color: var(--text-main);
}

article em {
    font-style: italic;
    color: var(--text-main);
}

article a {
    color: var(--accent-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

article a:hover {
    color: var(--text-main);
}

/* Post Header Meta */
.post-tags {
    margin-bottom: var(--space-4);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-top: auto;
    padding-top: var(--space-3);
}

.back-link {
    display: inline-block;
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
}

.back-link:hover {
    color: var(--text-main);
}

.post-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    height: 100%;
}

.post-meta {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    opacity: 0.7;
}

.post-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    margin: 0;
    line-height: var(--leading-snug);
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.post-excerpt {
    display: block;
    font-size: var(--text-base);
    color: var(--text-muted);
    line-height: var(--leading-normal);
    margin-top: var(--space-1);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-tag {
    font-size: var(--text-xs);
    color: var(--text-muted);
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
    text-decoration: none;
    transition: var(--transition-base);
    font-weight: 500;
}

.post-tag:hover {
    background: var(--text-main);
    color: white;
}

/* Mobile Actions */
.mobile-actions {
    display: none;
}

.mobile-menu-btn,
.mobile-search-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile Optimizations - Viewport Adaptive */
@media (max-width: 768px) {
    :root {
        --type-scale: 1.2;
        /* Reduce scale on mobile */
        --space-unit: 6px;
        /* Tighter spacing */
    }

    .container {
        padding: 0 var(--space-3);
    }

    .header-content {
        padding: 0 var(--space-3);
    }

    .nav-center,
    .desktop-search-btn {
        display: none;
        /* Hide desktop nav and search on mobile */
    }

    .mobile-actions {
        display: flex;
        align-items: center;
        gap: var(--space-2);
    }

    .nav-center.active {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--panel-bg);
        border-bottom: 1px solid var(--border-color);
        padding: var(--space-4);
        box-shadow: var(--shadow-md);
        z-index: 95;
    }

    .nav-links {
        flex-direction: column;
        width: 100%;
        gap: var(--space-2);
    }

    .nav-links a {
        width: 100%;
        justify-content: center;
        background: var(--bg-color);
    }

    .posts-grid {
        grid-template-columns: 1fr;
        /* Single column */
        gap: var(--space-3);
    }

    .hero h1 {
        font-size: var(--text-3xl);
    }

    .post-card {
        min-height: auto;
    }
}

/* Search Overlay */
.search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.98);
    z-index: 2000;
    flex-direction: column;
    align-items: center;
    padding-top: 100px;
}

.search-container {
    width: 100%;
    max-width: 800px;
    padding: 0 var(--space-4);
}

.search-header {
    display: flex;
    align-items: center;
    border-bottom: 2px solid var(--text-main);
    padding-bottom: var(--space-2);
    margin-bottom: var(--space-6);
}

#search-input {
    width: 100%;
    border: none;
    background: transparent;
    font-family: var(--font-serif);
    font-size: var(--text-3xl);
    color: var(--text-main);
    outline: none;
}

#close-search {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

#close-search:hover {
    color: var(--text-main);
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    max-height: 70vh;
    overflow-y: auto;
}

.search-result-item {
    text-decoration: none;
    display: block;
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

.search-result-item h3 {
    font-family: var(--font-serif);
    font-size: var(--text-xl);
    margin: 0 0 var(--space-1) 0;
    color: var(--text-main);
}

.search-result-item p {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin: 0 0 var(--space-2) 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-item .meta {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.search-trigger {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
    padding: 0;
    display: flex;
    align-items: center;
}

.logo-module {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-main);
    position: relative;
    padding-bottom: 4px;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}

.logo-text {
    font-family: var(--font-sans);
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

.logo-tagline {
    font-family: var(--font-serif);
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 2px;
    font-weight: 400;
    text-transform: none;
}

.logo-underline {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--text-main);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.no-results {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    margin-top: var(--space-4);
}

/* Custom Floating Support Button */
.floating-support-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: #ffffff;
    border: 1px solid #eaeaea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow: hidden;
}

.floating-support-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    border-color: #000;
}

.floating-support-btn img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    margin: 0;
    /* Override default img margin */
}

.floating-support-btn:hover img {
    opacity: 1;
}

@media (max-width: 768px) {
    .floating-support-btn {
        bottom: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
    }
}

/* Hide default BMC launcher to use our custom one */
#bmc-wbtn {
    display: none !important;
}

/* Consulting Form */
.consulting-form {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.form-group input,
.form-group textarea {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: var(--font-serif);
    font-size: 1rem;
    background: #fafafa;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--text-main);
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.submit-btn {
    background: var(--text-main);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 4px;
    align-self: flex-start;
    transition: opacity 0.2s;
}

.submit-btn:hover {
    opacity: 0.9;
}


.inline-newsletter {
    flex-direction: column;
    align-items: flex-start;
    padding: var(--space-4) 0;
}

.inline-form {
    width: 100%;
    max-width: none;
}

@media (max-width: 768px) {
    .inline-newsletter {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }

    .inline-form {
        width: 100%;
        max-width: none;
    }
}

/* Bottom Newsletter */
.bottom-newsletter {
    margin-top: var(--space-8);
    margin-bottom: var(--space-8);
    width: 100%;
    display: flex;
    justify-content: center;
}

.bottom-newsletter iframe {
    max-width: 600px;
    width: 100%;
    border-radius: 8px;
}