* {
  box-sizing: border-box;
}

:root {
  --header-height: clamp(4vh, 60px, 8vh);
  --gap-size: clamp(2vw, 30px, 5vw);
  --border-grey: #444444;
  --darker-grey: #222222;
  --nav-grey: #aaaaaa;
  --nav-grey-active: #dddddd;
  --white-grey: #f0f0f0;
  --accent-red: #992222;
  --box-background: #0f0f0f;
  --text-colour: #d5d5d5;
  --bold-colour: #e5e5e5;
  --link-colour: #aa6666;
}

html {
  overflow-x: clip;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: system-ui, sans-serif;
  background: var(--darker-grey);
  background: url("Images/background.png") repeat top left;
  color: var(--nav-grey);  
  margin: 0;
  overflow-x: hidden;
  font-size: clamp(1.1vw, 1rem, 3vw);
}

h2 {
	margin-bottom: calc(var(--gap-size) * 0.5);
	padding: 0 calc(var(--gap-size) * 0.5);
  font-size: clamp(1.6vw, 1.6rem, 5vw);
  line-height: 1;
  text-align: center;
  font-weight: 500;
  margin-top: 0;
  color: var(--text-colour);
}

h2 a {
	color: var(--text-colour);
	text-decoration: none;
}

h3 {
  font-size: clamp(1.2vw, 1.2rem, 4vw);
	font-weight: 500;
	text-decoration: underline;
	color: var(--bold-colour);
	margin-top: 0;
	text-underline-offset: 0.3em;
}

h4 {
  font-size: clamp(1.4vw, 1.4rem, 4vw);
	font-weight: 500;
	color: var(--bold-colour);
	margin-top: 0;
	margin-bottom: calc(var(--gap-size) * 0.4);
}

b {
	color: var(--bold-colour);
}

a {
  color: var(--link-colour);
  text-decoration: none;
}

a:visited {
  color: var(--link-colour);
}

a:hover {
  text-decoration: underline;
}

a:active {
  color: var(--link-colour);
}

kbd {
  display: inline;
  border: 1px solid var(--border-grey);
  padding: 0 0.3em;
  border-radius: 3px;
}

p {
	line-height: 1.5;
	color: var(--text-colour);
}


/* Page header bar */

.site-header {
  height: var(--header-height);
  width: 100vw;
  display: flex;
  align-items: center;
  background: black;
  border-bottom: 1px solid var(--border-grey);
  padding: 0 var(--gap-size);
}

.site-nav {
  margin-left: auto;
  height: 100%;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  width: max-content;
  align-items: stretch;
}

.nav-link, .nav-link:visited {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0 calc(var(--gap-size) * 0.4);
  color: var(--nav-grey);
  text-decoration: none;
  font-size: clamp(1.1vw, 1.2rem, 3vw);
  font-weight: 500;
	text-shadow: 1px 1px 0 var(--accent-red);
	white-space: nowrap;
}

.nav-link img {
	filter: brightness(0.85) saturate(0.7);
}

.nav-link:hover {
  color: var(--nav-grey-active);
}

.nav-link:hover img {
	filter: brightness(1) saturate(1);
}

.nav-link.active {
	color: var(--nav-grey-active);
	box-shadow: 0 2px 0 var(--accent-red);
}

.site-logo {
  display: block;
  height: calc(var(--header-height) * 0.42);
  width: auto;
}


/* Page footer bar */

.site-footer {
  margin-top: auto;
  height: var(--header-height);
  display: flex;
  justify-content: center;
  background: black;
  border-top: 1px solid var(--border-grey);
  overflow: hidden;
  padding: 0 var(--gap-size);
}

.foot-nav {
  height: 100%;
  display: flex;
  justify-content: center;
}

.foot-icon {
  height: 100%;
  padding: 0 calc(var(--gap-size) * 0.6) 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.foot-icon img {
  display: block;
  height: calc(var(--header-height) * 0.25);
  width: auto;
  filter: brightness(0.7) saturate(0.2);
}

.foot-icon:hover img {
  filter: brightness(1) saturate(1);
}


/* General purpose content boxes */

.content-box {
  width: 80%;
  padding: calc(var(--gap-size) * 0.6);
  background: var(--box-background);
  align-items: center;
  margin: var(--gap-size) auto 0;
  border-radius: 6px;
}

.invisible-box {
	width: 100%;
	padding: 0;
	margin: 0 auto;
}

.welcome-box {
  width: 80%;
  padding: calc(var(--gap-size) * 0.7);
  background: var(--box-background);
  align-items: center;
  margin: var(--gap-size) auto 0;
  border-radius: 6px;
  font-size: clamp(1vw, 1.4rem, 2.5vw);;
  text-align: center;
}

.spacer {
  height: var(--gap-size);
}

.header-spacer {
  height: var(--header-height);
}

/* Headings with the faffy thing on either side */

.header-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: calc(var(--gap-size) * 0.8);
}

.header-decoration {
  position: relative;
  min-width: 0;
  overflow: hidden;
  margin-bottom: calc(var(--gap-size) * 0.2);
}

.header-decoration img {
  position: absolute;
  top: 0;
  height: 100%;
  width: clamp(100px, 35%, 500px);
  display: block;
  filter: brightness(0.5);
}

.header-decoration.left img {
  right: 0;
}

.header-decoration.right img {
  left: 0;
}

.line {
	color: var(--darker-grey);
	width: 100%;
}


/* Home page stuffs */

.two-column-grid {
	width: 80%;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--gap-size);
	margin: var(--gap-size) auto var(--gap-size);
	place-items: center;
}

.image-box {
  width: 100%;
  height: auto;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: black;
  display: flex;
  align-items: center;
  justify-content: center; 
  border-radius: 8px;
  aspect-ratio: 3 / 1;
}

.image-box, .image-box:visited, .image-box:hover, .image-box:active {
	text-decoration: none;
}

.image-box:hover h2 {
	text-shadow: -2px -2px 3px black, 2px 2px 3px black;
}

.image-box-f {
	background-image: url("Images/fractalbg2.png");
}

.image-box-f:hover{
	background-image: url("Images/fractalbg.png");
}

.image-box-m {
	background-image: url("Images/metronomebg2.png");
}

.image-box-m:hover{
	background-image: url("Images/metronomebg.png");
}

.image-box-a {
	background-image: url("Images/nickbg2.png");
}

.image-box-a:hover{
	background-image: url("Images/nickbg.png");
}

.image-box-p {
	background-image: url("Images/beatopiabg2.png");
}

.image-box-p:hover{
	background-image: url("Images/beatopiabg.png");
}


/* About page stuffs */

.main-side-grid {
	width: 90%;
	display: grid;
	grid-template-columns: 3fr 1fr;
	gap: var(--gap-size);
	margin: var(--gap-size) auto 0;
}

.about-box {
  width: 100%;
  padding: calc(var(--gap-size) * 0.6);
  background: var(--box-background);
  align-items: center;
  margin: 0px auto var(--gap-size);
  border-radius: 6px;
}

.about-image {
  width: 100%;
  height: auto;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center; 
  border-radius: 6px; 
  margin-bottom: var(--gap-size);
}

.tool-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.tool-list li {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.tool-icon {
  width: 1.25em;
  height: 1.25em;
  object-fit: contain;
  flex: 0 0 auto;
}


/* Projects page stuffs */

.project-inner {
  width: 100%;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-size);
  align-items: start;
}

.project-text {
  padding: calc(var(--gap-size) * 0.2);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
}

.project-text h2 {
  margin-top: 0;
  text-align: left;
}

.project-text a {
  margin-top: auto;
  color: var(--white-grey);
  text-decoration: underline;
  text-underline-offset: 5px;
}

.project-text a.header-link {
  color: inherit;
  text-decoration: none;
}

.project-text a.header-link:hover {
  color: inherit;
  text-decoration: underline;
}

.video-embed {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 6px;
  overflow: hidden;
  margin: auto;
  align-items: center;
}

.video-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.projects-image {
  width: 100%;
  height: auto;
  border: 0;
}

/* Project pages second level*/

.page-video iframe {
  display: block;
  width: 70%;
  aspect-ratio: 16 / 9;
  height: auto;
  margin: 0 auto;
  border-radius: 6px;
  border: 0;
}

.content-box h2 a {
	font-size: clamp(1.6vw, 1.6rem, 4vw);
  color: inherit;
  text-decoration: none;
}

.content-box h2 a:hover {
  color: inherit;
  text-decoration: underline;
}

.links-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: calc(var(--gap-size) * 0.4);
  padding-top: calc(var(--gap-size) * 0.6)
}

.links-grid h2 a {
	 font-size: clamp(1.3vw, 1.3rem, 2vw);
	 white-space: nowrap;
}

.left {
	text-align: left;
}

.right {
	text-align: right;
}

/* Fractal explorer help page */
.help-page [id] {
  scroll-margin-top: var(--header-height);
}

.fractal-header {
  height: var(--header-height);
  width: 100vw;
  display: flex;
  align-items: center;
  position: fixed;
  background: black;
  border-bottom: 1px solid var(--border-grey);
  padding: 0 var(--gap-size);
  z-index: 10;
}

.fractal-header .nav-link {
	font-size: clamp(1.1vw, 1.2rem, 1.4vw);
	text-shadow: none;
}

.control-box {
  position: fixed;
  top: calc(var(--header-height) + var(--gap-size));
  right: 5vw;
  width: calc((90vw - var(--gap-size)) / 4);
  max-height: calc(100vh - (var(--header-height) + var(--gap-size)));
  overflow-y: auto;
  font-size: clamp(1.1vw, 1rem, 1.4vw);
}

.control-box .about-box  {
	  margin-bottom: 0;
}

.controls-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.controls-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  gap: 0.6rem;
}


/* Contact page stuffs */

.contact-form {
  width: clamp(40vw, 100%, 700px);
  margin: calc(var(--gap-size) * 0.5) auto calc(var(--gap-size) * 0.2);
}

.form-group {
  margin-bottom: calc(var(--gap-size) * 0.5);
}

.form-group label {
  display: block;
  margin-bottom: calc(var(--gap-size) * 0.3);
  font-weight: bold;
}

.contact-form input,
.contact-form textarea {
  box-sizing: border-box;
  width: 100%;
  padding: calc(var(--gap-size) * 0.4);
  font: inherit;
  color: inherit;
  border: 0;
	border-radius: 4px;
  background: var(--darker-grey);
  outline: 1px solid var(--border-grey);
}

.contact-form textarea {
  min-height: 30vh;
  resize: vertical;
}

.contact-submit {
  padding: calc(var(--gap-size) * 0.4);
  font: inherit;
  font-weight: bold;
  background: var(--darker-grey);
  cursor: pointer;
  border: 1px solid var(--border-grey);
  border-radius: 4px;
  color: inherit;
}

.contact-submit:hover {
  background: var(--border-grey);
  color: var(--nav-grey-active);
}


/*
  Honeypot field for spambots.

  This technique hides the field visually without using display: none,
  which some spambots may detect and ignore.
*/
.hidden-field {
  position: absolute;
  overflow: hidden;
  clip: rect(0 0 0 0);
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
}



/* Mobile stuffs */


@media (max-width: 700px) {

  .two-column-grid {
    grid-template-columns: 1fr;
  }
  
  .main-side-grid {
	grid-template-columns: 1fr;
	}
	
	.about-image {
	display: none;
	}
	
	.project-inner {
  grid-template-columns: 1fr;
	}
	
	.control-box {
	  position: static;
	  top: auto;
	  right: auto;
	  width: 100%;
	  max-height: none;
	  font-size: clamp(1.1vw, 1rem, 3vw);
	}
	
	.foot-icon img {
	  height: auto;
	  width: 8vw;
	}
	
	.control-box .about-box  {
	  margin-bottom: var(--gap-size);
	}
}

