/**
 * Launchmind Blog - Adaptive Design
 * Inherits website styling, adapts to light/dark themes
 */

:root {
    --lm-primary: #10b981;
    --lm-primary-dark: #059669;
    
    /* Adaptive colors - will be overridden based on theme detection */
    --lm-card-bg: rgba(255, 255, 255, 0.95);
    --lm-card-border: rgba(0, 0, 0, 0.08);
    --lm-text-primary: #111827;
    --lm-text-secondary: #6b7280;
    --lm-text-muted: #9ca3af;
}

/* Dark theme detection - auto-adapt to dark backgrounds */
@media (prefers-color-scheme: dark) {
    :root {
        --lm-card-bg: rgba(30, 30, 30, 0.95);
        --lm-card-border: rgba(255, 255, 255, 0.1);
        --lm-text-primary: #f9fafb;
        --lm-text-secondary: #d1d5db;
        --lm-text-muted: #9ca3af;
    }
}

/* Force dark mode for sites with dark backgrounds */
.launchmind-blog-list.lm-dark,
.launchmind-single-wrapper.lm-dark,
body.dark .launchmind-blog-list,
body[data-theme="dark"] .launchmind-blog-list,
.dark-theme .launchmind-blog-list {
    --lm-card-bg: rgba(30, 30, 30, 0.95);
    --lm-card-border: rgba(255, 255, 255, 0.1);
    --lm-text-primary: #f9fafb;
    --lm-text-secondary: #d1d5db;
    --lm-text-muted: #9ca3af;
}

/* Force light mode */
.launchmind-blog-list.lm-light,
.launchmind-single-wrapper.lm-light {
    --lm-card-bg: rgba(255, 255, 255, 0.98);
    --lm-card-border: rgba(0, 0, 0, 0.08);
    --lm-text-primary: #111827;
    --lm-text-secondary: #6b7280;
    --lm-text-muted: #9ca3af;
}

/* ============================================
   Blog Intro - Auto-generated welcome text
   ============================================ */

.launchmind-blog-intro {
    max-width: 800px;
    margin: 0 auto 2rem;
    padding: 0 4%;
}

.launchmind-blog-intro p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--lm-text-secondary);
    margin: 0;
}

.launchmind-blog-intro .launchmind-site-name {
    color: var(--lm-primary);
    font-weight: 700;
}

/* Dark mode intro */
.launchmind-blog-intro.lm-dark p {
    color: rgba(255, 255, 255, 0.7);
}

@media (max-width: 768px) {
    .launchmind-blog-intro {
        padding: 0 1rem;
        margin-bottom: 1.5rem;
    }
    
    .launchmind-blog-intro p {
        font-size: 1rem;
    }
}

/* ============================================
   Blog Grid - Clean & Spacious
   ============================================ */

.launchmind-blog-list {
    display: grid;
    gap: 2rem;
    margin: 2rem auto;
    padding: 0 2%;
    width: 100%;
    max-width: 1600px;
}

/* No max-width restrictions - fills available space */
.launchmind-columns-1 { grid-template-columns: 1fr; }
.launchmind-columns-2 { grid-template-columns: repeat(2, 1fr); }
.launchmind-columns-3 { grid-template-columns: repeat(3, 1fr); }
.launchmind-columns-4 { grid-template-columns: repeat(4, 1fr); }

/* Responsive */
@media (max-width: 1400px) {
    .launchmind-columns-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
    .launchmind-columns-3,
    .launchmind-columns-4 { grid-template-columns: repeat(2, 1fr); }
    
    .launchmind-blog-list {
        gap: 2.5rem;
        padding: 0 1.5rem;
    }
}

@media (max-width: 768px) {
    .launchmind-blog-list {
        gap: 1.5rem;
        margin: 1.5rem auto;
        padding: 0 1rem;
    }
}

@media (max-width: 640px) {
    .launchmind-columns-2,
    .launchmind-columns-3,
    .launchmind-columns-4 { grid-template-columns: 1fr; }
    
    .launchmind-blog-list {
        gap: 1.25rem;
        margin: 1rem auto;
    }
}

/* ============================================
   Card - Adaptive to Theme
   ============================================ */

.launchmind-post-card {
    background: var(--lm-card-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--lm-card-border);
    backdrop-filter: blur(10px);
}

.launchmind-post-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    transform: translateY(-6px);
    border-color: var(--lm-primary);
}

/* Image - Clean aspect ratio */
.launchmind-post-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #f3f4f6;
}

.launchmind-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.launchmind-post-card:hover .launchmind-post-image img {
    transform: scale(1.08);
}

/* Content - Compact but readable */
.launchmind-post-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.launchmind-post-title {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    color: var(--lm-text-primary);
    letter-spacing: -0.02em;
    font-family: inherit;
}

.launchmind-post-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.launchmind-post-title a:hover {
    color: var(--lm-primary);
}

/* Meta - Subtle */
.launchmind-post-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--lm-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.launchmind-post-author::before {
    content: "·";
    margin: 0 0.25rem;
    opacity: 0.6;
}

/* Excerpt - Readable */
.launchmind-post-excerpt {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--lm-text-secondary);
    margin: 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Tags - Minimal */
.launchmind-post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: auto;
}

.launchmind-tag {
    padding: 0.3rem 0.6rem;
    font-size: 0.65rem;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.15);
    color: var(--lm-primary);
    border-radius: 4px;
    transition: all 0.2s ease;
    text-transform: capitalize;
    letter-spacing: 0.02em;
}

.launchmind-tag:hover {
    background: var(--lm-primary);
    color: white;
}

/* Read More - Clean CTA */
.launchmind-read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--lm-primary);
    text-decoration: none;
    margin-top: 0.75rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

.launchmind-read-more:hover {
    color: var(--lm-primary-dark);
    gap: 0.6rem;
}

.launchmind-read-more::after {
    content: "→";
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.launchmind-read-more:hover::after {
    transform: translateX(3px);
}

/* ============================================
   Single Post - Reading Experience
   ============================================ */

.launchmind-single-wrapper {
    width: 100%;
    margin: 0 auto;
    padding: 2rem 4%;
}

.launchmind-post-single {
    max-width: 900px;
    margin: 0 auto;
    background: var(--lm-card-bg);
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--lm-card-border);
    backdrop-filter: blur(10px);
}

/* On very large screens, limit article width for readability */
@media (min-width: 1800px) {
    .launchmind-post-single {
        max-width: 1000px;
    }
}

.launchmind-post-featured-image {
    margin: -3.5rem -3.5rem 3rem -3.5rem;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
}

.launchmind-post-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

.launchmind-post-single .launchmind-post-title {
    font-size: clamp(1.75rem, 5vw, 2.75rem);
    font-weight: 800;
    line-height: 1.15;
    margin: 0 0 1.5rem;
    color: var(--lm-text-primary);
    letter-spacing: -0.03em;
    font-family: inherit;
}

.launchmind-post-single .launchmind-post-meta {
    font-size: 0.875rem;
    color: var(--lm-text-muted);
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--lm-card-border);
    font-weight: 500;
}

.launchmind-post-body {
    font-size: 1.0625rem;
    line-height: 1.8;
    color: var(--lm-text-secondary);
    font-family: inherit;
}

.launchmind-post-body h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 2.5rem 0 1rem;
    color: var(--lm-text-primary);
    letter-spacing: -0.02em;
}

.launchmind-post-body h3 {
    font-size: 1.35rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem;
    color: var(--lm-text-primary);
    letter-spacing: -0.01em;
}

.launchmind-post-body p {
    margin-bottom: 1.5rem;
}

.launchmind-post-body ul,
.launchmind-post-body ol {
    margin: 1.5rem 0;
    padding-left: 1.5rem;
}

.launchmind-post-body li {
    margin-bottom: 0.75rem;
}

.launchmind-post-body a {
    color: var(--lm-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--lm-primary);
    transition: all 0.2s ease;
    padding-bottom: 1px;
}

.launchmind-post-body a:hover {
    color: var(--lm-primary-dark);
    border-bottom-color: transparent;
}

.launchmind-post-body strong {
    font-weight: 700;
    color: var(--lm-text-primary);
}

.launchmind-post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 2rem 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.launchmind-post-single .launchmind-post-tags {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--lm-card-border);
}

.launchmind-tags-label {
    font-weight: 700;
    margin-right: 0.75rem;
    color: var(--lm-text-primary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.launchmind-back-link {
    display: inline-flex !important;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: var(--lm-primary);
    color: white !important;
    text-decoration: none !important;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.launchmind-back-link:hover {
    background: var(--lm-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.4);
}

/* ============================================
   Mobile Optimizations
   ============================================ */

@media (max-width: 768px) {
    .launchmind-single-wrapper {
        padding: 1.5rem 1rem;
    }
    
    .launchmind-post-single {
        padding: 2rem 1.25rem;
    }
    
    .launchmind-post-featured-image {
        margin: -2rem -1.25rem 1.5rem -1.25rem;
    }
    
    .launchmind-post-single .launchmind-post-title {
        font-size: 1.75rem;
    }
    
    .launchmind-post-body {
        font-size: 1rem;
    }
    
    .launchmind-post-body h2 {
        font-size: 1.5rem;
    }
    
    .launchmind-post-content {
        padding: 1.25rem;
    }
    
    .launchmind-post-title {
        font-size: 1.15rem;
    }
}

@media (max-width: 480px) {
    .launchmind-post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }
    
    .launchmind-post-author::before {
        display: none;
    }
    
    .launchmind-post-content {
        padding: 1rem;
    }
}

/* ============================================
   Error States
   ============================================ */

.launchmind-error,
.launchmind-empty {
    padding: 3rem 2rem;
    text-align: center;
    border-radius: 16px;
    margin: 3rem auto;
    max-width: 600px;
}

.launchmind-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-weight: 600;
}

.launchmind-empty {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    color: #9ca3af;
    font-size: 1.125rem;
}
