/* Blog specific styles */
.blog-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 2rem;
    justify-content: center;
}

.blog-images img,
.blog-images .youtube-preview {
    width: 100%;
    height: auto;
    /* Let height adjust naturally to ratio */
    max-height: 500px;
    /* Prevent extremely tall images */
    object-fit: contain;
    /* Keep entire image visible */
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    transition: transform 0.3s ease;
    background-color: rgba(0, 0, 0, 0.2);
}

.blog-images img:hover,
.blog-images .youtube-preview:hover {
    transform: scale(1.02);
    /* Slight scale to avoid overflow issues */
}

.youtube-preview {
    position: relative;
    display: block;
    /* Block for grid */
    cursor: pointer;
    aspect-ratio: 16/9;
    /* Enforce ratio for video previews */
}

.youtube-preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.youtube-preview::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 68px;
    height: 48px;
    background: rgba(255, 0, 0, 0.8);
    border-radius: 12px;
    transition: background 0.3s;
}

.youtube-preview::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-35%, -50%);
    width: 0;
    height: 0;
    border-left: 20px solid white;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    z-index: 1;
}

.youtube-preview:hover::after {
    background: rgba(255, 0, 0, 1);
}

/* Ensure images embedded in text don't break layout */
.blog-post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 10px 0;
}

.blog-post-content {
    white-space: pre-wrap;
    /* Preserve line breaks */
}

.blog-post-content a {
    color: var(--gold);
    text-decoration: underline;
    transition: color 0.3s ease;
}

.blog-post-content a:hover {
    color: var(--gold-hover);
    text-decoration: underline;
}

.update-info {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-top: 15px;
    font-style: italic;
}

/* Blog Index Cards */
.blog-index-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 2rem;
}

.blog-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transition: transform 0.3s ease, background 0.3s ease;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    transform: translateY(-5px);
    background: var(--card-hover);
    border-color: var(--gold);
}

.blog-card-image {
    width: 100%;
    height: 200px;
    object-fit: contain;
    background: #1e293b;
}

.blog-card-content {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.blog-card h2 {
    font-size: 1.2rem;
    margin: 0 0 10px 0;
    color: var(--gold);
}

.blog-card .timestamp {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: auto;
}