@import url('https://fonts.googleapis.com/css2?family=Geist:ital,wght@0,100..900;1,100..900&display=swap');
@import url('https://cdn.jsdelivr.net/npm/@fontsource/dseg14-classic@5.3.0/index.css');

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

body {
    overflow-y: auto;

    background-color: #101114;
    color: white;

    font-family: 'Geist', sans-serif;
}

*,
*::before,
*::after {
    font-family: inherit;
    box-sizing: border-box;
}

::selection {
    background-color: #4c94fe;
    color: black;
}

body > main {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 64px 0;
}

.rootPage {
    color: rgba(255, 255, 255, 0.75);
    margin: 0;

    + h1 {
        margin-top: 0;
    }

    a {
        color: inherit;
        text-decoration: none;

        &:hover {
            color: #7db1fe;
            text-decoration: underline;
        }
    }
}

.pageTitle {
    .onDuty {
        color: #7db1fe;
    }

    .offDuty {
        color: #fec67d;
    }

    .dash {
        color: rgba(255, 255, 255, 0.5);
    }
}

.maingrid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.kvCard,
.logCard,
.mapCard {
    padding: 16px;
    border-radius: 6px;

    h2 {
        margin: 0;
        font-size: 12px;
        color: #ffffffa3;
        margin-bottom: 6px;
    }
}

.kvCard {
    background-color: #181c20;

    .digitalTimer {
        position: relative;
        color: #7db1fe;

        font-size: 36px;
        font-family: 'DSEG14 Classic', sans-serif;
        transform: skew(-7.5deg);

        .bg {
            position: absolute;
            z-index: -1;
            top: 0;
            left: 0;

            opacity: 0.15;

            user-select: none;
        }
    }

    .textValue {
        margin: 0;
        color: white;

        font-size: 24px;
    }

    &:has(.textValue) {
        grid-column: 1;
        grid-row: 3;
    }

    &.bl {
        grid-row: 2;

        .digitalTimer {
            color: #fec67d;
        }

        .offDutyStatuses {
            div {
                position: relative;
                padding-left: 16px;
                margin-top: 6px;

                font-size: 14px;
                color: rgba(255, 255, 255, 0.75);

                &::before {
                    content: '';
                    position: absolute;

                    top: 50%;
                    left: 0;
                    width: 10px;
                    height: 10px;
                    transform: translateY(-50%);

                    border: solid 2px rgba(255, 255, 255, 0.25);
                    border-radius: 99px;
                }

                &:first-child:not(.done)::before,
                &.done + :not(.done)::before {
                    border-color: rgb(254, 198, 125, 0.65);
                    animation: blink ease 3000ms infinite;
                }

                &.done::before {
                    background-color: #fec67d;
                }
            }
        }
    }

    &.bh {
        display: none;
    }
}

.ifBreak {
    display: none;
}

body:has(.kvCard.bl) {
    .kvCard:not(.bl) .digitalTimer {
        color: rgba(255, 255, 255, 0.75) !important;
    }

    .ifBreak {
        display: unset;
    }

    .ifNBreak {
        display: none;
    }
}

.mapCard {
    display: flex;

    .empty {
        flex: 1;
    }
}

.actionCard {
    color: rgba(255, 255, 255, 0.5);

    summary {
        list-style: none;
        text-decoration: underline;
        cursor: pointer;

        &:hover {
            color: white;
        }
    }

    details:open summary {
        color: white;
        text-decoration: none;
        margin-bottom: 8px;
    }
}

.infoCard {
    color: rgba(255, 255, 255, 0.5);

    > * {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    grid-column: span 2;

    svg {
        color: inherit;
        * {
            fill: currentColor;
        }
    }

    p {
        margin: 0;
    }
}

.logCard {
    grid-column: 1;

    .timelineItem {
        position: relative;

        padding: 0 0 16px 24px;

        .tagline {
            font-size: 12px;
            font-weight: 700;
            margin: 0;
        }

        p {
            margin: 2px 0;
        }

        &::before,
        &::after {
            content: '';
            position: absolute;
        }

        &::before {
            width: 10px;
            height: 10px;
            border-radius: 99px;

            left: 0px;
            top: 50%;
            transform: translateY(-150%);
        }

        &:not(:last-child)::after {
            width: 2px;
            height: 50%;

            left: 4px;
            top: calc(50% + 3px);

            background-color: #67696d;
        }

        &:has(+ * > :only-child)::after {
            height: calc(50% - 4px);
        }

        &:has(+ &.progress)::after {
            background-image: repeating-linear-gradient(
                0deg,
                transparent,
                transparent 4px,
                #101114 4px,
                #101114 8px
            );
            background-repeat: repeat;
            background-size: 2px 8px;
            animation: dotMove 0.5s linear infinite;
            will-change: background-image;

            height: calc(50% + 14px);
            top: calc(50% - 3px);
        }

        &:has(+ &.progress.sLine)::after {
            height: calc(50% + 8px) !important;
        }

        &.done {
            --dotcolor: #7db1fe;

            &::before {
                background-color: var(--dotcolor);
            }

            &::after {
                background-color: var(--dotcolor);
            }
        }

        &.progress {
            --dotcolor: #7db1fe;

            &::before {
                border: solid 2px var(--dotcolor);
            }

            body:not(:has(.bl)) &.canBreak .tagline {
                color: transparent;

                width: fit-content;
                /* background-color: #7db1fe; */
                background-image: linear-gradient(
                    135deg,
                    #7db1fe 10%,
                    #a9cafc,
                    #7db1fe 90%
                );
                background-clip: text;
                /* background-repeat: no-repeat; */
                background-size: 200px;
                animation: shimmer 4s linear infinite;
            }

            body:has(.bl) &.canBreak .tagline {
                color: #fec67d;
            }
        }

        &:has(> :only-child) {
            color: rgba(255, 255, 255, 0.5);
        }

        &.notDone {
            &::before {
                border: solid 2px #67696d;
            }
        }
    }
}

body:has(.bl) .timelineItem {
    .tagline,
    &::after {
        animation: none !important;
    }

    &.progress,
    &.done {
        --dotcolor: #fec67d;
    }
}

.mapCard {
    position: relative;

    background-color: #181c20;
    grid-column: 2 / 4;
    grid-row: 2 / 5;

    overflow: hidden;

    :not(.empty) {
        position: relative;
        z-index: 2;
    }

    .empty {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .empty::after {
        content: '';
        position: absolute;
        inset: 0;
        top: 42px;

        background-color: #67696d;
        mask: repeating-radial-gradient(
            circle at center,
            black,
            var(--lines),
            black,
            0,
            #0000,
            calc(var(--lines) * 2),
            #0000 0
        );

        opacity: 0.25;

        transform-origin: top left;
        transform: scale(2);
        animation: noise 0.5s infinite forwards;
    }
}

button.dbg {
    position: fixed;
    bottom: 24px;
    left: 24px;

    background-color: #181c20;
    border: solid 1px rgba(255, 255, 255, 0.075);
    border-radius: 999px;

    height: 36px;
    padding: 0 18px;

    color: white;
    font-family: monospace;

    cursor: pointer;

    &::before {
        content: 'debug: ';
        color: #e71825;
    }

    &:hover {
        background-color: color-mix(in srgb, #181c20, white 5%);
    }
}

@keyframes noise {
    from,
    to {
        --lines: 0.00036px;
    }

    56% {
        --lines: 0.00048px;
    }
}

@keyframes dotMove {
    from {
        background-position-y: 0px;
    }

    to {
        background-position-y: 8px;
    }
}

@keyframes shimmer {
    from {
        background-position-x: -200px;
    }

    to {
        background-position-x: 200px;
    }
}

@keyframes blink {
    from,
    to {
        opacity: 1;
    }

    50% {
        opacity: 0.75;
    }
}

@media screen and (max-width: 720px) {
    body > main {
        padding: 16px;
        padding-bottom: 72px;
    }

    .maingrid {
        /* grid-template-columns: 1fr !important;  */
        display: flex;
        flex-direction: column;
    }

    .bl {
        order: -100;
    }

    .logCard {
        background-color: #181c20;

        .timelineItem:last-child {
            padding-bottom: 0;
        }
    }

    .mapCard {
        height: 400px;
    }

    .actionCard {
        order: 99;
    }

    .infoCard {
        div {
            align-items: flex-start;
        }

        svg {
            width: 24px;
            height: 24px;
        }
    }

    button.dbg {
        z-index: 99;
        left: 50%;
        transform: translateX(-50%);
        width: 230px;

        border-color: rgba(255, 255, 255, 0.25);
        background-color: black;

        box-shadow:
            0 1px 3px rgba(0, 0, 0, 0.25),
            0 3px 8px rgba(0, 0, 0, 0.2),
            0 5px 12px rgba(0, 0, 0, 0.15);
    }

    .rootPage {
        margin: 16px 0 0 16px;
        font-size: 14px;
    }

    .pageTitle {
        margin: 0 0 24px 16px;
        font-size: 24px;

        #dStatus {
            display: block;
        }
    }
}
