/*
  Hello! You found the CSS. It is mostly about a normal page.
  Some of it is not. Please do not read the bottom half. 🙂
*/

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #fff;
}

body {
  --ground: 0;
  transition: background-color 2s;
}

/* The page and the panel. */

#site {
  position: fixed;
  inset: 0;
  perspective: 1400px;
  perspective-origin: 50% 50%;
}

/* The layout box does not catch clicks. Only the columns do. */
#layout {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
  pointer-events: none;
}

.column {
  position: absolute;
  top: 0;
  height: 100%;
  box-sizing: border-box;
  pointer-events: auto;
}

#page {
  left: 0;
  width: 55%;
}

#panel {
  right: 0;
  width: 45%;
}

.inner {
  position: absolute;
  inset: 0;
  background: #fff;
}

#page .inner {
  overflow: auto;
}

#panel .inner {
  border-left: 1px solid #cacdd1;
}

/* The text styles match the browser defaults. */

main {
  padding: 8px;
  font-family: "Times New Roman", Times, serif;
  font-size: 16px;
  line-height: normal;
  color: #000;
}

h1 {
  font-size: 2em;
  margin: 0.67em 0;
}

a { color: #0000ee; }
a:visited { color: #551a8b; }

[data-say] { cursor: text; }
a[data-say] { cursor: pointer; }

#devtools {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
}

/* On a narrow screen, the panel is below the page. */

@media (max-width: 700px) {
  #page {
    width: 100%;
    height: 50%;
  }
  #panel {
    top: 50%;
    width: 100%;
    height: 50%;
  }
  #panel .inner {
    border-left: none;
    border-top: 1px solid #cacdd1;
  }
}

/* ------------------------------------------------------------------ */
/* You read the bottom half. That is fine. I would have read it too.  */
/* ------------------------------------------------------------------ */

body.is-3d {
  background: #f3efe6;
}

/* On a touch screen, a drag turns the camera. It does not scroll. */
body.is-3d #site {
  touch-action: none;
}

body.is-3d #layout,
body.is-3d .column {
  transform-style: preserve-3d;
}

/* The iframe ignores backface-visibility, so layout.js hides the front. */
.flipped .inner {
  visibility: hidden;
}

body.is-3d .inner,
body.is-3d .back {
  backface-visibility: hidden;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 30px 80px rgba(0, 0, 0, calc(var(--ground) * 0.18));
}

.back {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotateY(180deg);
  background: #fbfaf7;
}

#floor {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 6000px;
  height: 6000px;
  margin: -3000px 0 0 -3000px;
  transform: translateY(160px) rotateX(90deg);
  opacity: var(--ground);
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.07) 1px, transparent 1px);
  background-size: 80px 80px;
  -webkit-mask-image: radial-gradient(circle at center, #000 0, transparent 45%);
  mask-image: radial-gradient(circle at center, #000 0, transparent 45%);
  pointer-events: none;
}

#shadow {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 1600px;
  height: 900px;
  margin: -450px 0 0 -800px;
  transform: translateY(159px) rotateX(90deg);
  opacity: var(--ground);
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.16), transparent);
  pointer-events: none;
}

body:not(.is-3d) #floor,
body:not(.is-3d) #shadow,
body:not(.is-3d) .back {
  display: none;
}

.label {
  padding: 24px 28px;
  border: 2px dashed #bbb;
  border-radius: 6px;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  color: #555;
  text-align: center;
}

.label p {
  margin: 6px 0;
}
