@import url('https://cdn.jsdelivr.net/npm/@fontsource/indie-flower@5.3.0/index.css');

html, body { margin: 0; height: 100%; background: #111; color: #eee; font: 14px system-ui, sans-serif; overflow: hidden; }
#welcome {
  position: fixed;
  inset: 0;                /* cover the whole screen */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #f5f2ec;          /* just off white */
  background: radial-gradient(ellipse 50% 35% at center, rgba(0,0,0,.65) 0%, rgba(0,0,0,.45) 60%, transparent 100%);
  pointer-events: none;    /* clicks pass through to the 3D scene */
  opacity: 0;              /* hidden until .ready is added */
  transition: opacity .6s ease;
}
#welcome h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 500;
}
#welcome p {
  margin: 0;
  font-size: clamp(15px, 2vw, 20px);
  opacity: .85;
}
#welcome.ready {
  opacity: 1;
  animation: fadeIn .8s ease backwards;
}
#welcome.ready h1 {
  animation: fadeUp .9s ease .2s backwards;
}
#welcome.ready p {
  animation: fadeUp .9s ease .5s backwards;
}
#welcome.ready.hidden {
  opacity: 0;
  animation: none;
}
#browser-note {
  position: absolute;
  top: 16px;
  left: 16px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  font-size: 12px;
}
#look-choice { display: flex; gap: 12px; margin-top: 28px; pointer-events: auto; }
#look-choice button, #start, #book-close {
  padding: 10px 32px;
  border: 1px solid rgba(245, 242, 236, .5);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
#look-choice button:hover, #start:hover, #book-close:hover,
#look-choice button.on { background: #f5f2ec; color: #111; }
#controls-list {
  display: flex;
  gap: 20px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  opacity: .65;
}
#controls-list b { font-weight: 600; }
#start {
  margin-top: 16px;
  pointer-events: auto;
  visibility: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .4s ease, transform .4s ease, visibility .4s, background .2s ease, color .2s ease;
}
#start.visible { visibility: visible; opacity: 1; transform: translateY(0); }
#welcome.hidden #look-choice, #welcome.hidden #start { pointer-events: none; }
#welcome.ready #look-choice { animation: fadeUp .9s ease .8s backwards; }
#welcome.ready #controls-list { animation: fadeUp .9s ease 1.1s backwards; }
#menu-tip {
  position: fixed;
  top: 16px;
  left: 16px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  font-size: 12px;
  color: #f5f2ec;
  pointer-events: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .6s ease, transform .6s ease;
}
#menu-tip.visible { opacity: 1; transform: translateY(0); }
/* After a cookie opens a link: covers the screen so any click takes the mouse back */
#keep-exploring {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
}
#keep-exploring.visible { display: flex; }
#keep-exploring span {
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  font-size: 14px;
  color: #f5f2ec;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s ease;
  mix-blend-mode: difference;  /* makes it visible on both light and dark backgrounds */
}
#crosshair.visible { opacity: 1; }
#crosshair::before, #crosshair::after {
  content: '';
  position: absolute;
  background: #f5f2ec;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .45);
}
#crosshair::before { left: 7px; top: 0; width: 2px; height: 16px; }  /* vertical bar */
#crosshair::after  { top: 7px; left: 0; width: 16px; height: 2px; }  /* horizontal bar */

#achievements-list {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}
#achievements-list li::before { content: '\25CB'; margin-right: 8px; }
#achievements-list li { margin-top: 4px; }
#achievements-list li.done { opacity: .55; }
#achievements-list li.done .achievement-label { text-decoration: line-through; }
.achievement-description { margin-left: 8px; font-size: 12px; opacity: .7; }
.achievement-count { margin-left: 8px; font-size: 12px; font-weight: 600; }
#achievements-list li.done::before { content: '\25CF'; }
#welcome.ready #achievements-list { animation: fadeUp .9s ease 1.3s backwards; }

#achievement-toasts {
  position: fixed;
  top: 56px;
  left: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}
.achievement-toast {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  color: #f5f2ec;
  font-size: 12px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .6s ease, transform .6s ease;
}
.achievement-toast.visible { opacity: 1; transform: translateY(0); }
.achievement-toast.complete::after { content: ' \2713'; font-weight: 700; }

#book-ui {
  position: fixed;
  inset: 0;
  pointer-events: none; /* only the form and Close button catch clicks */
  color: #f5f2ec;
  visibility: hidden;
  opacity: 0;
  transition: opacity .3s ease, visibility .3s;
}
#book-ui.visible { visibility: visible; opacity: 1; }

#guestbook-form, #guestbook-signed {
  position: absolute;
  top: 50%;
  left: calc(50% + 1.5vh);
  width: 27vh;
  height: 40vh;
  transform: translateY(-50%);
  box-sizing: border-box;
  padding: 2vh;
  display: flex;
  flex-direction: column;
  gap: 1vh;
  background: #efe9da;
  color: #2b2622;
  font-size: 1.5vh;
  pointer-events: auto;
}
#guestbook-form h2, #guestbook-signed h2 { margin: 0; font-size: 2.2vh; font-weight: 500; }
#guestbook-form label { display: flex; flex-direction: column; gap: .3vh; }
#guestbook-form input, #guestbook-form textarea {
  border: 0;
  border-bottom: 1px solid rgba(43, 38, 34, .4);
  background: transparent;
  color: inherit;
  font: inherit;
  padding: .4vh 0;
  outline: none;
  resize: none;
  font-family: 'Indie Flower', cursive; /* what visitors type looks handwritten */
  font-size: 2vh;
  font-weight: 400;
}
#guestbook-form input::placeholder, #guestbook-form textarea::placeholder {
  font-family: system-ui, sans-serif;
  font-size: 1.3vh;
  opacity: .5;
}
#guestbook-form input:focus, #guestbook-form textarea:focus { border-bottom-color: #2b2622; }
#guestbook-form button {
  margin-top: auto;
  padding: .7vh;
  border: 1px solid #2b2622;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
#guestbook-form button:hover { background: #2b2622; color: #efe9da; }
#guestbook-form[hidden], #guestbook-signed[hidden], #guestbook-error[hidden] { display: none; }
#guestbook-signed p {
  margin: 0;
  font-family: 'Indie Flower', cursive;
  font-size: 2vh;
  overflow-wrap: anywhere;
}
#guestbook-error { margin: 0; color: #a12a1f; font-size: 1.3vh; }
#book-close {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: auto;
}

#guestbook-notice { margin: 0; font-size: 1.1vh; opacity: .6; }
#guestbook-error:not([hidden]) + #guestbook-notice { display: none; }

#crosshair.holding { opacity: 0; }
#photo-hint {
  position: fixed;
  bottom: 32px;
  left: 50%;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  color: #f5f2ec;
  font-size: 12px;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity .3s ease;
}
#photo-hint.visible { opacity: 1; }

#crosshair.resume-out { opacity: 0; }
#resume-ui {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  color: #f5f2ec;
  visibility: hidden;
  opacity: 0;
  transition: opacity .3s ease, visibility .3s;
}
#resume-ui.visible { visibility: visible; opacity: 1; }
#resume-scroll {
  position: absolute;
  top: 4vh;
  left: 50%;
  width: min(86vh, 94vw); /* wider than the page fits at this height, so it scrolls */
  height: 92vh;
  padding-bottom: 72px; /* room to scroll the last lines above the buttons */
  box-sizing: border-box;
  transform: translateX(-50%);
  overflow-y: auto;
  background: #fff;
}
#resume-scroll img { display: block; width: 100%; height: auto; }
#resume-actions {
  position: absolute;
  bottom: 28px;
  left: 50%;
  display: flex;
  gap: 12px;
  transform: translateX(-50%);
}
#resume-download, #resume-close {
  padding: 10px 28px;
  border: 1px solid rgba(245, 242, 236, .5);
  border-radius: 999px;
  background: rgba(17, 17, 17, .85);
  color: inherit;
  font: inherit;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
#resume-download:hover, #resume-close:hover { background: #f5f2ec; color: #111; }


canvas { display: block; touch-action: none; }
#controls-list { flex-wrap: wrap; justify-content: center; }

.touch-only { display: none; }

#joystick {
  position: fixed;
  left: calc(32px + env(safe-area-inset-left));
  bottom: calc(32px + env(safe-area-inset-bottom));
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 1px solid rgba(245, 242, 236, .4);
  background: rgba(0, 0, 0, .3);
  display: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
#joystick-knob {
  position: absolute;
  left: 34px;
  top: 34px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(245, 242, 236, .7);
  pointer-events: none;
}

@media (pointer: coarse) {
  /* A bigger, darker shade behind the menu, since the text fills more of a narrow screen */
  #welcome { background: radial-gradient(ellipse 85% 50% at center, rgba(0,0,0,.75) 0%, rgba(0,0,0,.55) 60%, transparent 100%); }
  #welcome h1 { text-shadow: 0 1px 8px rgba(0, 0, 0, .5); }
  .title-greeting { display: block; }
  .desktop-only { display: none; }
  .touch-only { display: revert; }

  #joystick.visible { display: block; }
  #crosshair { display: none; }              /* you tap the thing itself instead of aiming */
  #menu-tip.visible { pointer-events: auto; } /* it's the menu button now */

  /* The vh sizes that line the form up with the 3D book are tiny on a phone, so it's a normal card instead */
  #guestbook-form, #guestbook-signed {
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: min(340px, calc(100vw - 32px));
    height: auto;
    max-height: calc(100% - 100px);
    overflow-y: auto;
    padding: 16px;
    gap: 10px;
    border-radius: 8px;
    font-size: 14px;
  }
  #guestbook-form h2, #guestbook-signed h2 { font-size: 20px; }
  #guestbook-form input, #guestbook-form textarea { font-size: 16px; } /* under 16px, iPhones zoom in when you type */
  #guestbook-form input::placeholder, #guestbook-form textarea::placeholder { font-size: 13px; }
  #guestbook-form button { padding: 8px; }
  #guestbook-signed p { font-size: 18px; }
  #guestbook-notice { font-size: 11px; }
  #guestbook-error { font-size: 13px; }

  #resume-scroll { width: 94vw; }
}

/* Phones turned sideways are short, so the menu tightens up to fit */
@media (max-height: 500px) {
  #welcome h1 { font-size: 26px; margin-bottom: 6px; }
  #look-choice { margin-top: 14px; }
  #start { margin-top: 10px; }
  #controls-list { margin-top: 12px; }
  #achievements-list { margin-top: 10px; font-size: 12px; }
}
#fps-meter {
  position: fixed;
  top: 16px;
  right: 16px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  color: #f5f2ec;
  font-size: 12px;
  pointer-events: none;
}
