/* ================================
   MODERN JOURNAL.KIM STYLES
   Updated: October 2025
   ================================ */

/* CSS Variables for theming */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --success-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    
    --primary-color: #667eea;
    --secondary-color: #f5576c;
    --accent-color: #00f2fe;
    --text-dark: #2d3748;
    --text-light: #718096;
    --bg-light: #f7fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.2);
    
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Body enhancements */
body {
    background: linear-gradient(to bottom, #f7fafc 0%, #edf2f7 100%);
    position: relative;
    font-family: 'Lora', Georgia, serif;
    overflow-x: hidden;
}

/* Constrain main content width on desktop */
main {
    max-width: 100%;
}

#content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Animated background pattern - static, no animation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(245, 87, 108, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(0, 242, 254, 0.03) 0%, transparent 50%);
    z-index: -1;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

h1 {
    color: var(--text-dark);
}

h2 {
    color: var(--text-dark);
    position: relative;
    padding-bottom: 0.5rem;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--primary-gradient);
    border-radius: 2px;
}


/* Text selections */
::selection {
    background: rgba(102, 126, 234, 0.3);
    color: var(--text-dark);
}

/* Links */
a {
    color: var(--primary-color);
    text-decoration: none;
    position: relative;
    transition: color var(--transition-base);
    border-bottom: 2px solid transparent;
}

a::before {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background: var(--primary-gradient);
    transition: width var(--transition-base);
}

a:hover::before {
    width: 100%;
}

a:hover {
    color: #764ba2;
}

a:visited {
    color: #764ba2;
}

/* Fix visited links in navigation and badges */
#navigation a:visited,
.badge:visited,
.tag:visited,
#pages a:visited,
.read-more:visited {
    color: inherit;
}

/* Mark/Highlight */
mark {
    background: linear-gradient(120deg, rgba(102, 126, 234, 0.2) 0%, rgba(245, 87, 108, 0.2) 100%);
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
}

/* Code blocks */
code {
    font-size: 0.9rem;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    color: var(--primary-color);
    font-weight: 500;
}

pre code {
    display: block;
    padding: 1.5rem;
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary-color);
}

/* Blockquotes - Modern card style */
blockquote {
    background: var(--bg-card);
    border-left: 4px solid transparent;
    border-image: var(--primary-gradient) 1;
    padding: 1.25rem 1.25rem 1.25rem 1.75rem;
    margin: 1.5rem 0;
    font-style: italic;
    box-shadow: var(--shadow-md);
    border-radius: 8px;
    position: relative;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

blockquote::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 20px;
    font-size: 4rem;
    color: var(--primary-color);
    opacity: 0.2;
    font-family: Georgia, serif;
}

blockquote:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* Header styles */
header {
    padding: 1rem;
}

#title {
    text-align: center;
    margin-bottom: 1rem;
}

#title {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#title a {
    background: var(--primary-gradient);
    color: white !important;
    text-decoration: none;
    padding: 8px 20px;
    border-radius: 50px;
    display: inline-block;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    font-weight: 700;
    letter-spacing: 0.02em;
}

#title a:visited {
    color: white !important;
}

#title a:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Quote section */
#quote {
    max-width: 40ch;
    margin: 1.5rem auto;
    font-size: 1rem;
    text-align: center;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

#quote::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
}

/* Navigation */
#navigation {
    text-align: center;
    margin: 1rem 0;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#navigation a {
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.4rem 0.8rem;
    margin: 0.2rem;
    display: inline-block;
    color: var(--text-dark);
    border-radius: 8px;
    transition: all var(--transition-base);
    position: relative;
}

#navigation a::before {
    display: none; /* Remove underline animation for nav */
}

#navigation a:hover {
    background: var(--primary-gradient);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Site intro */
.site-intro {
    background: var(--bg-card);
    border-left: 4px solid transparent;
    border-image: var(--accent-gradient) 1;
    padding: 1.25rem 1.5rem;
    font-style: italic;
    margin: 1rem 0;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

/* Post content */
.post {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin: 1rem 0;
}

.post p {
    line-height: 1.8;
    margin: 1rem 0;
    color: var(--text-dark);
}

.post img {
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    max-width: 100%;
    height: auto;
}

.post img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

/* Pagination */
#pages {
    text-align: center;
    font-size: 1rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

#pages a {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    background: var(--primary-gradient);
    color: white !important;
    font-weight: 600;
    border-radius: 50px;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    border-bottom: none;
}

#pages a::before {
    display: none;
}

#pages a:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem 1rem;
    margin: 2rem 0 1rem;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

footer a {
    color: var(--primary-color);
    font-weight: 500;
}

/* HR styling */
hr {
    border: none;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--primary-color), transparent);
    margin: 2rem 0;
    opacity: 0.3;
}

/* Post list items - removed translateX on hover */
article.post {
    transition: transform var(--transition-base);
}

/* Badges and tags */
.tag, .badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-gradient);
    color: white;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0.25rem;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast);
}

.tag:hover, .badge:hover {
    transform: scale(1.05);
}

/* ACCESSIBILITY */
a.skip-main {
    left: -999px;
    position: absolute;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: -999;
}

a.skip-main:focus,
a.skip-main:active {
    color: #fff;
    background: var(--primary-gradient);
    left: auto;
    top: auto;
    width: auto;
    height: auto;
    overflow: auto;
    margin: 10px auto;
    padding: 1rem 2rem;
    border-radius: 50px;
    border: 3px solid var(--accent-color);
    text-align: center;
    font-size: 1.2em;
    font-weight: 700;
    z-index: 999;
    box-shadow: var(--shadow-xl);
}

/* Loading animation for images */
img {
    animation: fadeIn 0.5s ease-out;
}

/* Smooth transitions for all interactive elements */
button, input, select, textarea {
    transition: all var(--transition-base);
}

/* Focus states for better accessibility */
*:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 3px;
    border-radius: 4px;
}

/* Better word wrapping for all text */
* {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Ensure media and overflow-prone elements respect viewport */
img, video, iframe, table, pre, code {
    max-width: 100%;
}

/* Better table handling on mobile */
table {
    display: block;
    overflow-x: auto;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    body {
        padding: 0 0.5rem;
    }
    
    #navigation {
        font-size: 0; /* Hide text nodes (slashes) */
    }
    
    #navigation a {
        font-size: 0.95rem; /* Restore font size for links */
        margin: 0.25rem;
    }
    
    .post {
        padding: 1rem;
        margin: 0.5rem 0;
    }
    
    #quote {
        font-size: 0.95rem;
        padding: 1rem;
        max-width: 100%;
    }
    
    h1 {
        font-size: 1.8rem;
        word-break: break-word;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    /* Ensure pre/code blocks don't overflow */
    pre {
        max-width: 100%;
        overflow-x: auto;
    }
    
    pre code {
        white-space: pre-wrap;
        word-break: break-all;
    }
    
    /* Fix long links */
    a {
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    
    /* Better blockquote mobile handling */
    blockquote {
        padding: 1rem;
        margin: 1rem 0;
    }
    
    blockquote::before {
        font-size: 2.5rem;
        left: 10px;
    }
}

/* Print styles */
@media print {
    body::before {
        display: none;
    }
    
    .post, blockquote, #quote {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}