/* Reset and base styles */
:root {
  --bg-color: #F7F9FC;
  --text-primary: #1f2937;
  /* gray-800 */
  --text-secondary: #4b5563;
  /* gray-600 */
  --emerald-50: #ecfdf5;
  --emerald-400: #34d399;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --emerald-800: #065f46;
  --red-500: #ef4444;

  /* Base CSS Compatibility Variables */
  --earth-green: #2C7A4B;
  --warm-terracotta: #D9733B;
  --dark-text: #1F2D2E;
  --white: #ffffff;
  --transition: all 0.25s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  outline: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Hero Header */
.hero-header {
  position: relative;
  height: 35vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

@media (min-width: 768px) {
  .hero-header {
    height: 40vh;
  }
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
}

.hero-content {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 0 1rem;
  margin-top: 2rem;
}

.hero-title {
  font-size: 2.25rem;
  line-height: 2.5rem;
  font-weight: 700;
  color: white;
  margin-bottom: 1rem;
  letter-spacing: -0.025em;
  filter: drop-shadow(0 10px 8px rgba(0, 0, 0, 0.04)) drop-shadow(0 4px 3px rgba(0, 0, 0, 0.1));
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.6s forwards;
}

@media (min-width: 768px) {
  .hero-title {
    font-size: 3rem;
    line-height: 1;
  }
}

@media (min-width: 1024px) {
  .hero-title {
    font-size: 3.75rem;
    line-height: 1;
  }
}

.hero-subtitle {
  font-size: 1.125rem;
  line-height: 1.75rem;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 500;
  max-width: 42rem;
  margin: 0 auto;
  filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.07)) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.06));
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.6s 0.2s forwards;
}

@media (min-width: 768px) {
  .hero-subtitle {
    font-size: 1.25rem;
    line-height: 1.75rem;
  }
}

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Main Content */
.main-content {
  max-width: 80rem;
  margin: 0 auto;
  padding: 3rem 1rem;
}

@media (min-width: 640px) {
  .main-content {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 768px) {
  .main-content {
    padding-top: 4rem;
    padding-bottom: 4rem;
  }
}

@media (min-width: 1024px) {
  .main-content {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* Category Tabs */
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 3rem;
}

@media (min-width: 768px) {
  .category-tabs {
    gap: 0.75rem;
  }
}

.category-btn {
  padding: 0.625rem 1.25rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  transition: all 0.3s;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.category-btn.active {
  background-color: var(--emerald-700);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transform: scale(1.05);
}

.category-btn:not(.active) {
  background-color: white;
  color: var(--text-secondary);
}

.category-btn:not(.active):hover {
  background-color: var(--emerald-50);
  color: var(--emerald-700);
}

/* Photo Grid */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .photo-grid {
    gap: 2rem;
  }
}

@media (min-width: 1024px) {
  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.photo-card {
  background-color: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: all 0.3s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(30px) scale(0.9);
}

.photo-card.show {
  animation: popIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes popIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.photo-card:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transform: translateY(-0.25rem);
}

.photo-img-container {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.photo-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.photo-card:hover .photo-img-container img {
  transform: scale(1.05);
}

.photo-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0);
  transition: background-color 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-card:hover .photo-overlay {
  background-color: rgba(0, 0, 0, 0.3);
}

.photo-overlay .lucide-maximize-2 {
  color: white;
  opacity: 0;
  transition: opacity 0.3s;
  filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.07)) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.06));
}

.photo-card:hover .photo-overlay .lucide-maximize-2 {
  opacity: 1;
}

.like-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 10;
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 0.5rem;
  border-radius: 9999px;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: transform 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  width: 34px;
}

.like-btn:hover {
  transform: scale(1.1);
}

.like-btn i,
.like-btn svg {
  color: #9ca3af;
  flex-shrink: 0;
  transition: fill 0.3s, color 0.3s;
}

.like-btn.liked i,
.like-btn.liked svg {
  color: var(--red-500);
  fill: var(--red-500);
}

.photo-info {
  padding: 1.25rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.photo-category {
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 600;
  color: var(--emerald-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
  display: block;
}

.photo-caption {
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 600;
  color: #111827;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.photo-likes-container {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: #6b7280;
}

.photo-likes-container i,
.photo-likes-container svg {
  margin-right: 0.375rem;
}

/* Load More */
.load-more-container {
  margin-top: 4rem;
  display: flex;
  justify-content: center;
  opacity: 0;
  animation: fadeIn 0.5s forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.load-more-btn {
  background-color: var(--emerald-700);
  color: white;
  padding: 0.875rem 2rem;
  border-radius: 9999px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s;
}

.load-more-btn:hover {
  background-color: var(--emerald-800);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
}

.hidden {
  display: none !important;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: rgba(255, 255, 255, 0.7);
  padding: 0.5rem;
  z-index: 50;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 9999px;
  transition: color 0.3s, background-color 0.3s;
}

@media (min-width: 768px) {
  .lightbox-close {
    top: 1.5rem;
    right: 1.5rem;
  }
}

.lightbox-close:hover {
  color: white;
  background-color: rgba(0, 0, 0, 0.4);
}

.lightbox-prev,
.lightbox-next {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.7);
  padding: 0.75rem;
  z-index: 50;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 9999px;
  transition: all 0.3s;
}

@media (min-width: 768px) {

  .lightbox-prev,
  .lightbox-next {
    display: flex;
  }
}

.lightbox-prev:hover,
.lightbox-next:hover {
  color: white;
  background-color: rgba(0, 0, 0, 0.4);
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

.lightbox-content {
  position: relative;
  width: 100%;
  max-width: 64rem;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  opacity: 0;
  transform: scale(0.95);
}

.animate-spring {
  animation: springIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes springIn {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (min-width: 768px) {
  .lightbox-content {
    padding-left: 4rem;
    padding-right: 4rem;
  }
}

.lightbox-img-container {
  position: relative;
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.lightbox-img-container img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 0.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

@media (min-width: 768px) {
  .lightbox-img-container img {
    max-height: 80vh;
  }
}

.lightbox-info {
  width: 100%;
  max-width: 48rem;
  margin-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  color: white;
  background-color: rgba(0, 0, 0, 0.4);
  padding: 1rem;
  border-radius: 0.75rem;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

@media (min-width: 768px) {
  .lightbox-info {
    padding: 1.5rem;
  }
}

.lightbox-info-text h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

@media (min-width: 768px) {
  .lightbox-info-text h3 {
    font-size: 1.5rem;
  }
}

.lightbox-info-text p {
  color: var(--emerald-400);
  font-weight: 500;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lightbox-like-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  transition: background-color 0.3s;
}

.lightbox-like-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.lightbox-like-btn i,
.lightbox-like-btn svg {
  color: white;
  transition: fill 0.3s, color 0.3s;
}

.lightbox-like-btn.liked i,
.lightbox-like-btn.liked svg {
  fill: var(--red-500);
  color: var(--red-500);
}

.lightbox-like-btn span {
  font-weight: 500;
}