/* Hallmark · macrostructure: image-led viewer · tone: architectural · anchor hue: warm brass */
/* Hallmark · pre-emit critique: P4 H5 E4 S4 R5 V4 */
:root {
  color-scheme: dark;
  --paper: #171815;
  --panel: #20211d;
  --ink: #f5f0e7;
  --dim: #c3beb2;
  --rule: #777467;
  --soft-rule: #45453c;
  --accent: #e7d2ab;
  --accent-ink: #221e16;
  --shade: rgb(0 0 0 / 60%);
  --sans: system-ui, -apple-system, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --gutter: clamp(14px, 3.5vw, 48px);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.45 var(--sans);
}
.tour {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.tour-head, .tour-controls {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-inline: var(--gutter);
}
.tour-head {
  min-height: 70px;
  padding-block: 10px;
  padding-top: max(10px, env(safe-area-inset-top));
}
.tour-head h1 {
  margin: 0;
  font: 500 clamp(20px, 3vw, 31px)/1.13 var(--serif);
  overflow-wrap: anywhere;
}
.tour-home {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--dim);
  text-decoration: none;
  white-space: nowrap;
}
.tour-home:hover { color: var(--ink); text-decoration: underline; }
.viewer {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
}
#scena {
  position: relative;
  width: min(100%, calc((100dvh - 174px) * 16 / 9));
  aspect-ratio: 16 / 9;
  overflow: clip;
  background: var(--panel);
}
#scena img, #scena video, #scena svg, .pano video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#film { opacity: 0; pointer-events: none; transition: opacity .14s ease; }
#zone path {
  fill: transparent;
  stroke: transparent;
  transition: fill .18s, stroke .18s;
}
#zone[inert] { pointer-events: none; }
#zone path[role="button"] { cursor: pointer; }
#zone path.on, #zone path:focus-visible {
  fill: color-mix(in srgb, var(--accent) 23%, transparent);
  stroke: var(--accent);
  stroke-width: 3;
}
#etichetta {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  padding: 8px 12px;
  background: var(--paper);
  box-shadow: 0 2px 12px var(--shade);
  transform: translate(12px, 12px);
}
#etichetta b, #etichetta span { display: block; }
#etichetta span { color: var(--dim); font-size: 13px; }
.nascosta { visibility: hidden; }
.tour-controls {
  min-height: 104px;
  padding-block: 14px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}
.tour-position { min-width: 0; }
#briciole {
  margin: 0;
  color: var(--ink);
  font: 500 clamp(17px, 2.4vw, 25px)/1.2 var(--serif);
  overflow-wrap: anywhere;
}
#suggerimento { margin: 4px 0 0; color: var(--dim); font-size: 13px; }
#passo {
  width: min(120px, 100%);
  height: 2px;
  margin-top: 9px;
  background: linear-gradient(to right, var(--accent) var(--progress, 0%), var(--soft-rule) var(--progress, 0%));
}
.tour-actions {
  flex: 0 0 min(415px, 56vw);
  min-width: 320px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 8px;
}
.passo-sinistra { grid-area: 1 / 1; }
.passo-centro { grid-area: 1 / 2; }
.passo-destra { grid-area: 1 / 3; }
.tour-actions > :is(button, a), .chiudi-piantine, #torna {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--ink);
  background: var(--paper);
  font: inherit;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}
.tour-actions > [hidden] { display: none; }
.tour-actions .continuare { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.tour-actions > :is(button, a):hover:not([aria-disabled="true"]) { box-shadow: inset 0 0 0 1px var(--accent); }
.tour-actions button:is(:disabled, [aria-disabled="true"]) { opacity: .68; cursor: progress; }
.tour-actions > :focus-visible, .tour-home:focus-visible, .chiudi-piantine:focus-visible, #torna:focus-visible, canvas:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
#modofoto, #modo3d { gap: 4px; border-color: var(--accent); }
.tour-actions .tour-exit { color: var(--dim); font-size: 13px; }
#torna {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 44px;
  padding: 0;
  font-size: 21px;
}
.pano #panorama, .pano canvas { width: 100%; height: 100%; }
.pano #panorama { position: absolute; inset: 0; }
.pano canvas { display: block; cursor: grab; touch-action: none; }
.pano canvas:active { cursor: grabbing; }
.pano canvas:focus-visible { outline-offset: -3px; }

#piantine {
  width: min(840px, calc(100vw - 42px), calc((100dvh - 174px) * 1.43));
  max-height: calc(100dvh - 28px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--soft-rule);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 16px 54px var(--shade);
}
#piantine::backdrop { background: rgb(0 0 0 / 48%); }
.piantine-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px 5px 14px;
}
.piantine-head h2 { margin: 0; font: 500 21px/1.2 var(--serif); }
.chiudi-piantine { min-width: 44px; padding: 0; font-size: 22px; }
#tavola-piantine {
  display: block;
  width: 100%;
  height: auto;
  background: var(--paper);
}
@media (max-width: 600px) {
  .tour-head { min-height: 61px; }
  .tour-home { font-size: 13px; }
  .tour-controls { align-items: stretch; flex-direction: column; gap: 10px; min-height: 138px; }
  .tour-actions { flex: none; width: 100%; min-width: 0; gap: 6px; }
  .tour-actions > :is(button, a) { padding-inline: 3px; font-size: clamp(11.5px, 3.55vw, 14px); }
}
@media (max-width: 600px) and (orientation: portrait) {
  #scena { aspect-ratio: 5 / 4; }
  #scena img, #scena video, #scena svg {
    inset: 0 auto 0 50%;
    width: calc(100% * 64 / 45);
    transform: translateX(-50%);
  }
}
@media (max-height: 460px) and (orientation: landscape) {
  .tour-head { padding-block: 3px; min-height: 50px; }
  .tour-controls {
    height: 76px;
    min-height: 76px;
    flex-direction: row;
    align-items: center;
    padding-block: 3px;
  }
  .tour-actions { flex: 0 0 min(415px, 56vw); min-width: min(280px, 52vw); }
  #scena { width: min(100%, calc((100dvh - 126px) * 16 / 9)); }
  #passo { margin-top: 4px; }
  #piantine { width: min(840px, calc(100vw - 42px), calc((100dvh - 126px) * 1.36)); }
}
@media (pointer: coarse) {
  #etichetta { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #zone path, #film { transition: none !important; }
}
