/*
RESET
*/

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
/*    outline: 1px solid lime;*/
}

/* 
ROOT VARIABLES
*/

:root {
    --background-color: #d9dfe2;
    --main-color:#0075ff;
    --main-white-color: #ffffff; 
    --button-focus-outline: 2px solid orange;
    --label-background-color: rgba(0, 117, 255, 0.3);
    --node-background-color: blue;
    --node-selected-border: 2px solid orange;
    --popover-color: black;
    --popover-border: solid black 1px;
    --link-friend-color: #00b000;
    --link-disliked-color: black;
    --pre-link-color: #999;
    --battery-background: #D9D9D9;
    --battery-level-color: lightgreen;
    --battery-text-color: black;
    --delete-button-color: red;
    --profile-username-color: #0966ff;
    --skip-button-background: #6c757d;
    --liked-link-color: #ff9900;
}

/* 
GENERAL STYLING
*/

body {
    padding: 1em;
    background-color: var(--background-color);
    height: 100vh;
    font-family: system-ui;
}

main {
    display: grid;
    grid-template-columns: 1fr 16em;
    grid-template-rows: 1fr min-content min-content;
    gap: 1em;
    height: 100%;
}

h1 {
    padding: 0;
    margin: 0;
    height: fit-content;
}

h3 {
    font-size: 1em;
    font-family: system-ui;
    margin-bottom: 0.25em;
    margin-top: 0;
}

h3:nth-of-type(2),
h3:nth-of-type(3) {
    margin-top: 2rem;
}

label,
button {
    padding: 0.5em;
    border-radius: 0.75rem;
}

button {
    font: inherit;
    --background-color: var(--main-color);
    background-color: color-mix(in srgb, var(--background-color), #ffffff 0%);
    color: white;
    border: none;
    width: fit-content;
    padding: .5em 1em;
    cursor: pointer;
    transition: 100ms;
    text-wrap: nowrap;
    display: flex;
    gap: .5em;
    align-items: center;

    &:focus-visible {
        outline: var(--button-focus-outline);
        outline-offset: 2px;
    }

    &:hover,
    &:focus-visible {
        box-shadow: 0 0 2px 1px #0009;
        background-color: color-mix(in srgb, var(--background-color), #ffffff 30%);
    }
    
    &:active {
        box-shadow: inset 0 0 3px 1px #0009;
        background-color: color-mix(in srgb, var(--background-color), #000000 30%);
    }
    & > img {
        pointer-events: none;
    }
}

/* Only for screenreaders */
.visually-hidden {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.label-with-icon {
    display: flex;
    align-items: center;
}

.label-with-icon img {
    width: 1.5em; 
    height: 1.5em; 
}

p span {
    color: var(--button-color);
    font-weight: 700;
}

/*
HEADER STYLES
*/

body > header {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 1em;
    z-index: 12;
    transition: 200ms;
    &:hover {
        opacity:0;
        filter: alpha(opacity=0);
        z-index: 12;
    }
    & h1 {
        order: 1;
        font-size: 1.4em;
        height: fit-content;
        user-select: none;
    }
    & .logo {
        height: 100%;
    }
}

/*
CANVAS STYLES
*/

.canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
    grid-column: 1/2;
    grid-row: 1/3;
    overflow: auto;
    cursor: url("./../images/select-cursor.png") 7 7, default;
}

canvas {
    height: 100%;
    position: relative;
    margin: 0 auto;
    display: block;
}

@supports not (anchor-name: --anchor) {
    .node-popover {
        position-visibility: anchors-visible;
        position: absolute; 
    }
}
.node-popover {
    z-index: 99;
    width: fit-content;
    height: fit-content;
    border-radius: 0.75em;
    display: grid;
    grid-template-rows: max-content max-content;
    grid-template-columns: 48px 1fr;
    padding: 12px 16px 12px 12px;
    gap: 8px;
    background-color: var(--main-white-color);
    color: var(--popover-color);
    box-shadow:rgba(0, 0, 0, 0.25) 0px 4px 4px;
    border: none;
    position-anchor: --currentNode;
    top: anchor(25%);
    left: anchor(25%);
    & img {
        width: 3em;
        aspect-ratio: 1;
        border-radius: 50%;
        border: var(--popover-border);
        grid-row: 1/3;
        grid-column: 1/2;
    }

    & p:nth-of-type(1) {
        font-weight: 700;
    }

    & p {
        display: flex;
        gap: 0.5em;
    }

    & p span:nth-of-type(2) {
        overflow: hidden;
        width: 0.25em;
        height: 0.25em;
        display: block;
        border-radius: 50%;
        border: black solid 2px;
        align-self: center;
    }
}

.forwardButton {
    border: none;
    border-radius: 0.5em;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    height: 2.5rem;
    transform: translate(-50%, calc(-100% - 10px));
    transition: transform 0.3s ease;

    &:hover {
        transform: translate(-50%, calc(-100% - 10px - .5em));
    }

    & img {
        width: 2rem;
        filter: invert(1);
    }

    &::after {
        content: "";
        position: absolute;
        bottom: -10px;
        left: 50%;
        transform: translateX(-50%);
        width: 20px;
        height: 10px;
        background-color: inherit;
        clip-path: polygon(50% 100%, 0 0, 100% 0);
        transition: transform 0.3s ease;
    }
}

.hide {
    display: none;
}

/* 
TOOLBAR STYLES
*/

.top-bar {
    display: flex;
    flex-direction: row;
    height: 100%;
    overflow: auto;
    column-width: 340px;
    grid-column: 1 / 2;
    grid-row: 3 / 4;
    align-items: end;
}

.toolbar {
    display: flex;
    flex-direction: row;
    padding-inline: 1em;
    padding-block: 0.5em;
    background-color: var(--main-white-color);
    border-radius: 0.75rem;
    top: 0;
    gap: 0.75em;
    justify-content: start;
}

.vertical-line {
    width: 2px;
    background-color: #d3d3d3;
    align-self: stretch;
    border-radius: 2px;
}

.tools {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.help{
    padding: 0;
    --background-color: transparent;
    margin-top: 1.5em;
    filter: invert(1);
}

.info-button{
    width: 1.5em;
    height: 1.5em;
}

.wide-shown {
    display: none;
}
.small-hidden{
    display: inline;
}

@media(max-width: 1162px) {
    .small-hidden {
        display: none;
    }

}

@media (min-width: 1355px) {
    .wide-shown {
        display: inline;
    }
}

.tools button img {
    height: 1.2em;
    filter: invert(1);
    vertical-align: bottom;
}


/*
SPECIAL INPUTS
*/

.counter-input {
    display: inline-flex;
    gap: 0.25em;
    align-items: center;
    border-radius: 999em;
    width: fit-content;

    & input {
        display: block;
        border: none;
        font-weight: 700;
        font-size: 1em;
        text-align: center;
        color: var(--button-color);
        outline: none;
        width: 2ch;
        -moz-appearance: textfield;
    }

    & input::-webkit-outer-spin-button,
    & input::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    & button {
        --background-color: #c3c3c3;
        color: #000000;
        margin: 0;
        padding: 0;
        display: block;
        width: 1.2em;
        height: 1.2em;
        display: grid;
        place-items: center;
        line-height: 1;
    }

    &:has(:focus-visible) {
        outline: var(--button-focus-outline);
        outline-offset: 2px;
    }
}

.select {
    border: 2px solid var(--main-color);
    border-radius: .75em;
    display: block;
    position: relative;
    overflow: hidden;

    &:has(:focus-visible) {
        outline: var(--button-focus-outline);
    }
    

    & select {
        font: inherit;
        padding-block: .25em;
        padding-inline-start: .5em;
        padding-inline-end: 2em;
        appearance: none;
        border: none;
        outline: none;
        width: 100%;
    }

    &::after {
        content: url('../images/circle-chevron-down.svg');
        position: absolute;
        right: .5em;
        top: 50%;
        transform: translateY(-50%);
        width: 1em;
        height: 1em;
        pointer-events: none;
        filter: invert(36%) sepia(63%) saturate(6710%) hue-rotate(205deg) brightness(106%) contrast(102%);
    }
}

/*
NODE STYLES
*/

.node {
    z-index: 90;
    transform: translate(-50%, -50%);
    aspect-ratio: 1;
    position: absolute;
    transition: 200ms;
}

.personNode {
    background-color: var(--node-background-color);
    background-repeat: no-repeat;
    background-size: contain;
    border-radius: 50%;

    &.selected {
        border: var(--node-selected-border);
    }
}

.postNode {
    /* background-color: red; */
    background-image: url(../images/post.svg);
    filter: invert(16%) sepia(86%) saturate(7468%) hue-rotate(358deg) brightness(110%) contrast(115%);
}

/* the person nodes that are not selected */
.canvas-container:has(.personNode.selected) .personNode:not(.selected) {
    background-color: color-mix(in srgb, var(--node-background-color), var(--background-color) 50%);

    &::after {
        content: "";
        position: absolute;
        inset: 0;
        background-color: var(--background-color);
        opacity: 50%;
    }

    &:hover {
        &::after {
            display: none;
        }
    }
}

.postNode.selected {
    background-color: color-mix(in srgb, red, var(--background-color) 50%);
}

/* LINK STYLES */

.linkStripe {
    transform-origin: center left;
    height: 1px;

    &.info-link, &.friend-link, &.liked-link, &.disliked-link {
        animation: shoot 1s linear;
    }
    &.highlight-link {
        height: 1.5px;
    }
}

@keyframes shoot {
    from {
        scale: 0;
    }
    to {
        scale: 1;
    }
}

.info-link {
    background-color: var(--main-color);
}
.friend-link {
    background-color: var(--link-friend-color);
}
.liked-link {
    background-color: var(--liked-link-color);
}
.pre-link {
    background-color: var(--pre-link-color);
    opacity: 0;
}
.disliked-link {
    background-color: var(--link-disliked-color);
    opacity: 0.1;
}

.canvas-container:hover .pre-link {
    opacity: 1;
}

/* pre link als een persoon wordt gehovered */
.canvas-container:has(.personNode:hover) {
    & .pre-link {
        background-color: var(--link-friend-color);
        height: 2px;
    }
}

/* pre link als een post wordt gehovered */
.canvas-container:has(.postNode:hover) {
    & .pre-link {
        background-color: var(--liked-link-color);
        height: 2px;
    }
}

label:has(input[type="radio"]:checked) {
    background-color: var(--label-background-color);
}

input[type="radio"] {
    position: absolute;
    left: -9999px;
}

/* 
LEGEND STYLES
*/

.legend {
    flex-direction: column;
    padding-block: 0.75em;
    padding-inline: 1em;
    background-color: var(--main-white-color);
    border-radius: 0.75rem;
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    top: 0;
    display: flex;
    gap: 0.5em;
    flex-direction: column;
    h2 {
        font-size: 1em;
    }
    & ul {
        display: flex;
        flex-wrap: wrap;
        gap: 1em;
        row-gap: .5em;
        & li {
            font-family: system-ui;
            list-style: none;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.5em;
            cursor: pointer;
            transition: 150ms;  
            position: relative; 
            padding-bottom: 0.6rem;
            /* z-index: 3; */
            & span {
                height: 3px;
                width: 100%;
                animation: none;
                transition: 200ms;
                position: absolute;
                bottom: 0;
            }
            & img {
                width: 1.25em;
                height: auto;
            }
            &:hover span{
                animation: slideToTop 200ms linear forwards;
                opacity: .5;
            }
        }
        & li:has(.post-dot, img){
            flex-direction: row;
            cursor: auto;
            &:hover {
                animation: none;
            }
        }
        & li:has(.disliked-link){
            text-decoration: line-through;
            &:hover span{
                opacity: .1;
            }
        }
    }

    & li:nth-of-type(4){
        margin-top: 0.7em;
    }
}

@keyframes slideToTop {
    from {
        height: 3px;
    }
    to {
        height: 100%;
    }
}

/* 
CALCULATE STYLES
*/

.calculated {
    grid-column: 2 / 3;
    grid-row: 3 / 4;
    background-color: var(--main-white-color);
    flex-direction: column;
    padding-block: 0.75em;
    padding-inline: 1em;
    border-radius: 0.75rem;
    top: 0;
    display: flex;
    gap: 0.5em;
    flex-direction: column;
    & > div {
        display: flex;
        justify-content: space-between;
    }
    & h2 {
        font-size: 1em;
    }
    & img {
        width: 1em;
        height: auto;
    }
    & p span {
        color: var(--main-color);
    }
}

/*
PHONE STYLES
*/

.phone {
    grid-column: 2 / 2;
    grid-row: 1 / 2;
    width: 100%;
    justify-self: right;
    align-self: end;
    position: relative;
    aspect-ratio: 272 / 554;
    border: 0.5em solid #234;
    border-radius: 28px;
    overflow: hidden;
    opacity: 0;
    transition: 200ms;
    transform: translate(6%, 0);

    & button {
        transition: none;
    }

    & button:hover,
    & button:active {
        box-shadow: none;
        opacity: .7;
    }
    
}

.phone-selected {
    opacity: 1;
    transform: translate(0, 0);
}

.phone-border {
    width: -webkit-fill-available;
    grid-column: 2 / 2;
    grid-row: 2 / 3;
    pointer-events: none;
    position: absolute;
    inset: 0;
    z-index: 100;
}

.phone-status-bar {
    width: 100%;
    background-color: var(--main-white-color);
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5em;
    padding: .25em 1em .25em 1em;
}


.phoneIcon{
    grid-column: 3 / 3;
    grid-row: 1 / 1;
    display: flex;
    gap: 0.25em;
    & img{
        height: 10px;
    }
}


/*
FAKEBOOK STYLES
*/

.fakebook {
    grid-column: 2 / 2;
    grid-row: 2 / 3;

    display: flex;
    flex-direction: column;

    column-gap: 1em;
    row-gap: 1rem;

    background-color: var(--main-white-color);

    width: 100%;
    aspect-ratio: 1 / 2.08;
    overflow-y: auto;

    padding: 0.5em;
    padding-bottom: 5em;

    &::-webkit-scrollbar {
        display: none;
    }

    & h3 {
        padding: 0.5rem;
        font-size: 1.2rem;
        margin: 0;
    }

    & > div:nth-of-type(1) {
        & > p:nth-of-type(1) {
            padding-top: 0;
        }

        & p,
        label {
            padding: 0em;
            padding-block: 0.4em;
        }
        & p span {
            color: var(--button-color);
            font-weight: 700;
            font-family: system-ui;
        }
        & label {
            display: block;
            padding-bottom: 0;
        }
    }

    & > button {
        margin-bottom: 0;
        padding: 0.5em 1em;
        align-self: end;
        height: fit-content;
    }
}

.fakebook-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 0.5em;
    gap: 0.5em;

    & h2 {
        margin-right: auto;
    }

    & button {
        background-color: transparent;
        padding: 0.5em;
        display: grid;
        place-items: center;
    }
}

.phone nav {
    display: flex;
    position: absolute;
    gap: 1rem;
    list-style: none;
    padding: 0.25rem 0 0.5rem 0;
    justify-content: center;
    background-color: var(--main-color);
    color: var(--main-white-color);
    bottom: 0;
    right: 0;
    left: 0;

    & ul {
        display: flex;
        justify-content: space-around;
        list-style: none;
        padding: 0;
        margin: 0;
        gap: 1rem;
    }

    & button {
        padding: 0;
        box-shadow: none;

        & img {
            width: 2.25em;
            filter: invert(1);
        }
    }

    & button.active {
        --background-color: #ffffff 20%;
    }
}

.friends,
.liked,
.profile {
    display: none;
}

.fakebook-profile {
    text-align: center;
    justify-items: center;

    & > img {
        width: 4rem;
        aspect-ratio: 1;
        border-radius: 50%;
        border: solid black 1px;
    }

    & > div {
        grid-column: 1/-1;
    }

    & button {
        color: black;
        background-color: transparent;
        padding: 0;

        & img {
            height: auto;
            width: auto;
            border: none;
        }
    }

    & .username {
        margin-top: 0.5em;
        font-weight: bold;
    }

    & .user-data {
        display: grid;
        grid-template-columns: max-content max-content;
        column-gap: 1em;
        justify-content: center;

        & span {
            font-weight: bold;
            color: var(--profile-username-color);
        }
    }
}

.fakebook ul {
    background-color: grey;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding-block: 1px;
    list-style: none;

    & li {
        background-color: var(--main-white-color);
    }
}

.fakebook .section-heading {
    text-align: left;
    display: flex;

    & button {
        --background-color: transparent;
        display: flex;
        padding: .25em;
        align-items: center;
    }

    & * + button {
        margin-left: auto;
    }

    & img {
        height: 1.5em;
    }
}

.battery {
    width: 1.25em;
    height: 10px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--battery-background);
    border-radius: 3px;

}
.battery-level {
    height: 100%;
    width: 0;
    background-color: var(--battery-level-color);
    position: absolute;
    left: 0;
    top: 0;
    transition: width 0.5s;
    border-top-left-radius: 3px;
    border-bottom-left-radius: 3px;
}
.battery::before {
    content: '';
    width: 2px;
    height: 2px;
    background: var(--battery-background);
    position: absolute;
    right: -3px;
    border-top-right-radius: 3px;
    border-bottom-right-radius: 3px;
    top: 50%;
    transform: translateY(-50%);
}
.level {
    position: absolute;
    z-index: 1;
    font-size: .5em;
    color: var(--battery-text-color);
}

.friends {

    & > button{
        display: flex;
        align-items: center;
        justify-content: end;
        flex: auto;
        color: var(--background-color);
        padding-right: 0.5rem;

        & img {
            border: none;
            height: 2rem;
            width: 2rem;
        }
    }

    & li {
        display: grid;
        grid-template-columns: 3rem 1fr;
        column-gap: 1rem;
        padding: 0.5rem;

        & img {
            width: 3rem;
            height: 3rem;
            border-radius: 50%;
            grid-column: 1 / 2;
            grid-row: 1 / 3;
        }
    
        & p {
            grid-column: 2 / 2;
            grid-row: 1 / 2;
            padding: 0;
        }

        & div {
            grid-column: 2 / 2;
            grid-row: 2 / 2;
            display: flex;
            gap: 0.5rem;
        }

        & button {
            padding: 0;
            background-color: transparent;
            text-decoration: underline;
        }
    }
}

.search-bar {
    width: calc(100% - .5em);
    font-size: 1em;
    border-radius: 2em;
    border: 1px solid black;
    padding-block: .5em;
    padding-inline-start: 2.5em;
    padding-inline-end: .5em;
    box-shadow: .1em .1em .1em #0005;
    margin-inline: .25em;
    margin-block-end: 1em;
    background-image: url('../images/search.svg');
    background-repeat: no-repeat;
    background-size: 1.5em;
    background-position: .5em center;
}

.feed, .liked {

    & li {

        & .post-heading {
            padding: .5em;
            text-align: left;
        }

        & .post-image {
            width: 100%;
        }

        & .post-options {
            display: flex;
            gap: .5em;
            padding: .5em;

            & div {
                display: flex;
                align-items: center;
                margin-left: auto;
                gap: .5em;
            }

            & button {
                --background-color: transparent;
                padding: 0;
                box-shadow: none;
            }

            & svg,
            & img {
                width: 1.5em;
            }

            & .eye {
                filter: invert(.45);
            }
        }
    }
}

.like-button svg {
    fill: transparent;
    transition: fill 0.3s ease;
    stroke: #000000;
    pointer-events: none;
}

.like-button:hover, .like-button:active {
    box-shadow: none;
}
   

.like-button.active svg{
    fill: red;
    stroke: red;
    animation: like 0.3s ease;
}



@keyframes like {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(2);
    }
    100% {
        transform: scale(1);
    }
}



.delete-button {
    --background-color: transparent;
    color: var(--delete-button-color);
    text-decoration: underline;
    padding: 0;
}

.add-button {
    --background-color: transparent;
    color: #0075ff;
    text-decoration: underline;
    padding: 0;
    gap: 0;

    & img {
        filter: invert(36%) sepia(63%) saturate(6710%) hue-rotate(205deg) brightness(106%) contrast(102%);
    }
}

/* account  */

.selectedProfile {
    display: none;
}

.username {
    grid-column: 2 / 3;
}

.trait {
    display: flex;
    margin: 0.5em 0;
    gap: .5em;

    & p {
        padding: 0.25em 0;
    }

    & .select {
        width: 100%;
    }
}

.profileInfo {
    gap: 1rem;
    display: flex;
    flex-direction: column;
}

.fakeFollowers {
    display: flex;
    gap: 1em;
}

/*
ONBOARDING STYLES
*/

dialog {
    border-radius: .75em;
    padding: 2em;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 36em;
    border: none;
    margin: auto;

    &::backdrop {
        background-color: rgba(0, 0, 0, .25);
    }
    
    & > div{
        display: flex;
        flex-direction: column;
        gap: 1em;
    }

    & p {
        line-height: 1.6em;
    }
}

.skip-button {
    --background-color: var(--skip-button-background);
    color: var(--main-white-color);
}

video {
    margin: 0;
}

.button-row {
    display: flex;
    gap: 0.5em;
}

/* 
Medal img for MIP
*/

.mipMedal {
    display: none;
    position: fixed;
    position-anchor: --MIP;
    position-visibility: anchors-visible;
    top: anchor(0%);
    left: anchor(start);
    width: 1.25em;
    height: auto;
    z-index: 9999;
}
