@import url("/css/reset.css");
@import url("/css/starburst.css");

@font-face{
	/* Note: Don't use local() as a source, because our version matches Georgia's x-height */
	font-family: "Crimson Pro";
	src: url("/fonts/crimson-pro.woff2") format("woff2");
	font-weight: normal;
	font-style: normal;
	font-display: swap;
}

@font-face{
	/* Note: Don't use local() as a source, because our version matches Georgia's x-height */
	font-family: "Crimson Pro";
	src: url("/fonts/crimson-pro-bold.woff2") format("woff2");
	font-weight: bold;
	font-style: normal;
	font-display: swap;
}

@font-face{
	/* Note: Don't use local() as a source, because our version matches Georgia's x-height */
	font-family: "Crimson Pro";
	src: url("/fonts/crimson-pro-italic.woff2") format("woff2");
	font-weight: normal;
	font-style: italic;
	font-display: swap;
}

@font-face{
	/* Note: Don't use local() as a source, because our version matches Georgia's x-height */
	font-family: "Crimson Pro";
	src: url("/fonts/crimson-pro-bold-italic.woff2") format("woff2");
	font-weight: bold;
	font-style: italic;
	font-display: swap;
}

:root{
	--logo-image-width: 310px;
	--logo-image-height: 100px;
	--header-height: 8rem;
	--main-padding: 2rem;
	--main-width: 70ch;
}

html{
	font-size: 16px;
	height: 100%;
}

body{
	color: #222;
	background: #f9e9d1;
	font-size: 1.2rem;
	min-height: 100%;
	display: grid;
	grid-template-rows: min-content 1fr min-content;
	padding-bottom: 2rem;
	box-sizing: border-box;
	font-family: "Crimson Pro", serif;
	box-shadow: 0 0 100px 10px rgba(0, 0, 0, .25) inset;
}

body > header{
	background: #392845;
	padding: 2rem;
	height: var(--header-height);
	box-sizing: border-box;
	z-index: 100; /* Give it a `z-index` so we can put the confetti animation behind it. */
	display: flex;
	color: #fff;
	align-items: center;
	gap: 2rem;
	border-bottom: 5px solid rgba(0, 0, 0, .25);
}

body > header a.logo{
	height: calc(var(--logo-image-height) * .75);
	width: calc(var(--logo-image-width) * .75);
	font-size: 0;
	background: url("/images/inkstreak.svg");
	background-size: cover;
}

body > header > button:focus,
body > header a:focus,
body > header a.button:focus,
body > header > nav a:focus{
	outline: 1px dashed #fff;
}

body > header a:any-link{
	text-decoration: none;
	color: #fff;
}

body > header ul.stats{
	display: flex;
	list-style: none;
	gap: 2rem;
	margin-left: auto;
}

body > header ul.stats li + li{
	margin-top: 0;
}

body > header ul.stats li p{
	white-space: nowrap;
}

body > header ul.stats li p::before{
	margin-right: .25rem;
}

body > header ul.stats li.word-count p::before{
	content: "📝";
}

body > header ul.stats li.streak-length p::before{
	content: "🔥";
}

body > header ul.stats li.streak-saver-count p::before{
	content: "🛟";
}

body > header a.star-button{
	z-index: 103; /* Make the stars fly over the menu button and the nav menu. */
}

body > header a.button{
	padding: 1rem;
}

body > header button.menu{
	font-size: 0;
	padding: 1rem;
}

body > header button.menu::before{
	content: "";
	background: url("/images/menu.svg");
	filter: invert(100);
	height: 19px;
	width: 19px;
	display: block;
	background-size: cover;
}

body > header > nav.public-nav{
	margin-left: auto;
}

body > header > nav.public-nav ul{
	display: flex;
	gap: 2rem;
}

body > header > nav.public-nav > ul > li{
	list-style: none;
	margin: 0;
	font-size: 1.5rem;
	font-family: sans-serif;
	font-weight: bold;
}

body > header > nav.public-nav > ul > li a{
	border-bottom: 4px solid transparent;
	padding: 4px 4px 0 4px;
}

body > header > nav.public-nav > ul > li a:hover{
	border-bottom: 4px solid #fff;
}

body > header > nav.public-nav > ul > li a::before{
	margin-right: .5rem;
}

body > header > nav.public-nav > ul > li a[href="/sign-up"]::before{
	content: "🎉";
}

body > header > nav.public-nav > ul > li a[href="/log-in"]::before{
	content: "🔑";
}

body > header > nav.menu{
	display: none;
	position: absolute;
	right: 0;
	top: calc(var(--header-height) - 5px); /* Header bottom border width. */
	padding: 1rem;
	border: 1px solid black;
	background: #392845;
	border: 5px solid rgba(0, 0, 0, .25);
	border-right: none;
	border-top: 0;
	border-bottom-left-radius: 10px;
	z-index: 101; /* `z-index` of header + 1 */
}

body > header > nav.menu ul li{
	margin: 0;
	list-style: none;
}

body > header > nav.menu ul li.divider{
	border-top: 1px dashed #fff;
	padding-top: .5rem;
	margin-top: .5rem;
}

body > header > nav.menu ul li a{
	display: block;
	border-radius: 10px;
	padding: 1rem 1.5rem;
}

body > header > nav.menu ul li a:any-link{
	text-decoration: none;
	color: #fff;
	text-shadow: 1px 1px 0px rgba(0, 0, 0, .5);
}

body > header > nav.menu a:hover{
	background: rgba(255, 255, 255, .25);
}

.star-button{
	z-index: 1;
	position: relative;
}

.star-button::before{
	content: "✨";
	margin-right: .5rem;
}

.hidden{
	display: none;
}

body > main{
	display: flex;
	flex-direction: column;
	padding: var(--main-padding);
}

body > main > section{
	width: 100%;
	max-width: var(--main-width);
	margin: 0 auto;
}

body > footer{
	margin: auto;
	margin-top: 2rem;
	padding: 2rem 0;
	text-align: center;
	border-top: 1px dashed #222;
	width: 100%;
	max-width: var(--main-width);
}

body > footer > ul{
	font-size: 1rem;
}

body > footer > ul > li{
	display: inline-block;
}

body > footer > ul > li p{
	display: inline;
}

body > footer > ul > li + li::before{
	content: "•";
	margin: 1rem;
}

body > footer a:any-link{
	color: #222;
}

h1{
	color: #392845;
	font-size: 3rem;
	margin: 2rem 0;
}

h2{
	color: #392845;
	margin-top: 4rem;
	margin-bottom: 2rem;
	font-size: 2.3rem;
}

h3{
	margin-top: 4rem;
	margin-bottom: 1rem;
	font-size: 1.8rem;
}

h2 + p{
	margin-top: 1rem;
}

form > h2{
	margin-bottom: 0;
}

summary{
	cursor: pointer;
}

a.button,
button{
	border-radius: .5rem;
	padding: 1rem 2rem;
	background: #392845;
	color: #fff;
	border: 1px solid rgba(0, 0, 0, .75);
	box-shadow: 	2px 2px 2px rgba(0, 0, 0, .5),
			-2px -2px 0 rgba(0, 0, 0, .4) inset,
			2px 2px 0 rgba(255, 255, 255, .2) inset;
	position: relative;
	font-size: 1.2rem;
	text-transform: lowercase;
	font-family: sans-serif;
	cursor: pointer;
	font-weight: bold;
	text-decoration: none;
	white-space: nowrap;
	text-shadow: 1px 1px 0px #000;
	line-height: 1;
	display: inline-block;
	transition: background-color .25s ease-out;
}

a.button:focus,
button:focus,
a:focus{
	outline: 1px dashed #222;
}

a.button:hover,
button:hover{
	background: #6a517c;
	transition: none;
}

a.button:active,
button:active{
	top: 2px;
	right: -2px;
	box-shadow: none;
}

p,
li,
blockquote{
	line-height: 1.5;
}

p + p,
p + ul,
p + ol,
ul + p,
ol + p,
li + li{
	margin-top: 1rem;
}

ul.error{
	background: tomato;
	border: 2px solid rgba(0, 0, 0, .5);
	padding: 1rem 2rem;
}

ul.error li{
	margin-left: 1rem;
}

ul.error a:any-link{
	color: #fff;
}

.empty-notice{
	font-style: italic;
	text-align: center;
}

label > span,
div.super-label > span{
	display: block;
	font-weight: bold;
}

form{
	display: flex;
	flex-direction: column;
	gap: 2rem;
	margin-top: 1rem;
}

form > footer{
	display: flex;
	justify-content: flex-end;
}

form > p + p,
form > h2 + p{
	margin: 0;
}

main > section > nav.menu{
	font-style: italic;
}

input::placeholder,
textarea::placeholder{
	font-style: italic;
	color: #666;
}

select{
	cursor: pointer;
}

label{
	display: block;
}

label:has(select){
	position: relative;
}

label:has(select)::after{
	height: 1rem;
	width: 1rem;
	background: center center url("/images/chevron-down.svg");
	background-size: cover;
	content: "";
	position: absolute;
	right: 1rem;
	opacity: .5;
	top: calc(50% - 1rem / 2 + 1px);
	pointer-events: none;
	transition: opacity .25s;
}

label:has(select):has(span)::after{
	top: calc(50% + 1px);
}

label:has(select):hover::after{
	opacity: 1;
	transition: none;
}

select,
textarea,
input{
	font-size: 1.2rem;
}

label:has(input[type="checkbox"]),
label:has(input[type="radio"]){
	display: inline-flex;
	cursor: pointer;
	padding: 1rem 0;
	border-radius: 5px;
	border: 1px solid transparent;
}

label:has(input[type="checkbox"]) > span,
label:has(input[type="radio"]) > span{
	font-weight: normal;
	margin-left: .5rem;
}

select,
textarea,
input:not([type="radio"]):not([type="checkbox"]){
	-webkit-appearance: none;
	appearance: none;
	box-sizing: border-box;
	width: 100%;
	background: #fff;
	border-radius: 5px;
	border: 1px solid #222;
	display: flex;
	align-items: center;
	padding: 1rem;
	line-height: 1.4;
	box-shadow: 1px 1px 0 rgba(255, 255, 255, .5) inset, 2px 2px 4px rgba(0, 0, 0, .25);
	outline: 1px dashed transparent;
	transition: outline 200ms ease;
}

select{
	padding-right: 3rem;
}

select:focus,
textarea:focus,
input:not(input[type="radio"]):not(input[type="checkbox"]):focus,
label:has(input[type="radio"]:focus),
label:has(input[type="checkbox"]:focus){
	outline: 1px dashed #222;
	transition: none;
}

input:not(input[type="radio"]):not(input[type="checkbox"]):user-invalid,
label:has(input[type="radio"]:user-invalid),
label:has(input[type="checkbox"]:user-invalid),
textarea:user-invalid{
	border-color: tomato;
	box-shadow: 1px 1px 0 #ff0000, -1px -1px 0 tomato;
}

.message{
	padding: 1rem;
	border: 5px solid rgba(0, 0, 0, .05);
	margin: 1rem 0;
}

.message.success,
.message.error{
	color: #fff;
	text-shadow: 1px 1px 0 #000;
}

.message.success{
	background: #3cb371;
}

.message.error{
	background: #950b0b;
}

.message.goal-met{
	background: #f8cb5c;;
	color: #222;
	text-shadow: 1px 1px 0 rgba(255, 255, 255, .75);
}

ul.message.error:has(li:only-child) li{
	list-style: none;
	margin: 0;
}

label:has(select[disabled]),
label:has(select[disabled]) select{
	color: #aaa;
}

label[data-controls-next] + label{
	margin-left: 2rem;
}

.navigation-footer{
	display: flex;
	flex-wrap: wrap;
	gap: 2rem;
}

ul.badges{
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 4rem 2rem;
	list-style: none;
}

ul.badges > li{
	text-align: center;
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
}

ul.badges > li > img,
ul.badges > li > div.level{
	height: 150px;
	width: 150px;
	filter: drop-shadow(4px 4px 2.5px rgba(0, 0, 0, .4));
}

ul.badges > li p{
	width: 100%;
}

ul.badges > li > div.level{
	position: absolute;
}

ul.badges > li.in-progress > div.level{
	filter: drop-shadow(4px 4px 2.5px rgba(0, 0, 0, .4)) grayscale(1) blur(5px) opacity(.5);
}

ul.badges > li > div.level-2{
	background: center / contain image-set(url("/images/banner.png") 1x, url("/images/banner@2x.png") 2x);
	z-index: -2
}

ul.badges > li > div.level-3{
	background: center / contain image-set(url("/images/laurels.png") 1x, url("/images/laurels@2x.png") 2x);
	z-index: 1
}

ul.badges > li > div.level-4{
	background: center / contain image-set(url("/images/stars.png") 1x, url("/images/stars@2x.png") 2x);
	z-index: 2;
}

ul.badges > li > div.level-5{
	background: center / contain image-set(url("/images/wings.png") 1x, url("/images/wings@2x.png") 2x);
	z-index: -1;
}

ul.badges li + li{
	margin-top: 0;
}

ul.badges > li p.name ~ p{
	margin-top: .5rem;
}

ul.badges > li div.description{
	margin-top: 1rem;
	display: flex;
	flex-direction: column;
	height: 100%;
}

ul.badges > li div.description div.progress{
	margin-top: auto;
}

ul.badges > li p.description,
ul.badges > li p.earned-at{
	font-style: italic;
}

ul.badges > li.in-progress img{
	filter: drop-shadow(4px 4px 2.5px rgba(0, 0, 0, .4)) grayscale(1) blur(5px) opacity(.5);
}

ul.badges > li.in-progress p.name{
	filter: blur(3px);
}

ul.badges > li.in-progress div.level + .description p.name{
	filter: none;
}

ul.badges .count,
ul.badges .level{
	font-weight: bold;
}

/* The progress bar container. */
progress,
progress::-webkit-progress-bar{
	-webkit-appearance: none;
	appearance: none;
	border: 1px solid #222;
	background: transparent;
	border-radius: 3px;
	height: 1rem;
}

/* The actual progress value. */
/* Firefox doesn't support animating progress bars. */
progress::-webkit-progress-value{
	transition: all 1s ease;
	background-color: #392845;
}

/* The actual progress value. */
/* Firefox doesn't support animating progress bars. */
progress::-moz-progress-bar{
	transition: all 1s ease;
	background-color: #392845;
}

ul.badges.notification{
	position: sticky;
	left: calc(50vw + (var(--main-width) / 2) + 4rem);
	right: auto;
	top: 2rem;
	height: 0;
	z-index: 100;
	box-sizing: border-box;
	grid-template-columns: 1fr;
	align-self: flex-start;
	width: 20rem;
	gap: 0; /* We can't use a gap because we can't animate it when sliding up. */
}

ul.badges.notification .earned-at,
ul.badges.notification .count,
ul.badges.notification .name{
	display: none;
}

ul.badges.notification > li > img,
ul.badges.notification > li > div.level{
	height: 100px;
	width: 100px;
}

/* Select the last `div.level` in a notification that doesn't have the `.bright-in` or `.spin-out` class. */
ul.badges.notification > li > div.level:nth-last-child(1 of .level):not(.bright-in):not(.spin-out){
	display: none;
}

ul.badges.notification > li > div.level.bright-in{
	animation: bright-in 1s ease-out;
}

ul.badges.notification > li{
	visibility: hidden; /* Instead of `display: none`, so they have dimensions we can use to calculate before animating. */
	transition: height .5s ease;
}

ul.badges.notification > li p.name + p.description,
ul.badges.notification > li p.name + p.level{
	margin-top: 0;
}

ul.badges + ul.badges{
	margin-top: 2rem;
}

nav.calendar{
	margin-top: 1rem;
	display: flex;
	justify-content: space-between;
}

nav.calendar a[rel="prev"]{
	margin-right: auto;
}

nav.calendar a[rel="prev"]::before{
	content: "← ";
}

nav.calendar a[rel="next"]{
	margin-left: auto;
}

nav.calendar a[rel="next"]::after{
	content: " →";
}

.fade-in{
	animation: fade-in .5s ease-out;
}

.fade-out{
	animation: fade-out .5s ease-in;
}

.pop-in{
	animation: pop-in .5s;
}

.spin-out{
	animation: spin-out .5s ease-in;
}

@keyframes fade-in{
	0%{
		opacity: 0;
	}
	100%{
		opacity: 1;
	}
}

@keyframes fade-out{
	0%{
		opacity: 1;
	}
	100%{
		opacity: 0;
	}
}

@keyframes pop-in{
	0%{
		transform: scale(0) rotate(-20deg);
		opacity: 0;
	}
	60%{
		transform: scale(1.25) rotate(5deg);
	}
	80%{
		transform: scale(0.8) rotate(-5deg);
		opacity: 1;
	}
	100%{
		transform: scale(1) rotate(0deg);
	}
}

@keyframes spin-out{
	0%{
		transform: scale(1) rotate(0);
		opacity: 1;
	}
	100%{
		transform: scale(0) rotate(-180deg);
		opacity: 0;
	}
}

@keyframes bright-in{
	0%{
		filter: brightness(1000%);
		transform: scale(1.5);
	}
	80%{
		filter: brightness(1);
		transform: scale(.95);
	}
	90%{
		transform: scale(1.05);
	}
	100%{
		transform: scale(1);
	}
}

@media(max-width: 1300px){
	ul.badges.notification p{
		display: none;
	}
}

@media(max-width: 800px){
	ul.badges{
		grid-template-columns: 50% 50%;
	}
}

@media(max-width: 1650px){
	ul.badges.notification{
		width: 10rem;
	}
}

@media(max-width: 920px){
	body > header ul.stats{
		display: none;
	}

	body > header .button{
		margin-left: auto;
	}

	h1,
	button,
	a.button{
		overflow-wrap: break-word;
		word-break: break-word;
		hyphens: auto;
	}
}

@media(max-width: 560px){
	:root{
		--header-height: 90px;
	}

	button{
		white-space: normal;
	}

	ul.badges > li > img,
	ul.badges > li > div.level{
		height: 150px;
		width: 150px;
	}

	ul.badges{
		grid-template-columns: 100%;
	}

	body > header{
		padding: 1rem;
		justify-content: flex-end;
	}

	body > header a.logo{
		height: calc(var(--logo-image-height) * .5);
		width: calc(var(--logo-image-width) * .5);
		position: absolute;
		left: 50%;
		transform: translateX(calc(-50% - 10px));
	}

	body > header a.star-button{
		display: none;
	}
}

@media(max-width: 340px){
	body > header a.logo{
		position: static;
		margin-right: auto;
		transform: none;
	}
}
