:root{
    --mask-bg: url('../img/dawnwalker.jpg');
}

/* =========================================
   LAYOUT: KATEGORIEN & RASTER
   ========================================= */
main {
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.game-category {
    margin-bottom: 70px;
}

.game-category h2 {
    margin-bottom: 30px;
}

.grid-container {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap; /* Bricht in die nächste Zeile um, wenn der Platz nicht reicht */
    position: relative;
    z-index: 1;
}

/* =========================================
   DIE QUADRATISCHEN BUTTONS
   ========================================= */
.game-square {
    position: relative;
    padding: 5px;
    width: 250px;
    aspect-ratio: 1 / 1;
    border: 2px solid var(--color-title);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    background-color: var(--color-bg);
    transition: border-color 0.3s ease 0.05s;
}

/* Sorgt dafür, dass der gehoverte Button immer über den anderen liegt */
.game-square:hover {
    z-index: 10;
    border-color: transparent; /* Button-Rahmen blendet aus, die Outline der Blob-Form übernimmt */
}

.square-content {
    text-align: center;
    z-index: 2;
    transition: opacity 0.2s ease;
}

.game-square:hover .square-content {
    opacity: 0; /* Text verschwindet, damit er nicht durch transparente Maskenstellen scheint */
}

/* =========================================
   HOVER-BLOB (wächst aus dem Button)
   ========================================= */
.preview-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    /* Startzustand = exakt die Größe des Buttons (250px minus 2x2px Rahmen) */
    width: 100%;
    height: 100%;

    opacity: 0;
    pointer-events: none;
    z-index: 5;

    transition:
        width 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        height 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        opacity 0.25s ease;

    /* Outline in Blob-Form (folgt der Maske) + weicher Schatten zum Schluss */
    filter:
        drop-shadow(2px 0 0 var(--color-title))
        drop-shadow(-2px 0 0 var(--color-title))
        drop-shadow(0 2px 0 var(--color-title))
        drop-shadow(0 -2px 0 var(--color-title))
        drop-shadow(0 15px 25px rgba(0, 0, 0, 0.45));
}

.preview-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;

    /* Hier kannst du pro Wrapper andere Bilder laden */
    background: var(--mask-bg) center/cover no-repeat;

    -webkit-mask-image: url('../img/cloudmask.svg');
    mask-image: url('../img/cloudmask.svg');
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

/* Hover: auf Zielgröße wachsen */
.game-square:hover .preview-wrapper {
    opacity: 1;
    width: 600px;
    height: 600px;
}

/* =========================================
   DIE HORIZONTALE LINIE
   ========================================= */
/* Die dreifache Linie (1x gerade, 2x gegenläufig geschwungen) */
.grid-container::before {
    content: '';
    position: absolute;
    width: 100vw; 
    height: 50px; 
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--color-accent-green); 
    z-index: -1; 
    
    -webkit-mask-image: 
        linear-gradient(black, black),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='160'%3E%3Cpath d='M0,80 Q62.5,20 125,80 T250,80' fill='none' stroke='black' stroke-width='4'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='450' height='160'%3E%3Cpath d='M0,80 Q112.5,180 225,80 T450,80' fill='none' stroke='black' stroke-width='4'/%3E%3C/svg%3E");
        
    mask-image: 
        linear-gradient(black, black),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='160'%3E%3Cpath d='M0,80 Q62.5,20 125,80 T250,80' fill='none' stroke='black' stroke-width='4'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='450' height='160'%3E%3Cpath d='M0,80 Q112.5,180 225,80 T450,80' fill='none' stroke='black' stroke-width='4'/%3E%3C/svg%3E");

    -webkit-mask-size: 100% 2px, 250px 100%, 450px 100%;
    mask-size: 100% 2px, 250px 100%, 450px 100%;
    
    -webkit-mask-position: center, center, center;
    mask-position: center, center, center;
    
    -webkit-mask-repeat: no-repeat, repeat-x, repeat-x;
    mask-repeat: no-repeat, repeat-x, repeat-x;
}

.game-category:has(.game-square:hover){
    z-index: 50;
    position: relative;
}