body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: #000;
  color: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-family: Consolas, "Courier New", monospace;
  font-size: clamp(1.25rem, 3vw, 2rem);
}

/* ---------- typing intro ---------- */
.intro {
  position: relative;
  width: min(40rem, 100%);
  transition: opacity 1s;
}

.intro.fade-out {
  opacity: 0;
}

#typed {
  width: 100%;
  box-sizing: border-box;
  padding: 1.5rem;
  margin: 0;
  white-space: pre-wrap;
  text-align: center;
}

#typed.code {
  color: #569cd6;
}

/* blinking cursor */
#typed::after {
  content: "";
  display: inline-block;
  width: 0.6ch;
  height: 1.1em;
  background: currentColor;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ---------- continue button ---------- */
#continue {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: transparent;
  color: #fff;
  border: 1px solid #fff;
  padding: 0.6rem 1.5rem;
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s, background 0.2s, color 0.2s;
}

#continue.show {
  opacity: 1;
  pointer-events: auto;
}

#continue:hover,
#continue:focus-visible {
  background: #fff;
  color: #000;
}

/* ---------- desk scene ---------- */
#scene {
  position: fixed;
  inset: 0;
  background: #000;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.5s;
}

#scene.show {
  opacity: 1;
}

/* image + animations live in one box so they always scale together */
.stage {
  --w: 9;                 /* replaced by the real image size in script.js */
  --h: 16;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  aspect-ratio: var(--w) / var(--h);
  container-type: inline-size;   /* lets text scale with the scene (cqw units) */
  /* phone: fill the screen (cover) */
  width: max(100vw, calc(100dvh * var(--w) / var(--h)));
}

.stage img,
.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* desktop: show the whole scene (contain) */
@media (min-aspect-ratio: 1/1) {
  .stage {
    width: min(100vw, calc(100dvh * var(--w) / var(--h)));
  }
}

/* ---------- clickable text on the scene ---------- */
.work-link {
  position: absolute;
  left: 50%;                 /* whiteboard center: tweak these two to move it */
  top: 27.4%;
  transform: translate(-50%, -50%);
  background: none;
  border: 0;
  padding: 0.3em 0.5em;
  font: 700 4.6cqw Consolas, "Courier New", monospace;   /* size scales with scene */
  color: #1a1a1a;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s;
}

.work-link.show {
  opacity: 1;
  pointer-events: auto;
}

.work-link .arrow {
  display: inline-block;
  margin-left: 0.3em;
  transition: transform 0.2s;
}

.work-link:hover .arrow,
.work-link:focus-visible .arrow {
  transform: translateX(0.3em);
}

.work-link:hover,
.work-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* "About Me" sits on the cheese */
/* "About Me" printed on the front face of the cheese */
#aboutLink {
  --tilt: -4deg;            /* rotates the text to follow the face's edge */
  --skew: -8deg;            /* shears the letters to match the face's slope */
  --turn: -20deg;           /* turns the text away, squeezing it like a side face */

  left: 21%;              /* nudged toward the lower-left front face */
  top: 90.7%;
  font-size: 2.1cqw;
  line-height: 1.1;
  text-align: center;
  padding: 0.6em;

  color: #000;           /* dark cheese-rind brown */
  mix-blend-mode: multiply; /* picks up the cheese's own shading and holes */
  text-shadow: 0 0.06em 0 rgba(255, 244, 160, 0.8);   /* light edge, looks pressed in */

  transform: translate(-50%, -50%)
             perspective(30cqw)
             rotateY(var(--turn))
             rotateZ(var(--tilt))
             skewY(var(--skew));
}

/* "Contact Me" sits on the cockroach */
#contactLink {
  left: 89%;                 /* cockroach position: nudge these two to adjust */
  top: 96.5%;
  font-size: 2.1cqw;
  line-height: 1.1;
  text-align: center;
  padding: 0.6em;
  color: #fff4d6;            /* cream, so it reads on the brown body */
  text-shadow: 0 0 0.2em #000, 0 0.05em 0.1em #000;
  transform: translate(-50%, -50%) rotate(8deg);
}

/* flashy hover: the stamp glows instead of underlining */
#aboutLink:hover,
#aboutLink:focus-visible {
  text-decoration: none;
  color: #5a3200;
  text-shadow:
    0 0.06em 0 rgba(255, 244, 160, 0.9),
    0 0 0.6em rgba(255, 225, 80, 0.95);
}

/* ---------- whiteboard views (fade in over the desk) ---------- */
#board,
#board2 {
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s ease;
}

#board.show,
#board2.show {
  opacity: 1;
  pointer-events: auto;   /* blocks clicks reaching the layers underneath */
}

/* ---------- About Me page (blank for now) ---------- */
/* ---------- blank pages (About Me, Contact) ---------- */
#aboutPage,
#contactPage {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s ease;
}

#aboutPage.show,
#contactPage.show {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- back arrow (top left) ---------- */
#backBtn {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top));
  left: 1rem;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid #1a1a1a;
  background: rgba(255, 255, 255, 0.85);
  color: #1a1a1a;
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s, background 0.2s, color 0.2s;
}

#backBtn.show {
  opacity: 1;
  pointer-events: auto;
}

#backBtn:hover,
#backBtn:focus-visible {
  background: #1a1a1a;
  color: #fff;
}

/* ---------- next arrow (middle right) ---------- */
#nextBtn {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid #1a1a1a;
  background: rgba(255, 255, 255, 0.85);
  color: #1a1a1a;
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s, background 0.2s, color 0.2s;
}

#nextBtn.show {
  opacity: 1;
  pointer-events: auto;
}

#nextBtn:hover,
#nextBtn:focus-visible {
  background: #1a1a1a;
  color: #fff;
}

.layer.hidden {
  visibility: hidden;
}

/* nudge the idle cockroach so it lines up with where the entrance ends */
#cockroachstay {
  transform: translate(-0.8%, 0);   /* first number = left/right, second = up/down */
}