/* SadAR in the lab's style. Everything stays inside one screen, no scrolling. */

[hidden] { display: none !important; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body { margin: 0; background: var(--bg); }
/* AR.js puts the camera feed behind everything (z-index -2): nothing may paint over it */
html:has(body.in-ar) { background: #000; }
body.in-ar { background: transparent; }
body.in-ar > .back { display: none; }

#arjsDebugUIContainer, .arjs-loader, .arjs-debugUI { display: none !important; }

/* ---------- start ---------- */

.start {
  position: fixed;
  inset: 0;
  height: 100dvh;
  width: min(100% - 32px, 460px);
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 72px) 0 calc(env(safe-area-inset-bottom) + 20px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  justify-content: safe center; /* if it ever overflows, the title stays reachable */
  gap: clamp(12px, 2.5vh, 22px);
  overflow-y: auto; /* only ever needed with very large text */
  color: var(--ink);
}
body:not(.in-ar)::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(60% 40% at 50% -10%, color-mix(in oklab, var(--accent) 16%, transparent), transparent 70%);
}
.start .kit-title { font-size: clamp(2.2rem, 9vw, 3.4rem); }
.start__text { margin: 0; color: var(--ink-2); }

.start__marker {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink-2);
  font-size: 0.92rem;
  line-height: 1.35;
  text-decoration: none;
}
.start__marker img { width: 56px; height: 56px; border-radius: 6px; background: #fff; flex: none; }
.start__marker span { text-decoration: underline; text-decoration-color: color-mix(in oklab, var(--accent) 60%, transparent); text-underline-offset: 3px; }
@media (hover: hover) { .start__marker:hover { border-color: color-mix(in oklab, var(--accent) 50%, var(--line)); } }

.start .kit-btn { align-self: flex-start; min-height: 50px; padding-inline: 28px; }

#waiting { justify-items: start; }
#waiting .logo { width: clamp(110px, 30vw, 150px); }
.start__msg { margin: 10px 0 0; color: var(--ink-2); }

@media (max-height: 560px) and (min-width: 600px) {
  .start { padding-top: 16px; width: min(100% - 2 * 150px, 620px); gap: 10px; }
  .start .kit-title { font-size: 2rem; }
  #waiting .logo { width: 90px; }
}

/* ---------- AR ---------- */

/* AR.js sizes its <video> and the <body> (where the scene lives) to "cover" the screen, cropping
   with negative margins; both must keep that geometry or the model drifts off the marker.
   So the body stays unpositioned and the root just clips the overflow. */
html:has(body.in-ar) { overflow: clip; }
#ar, #ar a-scene { width: 100%; height: 100%; }

.hint {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 22px);
  left: 50%;
  z-index: 5;
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(11, 13, 16, 0.78);
  color: var(--ink-2);
  font: 400 12px/1.2 var(--mono);
  white-space: nowrap;
  transform: translateX(-50%);
  transition: opacity 0.3s, transform 0.3s var(--ease-out);
}
.hint.is-found { opacity: 0; transform: translate(-50%, 8px); }
#waiting:focus { outline: none; }
