/* =========================================================================
   VARIABLES & THEMING
   ========================================================================= */
:root {
  /* Color Palette (Kawaii / Pastel) */
  --bg-gradient-start: #ffdde1;
  --bg-gradient-end: #ee9ca7;
  --bg-blur-1: rgba(255, 182, 193, 0.4);
  --bg-blur-2: rgba(221, 160, 221, 0.4);
  --bg-blur-3: rgba(173, 216, 230, 0.4);
  
  --glass-bg: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(255, 255, 255, 0.8);
  --glass-shadow: 0 8px 32px 0 rgba(255, 105, 180, 0.15);
  --glass-shadow-hover: 0 12px 48px 0 rgba(255, 105, 180, 0.3);

  --text-main: #5a4a58;
  --text-light: #8b7989;
  --accent: #ff758c;
  --accent-light: #ff7eb3;

  /* Typography */
  --font-primary: 'M PLUS Rounded 1c', 'Nunito', sans-serif;
  
  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-bounce: 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* Spacing & Layout */
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 32px;
  --max-width: 1200px;
}

/* =========================================================================
   RESET & BASE STYLES
   ========================================================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-primary);
  color: var(--text-main);
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  background-attachment: fixed; /* Keeps background still while scrolling */
  min-height: 100vh;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

/* Background Decorative Blurs for Glassmorphism depth */
.bg-blur {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  opacity: 0.8;
  animation: float 15s infinite alternate ease-in-out;
}

.bg-blur-1 {
  width: 400px;
  height: 400px;
  background-color: var(--bg-blur-1);
  top: -100px;
  left: -100px;
}

.bg-blur-2 {
  width: 500px;
  height: 500px;
  background-color: var(--bg-blur-2);
  bottom: -150px;
  right: -100px;
  animation-delay: -5s;
}

.bg-blur-3 {
  width: 300px;
  height: 300px;
  background-color: var(--bg-blur-3);
  top: 40%;
  left: 40%;
  animation-duration: 20s;
}

@keyframes float {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-50px) scale(1.1); }
}

/* =========================================================================
   LAYOUT & UTILITIES
   ========================================================================= */
.app-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

/* =========================================================================
   HEADER
   ========================================================================= */
.site-header {
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.site-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  letter-spacing: -0.02em;
}

.site-title .icon {
  font-size: 0.8em;
  animation: gentle-bounce 2s infinite;
}

.site-title .icon:last-child {
  animation-delay: 1s;
}

.site-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text-light);
  font-weight: 700;
}

@keyframes gentle-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* =========================================================================
   NAVIGATION (TABS)
   ========================================================================= */
.genre-nav {
  border-radius: var(--radius-md);
  padding: 1rem;
  position: sticky;
  top: 1rem;
  z-index: 100;
}

.tab-list {
  display: flex;
  list-style: none;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.4);
  border: 2px solid transparent;
  padding: 0.6rem 1.5rem;
  border-radius: 50px; /* Pill shape */
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition-normal);
  user-select: none;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 117, 140, 0.2);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  color: white;
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 15px rgba(255, 117, 140, 0.4);
  transform: scale(1.05);
}

/* =========================================================================
   MAIN CONTENT (PHOTO GRID)
   ========================================================================= */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  min-height: 400px; /* Prevent layout shift while loading */
}

/* Loading State */
.loading-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-weight: 700;
  gap: 1rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 117, 140, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================================================================
   PHOTO CARD
   ========================================================================= */
.photo-card {
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: var(--transition-bounce);
  opacity: 0;           /* For entrance animation */
  transform: translateY(20px);
  cursor: pointer;
}

.photo-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.photo-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--glass-shadow-hover);
  border-color: rgba(255, 255, 255, 1);
}

.card-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4; /* Portrait typical for photobooks */
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.5); /* Placeholder while loading */
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.photo-card:hover .card-image {
  transform: scale(1.06);
}

/* Genre Badge Overlay */
.card-genre-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  color: var(--accent);
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  z-index: 2;
}

.card-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 0.5rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-main);
  /* Truncate text to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-author {
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 700;
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-main);
  flex-grow: 1;
  /* Truncate text to 3 lines */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Affiliate Button */
.affiliate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.8rem 1rem;
  margin-top: auto;
  background: linear-gradient(135deg, var(--accent) 0%, #ff5277 100%);
  color: white;
  text-decoration: none;
  font-weight: 800;
  border-radius: var(--radius-sm);
  transition: var(--transition-normal);
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(255, 117, 140, 0.3);
}

.affiliate-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-25deg);
  transition: all 0.5s;
}

.affiliate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 117, 140, 0.5);
}

.affiliate-btn:hover::before {
  left: 200%; /* Shine effect */
}

/* =========================================================================
   FOOTER
   ========================================================================= */
.site-footer {
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-light);
  font-weight: 700;
}

.disclaimer {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  opacity: 0.8;
}

/* =========================================================================
   MEDIA QUERIES
   ========================================================================= */
@media (max-width: 600px) {
  .app-container {
    padding: 1rem;
    gap: 1rem;
  }
  
  .site-header {
    padding: 1.5rem 1rem;
  }
  
  .grid-container {
    grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
    gap: 1.5rem;
  }
  
  .genre-nav {
    padding: 0.5rem;
  }
  
  .tab-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 0.5rem; /* Space for scrollbar */
    /* Hide scrollbar visually but keep functionality */
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .tab-list::-webkit-scrollbar {
    display: none;
  }
  
  .tab-btn {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
}
