.blogs-header {
  width: auto;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 15px;
}

.header-container h1 {
  font-size: 28pt;
  color: #333333;
  font-weight: 700;
}

.top-nav {
  background-color: #333333;
  border-radius: 6px;
  padding: 4px;
  display: flex;
}

.top-nav a {
  color: #ffffff;
  text-decoration: none;
  padding: 10px 16px;
  font-size: 13px;
  display: block;
  border-radius: 4px;
  transition: background 0.2s;
}

.top-nav a:hover {
  background-color: #444444;
}

/* Container layout using CSS Grid */
.card-grid {
  display: grid;
  /* Automatically wraps or scales items down to 250px wide min */
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px; /* Space between the cards */
  padding: 20px;
  font-family: Arial, sans-serif;
}

/* Individual Card Styling */
.card {
  background-color: #f2f2f2; /* Light gray background */
  border-radius: 16px;       /* Noticeable rounded corners */
  overflow: hidden;          /* Prevents image from spilling out of rounded corners */
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05); /* Soft, subtle drop shadow */
}

/* Image behavior inside the card */
.card-img img {
  width: 100%;
  height: 300px;             /* Keeps crop uniform across different image uploads */
  object-fit: cover;         /* Crops the image cleanly to fit the container scale */
}

/* Layout text padding inside the cards */
.card-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;              /* Ensures the footer links align even with varying text sizes */
}

.card-content h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.1rem;
  color: #222222; 
}

.card-h3 h3:hover{
  border-color: #000000;
  background-color: #e1e5e7;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  transform: scale(105%);
  transition: all 0.2s ease-in-out;
}

.card-h3 h3:active{
  transform: scale(95%);
  transition: all 0.08s ease; 
}

.card-content p {
  font-size: 0.9rem;
  color: #555;
  line-height: 1.4;
  margin-bottom: 20px;
}

/* Link Styling */
.read-more {
  margin-top: auto;          /* Pushes link down to the bottom of the card */
  font-size: 0.9rem;
  color: #222222;
  text-decoration: underline;
  font-weight: bold;
}

.read-more:hover{
  border-color: #000000;
  background-color: #e1e5e7;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  transform: scale(105%);
  transition: all 0.2s ease-in-out;
}

.read-more:active{
  transform: scale(95%);
  transition: all 0.08s ease; 
}

@media (max-width: 600px) {
  .header-container {
      flex-direction: column;
      align-items: flex-start;
  }
  .top-nav {
      width: 100%;
  }
  .top-nav ul {
      justify-content: space-between;
  }
  .card-grid {
      grid-template-columns: 1fr; 
  }
}

/* ==========================================
   MOBILANPASSNING FÖR BLOGGEN (< 768px)
   ========================================== */
   @media (max-width: 768px) {
  
    /* 1. Centrera hela headern så att logga/titel och nav hamnar snyggt under varandra */
    .header-container {
      flex-direction: column;
      align-items: center;
      text-align: center;
      gap: 20px;
      margin-top: 15px;
    }
  
    /* 2. Krymp den enorma rubriken så den inte klipper eller tar upp hela skärmen */
    .header-container h1 {
      font-size: 20pt !important; /* Sänk från 28pt */
      margin: 0;
    }
  
    /* 3. Gör navigeringsfälten mer flexibla om länkarna blir många */
    .top-nav {
      max-width: 92%;
      justify-content: center;
      flex-wrap: wrap;
    }
  
    .top-nav a {
      padding: 8px 12px; /* Något mindre padding för att spara utrymme */
      font-size: 12px;
    }
  
    /* 4. Se till att bloggkorten inte klistrar sig djupt mot skärmens ytterkanter */
    .card-grid {
      padding: 0 15px;
      gap: 20px; /* Lite tightare glapp mellan korten på mobil */
    }
  }