@import url("https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700;900&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&display=swap");
@import url("https://fonts.googleapis.com/icon?family=Material+Icons");

:root,
[data-theme="dark"] {
  /* https://www.schemecolor.com/halloween-gradient.php */
  --halloween-1: #eb6122;
  --halloween-2: #c9532c;
  --halloween-3: #a84535;
  --halloween-4: #86383f;
  --halloween-5: #652a48;
  --halloween-6: #431c52;

  --halloween-bg-1: #380a45;
  --halloween-bg-2: #4d0b2d;

  --halloween-bg-darker-1: #593124;
  --halloween-bg-darker-2: #421c2f;

  --halloween-bg-darker-1-triplet: 89, 49, 36;
  --halloween-bg-darker-2-triplet: 66, 28, 47;

  --color: #f2f2f2;
  --h1-color: #ffffff;
  --h2-color: var(--h1-color);
  --h3-color: var(--h1-color);
  --h4-color: var(--h1-color);
  --h5-color: var(--h1-color);
  --h6-color: var(--h1-color);
  --muted-color: #bfbfbf;
  --background-color: #421c2f;
  --primary: var(--halloween-1);
  --primary-hover: var(--halloween-2);
  --secondary: var(--halloween-6);
  --secondary-hover: var(--halloween-5);

  --font-family: "Lato", sans-serif;
  --nav-height: 3rem;
  --sep-height: 1.5px;
}

:where(:root) {
  background: none !important;
}

body {
  --font-size: 1em;
  position: relative;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  --font-family: "Poppins", sans-serif;
}

h1 {
  font-size: 3.5em;
}

h2 {
  font-size: 2.5em;
}

h3 {
  font-size: 2em;
}

ul,
ol,
ul li,
ol li {
  list-style: none;
  padding: 0;
}

ul li,
ol li {
  margin-bottom: 1em;
}

ul li::before,
ol li::before {
  content: "";
}

ul li strong,
ol li strong {
  line-height: 1.5;
  font-size: 1.15em;
}

nav ol:last-of-type,
nav ul:last-of-type,
nav ol:first-of-type,
nav ul:first-of-type {
  margin: 0;
}

footer {
  padding: 1em 0;
  border-top: var(--sep-height) solid rgba(255, 255, 255, 0.15);

  font-size: 0.8em;

  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

@media (max-width: 576px) {
  footer {
    flex-direction: column;
    align-items: center;
  }
}

#floating-background {
  z-index: -2;

  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;

  width: 100vw;
  height: 100vh;

  background-color: var(--background-color);
  background-image: linear-gradient(
    to bottom,
    var(--halloween-bg-1) 0%,
    var(--halloween-bg-2) 100%
  );
}

.inline-icon,
.inline-emoji {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  margin: 0 0.05em 0 0.1em;
  vertical-align: -0.25em;
}

.inline-icon {
  filter: invert(1);
}

/*
 * Parallax effect
 * https://keithclark.co.uk/articles/pure-css-parallax-websites/
 */

.perspective {
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100);

  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) - var(--sep-height));
}

.perspective:not(.apple-sucks) {
  --perspective: 1;
  perspective: calc(var(--perspective) * 1px);
  perspective-origin: 0 0;

  overflow-x: hidden;
  overflow-y: auto;
}

.perspective-buffer {
  z-index: 5;
  transform-style: preserve-3d;
}

#bg-top-bat1,
#bg-top-bat2,
#bg-top-moon {
  --x-translate: 0%;
  --y-translate: 0%;
  --z-translate: 0;

  z-index: -1;

  position: absolute;
  top: 0;
  right: calc(var(--z-translate) * (95% - var(--width)));
  width: var(--width);

  transform: translateZ(calc(var(--z-translate) * 1px))
    scale(calc((var(--perspective) - var(--z-translate)) / var(--perspective)));
  transform-origin: 0 0;
  transform-style: preserve-3d;

  pointer-events: none;
}

#bg-top-moon {
  --x-translate: 1000%;
  --z-translate: -16;
  --width: min(60%, 1000px);

  opacity: 0.85;
  filter: drop-shadow(0 0 5vw rgba(255, 255, 255, 0.35));
}

#bg-top-bat1,
#bg-top-bat2 {
  --x-translate: 200%;
  --z-translate: -4;
  --width: min(60%, 800px);

  opacity: 0.55;
  animation-duration: 4s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

#bg-top-bat1 {
  animation-name: bat1;
}

#bg-top-bat2 {
  animation-name: bat2;
  top: -350px;
}

@keyframes bat1 {
  0% {
    top: 0;
  }
  50% {
    top: 50px;
  }
  100% {
    top: 0;
  }
}

@keyframes bat2 {
  0% {
    top: -350px;
  }
  50% {
    top: -150px;
  }
  100% {
    top: -350px;
  }
}

#bg-bottom {
  --z-translate: -1;

  z-index: -1;
  opacity: 1;

  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: inherit;

  transform: translateZ(calc(var(--z-translate) * 1px))
    scale(calc((var(--perspective) - var(--z-translate)) / var(--perspective)));
  transform-origin: 0 0;
  transform-style: preserve-3d;

  overflow: clip;
  pointer-events: none;
}

#bg-bottom img {
  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: left;
}

#bg-bottom div {
  background-color: black;
  margin-top: -2px; /* fix SVG artifact */
  height: 9999px;
}

@media (min-width: 1200px) {
  .container {
    max-width: 860px;
  }
}

@media (min-width: 992px) {
  .container {
    max-width: 860px;
  }
}

span.halloween {
  color: var(--halloween-1);
}

#header > * {
  margin: 0;
}

.whole-page {
  --percentage: 100;
  min-height: calc(var(--percentage) * 1%);

  display: flex;
  flex-direction: column;
  justify-content: center;
}

section + div.container {
  max-width: 400px;
}

section + div.container > hr {
  margin: 0 calc(var(--spacing) / 4);
  border-top: var(--sep-height) solid rgba(255, 255, 255, 0.15);
}

section h2 {
  margin: 0;
  margin-bottom: var(--spacing);
}

section h2 a[href^="#"] {
  color: inherit;
  text-decoration: none;
}

section.qrcode-promo {
  display: flex;
  flex-direction: column;
  gap: var(--spacing);

  align-items: center;
  text-align: center;

  width: 100%;
  max-width: 600px;
}

section.qrcode-promo > h2 {
  margin: 0;
  line-height: 1; /* keeps spacing consistent */
}

section.qrcode-promo > p.links {
  font-size: 1.2em;
}

section.qrcode-promo > p.links .material-icons {
  font-size: 1.35em;
  vertical-align: sub;
}

section.qrcode-promo > *:not(:first-child) {
  margin: 0;
}

#about {
  position: relative;
  margin-top: 0;
  margin-bottom: 0;
}

#about > *:not(#floating-background) {
  z-index: 2;
}

#about h1 {
  font-size: clamp(3em, 10vw, 6em);
  line-height: 1;
}

#about header,
#about .intro p {
  margin-bottom: 2em;
}

#about .intro {
  font-size: 1.1em;
}

#about table {
  width: 100%;
  max-width: max-content;
  box-shadow: 0 0 32px -12px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}

#about table td {
  padding: calc(var(--spacing) / 2) calc(var(--spacing) / 1.5);
  border-bottom: 0;
}

#about table td:nth-child(1) {
  width: 6ch;
  font-weight: 600;
  background-color: rgba(var(--halloween-bg-darker-1-triplet), 0.85);
}

#about table td:nth-child(2) {
  background-color: rgba(var(--halloween-bg-darker-2-triplet), 0.85);
}

#about + div {
  box-shadow: 0 0 52px -12px rgba(0, 0, 0, 0.5) inset;

  background-color: var(--background-color);
  background-image: linear-gradient(
    to bottom,
    var(--halloween-bg-darker-1) 0%,
    var(--halloween-bg-darker-2) 100%
  );

  display: flex;
  flex-direction: column;
}

div.content {
  transform-style: flat; /* required for sticky positioning?? */
}

div.content > section {
  padding-top: calc(var(--block-spacing-vertical));
  padding-bottom: calc(var(--block-spacing-vertical));

  margin-top: 0;
  margin-bottom: 0;
}

div.content > section h2 {
  text-align: center;
}

div.content > section:target h2 {
  text-decoration: underline;
}

#move-down {
  filter: invert(1);

  position: absolute;
  bottom: 0;
  left: 0;

  width: 100%;
  height: 5em;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#toc {
  --background-color: var(--halloween-6);
  /* --background-color: #2e1e19; */

  background-color: var(--background-color);
  box-shadow: 0 4px 8px -4px rgba(0, 0, 0, 0.25);

  position: sticky;
  top: -1px;
  z-index: 10;

  padding: 0 1rem;
  margin: 0;

  transition: background-color 200ms ease-in-out;
}

#toc nav {
  max-width: 1000px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  padding: 0;
  margin: 0 auto;
}

#toc nav h4 {
  pointer-events: none; /* forbid clicking */
}

#toc nav h4 .expand-more {
  font-size: 0;
}

#toc nav ol {
  display: flex;
  flex-direction: row;
}

#toc nav h4,
#toc nav ol li {
  height: 100%;
  display: flex;
  justify-content: center;
  flex-direction: row;
  padding: 0;
  margin: 0;
}

#toc nav ol li:before {
  border-left: 1px solid #fff7;
  align-self: center;
}

#toc nav a {
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-radius: 0;

  display: flex;
  flex-direction: row;
  align-items: center;

  background-color: transparent;
}

#toc nav a:hover,
#toc nav a:focus,
#toc nav a:target {
  background-color: var(--secondary-focus);
}

@media (max-width: 700px) {
  #toc {
    max-width: 100%;
    padding: 0;
  }

  #toc nav {
    height: 3rem;
    flex-direction: column;
    position: relative;
  }

  #toc nav a {
    width: 100%;
    text-align: center;
  }

  #toc nav h4 {
    pointer-events: auto;
  }

  #toc nav h4 .expand-more {
    font-size: 1.5rem;
    margin-right: calc(var(--spacing) / 4);
  }

  #toc nav ol {
    flex-direction: column;
    align-items: stretch;
    background-color: var(--background-color);

    overflow: hidden;
    position: absolute;
    top: 100%;
    left: 0;

    max-height: 0;
    transition: max-height 200ms ease-in-out;
  }

  #toc:target nav ol {
    max-height: 50vh;
  }

  #toc nav ol li {
    justify-content: flex-start;
  }

  #toc nav ol,
  #toc nav ol li a {
    width: 100%;
  }
}

#scoring {
  --color-1: #e78284;
  --color-2: #ef9f76;
  --color-3: #a6d189;
  --color-4: #f4b8e4;
  --color-5: #99d1db;
}

#scoring li:nth-child(1) strong,
#scoring li:nth-child(1) span.tip {
  color: var(--color-1);
}

#scoring li:nth-child(2) strong,
#scoring li:nth-child(2) span.tip {
  color: var(--color-2);
}

#scoring li:nth-child(3) strong,
#scoring li:nth-child(3) span.tip {
  color: var(--color-3);
}

#scoring li:nth-child(4) strong,
#scoring li:nth-child(4) span.tip {
  color: var(--color-4);
}

#scoring li:nth-child(5) strong,
#scoring li:nth-child(5) span.tip {
  color: var(--color-5);
}

#scoring li span.tip {
  filter: contrast(0.35) brightness(1.35);
  font-size: 0.9em;
  margin-top: calc(var(--spacing) / 4);

  display: flex;
}

#scoring ul li {
  display: flex;
  flex-direction: column;
}

#scoring ul li strong {
  display: flex;
}

#scoring span.weight {
  margin-left: auto;
  padding: 0 calc(var(--spacing) / 2);
}

#scoring .tip::before {
  content: "💡";
  margin: 0 calc(var(--spacing) / 4);
}

#prizes {
  --1st-place: #f0c674;
  --2nd-place: #c5c8c6;
  --3rd-place: #de935f;
}

#prizes ol {
  width: 100%;
  max-width: max-content;
  margin: auto;
}

#prizes ol li:nth-child(1) strong {
  color: var(--1st-place);
}

#prizes ol li:nth-child(2) strong {
  color: var(--2nd-place);
}

#prizes ol li:nth-child(3) strong {
  color: var(--3rd-place);
}

#prizes ol li {
  display: flex;
  flex-direction: column;
}

#prizes ol li ul {
  margin-top: 0;
}

#prizes ol li ul,
#prizes ol li ul li {
  padding-left: calc(var(--spacing));
  margin-bottom: calc(var(--spacing) / 4);
}

#prizes ol li ul li {
  display: flex;
  flex-direction: row;
}

#prizes ol li ul li::before {
  content: "•";
  margin-right: calc(var(--spacing) / 2);
}

#judges {
  max-width: 950px;
  padding-left: var(--block-spacing-horizontal);
  padding-right: var(--block-spacing-horizontal);
}

#judges ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;

  gap: calc(var(--block-spacing-vertical));
  margin-top: calc(var(--block-spacing-vertical));
  margin-bottom: calc(var(--block-spacing-vertical));

  font-size: 1.1em;
  font-weight: bold;
}

#judges img.board-avatar {
  width: min(200px, 50vw);
  margin-bottom: calc(var(--spacing) / 2);
}

#judges ul li {
  display: flex;
  flex-direction: column;

  align-items: center;
  text-align: center;

  white-space: nowrap;
  margin-bottom: 0;
}

#judges .acm-general {
  color: rgb(5, 163, 255);
}

#judges .acm-ai {
  color: rgb(53, 231, 146);
}

#judges .acm-algo {
  color: rgb(157, 53, 231);
}

#judges .acm-design {
  color: rgb(255, 67, 101);
}

#judges .acm-dev {
  color: rgb(30, 108, 255);
}

#judges .acm-gamedev {
  color: rgb(212, 17, 83);
}

#judges .acm-oss {
  color: rgb(17, 212, 177);
}

#faq h2 {
  margin-bottom: var(--spacing);
}

#contact p {
  font-size: 1.1em;
}
