/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Georgia", "Times New Roman", serif;
  line-height: 1.6;
  color: #ffffff;
  background-color: #000000;
  overflow-x: hidden;
}

/* Hero Section */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
  background: radial-gradient(circle at center, #1a1a1a 0%, #000000 70%);
  position: relative;
}

/* Nepal Flag */
.nepal-flag {
  position: absolute;
  top: 2rem;
  right: 2rem;
  width: 60px;
  height: auto;
  z-index: 10;
  opacity: 0.9;
}

.nepal-flag img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
  transition: opacity 0.3s ease;
}

.nepal-flag:hover img {
  opacity: 1;
}

.candle-container {
  margin-bottom: 3rem;
  position: relative;
}

/* Animated Candle */
.candle {
  position: relative;
  width: 20px;
  height: 120px;
  margin: 0 auto;
}

.flame {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 20px;
  background: radial-gradient(circle, #ffeb3b 30%, #ff9800 70%, #ff5722 100%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: flicker 2s ease-in-out infinite alternate;
  box-shadow: 0 0 20px #ff9800, 0 0 40px #ff5722;
}

.wick {
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 10px;
  background: #333;
  border-radius: 50%;
}

.wax {
  width: 20px;
  height: 100px;
  background: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
  border-radius: 0 0 10px 10px;
  position: relative;
}

.base {
  width: 30px;
  height: 8px;
  background: #8d6e63;
  border-radius: 50%;
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
}

@keyframes flicker {
  0%,
  100% {
    transform: translateX(-50%) scale(1) rotate(-1deg);
  }
  50% {
    transform: translateX(-50%) scale(1.1) rotate(1deg);
  }
}

/* Hero Text */
.hero-text h1 {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  font-weight: 300;
  letter-spacing: 2px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.subtitle {
  font-size: 1.3rem;
  margin-bottom: 2rem;
  color: #cccccc;
  font-style: italic;
}

.description {
  max-width: 800px;
  margin: 0 auto;
  font-size: 1.1rem;
  line-height: 1.8;
  color: #e0e0e0;
}

.description p {
  margin-bottom: 1.5rem;
}

.scroll-indicator {
  margin-top: 3rem !important;
  font-size: 1rem;
  color: #888;
  animation: pulse 2s ease-in-out infinite;
}

.info-link {
  margin: 2rem 0 !important;
  text-align: center;
}

.info-link a {
  color: #888;
  text-decoration: underline;
  font-size: 0.95rem;
  transition: color 0.3s ease;
  font-weight: normal;
}

.info-link a:hover {
  color: #bbb;
  text-decoration: underline;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

/* Memorial Section */
.memorial-section {
  padding: 5rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.memorial-section h2 {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 2rem;
  color: #ffffff;
  font-weight: 300;
  letter-spacing: 1px;
}

/* Profiles Info Container */
.profiles-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
  padding: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.profile-count {
  font-size: 1rem;
  color: #ddd;
  font-weight: 300;
  letter-spacing: 0.5px;
}

/* Sort Controls */
.sort-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sort-label {
  color: #ccc;
  font-size: 0.9rem;
  margin-right: 1rem;
}

.sort-btn {
  background: transparent;
  border: 1px solid #555;
  color: #ccc;
  padding: 0.5rem 1rem;
  margin: 0 0.25rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.sort-btn:hover {
  border-color: #888;
  color: #fff;
}

.sort-btn.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: #888;
  color: #fff;
}

/* Profiles Grid Layout */
.profiles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4rem;
  margin-top: 2rem;
}

/* Profile Cards */
.profile-card {
  display: flex;
  flex-direction: column;
  background: rgba(40, 40, 40, 0.8);
  border-radius: 15px;
  margin-bottom: 0;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  height: fit-content;
}

.profile-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7);
}

.profile-image {
  flex: none;
  height: 250px;
  width: 100%;
  overflow: hidden;
  background: #333;
}

.profile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.profile-image img.fallback-image {
  filter: brightness(0.6) sepia(0.3) saturate(0.8);
  opacity: 0.7;
}

.profile-card:hover .profile-image img {
  transform: scale(1.05);
}

.profile-info {
  flex: 1;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.profile-info .name {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  color: #ffffff;
  font-weight: 400;
}

.profile-info .age {
  font-size: 1rem;
  color: #bbb;
  margin-bottom: 1rem;
  font-style: italic;
}

.profile-info .description {
  font-size: 1rem;
  line-height: 1.6;
  color: #e0e0e0;
  max-width: none;
}

/* Footer */
footer {
  text-align: center;
  padding: 3rem 2rem;
  background: rgba(20, 20, 20, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

footer p {
  margin-bottom: 0.5rem;
  color: #ccc;
}

.date {
  font-style: italic;
  color: #888;
  font-size: 0.9rem;
}

.sources-link {
  margin-top: 1rem;
  font-size: 0.85rem;
}

.sources-link a {
  color: #999;
  text-decoration: none;
  border-bottom: 1px dotted #bbb;
  transition: color 0.3s ease;
}

.sources-link a:hover {
  color: #ccc;
  border-bottom-color: #ddd;
}

/* Loading and Fallback States */
.loading-message,
.fallback-message {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 2rem;
  color: #ccc;
  font-style: italic;
}

.loading-message p {
  margin: 0;
  font-size: 1.1rem;
}

.fallback-message h3 {
  color: #fff;
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.fallback-message p {
  margin: 0;
  font-size: 1rem;
  color: #aaa;
}

/* Responsive Design */
@media (max-width: 768px) {
  .nepal-flag {
    top: 1rem;
    right: 1rem;
    width: 40px;
  }

  .info-link a {
    font-size: 0.9rem;
  }

  .profiles-info {
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
  }

  .profile-count {
    font-size: 0.9rem;
  }

  .sort-controls {
    justify-content: center;
  }

  .sort-label {
    margin-bottom: 0.5rem;
  }

  .sort-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }

  .profiles-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .hero-text h1 {
    font-size: 2.5rem;
  }

  .subtitle {
    font-size: 1.1rem;
  }

  .description {
    font-size: 1rem;
  }

  .profile-image {
    height: 250px;
  }

  .profile-info {
    padding: 1.5rem;
  }

  .memorial-section h2 {
    font-size: 2rem;
  }

  .memorial-section {
    padding: 3rem 1rem;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 1rem;
  }

  .hero-text h1 {
    font-size: 2rem;
  }

  .candle {
    transform: scale(0.8);
  }
}
