/*
Theme Name: Schul-Theme (Header/Footer)
Theme URI: https://example.com
Author: Max
Author URI: https://example.com
Description: Klassisches WordPress-Theme mit Header/Footer im Stil einer Schul-Website. Vollständig kompatibel mit dem klassischen Editor (kein Block-/FSE-Theme). Farben, Menüs, Logo und Footer-Inhalte lassen sich im gewohnten Backend (Customizer, Menüs, Widgets) anpassen.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: kzs-theme
*/

/* ==========================================================================
   Basis
   ========================================================================== */

:root {
    --kzs-color-topbar: #9c1b34;
    --kzs-color-accent: #9c1b34;
    --kzs-color-text: #4a4a4a;
    --kzs-color-footer: #0e7ea3;
    --kzs-color-footer-bottom: #4a4a4a;
    --kzs-font-primary: "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--kzs-font-primary);
    color: #333;
    line-height: 1.6;
    background: #fff;
    overflow-anchor: none;
}

h1, h2, h3, h4, h5, h6,
button, input, select, textarea {
    font-family: var(--kzs-font-primary);
}

a { color: var(--kzs-color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

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

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

.screen-reader-text {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(1px,1px,1px,1px);
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 500;
    background: #fff;
    overflow-anchor: none;
}

.top-bar {
    background: var(--kzs-color-topbar);
    max-height: 60px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

body.kzs-scrolled .top-bar {
    max-height: 0;
    opacity: 0;
}

.main-header {
    background: #fff;
    transition: box-shadow 0.3s ease;
}

body.kzs-scrolled .main-header {
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}

.top-bar-inner {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 38px;
}

.top-menu {
    display: flex;
    align-items: center;
    gap: 18px;
}

.top-menu li a {
    color: #fff;
    font-size: 0.85rem;
    display: inline-block;
    transition: color 0.2s ease;
}

.top-menu li a:hover {
    color: #d9d9d9;
    text-decoration: none;
}

.main-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 18px 24px;
    gap: 24px;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 18px;
}

.custom-logo-link img {
    max-height: 78px;
    width: auto;
}

.site-title-link {
    display: block;
    line-height: 1.1;
}

.site-title {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: var(--kzs-color-accent);
    text-transform: uppercase;
}

.site-description {
    margin: 4px 0 0;
    font-size: 0.95rem;
    font-weight: 500;
    color: #777;
}

.main-navigation {
    margin-left: auto;
}

.primary-menu {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: nowrap;
}

.primary-menu > li {
    position: relative;
}

.primary-menu > li > a {
    display: block;
    padding: 8px 6px;
    color: #555;
    font-family: "Noto Sans", sans-serif;
    font-size: 18px;
    font-weight: 400;
    font-style: normal;
    font-variant: normal;
    text-transform: none;
    text-decoration: none;
    letter-spacing: normal;
    transition: color 0.2s ease;
}

.primary-menu > li > a:hover,
.primary-menu > li.current-menu-item > a {
    color: #999;
    background-color: transparent;
    text-decoration: none;
}

.primary-menu .sub-menu {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    min-width: 220px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 8px 0;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.primary-menu li:hover > .sub-menu,
.primary-menu li.kzs-open > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.primary-menu .sub-menu li a {
    display: block;
    padding: 8px 20px;
    color: #555;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.primary-menu .sub-menu li a:hover {
    background: transparent;
    color: #999;
    text-decoration: none;
}

.menu-item-has-children > a::after {
    content: "";
}

/* Automatisch erkannte Social-Icons in Menüs (z. B. Instagram-Link) */
.menu-social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.menu-item-is-social > a {
    display: inline-flex !important;
    align-items: center;
    padding: 6px !important;
}

.top-menu .menu-item-is-social > a {
    color: #fff;
}

.top-menu .menu-item-is-social > a:hover {
    opacity: 0.85;
}

.primary-menu .menu-item-is-social > a {
    color: #555;
    border-bottom: none !important;
}

.footer-legal-menu .menu-item-is-social a,
.footer-widget .menu-item-is-social a {
    color: #fff;
}

.menu-toggle {
    display: none;
    align-items: center;
    gap: 12px;
    background: none;
    border: 0;
    cursor: pointer;
    padding: 8px 0 8px 8px;
    color: var(--kzs-color-accent);
}

.menu-toggle-label {
    font-size: 1.15rem;
    line-height: 1;
}

.menu-toggle-icon {
    display: block;
    width: 22px;
}

.menu-toggle-icon span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    margin: 5px 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Hamburger wird beim Öffnen zum X */
.menu-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ==========================================================================
   Content
   ========================================================================== */

.site-content { padding: 40px 0; min-height: 40vh; }

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer-main {
    background: var(--kzs-color-footer);
    color: #fff;
    padding: 56px 0 40px;
}

.footer-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
}

.footer-title,
.footer-widget h3 {
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 16px;
}

.footer-widget {
    font-size: 0.95rem;
    line-height: 1.7;
}

.footer-widget a { color: #fff; text-decoration: underline; }

.footer-widget .widget-title { display: none; } /* footer-title from before_title is used instead */

.social-icons {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.social-icons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.15);
    border-radius: 6px;
    text-decoration: none;
}

.social-icons a:hover { background: rgba(255,255,255,0.3); }

.site-footer-bottom {
    background: var(--kzs-color-footer-bottom);
    color: #ddd;
    font-size: 0.85rem;
}

.footer-bottom-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 24px;
}

.footer-legal-menu {
    display: flex;
    gap: 20px;
}

.footer-legal-menu a { color: #ddd; }
.footer-legal-menu a:hover { color: #fff; }

.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #3a3a3a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover { text-decoration: none; opacity: 0.9; }

/* Roter Fortschrittsring: füllt sich mit der Scrollposition (siehe js/navigation.js) */
.back-to-top-progress {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.back-to-top-progress circle {
    fill: none;
    stroke: var(--kzs-color-accent);
    stroke-width: 3;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
}

.back-to-top-icon {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 782px) {
    .main-header { position: relative; }

    .main-header-inner {
        flex-wrap: nowrap;
        padding: 14px 16px;
        gap: 16px;
    }

    .site-branding {
        flex: 1 1 auto;
        min-width: 0;
    }

    .custom-logo-link img {
        max-height: 56px;
        max-width: 100%;
    }

    .site-title { font-size: 1.4rem; }

    .menu-toggle { display: flex; }

    .main-navigation { flex: 0 0 auto; margin-left: auto; }

    /* Aufgeklapptes Menü liegt unter dem Header über volle Breite */
    .primary-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding: 8px 16px 16px;
        background: #fff;
        box-shadow: 0 8px 24px rgba(0,0,0,0.12);
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }

    .primary-menu.kzs-menu-open { display: flex; }

    .primary-menu > li { width: 100%; }

    .primary-menu .sub-menu {
        position: static;
        box-shadow: none;
        padding-left: 16px;
        max-height: 0;
        opacity: 1;
        visibility: visible;
        transform: none;
        overflow: hidden;
        transition: max-height 0.25s ease;
        pointer-events: auto;
    }

    .primary-menu li.kzs-open > .sub-menu {
        max-height: 600px;
    }

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

    .footer-bottom-inner { flex-direction: column; align-items: flex-start; }

    .back-to-top { right: 16px; bottom: 16px; }
}

@media (max-width: 420px) {
    .site-description { font-size: 0.8rem; }
    .menu-toggle-label { font-size: 1rem; }
    .menu-toggle { gap: 8px; }
}
