/* ===========================
   Reset & Base Styles
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2f6fb7;
    --secondary-color: #4f8a2a;
    --accent-color: #ffa726;
    --text-color: #333;
    --text-light: #5f5f5f;
    --bg-light: #f5f5f5;
    --bg-page: #fafafa;
    --dark: #2c3e50;
    --white: #fff;
    --radius: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
}

/* Farbschemata (Theme-Einstellung "Farbschema") */
body.scheme-warm {
    /* Farben aus dem Schullogo */
    --primary-color: #c94a0c;
    --secondary-color: #8a3b0b;
    --accent-color: #f28c28;
    --bg-light: #fdf3ec;
    --dark: #3a3a3a;
}

body.scheme-cool {
    --primary-color: #1f6e9c;
    --secondary-color: #12807a;
    --accent-color: #3cc0c0;
    --bg-light: #eef6f8;
    --dark: #1f3340;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-page);
}

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

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--secondary-color);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.button {
    display: inline-block;
    padding: 10px 22px;
    border-radius: 25px;
    background: var(--primary-color);
    color: var(--white);
    font-weight: 600;
    transition: background 0.3s ease;
}

.button:hover {
    background: var(--secondary-color);
    color: var(--white);
}

/* ===========================
   Skip Link (Accessibility)
   =========================== */
.skip-link {
    position: absolute;
    left: -9999px;
    z-index: 999;
}

.skip-link:focus {
    left: 0;
    top: 0;
    background: var(--primary-color);
    color: var(--white);
    padding: 10px;
}

/* ===========================
   Top Bar
   =========================== */
.top-bar {
    background: var(--dark);
    color: var(--white);
    padding: 8px 0;
    font-size: 0.85rem;
}

.top-bar-content {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 24px;
    list-style: none;
}

.top-contact a {
    color: var(--white);
}

.top-contact a:hover {
    color: var(--accent-color);
}

/* ===========================
   Header Styles
   =========================== */
.site-header {
    background: var(--white);
}

.header-top {
    padding: 20px 0;
}

.header-top .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px 30px;
}

.header-content {
    display: inline-block;
}

.school-logo {
    width: 560px;
    max-width: 100%;
    height: auto;
}

.site-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* ===========================
   Navigation Styles
   =========================== */
.main-navigation {
    background: var(--white);
    border-top: 1px solid #eee;
    border-bottom: 4px solid var(--accent-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.nav-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.main-menu {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    flex: 1;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: block;
    padding: 16px 12px;
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.98rem;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.nav-link:hover,
.nav-item.active > .nav-link {
    background-color: var(--bg-light);
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
}

/* Dropdown Menu */
.nav-item.has-children > .nav-link::after {
    content: '▾';
    margin-left: 6px;
}

.submenu-toggle {
    display: none;
}

.nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    min-width: 240px;
    box-shadow: var(--shadow-hover);
    list-style: none;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

.nav-item:hover > .nav-dropdown,
.nav-item:focus-within > .nav-dropdown {
    display: block;
}

.nav-dropdown .nav-link {
    padding: 12px 20px;
    border-bottom: 1px solid var(--bg-light);
    font-weight: 500;
}

.nav-dropdown .nav-link:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

/* Search Box */
.search-box form {
    display: flex;
    align-items: center;
    background: var(--bg-light);
    border-radius: 25px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.search-box form:focus-within {
    border-color: var(--primary-color);
}

.search-box input {
    border: none;
    background: transparent;
    padding: 9px 14px;
    font-size: 0.95rem;
    outline: none;
    width: 150px;
}

.search-box button {
    background: var(--primary-color);
    border: none;
    padding: 9px 14px;
    cursor: pointer;
    font-size: 1rem;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 15px 0;
    flex-direction: column;
    gap: 5px;
}

.mobile-menu-toggle span {
    width: 28px;
    height: 3px;
    background: var(--text-color);
    border-radius: 2px;
    transition: 0.3s;
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* ===========================
   Main Content
   =========================== */
.main-content {
    min-height: 60vh;
    padding: 40px 0;
}

.main-content:focus {
    outline: none;
}

.page-content {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
}

.page-hero {
    margin: -40px -40px 30px;
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
}

.page-hero img {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.page-title {
    font-size: 2.2rem;
    line-height: 1.25;
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--accent-color);
}

.page-subtitle {
    font-size: 1.3rem;
    color: var(--text-light);
    margin-bottom: 25px;
    font-style: italic;
}

.page-body {
    font-size: 1.05rem;
    line-height: 1.75;
}

.page-body h2 {
    color: var(--secondary-color);
    margin: 35px 0 12px;
    font-size: 1.6rem;
    line-height: 1.3;
}

.page-body h3 {
    color: var(--primary-color);
    margin: 25px 0 10px;
    font-size: 1.3rem;
}

.page-body > :first-child {
    margin-top: 0;
}

.page-body p {
    margin-bottom: 20px;
}

.page-body ul,
.page-body ol {
    margin: 0 0 20px 30px;
}

.page-body li {
    margin-bottom: 6px;
}

.page-body p > img {
    border-radius: 8px;
    margin: 0 auto;
}

.page-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 25px;
}

.page-body th,
.page-body td {
    text-align: left;
    vertical-align: top;
    padding: 10px 14px;
    border-bottom: 1px solid #e3e3e3;
}

/* Aus WordPress übernommene Tabellen haben keine echte Kopfzeile */
.page-body th {
    font-weight: inherit;
}

.page-body tr:nth-child(even) td {
    background: var(--bg-light);
}

/* Bildergalerie: mehrere Bilder direkt untereinander (ohne Leerzeile) im Markdown */
.page-body p:has(> img:nth-of-type(2)) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.page-body p:has(> img:nth-of-type(2)) > img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    margin: 0;
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.page-body p:has(> img:nth-of-type(2)) > img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-hover);
}

.page-body p > img:only-of-type {
    cursor: zoom-in;
}

/* Downloads: Listen mit Links auf Dateien */
.page-body li:has(> a.file-link:only-child) {
    list-style: none;
    margin-bottom: 10px;
}

.page-body ul:has(> li > a.file-link:only-child) {
    margin-left: 0;
}

.file-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    background: var(--white);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.file-link:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.file-link::before {
    content: attr(data-ext);
    flex: none;
    min-width: 46px;
    padding: 3px 6px;
    border-radius: 4px;
    background: var(--primary-color);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
}

/* ===========================
   Startseite & Beitragslisten
   =========================== */
.home-content .page-body h2 {
    text-align: center;
    color: var(--primary-color);
}

.home-content .page-body > p:first-child > img:only-of-type {
    width: 100%;
    max-height: 480px;
    object-fit: cover;
}

.home-news {
    margin-top: 50px;
}

.section-title {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 10px;
}

.post-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.post-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
}

.post-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: var(--text-color);
}

.post-card-image img {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
}

.post-card-body {
    padding: 18px 20px 22px;
}

.post-card-title {
    font-size: 1.2rem;
    line-height: 1.35;
    color: var(--primary-color);
    margin: 4px 0 8px;
}

.post-card-summary {
    color: var(--text-light);
    font-size: 0.95rem;
}

.post-card-meta {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.post-date {
    display: block;
    font-size: 0.9rem;
    color: var(--text-light);
}

.post .post-date {
    margin: -10px 0 25px;
}

.more-link {
    text-align: center;
    margin-top: 30px;
}

.back-link {
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.prev-next {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 40px;
    padding-top: 25px;
    border-top: 1px solid #eee;
}

.prev-next .button:only-child:last-child {
    margin-left: auto;
}

/* Übersichtsseiten */
.section-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.section-card {
    display: block;
    height: 100%;
    padding: 22px 24px;
    border-radius: var(--radius);
    background: var(--bg-light);
    border-left: 5px solid var(--accent-color);
    color: var(--text-color);
    transition: box-shadow 0.3s ease;
}

.section-card:hover {
    box-shadow: var(--shadow-hover);
    color: var(--text-color);
}

.section-card-title {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 6px;
}

.section-card-summary {
    display: block;
    font-size: 0.95rem;
    color: var(--text-light);
}

/* ===========================
   Lightbox
   =========================== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.88);
}

.lightbox[hidden] {
    display: none;
}

.lightbox img {
    max-width: 92vw;
    max-height: 88vh;
    border-radius: 6px;
}

.lightbox button {
    position: absolute;
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 1.6rem;
    cursor: pointer;
}

.lightbox button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-close { top: 16px; right: 16px; }
.lightbox-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 16px; top: 50%; transform: translateY(-50%); }

.lightbox-counter {
    position: absolute;
    bottom: 16px;
    color: var(--white);
    font-size: 0.9rem;
}

/* ===========================
   Footer Styles
   =========================== */
.site-footer {
    background: var(--dark);
    color: var(--white);
    padding: 50px 0 20px;
    margin-top: 60px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 30px;
}

.footer-section h2 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.footer-section p,
.footer-section ul {
    line-height: 1.8;
    opacity: 0.9;
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    color: var(--white);
}

.footer-section a:hover {
    color: var(--accent-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0.8;
    font-size: 0.9rem;
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 960px) {
    .nav-wrapper {
        flex-wrap: wrap;
        gap: 0 20px;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .main-menu {
        display: none;
        order: 3;
        flex: 1 0 100%;
        flex-direction: column;
        padding-bottom: 10px;
    }

    .main-menu.active {
        display: flex;
    }

    .nav-item.has-children {
        display: flex;
        flex-wrap: wrap;
    }

    .nav-item.has-children > .nav-link {
        flex: 1;
    }

    .nav-item.has-children > .nav-link::after {
        content: none;
    }

    .submenu-toggle {
        display: block;
        width: 52px;
        background: none;
        border: none;
        border-left: 1px solid #eee;
        cursor: pointer;
        font-size: 1.1rem;
        color: var(--text-color);
    }

    .submenu-toggle::before {
        content: '▾';
    }

    .submenu-toggle[aria-expanded="true"]::before {
        content: '▴';
    }

    /* Auf dem Handy nur per Knopf aufklappen, nicht per Hover */
    .nav-item:hover > .nav-dropdown,
    .nav-item:focus-within > .nav-dropdown {
        display: none;
    }

    .nav-item > .nav-dropdown.open {
        display: block;
    }

    .nav-dropdown {
        position: static;
        flex: 1 0 100%;
        box-shadow: none;
        border-radius: 0;
        padding-left: 15px;
    }
}

@media (max-width: 640px) {
    .search-box,
    .search-box input {
        flex: 1;
    }

    .search-box {
        flex-basis: 100%;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 20px 0;
    }

    .page-content {
        padding: 22px;
    }

    .page-hero {
        margin: -22px -22px 20px;
    }

    .page-hero img {
        height: 250px;
    }

    .page-title {
        font-size: 1.7rem;
    }

    .page-body h2 {
        font-size: 1.35rem;
    }

    .page-body p:has(> img:nth-of-type(2)) {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .page-body table,
    .page-body thead,
    .page-body tbody,
    .page-body tr,
    .page-body th,
    .page-body td {
        display: block;
    }

    .page-body tr {
        padding: 8px 0;
        border-bottom: 1px solid #e3e3e3;
    }

    .page-body th,
    .page-body td {
        border: none;
        padding: 2px 0;
        background: none !important;
    }

    .page-body th:first-child,
    .page-body td:first-child {
        font-weight: 600;
    }

    .file-link {
        display: flex;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

/* ===========================
   Utility Classes
   =========================== */
.text-center {
    text-align: center;
}

.mb-large {
    margin-bottom: 40px;
}

.mt-large {
    margin-top: 40px;
}
