/*
  ================================================
  Theme 3: Earthy & Organic (FIXED)
  ================================================
  - Style: Natural, warm, trustworthy, and calm
  - Palette: Earth tones - deep greens, sandy beiges, and warm grays
  - FIX: Carousel logic updated to use 'transform' for sliding, matching the project's JavaScript.
*/

:root {
  --primary-color: #2c3e50;  /* Deep Forest Green/Blue */
  --secondary-color: #f7f3e9;/* Sandy Beige */
  --accent-color: #e74c3c;   /* Terracotta Red */
  --text-primary: #34495e;   /* Dark Slate */
  --text-secondary: #7f8c8d; /* Muted Gray */
  --background-color: #f7f3e9; /* Light Sand background */
  --card-shadow: 0 3px 5px rgba(0, 0, 0, 0.05);
  --card-shadow-hover: 0 6px 12px rgba(0, 0, 0, 0.1);
}

*, *::before, *::after {
  box-sizing: border-box;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body {
  font-family: 'Lora', 'Georgia', serif; /* Serif font for a classic feel */
  margin: 0;
  padding: 0;
  background-color: var(--background-color);
  color: var(--text-primary);
  line-height: 1.6;
}

.main-header {
  background-color: var(--primary-color);
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--secondary-color);
}

.header-content {
  max-width: 1200px; margin: 0 auto 2rem auto;
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
}

.logo { height: 110px; width: auto; }

.main-header h1 {
  font-family: 'Poppins', sans-serif;
  font-size: 2.5rem;
  font-weight: 600;
  margin: 0;
}

.download-section { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }

.download-btn {
  background-color: transparent;
  color: var(--secondary-color);
  border: 2px solid var(--secondary-color);
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  border-radius: 4px;
}

.download-btn:hover { background-color: var(--secondary-color); color: var(--primary-color); }
.logo-right { width: 14px; height: auto; filter: brightness(0) invert(1); }
.download-btn:hover .logo-right { filter: none; }

.container { max-width: 1200px; margin: 4rem auto; padding: 0 1rem; }

.story-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2.5rem;
}

.story-item {
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  cursor: pointer;
}

.story-item:hover { transform: translateY(-6px); box-shadow: var(--card-shadow-hover); }

.cover-image { width: 100%; height: 200px; object-fit: cover; }

.story-content { padding: 1.5rem; }

.story-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.3rem; font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--primary-color);
}

.story-description { font-size: 1.05rem; color: var(--text-secondary); }

/* --- Modal --- */
.story-details {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(44, 62, 80, 0.85);
  backdrop-filter: blur(5px);
  display: none; justify-content: center; align-items: center;
  z-index: 1000; padding: 20px; overflow-y: auto;
}
.story-details-content {
  background: #ffffff;
  border-radius: 8px;
  padding: 2.5rem;
  max-width: 800px; width: 95%;
  position: relative; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 15px 40px rgba(0,0,0,0.2);
}
.story-details-content h2 {
  font-family: 'Poppins', sans-serif;
  font-size: 2rem; margin: 0 0 1rem 0; color: var(--primary-color);
}
.meta-info {
  display: flex; gap: 1.5rem; flex-wrap: wrap;
  padding: 1rem 0; margin-bottom: 1.5rem;
  border-top: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  font-family: 'Poppins', sans-serif;
}
.meta-label { font-weight: 600; color: var(--text-secondary); font-size: 0.8rem; text-transform: uppercase; }
#detail-location { font-weight: 400; color: var(--text-secondary); font-size: 0.8rem; text-transform: uppercase; }
#detail-tag { font-weight: 400; font-size: 0.8rem; text-transform: uppercase; }
#detail-createdAt { font-weight: 400; color: var(--text-secondary); font-size: 0.8rem; text-transform: uppercase; }
.tag {
  background: var(--accent-color);
  color: white; padding: 0.3rem 0.8rem; border-radius: 4px; font-size: 0.9rem;
}
.story-body { font-size: 1.15rem; line-height: 1.8; }
.close-btn:hover {
    color: var(--secondary-color);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary-color);
    cursor: pointer;
    transition: color 0.3s ease;
}

/*
  ================================================
  Carousel Fix Section
  ================================================
  The following CSS rules have been taken from your original working file
  to ensure the JavaScript can correctly control the sliding animation.
  The aesthetic styles from Theme 3 have been applied.
*/

.media-carousel {
  position: relative;
  width: 100%;
  margin: 20px 0;
}

.carousel-content {
  position: relative;
  overflow: hidden;
  height: 400px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  width: 100%;
}

/* This is the key functional rule that works with your JS */
.carousel-item {
  position: absolute;
  width: 100%;
  height: 100%;
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); /* Smoother transition */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.carousel-media {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: pointer;
}

.carousel-btn {
  background: rgba(44, 62, 80, 0.6);
  color: white;
  border: none;
  border-radius: 4px;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

.carousel-btn:hover {
  background: var(--primary-color);
}

.prev-btn { left: 10px; }
.next-btn { right: 10px; }

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  background: #e6e2d8;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 3rem;
  font-family: 'Poppins', sans-serif;
}

.footer-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
}

.footer-link:hover {
  color: var(--accent-color);
}


/* --- Fullscreen Overlay (from original file) --- */
.fullscreen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1001; /* Higher z-index than modal */
  cursor: pointer;
}

.fullscreen-image {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}