/* Reset and Base */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Merriweather', serif; background: #FDFDF6; color: #333; line-height: 1.6; }
h1, h2, h3 { font-family: 'Montserrat', sans-serif; }
a { color: #E07A5F; text-decoration: none; }
button { background: #81B29A; color: white; border: none; padding: 0.5rem 1rem; cursor: pointer; border-radius: 5px; transition: background 0.3s; }
button:hover { background: #6A9A7E; }

/* Header and Hero */
header { background: #F2CC8F; padding: 1rem; text-align: center; }
nav { display: flex; justify-content: space-between; align-items: center; }
nav ul { list-style: none; display: flex; gap: 1rem; }
.hero { margin-top: 2rem; }

/* Filters */
.filters { display: flex; gap: 1rem; padding: 1rem; justify-content: center; }
input, select { padding: 0.5rem; border: 1px solid #DDD; border-radius: 5px; }
#theme-filter { max-width: 12rem; }

/* Story Grid */
.story-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2rem; padding: 2rem; }
.card { background: white; border-radius: 10px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); padding: 1rem; opacity: 0; transform: translateY(20px); transition: opacity 0.5s, transform 0.5s; }
.card.visible { opacity: 1; transform: translateY(0); }
.card img { width: 100%; height: auto; border-radius: 5px; loading: lazy; }

/* Story Page */
.header-section { text-align: center; padding: 2rem; background: #E07A5F; color: white; }
.image-gallery {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
}
.art-style-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.art-style-row label {
  font-weight: 600;
}
#main-image {
  max-width: 80%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  transition: opacity 0.3s;
}
.tabs { display: flex; justify-content: center; gap: 1rem; margin-bottom: 1rem; }
.tab { background: #F2CC8F; padding: 0.5rem 1rem; border-radius: 5px; cursor: pointer; }
.tab.active { background: #E07A5F; color: white; }
#story-text { padding: 1rem; background: white; border-radius: 10px; }
.additional-content details { margin: 1rem 0; background: #81B29A; color: white; padding: 0.5rem; border-radius: 5px; }
.story-nav { display: flex; justify-content: space-between; padding: 1rem; align-items: center; }
.story-nav #prev,
.story-nav #next {
  font-size: 1.5rem;
  padding: 1rem 2rem;
}
.share {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1rem 1rem;
  gap: 1rem;
}
.share-left {
  display: flex;
  gap: 0.5rem;
}
.text-size-controls {
  display: flex;
  gap: 0.5rem;
}

/* Responsiveness */
@media (max-width: 768px) {
  .story-grid { grid-template-columns: 1fr; }
  #main-image { max-width: 100%; }
}

/* Accessibility */
:focus { outline: 2px solid #E07A5F; }
.high-contrast { background: black; color: white; } /* Toggle via JS if needed */

/* Animations */
.fade-in { animation: fadeIn 0.5s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }