:root {
  --bg: #f8f9fa; 
  --card-bg: #ffffff;
  --text: #212529; 
  --text-muted: #6c757d;
  --accent: #4f46e5; /* Modern indigo accent color */
  --edge: #e9ecef;
}

* {
  box-sizing: border-box;
}

body {
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.6;
}

/* --- GLOBAL IMAGE FIX --- */
img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover; /* Crops the image cleanly to fit the container without distortion */
  display: block;
}

/* --- HEADER & NAVIGATION --- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background-color: var(--card-bg);
  color: var(--text);
  padding: 1rem 2rem;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--edge);
}

.title h1 {
  font-size: 1.5rem;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.title a {
  color: var(--text);
  text-decoration: none;
}

nav {
  display: flex;
  gap: 2rem;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

nav a:hover {
  color: var(--accent);
}

/* --- MAIN LAYOUT --- */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 120px 2rem 4rem 2rem; 
}

/* --- HERO SECTION --- */
.hero {
  text-align: center;
  padding: 3rem 1rem;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--edge);
}

.hero h2 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  letter-spacing: -1px;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.2rem;
  max-width: 600px;
  margin: 0 auto;
}

/* --- FEATURED POST --- */
.featured-post {
  display: grid;
  grid-template-columns: 1fr;
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--edge);
  margin-bottom: 3rem;
}

.featured-img {
  background: #ddd;
  height: 300px; /* Default height for mobile viewports */
  width: 100%;
  overflow: hidden;
}

.featured-content {
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (min-width: 768px) {
  .featured-post {
    grid-template-columns: repeat(2, minmax(0, 1fr)); /* Prevents large images from expanding the columns */
  }
  .featured-img {
    height: 100%; /* Stretches to perfectly match the height of the text content card */
  }
}

.tag {
  align-self: flex-start;
  background: rgba(79, 70, 229, 0.1);
  color: var(--accent);
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* --- POSTS GRID --- */
.section-title {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.post-card {
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--edge);
  display: flex;
  flex-direction: column;
}

.post-img {
  background: #eee;
  height: 200px;
  width: 100%;
  overflow: hidden;
  flex-shrink: 0; /* Keeps layout stable if text content grows */
}

.post-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.post-content h4 {
  margin: 0.5rem 0;
  font-size: 1.25rem;
}

.post-content p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.read-more {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.95rem;
}

.read-more:hover {
  text-decoration: underline;
}