/* AR screen: a header with one title, then either the intro (phone) or the stage — video or the sheet on screen —
   and a bar with «Стоп» and the subtitles. Night palette and fonts come from shared.css. */
html, body { height: 100%; }
body { overflow: hidden; }
.ar { display: grid; grid-template-rows: auto 1fr auto; height: 100svh; }

.head { position: relative; display: grid; gap: var(--space-1); padding: var(--space-4) var(--gutter) var(--space-3); padding-right: 6.5rem; }
.head h1 { font-size: clamp(1.9rem, 7vw, 3rem); }
.back { position: absolute; right: var(--gutter); top: var(--space-4); display: inline-flex; align-items: center; min-height: var(--tap-min); padding: 0 var(--space-4); border: 1px solid rgb(244 239 226 / 0.45); border-radius: var(--radius-pill); text-decoration: none; font: 800 0.9375rem / 1 var(--font-display); white-space: nowrap; }
body[data-mode="camera"] .head, body[data-mode="nocam"] .head { padding-bottom: var(--space-2); }
body[data-mode="camera"] .head .micro, body[data-mode="nocam"] .head .micro { display: none; }
body[data-mode="camera"] .head h1, body[data-mode="nocam"] .head h1 { font-size: 1.5rem; }

/* intro: text and the two actions at the lower left, the drawing from the book above */
.intro { display: grid; align-content: end; gap: var(--space-4); padding: 0 var(--gutter) var(--space-6); max-width: 40rem; position: relative; }
.intro::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 40svh; background: url('img/art-color.svg') 50% 18% / cover no-repeat; opacity: 0.55; -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent 100%); mask-image: linear-gradient(to bottom, #000 40%, transparent 100%); z-index: -1; }
.lead { font-size: 1.125rem; max-width: var(--measure); }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.intro .note { margin-top: calc(-1 * var(--space-2)); }

/* stage: MindAR appends <video> and <canvas> into .view; the fallback appends its own canvas */
.stage { position: relative; min-height: 0; display: grid; }
.stage[hidden] { display: none; }
.view { position: relative; overflow: hidden; background: var(--color-night); }
.view > canvas, .view > video { position: absolute; left: 0; top: 0; }
body[data-mode="camera"] .view { background: transparent; } /* MindAR puts the video at z-index -2: an opaque background would hide it */
.privacy { position: absolute; left: var(--gutter); right: var(--gutter); top: var(--space-3); font-size: var(--micro-size); line-height: 1.4; color: var(--color-text-muted); text-shadow: 0 1px 6px rgb(15 20 48 / 0.9); pointer-events: none; }
body[data-mode="nocam"] .privacy { display: none; }
.overlay { position: absolute; left: 0; right: 0; bottom: 0; display: grid; gap: var(--space-3); padding: var(--space-4) var(--gutter); pointer-events: none; background: linear-gradient(to top, rgb(15 20 48 / 0.85), transparent); }
.overlay .actions { pointer-events: auto; }
.overlay:has(.hint:empty):has(.btn[hidden]) { background: none; }
.hint { font-size: 1.0625rem; line-height: 1.45; max-width: var(--measure); text-shadow: 0 1px 6px rgb(15 20 48 / 0.9); }
.hint:empty { display: none; }
.btn[hidden] { display: none; }

/* bar: the current phrase above, «Стоп» below; side by side on wide screens */
.bar { display: grid; gap: var(--space-3); padding: var(--space-3) var(--gutter) calc(var(--space-3) + env(safe-area-inset-bottom)); border-top: 1px solid var(--color-line); background: var(--color-surface); }
.bar[hidden] { display: none; }
.bar .btn { min-height: var(--cta-min); padding: 0 26px; justify-self: start; }
.subtitle { order: -1; font-size: 1rem; line-height: 1.4; min-height: 5.6em; color: var(--color-text); text-wrap: pretty; max-width: var(--measure); }
.subtitle:empty::before { content: 'Ван Гог сейчас заговорит…'; color: var(--color-text-faint); }

@media (min-width: 720px) {
  :root { --gutter: 32px; }
  .intro { padding-bottom: var(--space-8); }
  .intro::before { height: 55svh; }
  .bar { grid-template-columns: auto minmax(0, 40rem); align-items: center; gap: var(--space-5); }
  .subtitle { order: 0; min-height: 2.8em; font-size: 1.0625rem; }
}
