/* ================================================== */
/* BLOG-SPECIFIC STYLES */
/* ================================================== */

/* Blog Hero Section */
#blog-hero {
    background: linear-gradient(135deg, var(--soft-orange) 0%, var(--soft-pink) 100%);
    padding: 4rem 0;
    text-align: center;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

#blog-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--title-orange), #e67e22, var(--title-orange));
    background-size: 200% 100%;
    animation: gradientShift 3s ease-in-out infinite;
}

#blog-hero h1 {
    margin-bottom: 1rem;
    color: var(--title-orange);
    position: relative;
}

#blog-hero p {
    font-size: 1.2rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
    font-style: italic;
}

/* Blog Posts Grid */
.blog-posts-grid {
    display: grid;
    gap: 2rem;
    margin-bottom: 3rem;
    container-type: inline-size;
}

/* Responsive grid */
@container (min-width: 768px) {
    .blog-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@container (min-width: 1024px) {
    .blog-posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Blog Post Cards */
.blog-post-card {
    background-color: #fff;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.blog-post-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--title-orange), #e67e22);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.blog-post-card:hover::before {
    transform: scaleX(1);
}

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

.post-meta {
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.post-meta:first-child {
    justify-content: flex-start;
    margin-bottom: 1.5rem;
}

.post-meta time {
    color: var(--title-orange);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Lora', serif;
}

.blog-post-card h3 {
    margin-bottom: 1rem;
    line-height: 1.3;
    color: var(--title-orange);
}

.blog-post-card h3 a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition);
    position: relative;
}

.blog-post-card h3 a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--title-orange);
    transition: width 0.3s ease;
}

.blog-post-card h3 a:hover {
    color: #e67e22;
}

.blog-post-card h3 a:hover::after {
    width: 100%;
}

.post-excerpt {
    color: #666;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    flex-grow: 1;
    font-size: 1rem;
}

/* ================================================== */
/* BLOG BUTTONS - Updated to use primary button style */
/* ================================================== */

/* Blog Button - For blog-related actions */
.btn-blog {
    display: inline-block;
    background: var(--soft-orange);
    color: var(--title-orange);
    padding: clamp(0.5rem, 1.2vw, 0.7rem) clamp(1rem, 2.5vw, 1.5rem);
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(215, 84, 0, 0.1);
    border: 2px solid var(--title-orange);
    cursor: pointer;
    font-family: inherit;
    font-size: clamp(0.8rem, 1.5vw, 0.9rem);
    text-align: center;
    white-space: nowrap;
    align-self: flex-start; /* Prevent stretching in flex container */
}

.btn-blog:hover {
    background: var(--soft-orange-darker);
    transform: translateY(-2px);
    box-shadow: 0 5px 18px rgba(215, 84, 0, 0.2);
    color: var(--title-orange);
}

/* Read Post Button - For latest post section */
.read-post-btn {
    display: inline-block;
    background: #f5d5a8;
    color: var(--title-orange);
    padding: clamp(0.6rem, 1.5vw, 0.8rem) clamp(1.5rem, 3vw, 2rem);
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(215, 84, 0, 0.1);
    border: 2px solid var(--title-orange);
    cursor: pointer;
    font-family: inherit;
    font-size: clamp(0.85rem, 1.8vw, 1rem);
    text-align: center;
    white-space: nowrap;
}

.read-post-btn:hover {
    background: #f0ca94;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(215, 84, 0, 0.2);
    color: var(--title-orange);
}

/* Loading and No Posts Messages */
.loading-message,
.no-posts-message {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
    background: var(--soft-pink);
    border-radius: var(--border-radius);
    margin: 2rem 0;
}

.loading-message p,
.no-posts-message p {
    font-size: 1.1rem;
    margin: 0;
    font-style: italic;
}

.loading-message::before {
    content: '⏳';
    display: block;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.no-posts-message::before {
    content: '📝';
    display: block;
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* Individual Post Styles */
.post-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, var(--soft-orange) 0%, var(--soft-pink) 100%);
    border-radius: var(--border-radius);
    position: relative;
    overflow: hidden;
    z-index: 1; /* Ensure post header stays below navigation */
}

.post-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--title-orange), #e67e22, var(--title-orange));
    background-size: 200% 100%;
    animation: gradientShift 3s ease-in-out infinite;
}

.post-header h1 {
    margin-bottom: 1.5rem;
    color: var(--title-orange);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.post-meta-full {
    color: #666;
    font-size: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.post-meta-full time,
.post-meta-full .reading-time,
.post-meta-full .post-author {
    background: var(--soft-pink);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(215, 84, 0, 0.1);
    font-weight: 500;
    color: var(--title-orange);
}

.post-content {
    background-color: #fff;
    padding: 4rem 3rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    line-height: 1.8;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 1; /* Ensure content stays below navigation */
}

.post-content .abstract {
    background: var(--soft-orange);
    padding: 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 3rem;
    border-left: 4px solid var(--title-orange);
    border-top: 2px solid var(--title-orange);
}

.post-content .abstract h2 {
    color: var(--title-orange);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.post-content .abstract p {
    color: #555;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.post-content .abstract strong {
    color: var(--title-orange);
    font-weight: 600;
}

.post-content h2 {
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    color: var(--title-orange);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--soft-orange);
}

.post-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--title-orange);
    font-size: 1.3rem;
}

.post-content p {
    margin-bottom: 1.5rem;
    text-align: justify;
}

.post-content blockquote {
    background-color: var(--soft-pink);
    border-left: 4px solid var(--title-orange);
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    font-style: italic;
    position: relative;
}

.post-content blockquote::before {
    content: '"';
    font-size: 4rem;
    color: var(--title-orange);
    position: absolute;
    top: -0.5rem;
    left: 0.5rem;
    opacity: 0.3;
    font-family: serif;
}

.post-content code {
    background-color: #f4f4f4;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #c53030;
}

.post-content pre {
    background-color: #f4f4f4;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin: 2rem 0;
    border: 1px solid #e0e0e0;
}

.post-content pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
}

.post-content .references {
    background: var(--soft-orange);
    padding: 2rem;
    border-radius: var(--border-radius);
    margin-top: 3rem;
    border-top: 3px solid var(--title-orange);
    border-left: 4px solid var(--title-orange);
}

.post-content .references h2 {
    color: var(--title-orange);
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    border-bottom: none;
    padding-bottom: 0;
}

.post-content .references p {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
    text-align: left;
}

.post-content .references em {
    color: var(--title-orange);
    font-weight: 600;
}

.post-content .references a {
    color: var(--title-orange);
    text-decoration: none;
    border-bottom: 1px solid var(--title-orange);
    transition: all 0.3s ease;
}

.post-content .references a:hover {
    color: #e67e22;
    border-bottom-color: #e67e22;
    background-color: rgba(215, 84, 0, 0.1);
    padding: 0 2px;
}

/* Content sections styling */
.post-content .content-section {
    margin-bottom: 2.5rem;
}

.post-content .content-section:last-child {
    margin-bottom: 0;
}

.post-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 0;
    border-top: 1px solid #eee;
    max-width: 900px;
    margin: 0 auto;
}

/* Latest Post Section Styles */
#writing {
    position: relative;
    overflow: hidden;
}

.writing-content {
    background: linear-gradient(135deg, #ffffff 0%, #fefefe 100%);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

.writing-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--title-orange), #e67e22, var(--title-orange));
    background-size: 200% 100%;
    animation: gradientShift 3s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.latest-post {
    background: none;
    border: none;
    padding: 2.5rem;
    margin-bottom: 0;
    border-radius: 0;
}

.latest-post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--soft-pink);
}

.latest-post-header h3 {
    margin: 0;
    color: var(--title-orange);
    font-size: 1.4rem;
    position: relative;
}

.latest-post-header h3::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--title-orange);
    border-radius: 2px;
}

.post-date {
    background: var(--soft-pink);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(215, 84, 0, 0.1);
}

.post-date time {
    color: var(--title-orange);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Lora', serif;
}

.latest-post-content {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.latest-post-content h4 {
    margin-bottom: 1rem;
    line-height: 1.3;
}

.latest-post-content h4 a {
    color: var(--title-orange);
    text-decoration: none;
    transition: color 0.3s ease;
    position: relative;
}

.latest-post-content h4 a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--title-orange);
    transition: width 0.3s ease;
}

.latest-post-content h4 a:hover {
    color: #e67e22;
}

.latest-post-content h4 a:hover::after {
    width: 100%;
}

.post-excerpt {
    color: #666;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.post-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
}

.reading-time {
    color: #888;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reading-time::before {
    content: '⏳';
    font-size: 0.8rem;
}

.post-author {
    color: #888;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.post-author::before {
    content: '✍️';
    font-size: 0.8rem;
}

/* Loading animation for dynamic content */
.latest-post.loading {
    opacity: 0.6;
    pointer-events: none;
}

.latest-post.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--title-orange);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ================================================== */
/* BLOG BUTTON RESPONSIVENESS */
/* ================================================== */

/* Medium screens */
@media (max-width: 768px) {
    .btn-blog,
    .read-post-btn {
        padding: clamp(0.5rem, 1.2vw, 0.7rem) clamp(1rem, 2.5vw, 1.5rem);
        font-size: clamp(0.8rem, 1.5vw, 0.9rem);
    }
    
    .latest-post-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .post-actions {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .latest-post {
        padding: 2rem 1.5rem;
    }
    
    .post-meta-full {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .blog-post-card {
        padding: 2rem;
    }
    
    .post-content .abstract {
        padding: 1.5rem;
    }
    
    .post-content .references {
        padding: 1.5rem;
    }
}

/* Small screens */
@media (max-width: 480px) {
    .btn-blog,
    .read-post-btn {
        padding: clamp(0.4rem, 1vw, 0.6rem) clamp(0.8rem, 2vw, 1.2rem);
        font-size: clamp(0.75rem, 1.3vw, 0.85rem);
    }
    
    .blog-posts-grid {
        grid-template-columns: 1fr;
    }
    
    .post-content {
        padding: 2.5rem 1.5rem;
    }
    
    .post-header {
        padding: 2rem 1rem;
    }
}

/* Extra small screens */
@media (max-width: 320px) {
    .btn-blog,
    .read-post-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.75rem;
    }
}