@font-face {
  font-family: pixel;
  src: url(../fonts/bbt.ttf) format("truetype");
}

* {
  box-sizing: border-box;
}

html, body {
  background: #000;
  font-family: pixel;
  color: #fff;
  margin: 0;
}

.container {
  max-width: 1120px;
  margin: 32px auto;
  padding: 0 16px;
}

.pixelbox {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 16px solid transparent;
  border-image: url(../images/border_img.png) 16 round;
  padding: 16px;
  box-sizing: border-box;
}

.top {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-inner {
  width: 96px;
  height: 96px;
  background-image: url(../images/logo-gray.png);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: 50%;
  image-rendering: pixelated;
}

.logo-inner:hover {
  background-image: url(../images/logo-color.png);
}

.desc {
  font-size: 22px;
  text-align: center;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.main-ui {
  display: grid;
  grid-template-columns: 300px 1fr;
  align-items: start;
  gap: 16px;
  margin: 0 auto;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.box-heading {
  font-family: pixel;
  font-size: 18px;
  margin: 0 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #fff;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  text-decoration: none;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.nav-links a:last-child {
  margin-bottom: 0;
}

.nav-links a::before {
  content: "▷";
  flex-shrink: 0;
  opacity: 0;
}

.nav-links a:hover::before {
  opacity: 1;
}

.nav-links a.active::before {
  content: "▶";
  opacity: 1;
}

.nav-divider {
  border: none;
  border-top: 1px solid #fff;
  margin: 8px 0;
}

li a:active,
li a:focus,
li a:visited {
  color: #fff;
}

li a:hover {
  color: #666 !important;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.screen-inner {
  font-family: pixel;
  font-size: 18px;
  line-height: 1.4;
  color: #fff;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
}

.screen-inner p {
  margin: .6em 0;
}

.screen-inner h1,
.screen-inner h2,
.screen-inner h3 {
  margin: .6em 0;
}

.back-button {
  display: inline-block;
  font-family: pixel;
  font-size: 18px;
  color: #fff;
  background: #000;
  border: 2px solid #fff;
  padding: 4px 8px;
  cursor: pointer;
  margin-bottom: 16px;
  image-rendering: pixelated;
}

.back-button:hover {
  background: #fff;
  color: #000;
}

.back-to-top {
  text-align: right;
  margin-top: 16px;
}

.back-to-top a {
  color: #fff;
}

.retro-toggle {
  display: block;
  width: 100%;
  font-family: pixel;
  font-size: 16px;
  color: #fff;
  background: #000;
  border: 2px solid #fff;
  padding: 8px;
  cursor: pointer;
  image-rendering: pixelated;
}

.retro-toggle:hover {
  background: #222;
}

.retro-toggle.active {
  background: #fff;
  color: #000;
}

/* retro mode: the .container is rendered normally but made invisible (while
   staying interactive/accessible), and a three.js canvas draws a
   hardware-accelerated CRT recreation of it on top - see js/retro-crt.js */
.container.crt-source-hidden {
  opacity: 0;
}

.crt-canvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 10;
}

@media (max-width: 700px) {
  .container {
    max-width: 100%;
    padding: 0 8px;
  }

  .top {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .main-ui {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 16px !important;
  }

  .pixelbox {
    width: 100% !important;
    padding: 8px !important;
  }

  .logo-inner {
    width: 100px !important;
    height: 100px !important;
  }

  .desc {
    font-size: 20px !important;
  }

  .sidebar {
    width: 100% !important;
  }

  .nav-links {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  .nav-links a {
    font-size: 18px !important;
    padding: 8px !important;
    justify-content: center !important;
    margin-bottom: 0 !important;
  }

  .content {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }

  .screen {
    width: 100% !important;
  }

  .back-button {
    font-size: 16px !important;
    padding: 4px 6px !important;
  }
}
