Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ // Mobile menu toggle
+ const menuToggle = document.querySelector('.menu-toggle');
+ const navLinks = document.querySelector('.nav-links');
+
+ menuToggle.addEventListener('click', () => {
+ navLinks.classList.toggle('active');
+ menuToggle.classList.toggle('active');
+ });
+
+ // Sample data - In a real application, this would come from an API
+ const sampleContent = {
+ featured: [
+ {
+ title: "The Last Summer Day",
+ author: "Sarah Chen",
+ magazine: "Narrative Magazine",
+ excerpt: "The sun hung low on the horizon, painting the sky in impossible colors..."
+ },
+ {
+ title: "Metamorphosis in Blue",
+ author: "James Wright",
+ magazine: "Poetry Foundation",
+ excerpt: "Where the light bends / In the corners of your mind..."
+ }
+ ],
+ stories: [
+ {
+ title: "The Silent House",
+ author: "Michael Torres",
+ magazine: "Ploughshares"
+ },
+ {
+ title: "Beyond the Fence",
+ author: "Lisa Kumar",
+ magazine: "Granta"
+ }
+ ],
+ poems: [
+ {
+ title: "Morning Ritual",
+ author: "Emma Wilson",
+ magazine: "Paris Review"
+ },
+ {
+ title: "Urban Symphony",
+ author: "David Chang",
+ magazine: "Poetry Magazine"
+ }
+ ]
+ };
+
+ // Populate content
+ function createCard(item, type) {
+ const card = document.createElement('article');
+ card.className = 'card';
+ card.innerHTML = `
+
${item.title}
+ ${item.excerpt ? `
${item.excerpt}
` : ''}
+ `;
+ return card;
+ }
+
+ // Populate featured content
+ const featuredGrid = document.querySelector('.featured-grid');
+ sampleContent.featured.forEach(item => {
+ featuredGrid.appendChild(createCard(item, 'featured'));
+ });
+
+ // Populate stories
+ const storyGrid = document.querySelector('.story-grid');
+ sampleContent.stories.forEach(item => {
+ storyGrid.appendChild(createCard(item, 'story'));
+ });
+
+ // Populate poems
+ const poemGrid = document.querySelector('.poem-grid');
+ sampleContent.poems.forEach(item => {
+ poemGrid.appendChild(createCard(item, 'poem'));
+ });
+
+ // Smooth scroll for navigation links
+ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
+ anchor.addEventListener('click', function (e) {
+ e.preventDefault();
+ const target = document.querySelector(this.getAttribute('href'));
+ if (target) {
+ target.scrollIntoView({
+ behavior: 'smooth',
+ block: 'start'
+ });
+ // Close mobile menu if open
+ navLinks.classList.remove('active');
+ }
+ });
+ });
+
+ // Intersection Observer for animation
+ const observer = new IntersectionObserver((entries) => {
+ entries.forEach(entry => {
+ if (entry.isIntersecting) {
+ entry.target.style.opacity = '1';
+ entry.target.style.transform = 'translateY(0)';
+ }
+ });
+ }, {
+ threshold: 0.1
+ });
+
+ document.querySelectorAll('.card').forEach(card => {
+ card.style.opacity = '0';
+ card.style.transform = 'translateY(20px)';
+ card.style.transition = 'opacity 0.5s ease, transform 0.5s ease';
+ observer.observe(card);
+ });
+ });