/* WM Arte Interactive — stage. Shared by every scene; nothing artwork-specific here. */

:root {
  --wall: #ffffff;
  --ink: #201c17;
  --ink-soft: #7a7266;
  --coral: #e0502c;
  --plate-h: 52px;
  --pad: clamp(10px, 3vmin, 36px);
  color-scheme: light; /* the paper is white; the wall matches it in every theme */
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--wall); color: var(--ink); }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

.stage {
  position: relative;
  height: calc(100svh - var(--plate-h) - env(safe-area-inset-bottom));
  margin: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* The plain artwork: shown first, and stays as the experience if WebGL is unavailable.
   The engine measures this box, so canvas and image line up exactly on the swap. */
.stage > img {
  position: absolute;
  inset: var(--pad);
  width: calc(100% - 2 * var(--pad));
  height: calc(100% - 2 * var(--pad));
  object-fit: contain;
  -webkit-user-drag: none;
}
.stage.is-live > img { visibility: hidden; }
.stage > .stage-box { position: absolute; inset: var(--pad); visibility: hidden; pointer-events: none; }

.stage-canvas, .stage-debug {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.stage-debug { pointer-events: none; }
.stage-coord {
  position: absolute; left: 8px; top: 8px;
  font: 12px ui-monospace, Menlo, monospace;
  background: rgba(255,255,255,.85); padding: 2px 6px; pointer-events: none;
}

.plate {
  height: calc(var(--plate-h) + env(safe-area-inset-bottom));
  padding: 0 max(16px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(16px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  color: var(--ink-soft);
}
.plate-title { margin: 0; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate-title em {
  font-family: "Fraunces", Georgia, serif;
  font-style: italic;
  font-size: 16px;
  color: var(--ink);
  margin-right: 6px;
}
.plate-home {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 11px;
  white-space: nowrap;
}
.plate-home::before { content: "← "; color: var(--coral); }
.plate-home:hover, .plate-home:focus-visible { color: var(--coral); }

@media (max-width: 420px) {
  .plate-title span { display: none; }
}

/* ?embed — inside an <iframe> from embed.js: no plate, a small credit instead */
.embed-credit { display: none; }
html.is-embed { --plate-h: 0px; --pad: clamp(6px, 2vmin, 16px); }
html.is-embed .plate { display: none; }
html.is-embed .embed-credit {
  display: block;
  position: absolute; right: 8px; bottom: 6px; z-index: 2;
  font-size: 11px; letter-spacing: .04em;
  color: var(--ink-soft); text-decoration: none;
  background: rgba(255,255,255,.8); padding: 2px 6px; border-radius: 3px;
}
html.is-embed .embed-credit:hover { color: var(--coral); }

.plate-more {
  color: var(--ink-soft); text-decoration: none; font-size: 12px; white-space: nowrap;
  margin-right: auto; padding-left: 4px;
}
.plate-more:hover, .plate-more:focus-visible { color: var(--coral); }
@media (max-width: 480px) { .plate-more { display: none; } }
