/* Klitsch type system: Inter 400 and 500 only, two sizes (13/18 and 15/20), one ink colour. */
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #1d1d1b;
  --panel: #ffffff;
  --font: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --small: 400 13px/18px var(--font);
  --main: 500 15px/20px var(--font);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #2a2a2a;
  color: var(--ink);
  font: var(--small);
}

#stage {
  position: fixed;
  inset: 0;
  touch-action: none;
  cursor: grab;
}

#stage.dragging { cursor: grabbing; }
#stage canvas { display: block; }

.brand-wrap {
  position: fixed;
  color: #f2f1ee;
  top: max(16px, env(safe-area-inset-top));
  left: 16px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.version { font: var(--small); line-height: 1; padding-bottom: 4px; }

.brand {
  margin: 0;
  font: var(--main);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
}

.hint {
  position: fixed;
  top: calc(max(16px, env(safe-area-inset-top)) + 40px);
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 8px 14px;
  background: var(--panel);
  font: var(--small);
  text-align: center;
  pointer-events: none;
  transition: opacity 0.6s;
}

.controls {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  max-width: calc(100% - 32px);
}

.controls button {
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border: 0;
  background: var(--panel);
  color: var(--ink);
  font: var(--main);
  cursor: pointer;
}

.controls button:hover { background: #f4f4f2; }
.controls button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.fade {
  position: fixed;
  inset: 0;
  background: #2a2a2a;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}

.fade.on { opacity: 1; }

.fallback {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  padding: 24px 16px 48px;
  background: var(--panel);
}

.fallback figure { margin: 0 auto 40px; max-width: 520px; }
.fallback img { width: 100%; height: auto; display: block; }
.fallback figcaption { margin-top: 8px; font: var(--small); }
.fallback-note { padding: 16px; }

/* Guestbook: a cheap black book with white writing. Same type system, pink only for page numbers. */
.book {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: rgba(29, 29, 27, 0.55);
  overflow-y: auto;
}

.book[hidden] { display: none; }

.book-spread {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(880px, 100%);
  background: var(--ink);
  color: #fff;
}

.book-page { padding: 28px 28px 24px; min-height: 420px; display: flex; flex-direction: column; }
.book-left { border-right: 1px solid rgba(255, 255, 255, 0.18); }

.book-title {
  margin: 0 0 28px;
  font: var(--main);
}


.book-form { display: flex; flex-direction: column; gap: 6px; }
.book-form label { font: var(--small); }

.book-form textarea,
.book-form input {
  width: 100%;
  padding: 6px 0;
  border: 0;
  border-bottom: 1px solid #fff;
  background: transparent;
  color: #fff;
  font: var(--main);
  resize: none;
}

.book-form textarea:focus,
.book-form input:focus { outline: none; border-bottom-color: #ff2fb4; }

.book-count { margin: 0 0 10px; font: var(--small); text-align: right; }
.book-count.full { color: #ff2fb4; }

.book-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.book button {
  height: 44px;
  padding: 0 14px;
  border: 0;
  background: #fff;
  color: var(--ink);
  font: var(--main);
  cursor: pointer;
}

.book button:disabled { opacity: 0.35; cursor: default; }
.book button:focus-visible { outline: 2px solid #ff2fb4; outline-offset: 2px; }
.book-form button { align-self: flex-start; margin-top: 8px; }
.book-status { margin: 8px 0 0; min-height: 18px; font: var(--small); }

.book-entries { list-style: none; margin: 0; padding: 0; flex: 1; }
.book-entries li { padding: 0 0 12px; margin: 0 0 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.18); }
.book-entries .text { display: block; font: var(--main); overflow-wrap: anywhere; }
.book-entries .who { display: block; margin-top: 2px; font: var(--small); opacity: 0.7; }
.book-entries .empty { border: 0; font: var(--small); opacity: 0.7; }

.book-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.book-folio { font: var(--small); color: #ff2fb4; }
.book-close { align-self: center; }

@media (max-width: 700px) {
  .book { justify-content: flex-start; }
  .book-spread { grid-template-columns: 1fr; }
  .book-left { border-right: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.18); }
  .book-page { min-height: 0; padding: 20px 16px; }
  .book-nav button { padding: 0 10px; }
}

/* Controls help */
.help-open {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  right: 16px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  background: var(--panel);
  color: var(--ink);
  font: var(--small);
  cursor: pointer;
}

.help-open:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.help {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(29, 29, 27, 0.35);
}

.help[hidden] { display: none; }
/* Overlays above the control bar. */
.help, .book { z-index: 10; }
/* On touch devices the help only shows the touch controls. */
.touch .help-keys { display: none; }
.help-panel { width: min(440px, 100%); max-height: 100%; overflow-y: auto; padding: 24px; background: var(--panel); }
.help-title { margin: 0 0 16px; font: var(--main); letter-spacing: 0.04em; text-transform: uppercase; }
.help-sub { margin: 20px 0 8px; font: var(--main); }
.help-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font: var(--small); }
.help-list dt { font-weight: 500; }
.help-list dd { margin: 0; }

.help button#help-close {
  margin-top: 20px;
  height: 44px;
  padding: 0 14px;
  border: 0;
  background: var(--ink);
  color: #fff;
  font: var(--main);
  cursor: pointer;
}

/* Touch: no double-tap zoom or grey flash on the buttons. */
button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.controls .short { display: none; }

/* Phones: arrows instead of words for back and next, and the bar fills the width evenly. */
@media (max-width: 560px) {
  .controls {
    left: 16px;
    right: 16px;
    max-width: none;
    transform: none;
    gap: 6px;
  }
  .controls button { flex: 0 0 auto; padding: 0 6px; font-size: 14px; line-height: 1.1; }
  /* Näher / Zurücktreten takes the leftover width and may break onto two lines. */
  #close { flex: 1 1 0; min-width: 0; white-space: normal; hyphens: manual; }
  #prev, #next { flex: 0 0 48px; }
  /* The words first, the arrows side by side on the right. */
  #overview { order: 1; }
  #close { order: 2; }
  #book-open { order: 3; }
  #prev { order: 4; }
  #next { order: 5; }
  /* Before the tour starts the next button says Start, which needs more than an arrow's width. */
  #next.is-start { flex: 0 0 auto; }
  #next.is-start .short { font-size: 14px; }
  .controls .long { display: none; }
  .controls .short { display: inline; font-size: 24px; line-height: 1; }
  .hint { width: calc(100% - 32px); }
  /* 16 px keeps iOS from zooming the page when a guestbook field gets focus. */
  .book-form textarea,
  .book-form input { font-size: 16px; }
  .help-list { grid-template-columns: 1fr; gap: 2px; }
  .help-list dd { margin-bottom: 8px; }
}
