/* Container: Responsive Flexbox Grid */
.parkrun-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding: 1rem 0;
  justify-content: flex-start;
}

/* Individual Card */
.parkrun-card {
  flex: 1 1 280px; /* Grow, shrink, base width of 280px */
  max-width: 100%;
  box-sizing: border-box;
  background-color: #ffffff;
  border: 1px solid #000000;
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Limit card thumbnail width and keep proportions */
.parkrun-thumb {
  max-width: 450px;
  width: 100%;       /* Resizes down smoothly on mobile screens */
  height: auto;      /* Maintains proper aspect ratio */
  border-radius: 8px; /* Optional: rounds image corners nicely */
  display: block;
}

.card-image-container {
  margin: 0.5rem 0;
  display: flex;
  justify-content: center; /* Centers the image inside the card */
}

/* Hover Effect */
.parkrun-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

/* Card Content Typography */
.parkrun-card h3 {
  margin: 0 0 0.5rem 0;
  color: #000000;
  font-size: 1.2rem;
}

.parkrun-card .details {
  font-size: 0.95rem;
  color: #475569;
  line-height: 1.5;
}

/* Highlight Badge for Personal Best (PB) */
.parkrun-card.pb-highlight {
  border-left: 5px solid #10b981; /* Green accent bar */
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

.pb-badge {
  display: inline-block;
  margin-top: 0.75rem;
  background-color: #10b981;
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  align-self: flex-start;
}

/* Styling specifically for South African Parkrun Cards */
.parkrun-card.za-country {
  /* Apply the background image */
  background-image: url('/webp-images/parkruns/background-za-light.webp');
  
  /* Ensure it covers the whole card neatly without tiling */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  
  /* IMPORTANT FOR READABILITY: Darken the image using an overlay */
  /* This creates a semi-transparent black layer over the flag */
  position: relative;
  z-index: 1;
}

/* Create the dark overlay so text remains readable */
.parkrun-card.za-country::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.6); /* Black with 40% opacity */
  border-radius: 10px; /* Match your card corner radius */
  z-index: -1; /* Place overlay *behind* the text content */
}

/* Ensure text inside ZA cards is white or light for contrast */
.parkrun-card.za-country {
  color: #000000 !important;
}

.parkrun-card.nl-country {
  background-image: url('/webp-images/parkruns/background-nl-light.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  z-index: 1;
}

/* Dark overlay for readability */
.parkrun-card.nl-country::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.4);
  border-radius: 10px;
  z-index: -1;
}

/* Ensure text stays readable */
.parkrun-card.nl-country,
.parkrun-card.nl-country h3,
.parkrun-card.nl-country .details p {
  color: #000000 !important;
}

.card-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr; /* Ensures both items get exactly 50% width */
  gap: 10px;                       /* Gap between the two items */
  align-items: center;            /* Centers content vertically */
  margin-top: 8px;
}

/* Ensure paragraph margins don't break the alignment */
.card-stats-row p {
  margin: 0;
  text-align: center;             /* Centers text within each half */
  white-space: nowrap;            /* Keeps date and stats on one line each */
}

.card-action-row {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}

/* YouTube Brand Button */
.youtube-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: #FF0000;
  color: #FFFFFF !important;
  font-weight: bold;
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: 6px;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.1s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.youtube-btn:hover {
  background-color: #CC0000; /* Darker red on hover */
  transform: translateY(-1px);
}

.youtube-btn:active {
  transform: translateY(0);
}

/* YouTube Play Icon */
.yt-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
}

.card-title-full {
  width: 100%;
  margin: 0 0 6px 0;
  font-size: 1.15rem;
  line-height: 1.3;
  text-align: left; /* or center if you prefer */
  word-wrap: break-word; /* Prevents long parkrun names from breaking layout */
}

.card-subheader {
  display: flex;
  justify-content: flex-end; /* Keeps run number neatly aligned right */
  margin-bottom: 8px;
}

.card-title-full.npr-title {
  color: brown !important;;
}