*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

/* --- Shared header --- */

.site-header {
  position: fixed;
  top: 20px;
  left: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-logo,
.site-about {
  font-family: Helvetica, Arial, sans-serif;
  font-weight: bold;
  font-size: 1rem;
  color: black;
  text-decoration: none;
}

/* --- Index page --- */

body.index {
  min-height: 100vh;
  background: white;
}

.index-layout {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.thinkpad-link,
.projector-link {
  position: absolute;
  width: fit-content;
  height: fit-content;
  top: 50%;
  transform: translateY(calc(-50% + 20vh));
  margin: 0 auto;
  text-decoration: none;
}

.thinkpad-link {
  left: 0;
  right: calc(50% + 22.5vh + 20px);
}

.projector-link {
  left: calc(50% + 22.5vh + 20px);
  right: 0;
}

.thinkpad-link img,
.projector-link img {
  max-height: 45vh;
  width: auto;
  display: block;
}

.nav-arrow {
  display: none;
}

.grid {
  display: grid;
  grid-template-columns: 7.5vh 15vh 15vh 7.5vh;
  grid-template-rows: repeat(5, 18vh);
  width: 45vh;
  height: 90vh;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 1.25rem;
  color: black;
  text-decoration: none;
  border: 1px solid black;
}

/* Remove exterior borders so only interior lines are visible */
.cell:nth-child(-n+4)  { border-top: none; }
.cell:nth-child(4n+1)  { border-left: none; }
.cell:nth-child(4n)    { border-right: none; }
.cell:nth-child(n+17)  { border-bottom: none; }

/* --- Numbered pages --- */

body.page {
  min-height: 100vh;
  background: white;
}

.page-content {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 80px 10vw 80px;
  font-family: Helvetica, Arial, sans-serif;
  color: black;
}

.page-content > * + * {
  margin-top: 16px;
}

.page-content p + p {
  margin-top: 0.8em;
}

.page-content h1 { font-size: 2rem;    font-weight: bold; line-height: 1.2; }
.page-content h2 { font-size: 1.5rem;  font-weight: bold; line-height: 1.3; }
.page-content h3 { font-size: 1.25rem; font-weight: bold; line-height: 1.4; }
.page-content h4 { font-size: 1rem;    font-weight: bold; line-height: 1.5; }
.page-content h5 { font-size: 0.875rem; font-weight: bold; }
.page-content h6 { font-size: 0.75rem;  font-weight: bold; }

.page-content p {
  font-size: 1rem;
  line-height: 1.6;
}

.page-content img {
  height: 50vh;
  max-height: 50vh;
  width: auto;
  display: block;
}

@media (max-width: 768px) {
  .site-logo,
  .site-about {
    font-size: 1.15rem;
  }

  body.index {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  .index-layout {
    display: flex;
    flex-direction: row;
    width: 300vw;
    height: 100vh;
    align-items: stretch;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
  }

  .index-layout[data-panel="0"] { transform: translateX(0); }
  .index-layout[data-panel="1"] { transform: translateX(-100vw); }
  .index-layout[data-panel="2"] { transform: translateX(-200vw); }

  .thinkpad-link,
  .projector-link {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: none;
    margin: 0;
  }

  .thinkpad-link img,
  .projector-link img {
    height: 75vh;
    max-height: 75vh;
    max-width: 90vw;
    width: auto;
    transform: none;
  }

  .grid-panel {
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 70px 20px 60px;
  }

  .grid {
    --grid-w: min(calc(100vw - 40px), calc((100vh - 130px) / 2));
    width: var(--grid-w);
    height: calc(var(--grid-w) * 2);
    grid-template-columns: 1fr 2fr 2fr 1fr;
    grid-template-rows: repeat(5, 1fr);
  }

  .nav-arrow {
    display: flex;
    position: fixed;
    bottom: 20px;
    z-index: 200;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    font-family: Helvetica, Arial, sans-serif;
    align-items: center;
    justify-content: center;
    padding: 8px;
    color: black;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
  }

  .nav-arrow-left {
    left: 20px;
  }

  .nav-arrow-right {
    right: 20px;
  }
}

@media (max-width: 768px) {
  .page-content {
    width: 100%;
  }

  .page-content img {
    width: 100%;
    height: auto;
    max-height: none;
  }
}

.page-content a {
  color: black;
}

.page-content blockquote {
  margin-left: 1.5em;
  padding: 1em 1.5em;
  background: whitesmoke;
  font-style: italic;
  color: #444;
}

.page-content hr {
  border: none;
  border-top: 1px solid #ccc;
  margin: 2em 0;
}

.page-content ul,
.page-content ol {
  padding-left: 1.5em;
}
