/* ============================================
   Kreative Fische - Main CSS
   Site Package for TYPO3 13.4
   Version 2.1 - Mit Dark Mode, 6-Spalten Grid & Glitch Menu
   ============================================ */

/* === Google Fonts (wird via TypoScript geladen) === */
/* Space Grotesk (Headings) */
/* Inter (Body Text) */

/* === Import Module === */

/* 1. Variables - Must be first */
@import '_variables.css';

/* 2. Reset & Base */
@import '_reset.css';

/* 3. Typography */
@import '_typography.css';

/* 4. Layout System (inkl. 6-Spalten Grid) */
@import '_layout.css';

/* 5. Images */
@import '_images.css';

/* 6. Components */
@import '_buttons.css';
@import '_forms.css';
@import '_tables.css';
@import '_components.css';

/* 7. Theme Switch */
@import '_theme-switch.css';

/* 8. Utilities - Last for highest specificity */
@import '_utilities.css';

/* ============================================
   BASE STYLES
   ============================================ */

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    font-family: var(--font-body);
    font-size: var(--font-size-body);
    line-height: var(--line-height-normal);
    color: var(--color-text);
    background-color: var(--color-background);
    min-height: 100vh;
    transition: 
        background-color var(--transition-slow),
        color var(--transition-slow);
}

/* Focus Visible (Accessibility) */
:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
}

/* Skip to Content Link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-primary);
    color: var(--color-white);
    padding: var(--space-sm) var(--space-md);
    text-decoration: none;
    border-radius: 0 0 var(--border-radius-md) 0;
    z-index: 9999;
    transition: top var(--transition-fast);
}

.skip-to-content:focus {
    top: 0;
}

/* Main Content Area */
main {
    min-height: 60vh;
}

/* ============================================
   SITE HEADER
   ============================================ */

.site-header {
    background: var(--color-surface, var(--color-white));
    border-bottom: 1px solid var(--color-border, var(--color-light));
    position: sticky;
    top: 0;
    z-index: 100;
    transition: 
        background-color var(--transition-base),
        border-color var(--transition-base),
        box-shadow var(--transition-base);
}

.site-header.scrolled {
    box-shadow: var(--shadow-md);
}

.header-container {
    max-width: var(--container-max-width, 1200px);
    margin: 0 auto;
    padding: var(--space-md) var(--container-padding, var(--space-lg));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo {
    font-family: var(--font-heading);
    font-size: var(--font-size-h4);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    transition: color var(--transition-base);
}

.site-logo:hover {
    color: var(--color-primary);
}

/* ============================================
   NAVIGATION BASICS
   ============================================ */

.main-nav .nav-list {
    display: flex;
    gap: var(--space-lg);
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item a {
    color: var(--color-text);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--border-radius-sm);
    transition: 
        color var(--transition-base),
        background-color var(--transition-base);
}

.nav-item a:hover,
.nav-item a.active {
    color: var(--color-primary);
}

/* ============================================
   DESKTOP NAVIGATION - HORIZONTAL mit //
   ============================================ */

.desktop-nav {
    display: none;
}

@media (min-width: 1024px) {
    .desktop-nav {
        display: flex;
        align-items: center;
    }
    
    .desktop-nav .nav-list {
        display: flex !important;
        flex-direction: row !important;
        list-style: none;
        margin: 0;
        padding: 0;
        gap: 0;
        align-items: center;
    }
    
    .desktop-nav .nav-item {
        position: relative;
        display: inline-block;
    }
    
    /* // Separator zwischen Items */
    .desktop-nav .nav-item:not(:last-child)::after {
        content: '//';
        color: var(--color-text-muted);
        margin: 0 1rem;
        font-weight: 300;
        opacity: 0.5;
    }
    
    .desktop-nav .nav-item a {
        font-family: var(--font-heading);
        font-size: 0.9rem;
        font-weight: 500;
        color: var(--color-text);
        text-decoration: none;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        padding: 0.5rem 0;
        transition: color 0.3s ease;
        position: relative;
        display: inline-block;
    }
    
    .desktop-nav .nav-item a:hover,
    .desktop-nav .nav-item a.active {
        color: var(--color-primary);
    }
    
    .desktop-nav .nav-item a::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 0;
        height: 2px;
        background: var(--color-primary);
        transition: width 0.3s ease;
    }
    
    .desktop-nav .nav-item a:hover::after,
    .desktop-nav .nav-item a.active::after {
        width: 100%;
    }
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-highlight) 100%);
    color: var(--color-white);
    padding: var(--space-2xl) var(--space-lg);
    text-align: center;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 600"><path d="M0,300 Q300,100 600,300 T1200,300 L1200,600 L0,600 Z" fill="rgba(255,255,255,0.08)"/></svg>') no-repeat bottom;
    background-size: cover;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
}

.hero h1 {
    color: var(--color-white);
    font-size: 3rem;
    margin-bottom: var(--space-lg);
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
}

.hero .lead {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: var(--space-xl);
}

/* ============================================
   SITE FOOTER
   ============================================ */

.site-footer {
    background: var(--color-dark);
    color: var(--color-light);
    padding: var(--space-xl) 0;
    margin-top: var(--space-2xl);
}

.footer-container {
    max-width: var(--container-max-width, 1200px);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.footer-content {
    margin-bottom: var(--space-lg);
}

/* Footer Überschriften */
.site-footer h1,
.site-footer h2,
.site-footer h3,
.site-footer h4,
.site-footer h5,
.site-footer h6 {
    color: var(--color-light) !important;
}

/* Footer Text */
.site-footer p,
.site-footer .bodytext {
    color: rgba(255, 255, 255, 0.8);
}

/* Footer Links */
.site-footer a {
    color: var(--color-primary-light);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--color-accent);
    text-decoration: underline;
}

.copyright {
    text-align: center;
    padding-top: var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0.7;
    font-size: 0.9rem;
}

/* === Main Content === */
.container {
    max-width: var(--container-max-width, 1200px);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.page-content {
    padding: var(--space-2xl) 0;
}

/* ============================================
   MOBILE MENU BUTTON - MORPHING!
   ============================================ */

.mobile-menu-btn {
    display: flex;
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 140px;
    height: 52px;
    border-radius: 26px;
    background: var(--color-highlight);
    color: white;
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 30px rgba(237, 125, 76, 0.6);
    transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-btn:not(.is-morphing):hover {
    background: var(--color-highlight-light);
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 10px 40px rgba(237, 125, 76, 0.7);
}

/* MORPHING STATE - Vertikal! */
.mobile-menu-btn.is-morphing {
    width: 80px;
    height: 200px;
    border-radius: 40px;
    background: var(--color-canal);
    box-shadow: 0 10px 40px rgba(159, 196, 212, 0.5);
}

/* Horizontal Text "MENÜ" */
.btn-text-horizontal {
    position: absolute;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.mobile-menu-btn.is-morphing .btn-text-horizontal {
    opacity: 0;
    pointer-events: none;
}

/* Vertical Text (versteckt) */
.btn-text-vertical {
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0;
    pointer-events: none;
}

.vertical-letter {
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

/* Close X Button */
.close-circle-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0) rotate(-90deg);
    width: 80px;
    height: 80px;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.2s;
}

.mobile-menu-btn.is-morphing .close-circle-btn {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
}

.close-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}

.mobile-menu-btn.is-morphing:hover .close-circle-btn {
    transform: translate(-50%, -50%) scale(1.1) rotate(90deg);
}

@media (min-width: 1024px) {
    .mobile-menu-btn {
        display: none;
    }
}

/* ============================================
   GLITCH BACKGROUND - SCROLL CONTROLLED! 🎧
   ============================================ */

.glitch-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('../Images/glitch-background.jpeg') center/cover;
    background-blend-mode: multiply;
    z-index: 997;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    will-change: transform, filter;
    transform: translate3d(0, 0, 0);
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.mobile-nav-open .glitch-background {
    opacity: 1;
    visibility: visible;
}

body.mobile-nav-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ============================================
   MOBILE NAVIGATION
   ============================================ */

.mobile-nav {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 100vh;
    background: transparent;
    z-index: 999;
    transition: bottom 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
    visibility: hidden;
}

.mobile-nav.is-open {
    bottom: 0;
    visibility: visible;
}

.mobile-nav-content {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    padding: 2rem 0 280px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    scroll-behavior: smooth;
}

.mobile-nav-content::-webkit-scrollbar {
    width: 6px;
}

.mobile-nav-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.mobile-nav-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
}

.mobile-nav-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.7);
}

.mobile-nav-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.5) rgba(0, 0, 0, 0.1);
}

.mobile-nav-content .nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

/* Slide-In Animation */
.mobile-nav-content .nav-item {
    opacity: 0;
    transform: translateY(30px);
    animation: slideInUp 0.5s ease forwards;
}

.mobile-nav-content .nav-item:nth-child(1) { animation-delay: 0.1s; }
.mobile-nav-content .nav-item:nth-child(2) { animation-delay: 0.15s; }
.mobile-nav-content .nav-item:nth-child(3) { animation-delay: 0.2s; }
.mobile-nav-content .nav-item:nth-child(4) { animation-delay: 0.25s; }
.mobile-nav-content .nav-item:nth-child(5) { animation-delay: 0.3s; }
.mobile-nav-content .nav-item:nth-child(6) { animation-delay: 0.35s; }
.mobile-nav-content .nav-item:nth-child(7) { animation-delay: 0.4s; }
.mobile-nav-content .nav-item:nth-child(8) { animation-delay: 0.45s; }

@keyframes slideInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   MOBILE NAV ITEMS - 80px Breite wie Menü!
   ============================================ */

.mobile-nav-content .nav-item a {
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* GLEICHE Breite wie Menü-Button! */
    width: 80px;
    min-height: auto;
    padding: 2.5rem 1rem;
    
    border-radius: 40px;
    
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    color: white;
    
    writing-mode: vertical-rl;
    text-orientation: mixed;
    
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Farben für jeden Menüpunkt */
.mobile-nav-content .nav-item:nth-child(1) a { background: #7F9082; }
.mobile-nav-content .nav-item:nth-child(2) a { background: #B88A6C; }
.mobile-nav-content .nav-item:nth-child(3) a { background: #9FC4D4; }
.mobile-nav-content .nav-item:nth-child(4) a { background: #7B6BA8; }
.mobile-nav-content .nav-item:nth-child(5) a { background: #D64369; }
.mobile-nav-content .nav-item:nth-child(6) a { background: #ED7D4C; }
.mobile-nav-content .nav-item:nth-child(7) a { background: #C5B5BD; }
.mobile-nav-content .nav-item:nth-child(8) a { background: #F5B8C6; }

.mobile-nav-content .nav-item a:hover,
.mobile-nav-content .nav-item a:active {
    transform: scale(1.05);
    box-shadow: 
        0 12px 50px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.mobile-nav-content .nav-item a.active {
    transform: scale(1.08);
    box-shadow: 
        0 15px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    filter: brightness(1.15);
}

/* ============================================
   MOBILE OVERLAY
   ============================================ */

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    visibility: hidden;
}

.mobile-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

@media (min-width: 1024px) {
    .mobile-nav,
    .mobile-overlay {
        display: none !important;
    }
}

/* ============================================
   2-SPALTEN LAYOUT
   ============================================ */

.two-column-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: var(--space-2xl);
    padding: var(--space-2xl) 0;
}

.main-column {
    min-width: 0;
}

.sidebar-column {
    position: sticky;
    top: calc(var(--space-2xl) + 80px);
    height: fit-content;
}

@media (max-width: 1024px) {
    .two-column-layout {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }
    
    .sidebar-column {
        position: relative;
        top: 0;
    }
}

/* ============================================
   TYPO3 CONTENT ELEMENTS
   ============================================ */

.frame-spacing-small { padding: var(--space-md) 0; }
.frame-spacing-medium { padding: var(--space-lg) 0; }
.frame-spacing-large { padding: var(--space-2xl) 0; }

.ce-textpic,
.ce-image,
.ce-text {
    margin-bottom: var(--space-xl);
}

.ce-textpic .ce-gallery {
    margin-bottom: var(--space-md);
}

.ce-gallery {
    display: grid;
    gap: var(--space-md);
}

.ce-gallery[data-ce-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.ce-gallery[data-ce-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.ce-gallery[data-ce-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
    .ce-gallery[data-ce-columns="2"],
    .ce-gallery[data-ce-columns="3"],
    .ce-gallery[data-ce-columns="4"] {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   DARK MODE ADJUSTMENTS
   ============================================ */

[data-theme="dark"] .hero {
    background: linear-gradient(135deg, 
        color-mix(in srgb, var(--color-primary) 80%, black) 0%, 
        color-mix(in srgb, var(--color-highlight) 80%, black) 100%
    );
}

[data-theme="dark"] .site-header {
    background: var(--color-surface);
}

[data-theme="dark"] .card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .site-header,
    .site-footer,
    .main-nav,
    .mobile-menu-btn,
    .mobile-nav,
    .mobile-overlay,
    .glitch-background,
    .theme-switch,
    .btn {
        display: none !important;
    }
    
    main {
        padding-top: 0;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}

/* ============================================
   PERFORMANCE
   ============================================ */

.hover-lift,
.hover-scale,
.card {
    will-change: transform;
}

img {
    image-rendering: -webkit-optimize-contrast;
}

/* ============================================
   RESPONSIVE FIXES
   ============================================ */

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .header-container {
        flex-direction: column;
        gap: var(--space-md);
    }
}
