/* Responsive images in content */
main img, .markdown img, .content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 1.5rem auto;
}
/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
}

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Libre Baskerville', serif;
    margin-bottom: 1rem;
    line-height: 1.3;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: 1rem;
}

a {
    color: #2563eb;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #1d4ed8;
}

/* Header */
.site-header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.navbar {
    padding: 1rem 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h1 {
    font-size: 1.5rem;
    margin: 0;
    color: #1f2937;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
}

.nav-link {
    font-weight: 500;
    color: #6b7280;
    transition: color 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: #2563eb;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background: #333;
    margin: 3px 0;
    transition: 0.3s;
}

/* Main Content */
.main-content {
    margin-top: 80px;
    min-height: calc(100vh - 160px);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
}

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

.hero-content h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
}

.featured-story {
    margin-top: 2rem;
}

.featured-story h3 {
    margin-bottom: 1rem;
    opacity: 0.9;
}

/* Story Cards */
.story-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 1.5rem;
}

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

.story-card.featured {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
}

.story-card h3,
.story-card h4 {
    margin-bottom: 0.5rem;
}

.story-card h3 a,
.story-card h4 a {
    color: inherit;
}

.story-card.featured h4 a {
    color: white;
}

.story-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.story-meta span {
    background: #f3f4f6;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.genre { background: #dbeafe; color: #1d4ed8; }
.origin { background: #d1fae5; color: #047857; }
.reading-time { background: #fef3c7; color: #92400e; }
.theme { background: #e0e7ff; color: #5b21b6; }
.age-group { background: #fce7f3; color: #be185d; }
.date { background: #f3f4f6; color: #6b7280; }

.story-card.featured .story-meta span {
    background: rgba(255,255,255,0.2);
    color: white;
}

.read-more {
    font-weight: 500;
    color: #2563eb;
    display: inline-block;
    margin-top: 0.5rem;
}

.story-card.featured .read-more {
    color: white;
}

/* Stories Grid */
.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Browse Section */
.browse-section,
.recent-section {
    padding: 3rem 0;
}

.browse-section {
    background: #f9fafb;
}

.browse-section h2,
.recent-section h2 {
    text-align: center;
    margin-bottom: 2rem;
}

/* Filters */
.browse-filters,
.advanced-filters {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filter-group,
.search-group,
.sort-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label,
.sort-group label {
    font-weight: 500;
    color: #374151;
}

.filter-select,
.sort-select,
.search-input {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
}

.browse-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    color: white;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
    color: white;
}

.view-all {
    text-align: center;
    margin-top: 2rem;
}

/* Story Page */
.story {
    max-width: 800px;
    margin: 0 auto;
    padding: 3.5rem 20px 2rem; /* Increased top padding to ensure story title isn't covered */
}

.story-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.story-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
    padding-top: 1rem; /* Additional padding to ensure title is visible */
}

.story-meta {
    margin-bottom: 1rem;
}

.story-meta > div {
    margin-bottom: 0.5rem;
}

.story-meta span {
    display: inline-block;
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
}

.genre-tag,
.origin-tag,
.theme-tag,
.age-group-tag {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.genre-tag { background: #dbeafe; color: #1d4ed8; }
.origin-tag { background: #d1fae5; color: #047857; }
.theme-tag { background: #e0e7ff; color: #5b21b6; }
.age-group-tag { background: #fce7f3; color: #be185d; }

/* Social Sharing */
.social-sharing {
    margin-top: 1rem;
}

.social-sharing h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.share-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.share-btn {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
}

.share-btn.facebook { background: #1877f2; }
.share-btn.twitter { background: #1da1f2; }
.share-btn.linkedin { background: #0077b5; }

.share-btn:hover {
    opacity: 0.9;
    color: white;
}

/* Story Content */
.story-content {
    margin-bottom: 2rem;
}

.story-attribution {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 2rem;
    font-size: 0.875rem;
}

.story-text {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.125rem;
    line-height: 1.7;
}

.story-text p {
    margin-bottom: 1.5rem;
}

.story-notes {
    background: #f3f4f6;
    padding: 1rem;
    border-radius: 6px;
    margin-top: 2rem;
}

/* Rating Widget */
.story-rating {
    background: #f9fafb;
    padding: 1.5rem 0;
    margin: 2rem 0;
}

.rating-widget {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.rating-widget .star {
    font-size: 1.5rem;
    color: #d1d5db;
    cursor: pointer;
    transition: color 0.2s ease;
}

.rating-widget .star:hover,
.rating-widget .star.active {
    color: #fbbf24;
}

.rating-display {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Comments */
.comments-section {
    margin: 2rem 0;
}

/* Similar Stories */
.similar-stories {
    background: #f9fafb;
    padding: 2rem 0;
    margin-top: 2rem;
}

/* Page Header */
.page-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 0;
}

.page-header h1 {
    margin-bottom: 0.5rem;
}

/* Results Info */
.results-info {
    margin-bottom: 1rem;
    color: #6b7280;
    font-size: 0.875rem;
}

/* Load More & No Results */
.load-more {
    text-align: center;
    margin-top: 2rem;
}

.no-results {
    text-align: center;
    padding: 3rem 0;
    color: #6b7280;
}

/* Footer */
.site-footer {
    background: #1f2937;
    color: white;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: #d1d5db;
}

.footer-links a:hover {
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }
    
    .nav-toggle {
        display: flex;
    }

    /* Hide hamburger when menu is active */
    .nav-menu.active ~ .nav-toggle,
    .nav-toggle.active {
        display: none;
    }

    /* Optional: Animate hamburger to X when active */
    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }

    .nav-menu.active {
        display: flex;
        flex-direction: column;
    }
    
    .hero-content h2 {
        font-size: 2rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
    
    .stories-grid {
        grid-template-columns: 1fr;
    }
    
    .browse-filters,
    .filter-row {
        grid-template-columns: 1fr;
    }
    
    .filter-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .share-buttons {
        justify-content: center;
    }
    
    .footer-container {
        flex-direction: column;
        text-align: center;
    }
    
    .story-title {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .story {
        padding: 3rem 15px 1rem; /* Increased top padding to prevent overlap */
    }
    
    .hero-content h2 {
        font-size: 1.75rem;
    }
    
    .story-title {
        font-size: 1.75rem;
        padding-top: 0.5rem; /* Smaller padding on mobile but still maintaining space */
    }
}

/* Story Tags */
.story-tags {
    margin-top: 1rem;
}

.story-tags .tag {
    display: inline-block;
    background: #e5e7eb;
    color: #374151;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
}
