* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
:root {
    --primary-color: #888 ;
    --secondary-color: #777777;
    --light-gray: #d6d6d6;
    --main-white: #fff;
    --accent-color: #050505;
    --background-color: #F6F6F6;
    --text-color: #333;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --max-width: 1200px;
    --lesser-width: 800px;
    --card-bg: rgba(255, 255, 255, 0.7); /* Weiß, 70% Deckkraft */
    --smallheader-bg: rgba(777, 777, 777, 0.1);
    --border-radius: 1px
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Roboto', sans-serif;
    font-size: 18px; /* Hier: Desktop-Schriftgröße erhöht */
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);

    /* erzwinge sinnvolle umbrüche */
    p, li, blockquote {
    overflow-wrap: anywhere;  /* bricht auch sehr lange wörter/urls */
    word-break: normal;       /* deutschfreundlich */
    hyphens: auto;            /* bindestriche zulassen */
  }
}


/* übergeordnete Schachteln */
.content-wrapper {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 24px 16px;
}


.container {
    max-width: var(--lesser-width);
    margin: 0 auto;
    padding: 20px;
}

/* Header mit Menü */
.header {
    /* Diese Regel ist jetzt leer, damit sie den Header auf der index.html nicht beeinflusst. */
    /* Die Positionierung wird durch die neue Klasse unten gesteuert. */
}

/* Eigene Klasse für den Header mit den fixierten Buttons. */
.header-with-buttons {
    position: fixed; /* Fixiert am Viewport */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    pointer-events: none; /* Klicks gehen durch den leeren Bereich durch */
}
/* Fügt den Abstand oben nur hinzu, wenn der fixierte Header vorhanden ist */
.header-with-buttons + .content-wrapper {
    padding-top: 80px;
}

.menu-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--text-color);
    color: var(--background-color);
    border: none;
    cursor: pointer;
    border-radius: var(--border-radius);
    font-size: 16px;
    text-decoration: none; /* Entfernt die Unterstreichung vom Link */
    /* NEU: Feste Größe und Zentrierung für quadratische Form */
    width: 45px;
    height: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto; /* Button bleibt klickbar */
}

/* Zurück-Button, angelehnt an Menu-Button*/
.back-button {
    position: absolute;
    top: 10px;
    left: 10px; /* Position auf links geändert */
    background: var(--text-color);
    color: var(--background-color);
    border: none;
    cursor: pointer;
    border-radius: var(--border-radius);
    font-size: 16px;
    text-decoration: none; /* Für <a>-Tag, um Unterstreichung zu entfernen */
    /* NEU: Feste Größe und Zentrierung für quadratische Form */
    width: 45px;
    height: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: 2px; /* Kleine Korrektur, um den Pfeil optisch zu zentrieren */
    pointer-events: auto; /* Button bleibt klickbar */
}

/* Video-Toggle-Button (Play/Pause) */
.video-toggle {
    position: absolute; /* Scrollt mit dem Inhalt weg (nicht fixed) */
    top: 10px;
    left: 50%;
    transform: translateX(-50%); /* Exakte horizontale Zentrierung */
    background: var(--text-color);
    color: var(--background-color);
    border: none;
    cursor: pointer;
    border-radius: var(--border-radius);
    font-size: 16px;
    width: 45px;
    height: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000; /* Muss über dem Header liegen, um klickbar zu sein */
    pointer-events: auto;
}

.menu-toggle:hover {
    background: var(--accent-color);
}
.video-toggle:hover {
    background: var(--accent-color);
}
.back-button:hover {
    background: var(--accent-color);
}

.menu {
    position: absolute;
    top: 30px;
    right: 10px;
    background: var(--background-color);
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px var(--box-shadow);
    display: none;
    min-width: 150px;
    pointer-events: auto; /* Menü bleibt klickbar */
}

.menu.active {
    display: block;
}

.menu a {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-color); 
    border-bottom: 1px solid #eee;
}

.menu a:last-child {
    border-bottom: none;
}
.menu a:hover {
    background-color: var(--background-color);
}


/* Content Boxen */
.content-box {
    text-align: center;
    background: var(--card-bg);
    border-radius: var(--border-radius)/2;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-width: var(--lesser-width);
    width: 60%; /* Breite auf Desktop auf 60% reduziert */
    margin-bottom: 60px; /* Erhöht für mehr Abstand zwischen den Boxen */
    padding: 40px;
    margin-left: auto;  /* Zentrierung */
    margin-right: auto; /* Zentrierung */
}

.content-box a {
color: var(--secondary-color);          /* Links grau */
text-decoration: none;   /* Unterstreichung weg */
}
.content-box a:hover {
text-decoration: underline; /* Unterstrich beim Drüberfahren */
}

/* Versuch ganzer Text in eine Box */
.article-body-content {
    margin-top: 5rem;
    padding: 3rem;
    text-align: left; /* Text linksbündig für den Hauptartikel */
    background: var(--background-color); 
}
    /* Eigene Klasse für Zwischenüberschriften, um sie direkt zu integrieren */
.subheading {
    font-weight: bold;
    color: var(--secondary-color);
    font-size: 1.2rem;
    text-align: center;
    margin-top: 2em;
    margin-bottom: 1.5em;
}
    /* Eigene Klasse für den Teaser-Text, damit er auch innerhalb der großen Box funktioniert */
.teaser-text {
    font-style: italic;
    color: var(--secondary-color);
    font-size: 1rem;
    margin-bottom: 2em;
    display: block; /* Stellt sicher, dass es als eigener Absatz behandelt wird */
}

.content-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

/* Modifikator für eine unauffälligere Content-Box */
.content-box.subtle {
    background: none;
    box-shadow: none;
    border-radius: 0;
    text-align: left; /* Text linksbündig statt zentriert */
    padding-left: 30px;
    padding-right: 30px;
    margin-bottom: 20px;
}

.content-box.subtle:hover {
    transform: none; /* Kein Hover-Effekt */
    box-shadow: none;
}

/* Modifikator für Header-Box mit Abstand nach unten */
.content-box.header {
    padding: 60px;
    margin-bottom: 10em;

}
/* Titelbox für Artikel */
.content-box.smallheader {
    margin-top: 2em;
    margin-bottom: 2em;
    background: var(--background-color);
}
/* Titelbox für Artikel mit transparentem Look */
.content-box.transparent_smallheader {
    margin-top: 10vh;    /* Desktop: Titel rutscht ins vertikale Zentrum */
    margin-bottom: 50vh; /* Desktop: Viel Platz nach unten, schiebt Text aus dem Bild */
    padding: 60px 5px;
    background: var(--smallheader-bg);
}
.transparent_main-title {
    text-align: center;
    font-size: 2rem;
    font-weight: bolder;
    line-height: 40px;
    color: var(--main-white);
    margin: 0;
    padding: 10px 0 40px 0;
}
.transparent_author-title {
    text-align: center;
    font-size: 1rem;
    font-weight: lighter;
    color: var(--light-gray);
    margin: 0;
}
.transparent_secondary-title {
    text-align: center;
    font-size: 1.3rem;
    font-weight: lighter;
    color: var(--light-gray);
    margin: 0;
}
.box-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 15px;
}

.box-text {
    color: var(--text-color);
    font-size: 1rem;
    line-height: 1.5;
}

.content-box.italic-teaser .box-text {
    font-style: italic;
    color: var(--text-color);
    font-size: 1rem;
    margin-bottom: 2em;
}



.content-box.title .box-text {
    font-weight: bold;
    color: var(--secondary-color);
    font-size: 1.2rem;
    text-align: center;
}


/* Titel-Styling innerhalb der Box */
.homepage-title {
    text-align: center;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-color);
    margin: 0;
    padding: 0;
}

.main-title {
    text-align: center;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-color);
    margin: 0;
    padding: 0;
}

.secondary-title {
    text-align: center;
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 0 0 0.5em 0; /* kleiner Abstand nach unten */
    padding: 0;
}

.author-title {
    text-align: center;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--secondary-color);
    margin: 1em 0 1em 0; /* kleiner Abstand nach oben, großer Abstand nach unten */
    padding: 0;
}
.box-text a:hover {
    text-decoration: underline}


/* Standard (Desktop): Mobile Sachen ausblenden */
/* WICHTIG: Diese Regel muss VOR dem Media-Query stehen, damit sie mobil überschrieben werden kann */
.mobile-only {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        font-size: 16px; /* Hier: Mobil wieder auf Standard zurück */
    }

    .main-title {
        font-size: 2rem;
        margin: 20px 0;
    }
    
    .container {
        padding: 15px;
    }

    .box-content {
        padding: 15px;
    }
    .box-title {
        font-size: 1rem;
    }
    .box-text {
        font-size: 0.9rem;
    }

    /* Mobile Anpassung: Hier brauchen wir weniger Abstand als auf dem Desktop */
    .content-box.transparent_smallheader {
        margin-top: 8vh;    /* Titel etwas höher als Desktop */
        margin-bottom: 22vh; /* Flexibler Abstand, aber kompakt genug für Handy */
    }
        .content-box.smallheader {
        margin-top: 10vh;    /* Titel etwas höher als Desktop */
        margin-bottom: 20vh; /* Flexibler Abstand, aber kompakt genug für Handy */
    }

    .footer {
        font-size: 0.4rem;
        padding: 10px;
    }
}


/* Footer-Styling */
footer {
background-color: var(--text-color);   /* dunkler Hintergrund */
color: var(--background-color);      /* heller Text */
padding: 30px 16px;              /* Innenabstand oben/unten und seitlich */
text-align: center;              /* Text mittig */
margin-top: 35em;                /* Abstand zum Inhalt darüber */
font-size: 0.7rem;
}

footer a {
color: var(--background-color);          /* Links weiß */
text-decoration: none;   /* Unterstreichung weg */
}

footer a:hover {
text-decoration: underline; /* Unterstrich beim Drüberfahren */
}

/* Container für die Videos, um sie im Hintergrund zu halten */
.video-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Stellt sicher, dass der Inhalt darüber liegt */
    overflow: hidden;
    /* Damit das Fallback-Bild (das wir jetzt inline im HTML setzen) korrekt skaliert wird */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Gemeinsame Stile für beide Videos */
.bg-video {
    position: absolute; /* Positioniert das Video innerhalb des Containers */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Füllt den Bildschirm ohne das Seitenverhältnis zu verzerren */
    opacity: 0; /* Startzustand ist unsichtbar, damit man das Fallback-Bild sieht */
    transition: opacity 1.5s ease-in-out; /* Sanftes Einblenden über 1.5 Sekunden */
}

/* Diese Klasse wird vom JS hinzugefügt, sobald das Video flüssig läuft */
.bg-video.is-playing {
    opacity: 1;
}

/* Standardmäßig das mobile Video ausblenden */
.bg-video-mobile {
    display: none;
}

/* Media Query für Bildschirme, die breiter als 768px sind (Tablets/Desktops) */
@media (min-width: 769px) {
    .bg-video-desktop {
        display: block; /* Desktop-Video anzeigen */
    }
    .bg-video-mobile {
        display: none; /* Mobiles Video ausblenden */
    }
}

/* Media Query für Bildschirme, die schmaler als 768px sind (Smartphones) */
@media (max-width: 768px) {
    .bg-video-desktop {
        display: none; /* Desktop-Video ausblenden */
    }
    .bg-video-mobile {
        display: block; /* Mobiles Video anzeigen */
    }
}

    /* header und content breit auf Mobilgeräten */
    @media (max-width: 768px) {
        .content-wrapper {
            padding-left: 0;
            padding-right: 0;
        }
        .content-box {
            width: 100%;
            max-width: 100%;
            margin-left: 0;
            margin-right: 0;
            border-radius: 0;
            padding: 2rem 1rem;
        }
    }

/* beim Hovern über Link erscheint eine Hand */
a, button, [onclick] {
    cursor: pointer;
}

/* --- Stile für Scrollytelling   --       --            --        --       --         --- */
#scrolly-presidents {
    position: relative;
}

/* Scrolly Population: Fixes für die Achsen-Animation */
#scrolly-population .y-axis .domain {
    display: none; /* Die vertikale Achsenlinie dauerhaft ausblenden */
}

#scrolly-population .y-axis .tick line {
    stroke-opacity: 0.1;   /* Gitterlinien immer zart */
    stroke-dasharray: 2,2; /* Gitterlinien immer gestrichelt */
}

.scrolly-vis {
    position: -webkit-sticky;
    position: sticky;
    top: 0; /* Klebt ganz oben am Bildschirmrand */
    left: 0;
    width: 100%;
    height: 100vh; /* Füllt den gesamten Bildschirm aus */
    display: flex;
    flex-direction: column; /* Kinder sollen untereinander angeordnet werden */
    justify-content: center;
    align-items: center;
}

/* Container für die responsive SVG */
.chart-container {
    width: 100%;
    max-width: var(--lesser-width); /* Legt eine maximale Größe fest, damit es auf sehr großen Bildschirmen nicht riesig wird */
    margin: 0 auto; /* Zentriert den Container */
}

/* Gemeinsame Stile für Header und Intro der Grafik */
.chart-header, .chart-intro {
    width: 100%;
    max-width: var(--lesser-width); /* Dieselbe maximale Breite wie die Grafik */
    margin-left: auto;
    margin-right: auto;
    text-align: left; 
}

.scrolly-text {
    position: relative;
    z-index: 1; /* Wichtig: Stellt sicher, dass der Text VOR der Grafik liegt */
    /* Wir machen den Text-Container zu einem Flex-Container, der seine Kinder zentriert */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.step {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: var(--lesser-width)*0.95;
    margin-bottom: 100vh; /* Nur noch Abstand nach unten */
    padding: 3rem;
    background-color: var(--background-color); /* Solide Hintergrundfarbe, passend zum Rest der Seite */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}


/* Scrolly-Anpassungen für kleinere Bildschirme */
@media (max-width: 768px) {
    #scrolly-presidents {
        display: block; /* Untereinander statt nebeneinander */
    }

    .scrolly-vis {
        position: -webkit-sticky;
        position: sticky;
        top: 80px; /* Etwas Abstand zum oberen Rand, damit es nicht direkt klebt */
        width: 100%;
        height: 60vh; /* Größere Höhe */
        z-index: 0;
        margin: 0;
    }

    .scrolly-text {
        width: 100%;
        margin: 0 auto;
        margin-top: 75vh; /* Text startet viel weiter unten, damit die Grafik erst mal alleine wirkt */
    }

    .step {
        width: 100%;   /* Volle Breite für mobile Geräte */
        padding: 1rem 1.5rem; /* Etwas seitlicher Abstand für Lesbarkeit */
        margin: 0 auto 60vh auto; /* Abstand nach unten, damit man scrollen kann */
        background-color: rgba(255, 255, 255, 0.95); /* Leicht transparent, wirkt moderner */
        border-radius: 0px;    /* Keine abgerundeten Ecken bei voller Breite */
    }

    /* Spezifische Anpassungen für Seiten mit Scrolly-Grafiken auf Mobilgeräten
    im Zweifel wieder freigeben, wenn doch nur bei den Scrolly-Seiten nötig 
    .page-with-scrolly .content-wrapper {
        padding-left: 0;
        padding-right: 0;
    }
    .page-with-scrolly .content-box {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        border-radius: 0;
        padding: 2rem 1rem;
    }*/

    .page-with-scrolly .article-body-content {
        margin-top: 1rem; /* Abstand nach oben verringern */
    }
    .page-with-scrolly .step {
        padding: 1rem 0.5rem; /* Minimales Padding, damit Grafiken/Text maximal breit sind */
    }

    /* Mehr Abstand für die Scrolly-Sektionen zum restlichen Text */
    #scrolly-presidents, #scrolly-population, #scrolly-congress {
        margin-top: 4rem;
        margin-bottom: 4rem;
    }

    /* NEU: Grafik-Container auf volle Breite zwingen, damit die SVG den Platz nutzt */
    .page-with-scrolly .chart-container,
    .page-with-scrolly .chart-header,
    .page-with-scrolly .chart-intro {
        max-width: none; /* Hebt die 800px-Beschränkung auf */
        padding-left: 1rem; /* Etwas seitlicher Abstand, damit es nicht am Rand klebt */
        padding-right: 1rem;
    }

    /* Hilfsklassen für unterschiedliche Inhalte je nach Gerät */
    .desktop-only { display: none !important; }
    .mobile-only { display: flex !important; } /* Steps sind Flex-Container */
}
