@import '../base';

@keyframes open {
    0% {
        width: calc(var(--size) - 10px);
        height: calc(var(--size) - 10px);
        margin: 5px 0;
    }
    100% {
        width: var(--size);
        height: var(--size);
        margin: 0;
    }
}

* {
    &:focus-visible {
        outline: 1px solid black;
        outline-style: dotted;
    }
}

body {
    font-size: 9pt;
    font-kerning: none;
    display: flex;
    margin: 0;
    background-image: var(--backgroundGradient);
    background-size: 100% 84px;
    background-repeat: no-repeat;
    background-color: var(--background);
}

h1 {
	margin: 0;
    margin-left: 3px;
    font-weight: normal;
    font-size: 14pt;
    margin-bottom: 25px;
}

p {
    margin: 0;
}

hbox {
    display: flex;
}

.container {
	position: relative;
	margin: 0 auto;
    margin-top: 52px;
    width: 849px;

    @media (max-width: 959px) {
        width: 679px;
    }

	&::before {
		position: absolute;
		top: -52px;
		right: 80px;
		height: 97px;
		width: 209px;
		background-image: url("chrome://userchrome/content/resources/ieframe.dll/Bitmap/821.png");
		background-size: cover;
		opacity: 0.5;
	}
}

.recentSitesContainer {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 24px;

    > .tileContainer {
        position: relative;
        --size: 150px;
        height: var(--size);
        width: var(--size);
        animation: open .1s linear;

        @media (max-width: 959px) {
            --size: 120px;
		}

        .delete {
            all: unset;
            display: none;
            position: absolute;
            top: 8px;
            right: 8px;
            height: 16px;
            width: 16px;
            margin-left: auto;
            cursor: pointer;
            mask-image: url('chrome://userchrome/content/pages/newTabHome/resources/delete.svg');
            mask-size: 8px;
            mask-position-y: center;
            mask-position-x: 5px;
            mask-repeat: no-repeat;
            background: var(--deleteNormal);

            &:hover {
                background: var(--deleteHot);
            }
        }

        &:hover {
            .delete,
            .activityLabel {
                display: block !important;
            }
        }
    
        > .tile {
            width: 100%;
            height: 100%;
            box-sizing: border-box;
            border: 1px solid var(--tileBorder);
            background-color: var(--tileEmpty);
            padding: 8px;
            display: block;
            font-size: 10pt;
            color: var(--label);
            text-decoration: none;
            font-weight: normal;

            &[href] {
                background-color: var(--tileContent);
            }

            > hbox {
                margin-bottom: 12px;

                @media (max-width: 959px) {
                    margin-bottom: 6px;
                }
            }

            .icon {
                height: 32px;
                width: 32px;
                background-size: 32px;
                background-position: center;
                background-repeat: no-repeat;
                box-sizing: border-box;
            }

            > .title {
                height: 34px;
                overflow: hidden;
                margin: 0;
            }

            > .activity {
                position: relative;
                height: 8px;
                background-color: var(--websiteColour);
                width: 100%;
                margin-top: 29px;

                @media (max-width: 959px) {
                    margin-top: 13px;
                }

                &::before {
                    content: '';
                    position: absolute;
                    top: 0;
                    left: 0;
                    height: 3px;
                    width: 100%;
                    background-color: white;
                    opacity: .15;
                }
            }

            > .activityLabel {
                margin: 0 2px;
                color: var(--activityLabel);
                display: none;
            }
        }
    }
}

.footer {
    margin-top: 30px;
    height: 46px;
	user-select: none;

    hr {
        border: 0;
        border-top: 1px solid var(--footerSeparator);
        margin-top: 7px;
        margin-bottom: 5px;
		width: 100%;
    }

    .button {
        display: inline-block;
		color: var(--footerLabel);
        height: 13px;
        text-decoration: none;
        cursor: default;
        display: flex;

        &:hover {
            text-decoration: underline;
        }

        &:first-of-type {
            margin-left: 2px;
        }

        &:last-of-type {
            margin-right: 2px;
        }
    }

    #top {
        > img {
            transform: translateY(-1px);

            &:first-of-type {
                margin-right: 5px;
            }
        }

        > .button {
            &:last-of-type {
                margin-left: auto;
            }
        }
    }

    separator {
        width: 1px;
        height: 13px;
        margin: 0 15px;
		background-color: var(--footerSeparator);
    }
}
#searchForm {
	display: flex;
	flex: 1;
}

#searchContainer {
	margin-top: 90px;
	margin-bottom: 50px;
	height: 47px;
}

#searchLogo {
	display: flex;
	width: 125px;
	align-items: center;
	
	> img {
		height: 41px;
		filter: grayscale(100%) contrast(2%);
	}
}

#searchBoxContainer {
	flex: 1;
	box-sizing: border-box;
	background-color: var(--searchBox);
	border: 1px solid var(--searchBoxBorder);

	#searchBox {
		all: unset;
		flex: 1;
		font-size: 18pt;
		padding-left: 14px;
		
		&::placeholder {
			font-style: italic;
			text-transform: lowercase;
		}
	}

	#searchGlyph {
		all: unset;
		width: 43px;
		mask: url(chrome://userchrome/content/images/newtabhome-search-mask.svg);
		mask-repeat: no-repeat;
		mask-position: center 9px;
		background-color: var(--searchGlyph);
	}
}

.IE97777,
.IE97930,
.IE9,
.IE10Plus,
.IE11 {
	display: none;
}

:root {
	&[appearance="IE97777"] {
		.IE97777 {
			display: flex;
		}

		.container {
			&::before {
				background-position-y: 0px;
			}
		}
	}

	&[appearance="IE97930"] {
		.IE97930 {
			display: flex;
		}

		.container {
			&::before {
				background-position-y: -97px;
			}
		}
	}

	&[appearance="IE97777"],
	&[appearance="IE97930"] {
		.container {
			&::before {
				content: '';
			}
		}

		.recentSitesContainer {
			> .tileContainer {
				> .tile {
					border-radius: 4px;
				}
			}
		}
	}

	&[appearance="IE9"] {
		.IE9 {
			display: flex;
		}
	}

	&[appearance="IE10Plus"],
	&[appearance="IE11"] {
		.IE10Plus {
			display: flex;
		}

		body {
			background-image: none;
			font-size: 11pt;
		}

		.container {
			margin-top: 50px;
		}

		h1 {
			margin-left: 7px;
			color: var(--header);
			font-size: 21pt;
		}

		.recentSitesContainer {
			> .tileContainer {
				> .tile {
					font-size: 11pt;

					.title {
						height: 39px;
					}

					.activity {
						margin-top: 26px;
					}

					.activityLabel {
						margin-top: 1px;
						font-size: 8pt;
					}
				}
			}
		}

		.footer {
			margin-top: 55px;

			.button {
				height: 20px;

				&:first-of-type {
					margin-left: 3px;
				}

				&:last-of-type {
					margin-right: 3px;
				}
			}

			hr {
				margin-bottom: 4px;
			}

			separator {
				margin: 0 26px;
				margin-top: 5px;
			}
		}
	}

	&[appearance="IE11"] {
		.IE11 {
			display: flex;
		}
	}
}
