/* Reset & Base */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

body {
    background-color: #1a1a1a; /* Dark professional background */
    color: #333;
    min-height: 100vh;
}

/* --- Top Navigation (Lego Brick Style) --- */
.lego-nav {
    background-color: #d32f2f; /* Classic Lego Red */
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-title { font-size: 1.5rem; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; }
.subtitle { font-weight: 300; opacity: 0.8; font-size: 1rem; text-transform: none; }

.back-btn {
    text-decoration: none;
    color: white;
    font-weight: bold;
    background: rgba(0,0,0,0.2);
    padding: 8px 15px;
    border-radius: 4px;
    transition: background 0.2s;
}
.back-btn:hover { background: rgba(0,0,0,0.4); }

/* Decorative Studs on Nav Bar */
.stud-row {
    height: 12px;
    display: flex;
    justify-content: center;
    gap: 15px;
    padding-bottom: 5px;
}
.stud-row span {
    width: 30px;
    height: 6px;
    background-color: #b71c1c; /* Darker red for 3D effect */
    border-radius: 4px 4px 0 0;
}

/* --- Main Layout --- */
.container {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
}

/* --- Blog Grid --- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

/* --- Lego Blog Card --- */
.blog-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    transition: transform 0.3s, box-shadow 0.3s;
    /* The "Brick" 3D bottom border */
    border-bottom: 6px solid #ccc;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.blog-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    border-bottom-color: #d32f2f; /* Highlight border on hover */
}

.blog-card:hover .read-btn {
    background-color: #d32f2f;
}

/* Stud decoration on top of card */
.card-studs {
    height: 8px;
    background-color: #f0f0f0;
    display: flex;
    gap: 10px;
    padding-left: 10px;
}
.card-stud {
    width: 20px;
    height: 8px;
    background-color: #ddd;
    border-radius: 4px 4px 0 0;
}

.card-img-container {
    height: 180px;
    overflow: hidden;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.blog-card:hover .card-img { transform: scale(1.05); }

.card-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-date {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 8px;
    font-weight: 600;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: #222;
    line-height: 1.3;
}

.read-btn {
    margin-top: auto; /* Push to bottom */
    background-color: #333;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    align-self: flex-start;
    transition: background 0.2s;
}

.read-btn:hover {
    background-color: #d32f2f;
}



/* --- Article Reader (Overlay) --- */
.article-reader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 200;
    
    /* CHANGE: Align items to center the box perfectly */
    display: flex; 
    justify-content: center; 
    align-items: center; 
    
    /* CHANGE: Remove scroll from here, we will scroll the inner box instead */
    overflow: hidden; 
    padding: 20px; 
}

.article-content-wrapper {
    background: white;
    width: 90%; /* CHANGE: Use more percentage width for responsiveness */
    max-width: 1200px; /* CHANGE: Increased from 800px to 1200px for a wider view */
    
    /* CHANGE: Make the white box scrollable internally */
    max-height: 90vh; /* Limit height to 90% of the screen */
    overflow-y: auto; /* Enable vertical scrolling inside the box */
    
    border-radius: 8px;
    position: relative;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
}

.article-reader.hidden { display: none; }

.close-article-btn {
    position: fixed;
    top: 20px;
    right: 30px;
    background: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    z-index: 210;
}
.close-article-btn:hover { background: #eee; }

.reader-hero {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

.reader-header {
    padding: 30px 40px 10px 40px;
}
.reader-date { color: #888; font-weight: bold; font-size: 0.9rem; }
.reader-header h1 { font-size: 2.5rem; margin-top: 10px; color: #111; }

.reader-text {
    padding: 30px 40px 60px 40px;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #444;
}

.blog-img-wrapper {
    /* Pushes text away from the image (Top and Bottom) */
    margin: 40px 0; 
    
    /* Ensures the image and caption stack vertically */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    
    /* Clears any floating elements to ensure text is strictly above/below */
    clear: both;
    width: 100%;
}

.article-inset-img {
    /* Responsive Width: fit container but don't stretch pixelated */
    max-width: 100%; 
    width: auto; 
    
    /* Height constraint so it doesn't take the whole screen */
    max-height: 500px; 
    
    /* IMPORTANT: 'contain' ensures the full image is shown (no cropping) */
    object-fit: contain; 
    
    /* Standard styling */
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: block; /* Removes any inline spacing issues */
}

.img-caption {
    display: block;
    margin-top: 15px; /* Space between image and caption */
    color: #666;
    font-style: italic;
    font-size: 0.95rem;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-content { padding: 10px 15px; }
    .nav-title { font-size: 1.2rem; }
    .reader-header h1 { font-size: 1.8rem; }
    .reader-text { padding: 20px; }
}