/* ============================================
   FANART GALLERY STYLES
   ============================================ */

/* Page-scoped gallery tokens */
:root {
    --fanart-card-border: rgba(221, 226, 196, 0.14);
    --fanart-card-border-strong: rgba(221, 226, 196, 0.28);
    --fanart-card-shadow: 0 1px 0 rgba(221, 226, 196, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.6), 0 10px 24px rgba(0, 0, 0, 0.42);
    --fanart-card-shadow-strong: 0 1px 0 rgba(221, 226, 196, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.7), 0 14px 28px rgba(0, 0, 0, 0.55);
    --gallery-ink: #d7d7dc;
    --gallery-muted: rgba(215, 215, 220, 0.68);
    --gallery-line: rgba(255, 255, 255, 0.12);
    --gallery-surface: rgba(12, 12, 12, 0.94);
    --gallery-surface-soft: rgba(255, 255, 255, 0.03);
    --gallery-shadow: 0 14px 28px rgba(0, 0, 0, 0.32);
    --gallery-width: min(980px, calc(100vw - 48px));
    --gallery-gap: 0.85rem;
}

/* ============================================
   GALERIE (minimal, dark thumbs)
   ============================================ */
body.gallery-page .item-container,
body.fanart-gallery-page .main-wrapper {
    position: relative;
    z-index: 20;
    width: var(--gallery-width);
    margin: 0 auto calc(var(--footer-reserved-height) + 2rem);
    padding-top: calc(var(--bar-height) + 0.85rem);
    padding-bottom: calc(var(--footer-reserved-height) + 1rem);
    color: var(--gallery-ink);
}

body.gallery-page .item-container {
    width: var(--gallery-width);
}

body.gallery-page .artefakt-gallery {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--gallery-gap);
    width: 100%;
}

@media (max-width: 1050px) {
    body.gallery-page .artefakt-gallery {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 780px) {
    body.gallery-page .artefakt-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    body.gallery-page .artefakt-gallery {
        grid-template-columns: 1fr;
    }
}

body.gallery-page .artefakt-card {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.95rem;
    background: var(--gallery-surface);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 3px;
    box-shadow: none;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

body.gallery-page .artefakt-card:hover,
body.gallery-page .artefakt-card:focus-within {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: var(--gallery-shadow);
}

body.gallery-page .artefakt-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--gallery-line);
    background: var(--gallery-surface-soft);
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03);
}

body.gallery-page .artefakt-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.58) saturate(0.88);
    transition: filter 0.2s linear, transform 0.2s linear;
}

body.gallery-page .artefakt-thumb:hover img,
body.gallery-page .artefakt-thumb:focus-visible img {
    filter: brightness(0.8) saturate(0.95);
    transform: scale(1.01);
}

body.gallery-page .artefakt-title {
    margin: 0;
    text-align: center;
    color: var(--gallery-ink);
    font-family: var(--font-family);
    font-size: 1rem;
    line-height: 1.2;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 1;
}

/* Dark Page Overlay mit Backdrop Filter */
body.fanart-gallery-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(var(--color-dark-rgb), 0.7);
    backdrop-filter: var(--backdrop-blur-strong);
    z-index: 1;
    pointer-events: none;
}

/* Kategorie-Header im Blog-Stil */
.main-wrapper > .wg-category-header {
    box-sizing: border-box;
    width: 100%;
    padding: 1rem 2rem;
    text-align: center;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.main-wrapper > .wg-category-header::before,
.main-wrapper > .wg-category-header::after {
    display: none;
}

.main-wrapper > .wg-category-header h1,
.main-wrapper > .wg-category-header p {
    width: 100%;
    text-align: center !important;
    margin-left: auto;
    margin-right: auto;
}

.main-wrapper > .wg-category-header h1 {
    margin-top: 0;
    margin-bottom: 0.8rem;
    font-family: var(--font-family);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-color-active);
    text-shadow: -6px 0 12px #230404;
}

.main-wrapper > .wg-category-header p {
    max-width: 62ch;
    margin-top: 0;
    font-family: var(--font-family-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--gallery-muted);
}



/* Fanart Section */
.fanart-section {
    margin-bottom: 4rem;
}

.fanart-category-title {
    font-family: var(--font-family);
    font-size: clamp(1.3rem, 1.7vw, 1.65rem);
    color: var(--gallery-ink);
    text-align: center;
    margin: 2rem 0 1.5rem;
    text-shadow: none;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Fanart Grid */
.fanart-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gallery-gap);
    padding: 0;
    margin-bottom: 2rem;
}

/* Featured Grid - 3 größere Bilder */
.fanart-grid[data-category="featured"] {
    grid-template-columns: repeat(3, 1fr);
    justify-content: center;
    max-width: 900px;
    margin: 0 auto 2rem;
}

/* Featured Items - Card Style */
.fanart-grid[data-category="featured"] .fanart-item {
    background: var(--gallery-surface);
    backdrop-filter: none;
    border-radius: 3px;
    padding: 0;
    box-shadow: none;
    border: 1px solid rgba(255, 255, 255, 0.09);
}

.fanart-grid[data-category="featured"] .fanart-item:hover {
    box-shadow: var(--gallery-shadow);
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
}

.fanart-grid[data-category="featured"] .fanart-item img {
    border-radius: 0;
}

/* Flexible Zentrierung bei weniger Bildern */
.fanart-grid[data-category="featured"]:has(.fanart-item:nth-child(1):last-child) {
    grid-template-columns: repeat(3, 1fr);
    max-width: 900px;
}

.fanart-grid[data-category="featured"]:has(.fanart-item:nth-child(2):last-child) {
    grid-template-columns: repeat(3, 1fr);
    max-width: 900px;
}

.fanart-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    background: var(--gallery-surface);
    border: 1px solid rgba(255, 255, 255, 0.09);
    backdrop-filter: none;
    box-shadow: none;
}

.fanart-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--gallery-shadow);
    border-color: rgba(255, 255, 255, 0.18);
}

.fanart-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity var(--transition-fast);
    filter: brightness(0.7) saturate(0.9);
}

/* Fanart Overlay */
.fanart-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.88));
    padding: 1rem;
    transform: translateY(100%);
    transition: transform var(--transition-fast);
    backdrop-filter: var(--backdrop-blur);
}

.fanart-item:hover .fanart-overlay {
    transform: translateY(0);
}

.fanart-info h3 {
    font-family: var(--font-family);
    font-size: 1rem;
    color: var(--gallery-ink);
    margin: 0 0 0.25rem 0;
    text-shadow: none;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.fanart-info p {
    font-size: 0.8rem;
    color: var(--gallery-muted);
    opacity: 1;
    margin: 0;
}

/* ============================================
   LIGHTBOX MODAL
   ============================================ */

.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 6rem 2rem 6rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.lightbox-modal.active {
    display: flex;
}

.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(var(--color-dark-rgb), 0.95);
    backdrop-filter: var(--backdrop-blur-strong);
    z-index: 1;
    pointer-events: none;
}

.lightbox-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    background: var(--gallery-surface);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 3px;
    padding: 1.5rem;
    backdrop-filter: var(--backdrop-blur-strong);
    box-shadow: var(--gallery-shadow);
}

.lightbox-image {
    max-width: 60vw;
    max-height: 70vh;
    object-fit: contain;
    border-radius: var(--border-radius-sm);
    scroll-behavior: smooth;
}

.lightbox-info {
    min-width: 250px;
    max-width: 350px;
    color: var(--wg-text);
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.lightbox-info::-webkit-scrollbar {
    width: 4px;
}

.lightbox-info::-webkit-scrollbar-track {
    background: rgba(var(--color-dark-rgb), 0.3);
    border-radius: 2px;
}

.lightbox-info::-webkit-scrollbar-thumb {
    background: var(--wg-glow);
    border-radius: 2px;
}

.lightbox-title {
    font-family: var(--font-family);
    font-size: clamp(1.9rem, 2.4vw, 2.4rem);
    color: var(--text-color-active);
    margin: 0 0 0.9rem 0;
    text-shadow: -6px 0 12px #230404;
    letter-spacing: 0.1em;
    line-height: 1.1;
    text-transform: uppercase;
}

.lightbox-artist,
.lightbox-description,
.lightbox-artist-bio,
.lightbox-artist-twitter,
.lightbox-artist-twitter a,
.comment-toggle,
.comment-content p {
    font-family: var(--font-family-body);
    color: var(--text-color-dim);
}

.lightbox-artist {
    font-size: 1rem;
    margin: 0 0 1rem 0;
    font-weight: 500;
}

.lightbox-description {
    font-size: 0.95rem;
    line-height: 1.5;
    font-family: var(--font-family-body);
    color: var(--text-color-dim);
    margin: 0 0 1.5rem 0;
    opacity: var(--opacity-high);
    white-space: pre-line;
}

.lightbox-artist-bio {
    font-size: 0.9rem;
    font-style: italic;
    margin: 0.5rem 0;
    opacity: var(--opacity-medium);
    line-height: 1.4;
}

.lightbox-artist-twitter {
    font-size: 0.85rem;
    margin: 0.5rem 0 1rem 0;
}

.lightbox-artist-twitter a {
    color: var(--wg-glow);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.lightbox-artist-twitter a:hover {
    color: var(--wg-text);
    text-decoration: underline;
}

/* Kommentar Sections */
.lightbox-comments {
    margin-top: 1rem;
}

.comment-section {
    margin-bottom: 1rem;
    border: 1px solid var(--gallery-line);
    border-radius: 8px;
    background: var(--gallery-surface-soft);
}

.comment-toggle {
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-color-dim);
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.comment-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.comment-toggle .comment-icon {
    margin-right: 0.5rem;
}

.toggle-arrow {
    transition: transform var(--transition-fast);
    font-size: 0.7rem;
}

.comment-toggle.active .toggle-arrow {
    transform: rotate(180deg);
}

.comment-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-medium), padding var(--transition-medium);
    padding: 0 0.75rem;
}

.comment-content.active {
    max-height: 200px;
    padding: 0.75rem;
    border-top: 1px solid rgba(var(--color-glow-rgb), 0.1);
}

.comment-content p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.5;
    opacity: var(--opacity-high);
}

/* Lightbox Controls */
.lightbox-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 3.5rem;
    height: 3.5rem;
    border: none;
    background: var(--gallery-surface);
    color: var(--gallery-ink);
    font-size: 2.2rem;
    font-weight: bold;
    border: 1px solid var(--gallery-line);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    backdrop-filter: var(--backdrop-blur);
    box-shadow: var(--gallery-shadow);
    z-index: 10005 !important;
    pointer-events: auto !important;
}

.lightbox-close:hover {
    background: #b83b40;
    color: #fff;
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    height: 3rem;
    border: none;
    background: var(--gallery-surface);
    color: var(--gallery-ink);
    font-size: 2rem;
    font-weight: bold;
    border: 1px solid var(--gallery-line);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    backdrop-filter: var(--backdrop-blur);
    box-shadow: var(--gallery-shadow);
    z-index: 10003;
}

.lightbox-prev {
    left: -4rem;
}

.lightbox-next {
    right: -4rem;
}

.lightbox-nav:hover {
    background: #b83b40;
    color: #fff;
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
    .fanart-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }

    .fanart-grid[data-category="featured"] {
        grid-template-columns: repeat(3, 1fr);
        max-width: 720px;
    }

    .fanart-grid[data-category="featured"]:has(.fanart-item:nth-child(1):last-child) {
        grid-template-columns: 1fr;
        max-width: 240px;
    }

    .fanart-grid[data-category="featured"]:has(.fanart-item:nth-child(2):last-child) {
        grid-template-columns: repeat(2, 1fr);
        max-width: 480px;
    }

    .lightbox-content {
        flex-direction: column;
        max-width: 95vw;
        max-height: 95vh;
        gap: 1rem;
    }

    .lightbox-image {
        max-width: 85vw;
        max-height: 50vh;
    }

    .lightbox-info {
        min-width: auto;
        max-width: none;
        text-align: center;
    }

    .lightbox-nav {
        top: 30%;
    }

    .lightbox-prev {
        left: -2rem;
    }

    .lightbox-next {
        right: -2rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .fanart-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
        padding: 0 0.5rem;
    }

    .fanart-grid[data-category="featured"] {
        grid-template-columns: repeat(2, 1fr);
        max-width: 100%;
    }

    .fanart-grid[data-category="featured"]:has(.fanart-item:nth-child(1):last-child) {
        grid-template-columns: 1fr;
        max-width: 250px;
    }

    .fanart-category-title {
        font-size: 1.5rem;
        margin: 1.5rem 0 1rem;
    }

    .lightbox-modal {
        padding: 0;
        align-items: flex-start;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .lightbox-container {
        max-width: 100%;
        max-height: none;
        width: 100%;
        padding: 8rem 1rem 10rem;
        display: block;
    }

    .lightbox-content {
        padding: 1rem;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 1rem;
        width: 100%;
        max-width: 100%;
    }

    .lightbox-image {
        max-width: 100%;
        width: 100%;
        max-height: 50vh;
        object-fit: contain;
    }

    .lightbox-info {
        max-height: none;
        overflow-y: visible;
        width: 100%;
        max-width: 100%;
    }

    .lightbox-close {
        position: fixed;
        top: 1rem;
        right: 1rem;
        width: 3.5rem;
        height: 3.5rem;
        font-size: 2rem;
        z-index: 10005 !important;
        pointer-events: auto !important;
        cursor: pointer;
        touch-action: manipulation;
    }

    .lightbox-nav {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.5rem;
        position: fixed;
        top: 50%;
        transform: translateY(-50%);
    }

    .lightbox-prev {
        left: 0.5rem;
    }

    .lightbox-next {
        right: 0.5rem;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .fanart-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .lightbox-info {
        padding: 0.5rem 0;
    }

    .lightbox-title {
        font-size: 1.6rem;
    }

    .lightbox-artist {
        font-size: 0.9rem;
    }

    .lightbox-description {
        font-size: 0.85rem;
    }
}