/*
Theme Name: Astra Child für Emanuel Vogt Archive
Template: astra
*/

:root {
    --bg-color: #0d0f12;
    --card-bg: rgba(255, 255, 255, 0.03);
    --accent-color: #d4af37;
    /* Brass/Gold */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.08);
    --serif-font: 'Playfair Display', serif;
    --sans-font: 'Outfit', sans-serif;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Override Astra's default backgrounds */
body,
body.home,
body.home .site-content,
body.home .site,
body.home #page {
    background-color: var(--bg-color) !important;
    color: var(--text-primary) !important;
}

/* Global link color override */
a,
a:link,
a:visited {
    color: var(--accent-color) !important;
}

a:hover,
a:focus {
    color: #f0cc60 !important;
}

/* ASTRA HEADER OVERRIDES */
/* 1. Force the blue top menu to match our dark theme */
/* position:relative + high z-index keep the header above any animated content
   that would otherwise create a stacking context on top of the hamburger */
header#masthead,
.ast-primary-header-bar,
.site-header {
    background-color: var(--bg-color) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    position: relative !important;
    z-index: 9999 !important;
}

/* 2. Hide the original Astra Logo and Social Icons */
.site-logo-img,
.ast-builder-social-element {
    display: none !important;
}

/* 3. Hide Astra's Default Logo & Site Title, as we inject our own raw HTML */
.site-logo-img,
.site-title,
.ast-site-title-wrap {
    display: none !important;
}

/* 4. Make menu links permanent gold — desktop AND mobile */
.ast-builder-menu .menu-item > a,
.ast-mobile-popup-inner .menu-item > a,
.ast-fly-menu-wrap .menu-item > a,
.main-navigation .menu-item > a {
    color: var(--accent-color) !important;
    font-weight: 600 !important;
}

.ast-builder-menu .menu-item > a:hover,
.ast-mobile-popup-inner .menu-item > a:hover,
.ast-fly-menu-wrap .menu-item > a:hover,
.main-navigation .menu-item > a:hover {
    color: #ffffff !important;
}

/* 4b. Astra Mobile Popup / Off-canvas drawer — dark theme */
.ast-mobile-popup-drawer,
.ast-mobile-popup-inner,
.ast-fly-menu-wrap,
.ast-popup-full-overlay,
.ast-mobile-header .ast-primary-header-bar {
    background-color: var(--bg-color) !important;
    color: var(--text-primary) !important;
}

/* Hamburger icon lines — keep them visible */
.ast-mobile-menu-trigger .ast-mobile-menu-trigger-bars span,
.main-header-menu-toggle .ast-mobile-menu-trigger-bars span,
.ast-button-wrap .ast-mobile-menu-trigger-bars span {
    background-color: var(--text-primary) !important;
}

/* Close button inside mobile drawer */
.ast-mobile-popup-close,
.ast-mobile-popup-close span {
    color: var(--text-primary) !important;
    fill: var(--text-primary) !important;
}

/* Separator lines between mobile menu items */
.ast-mobile-popup-inner .menu-item,
.ast-fly-menu-wrap .menu-item {
    border-bottom: 1px solid var(--glass-border) !important;
}

/* Active/current page highlight */
.ast-mobile-popup-inner .current-menu-item > a,
.ast-fly-menu-wrap .current-menu-item > a {
    color: #ffffff !important;
}

/* 5. Astra Scroll To Top Button */
#ast-scroll-top,
.ast-scroll-top,
#ast-scroll-top:hover,
.ast-scroll-top:hover,
[data-section="section-scroll-to-top"] {
    background-color: var(--accent-color) !important;
    border: none !important;
    color: #000000 !important;
}

#ast-scroll-top .ast-icon,
.ast-scroll-top .ast-icon {
    color: #000000 !important;
    fill: #000000 !important;
}

#ast-scroll-top .ast-icon svg,
.ast-scroll-top .ast-icon svg {
    color: #000000 !important;
    fill: #000000 !important;
}

/* 6. Einzelseiten (Impressum, etc.) Titel in Gold */
.entry-title,
h1.entry-title {
    color: var(--accent-color) !important;
    font-family: var(--serif-font) !important;
    font-weight: 700 !important;
}

/* 7. Footer GANZ ausblenden */
.site-footer,
.ast-site-footer,
.ast-builder-footer-grid-columns,
footer {
    display: none !important;
}

/* 8. Content Headings in White */
.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
    color: var(--text-primary) !important;
}

/* Base resets are usually handled by Astra, but let's constrain the app container */
.app-container {
    padding: 2rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--sans-font);
    min-height: 100vh;
}

/* Header */
.main-header {
    margin-bottom: 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    /* No opacity animation here — animating opacity creates a CSS stacking
       context that covers the Astra header and makes the hamburger untappable
       on first load. Card-level animations in JS are unaffected. */
}

.brand h1 {
    font-family: var(--serif-font);
    font-size: 3.5rem;
    color: var(--accent-color);
    letter-spacing: -1px;
}

.brand .subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: -0.5rem;
}

/* Controls */
.search-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    width: 100%;
}

.search-box {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    width: 100%;
}

#searchInput {
    width: 100%;
    padding: 1.2rem 1.5rem 1.2rem 3.5rem;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.1);
}

.search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
}

/* Dropdowns (Selects) - Safe native styling for Chrome Mac */
.genre-select {
    padding: 1rem 3rem 1rem 1rem !important;
    /* Extra padding on right for the custom arrow */
    background-color: var(--card-bg) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 8px !important;
    color: #ffffff !important;
    font-size: 1rem !important;
    min-width: 200px !important;
    outline: none !important;
    width: 100% !important;

    /* Enforce our dark background by stripping Chrome's native gradient button */
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;

    /* Tell the browser's native popup renderer that this is a dark UI element */
    color-scheme: dark !important;

    /* White downward arrow SVG */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 1rem center !important;
    background-size: 0.8em auto !important;
}

.genre-select:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2) !important;
}

/* 
 * CRITICAL FIX FOR GOOGLE CHROME ON MAC:
 * We DELETE all CSS targeting `.genre-select option` !
 * By leaving the `<option>` totally unstyled, Chrome will use its native 
 * Dark Mode renderer for the popup list (because of color-scheme: dark above),
 * guaranteeing a perfect native dark gray list with bright white text!
 */

.stats {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Rotation Controls */
.rotation-btn {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.rotation-btn:hover {
    background: rgba(74, 144, 226, 0.2);
    border-color: #4a90e2;
}

.rotation-btn.active {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

.save-rotation-btn:hover {
    background: #357abd;
}


/* Loading state */
.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    font-size: 1rem;
}

.loading-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile PDF open bar */
.pdf-open-bar {
    display: none; /* shown only on mobile via media query below */
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.5);
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.pdf-open-btn-mobile {
    display: block;
    text-align: center;
    padding: 10px 16px;
    background: var(--accent-color);
    color: #000 !important;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none !important;
    letter-spacing: 0.3px;
}

/* Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.empty-state,
.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

.empty-state p,
.loading-state {
    color: var(--text-secondary);
    font-size: 1rem;
}

.load-all-btn {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: 0.9rem 1.4rem;
    border: 1px solid var(--accent-color);
    border-radius: 999px;
    background: transparent;
    color: var(--accent-color);
    font-family: var(--sans-font);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.load-all-btn:hover,
.load-all-btn:focus {
    background: var(--accent-color);
    color: var(--bg-color);
}

.load-all-btn:active {
    transform: scale(0.98);
}

.work-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 180px;
    /* Eliminate 300ms tap delay on mobile */
    touch-action: manipulation;
}

.work-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: var(--shadow);
}

.work-card:active {
    transform: scale(0.98);
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.06);
}

.work-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-number {
    font-weight: 600;
    color: var(--accent-color);
    font-size: 0.9rem;
    background: rgba(212, 175, 55, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
}

.card-genre {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.card-title {
    font-family: var(--serif-font);
    font-size: 1.4rem;
    line-height: 1.3;
    margin-top: 1rem;
    color: #ffffff !important;
    /* Force white to override Astra's default heading colors */
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    backdrop-filter: blur(5px);
}

.modal-content {
    width: 95%;
    height: 95%;
    margin: 1.5rem auto;
    background: #1a1e26;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-info .work-num {
    color: var(--accent-color);
    font-weight: 600;
}

.modal-info h2 {
    font-family: var(--serif-font);
    font-size: 1.8rem;
    margin: 0;
    color: white;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
}

.viewer-body {
    flex-grow: 1;
    display: flex;
    overflow: hidden;
}

.file-sidebar {
    width: 300px;
    padding: 1.5rem;
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    background: rgba(0, 0, 0, 0.2);
    overflow-y: auto;
}

.file-item {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
}

.file-item p {
    margin: 0;
}

.file-item small {
    color: #aaa;
}

.file-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.file-item.active {
    border-color: var(--accent-color);
    background: rgba(212, 175, 55, 0.1);
}

.pdf-frame {
    flex-grow: 1;
    position: relative;
    background: #252a33;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pdf-viewer-area {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

.pdf-rotation-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

#pdfFrame {
    border: none;
    width: 100%;
    height: 100%;
}

.placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-secondary);
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

@keyframes gridFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

@media (max-width: 768px) {

    /* --- Astra Header --- */
    .evogt-custom-brand-wrap {
        gap: 0.5rem !important;
        margin-right: 0.5rem !important;
    }

    #evogt-site-title {
        font-size: 1.4rem !important;
    }

    #evogt-site-subtitle {
        font-size: 0.75rem !important;
    }

    .evogt-custom-brand-wrap img {
        height: 54px !important;
    }

    /* --- App Container --- */
    .app-container {
        padding: 1rem;
    }

    .main-header {
        margin-bottom: 1.5rem;
    }

    /* --- Search Controls --- */
    .search-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        min-width: 0;
        width: 100%;
    }

    .genre-select {
        min-width: 0 !important;
        width: 100% !important;
    }

    /* --- Work Card Grid --- */
    .content-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .work-card {
        height: auto;
        min-height: 110px;
    }

    /* Disable hover lift effect (no hover on touch) */
    .work-card:hover {
        transform: none;
    }

    /* --- Modal: full-screen on mobile --- */
    .modal-content {
        width: 100%;
        height: 100%;
        margin: 0;
        border-radius: 0;
    }

    .modal-header {
        padding: 0.75rem 1rem;
    }

    .modal-info h2 {
        font-size: 1.2rem;
    }

    .close-btn {
        font-size: 2rem;
        padding: 0.25rem 0.5rem;
    }

    /* --- Viewer: stack sidebar above PDF --- */
    .viewer-body {
        flex-direction: column;
    }

    .file-sidebar {
        width: 100%;
        max-height: 130px;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
        padding: 0.75rem;
        gap: 0.5rem;
        /* Smooth momentum scroll on iOS */
        -webkit-overflow-scrolling: touch;
    }

    .file-item {
        flex-shrink: 0;
        min-width: 130px;
        max-width: 200px;
    }

    .file-item p {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* --- Rotation Controls on mobile --- */
    #rotationControls {
        flex-wrap: wrap !important;
        padding: 8px !important;
        gap: 6px !important;
    }

    /* --- PDF open button --- */
    .pdf-open-bar {
        display: block;
    }

    /* Ensure Astra mobile popup/hamburger is always tappable */
    .ast-mobile-menu-trigger,
    .ast-mobile-popup-trigger,
    [data-section="section-hb-mobile-trigger"] {
        touch-action: manipulation !important;
        position: relative !important;
        z-index: 10000 !important;
    }
}

@media (max-width: 480px) {

    #evogt-site-title {
        font-size: 1.1rem !important;
    }

    /* Keep subtitle visible but small — do NOT hide it */
    #evogt-site-subtitle {
        font-size: 0.65rem !important;
        margin-top: 2px !important;
    }

    .evogt-custom-brand-wrap img {
        height: 44px !important;
    }

    .app-container {
        padding: 0.75rem;
    }

    #searchInput {
        font-size: 1rem;
        padding: 1rem 1rem 1rem 3rem;
    }

    .modal-header {
        padding: 0.5rem 0.75rem;
    }

    .modal-info h2 {
        font-size: 1rem;
    }

    .file-sidebar {
        max-height: 110px;
    }
}