Skip to content

Instantly share code, notes, and snippets.

@badouine
Created December 26, 2024 11:03
Show Gist options
  • Save badouine/d9c9830918356b5052c80b8ab6490688 to your computer and use it in GitHub Desktop.
Save badouine/d9c9830918356b5052c80b8ab6490688 to your computer and use it in GitHub Desktop.
Winter Solstice
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
<script src="script.js" defer></script>
<title>Winter Solstice Celebrations Around the World</title>
</head>
<body>
<header id="main-header">
<h1>Celebrating the Winter Solstice</h1>
<nav id="main-nav">
<ul>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#science">The Science</a></li>
<li><a href="#hemispheres">Solstice Across Hemispheres</a></li>
<li><a href="#celebrations">Global Celebrations</a></li>
<li><a href="#traditions">Solstice Traditions</a></li>
<li><a href="#conclusion">Conclusion</a></li>
</ul>
</nav>
</header>
<section id="introduction">
<h2>Introduction to the Winter Solstice</h2>
<p>The winter solstice is a significant astronomical event that marks the shortest day and the longest night of the year. It occurs annually in December in the Northern Hemisphere and in June in the Southern Hemisphere. This event has been observed and celebrated by cultures around the world for thousands of years, often symbolizing rebirth, reflection, and the triumph of light over darkness.</p>
</section>
<section id="science">
<h2>The Science Behind the Solstice</h2>
<p>The solstices occur due to the Earth's axial tilt of approximately 23.5 degrees relative to its orbital plane around the Sun. This tilt causes different parts of the Earth to receive varying amounts of sunlight throughout the year, leading to the changing seasons. During the winter solstice, one hemisphere is tilted the farthest away from the Sun, resulting in the shortest period of daylight.</p>
<p>At the exact moment of the solstice, the Sun reaches its lowest maximum elevation in the sky. In the Northern Hemisphere, this happens around December 21st or 22nd, when the Sun is directly over the Tropic of Capricorn at 23.5 degrees south latitude. In the Southern Hemisphere, the winter solstice occurs around June 20th or 21st, when the Sun is over the Tropic of Cancer at 23.5 degrees north latitude.</p>
<p>The solstice is a precise moment in time, but its effects are felt throughout the day. The term "solstice" comes from the Latin words "sol" (sun) and "sistere" (to stand still), because the Sun's apparent movement north or south comes to a stop before reversing direction.</p>
</section>
<section id="hemispheres">
<h2>Solstice Across Hemispheres</h2>
<p>The experience of the solstice differs greatly between the Northern and Southern Hemispheres due to their opposite seasons.</p>
<article class="hemisphere" id="northern-hemisphere">
<h3>Northern Hemisphere</h3>
<p>In the Northern Hemisphere, the December solstice marks the beginning of winter. Countries like the United States, Canada, Russia, and much of Europe experience their shortest day and longest night. The weather typically becomes colder, and many cultures have developed traditions to bring light and warmth into this dark time of year.</p>
</article>
<article class="hemisphere" id="southern-hemisphere">
<h3>Southern Hemisphere</h3>
<p>Conversely, in the Southern Hemisphere, the December solstice signals the start of summer. Nations such as Australia, South Africa, and Argentina enjoy their longest day and shortest night. This time is associated with warmth, outdoor activities, and often, summer vacations.</p>
</article>
<p>This opposite experience of the solstice underscores the diversity of cultural responses to the same astronomical event, influenced by local climate and historical traditions.</p>
</section>
<section id="celebrations">
<h2>Global Celebrations of the Winter Solstice</h2>
<article class="celebration" id="newgrange">
<h3>Newgrange - Ireland</h3>
<p>The prehistoric monument of Newgrange is aligned with the rising sun on the winter solstice. Built over 5,000 years ago, it predates Stonehenge and the Egyptian pyramids. Each year, a beam of sunlight illuminates the inner chamber, symbolizing the victory of light over darkness.</p>
</article>
<article class="celebration" id="intiraymi">
<h3>Inti Raymi - Peru</h3>
<p>Although traditionally held during the June solstice, which is the winter solstice in the Southern Hemisphere, Inti Raymi is an ancient Incan festival honoring the Sun god Inti. The celebration includes music, dancing, and sacrifices, reflecting the importance of the Sun in agricultural societies.</p>
</article>
<article class="celebration" id="modranicht">
<h3>Modranicht - Anglo-Saxon Tradition</h3>
<p>Meaning "Mother's Night," Modranicht was observed by the Anglo-Saxons on the eve of the winter solstice. It was a time to honor female deities and ancestral mothers, symbolizing fertility and the rebirth of the Sun.</p>
</article>
<article class="celebration" id="koliada">
<h3>Koliada - Eastern Europe</h3>
<p>Koliada is a Slavic festival celebrated during the winter solstice. Traditions include singing carols, feasting, and lighting fires to symbolize the return of the Sun. The festival has influenced modern Christmas and New Year traditions in the region.</p>
</article>
</section>
<section id="traditions">
<h2>Common Solstice Traditions</h2>
<ul>
<li><strong>Bonfires and Candles:</strong> Lighting fires and candles is a widespread tradition to represent light overcoming darkness.</li>
<li><strong>Feasting:</strong> Communities gather to share meals, strengthening social bonds during the cold months.</li>
<li><strong>Gift-Giving:</strong> Exchanging gifts symbolizes goodwill and sharing abundance.</li>
<li><strong>Decorating with Evergreens:</strong> Using evergreen plants like holly and mistletoe represents eternal life and protection.</li>
<li><strong>Reflection and Renewal:</strong> The solstice is a time for introspection, setting intentions for the coming year.</li>
</ul>
</section>
<section id="conclusion">
<h2>Conclusion</h2>
<p>The winter solstice is a profound event that connects humanity across time and space. Despite differences in culture and climate, people around the world share common themes in their celebrations—hope, renewal, and the enduring human spirit. Understanding the science behind the solstice enhances our appreciation of these traditions and highlights our connection to the cosmos.</p>
</section>
<footer id="main-footer">
<p>&copy; 2024 Winter Solstice Celebrations</p>
<nav id="footer-nav">
<ul>
<li><a href="#main-header">Back to Top</a></li>
<li><a href="#contact">Contact Us</a></li>
</ul>
</nav>
</footer>
</body>
</html>
// Interactive Navigation
document.addEventListener('DOMContentLoaded', () => {
const sections = document.querySelectorAll('section');
const navLinks = document.querySelectorAll('#main-nav a');
// Smooth scrolling for all navigation links including footer
const allNavLinks = [...navLinks, ...document.querySelectorAll('#footer-nav a')];
allNavLinks.forEach(link => {
link.addEventListener('click', (e) => {
e.preventDefault();
const targetId = link.getAttribute('href').slice(1);
if (targetId === 'main-header') {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
} else if (targetId === 'contact') {
// "Contact Us", simple modal
const modal = document.createElement('div');
modal.style.position = 'fixed';
modal.style.top = '50%';
modal.style.left = '50%';
modal.style.transform = 'translate(-50%, -50%)';
modal.style.background = 'var(--section-bg)';
modal.style.padding = '2rem';
modal.style.borderRadius = '8px';
modal.style.boxShadow = '0 4px 6px rgba(0, 0, 0, 0.1)';
modal.style.zIndex = '1000';
modal.innerHTML = `
<h3 style="margin-bottom: 1rem;">Contact Us</h3>
<p>Email: [email protected]</p>
<p>Phone: (555) 123-4567</p>
<button style="margin-top: 1rem; padding: 0.5rem 1rem; background: var(--accent-color); color: white; border: none; border-radius: 4px; cursor: pointer;">Close</button>
`;
// Overlay
const overlay = document.createElement('div');
overlay.style.position = 'fixed';
overlay.style.top = '0';
overlay.style.left = '0';
overlay.style.right = '0';
overlay.style.bottom = '0';
overlay.style.background = 'rgba(0, 0, 0, 0.5)';
overlay.style.zIndex = '999';
document.body.appendChild(overlay);
document.body.appendChild(modal);
const closeModal = () => {
document.body.removeChild(modal);
document.body.removeChild(overlay);
};
modal.querySelector('button').addEventListener('click', closeModal);
overlay.addEventListener('click', closeModal);
} else if (targetId) {
// other links
const targetSection = document.getElementById(targetId);
if (targetSection) {
targetSection.scrollIntoView({ behavior: 'smooth' });
}
}
});
});
// Intersection Observer for section animations
const observerOptions = {
root: null,
rootMargin: '0px',
threshold: 0.1
};
const sectionObserver = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0)';
// Highlight corresponding nav link
const id = entry.target.id;
navLinks.forEach(link => {
link.classList.remove('active');
if (link.getAttribute('href') === `#${id}`) {
link.classList.add('active');
}
});
}
});
}, observerOptions);
sections.forEach(section => {
section.style.opacity = '0';
section.style.transform = 'translateY(20px)';
section.style.transition = 'opacity 0.6s ease-out, transform 0.6s ease-out';
sectionObserver.observe(section);
});
// Interactive Solstice Animation
const createSolsticeAnimation = () => {
const science = document.getElementById('science');
const canvas = document.createElement('canvas');
canvas.width = 300;
canvas.height = 300;
canvas.style.display = 'block';
canvas.style.margin = '2rem auto';
science.insertBefore(canvas, science.firstChild);
const ctx = canvas.getContext('2d');
let angle = 0;
function drawSun(x, y) {
ctx.beginPath();
ctx.arc(x, y, 20, 0, Math.PI * 2);
ctx.fillStyle = '#ffd700';
ctx.fill();
// Sun rays
for (let i = 0; i < 8; i++) {
ctx.beginPath();
const rayAngle = (i * Math.PI / 4) + angle;
ctx.moveTo(
x + Math.cos(rayAngle) * 25,
y + Math.sin(rayAngle) * 25
);
ctx.lineTo(
x + Math.cos(rayAngle) * 35,
y + Math.sin(rayAngle) * 35
);
ctx.strokeStyle = '#ffd700';
ctx.lineWidth = 2;
ctx.stroke();
}
}
function drawEarth() {
ctx.beginPath();
ctx.arc(150, 150, 50, 0, Math.PI * 2);
ctx.fillStyle = '#2d5a9e';
ctx.fill();
// Earth's tilt
ctx.save();
ctx.translate(150, 150);
ctx.rotate(23.5 * Math.PI / 180);
ctx.beginPath();
ctx.moveTo(-60, 0);
ctx.lineTo(60, 0);
ctx.strokeStyle = 'rgba(255, 255, 255, 0.3)';
ctx.stroke();
ctx.restore();
}
function animate() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
// Draw orbit
ctx.beginPath();
ctx.arc(150, 150, 100, 0, Math.PI * 2);
ctx.strokeStyle = 'rgba(255, 255, 255, 0.2)';
ctx.stroke();
// Calculate sun position
const sunX = 150 + Math.cos(angle) * 100;
const sunY = 150 + Math.sin(angle) * 100;
drawSun(sunX, sunY);
drawEarth();
angle += 0.01;
requestAnimationFrame(animate);
}
animate();
};
createSolsticeAnimation();
// Interactive Celebrations
const celebrations = document.querySelectorAll('.celebration');
celebrations.forEach(celebration => {
celebration.addEventListener('click', () => {
celebrations.forEach(c => c.classList.remove('active'));
celebration.classList.add('active');
});
});
// Dynamic Theme Toggle
const createThemeToggle = () => {
const toggle = document.createElement('button');
toggle.id = 'theme-toggle';
toggle.innerHTML = '☀️';
toggle.setAttribute('aria-label', 'Toggle theme');
toggle.style.position = 'fixed';
toggle.style.bottom = '20px';
toggle.style.right = '20px';
toggle.style.padding = '10px';
toggle.style.borderRadius = '50%';
toggle.style.border = 'none';
toggle.style.background = 'rgba(255, 255, 255, 0.1)';
toggle.style.cursor = 'pointer';
document.body.appendChild(toggle);
let isDark = true;
toggle.addEventListener('click', () => {
isDark = !isDark;
// Basculer la classe light-theme sur le body
document.body.classList.toggle('light-theme');
// Mettre à jour l'icône et le style du bouton
toggle.innerHTML = isDark ? '☀️' : '🌙';
toggle.style.background = isDark
? 'rgba(255, 255, 255, 0.1)'
: 'rgba(0, 0, 0, 0.1)';
});
};
createThemeToggle();
});
/* Variables */
:root {
/* Dark theme (default) */
--primary-color: #1a365d;
--secondary-color: #2d5a9e;
--accent-color: #ffd700;
--text-color: #ffffff; /* Blanc pour le thème sombre */
--bg-color: linear-gradient(135deg, #1a365d 0%, #0a192f 100%);
--section-bg: rgba(255, 255, 255, 0.05);
--card-border: rgba(255, 255, 255, 0.1);
--heading-color: #ffd700;
/* Light theme variables */
--primary-color-light: #2c5282;
--secondary-color-light: #4299e1;
--accent-color-light: #2b6cb0;
--text-color-light: #000000; /* Noir pour le thème clair */
--bg-color-light: linear-gradient(135deg, #f7fafc 0%, #e2e8f0 100%);
--section-bg-light: rgba(255, 255, 255, 0.9);
--card-border-light: rgba(44, 82, 130, 0.2);
--heading-color-light: #2c5282;
--transition-speed: 0.3s;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
color: var(--text-color);
background: var(--bg-color);
transition: background-color var(--transition-speed),
color var(--transition-speed);
}
body.light-theme {
--text-color: var(--text-color-light);
--bg-color: var(--bg-color-light);
--section-bg: var(--section-bg-light);
--card-border: var(--card-border-light);
--heading-color: var(--heading-color-light);
}
/* Assurez-vous que le texte dans les sections hérite de la couleur */
section {
color: var(--text-color);
}
/* Ajustement des titres */
h1, h2, h3, h4, h5, h6 {
color: var(--heading-color);
}
/* Ajustement pour le texte dans les articles */
article p {
color: var(--text-color);
}
/* Reset and Base Styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
color: var(--text-color);
background: var(--bg-color);
transition: background-color var(--transition-speed), color var(--transition-speed);
}
body.light-theme {
--primary-color: var(--primary-color-light);
--secondary-color: var(--secondary-color-light);
--accent-color: var(--accent-color-light);
--text-color: var(--text-color-light);
--bg-color: var(--bg-color-light);
--section-bg: var(--section-bg-light);
--card-border: var(--card-border-light);
}
/* Header Styles */
#main-header {
background: rgba(26, 54, 93, 0.95);
padding: 1rem;
position: sticky;
top: 0;
z-index: 100;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
backdrop-filter: blur(10px);
}
#main-header h1 {
text-align: center;
font-size: 2.5rem;
margin-bottom: 1rem;
color: var(--accent-color);
animation: glow 2s ease-in-out infinite alternate;
}
/* Navigation */
#main-nav ul {
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: 1rem;
list-style: none;
}
#main-nav a {
color: var(--light-text);
text-decoration: none;
padding: 0.5rem 1rem;
border-radius: 4px;
transition: var(--transition-speed);
position: relative;
}
#main-nav a::after {
content: '';
position: absolute;
bottom: 0;
left: 50%;
width: 0;
height: 2px;
background: var(--accent-color);
transition: width 0.3s ease, left 0.3s ease;
}
#main-nav a:hover::after {
width: 100%;
left: 0;
}
/* Sections */
section {
max-width: 1200px;
margin: 2rem auto;
padding: 2rem;
background: var(--section-bg);
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
border: 1px solid var(--card-border);
transition: transform var(--transition-speed), background-color var(--transition-speed);
}
section:hover {
transform: translateY(-5px);
}
h2 {
color: var(--accent-color);
margin-bottom: 1.5rem;
font-size: 2rem;
}
h3 {
color: var(--light-text);
margin: 1rem 0;
}
/* Interactive Elements */
.celebration {
padding: 1.5rem;
margin: 1rem 0;
border-left: 4px solid var(--accent-color);
background: rgba(255, 255, 255, 0.02);
transition: var(--transition-speed);
}
.celebration:hover {
background: rgba(255, 255, 255, 0.05);
transform: translateX(10px);
}
/* Hemispheres Section */
.hemisphere {
padding: 1.5rem;
margin: 1rem 0;
border-radius: 8px;
transition: var(--transition-speed);
}
#northern-hemisphere {
background: linear-gradient(to right, rgba(41, 128, 185, 0.2), rgba(44, 62, 80, 0.2));
}
#southern-hemisphere {
background: linear-gradient(to right, rgba(230, 126, 34, 0.2), rgba(211, 84, 0, 0.2));
}
/* Traditions List */
#traditions ul {
list-style-position: inside;
padding-left: 1rem;
}
#traditions li {
margin: 1rem 0;
padding-left: 1rem;
position: relative;
}
#traditions li::before {
content: '✧';
color: var(--accent-color);
position: absolute;
left: -1rem;
}
/* Footer */
#main-footer {
background: rgba(26, 54, 93, 0.95);
padding: 2rem;
margin-top: 3rem;
text-align: center;
}
#footer-nav ul {
display: flex;
justify-content: center;
gap: 2rem;
list-style: none;
margin-top: 1rem;
}
#footer-nav a {
color: var(--light-text);
text-decoration: none;
}
/* Animations */
@keyframes glow {
from {
text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}
to {
text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}
}
/* Responsive Design */
@media (max-width: 768px) {
#main-nav ul {
flex-direction: column;
align-items: center;
}
section {
margin: 1rem;
padding: 1rem;
}
#main-header h1 {
font-size: 2rem;
}
}
/* Accessibility Focus Styles */
a:focus,
button:focus {
outline: 3px solid var(--accent-color);
outline-offset: 3px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment