/* 
=================================================================
HUGOCIB - CARDS COMPONENT
=================================================================
Responsive card grid for country listings with hover effects

ARCHITECTURE:
- Uses CSS aspect-ratio (2:3) for consistent card proportions
- Height-based control system: only --card-height changes across breakpoints
- Width is automatically calculated from height and aspect ratio
- Images fill the entire card container using object-fit: cover
=================================================================
*/

/* =================================================================
   CSS VARIABLES & GRID LAYOUT
   ================================================================= */

:root {
  /* Typography */
  --font-card-title: 1.6rem;
  --font-card-subtitle: 0.8rem;
  --font-card-desc: 1.2rem;
  --font-line-height: 1.2;
  
  /* Card dimensions - height is the control parameter */
  --card-aspect-ratio: 2 / 3;  /* Width / Height ratio */
  --card-height: 300px;        /* Primary control parameter - changes at breakpoints */
}

.grid {
  display: grid;
  /* Grid auto-sizes based on card width (calculated from height * aspect-ratio) */
  grid-template-columns: repeat(auto-fit, calc(var(--card-height) * var(--card-aspect-ratio)));
  gap: 2.5rem;
  justify-content: center;
}

/* =================================================================
   CARD CONTAINER & STRUCTURE
   ================================================================= */

.card {
  position: relative;
  /* Height is controlled, width calculated from aspect-ratio */
  height: var(--card-height);
  aspect-ratio: var(--card-aspect-ratio);
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Remove default link styling */
.card a {
  display: block;
  position: relative;
  text-decoration: none;
  color: inherit;
  height: 100%;  /* Ensure link fills entire card */
}

/* Hover effects */
.card:hover {
  transform: translateY(-5px);
}

.card:hover .overlay {
  opacity: 1;
}

/* =================================================================
   IMAGE STYLING - Full card coverage
   ================================================================= */

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;        /* Ensures image covers entire card */
  object-position: center;  /* Centers image if cropping occurs */
  display: block;
  /*filter: grayscale(100%);
  transition: filter 0.3s ease; */
}

/* Color reveal on hover */
.card:hover img {
  filter: none;
}

/* =================================================================
   TEXT CONTENT OVERLAY - Always visible
   ================================================================= */

.card-content {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 2;  /* Ensure text appears above image and overlay */
}

.card-content .title {
  color: white;
  margin: 0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Main location title */
.card-content .main-title {
  font-size: var(--font-card-title);
  font-weight: bold;
  line-height: var(--font-line-height);
}

/* Country/region subtitle */
.card-content .country-subtitle {
  display: block;
  font-size: var(--font-card-subtitle);
  font-weight: normal;
  opacity: 0.85;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =================================================================
   HOVER OVERLAY - Description on hover
   ================================================================= */

.card .overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.1);  /* Subtle dark overlay */
  color: white;
  display: flex;
  align-items: start;
  justify-content: right;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;  /* Above image, below text content */
}

.card .overlay .desc {
  font-size: var(--font-card-desc);
  line-height: var(--font-line-height);
  font-weight: bold;
  text-align: right;
  margin: 0;
  padding: 1rem;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* =================================================================
   RESPONSIVE BREAKPOINTS - Height-based control system
   ================================================================= */

/* Tablet - reduce card height */
@media (max-width: 768px) {
  :root {
    --card-height: 270px;  /* Smaller cards for tablet */
  }
  
  .grid {
    margin: 4rem 1rem 2rem;
  }
  
  /* Adjust text positioning for smaller cards */
  .card-content {
    bottom: 15px;
    left: 15px;
  }

  .card-content .main-title {
    font-size: 1.4rem;
    line-height: 1.2;
  }
  
  .card-content .country-subtitle {
    font-size: 0.75rem;
    margin-bottom: 1px;
  }
}

/* Small tablet / Large mobile */
@media (max-width: 580px) {
  :root {
    --card-height: 240px;  /* Further reduction */
  }
  
  .grid {
    margin: 3rem 0.75rem 2rem;
    gap: 1.5rem;
    /* Keep fixed size to maintain centering */
    grid-template-columns: repeat(auto-fit, calc(var(--card-height) * var(--card-aspect-ratio)));
  }

  .card-content .main-title {
    font-size: 1.2rem;
    line-height: 1.2;
  }
  
  .card-content .country-subtitle {
    font-size: 0.7rem;
    margin-bottom: 1px;
  }
}

/* Mobile - smaller cards */
@media (max-width: 480px) {
  :root {
    --card-height: 210px;  /* Mobile-optimized size */
  }
  
  .grid {
    margin: 2rem 0.5rem 1rem;
    gap: 1rem;
    /* Keep fixed size for consistent centering */
    grid-template-columns: repeat(auto-fit, calc(var(--card-height) * var(--card-aspect-ratio)));
  }
  
  /* Smaller text for mobile */
  .card-content {
    bottom: 10px;
    left: 10px;
  }
  
  .card-content .main-title {
    font-size: 1.1rem;
    line-height: 1.1;
  }
  
  .card-content .country-subtitle {
    font-size: 0.65rem;
    margin-bottom: 1px;
  }
}

/* =================================================================
   CONTINENT FILTERS
   ================================================================= */

.continent-filters {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 5rem 0 6rem;
  flex-wrap: wrap;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  padding: 0.8rem 1.5rem;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  text-decoration: none;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.filter-btn.active {
  background: rgba(255, 255, 255, 0.9);
  color: var(--bg-primary);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* Card transition for filtering */
.card {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Responsive filters */
@media (max-width: 768px) {
  .continent-filters {
    margin: 4rem 0 5rem; /* Move down slightly */
    gap: 0.8rem;
  }

  .filter-btn {
    padding: 0.7rem 1.2rem; /* Smaller padding */
    font-size: 0.8rem; /* Smaller font size */
  }
}

@media (max-width: 480px) {
  .continent-filters {
    margin: 3rem 0 4rem; /* Move further down */
    gap: 0.6rem;
  }

  .filter-btn {
    padding: 0.6rem 1rem; /* Even smaller padding */
    font-size: 0.65rem; /* Even smaller font size */
  }
}