/* Modern CSS Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Globale Farbvariablen */
:root {
    /* Farb-Grundwerte */
    --black-rgb: 32, 34, 37;

    --brand: #D91358; /* #FF0040. #D91358 */
    --black: #201F23;
    --sub-black: #575F6E;
    --white: #FFFFFF;
    --background-light: var(--white); /* Hintergrund folgt nun der neuen Testfarbe */
    --bg-tag: #F3F4F5;
    --background-hover: #DCDAC8; /* Ein leicht dunklerer Ton des neuen Weiß für Hover-Effekte */
    --element-padding-block: 1.25rem; /* 20px - Globaler vertikaler Abstand für Titel/Dropdowns */
    --lightbox-bg: rgba(var(--black-rgb), 0.9);
    --border-color: #D1D1D1;
}

/* Dark Mode Farbvariablen */
body.dark-mode {
    --brand: #FF2D6B; /* Leuchtendere Brand-Farbe im Dark Mode, Kontrast ~6.1:1 auf Schwarz */
    --black: #FFFFFF; /* Wird zu hellem Text */
    --sub-black: #B0B0B0; /* Wird zu hellerem sub-Text */
    --white: #000000; /* Wird zu dunklem Hintergrund für Elemente wie Footer */
    --background-light: #000000; /* Wird zum primären Seitenhintergrund, jetzt identisch zum Dropdown */
    --bg-tag: #1F232A; /* Dunkle Tag-Hintergrundfarbe fuer gute Lesbarkeit in Kontext-Tags */
    --background-hover: #2a2a2a; /* Farbe für Hover-Effekte im Dark-Mode */
    --lightbox-bg: rgba(var(--black-rgb), 0.9); /* Bleibt absichtlich dunkel */
    --border-color: #333333;
}

/* Stellt sicher, dass das Header-Logo im Dark Mode weiss bleibt */
body.dark-mode .logo-overlay svg {
    color: #FFFFFF;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

/* Barlow Font Face - Regular */
@font-face {
  font-family: 'Barlow';
  font-style: normal;
  font-weight: 400;
  src: url('fonts/Barlow-Regular.ttf') format('truetype');
}

/* Barlow Font Face - Medium */
@font-face {
  font-family: 'Barlow';
  font-style: normal;
  font-weight: 500;
  src: url('fonts/Barlow-Medium.ttf') format('truetype');
}

/* Barlow Font Face - SemiBold */
@font-face {
  font-family: 'Barlow';
  font-style: normal;
  font-weight: 600;
  src: url('fonts/Barlow-SemiBold.ttf') format('truetype');
}

/* Barlow Font Face - Bold */
@font-face {
  font-family: 'Barlow';
  font-style: normal;
  font-weight: 700;
  src: url('fonts/Barlow-Bold.ttf') format('truetype');
}

/* Barlow Font Face - Italic */
@font-face {
  font-family: 'Barlow';
  font-style: italic;
  font-weight: 400;
  src: url('fonts/Barlow-Italic.ttf') format('truetype');
}

/* Barlow Font Face - Medium Italic */
@font-face {
  font-family: 'Barlow';
  font-style: italic;
  font-weight: 500;
  src: url('fonts/Barlow-MediumItalic.ttf') format('truetype');
}

/* Barlow Font Face - SemiBold Italic */
@font-face {
  font-family: 'Barlow';
  font-style: italic;
  font-weight: 600;
  src: url('fonts/Barlow-SemiBoldItalic.ttf') format('truetype');
}

/* Barlow Font Face - Bold Italic */
@font-face {
  font-family: 'Barlow';
  font-style: italic;
  font-weight: 700;
  src: url('fonts/Barlow-BoldItalic.ttf') format('truetype');
}

/* Basis-Einstellungen für konsistente Schriftgrösse */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}

/* Prevent FOUC (Flash of Unstyled/Unlocalized Content) */
html.loading body {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out;
}

/* --- Language Switching Logic --- */
:lang(de) .lang-en {
    display: none !important;
}
:lang(en) .lang-de {
    display: none !important;
}

/* General Body Styles */
body {
    font-family: 'Barlow', sans-serif;
    background-color: var(--background-light);
    color: var(--black);
    font-size: 1rem; /* Setzt die Basisschriftgrösse auf 16px */
    font-weight: 400; /* Setzt das Standard-Schriftgewicht auf Regular */
    line-height: 1.5rem; /* Setzt die Standard-Zeilenhöhe auf 24px (p1) */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    opacity: 1;
    visibility: visible;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-synthesis: none;
}

h3 {
    font-size: 1rem; /* 16px */
    line-height: 1.5rem; /* 24px */
    font-weight: 600;
}

/* Globale Fokus-Stile für bessere Barrierefreiheit */
:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 2px; /* Leichte Abrundung für den Fokus-Indikator */
}

/* Globale Typografie-Klassen */
.p1 {
    font-size: 1rem; /* 16px */
    line-height: 1.5rem; /* 24px */
}
.p2 {
    font-size: 0.875rem; /* 14px */
    line-height: 1.25rem; /* 20px */
    color: var(--black);
}
.textlink-p1 {
    font-size: 1rem; /* 16px */
    line-height: 2rem; /* 32px */
}
.textlink-p2 {
    font-size: 0.875rem; /* 14px */
    line-height: 2rem; /* 32px */
}

/* Reusable Text Link Button Style */
.textlink {
    display: inline-flex;
    align-items: center;
    min-height: 3rem; /* 48px Touch Target */
    background: transparent;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: 0.875rem; /* 14px, passend zu text-meta */
    line-height: 1.25rem;
    color: var(--brand);
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
}

/* Hervorhebung im Lauftext: Fett und in Sub-Black */
.text-highlight {
    font-weight: 600;
    color: var(--sub-black);
}

/* Container für "Mein Beitrag & Projektkontext" auf Detailseiten */
.project-context-box {
    padding: 0;
    margin-top: 1rem; /* Abstand zum vorherigen Element */
    color: var(--black);
}

/* Erzwingt 16px und Schwarz für alle Textelemente innerhalb der grauen Box */
.project-context-box .p2,
.project-context-box .text-highlight,
.project-context-box .text-list li {
    font-size: 1rem;
    line-height: 1.5rem;
    color: var(--black);
}

/* In der grauen Box nutzen wir echte, unmanipulierte Browser-Bullets (Disc) */
.project-context-box .text-list,
.tasks-box .text-list {
    list-style-type: disc;
    padding-left: 1.5rem; /* Behält den Standard-Einzug bei */
}
.project-context-box .text-list li::before,
.tasks-box .text-list li::before {
    display: none; /* Deaktiviert das gezeichnete Pseudo-System in der Box */
}
.project-context-box .text-list li {
    margin-bottom: 0.25rem; /* 4px */
}

/* Listen im Fliesstext */
.text-list,
.text-list-numbered {
    padding-left: 1.5rem;
    margin-bottom: 0;
}
.text-list {
    list-style-type: none; /* Deaktiviert native Bullets für das Pseudo-System */
}
.text-list li {
    position: relative;
}
.text-list li::before {
    content: "▫"; 
    position: absolute;
    left: -1.25rem;
    top: 0;
    color: var(--black);
}
.text-list-numbered {
    list-style-type: decimal;
}
.text-list li,
.text-list-numbered li {
    margin-bottom: 0.5rem;
}

.text-list li:last-child,
.text-list-numbered li:last-child {
    margin-bottom: 0;
}

/* Touch-Target optimierter Link-Container */
.TextLinkButton {
    min-height: 3rem; /* 48px Touch Target */
    display: flex;
    align-items: center;
    width: fit-content;
}

.TextLinkButton a {
    color: var(--black);
    text-decoration: underline;
    transition: color 0.2s ease-in-out;
}

/* Barrierefreiheit: Legt den Fokus-Rahmen um den gesamten Button, nicht nur den Link */
.TextLinkButton:focus-within {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Verhindert den doppelten Fokus-Rahmen auf dem Link selbst */
.TextLinkButton a:focus-visible {
    outline: none;
}

.TextLinkButton a:active {
    color: var(--brand);
}

@media (hover: hover) {
    .TextLinkButton a:hover {
        color: var(--brand);
    }
}

/* Secondary Button Style - Für sekundäre Aktionen (z.B. Kontakt-Links) */
.SecondaryButton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem; /* 48px Touch Target */
    padding: 0 1.5rem;
    border: 1px solid var(--brand);
    color: var(--brand);
    text-decoration: none;
    font-weight: 500; /* Medium */
    transition: color 0.2s ease-in-out, border-color 0.2s ease-in-out, background-color 0.2s ease-in-out;
    background-color: transparent;
    cursor: pointer;
    border-radius: 999px;
    gap: 0.5rem; /* Abstand zwischen Icon und Text */
}

.SecondaryButton:hover {
    background-color: var(--brand);
    color: var(--white);
}

/* Small Variant (36px) */
.SecondaryButton.small {
    min-height: 2.25rem; /* 36px */
    padding: 0 1rem;
    gap: 0.5rem;
}

.SecondaryButton svg {
    width: 1.5rem; /* 24px */
    height: 1.5rem;
    fill: currentColor;
    flex-shrink: 0;
}

/* Stellt sicher, dass der Text im Button nicht umbricht */
.SecondaryButton .button-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Container für Button-Gruppen */
.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

/* Globale Klasse für grosse, fluide Überschriften */
.fluid-headline {
    font-family: 'Barlow', sans-serif;
    font-weight: 600; /* SemiBold */
    font-size: 1.5rem; /* 24px Mobile Standard */
    line-height: normal; /* Nutzt die Standard-Zeilenhöhe der Schriftart */
    color: var(--black); /* Setzt die Standardfarbe auf Schwarz */
}

/* Globale Klasse für mittlere Titel (z.B. Dropdown-Optionen, TOC) */
.text-title-medium {
    font-size: 1.125rem; /* 18px Mobile Standard */
    line-height: 1.5rem; /* 24px */
    font-weight: 600; /* SemiBold */
}

a.text-title-medium {
    color: var(--black);
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

a.text-title-medium:hover {
    color: var(--brand);
}

/* Globale Klasse für Metadaten/Keywords */
.text-meta {
    font-size: 1rem; /* 16px */
    line-height: 1.5rem; /* 24px */
}
.text-meta dl {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.project-meta dd dl { /* Spezifischer für die innere DL der Aktivitäten */
    gap: 0.5rem; /* Kleinerer Abstand zwischen den Aktivitätskategorien */
}

.text-meta dt,
.text-meta dd {
    display: block;
}
.text-meta dt {
    font-weight: 600;
    font-size: 0.875rem; /* 14px */
    line-height: 1.25rem; /* 20px */
    color: var(--sub-black);
}
.text-meta dd {
    margin-left: 0;
    color: var(--black);
}

/* Main Content */
main {
    flex-grow: 1; /* Sorgt dafür, dass der main-Bereich wächst und den Footer nach unten drückt */
    padding-bottom: 2rem; /* 32px Abstand nach unten */
}


/* Header & Logo */
.site-header {
    padding-block: 4rem 2rem; /* 64px oben, 32px unten */
}

.site-logo {
    position: relative; /* Notwendig, damit z-index funktioniert */
    z-index: 30; /* Höher als der z-index des sticky Dropdowns (20) */
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100px;
    height: 100px;
    /* Hintergrund kommt aus der animierten Blob-Fläche */
    text-decoration: none;
    pointer-events: none; /* Der Container selbst fängt keine Maus-Events ab */
}

/* Container für Animation, Logo und Text */
.logo-animation-container, 
.logo-overlay, 
.text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    pointer-events: none; /* Container fängt keine Maus-Events ab */
    justify-content: center;
    align-items: center;
}

/* Logo Overlay */
.logo-overlay {
    z-index: 31; /* Über der Animation (30 ist site-logo base) */
    transition: opacity 0.3s ease-in-out;
}

/* NEU: Styling für das SVG im Logo Overlay */
.logo-overlay svg {
    width: 70%; /* Grösser dargestellt (vorher 50% inline) */
    height: auto;
    color: var(--white);
}

/* Blendet das Logo aus, wenn die animierte Fläche gehovert wird */
.site-logo:has(.logo-animation-target:hover) .logo-overlay {
    opacity: 0;
}

/* Text Overlay */
.text-overlay {
    z-index: 32; /* Über dem Logo */
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

/* Blendet den Text ein, wenn die animierte Fläche gehovert wird */
.site-logo:has(.logo-animation-target:hover) .text-overlay {
    opacity: 1;
}

.overlay-text {
    color: var(--white);
    text-align: left;
    line-height: 1.2rem; /* Engerer Zeilenabstand für den zweizeiligen Text */
}

/* Animationsfläche des Logos */
.logo-animation-container .logo-animation-target {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
    pointer-events: auto;
}

/* Flat Blob-Animation (anstelle von Rive) */
.logo-animation-container .lava-blob {
    background: var(--brand);
    border-radius: 50% 45% 52% 48% / 48% 53% 47% 52%;
    animation: lavaTransform 12s ease-in-out infinite alternate;
}

@keyframes lavaTransform {
    0% {
        border-radius: 48% 52% 50% 50% / 40% 55% 45% 60%;
    }
    25% {
        border-radius: 55% 45% 58% 42% / 50% 40% 60% 50%;
    }
    50% {
        border-radius: 42% 58% 40% 60% / 58% 52% 48% 42%;
    }
    75% {
        border-radius: 50% 50% 52% 48% / 45% 58% 42% 55%;
    }
    100% {
        border-radius: 52% 48% 45% 55% / 52% 45% 55% 48%;
    }
}

/* Wrapper für den Hauptinhalt, um eine einheitliche Breite und Zentrierung zu gewährleisten */
.content-wrapper {
    max-width: var(--grid-max-width, 400px); /* Nutzt die Breite vom Grid, mit Fallback */
    margin-inline: auto; /* Zentriert den gesamten Inhaltsblock */
    width: 100%; /* Nimmt die volle Breite des Parents ein */
    padding-inline: 1rem; /* 16px seitlicher Standard-Abstand für Phone */
    position: relative; /* Positionierungskontext für Kind-Elemente */
}

/* --- Global Custom Dropdown Styling --- */
.custom-dropdown {
    width: 100%;
    position: relative;
    display: block;
    background-color: var(--background-light);
    z-index: 40;
}

/* Sticky State */
.custom-dropdown.is-sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* Wrapper für den Header-Inhalt (Titel + Icon + Touch Target) */
/* Dient dazu, den Inhalt zu zentrieren, während der Hintergrund (custom-dropdown) volle Breite hat */
.custom-dropdown .dropdown-header-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: var(--grid-max-width, 400px); /* Standard Mobile Breite */
    margin-inline: auto;
    padding-left: 1rem; /* 16px für Phone */
    padding-right: 0.25rem; /* 4px für Phone */
    position: relative;
    z-index: 41;
    background-color: var(--background-light);
}

.dropdown-selected {
    cursor: pointer;
    display: flex;
    align-items: center;
    width: fit-content;
    padding-block: var(--element-padding-block);
    transition: color 0.2s ease-in-out;
    min-width: 0; /* Für Text-Truncation wichtig */
}

/* Stellt sicher, dass der Titel im Dropdown bei Überlänge abgeschnitten wird */
.dropdown-selected .fluid-headline {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease-in-out;
}

/* Hover-Effekte nur für Geräte mit Mauszeiger (verhindert Sticky-Hover auf Touch) */
@media (hover: hover) {
    .dropdown-selected:hover .fluid-headline,
    .dropdown-selected:hover {
        color: var(--brand);
    }
    .dropdown-selected:hover .dropdown-icon {
        fill: var(--brand);
    }
}

/* Active-State für Touch-Feedback */
.dropdown-selected:active .fluid-headline,
.dropdown-selected:active {
    color: var(--brand);
}
.dropdown-selected:active .dropdown-icon {
    fill: var(--brand);
}

.dropdown-icon {
    width: 1.5rem; /* 24px Mobile, passend zu fluid-headline */
    height: 1.5rem; /* 24px Mobile, passend zu fluid-headline */
    fill: var(--black);
    transition: transform 0.2s ease-in-out, fill 0.2s ease-in-out;
    flex-shrink: 0;
}

.custom-dropdown.open .dropdown-icon {
    transform: rotate(180deg);
}

/* Scroll-to-Top Target */
.icon-touch-target {
    width: 3rem;
    height: 3rem;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--black);
    cursor: pointer;
    transition: color 0.2s ease-in-out;
    flex-shrink: 0;
    opacity: 0; /* Standardmässig unsichtbar */
    pointer-events: none; /* Nicht klickbar, wenn unsichtbar */
    visibility: hidden; /* Verhindert Fokus wenn unsichtbar */
    transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out, visibility 0s 0.2s;
}

.custom-dropdown.is-sticky .icon-touch-target {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out, visibility 0s;
}

@media (hover: hover) {
    .icon-touch-target:hover {
        color: var(--brand);
    }
}

.icon-touch-target:active {
    color: var(--brand);
}

.icon-touch-target svg {
    width: 1.5rem;
    height: 1.5rem;
    fill: currentColor;
}

/* Dropdown Options Container */
.dropdown-options-wrapper {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--background-light);
    max-height: 0;
    overflow: hidden;
    /* Visibility verzögern (0.3s), damit die Height-Animation sichtbar bleibt beim Schliessen */
    transition: max-height 0.3s ease-in-out, visibility 0s 0.3s;
    box-shadow: 0 10px 10px rgba(0,0,0,0.05);
    visibility: hidden; /* Verhindert Fokus im geschlossenen Zustand */
    /* Scrollbalken visuell ausblenden, um Layout-Sprünge zu verhindern */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
    padding-bottom: 1rem; /* 16px, um am Ende der Liste Platz zu schaffen */
}
.custom-dropdown.disable-transition .dropdown-options-wrapper {
    transition: none !important;
}
.dropdown-options-wrapper::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.custom-dropdown.open .dropdown-options-wrapper {
    visibility: visible;
    transition: max-height 0.3s ease-in-out, visibility 0s; /* Visibility sofort umschalten */
}

.custom-dropdown.scrollable .dropdown-options-wrapper {
    overflow-y: auto; /* Aktiviert das Scrollen erst nach der Animation */
    overscroll-behavior: contain;
}

/* Innerer Container für die Optionen (Zentrierung) */
.dropdown-content-aligner {
    width: 100%;
    max-width: var(--grid-max-width, 400px);
    margin-inline: auto;
    padding-left: 1rem; /* 16px für Phone */
    padding-right: 1rem; /* 16px für Phone */
}

.dropdown-options {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dropdown-options li {
    padding: 1rem 0;
    border-top: 1px solid rgba(0,0,0,0.05);
    cursor: pointer;
    transition: color 0.2s ease-in-out;
}

/* Spezifisches Styling für den Projekt-Filter (Index) */
.dropdown-options--filter {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dropdown-options--filter li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding-block: 1rem;
    cursor: pointer;
    transition: color 0.2s ease-in-out;
}

.dropdown-item-icon {
    width: 1.5rem; /* 24px */
    height: 1.5rem;
    flex-shrink: 0;
    fill: currentColor;
}

/* Spezifisches Styling für das Inhaltsverzeichnis (Details) */
.dropdown-options--toc li {
    display: block; /* Einfache Liste */
}

/* Gemeinsamer Hover-Effekt */
.dropdown-options li:hover,
.dropdown-options--filter li:hover,
.dropdown-options--toc li:hover {
    color: var(--brand);
}

/* --- Global Portfolio Grid Styles --- */
.portfolio-grid {
    display: grid;
    gap: 0.25rem; /* 4px */
    /* Mobile-Standard: 4 Spalten */
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(100px, auto);
    min-height: 100px;
    width: 100%;
}

/* Project Tile Base Styles */
.project-tile {
    position: relative;
    overflow: hidden;
    border-radius: 0;
    aspect-ratio: 1 / 1;
    grid-column: span 2;
    min-height: 100px;
    transition: opacity 0.4s ease-out;
    display: block; /* Wichtig für a-Tags */
}

/* Large Project Tile (Mobile Base) */
.project-tile.large {
    grid-column: span 4; /* Volle Breite auf Mobile */
    grid-row: span 2;
}

.project-tile.large .project-info h3 {
    font-size: 1.25rem; /* 20px */
    line-height: 1.75rem; /* 28px */
}

.project-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

/* Project Info Overlay */
.project-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(to top, rgba(var(--overlay-color-base, 0, 0, 0), 0.8) 0%, rgba(var(--overlay-color-base, 0, 0, 0), 0) 100%);
    color: var(--white);
    padding: 0.9375rem; /* 15px */
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.project-info h3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #FFFFFF;
}

/* Zeigt das Overlay beim Hovern an */
.project-tile:hover .project-info,
.project-tile.touched .project-info,
.project-tile:focus .project-info {
    opacity: 1;
}

/* --- Global Grid Styles --- */
.footer-grid {
    display: grid;
    gap: 0.25rem; /* 4px */
    /* Mobile-Standard: 4 Spalten */
    grid-template-columns: repeat(4, 1fr);
}

/* --- Responsive Global Styles --- */
/* Tablet: 8 Spalten */
@media (min-width: 600px) {
    .footer-grid {
        grid-template-columns: repeat(8, 1fr);
    }
    .portfolio-grid {
        grid-template-columns: repeat(8, 1fr);
    }
    .project-tile {
        grid-column: span 2; /* Standardkachel: 2 von 8 Spalten */
    }
    .project-tile.large {
        grid-column: span 4; /* Grosse Kachel: 4 von 8 Spalten */
    }
    .content-wrapper,
    .footer-grid,
    .custom-dropdown {
        --grid-max-width: 804px; /* (400px * 2) + 4px */
    }
    .content-wrapper {
        padding-inline: 2rem; /* 32px seitlicher Standard-Abstand für Tablet und größer */
    }
    .custom-dropdown .dropdown-header-wrapper {
        padding-left: 2rem; /* 32px für Tablet und größer */
        padding-right: 1.25rem; /* 20px für Tablet und größer */
    }
    .dropdown-content-aligner {
        padding-left: 2rem; /* 32px für Tablet und größer */
        padding-right: 2rem; /* 32px für Tablet und größer */
    }
    /* Typografie-Anpassungen für Tablet und grösser */
    .fluid-headline {
        font-size: 2rem; /* 32px */
    }
    .text-title-medium {
        font-size: 1.25rem; /* 20px */
        line-height: 1.75rem; /* 28px */
    }
    .dropdown-icon {
        width: 2rem; /* 32px Tablet+, passend zu fluid-headline */
        height: 2rem; /* 32px Tablet+, passend zu fluid-headline */
    }
    .project-tile.large .project-info h3 {
        font-size: 1.5rem; /* 24px */
        line-height: 2rem; /* 32px */
    }
}

/* Laptop & Desktop: 12 Spalten */
@media (min-width: 992px) {
    .footer-grid {
        grid-template-columns: repeat(12, 1fr);
    }
    .portfolio-grid {
        grid-template-columns: repeat(12, 1fr);
    }
    .project-tile {
        grid-column: span 2; /* Standardkachel: 2 von 12 Spalten */
    }
    .project-tile.large {
        grid-column: span 4; /* Grosse Kachel: 4 von 12 Spalten */
    }
    .content-wrapper,
    .footer-grid,
    .custom-dropdown {
        --grid-max-width: 1208px; /* (400px * 3) + (2 * 4px) */
    }
}

/* Desktop XL */
@media (min-width: 1440px) {
    .content-wrapper,
    .footer-grid,
    .custom-dropdown {
        --grid-max-width: 1384px; /* (12 * (1384/12 - 56)) + (11*56) */
    }
}

/* Footer */
footer {
    padding: 2rem 0; /* 32px oben/unten, 0px links/rechts */
    margin-top: 0;
    background-color: var(--background-light);
}

.footer-grid {
    text-align: left;
    width: 100%; /* Füllt die Breite des neuen .content-wrapper aus */
}

/* Sorgt dafür, dass die HR-Linie im Footer-Grid alle Spalten einnimmt */
footer hr {
    grid-column: 1 / -1;
    border: 0; /* Entfernt alle Ränder */
    height: 2px; /* Definiert die Höhe der Linie */
    background-color: transparent; /* Stellt sicher, dass kein Hintergrund durchscheint */
    background-image: radial-gradient(circle at center, var(--sub-black) 1px, transparent 1px);
    background-size: 10px 100%;
    background-repeat: repeat-x;
    margin: 0; /* Entfernt den vertikalen Standardabstand */
    margin-bottom: 2.5rem; /* 40px Abstand zu den Spalten darunter */
}

.footer-column {
    /* Wendet die p2-Typografie als Standard für den Footer an */
    font-size: 0.875rem; /* 14px */
    line-height: 1.25rem; /* 20px */
}

.footer-column h4 {
    font-size: 0.875rem; /* 14px */
    line-height: 1.25rem; /* 20px */
    font-weight: 600; /* SemiBold */
    margin-bottom: 1rem; /* 16px */
    color: var(--sub-black); /* Farbe an den Footer-Standard angepasst */
}

.footer-logo {
    width: 60px;
    height: auto;
    padding-block: 2px;
    overflow: visible;
    color: var(--sub-black); /* Setzt die Farbe, die von 'currentColor' im SVG verwendet wird */
}

body.dark-mode .footer-logo {
    color: var(--sub-black);
}

.footer-address {
    margin-top: 1rem; /* 16px Abstand zum Logo */
    color: var(--sub-black); /* Gleiche Farbe wie die Links */
}

.footer-column ul {
    list-style: none; /* Entfernt die Aufzählungspunkte */
}

.footer-column a {
    text-decoration: none; /* Entfernt die Unterstreichung */
    color: var(--sub-black); /* Setzt die Link-Farbe explizit, um Browser-Standards zu überschreiben */
    /* Wendet die Zeilenhöhe von textlink-p2 an */
    line-height: 2rem; /* 32px */
    display: inline-block; /* Macht den Link klickbar, aber nur so breit wie der Text */
    transition: color 0.2s ease-in-out;
}

.footer-column a:hover {
    color: var(--brand); /* Ändert die Farbe beim Hovern */
}

/* Spezifische Klasse für Links mit einem Icon, wie z.B. der LinkedIn-Link */
.link-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem; /* Kleiner Abstand zwischen Text und Icon */
}

/* Styling für das inline SVG-Icon im Link */
.link-with-icon .external-link-icon {
    width: 1rem; /* 16px, relativ zur Root-Schriftgrösse */
    height: 1rem; /* 16px */
    display: inline; /* Überschreibt das globale 'display: block' für SVGs */
    fill: currentColor; /* Erbt die Farbe vom Elternelement (dem Link) */
}

/* Responsive Footer-Spalten */
/* Mobile (Standard) */
.footer-grid .footer-column:nth-of-type(1) {
    grid-column: 1 / -1; /* Volle Breite, über alle Spalten */
    padding-bottom: 2rem; /* 32px Abstand nach unten */
}
.footer-grid .footer-column:nth-of-type(2),
.footer-grid .footer-column:nth-of-type(3) {
    grid-column: span 2; /* Halbe Breite */
    padding-bottom: 2rem; /* 32px Abstand nach unten */
}

/* Tablet- und Desktop-Layout für den Footer */
@media (min-width: 600px) {
    .footer-grid .footer-column:nth-of-type(1) {
        grid-column: span 8; /* Volle Breite auf Tablets */
    }
    .footer-grid .footer-column:nth-of-type(2),
    .footer-grid .footer-column:nth-of-type(3) {
        grid-column: span 4; /* Halbe Breite */
    }
}

@media (min-width: 992px) {
    .footer-grid .footer-column:nth-of-type(1),
    .footer-grid .footer-column:nth-of-type(2),
    .footer-grid .footer-column:nth-of-type(3) {
        padding-bottom: 0; /* Setzt den Abstand für Desktop zurück */
        grid-column: span 4; /* Setzt alle Spalten auf gleiche Breite zurück */
    }
}

/* Klassen, um Elemente nur fuer Screenreader sichtbar zu machen */
.visually-hidden,
.sr-only {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
}

.language-switcher-wrapper {
    /* grid-column und margin-top werden vom neuen Container gesteuert */
    height: 32px; /* Angepasste Höhe */
    width: fit-content; /* Passt die Breite an den Inhalt an */
    display: flex;
    align-items: center; /* Zentriert den Switcher vertikal */
    cursor: default; /* Standard-Mauszeiger für den Wrapper */
}

/* Sprachumschalter im Footer */
.language-switcher {
    position: relative;
}

/* Versteckt die Standard-Checkbox */
.lang-toggle-checkbox {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.lang-toggle-label {
    display: flex;
    align-items: center; /* Zentriert den inneren Switcher vertikal */
    justify-content: center; /* Zentriert den inneren Switcher horizontal */
    width: 100%; /* Füllt die gesamte Breite des Wrappers */
    height: 100%; /* Füllt die gesamte Höhe des Wrappers */
    background-color: transparent;
    position: relative;
    z-index: 5; /* Stellt sicher, dass das Label über dem ::before-Element liegt */
    cursor: default; /* Setzt den Standard-Cursor für das Label */
}

/* Der eigentliche sichtbare Umschalter-Teil */
.language-switcher {
    width: calc(1.75rem * 2); /* 56px */
    height: 1.75rem; /* 28px */
    display: flex;
    /* Zentriert die Icons (flex items) horizontal und vertikal */
    justify-content: space-around;
    align-items: center;
    /* Ersetzt den 'border' durch 'box-shadow', um das Layout nicht zu beeinflussen */
    border: 1px solid var(--sub-black);
    position: relative; /* Wichtig für die Positionierung des ::before Elements */
    cursor: pointer; /* Hand-Cursor nur für den sichtbaren Schalter */
    transition: border-color 0.2s ease-in-out;
}

/* Der bewegliche Schieber (das schwarze Viereck) */
.language-switcher::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: calc(1.75rem - 1px); /* 27px, um den linken Rand auszugleichen */
    background-color: var(--sub-black);
    transition: transform 0.3s ease-in-out, background-color 0.2s ease-in-out;
    z-index: 1;
}

.lang-icon {
    width: 1.5rem; /* 24px */
    height: 1.5rem; /* 24px */
    transition: color 0.3s ease-in-out; /* Animiert den Farbwechsel des Icons */
    /* Stellt sicher, dass die Icons über dem ::before-Element liegen */
    position: relative;
    z-index: 2;
}

/* Standardzustand (Englisch aktiv, links) */
.en-icon {
    color: var(--white); /* Setzt die Füllfarbe auf Weiss */
}
.de-icon {
    color: var(--sub-black); /* Setzt die Füllfarbe auf Sub-Black */
}

/* Fügt einen sichtbaren Fokus-Rahmen hinzu, wenn die unsichtbare Checkbox fokussiert wird */
.lang-toggle-checkbox:focus-visible + .lang-toggle-label .language-switcher {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* Zustand, wenn die Checkbox aktiviert ist */
.lang-toggle-checkbox:checked + .lang-toggle-label .language-switcher::before {
    transform: translateX(100%); /* Verschiebt den Schieber um seine eigene Breite */
}

/* Checked-Zustand (Deutsch aktiv, rechts) */
.lang-toggle-checkbox:checked + .lang-toggle-label .language-switcher .en-icon {
    color: var(--sub-black);
}
.lang-toggle-checkbox:checked + .lang-toggle-label .language-switcher .de-icon {
    color: var(--white);
}

/* Active-State: Feedback beim Klicken/Tippen (auch auf Touch) */
.lang-toggle-label:active .language-switcher {
    border-color: var(--brand);
}
.lang-toggle-label:active .language-switcher::before {
    background-color: var(--brand);
}
.lang-toggle-checkbox:not(:checked) + .lang-toggle-label:active .language-switcher .de-icon {
    color: var(--brand);
}
.lang-toggle-checkbox:checked + .lang-toggle-label:active .language-switcher .en-icon {
    color: var(--brand);
}

/* Hover-Effekte nur für Geräte mit Mauszeiger (verhindert Sticky-Hover auf Touch) */
@media (hover: hover) {
    .lang-toggle-label:hover .language-switcher {
        border-color: var(--brand);
    }

    .lang-toggle-label:hover .language-switcher::before {
        background-color: var(--brand);
    }

    /* Hover-State: Färbt das inaktive Icon in Brand-Farbe (passend zu Border/Slider) */
    .lang-toggle-checkbox:not(:checked) + .lang-toggle-label:hover .language-switcher .de-icon {
        color: var(--brand);
    }
    .lang-toggle-checkbox:checked + .lang-toggle-label:hover .language-switcher .en-icon {
        color: var(--brand);
    }
}

/* --- Theme Toggle Styles --- */
.theme-toggle-wrapper {
    /* grid-column und margin-top werden vom neuen Container gesteuert */
    height: 32px; /* Angepasste Höhe für Konsistenz */
    width: fit-content; /* Passt die Breite an den Inhalt an */
    display: flex;
    align-items: center; /* Zentriert den Switcher vertikal */
    cursor: default;
}

.theme-toggle {
    position: relative;
}

.theme-toggle-checkbox {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.theme-toggle-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background-color: transparent;
    position: relative;
    z-index: 5;
    cursor: default;
}

.theme-toggle {
    width: calc(1.75rem * 2); /* 56px */
    height: 1.75rem; /* 28px */
    display: flex;
    justify-content: space-around;
    align-items: center;
    border: 1px solid var(--sub-black);
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s ease-in-out;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: calc(1.75rem - 1px);
    background-color: var(--sub-black);
    transition: transform 0.3s ease-in-out, background-color 0.2s ease-in-out;
    z-index: 1;
}

.theme-icon {
    width: 1.25rem; /* 20px */
    height: 1.25rem; /* 20px */
    transition: color 0.3s ease-in-out;
    position: relative;
    z-index: 2;
}

.sun-icon { color: var(--white); }
.moon-icon { color: var(--sub-black); }

.theme-toggle-checkbox:focus-visible + .theme-toggle-label .theme-toggle {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.theme-toggle-checkbox:checked + .theme-toggle-label .theme-toggle::before {
    transform: translateX(100%);
}

.theme-toggle-checkbox:checked + .theme-toggle-label .theme-toggle .sun-icon { color: var(--sub-black); }
.theme-toggle-checkbox:checked + .theme-toggle-label .theme-toggle .moon-icon { color: var(--white); }

/* Active-State: Feedback beim Klicken/Tippen (auch auf Touch) */
.theme-toggle-label:active .theme-toggle {
    border-color: var(--brand);
}
.theme-toggle-label:active .theme-toggle::before {
    background-color: var(--brand);
}
.theme-toggle-label:active .theme-toggle .moon-icon {
    color: var(--brand);
}
.theme-toggle-checkbox:checked + .theme-toggle-label:active .theme-toggle .sun-icon {
    color: var(--brand);
}

/* Hover-Effekte nur für Geräte mit Mauszeiger */
@media (hover: hover) {
    .theme-toggle-label:hover .theme-toggle {
        border-color: var(--brand);
    }

    .theme-toggle-label:hover .theme-toggle::before {
        background-color: var(--brand);
    }

    /* Hover-State: Färbt das inaktive Icon in Brand-Farbe */
    .theme-toggle-label:hover .theme-toggle .moon-icon {
        color: var(--brand);
    }
    .theme-toggle-checkbox:checked + .theme-toggle-label:hover .theme-toggle .sun-icon {
        color: var(--brand);
    }
}

/* --- Container für die Toggles im Footer --- */
.footer-toggles-container {
    grid-column: 1 / -1; /* Spannt über alle Grid-Spalten */
    margin-top: 0; /* Entfernt den Abstand nach oben */
    display: flex;
    align-items: center;
    gap: 1rem; /* 16px Abstand zwischen den beiden Toggles */
}