@import (once) "../../include/vars";
@import (once) "../../include/mixins";

.splitter {
    display: flex;
    flex-wrap: nowrap;
    flex-direction: row;
    justify-content: space-between;
    position: relative;
    user-select: none;

    &.vertical {
        flex-direction: column;
    }
}

.splitter {
    & > .gutter {
        flex-shrink: 0;
        flex-grow: 0;
        border: 1px solid @light;
        background-color: @light;
        cursor: col-resize;
        z-index: 1;
        position: relative;

        &.active {
            background-color: @gray;
        }

        &::before {
            content: "";
            z-index: 1;
            display: block;
            position: absolute;
            left: 0;
            width: 100%;
            top: 50%;
            height: 24px;
            margin-top: -12px;

            background: @gray;
        }
    }

    &.vertical {
        & > .gutter {
            cursor: row-resize;

            &::before {
                height: 100%;
                width: 24px;
                top: 0;
                left: 50%;
                margin-left: -12px;
                margin-top: 0;
            }
        }
    }

    &.static-size {
        & > .gutter {
            cursor: default;
        }
        & > .gutter::before {
            display: none;
        }
    }
}

.splitter {
    & > .split-block {
        position: relative;
        flex-grow: 1;
        flex-basis: 0;
        overflow: hidden;
    }
}

.splitter {
    &.gutter-style-ribbed {
        & > .gutter {
            &::before {
                background: repeating-linear-gradient(
                        45deg,
                        #ffffff,
                        #a6a6a6 4px,
                        #ffffff 4px,
                        #a6a6a6 8px
                );
            }
        }
    }

    &.gutter-style-dashed {
        & > .gutter {
            &::before {
                background: repeating-linear-gradient(
                        0deg,
                        #ffffff,
                        #a6a6a6 4px,
                        #ffffff 4px,
                        #a6a6a6 8px
                );
            }
        }

        &.vertical {
            & > .gutter {
                &::before {
                    background: repeating-linear-gradient(
                            90deg,
                            #ffffff,
                            #a6a6a6 4px,
                            #ffffff 4px,
                            #a6a6a6 8px
                    );
                }
            }
        }
    }

    --gutter-dot-size: 2px;
    --gutter-bg-size: 8px;
    --gutter-bg-position: ~"calc(var(--gutter-bg-size) / 2)";
    --gutter-dot-color: #ffffff;
    --gutter-dot-color-second: @gray;

    &.gutter-style-dotted {
        & > .gutter {
            &::before {
                background-image: radial-gradient(
                        circle at center,
                        var(--gutter-dot-color) var(--gutter-dot-size),
                        var(--gutter-dot-color-second) 0
                ), radial-gradient(circle at center, var(--gutter-dot-color) var(--gutter-dot-size), var(--gutter-dot-color-second) 0);
                background-size: var(--gutter-bg-size) var(--gutter-bg-size);
                background-position: 0 0, var(--gutter-bg-position) var(--gutter-bg-position);
            }
        }
    }
}