@use '../../styles/variables';

$anchor-border-width: 2px;

.thy-anchor {
    position: relative;
    padding-left: $anchor-border-width;

    &-wrapper {
        margin-block-start: -4px;
        padding-block-start: 4px;
        overflow: auto;
        background-color: variables.$bg-default;

        &:not(&-horizontal) {
            .thy-anchor {
                &-ink {
                    position: absolute;
                    top: 0;
                    left: 0;
                    height: 100%;

                    &::before {
                        position: relative;
                        display: block;
                        width: $anchor-border-width;
                        height: 100%;
                        margin: 0 auto;
                        background-color: variables.$nav-border-color;
                        content: ' ';
                    }

                    &-full {
                        position: absolute;
                        border-left: $anchor-border-width solid variables.$primary;
                        transition: top 0.2s ease-in-out;
                    }
                }
            }
        }
        &-horizontal {
            position: relative;
            padding: 0;

            .thy-anchor {
                display: flex;
                padding: 0;
                overflow-x: auto;
                scrollbar-width: none;

                &-ink {
                    position: absolute;
                    bottom: 0;
                    left: 0;
                    width: 100%;
                    height: 2px;

                    &::before {
                        position: relative;
                        display: block;
                        width: 100%;
                        height: 1px;
                        margin: 0 auto;
                        background-color: variables.$nav-border-color;
                        content: ' ';
                    }

                    &-full {
                        position: absolute;
                        bottom: 0;
                        border-top: $anchor-border-width solid variables.$primary;
                        transition:
                            left 0.2s ease-in-out,
                            width 0.2s ease-in-out;
                    }
                }
                &-link {
                    padding-left: 20px;

                    &-title {
                        padding: 13px 12px;
                        color: variables.$gray-800;
                    }
                }
            }
        }
    }

    &-link {
        padding-left: 16px;
        display: block;

        &-title {
            padding-top: 7px;
            padding-bottom: 7px;
            position: relative;
            display: block;
            margin-bottom: 6px;
            overflow: hidden;
            color: variables.$gray-600;
            white-space: nowrap;
            text-overflow: ellipsis;
            transition: all 0.2s;
            &:hover {
                text-decoration: none;
            }
            &:only-child {
                margin-bottom: 0;
            }
        }

        &-active > &-title {
            color: variables.$primary;
        }
    }
}
