* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: #b9b2a4;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  display: grid;
  place-items: center;
}

#view {
  display: block;
  cursor: pointer;
  touch-action: manipulation;
}

#door {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  overflow-y: auto; /* a phone on its side is too short for all this: let it scroll */
  padding: 2rem 1.25rem;
  background: rgba(0, 0, 0, 0.82);
  text-align: center;
  transition: opacity 4s ease;
}

/* centre the contents when there is room, start from the top when there isn't */
#door::before, #door::after { content: ""; flex: 1 0 0; }

#door.gone {
  opacity: 0;
  pointer-events: none;
}

h1 {
  margin: 0 0 1.2rem;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-weight: 400;
  letter-spacing: 0.42em;
  margin-right: -0.42em;
  text-transform: uppercase;
  color: #d9d1c0;
}

p { margin: 0; }

.ask {
  font-style: italic;
  font-size: 1.15rem;
}

.small {
  font-size: 0.78rem;
  color: #6f6a60;
  max-width: 22rem;
  margin-top: -0.7rem;
}

.warn, .calm {
  font-size: 0.9rem;
  color: #8a8478;
}

.calm {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  cursor: pointer;
}

.calm input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: #b9b2a4;
}

button {
  flex: none;
  margin-top: 1.4rem;
  min-height: 48px;
  padding: 0.7rem 2.2rem;
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #d9d1c0;
  background: transparent;
  border: 1px solid #5c574d;
  cursor: pointer;
  transition: border-color 0.6s, color 0.6s;
}

button:hover { border-color: #d9d1c0; }
button:focus-visible, .calm input:focus-visible { outline: 2px solid #d9d1c0; outline-offset: 4px; }
button:disabled { color: #5c574d; cursor: default; }

#failed { color: #c9a08a; max-width: 28rem; }

#hud {
  position: fixed;
  left: 10px;
  bottom: 8px;
  margin: 0;
  font: 11px/1.4 ui-monospace, Menlo, monospace;
  color: #7f8;
  opacity: 0.8;
  pointer-events: none;
}

[hidden] { display: none !important; }

/* ---------- the hint: a line about how to move, low in the frame */
#hint {
  position: fixed;
  left: 0; right: 0;
  bottom: max(9vh, 2.2rem);
  margin: 0 auto;
  padding: 0 1.25rem;
  max-width: 34rem;
  text-align: center;
  font-style: italic;
  font-size: clamp(0.95rem, 2.4vw, 1.1rem);
  line-height: 1.5;
  color: #cfc7b6;
  text-shadow: 0 0 12px #000, 0 0 3px #000;
  opacity: 0;
  transition: opacity 2.5s ease;
  pointer-events: none;
}
#hint.on { opacity: 0.85; }

/* ---------- the way to the instructions: top right, there if you want it */
#about-open {
  position: fixed;
  top: max(0.6rem, env(safe-area-inset-top));
  right: max(0.6rem, env(safe-area-inset-right));
  width: 44px; height: 44px;
  min-height: 0;
  margin: 0; padding: 0;
  display: grid; place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #d9d1c0;
  opacity: 0.4;
  letter-spacing: 0;
  transition: opacity 0.5s;
  z-index: 5;
}
#about-open:hover, #about-open:focus-visible { opacity: 1; }

#about {
  width: min(34rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 2rem 1.75rem 1.75rem;
  border: 1px solid #3d3a33;
  background: rgba(6, 6, 5, 0.94);
  color: #b9b2a4;
  font: inherit;
  line-height: 1.55;
  overflow-y: auto;
}
#about::backdrop { background: rgba(0, 0, 0, 0.7); }
#about h2 {
  margin: 0 0 1.4rem;
  font-size: 1.3rem; font-weight: 400;
  letter-spacing: 0.36em; text-transform: uppercase;
  color: #d9d1c0;
}
#about h3 {
  margin: 1.6rem 0 0.5rem;
  font-size: 0.78rem; font-weight: 400;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: #8a8478;
}
#about p { margin: 0 0 0.6rem; }
#about ul { margin: 0; padding-left: 1.1rem; }
#about li { margin-bottom: 0.35rem; }
#about a { color: #d9d1c0; }
#about .small.wide { max-width: none; margin-top: 0; }
#about kbd { font: 0.85em ui-monospace, Menlo, monospace; padding: 0.05em 0.4em; border: 1px solid #5c574d; border-radius: 3px; }
#about-close {
  position: absolute; top: 0.9rem; right: 0.9rem;
  margin: 0; min-height: 44px; padding: 0.4rem 0.9rem;
  font-size: 0.72rem; letter-spacing: 0.18em;
  border-color: #3d3a33;
}
button.plain {
  display: inline; margin: 0; min-height: 0; padding: 0;
  border: 0; border-bottom: 1px solid #5c574d;
  font-size: inherit; letter-spacing: 0; text-transform: none;
  color: #b9b2a4;
}
/* no keyboard or mouse: don't mention them */
@media (hover: none) and (pointer: coarse) { #about .keys, #about .pointer { display: none; } }
@media (prefers-reduced-motion: reduce) { #hint { transition-duration: 0.01s; } }
