/* 
    Created on : 2025年12月21日, 08:22:24
    Author     : sarkuya
*/

:root {
    color-scheme: light dark;
}

html, body {
    margin: 0;
    padding: 0;
}

html {
    box-sizing: border-box;

    display: flex;
    height: 100vh;
}

body {
    flex: 1;
    min-height: 0;

    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    min-height: 0;

    display: flex;
    flex-direction: column;
}

div#design-widget {
    flex: 1;
    min-height: 0;

    display: grid;
    grid-template-rows: 1fr auto;
    gap: 1em;

    border: 1px solid deepskyblue;
    background-color: #444;
    margin: 0.5em;

    > div#design-items {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(650px, 1fr));

        gap: 1.5em 1em;
        overflow: scroll;

        padding: 0.5em;

        > .design-item {
            border: 1px solid silver;
            border-radius: 0.5em;
            padding: 0.5em;

            display: grid;
            grid-template-columns: 1fr auto;
            gap: 0.5em;

            min-height: 400px;
            overflow: scroll;

            justify-items: stretch;
            align-items: stretch;

            > iframe {
                flex: 1;
                border: 1px solid gray;

                border-radius: 0.5em;
                align-self: stretch;
            }

            > div {
                --color-block-width: 65px;
                --color-block-gap: 0.1em;
                --color-block-col-num: 3;

                min-width: calc((var(--color-block-width) + var(--color-block-gap)) * var(--color-block-col-num));

                > h2 {
                    color: rgb(248, 125, 255);
                    margin: 0.5em 1em;
                    text-align: center;
                    font-size: 2em;
                }

                .palette-bar {
                    background: repeating-linear-gradient(45deg, #333333 0, #333333 5%, #4f4f4f 0, #4f4f4f 50%) 0 / 10px 10px;

                    display: grid;
                    grid-template-columns: repeat(auto-fit, minmax(var(--color-block-width), 1fr));
                    gap: var(--color-block-gap);

                    > div.color-box {
                        aspect-ratio: 1 / 1;

                        border-radius: 6px;
                        cursor: pointer;
                        transition: all 1.0s ease;
                        box-shadow: 1px 1px 5px #999;

                        display: flex;
                        align-items: center;
                        justify-content: center;
                        overflow: hidden;

                        &:hover {
                            transform: scale(1.5);
                            box-shadow: 0px 0px 12px 5px #555;

                            z-index: 10;
                            > div.color-value {
                                opacity: 1;
                            }
                        }

                        > div.color-value {
                            border: 1px solid gray;
                            border-radius: 0.5em;

                            margin: 0.5em;
                            padding: 0.5em;

                            font-weight: 600;
                            font-size: 8px;
                            letter-spacing: 0.3em;
                            opacity: 0;

                            transition: opacity 2s ease, transform 2s ease;
                            cursor: text;

                            text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
                            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
                            backdrop-filter: blur(5px);
                            text-align: center;
                        }
                    }
                }
            }
        }
    }

    > div#nav-bar {
        border: 1px solid gray;
        background-color: light-dark(#98BB92CC, #333c);
        display: flex;

        padding: 1em;
        gap: 1em;

        justify-content: space-around;
        align-items: center;

        white-space: nowrap;

        >input[type=button] {
            --btn-bg-color: hsl(220, 50%, 30%);
            --btn-color: hsl(from var(--btn-bg-color) calc(h + 180) s 60%);
            
            padding: 0.75em 1.2em;
            border: 1px solid gray;
            border-radius: 0.1em;

            color: var(--btn-color);
            background-color: var(--btn-bg-color);
            
            cursor: pointer;
            
            &:disabled {
                cursor: not-allowed;
                opacity: 0.5;
            }

            &:not(:disabled) {
                &:hover {
                    filter: brightness(1.3);
                }
                
                &:active {
                    border-style: inset;
                    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.125);
                    transform: translate(1px, 1px);
                    filter: brightness(0.9);
                }
            }
        }
    }
}