/* Base Styles and CSS Variables */

/* Font Face Definition */
@font-face {
  font-family: 'AnimeAce';
  src: url('../fonts/animeace2_reg.otf') format('opentype'),
       url('../fonts/animeace2_reg.ttf') format('truetype');
  font-display: swap;
  font-weight: normal;
  font-style: normal;
}

/* CSS Variables - Default values (overridden inline in templates) */
:root {
  --primary-color: #ffd700;
  --secondary-color: #ff8c00;
  --accent-color: #ffa500;
  --text-color: #e0e0e0;
  --display-font: 'AnimeAce', Arial, sans-serif;
}

/* Base Styles */
* {
  box-sizing: border-box;
}

body {
  /* Use direct font reference first, then CSS variable for override support */
  font-family: 'AnimeAce', Arial, sans-serif !important;
  font-family: var(--display-font, 'AnimeAce', Arial, sans-serif) !important;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  position: relative;
}


/* Ensure all text elements use the custom font */
h1, h2, h3, h4, h5, h6,
p, a, span, div, li, td, th {
  font-family: var(--display-font) !important;
}

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

/* Narrow container for detail pages */
.container.narrow {
  max-width: 1000px;
}

/* Mystical Animated Background - Used on home page */
body.mystical-bg {
  background: linear-gradient(135deg, #b19cd9, #ff9a8b, #fbc2eb, #a1c4fd);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  body.mystical-bg {
    animation: none !important;
    background: linear-gradient(135deg, #b19cd9, #ff9a8b);
  }
}

/* Default background for other pages */
body.default-bg {
  background: var(--theme-bg-primary, var(--bg-gradient, linear-gradient(135deg, rgba(233, 30, 99, 0.03), rgba(156, 39, 176, 0.03))));
  background-size: 400% 400%;
  background-attachment: fixed;
  animation: gradientBG 15s ease infinite;
}

/* Dark theme: use solid color instead of gradient */
[data-theme="dark"] body.default-bg {
  background: var(--theme-bg-primary, #121212);
  animation: none;
}

/* Grid Layouts for Listing Pages */
.chapters-grid,
.characters-grid,
.objects-grid,
.stories-grid,
.songs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.chapter-card,
.character-card,
.object-card,
.story-card,
.song-card {
  background: var(--theme-card-bg, white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px var(--theme-card-shadow, rgba(0,0,0,0.1));
  transition: transform 0.3s, box-shadow 0.3s;
}

.chapter-card:hover,
.character-card:hover,
.object-card:hover,
.story-card:hover,
.song-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.chapter-image,
.character-image,
.object-image,
.story-image,
.song-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.chapter-content,
.character-content,
.object-content,
.story-content,
.song-content {
  padding: 25px;
}

.chapter-card h3,
.character-card h3,
.object-card h3,
.story-card h3,
.song-card h3 {
  margin: 0 0 10px 0;
  color: var(--primary-color);
  font-size: 1.4em;
}

.chapter-card .meta,
.character-card .meta,
.object-card .meta,
.story-card .meta,
.song-card .meta {
  font-size: 0.9em;
  color: #666;
  margin-bottom: 15px;
}

.chapter-card p,
.character-card p,
.object-card p,
.story-card p,
.song-card p {
  color: #555;
  line-height: 1.6;
  margin: 15px 0 0 0;
}

.chapter-card a,
.character-card a,
.object-card a,
.story-card a,
.song-card a {
  text-decoration: none;
  display: block;
}

/* Empty state for listing pages */
.empty-state-listing {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.empty-state-listing h2 {
  font-size: 2em;
  margin-bottom: 15px;
}

.empty-state-listing p {
  font-size: 1.1em;
}

/* Badge styles for listing pages */
.type-badge,
.category-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 500;
  margin-right: 8px;
}

/* Character type badges */
.type-protagonist {
  background: #dbeafe;
  color: #1e40af;
}

.type-antagonist {
  background: #fee2e2;
  color: #991b1b;
}

.type-supporting {
  background: #f3e8ff;
  color: #6b21a8;
}

/* Object category badges */
.category-weapon {
  background: #fef3c7;
  color: #92400e;
}

.category-artifact {
  background: #ddd6fe;
  color: #5b21b6;
}

.category-location {
  background: #cffafe;
  color: #0e7490;
}

.category-concept {
  background: #e0e7ff;
  color: #3730a3;
}

/* Songs list styles */
.songs-list {
  margin-top: 40px;
}

.song-item {
  padding: 15px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s;
  cursor: pointer;
}

.song-item:hover {
  background-color: #f9f9f9;
}

.song-item a {
  text-decoration: none;
  color: inherit;
}

.song-item h3 {
  margin: 0 0 5px 0;
}

.song-item p {
  margin: 0;
  color: #666;
  font-size: 0.9em;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--display-font);
}

h1 {
  font-size: 3em;
  color: var(--primary-color);
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

h2 {
  color: #333;
  margin-bottom: 40px;
  font-size: 2.5em;
  text-align: center;
}

/* Buttons */
.btn {
  background: var(--accent-color);
  color: white;
  padding: 18px 40px;
  text-decoration: none;
  border-radius: 50px;
  display: inline-block;
  transition: all 0.3s;
  font-size: 1.1em;
  font-weight: bold;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  border: none;
  cursor: pointer;
}

.btn:hover {
  background: #e68800;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* Sections - reduced padding */
.section {
  padding: 40px 20px;
}

/* Hero Section - reduced padding */
.hero {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 50px 20px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.hero h1 {
  font-size: 2.5em;
  margin: 0 0 10px 0;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
  color: white;
  line-height: 1.2;
}

.hero p {
  font-size: 1.2em;
  margin: 0 0 25px 0;
  opacity: 0.95;
  line-height: 1.4;
}

/* Features Grid */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.feature {
  text-align: center;
  padding: 40px;
  background: white;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transition: all 0.3s;
}

.feature:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.feature h3 {
  color: var(--primary-color);
  font-size: 1.8em;
  margin-bottom: 15px;
}

/* Featured Grid */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 25px;
  margin-top: 20px;
}

.featured-item {
  background: white;
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transition: all 0.3s;
}

.featured-item:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.featured-item a {
  text-decoration: none;
  color: inherit;
}

.featured-item img {
  width: 100%;
  border-radius: 10px;
  margin-bottom: 15px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  transition: transform 0.3s;
}

.featured-item:hover img {
  transform: scale(1.05);
}

.featured-item h4 {
  margin: 0 0 10px 0;
  font-size: 1.2em;
  color: #333;
}

.featured-item p {
  margin: 0;
  font-size: 0.9em;
  color: #666;
}

