/* Blog-specific styles */
* {
    box-sizing: border-box;  /* Ensure consistent box model for all elements */
}

.blog-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5%;
    margin: auto;
    width: min(50%, 95%);
    border-radius: 10px;
    margin-bottom: 30px;
}

/* FIXED: Search container uses same grid structure as parent for perfect alignment */
.search-container {
    grid-column: 1 / -1;  /* Span all columns */
    display: grid;  /* Use grid for precise alignment */
    grid-template-columns: 1fr 1fr;  /* Match parent grid exactly */
    gap: 5%;  /* Match parent gap */
    padding: 20px 0;  /* Only vertical padding */
}

.search-container form {
    grid-column: 2;  /* Place form in second column */
}

.search-box {
    padding: 8px 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-family: 'Roboto Mono', sans-serif;
    font-size: 14px;
    /* FIXED: Start from right edge and use specific width */
    width: 50%;  /* Half of the column width when not focused */
    margin-left: auto;  /* Push to right edge of the column */
    transition: all 0.3s ease;
}

.search-box::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-box:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    width: 100%;  /* Full column width when focused */
    margin-left: 0;  /* Reset margin to fill entire column */
}

.post-item {
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    margin-bottom: 25px;
    padding: 6%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.post-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

.post-title {
    font-family: 'Roboto', sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: white;
    text-decoration: none;
    display: block;
    margin-bottom: 8px;
    transition: color 0.3s ease;
}

.post-title:hover {
    color: rgba(255, 255, 255, 0.8);
}

.post-meta {
    font-family: 'Roboto Mono', sans-serif;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 5px;
}

.post-tags {
    font-family: 'Roboto Mono', sans-serif;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

.no-posts {
    grid-column: 1 / -1;  /* Span all columns when no posts */
    text-align: center;
    padding: 40px;
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Roboto Mono', sans-serif;
}

/* Search results spans full width */
.search-results {
    grid-column: 1 / -1;  /* Span all columns */
    margin-bottom: 20px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-family: 'Roboto Mono', sans-serif;
    font-size: 0.9rem;
}

.clear-search {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    margin-left: 10px;
    font-size: 0.8rem;
}

.clear-search:hover {
    color: white;
}

/* Individual blog post styles */
.post-container {
    width: min(450px, 65%);
    margin: 0 auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    margin-top: 20px;
    margin-bottom: 40px;
}

.post-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.post-content {
    font-family: 'Roboto Mono', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: white;
    margin-bottom: 30px;
}

.post-content p {
    margin-bottom: 15px;
}

.post-content h1, .post-content h2, .post-content h3 {
    margin-top: 25px;
    margin-bottom: 15px;
    font-family: 'Roboto', sans-serif;
}

.post-content ul, .post-content ol {
    margin-bottom: 15px;
    padding-left: 25px;
}

.post-content a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: underline;
}

.post-content a:hover {
    color: white;
}

.case-toggle-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
}

.case-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-family: 'Roboto Mono', sans-serif;
    font-size: 12px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    text-transform: none;
}

.case-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.case-toggle.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.navigation {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.navigation a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-family: 'Roboto Mono', sans-serif;
    margin: 0 15px;
    transition: color 0.3s ease;
}

.navigation a:hover {
    color: white;
}

/* Case toggle states */
.proper-case {
    text-transform: none;
}

.proper-case .post-content p:first-letter,
.proper-case .post-content h1:first-letter,
.proper-case .post-content h2:first-letter,
.proper-case .post-content h3:first-letter,
.proper-case .post-content li:first-letter {
    text-transform: uppercase;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .search-container {
        padding: 15px 0;
        /* Mobile: Keep grid structure for alignment */
        grid-template-columns: 1fr 1fr;
        gap: 3%;  /* Match mobile gap */
    }

    .search-box {
        /* Mobile: Larger default width for easier tapping */
        width: 70%;
        margin-left: auto;  /* Keep right alignment */
    }
    
    .search-box:focus {
        /* Mobile: Full column width */
        width: 100%;
        margin-left: 0;
    }

    .blog-container {
        grid-template-columns: 1fr 1fr;
        width: min(90%, 95%);
        gap: 3%;
        padding: 5px;
    }

    .post-item {
        padding: 4%;
        margin-bottom: 15px;
    }
    
    .case-toggle-container {
        position: static;
        text-align: center;
        margin-bottom: 20px;
    }

    .post-container {
        width: min(450px, 80%);
    }

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

    .post-content {
        font-size: 0.95rem;
    }
    
    .post-meta, .post-tags {
        font-size: 0.8rem;
    }
    
    .navigation a {
        display: block;
        margin: 10px 0;
    }
}