/*
 * SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
 *
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

@import (reference) "../include/infopages.less";
@import (reference) "../include/browser.less";
@import (reference) "../include/colortheme-all.less";

&.cp-page-index {
    .infopages_main();

    #cp-main {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        align-items: center;

        .alert-info {
            font-size: 16px;
            background-color: @cp_alerts-info-bg;
            color: @cp_alerts-info-text;
        }

        & > .cp-container {
            flex: 1;
            display: flex;
            flex-flow: column;
            justify-content: space-around;
            justify-content: space-evenly;
            max-width: 1000vh;
        }
    }
    body {
        font-family: "Open Sans", Helvetica;
        color: @cryptpad_text_col;
    }

    h1.cp-instance-title {
        text-align: center;
        font-family: "IBM Plex Mono";
        font-weight: 500;
        color: @cryptpad_color_brand;
        font-size: 2.8rem; // Not used
        word-wrap: break-word;
        word-break: break-word;
    }
    @media screen and (max-width: @browser_media-medium-screen) {
        &.html h1.cp-instance-title {
            font-size: 2.5em;
        }
    }

    .cp-home-hero {
        width: 100%;
        align-self: center;
        align-items: center;
        justify-content: flex-end;
        @media screen and (max-width: 990px) {
            justify-content: center;
        }
        img {
            max-height: ~"max(40vh, 250px)";
        }
    }
    .cp-title {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        margin: 0 auto;
        flex-grow: 1;
        max-width: unset;
        img {
            max-width: 200px;
            margin-bottom: 1.5em;
        }
        h1 {
            font-family: "IBM Plex Mono";
            font-weight: 500;
            color: @cryptpad_color_brand;
            font-size: 3.7rem;
        }
        .tag-line {
            text-align: center;
            font-size: 1.4em;
            max-width: 50ch;
        }
        .cp-instance-location {
            margin-top: 20px;
            i {
                font-size: 1.2em;
                margin-right: 5px;
            }
        }
        .cp-instance-links {
            padding: 1.3rem;
            a {
                display: inline-block;
                margin: 0.5em;
                white-space: nowrap;
            }
        }
    }

    @callout-padding: 15px;
    a:hover {
        text-decoration: none;
    }

    .cp-apps {
        max-width: 575px;
        @media screen and (max-width: 990px) {
            align-self: baseline;
        }
    }

    .cp-app-grid {
        background-color: @cp_alertify-bg;
        border-radius: @infopages-radius-L;
        padding: 15px;
        box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.2);
        .cp-app-new {
            font-size: 1.4em;
            line-height: 100%;
            color: fade(@cryptpad_text_col, 80%);
            i {
                margin-right: 5px;
            }
        }
        .cp-app-grid-apps {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            padding: 0 0.8rem;
        }
        a {
            margin: 10px;
        }
        @media screen and (max-width: 990px) {
            margin-top: 40px;
        }
    }
    @icons-size: 120px;
    @icons-text-size: 24px;
    .bs-callout {
        display: flex;
        align-items: stretch;
        margin: 0;
        box-sizing: border-box;
        position: relative;
        flex-flow: column;
        //height: @icons-size;
        width: @icons-size;

        div h4 {
            @media only screen and (min-device-width: 576px) and (max-device-width: 767px) {
                font-size: 1.3em;
            }
        }
        div {
            flex: 1;
            min-height: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            font-size: 16px;
        }
        .fa, .cptools {
            display: flex;
            align-items: center;
            font-size: 3.5em;
            justify-content: center;
            width: @icons-size;
            padding: 10px 10px 0px 10px;
            //height: @icons-size - @icons-text-size;
        }
        .pad-button-text {
            color: @cryptpad_text_col;
            padding: 5px;
        }
    }
    .cp-index-appitem {
        &.cp-app-hidden {
            display: none;
        }
        &.cp-app-disabled {
            div {
                cursor: not-allowed !important;
            }
            opacity: 0.5;
        }
    }
    h4 {
        margin: 0;
    }
    .cp-callout-more-moremsg,.cp-callout-more-lessmsg {
        transform: none !important;
    }
    .bs-callout+.bs-callout {
        margin-top: -5px;
    }

    .bs-callout:hover {
        cursor: pointer;
    }
    .bs-callout:hover.cp-callout-more {
        transform: none !important;
    }

    each(@colortheme_apps, {
        .cp-callout-@{key} {
            border-radius: @infopages-radius;
            i { color: @value; }
            &:hover {
                @desat: desaturate(@value, 15%);
                background-color: contrast(@cryptpad_text_col, lighten(@value, 30%), darken(@desat, 20%));
                i { color: @cryptpad_text_col; }
            }
        }
    });
    .cp-app-drive {
        display: flex;
        flex-direction: row;
        margin: 20px 0px;
        // font-size: 1.4rem;
        a.cp-drive-btn {
            color: @cryptpad_text_col;
            font-size: 1.5rem;
            display: block;
            height: min-content;
            flex-shrink: 0;
            width: fit-content;
            padding: 10px;
            border-radius: @infopages-radius-L;
            margin-right: 25px;
            &:visited {
                color: @cryptpad_text_col;
            }
            &:hover {
                background-color: fade(@cryptpad_text_col, 10%);
            }
            i {
                color: @cryptpad_color_brand;
                margin-right: 10px;
                font-size: 1.3em;
            }
        }
        .cp-sub-prompt {
            * {
                display: block;
            }
            .subscribe-btn {
                text-align: center;
                background-color: @cp_buttons-primary;
                color: @cryptpad_text_col;
                font-size: 1.4rem;
                margin: 10px 0;
                border-radius: @infopages-radius-L;
                padding: 0.75rem;
                i {
                    display: inline;
                    margin-right: 10px;
                }
                &:hover, &:focus {
                    background-color:  contrast(@cp_buttons-primary-text, darken(@cp_buttons-primary, 10%), lighten(@cp_buttons-primary, 10%));
                }
            }
        }
    }

    .cp-hidden { display: none !important; }
    .cp-callout-more {
        display: inline-block;
        align-content: center;
        height: 2em;
        border-radius: 1em;
        margin-left: auto;
        margin-right: auto;
        margin-top: 0;
        background: none;
        width: 100%;
        div {
            .infopages_link();
            color: @cryptpad_color_white;
            .fa, .cptools {
                font-size: inherit;
                padding: 0;
                width: 1em;
                padding-left: 5px;
            }
        }
    }

    .cp-extensions-popups {
        width: 100%;
        .cp-extensions-popup {
            background-color: @cp_alertify-bg;
            border-radius: @infopages-radius-L;
            padding: 10px;
            box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.2);
            width: 400px;
            max-width: 100%;
            color: @cryptpad_text_col;
            margin-left: 40px;
        }

    }
    @media (max-width: 700px) {
        .cp-extensions-popups {
            max-width: 90%;
            .cp-extensions-popup {
                margin-left: 0;
            }
        }
    }

    @media (min-width: 576px) and (max-width: 767px) {
        .container {
            padding-left: 0;
            padding-right: 0;
        }
        div#cp-main.cp-page-index .cp-topbar .navbar-toggler-left {
            left: 5px;
        }
    }
}

