/* === GRUNDEINSTELLUNGEN & VARIABLEN === */
:root {
    --primary-color: #912CEE;
    --dark-color: #333;
    --light-color: #f4f4f4;
    --text-color: #555;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Poppins', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body, html { font-family: var(--font-body); line-height: 1.6; color: var(--text-color); scroll-behavior: smooth; scroll-padding-top: 100px; }
.container { max-width: 1100px; margin: auto; overflow: hidden; padding: 0 2rem; }
section { padding: 4rem 0; }
h1, h2, h3, h4 { font-family: var(--font-heading); color: var(--dark-color); margin-bottom: 1rem; }
h2 { font-size: 2.5rem; text-align: center; }
.centered-heading { text-align: center; color: var(--primary-color); padding-top: 3rem; }

/* === HEADER & NAVIGATION === */
.main-header { background: #fff; position: sticky; top: 0; z-index: 1000; width: 100%; }
.main-header .nav-container { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 2rem; max-width: 1300px; margin: 0 auto; }
.nav-left, .nav-right { flex: 1; }
.nav-center { padding: 0 2rem; }
.nav-left { display: flex; justify-content: flex-start; }
.logo-text { font-family: var(--font-heading); font-size: 1.5rem; color: var(--primary-color); text-decoration: none; white-space: nowrap; }
.logo-center img { height: 80px; display: block; }
.nav-right { display: flex; justify-content: flex-end; align-items: center; }
.nav-right ul { display: flex; list-style: none; }
.nav-right ul li a { color: var(--dark-color); text-decoration: none; padding: 0.5rem 1rem; font-weight: 600; transition: color 0.3s ease; white-space: nowrap; }
.nav-right ul li a:hover { color: var(--primary-color); }

/* === ADMIN & EDIT STYLES === */
#login-btn, #logout-btn, #save-btn { background: var(--primary-color); color: white; padding: 8px 15px; border-radius: 5px; text-decoration: none; font-weight: 600; cursor: pointer; border: none; margin-left: 1rem; font-size: 0.9rem; }
#logout-btn, #save-btn { display: none; background: #333; }
.edit-mode #logout-btn,
.edit-mode #save-btn {
    display: inline-block; /* Or 'block' if you prefer */
}
#save-btn { background: #28a745; }

.modal-overlay { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.6); }
.modal-content { background-color: #fefefe; margin: 15% auto; padding: 20px; border: 1px solid #888; width: 80%; max-width: 500px; border-radius: 8px; text-align: center; }
.modal-content h2 { font-size: 1.5rem; }
.modal-content p { margin: 10px 0 20px; }
.modal-content input[type="text"], .modal-content input[type="password"] { width: 100%; padding: 12px; margin: 8px 0; display: inline-block; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; }
.modal-content button { width: 48%; background-color: var(--primary-color); color: white; padding: 14px 20px; margin: 8px 1%; border: none; border-radius: 4px; cursor: pointer; }
.modal-content button.cancel-btn { background-color: #777; }
#password-error { color: red; font-size: 0.9rem; margin-bottom: 10px; display: none; text-align: left; }

.edit-mode .editable { outline: 2px dashed var(--primary-color); outline-offset: -2px; background-color: #f0e6ff; border-radius: 3px; }
.edit-mode .editable-link { position: relative; outline: 2px dashed #007bff; outline-offset: 0; }
.edit-mode .editable-link::after { content: '🔗 Link'; position: absolute; top: -20px; right: 0; background: #007bff; color: white; padding: 2px 5px; font-size: 12px; border-radius: 3px; cursor: pointer; z-index: 10; }

.edit-mode .hero .editable,
.edit-mode .cta-buttons a span.editable,
.edit-mode .download-btn span.editable,
.edit-mode .main-footer .editable { color: #000 !important; }

.remove-member-btn { display: none; cursor: pointer; margin-left: 10px; font-size: 1rem; color: #cc0000; }
.add-member-btn { display: none; cursor: pointer; margin-top: 15px; font-weight: 600; color: var(--primary-color); }
.edit-mode .remove-member-btn, .edit-mode .add-member-btn { display: inline-block; }
.member-list li { display: flex; align-items: center; }

/* === HERO, ABOUT, ETC. === */
.hero {
    height: 100vh;
    background-color: white; /* 1. Start with a solid white background */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    padding: 0 1rem;
    position: relative;
}
.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    /* Apply overlay and image in one go. The overlay will fade in with the image. */
    background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/images/kantonschule.jpeg') no-repeat center center/cover;
    background-attachment: fixed;
    opacity: 0;
    transition: opacity 0.75s ease-in-out; /* 3. Define the fade-in animation */
    z-index: 0;
}
.hero.image-loaded::before {
    opacity: 1;
}
/* Hide hero content initially and set up a fade-in transition */
.hero > * {
    opacity: 0;
    transition: opacity 0.75s ease-in-out;
}
.hero.image-loaded > * { opacity: 1; }
.hero * { z-index: 10; }
.hero h1 { font-size: 4rem; color: white; margin-bottom: 0.5rem; }
.hero p { font-size: 1.5rem; margin-bottom: 2rem; font-weight: 300; }
.cta-buttons a { display: inline-block; background: var(--primary-color); color: white; padding: 12px 25px; border-radius: 5px; text-decoration: none; margin: 0.5rem; font-weight: 600; transition: transform 0.3s ease, background 0.3s ease; }
.cta-buttons a:hover { transform: translateY(-3px); background: #733c87; }
.cta-buttons .icon { margin-right: 8px; }
#about { background: #fff; position: relative; z-index: 20; }
#about h2, #members h2, .member-lists-container > h2 { padding-top: 20px; }
#about .about-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; align-items: center; margin-top: 3rem; }
.about-text h3 { color: var(--primary-color); }
.about-text h4 { color: var(--dark-color); font-family: var(--font-body); font-weight: 700; padding-top: 1.5rem; margin-bottom: 0.5rem; }
.about-image img { width: 100%; border-radius: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.values-list, .key-facts { margin-top: 1rem; }
#events { background: var(--light-color); position: relative; z-index: 20; text-align: center; }
.calendar-container { position: relative; overflow: hidden; width: 100%; padding-top: 75%; border: 1px solid #ddd; border-radius: 8px; margin-top: 3rem; }
.calendar-container iframe { position: absolute; top: 0; left: 0; bottom: 0; right: 0; width: 100%; height: 100%; }
.download-section { margin-top: 3rem; }
.download-section p { margin-bottom: 1rem; font-size: 1.1rem; }
.download-btn { display: inline-block; background: var(--primary-color); color: white; padding: 14px 28px; border-radius: 5px; text-decoration: none; font-weight: 600; font-size: 1.1rem; transition: transform 0.3s ease, background 0.3s ease; }
.download-btn:hover { transform: translateY(-3px); background: #733c87; }
.download-btn .icon { margin-right: 10px; }
#members { background: #fff; position: relative; z-index: 20; }
.members-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2rem; margin-top: 3rem; text-align: center; }
.member-card-img { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; border: 4px solid var(--primary-color); margin-bottom: 1rem; }
.member-card h3 { font-size: 1.3rem; font-family: var(--font-body); font-weight: 600; }
.member-card .role { font-style: italic; color: #777; }
.member-lists-container { display: flex; justify-content: center; gap: 4rem; margin-top: 3rem; margin-bottom: 3rem; text-align: left; flex-wrap: wrap; }
.member-list { flex: 1; max-width: 400px; min-width: 250px; }
.member-list h3 { font-family: var(--font-heading); color: var(--primary-color); font-size: 1.8rem; margin-bottom: 1.5rem; border-bottom: 2px solid var(--light-color); padding-bottom: 0.5rem; }
.member-list ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.member-list li { font-size: 1rem; padding: 8px 16px; background-color: var(--light-color); border-radius: 20px; font-weight: 500; transition: background-color 0.3s ease; }
.member-list li:hover { background-color: #e0e0e0; }
#contact { background: var(--light-color); position: relative; z-index: 20; }
.contact-info { text-align: center; max-width: 600px; margin: 3rem auto 0 auto; }
.contact-info p { font-size: 1.1rem; margin-bottom: 2rem; }
.contact-info a { color: var(--primary-color); text-decoration: none; font-weight: 600; }
.main-footer { background: var(--dark-color); color: white; text-align: center; padding: 2rem; position: relative; z-index: 20; }
.main-footer a { color: var(--primary-color); text-decoration: none; }

@media(max-width: 768px) {
    h1 { font-size: 3rem; } h2 { font-size: 2rem; } .hero p { font-size: 1.2rem; }
    .main-header .nav-container { flex-direction: column; padding: 0.5rem 1rem; }
    .nav-left { display: none; } .nav-center { order: 1; } .logo-center img { height: 50px; }
    .nav-right { order: 2; width: 100%; justify-content: center; }
    .nav-right ul { justify-content: center; flex-wrap: wrap; padding-top: 0.5rem; }
}