/* Trapnest Zoom. The torn-paper title card lifts away as the painting begins. */

:root {
  --accent: #823025;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  font: 400 1rem/1.5 "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#fall {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: default;
  outline: none;
}
#fall.dragging { cursor: grabbing; }

/* ---- the title, on torn paper; it lifts away when the fall begins ---- */
#title {
  position: fixed;
  left: 50%;
  top: 46%;
  margin: 0;
  width: min(31rem, 87vw);
  padding: clamp(1rem, 4.7vh, 2.25rem) 1.15rem clamp(1rem, 4.5vh, 2rem);
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  text-align: center;
  color: var(--ink);
  transform: translate(-50%, -50%) rotate(-1.6deg);
  pointer-events: none;
  filter: drop-shadow(0 0.1rem 0.05rem rgba(24, 22, 60, 0.28)) drop-shadow(0 0.5rem 0.9rem rgba(24, 22, 60, 0.22));
  transition: transform 1.3s cubic-bezier(0.5, 0, 0.75, 0.3), opacity 0.9s ease 0.3s;
}
#title::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url("../art/ui/scrap_card.webp") center / 100% 100% no-repeat;
}
#title .mark {
  width: clamp(1.75rem, 7vh, 3rem);
  height: auto;
}
#title h1 {
  margin: 0;
  font: 400 clamp(1.75rem, 8vw, 4rem)/1.04 var(--display);
  letter-spacing: -0.048em;
}
.subtitle {
  margin: 0.12rem 0 0;
  font: 400 clamp(1rem, 4.2vw, 1.25rem)/1.4 var(--display);
}
.hints {
  margin: clamp(0.35rem, 1.7vh, 0.9rem) 0 0;
  font: 600 0.875rem/1.35 system-ui, sans-serif;
  color: var(--accent);
  transition: opacity 0.6s ease;
}
#wait {
  position: absolute;
  inset: auto 1.25rem clamp(1rem, 4.5vh, 2rem);
  margin: 0;
  font: 500 0.875rem/1.35 system-ui, sans-serif;
  color: var(--ink);
  opacity: 0;
  transition: opacity 0.4s ease;
}
body.loading #wait { opacity: 0.85; }
body.loading .hints { opacity: 0; }
body.begun #title {
  transform: translate(-50%, -260%) rotate(-7deg);
  opacity: 0;
}

.project-nav {
  position: fixed;
  bottom: max(0.85rem, env(safe-area-inset-bottom));
  left: max(0.85rem, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  padding: 0 0.2rem;
  border: 1px solid #f6ecd258;
  border-radius: 2rem;
  background: #112f28;
  color: var(--paper);
  font: 500 0.875rem/1 system-ui, sans-serif;
}
.project-nav a {
  display: grid;
  min-height: 2.75rem;
  align-items: center;
  padding: 0 0.75rem;
  border-radius: 2rem;
  color: inherit;
  text-decoration: none;
}
.project-nav a:hover { text-decoration: underline; text-underline-offset: 0.24em; }
.project-nav a:focus-visible { outline: 2px solid #ffd980; outline-offset: -3px; }
.project-nav a + a { position: relative; }
.project-nav a + a::before {
  content: "";
  position: absolute;
  left: 0;
  height: 0.8rem;
  border-left: 1px solid #f6ecd258;
}

/* Filming (?capture=...) shows the canvas alone. */
body.capture :is(#title, .project-nav) { display: none; }
body.capture #fall { inset: auto; left: 0; top: 0; }

.plain { position: fixed; inset: auto 1rem 4rem; text-align: center; font-style: italic; }

@media (prefers-reduced-motion: reduce) {
  #title { transition-duration: 0.01s; }
}
