:root {
    /* Base colors */
    --color-dark-blue: #102738;
    --color-light-blue: #3888c4;
    --color-blue: #225378;

    --bg-color: var(--color-light-blue);
    --text-color: var(--color-dark-blue);
    --accent-color: var(--color-blue);

    --toggle-frame: var(--color-dark-blue);
    --toggle-background: var(--color-blue);
    --toggle-thumb: var(--color-light-blue);

    --terminal-background: black;
    --terminal-text: green;

    color-scheme: light dark;
    font-size: 28px;
    /*font-size: 21pt;*/
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: var(--color-dark-blue);
        --text-color: var(--color-light-blue);
        --accent-color: var(--color-light-blue);

        --toggle-frame: var(--color-blue);
        --toggle-background: var(--color-light-blue);
        --toggle-thumb: var(--color-dark-blue);

        --terminal-background: black;
        --terminal-text: green;
    }
}

html:has(#dark-mode-toggle-checkbox:checked) {
    --bg-color: var(--color-dark-blue);
    --text-color: var(--color-light-blue);
    --accent-color: var(--color-light-blue);
    color-scheme: dark;

    --terminal-background: black;
    --terminal-text: green;
}

/* Explicit light mode when header checkbox is unchecked (overrides OS preference) */
html:has(#dark-mode-toggle-checkbox:not(:checked)) {
    --bg-color: var(--color-light-blue);
    --text-color: var(--color-dark-blue);
    --accent-color: var(--color-blue);

    --toggle-frame: var(--color-dark-blue);
    --toggle-background: var(--color-blue);
    --toggle-thumb: var(--color-light-blue);

    color-scheme: light;

    --terminal-background: white;
    --terminal-text: black;

    .toggle-switch span {
        transform: translateX(0);
    }
}


html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: color 150ms ease-in-out,
    background-color 150ms ease-in-out;
}

a {
    color: var(--text-color);
}


/* page styling */
#dark-mode-toggle-checkbox {
    display: none;
}

.toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;

    p {
        margin: 0;
        font-size: 0.8rem;
    }

    .toggle-switch {
        --w: 1.6rem;
        --h: 0.8rem;
        --knob: 0.8rem;
        display: flex;
        width: var(--w);
        height: var(--h);
        border: 3px solid var(--toggle-frame);
        background-color: var(--toggle-background);
        border-radius: var(--h);
        margin: 0 0.4rem;
        position: relative;

        span {
            position: absolute;
            border-radius: 50%;
            background-color: var(--toggle-thumb);
            width: var(--knob);
            height: var(--knob);
            top: 0;
            left: 0;
            transform: translateX(calc(var(--w) - var(--knob)));
            transition: transform 150ms ease-in-out;
        }
    }
}


#page-header {
    position: fixed;
    top: 0;
    right: 0;
    padding: 0.5rem 1rem;
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    width: 100%;
}

body {
    margin: 0;
    padding: 0;
}

.card-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.contact-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: space-between;
    gap: 1rem;
}

#flip-image-toggle {
    display: none;
}

#card-image {
    width: 230px;
    height: 230px;
    border-radius: 50%;
    overflow: hidden;
    border: 17px solid var(--accent-color);
    z-index: 150;

    box-shadow: -1px 10px 18px 5px rgba(0, 0, 0, 0.81);
    -webkit-box-shadow: -1px 10px 18px 5px rgba(0, 0, 0, 0.81);
    -moz-box-shadow: -1px 10px 18px 5px rgba(0, 0, 0, 0.81);
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    grid-template-areas: "image";

    .front {
        grid-area: image;
        border-radius: 50%;
        overflow: hidden;
        height: 100%;
        width: 100%;
        background-image: url('img/image2.png');
        background-position: center;
        background-size: 230px;

        transition: transform 300ms ease-in-out,
        z-index 300ms ease-in-out;

        &:hover {
            cursor: alias;
        }

        z-index: 100;
        background-repeat: no-repeat;
        transform: rotateY(0deg);
    }

    .back {
        z-index: 90;
        grid-area: image;
        transform: rotateY(180deg);
        height: 100%;
        width: 100%;
        background-image: url('img/image.png');
        background-position: center;
        background-size: 230px;
        transition: background-size 300ms ease-in-out,
        cursor 300ms ease-in-out,
        background-position 300ms ease-in-out,
        transform 300ms ease-in-out,
        z-index 300ms ease-in-out;;

        &:hover {
            /*background-size: 400px;*/
            /*background-position: -160px -140px;*/
        }
    }

}

/*html:has(#dark-mode-toggle-checkbox:checked) {*/
html:has(#flip-image-toggle:checked) {
    #card-image {
        .front {
            transform: rotateY(180deg);
            z-index: 90;
        }

        .back {
            transform: rotateY(0deg);
            z-index: 100;

            cursor: url('img/dachshund_2_64.png') 64 64, pointer;
        }
    }
}

.cursor-dachshund:hover {
    cursor: url('img/dachshund_2_64.png') 64 64, pointer;
}

.text-frame {
    line-height: 1.2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1rem;
}

.social-links {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 0.2rem;
    margin: 1rem 0;
    padding: 0;
    list-style: none;
    height: 1.5rem;

    li {
        margin: 0;
        padding: 0;
    }

    a {
        transition: font-size 100ms ease-in-out,
        margin 100ms ease-in-out;
        font-size: 1rem;
        margin-right: 0.5rem;

        &:hover {
            margin-right: 0.3rem;
            font-size: 1.2rem;
            cursor: pointer;
        }
    }
}

.link-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    font-size: 0.8rem;

    li {
        &:after {
            display: inline-block;
            margin: 0 1rem;
            content: "/"
        }

        &:last-of-type:after {
            content: "";
            margin-right: 0;
        }
    }

    a {
        &:before {
            content: "";
            background: var(--accent-color);
            width: 100%;
            height: 2px;
            display: inline-block;
            position: absolute;
            left: 0;
            bottom: -4px;
            transform-origin: left center;
            transform: scaleX(1);
            transition: transform 300ms ease-in-out;
        }

        &:hover {
            cursor: pointer;

            &:before {
                transform-origin: left center;
                transform: scaleX(0.5);
            }
        }
    }
}

.scroll-down {
    /*margin-top: 7rem;*/
    position: sticky;
    bottom: 0;
    opacity: 0.4;
    transition: opacity 300ms ease-in-out;
    font-size: 1.5rem;
    padding-bottom: 1rem;

    &:hover {
        opacity: 1;
        cursor: pointer;
    }

    &:visited {
        opacity: 0;
    }
}

/* text styling */
h1 {
    font-family: 'Roboto Slab', serif;
    font-size: 1.5rem;
    font-weight: 500;
    margin: 0;

    span {
        font-weight: 200;
    }
}

h2 {
    font-family: 'Roboto Slab', serif;
    font-size: 1rem;
    font-weight: 200;
    margin: 0;
}

a {
    text-decoration: none;
    font-family: 'Roboto Slab', serif;
    font-weight: 200;
    position: relative;
}

.fa7-brands {
    font-family: 'Font Awesome 7 Brands';
}

.fa5-brands {
    font-family: 'Font Awesome 5 Brands';
}

.fa7-solid {
    font-family: 'Font Awesome 7 Free';
    font-weight: 900;
}

.fa5-solid {
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
}

.fa7-regular {
    font-family: 'Font Awesome 7 Free';
    font-weight: 400;
}

.fa5-regular {
    font-family: 'Font Awesome 5 Free';
    font-weight: 400;
}


/* content styling */
#page-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
}

.terminal-window {
    width: 100%;
    background-color: var(--terminal-background);
    color: var(--terminal-text);
    font-family: 'Roboto Mono', monospace;
    font-weight: 200;
    font-size: 0.8rem;
    line-height: 1.5;
    padding: 1rem;
    margin: 1rem;
    box-sizing: border-box;
    border-radius: 0.5rem;
    border: 2px solid var(--text-color);

    *:before {
        content: "$ ";
        color: var(--terminal-text);
    }

    h2 {
        font-weight: 600;
        font-size: 0.8rem;
        margin: 0;
    }

    p {
        margin: 0;
    }
}

.typed {
    --chars: attr(data-chars number, 10);
    width: calc(var(--chars) * 1ch);
    white-space: nowrap;
    overflow: hidden;
    animation: typing 1s steps(var(--chars)), blink-caret 0.5s step-end infinite alternate;
    border-right: 3px solid currentColor;
}

@keyframes typing {
    from {
        width: 0ch;
    }
    to {
        width: calc(var(--chars) * 1ch);
    }
}

@keyframes blink-caret {
    50% {
        border-color: transparent;
    }
}

@media screen and (max-width: 650px) {
    .contact-card {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
}
