@import "_variables.scss";

/**
    The subcards.scss is responsible for all css of the subcards.
    Historically, it was always used for the preview-cards on the info-card
    and the article page of the corresponding subcard.

    Discuss: Personally I would prefer a strict separation from front page
    and article page. But there may be advantages, when the unit 'subcard'
    has a stylesheet on it's own.
    
    - SO

    Structure:

    1. Shared (Preview and Expanded)
    2. Preview Subcards
    3. Expanded Subcards
*/

.info-card {
    /*
        1. Shared Properties
    */
    .subcard {
        display: flex;
        flex-direction: column;
        color: $black;
        position: relative;
        border-radius: 3px;
    }

    .subcard-content{
        position: relative;
    }

    .titlebar {
        min-height: 84px;
        background: linear-gradient(to top, $gray-dark -100%, $gray 200%);
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: inherit;

        h2 {
            color: $white;
            font-size: $regular-font-size;
            text-transform: uppercase;
            letter-spacing: 2px;
            line-height: 1.3em;

            // font-weight: $normal-font-weight;
            text-align: center;
            margin: 0;
            padding: $default-space / 2;
        }
    }

    /*
       2. Preview Properties
    */
    .subcards-container {
        .subcard-wrapper {
            display: flex;
        }

        .subcard {
            flex: 1;
            // Put the subcards before the close button
            // to avoid closing when pushing subcard.
            z-index: 1;

            box-shadow: $near-hover-shadow;

            //Required for round borders.
            overflow: hidden;
        }

        $titlebar-height: 27%;

        .titlebar {
            min-height: $titlebar-height;
        }

        .subcard-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .wrapper {
            display: flex;
            overflow: hidden;
            flex:1;
            // height: 100% - $titlebar-height;

            .preview {
                display: flex;
                background-color: $white;
                align-items: center;
                justify-content: center;
                width: 100%;
                height: 100%;

                p {
                    //font-size: $large-font-size;
                    // line-height: $large-font-size*1.3;
                    font-style: italic;
                    color: $gray;
                    font-weight: 500;
                    text-align: center;
                    padding: 2 * $default-space;
                }

                // Cover the whole preview area!
                img {
                    // The position is set to absolute
                    // then we can use the 1fr unit on the
                    // grid element. 
                    //
                    // Otherwise it stretches with content.
                    position: absolute;
                    left: 0;
                    top: 0;
                    width: 100%;
                    height: 100%;
                    object-fit: cover;
                }
            }
        }

        .icon {
            border-radius: $default-radius 0 0 0;
        }

        .subcard.visited {
            .icon.info:before {
                content: "check";
            }
        }

        figure {
            //Reset some Bulma default styling.
            width: 100%;
            height: 100%;
            padding: 0;
            margin: 0;
            border: none;
        }
    }

    /*
        3. Article Properties
    */
    .mainview > .subcard {

        background-color: rgba($black,0.8);
        justify-content: center;
        .column.content {
            flex: 1;
            display: flex;
            flex-direction: column;
        }

        .column.content.wide {
            flex: 1 0 55%;
            display: flex;
            flex-direction: column;
        }

        .column.content.narrow {
            flex: 1 0 35%;
            display: flex;
            flex-direction: column;
        }

        article {

            background-color: $white;
            max-height: 100%;

            p {
                line-height: 1.4em;
            }

            p:last-child{
                margin-bottom: 0;
            }

            p:not(:last-child) {
                margin-bottom: 0.5em;
            }

            h2 {
                font-size: $large-font-size;
            }

            h2:not(:first-child) {
                margin-top: 0.5em;
            }
            
            .column:not(.zoomable-wrapper) {
                margin: $article-space;
            }

            a {
                
                margin: -0px -5px -20px -5px;
                padding: 0px 5px 10px 5px;
            }
        }

        .subcard-content{
            overflow: hidden;
            background-color: $white;
            box-shadow: 1px 3px 8px rgba(0, 0, 0, 0.5)
        }

        .subcard-content.dynamic-height {
            overflow: visible;
        }

        .subcard-content:not(.dynamic-height){
            height: 100%;
        }

        .zoomable-wrapper {
            padding: 0;
            margin: 0;
            padding-top: $article-space;
            padding-bottom: 2* $article-space;
            align-self: center;
            flex: 0;
        }

        .imggroup {
            padding: 0;
            margin: 0;
            padding-top: $article-space;
            padding-bottom: 2* $article-space;
            display: flex;
            justify-content: space-evenly;
        }
    }

    & > .zoomable-wrapper,
    .mainview > .subcard {
        // figure {
        //     position: relative;
        //     border: 5px solid white;
        //     box-shadow: $near-hover-shadow;
        // }

        figcaption {
            width: 100%;
            position: absolute;
            text-align: center;

            &.zoomcap {
                font-size: $tiny-font-size;
                display: none;
                top: calc(100% + 10px);
                padding: $default-space / 2;
                background-color: $white;
                box-shadow: $near-hover-shadow;
                color: $black;
                z-index: -1;
            }

            &.cap {
                bottom: -40px;
            }
        }
    }

    /*
        Colors for the card topics.
    */
    @import "_colors_003.sass";

    /* Remap the colors to the 'bundled' groups. */
    $g: $a;
    $a: $b;
    $c: $b;
    $e: $b;

    @mixin subcard-style($topic-color) {
        // border: 2px solid $topic-color;
        .titlebar {
           border-bottom: 10px solid $topic-color;
            // box-shadow: 0 2px 5px rgba($topic-color, 0.5);
             z-index: 10;
            // background-color: $topic-color;

            position: relative;
        }

    }

    .subcard.leben_des_kunstwerks {
        @include subcard-style($a);
    }

    .subcard.licht_und_farbe {
        @include subcard-style($b);
    }

    .subcard.extra_info {
        @include subcard-style($c);
    }

    .subcard.artist {
        @include subcard-style($d);
    }

    .subcard.komposition {
        @include subcard-style($e);
    }

    .subcard.details {
        @include subcard-style($f);
    }

    .subcard.thema {
        @include subcard-style($g);
    }

}

.info-card.debug {
    .mainview > .subcard a {
        background-color: rgba(102, 51, 153, 0.239);
    }

    article {
        background-color: rgba(0,255,0,0.5);
    }

    .subcard .view-button{
        background-color: rgba(0, 255, 0, 0.5) !important;
    }
}