/* ==========================================
     ACCESSIBILITY: Focus Indicators & Motion
     ========================================== */

/* Focus indicators for track cards (bootlegs grid) */
[data-track-url]:focus-visible {
    outline: 2px solid #ffffff !important;
    outline-offset: 2px !important;
}

/* Play buttons in grid cards */
.play-btn:focus-visible {
    outline: 2px solid #000000 !important;
    outline-offset: -2px !important;
}

/* Respect prefers-reduced-motion for all animations */
@media (prefers-reduced-motion: reduce) {

    /* Disable marquee animations */
    .marquee-content.animate {
        animation: none !important;
    }

    /* Disable on-air pulse */
    .animate-pulse {
        animation: none !important;
    }

    /* Instant transitions only */
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================
     BLOG MODAL & RESPONSIVE FIXES
     ========================================== */

@media (max-width: 600px) {

    /* Blog Modal: Neo-Brutalist Mobile - Adjusted for size */
    #blog-modal>div {
        max-width: 90vw !important;
        width: 90vw !important;
        padding: 1rem !important;
        border-radius: 0 !important;
        border: 2px solid var(--border-color) !important;
        top: 0 !important;
        left: 0 !important;
        margin: 0 auto !important; /* Center horizontally */
        box-sizing: border-box;
        max-height: 85vh !important; /* Reduced from 95vh */
    }

    #blog-modal h2 {
        font-size: 1.3rem !important;
        margin-bottom: 1rem !important;
    }

    #blog-modal .blog-content {
        font-size: 0.9rem !important;
        line-height: 1.6 !important;
    }

    /* Modal Close Button Mobile */
    #blog-modal button[onclick*="closeBlogModal"] {
        right: 1rem !important;
        top: 1rem !important;
        width: 2.5rem !important;
        height: 2.5rem !important;
        font-size: 1.6rem !important;
        border: 2px solid var(--border-color) !important;
    }

    /* Blog Post Cards Mobile */
    .blog-post-card {
        padding: 1.5rem 0 !important;
    }

    .blog-post-title {
        font-size: 1.1rem !important;
    }

    /* Blog Listing: Reset margins to center content */
    main .max-w-4xl {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    /* H1 kleiner */
    main h1 {
        font-size: 1.2rem !important;
        margin-bottom: 1.2rem !important;
    }

    /* Menü Overlay: kleinere Schrift und Abstand zum Burger-Icon */
    .menu-overlay {
        padding-left: 3.5rem !important;
        padding-right: 0.5rem !important;
    }

    .menu-nav .nav-link {
        font-size: clamp(2rem, 7vw, 3.2rem) !important;
        margin-bottom: 1.2rem !important;
        line-height: 1.1 !important;
        word-break: break-word;
    }
}

/* ==========================================
   SHARED STYLES - Verwendet auf ALLEN Seiten
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&display=swap');

:root {
    /* Light Mode (default) */
    --bg-color: #fafafa;
    --bg-secondary: #f0f0f0;
    --text-color: #0f172a;
    --text-muted: #64748b;
    --text-subtle: rgba(15, 23, 42, 0.45);
    --accent-color: #0f172a;
    --border-color: #e5e7eb;
    --border-subtle: rgba(15, 23, 42, 0.08);
    --card-bg: #ffffff;
    --overlay-bg: rgba(250, 250, 250, 0.95);
    --code-bg: rgba(15, 23, 42, 0.05);
    --shadow-color: rgba(0, 0, 0, 0.1);

    /* Grid Background */
    --grid-color: rgba(15, 23, 42, 0.06);
    --grid-size: 20px;
    --grid-thickness: 1px;

    /* Typography Scale (Modular) */
    --font-xs: 10px;
    --font-sm: 12px;
    --font-base: 14px;
    --font-md: 16px;
    --font-lg: 20px;
    --font-xl: 24px;
    --font-2xl: 32px;
    --font-3xl: 48px;
    --font-4xl: 64px;

    /* Blog Font Utility */
    --font-family-blog: 'JetBrains Mono', monospace;

    /* Spacing (4px grid) */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 20px;
    --spacing-2xl: 24px;
    --spacing-3xl: 32px;
    --spacing-4xl: 40px;
    --spacing-5xl: 48px;
    --spacing-6xl: 56px;
    --spacing-7xl: 64px;

    /* Tonal Grayscale */
    --gray-0: #000000;
    --gray-20: #333333;
    --gray-40: #666666;
    --gray-60: #999999;
    --gray-80: #cccccc;
    --gray-100: #ffffff;

    /* Motion */
    --transition-duration: 300ms;
    --transition-easing: cubic-bezier(0.22, 1, 0.36, 1);
    --animation-duration: 400ms;
}

html.dark {
    --bg-color: #0a0a0a;
    --bg-secondary: #141414;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --text-subtle: rgba(255, 255, 255, 0.45);
    --accent-color: #ffffff;
    --border-color: rgba(255, 255, 255, 0.1);
    --border-subtle: rgba(255, 255, 255, 0.05);
    --card-bg: #111111;
    --overlay-bg: rgba(0, 0, 0, 0.95);
    --code-bg: rgba(255, 255, 255, 0.05);
    --shadow-color: rgba(0, 0, 0, 0.4);

    /* Grid Background */
    --grid-color: rgba(255, 255, 255, 0.04);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    line-height: 1.2;
    margin: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.font-blog-style {
    font-family: var(--font-family-blog);
}

/* ==========================================
    HAMBURGER MENU & NAVIGATION
    ========================================== */

.hamburger-container {
    position: fixed;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Fixed dimensions to prevent shifting */
    width: 50px;
    height: 50px;
}

/* Reposition hamburger to top-right on mobile */
@media (max-width: 768px) {
    .hamburger-container {
        top: 25px;
        left: auto;
        right: 20px;
        transform: none; /* Remove vertical centering */
        width: 32px;
        height: 32px;
    }

    .page-label {
        display: none;
    }
}

.hamburger-btn {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: transform var(--transition-duration) var(--transition-easing),
        opacity var(--transition-duration) var(--transition-easing);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    opacity: 0.56;
    /* Touch target: minimum 44x44px */
    min-width: 44px;
    min-height: 44px;
}

@media (max-width: 768px) {
    .hamburger-btn {
        min-width: unset;
        min-height: unset;
    }
}

.hamburger-btn:hover {
    opacity: 1;
    transform: scale(1.1) skewX(-2deg);
}

.hamburger-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 4px;
}

/* Hamburger Icon Lines */
.hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    height: 100%;
}

@media (max-width: 768px) {
    .hamburger-line {
        height: 6px;
    }
}

.hamburger-line {
    width: 100%;
    height: 8px;
    background-color: currentColor;
    transition: all 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Active state animations */
.hamburger-icon.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(24px, 24px);
    background-color: var(--text-color) !important;
}

.hamburger-icon.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-icon.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(24px, -24px);
    background-color: var(--text-color) !important;
}

/* Burger Icon Colors */
#burgerIcon {
    color: var(--text-color) !important;
    transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1),
        color 300ms cubic-bezier(0.22, 1, 0.36, 1) !important;
}

#burgerIcon.active,
#burgerIcon.open {
    color: var(--text-color) !important;
}

/* Fullscreen Menu Overlay */
.menu-overlay {
    position: fixed;
    inset: 0;
    transform: translateY(-100vh);
    transition: transform 480ms cubic-bezier(0.22, 1, 0.36, 1), opacity 360ms ease;
    opacity: 0;
    overflow: hidden;
    padding-left: 10%;
    padding-right: 10%;
    display: flex;
    align-items: center;
    background: var(--bg-color);
    color: var(--text-color);
    z-index: 9990;
}

.menu-overlay.active {
    transform: translateY(0);
    opacity: 1;
}

@media (max-width: 600px) {
    .menu-overlay {
        padding-left: 20% !important;
        padding-right: 5% !important;
    }
}

.menu-nav {
    width: 100%;
}

/* Swiss Typography - Navigation Links */
.nav-link {
    font-size: clamp(5rem, 12vw, 10rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.03em;
    line-height: 0.85;
    /* Smooth return transition */
    transition: color 0.4s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), font-style 0.4s ease;
    display: block;
    margin-bottom: 2rem;
    color: var(--text-color);
    text-decoration: none;
    font-style: normal;
}

.nav-link:hover {
    color: var(--text-muted);
    /* Snappy hover entry to eliminate lag */
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s ease;
    transform: skewX(-4deg);
    font-style: italic;
}

.nav-link:active {
    transform: skewX(-6deg);
    font-style: italic;
}

/* ==========================================
   HEADER & BRANDING
   ========================================== */

.jodworks-header {
    font-family: 'Instrument Serif', serif;
    font-size: 90px;
    line-height: 90px;
    opacity: 0.56;
    position: fixed;
    top: 30px;
    left: 30px;
    z-index: 40;
}

@media (max-width: 768px) {
    .jodworks-header {
        font-size: 42px;
        line-height: 42px;
        top: 25px;
        left: 20px; /* Left-aligned, burger is now top-right */
    }
}

/* ==========================================
   CANVAS & MATRIX RAIN EFFECT
   ========================================== */

#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    z-index: -1;
    display: none;
    width: 100%;
    height: 100%;
    opacity: 0.2;
}

#matrix-canvas.active {
    display: block;
    opacity: 0.85;
}

/* When matrix is active: transparent body so canvas (z-index: -1) shines through */
html:has(#matrix-canvas.active) {
    background-color: #000;
}

body:has(#matrix-canvas.active) {
    background-color: transparent;
}

/* Hide grid pattern on main when matrix is active */
body:has(#matrix-canvas.active) main {
    background-image: none;
    background-color: transparent;
}

/* ==========================================
   MATRIX TOGGLE BUTTON
   ========================================== */

.matrix-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9998;
    /* Above all content including global player (z-40) */
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 12px;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 2px;
}

/* Hide Matrix Toggle when Menu is Open */
body.menu-open .matrix-toggle {
    display: none !important;
    pointer-events: none;
    opacity: 0;
}

/* Mobile Matrix Toggle Position */
@media (max-width: 768px) {
    .matrix-toggle {
        bottom: 20px;
        right: 20px;
        transition: bottom 0.5s ease;
        font-size: 10px; /* Smaller font on mobile */
        padding: 6px 10px;
    }

    /* When player is active (class added to body via JS) */
    body.player-active .matrix-toggle {
        bottom: 160px; /* Increased clearance for player */
    }
}


html:not(.dark) .matrix-toggle {
    display: none !important;
}

.matrix-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Matrix Toggle in Footer (Essence Page) */
.matrix-toggle-footer {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 12px;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 2px;
}

.matrix-toggle-footer:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.4);
}

@media (max-width: 768px) {
    .matrix-toggle-footer {
        font-size: 10px;
        padding: 6px 10px;
    }
}

/* ==========================================
   SECTION LABEL (Page Title)
   ========================================== */

#current-section-label {
    position: absolute;
    bottom: 100%;
    left: 50%;
    margin-bottom: 1.5rem;
    font-family: 'Inter', sans-serif;
    font-size: clamp(10px, 2vw, 14px);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 1;
    color: var(--text-muted);
    transition: color 0.3s ease;
    user-select: none;
    pointer-events: none;
    /* Center horizontally and rotate */
    transform: translateX(-50%) rotate(180deg);
    transform-origin: center;
}

@media (max-width: 768px) {
    #current-section-label {
        display: none; /* Hide vertical label on mobile to prevent overlap */
    }
}

/* Mobile: Reset main padding for ALL pages to prevent header overlap */
@media (max-width: 768px) {
    main {
        padding-top: 120px !important; /* increased to clear header */
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
        padding-bottom: 220px !important; /* ample space for audio player + matrix toggle (which sits at 160px up) */
    }
    
    /* Specific override if needed for specific classes, but general rule above should catch most */
    main.min-h-screen {
        padding-top: 120px !important;
    }
}

/* ==========================================
   VERTICAL TEXT UTILITY
   ========================================== */

.vertical-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    /* Rotation is now handled in #current-section-label */
    white-space: nowrap;
}

/* ==========================================
   PAGE CONTENT
   ========================================== */

main {
    min-height: 100vh;
    padding-top: 100px;
    padding-left: 48px;
    padding-right: 48px;
}

main h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 900;
    margin-bottom: 48px;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

main p {
    font-size: 18px;
    line-height: 1.6;
    opacity: 0.8;
}

main {
    background-image:
        /* Vertical lines */
        linear-gradient(90deg,
            var(--grid-color) var(--grid-thickness),
            transparent var(--grid-thickness)),
        /* Horizontal lines */
        linear-gradient(0deg,
            var(--grid-color) var(--grid-thickness),
            transparent var(--grid-thickness));
    background-size:
        var(--grid-size) var(--grid-size),
        var(--grid-size) var(--grid-size);
    background-attachment: fixed;
}

main.fade-transition {
    transition: opacity 220ms ease;
}

main.fade-transition[style] {
    transition: opacity 220ms ease !important;
}

/* ==========================================
   ACCESSIBILITY & SCREEN READERS
   ========================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .hamburger-line {
        background-color: #ffffff;
        height: 3px;
    }

    .menu-overlay {
        background: rgba(0, 0, 0, 0.98);
    }

    .nav-link {
        color: #ffffff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    .hamburger-btn,
    .hamburger-icon,
    .hamburger-line,
    .menu-overlay,
    .nav-link {
        transition: none;
    }

    .menu-overlay.active .nav-link {
        transition-delay: 0s;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {

    .hamburger-container,
    .menu-overlay {
        display: none !important;
    }
}

/* ==========================================
   MARQUEE ANIMATION
   ========================================== */
.marquee-container {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    mask-image: linear-gradient(to right, transparent 0%, black 2%, black 98%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 2%, black 98%, transparent 100%);
}

.marquee-content {
    display: inline-block;
    white-space: nowrap;
}

.marquee-content.animate {
    animation: marquee 15s linear infinite;
    padding-right: 50px;
    /* Gap between repeats */
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* ==========================================
   BLOG MODAL STYLES
   ========================================== */

#blog-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.60);
    pointer-events: auto;
    overflow: auto;
}

#blog-modal>div {
    max-width: min(32rem, 96vw);
    width: 100%;
    min-width: 0;
    padding: 1.5rem 1.2rem 1.2rem 1.2rem;
    border-radius: 1rem;
    border: 1.5px solid var(--border-color);
    background: var(--card-bg);
    box-shadow: 0 8px 32px var(--shadow-color);
    color: var(--text-color);
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    margin-top: 0;
}

#blog-modal h2 {
    margin-top: 0.5rem;
    margin-right: 2.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: 0.02em;
}

#blog-modal .blog-date {
    color: var(--text-subtle);
    font-size: 0.95rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

#blog-modal .blog-content {
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
}

#blog-modal button[onclick*="closeBlogModal"] {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    font-size: 2.2rem;
    color: rgba(255, 255, 255, 0.55);
    background: none;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: color 0.2s;
    z-index: 2;
}

#blog-modal button[onclick*="closeBlogModal"]:hover {
    color: rgba(255, 255, 255, 0.95);
}

@media (max-width: 600px) {
    #blog-modal {
        align-items: center;
        justify-content: center;
        padding: 1rem;
        overflow: hidden;
    }

    #blog-modal>div {
        max-width: 98vw;
        width: 98vw;
        padding: 1rem 0.5rem 0.8rem 0.5rem;
        gap: 1rem;
        margin-top: 2.5rem;
        margin-right: 0.5rem;
        max-height: 92vh;
    }

    #blog-modal h2 {
        margin-right: 2.2rem;
    }

    #blog-modal button[onclick*="closeBlogModal"] {
        right: 0.5rem;
        top: 0.5rem;
    }
}

/* ==========================================
   RESPONSIVE DESIGN - Comprehensive Mobile-First
   ========================================== */

/* Extra small devices (< 380px) */
@media (max-width: 380px) {
    main {
        padding-top: 150px !important;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    main h1 {
        font-size: 1.5rem !important;
        margin-bottom: 1.5rem !important;
    }

    main p {
        font-size: 15px !important;
    }

    main .max-w-4xl, main #bootlegs-grid {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Bootlegs Grid: Single Column & fit width */
    #bootlegs-grid .grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    /* Audio Player: Shift away from burger menu, keep centered in remaining space */


    /* Bootlegs Grid: Full width on extra small screens */
    main #bootlegs-grid {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    .hamburger-container {
        width: 40px;
        height: 40px;
    }

    .hamburger-line {
        height: 6px !important;
    }

    .jodworks-header {
        font-size: 36px !important;
        line-height: 36px !important;
        top: 10px !important;
        left: 10px !important;
    }

    .nav-link {
        font-size: clamp(2.5rem, 10vw, 5rem) !important;
        margin-bottom: 1rem !important;
    }
}

/* Small devices (340px - 600px) */
@media (max-width: 600px) {

    html,
    body {
        font-size: 14px;
    }

    main {
        padding-top: 6rem !important;
        padding-left: 1.5rem !important; /* Reset left padding */
        padding-right: 1.5rem !important;
        min-height: auto;
    }

    /* Additional safety for very small screens */
    .hero-container {
         padding-left: 1rem !important;
         padding-right: 1rem !important;
    }

    main h1 {
        font-size: clamp(1.8rem, 6vw, 2.5rem) !important; /* Adjusted size */
        margin-bottom: 1.5rem !important;
    }

    main p {
        font-size: 15px !important;
        line-height: 1.5 !important;
    }

    main .max-w-4xl {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        box-sizing: border-box;
    }

    .max-w-4xl {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Center content grids on log/essence pages while keeping text left-aligned */
    main .max-w-7xl {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Reset grid columns on mobile to single column, centered */
    main .max-w-7xl > div {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }



    /* Bootlegs Grid: Full width on mobile */
    main #bootlegs-grid {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    .max-w-lg {
        max-width: 100% !important;
    }

    /* Cards, articles responsive */
    article {
        padding: 0.5rem 0 !important;
        margin-bottom: 1rem !important;
    }

    /* Buttons responsive */
    button {
        min-height: 44px !important;
        min-width: 44px !important;
    }

    /* Links easier to tap */
    a {
        padding: 0.5rem 0 !important;
    }
}

/* Medium devices (600px - 768px) */
@media (min-width: 601px) and (max-width: 768px) {
    main {
        padding-top: 120px !important;
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }

    main h1 {
        font-size: 2rem !important;
        margin-bottom: 2rem !important;
    }

    main p {
        font-size: 16px !important;
    }

    /* Audio Player: Bottom right on mobile, will switch to top-right on larger screens via md: classes */
    #global-player {
        bottom: 30px !important;
        right: 30px !important;
        top: auto !important;
        left: auto !important;
        width: auto !important;
        max-width: 80vw !important;
    }
}

/* Large devices (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    main {
        padding-top: 180px !important;
        padding-left: 3rem !important;
        padding-right: 3rem !important;
    }

    main h1 {
        font-size: clamp(2rem, 5vw, 3rem) !important;
        margin-bottom: 2.5rem !important;
    }

    main p {
        font-size: 17px !important;
    }

    /* Audio Player: Small corner player */
    #global-player {
        top: 30px !important;
        right: 30px !important;
        bottom: auto !important;
        left: auto !important;
        width: auto !important;
        max-width: 80vw !important;
    }
}

/* Extra large devices (> 1024px) */
@media (min-width: 1025px) {
    main {
        padding-top: 180px !important;
        padding-left: 48px !important;
        padding-right: 48px !important;
    }

    main h1 {
        font-size: clamp(2.5rem, 5vw, 4rem) !important;
        margin-bottom: 48px !important;
    }

    main p {
        font-size: 18px !important;
    }

    /* Audio Player: Small corner player */
    #global-player {
        top: 30px !important;
        right: 30px !important;
        bottom: auto !important;
        left: auto !important;
        width: auto !important;
        max-width: 90vw !important;
    }
}

/* ==========================================
   RESPONSIVE IMAGES & MEDIA
   ========================================== */

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

iframe {
    max-width: 100%;
}

/* ==========================================
     BLOG STYLING - NEO-BRUTALIST SWISS DESIGN
     ========================================== */

/* Blog Posts List - Grid Layout */
#blog-posts {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Blog Post Cards - Neo-Brutalism */
.blog-post-card {
    display: block;
    padding: 2.5rem 0;
    border-bottom: 2px solid var(--border-subtle);
    transition: all 320ms cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
}

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

.blog-post-card {
    transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

.blog-post-card:hover {
    padding-left: 1rem;
    padding-right: 1rem;
    margin-left: -1rem;
    margin-right: -1rem;
    transform: skewX(-2deg);
}

.blog-post-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.blog-post-title {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(1.3rem, 4vw, 2rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0;
    color: var(--text-color);
    text-transform: uppercase;
    transition: all 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.blog-post-card:hover .blog-post-title {
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: -0.01em;
    font-style: italic;
}

.blog-post-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    color: var(--text-subtle);
    text-transform: uppercase;
}

.blog-post-preview {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    font-weight: 400;
    line-height: 1.7;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Blog Modal - Neo-Brutalist */
#blog-modal {
    font-family: 'JetBrains Mono', monospace;
    background: var(--overlay-bg);
    backdrop-filter: blur(8px);
}

#blog-modal>div {
    width: 90vw;
    max-width: 1000px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--card-bg);
    border: 3px solid var(--border-color);
    border-radius: 0;
    padding: 3rem;
    box-shadow: 0 20px 60px var(--shadow-color), 0 0 0 1px var(--border-subtle);
    animation: slideUp 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

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

#blog-modal h2 {
    font-family: 'Inter', sans-serif;
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.05em;
    text-transform: uppercase;
    margin: 0 0 1.5rem 0;
    color: var(--text-color);
    line-height: 1;
}

.blog-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    color: var(--text-subtle);
    text-transform: uppercase;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-subtle);
    padding-bottom: 1.5rem;
}

#blog-modal .blog-content {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-muted);
}

/* Blog Content Typography */
#blog-modal .blog-content p {
    margin: 0 0 1.5rem 0;
    color: var(--text-muted);
}

#blog-modal .blog-content strong,
#blog-modal .blog-content b {
    color: var(--text-color);
    font-weight: 700;
}

#blog-modal .blog-content em,
#blog-modal .blog-content i {
    font-style: italic;
    color: var(--text-color);
}

#blog-modal .blog-content code {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    padding: 0.2em 0.4em;
    border-radius: 2px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
    color: var(--text-color);
}

#blog-modal .blog-content pre {
    background: var(--code-bg);
    border: 2px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 0;
    overflow-x: auto;
    margin: 2rem 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

#blog-modal .blog-content blockquote {
    border-left: 4px solid var(--border-color);
    padding-left: 1.5rem;
    margin: 2rem 0;
    color: var(--text-muted);
    font-style: italic;
}

#blog-modal .blog-content ul,
#blog-modal .blog-content ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

#blog-modal .blog-content li {
    margin: 0.5rem 0;
    color: var(--text-muted);
}

#blog-modal .blog-content a {
    color: #0066cc !important;
    text-decoration: underline !important;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    transition: color 200ms ease;
}

#blog-modal .blog-content a:hover {
    color: #0088ff !important;
}

#blog-modal .blog-content img {
    max-width: 100%;
    height: auto;
    margin: 2rem 0;
    border: 2px solid var(--border-color);
    display: block;
}

#blog-modal .blog-content hr {
    border: none;
    border-top: 2px solid var(--border-color);
    margin: 2rem 0;
}

/* Modal Close Button - Neo-Brutalist */
#blog-modal button[onclick*="closeBlogModal"] {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 3rem;
    height: 3rem;
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-muted);
    font-size: 1.8rem;
    font-weight: 300;
    cursor: pointer;
    transition: all 200ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#blog-modal button[onclick*="closeBlogModal"]:hover {
    border-color: var(--text-color);
    color: var(--text-color);
    background: var(--code-bg);
}

/* ==========================================
    RESPONSIVE TYPOGRAPHY
    ========================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

p,
li,
td,
th {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Download Button Swiss Style */
.download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--code-bg);
    border: 1.5px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 0.35em 0.6em;
    font-size: 1.1em;
    transition: background 0.2s, color 0.2s, border 0.2s;
    margin-left: 0.5em;
    outline: none;
}

.download-btn:hover,
.download-btn:focus {
    background: var(--bg-secondary);
    color: var(--text-color);
    border-color: var(--text-color);
}

.download-btn svg {
    display: block;
    width: 1.2em;
    height: 1.2em;
}
/* ==========================================
   HERO & TEXT STYLES (Shared from Home)
   ========================================== */

/* Hero Container */
.hero-container {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 35vh;
    padding-bottom: 35vh;
    padding-left: 20px;
    padding-right: 20px;
}

/* Reading-full block: keep exact line breaks and center on page */
.reading-full {
    white-space: pre-line;
    text-align: center;
    max-width: 820px;
    margin: 0 auto;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 2.6vw, 1.4rem);
    line-height: 1.6;
    color: var(--accent-color);
    z-index: 20;
}

/* Hide Hero Content when Menu is Open */
body.menu-open .hero-container {
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
}

/* ==========================================
   THEME TOGGLE (in Menu Overlay)
   ========================================== */

.theme-toggle-container {
    position: absolute;
    top: 40px;
    left: 40px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
}

.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 1.5px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 2px;
    padding: 0;
}

.theme-toggle-btn:hover {
    border-color: var(--text-color);
    color: var(--text-color);
    background: var(--bg-secondary);
}

.theme-toggle-btn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.theme-toggle-btn .sun-icon {
    display: none;
}

.theme-toggle-btn .moon-icon {
    display: block;
}

html.dark .theme-toggle-btn .sun-icon {
    display: block;
}

html.dark .theme-toggle-btn .moon-icon {
    display: none;
}

.theme-toggle-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    user-select: none;
}

.networked-text {
    position: absolute;
    bottom: 40px;
    right: 40px;
    font-size: 11px;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .theme-toggle-container {
        top: 20px;
        left: 20px;
    }
    
    .networked-text {
        bottom: 30px;
        right: 30px;
    }
}

/* Hide toggle in overlay on desktop - keep only persistent one */
@media (min-width: 769px) {
    .menu-overlay .theme-toggle-container {
        display: none;
    }
}

/* ==========================================
   PERSISTENT THEME TOGGLE (Always Visible)
   ========================================== */

.theme-toggle-persistent {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 2px;
    padding: 0;
}

.theme-toggle-persistent:hover {
    background: var(--bg-secondary);
    color: var(--text-color);
    border-color: var(--text-muted);
}

.theme-toggle-persistent svg {
    width: 18px;
    height: 18px;
}

/* Hide when menu is open */
body.menu-open .theme-toggle-persistent {
    display: none !important;
}

@media (max-width: 768px) {
    /* Hide persistent toggle on mobile - only show in menu overlay */
    .theme-toggle-persistent {
        display: none !important;
    }
}

