<!-- MIT License

Copyright (c) 2024 Ayush Shukla

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -->

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>New York Recreational Cricket League</title>
    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" />
    <link rel="stylesheet" href="styles.css">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Montserrat+Alternates:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto+Serif:ital,opsz,wght@0,8..144,100..900;1,8..144,100..900&display=swap');

        * {
            font-family: 'Montserrat Alternates', sans-serif;
        }
    </style>
</head>
<body>
    <header id="head">
        <h1>Welcome to the New York Recreational Cricket League</h1>
        <p>Join us to experience the thrill of cricket right in the heart of New York City!</p>
    </header>

    <section id="about">
        <h2>About the League</h2>
        <p>The New York Recreational Cricket League (NYRCL) is dedicated to promoting the sport of cricket among New Yorkers of all ages. We offer a friendly but competitive environment where players can improve their skills and enjoy the game.</p>
    </section>

    <section id="join">
        <h2>How to Join</h2>
        <p>Interested in playing? We welcome players of all skill levels! To join, simply fill out our online registration form on our website, or contact us at join@nyrcl.com for more details.</p>
    </section>

    <section id="fees">
        <h2>League Fees</h2>
        <p>The registration fee for the league is $150 per player, which covers the entire season. This fee includes uniforms, equipment rental, and insurance.</p>
    </section>

    <section id="location">
        <h2>Location of Games</h2>
        <p>All games are held at the iconic Central Park Cricket Fields, located near the north end of Central Park, easily accessible via public transportation.</p>
        <div id="map"></div>
    </section>

    <section id="schedule">
        <h2>Season Schedule</h2>
        <p>The NYRCL season runs from April through September, with games typically held on weekends. Here is the schedule for the upcoming season:</p>
        <ul>
            <li>Opening Day: April 15th</li>
            <li>Mid-Season Tournament: July 8th-9th</li>
            <li>Season Finals: September 20th</li>
            <li>Closing Ceremony: September 30th</li>
        </ul>
    </section>

    <footer id="foot">
        <p>Contact Us:</p>
        <p>Email: info@nyrcl.com | Phone: (555) 123-4567</p>
        <p>Follow us on our social media pages for updates and more information.</p>
    </footer>

    <script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
    <script src="script.js"></script>
</body>
</html>
body,
h1,
h2,
p,
ul {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    line-height: 1.6;
    color: #333;
    background: #f0f8ff;
    overflow-x: hidden;
}

header {
    background: linear-gradient(rgba(0, 150, 136, 0.8), rgba(0, 150, 136, 0.8)), url('https://img.cricketworld.com/images/f-056485/baseball-cricket.jpg');
    background-size: cover;
    background-position: center;
    color: white;
    text-align: center;
    padding: 5rem 2rem;
    position: relative;
    overflow: hidden;
    height: 80vh;
}

header h1 {
    margin-bottom: 0.5rem;
    font-size: 2.8rem;
    animation: fadeInUp 1.5s ease-out;
}

header p {
    margin-top: 0;
    font-weight: 500;
    font-size: 1.4rem;
    font-style: italic;
    animation: fadeInUp 2s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

nav {
    position: sticky;
    top: 0;
    background: rgba(0, 77, 64, 0.9);
    color: white;
    padding: 1rem 0;
    text-align: center;
    z-index: 1000;
    transition: background 0.3s;
}

nav.scrolled {
    background: rgba(0, 77, 64, 0.7);
}

nav a {
    color: white;
    text-decoration: none;
    margin: 0 1.5rem;
    font-weight: bold;
    transition: color 0.3s;
}

nav a:hover {
    color: #00bfae;
}

section {
    padding: 4rem 2rem;
    margin: 0 auto;
    max-width: 800px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

section.visible {
    opacity: 1;
    transform: translateY(0);
}

section h2 {
    margin-bottom: 1rem;
    color: #00796b;
    font-size: 2rem;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

section p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
}

ul {
    list-style-type: none;
    padding: 0;
}

ul li {
    background: #e0f2f1;
    margin-bottom: 0.5rem;
    font-weight: 500;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: background 0.3s, transform 0.3s;
}

ul li:hover {
    background: #b2dfdb;
    transform: scale(1.02);
}

footer {
    background: rgba(0, 77, 64, 0.9);
    color: white;
    text-align: center;
    padding: 2rem 1rem;
}

footer p {
    margin: 0.5rem 0;
}

footer a {
    color: #00bfae;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.contact-form {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    animation: fadeIn 1s ease-in-out;
}

.contact-form h2 {
    margin-bottom: 1rem;
    font-size: 1.8rem;
    color: #00796b;
}

.contact-form label {
    font-weight: 500;
    display: block;
    margin-bottom: 0.5rem;
}

.contact-form input,
.contact-form textarea {
    width: 95%;
    font-weight: 500;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.3s;
}

.contact-form input:focus,
.contact-form textarea:focus {
    border-color: #00796b;
    outline: none;
}

.contact-form button {
    background: #009688;
    color: white;
    border: none;
    padding: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.contact-form button:hover {
    background: #00796b;
}

#map {
    height: 400px;
    width: 100%;
    margin: 2rem auto;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-weight: bolder;
}

.modal {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    width: 80%;
    max-width: 500px;
    text-align: center;
    position: relative;
}

.modal-content h2 {
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.modal-content p {
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #333;
}

.modal-close:hover {
    color: #00796b;
}

@media screen and (max-width: 670px) {
    nav {
        font-size: smaller;
    }

    nav a {
        margin: 0 0.75rem;
    }
}
document.getElementById("head").insertAdjacentHTML("beforebegin", `<nav id="navbar">
    <a href="#about">About</a>
    <a href="#join">Join</a>
    <a href="#fees">Fees</a>
    <a href="#location">Location</a>
    <a href="#schedule">Schedule</a>
    <a href="#contact">Contact</a>
</nav>`);

document.getElementById("schedule").insertAdjacentHTML("afterend", `<section id="contact">
        <h2>Contact Us</h2>
        <div class="contact-form">
            <h2>Get in Touch</h2>
            <form id="contactForm">
                <label for="name">Name:</label>
                <input type="text" id="name" name="name" required>
                
                <label for="email">Email:</label>
                <input type="email" id="email" name="email" required>
                
                <label for="message">Message:</label>
                <textarea id="message" name="message" rows="4" required></textarea>
                
                <button type="submit">Send Message</button>
            </form>
        </div>
    </section>`);

document.getElementById("foot").insertAdjacentHTML("afterend", `<div id="modal" class="modal">
        <div class="modal-content">
            <span class="modal-close">&times;</span>
            <h2>Special Announcement</h2>
            <p>We have an exciting new partnership with a local sports store! Stay tuned for special discounts and offers for our league members.</p>
        </div>
    </div>`);

document.querySelectorAll('nav a').forEach(anchor => {
    anchor.addEventListener('click', function(e) {
        e.preventDefault();
        document.querySelector(this.getAttribute('href')).scrollIntoView({behavior: 'smooth'});
    });
});

document.getElementById('contactForm').addEventListener('submit', function(event) {
    event.preventDefault();
    alert('Thank you for your message! We will get back to you soon.');
    this.reset(); 
});


const sections = document.querySelectorAll('section');
const revealSections = () => {
    sections.forEach(section => {
        const sectionTop = section.getBoundingClientRect().top;
        const windowHeight = window.innerHeight;
        if (sectionTop < windowHeight - 100) {
            section.classList.add('visible');
        }
    });
}

window.addEventListener('scroll', revealSections);
revealSections();

function initMap() {
    const centralPark = [40.785091, -73.968285];
    const map = L.map('map').setView(centralPark, 15);

    L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
        attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
    }).addTo(map);

    L.marker(centralPark).addTo(map)
        .bindPopup('Central Park Cricket Fields')
        .openPopup();
}
initMap();

const modal = document.getElementById('modal');
const modalClose = document.querySelector('.modal-close');

setTimeout(() => {
    modal.style.display = 'flex';
}, 3000);


modalClose.addEventListener('click', () => {
    modal.style.display = 'none';
});


window.addEventListener('click', (e) => {
    if (e.target === modal) {
        modal.style.display = 'none';
    }
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.