/* Walkthrough: the photograph is the whole stage. Controls are near-opaque rail-black
   boxes set inside the viewer edge; neighbouring setups are survey marks on the ground. */
body[data-view='walkthrough'] #stage {
  overflow: hidden;
}
@media (min-width: 761px) {
  body[data-view='walkthrough'] .page-head {
    display: none;
  }
}
.walkthrough {
  /* Height of one row of boxed controls: a 36px control, 3px padding and a 1px edge. */
  --walk-row: 44px;
  position: relative;
  height: 100%;
  min-height: 0;
  background: var(--plate);
}
.walkthrough:fullscreen {
  width: 100%;
  height: 100%;
}
.walk-viewport,
.walk-photo,
.walk-cloud,
.walk-cloud-layer {
  position: absolute;
  inset: 0;
}
.walkthrough [hidden] {
  display: none !important;
}
.walk-photo .psv-container {
  background: var(--plate);
  font-family: var(--font);
}
.walk-photo .psv-loader {
  color: var(--lime);
}
.walk-photo:focus-visible,
.walk-cloud canvas:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: -4px;
}

/* Boxes inside the viewer edge ------------------------------------------------ */
.walk-box {
  background: rgba(10, 13, 10, 0.92);
  border: 1px solid var(--line);
}
.walk-top,
.walk-tools,
.walk-step,
.walkthrough .walk-plan {
  position: absolute;
  z-index: 130;
}
.walk-top {
  top: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: calc(100% - 28px);
  pointer-events: none;
}
.walk-top > * {
  pointer-events: auto;
}
.walk-modes {
  display: flex;
  gap: 2px;
  padding: 3px;
}
.walk-modes .button {
  min-height: 36px;
  padding: 6px 13px;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-weight: 520;
}
.walk-modes .button:hover {
  background: var(--raised);
  color: var(--ink);
}
.walk-modes .button[aria-pressed='true'] {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--lime-ink, #151b06);
  font-weight: 620;
}
.walkthrough .walk-status {
  padding: 6px 10px;
  color: var(--ink);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.walk-error {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--danger);
  font-size: 14px;
}

/* Icon tools ------------------------------------------------------------------ */
.walk-tools {
  top: 14px;
  right: 14px;
  display: flex;
  gap: 2px;
  padding: 3px;
}
.walk-tool {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 2px;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}
.walk-tool::-webkit-details-marker {
  display: none;
}
.walk-tool:hover,
.walk-pop[open] > .walk-tool {
  background: var(--raised);
}
.walk-tool:disabled {
  color: var(--graticule);
  cursor: default;
  background: transparent;
}
.walk-tool:focus-visible,
.walk-modes .button:focus-visible,
.walk-step select:focus-visible,
.walk-plan summary:focus-visible,
.walk-plan [role='button']:focus-visible,
.walk-ring:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}
.walk-pop {
  position: relative;
}
.walk-pop-body {
  position: absolute;
  top: calc(100% + 9px);
  right: -3px;
  width: min(360px, calc(100vw - 40px));
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.walk-pop-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}
.walk-pop-body p + p {
  margin-top: 10px;
}
.walk-cloud-tools {
  display: grid;
  gap: 12px;
}
.walk-cloud-tools label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}
.walk-cloud-tools label:has(input[type='checkbox']) {
  justify-content: flex-start;
}
.walk-cloud-tools select {
  min-height: 36px;
  padding: 6px 10px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 3px;
  font: inherit;
}

/* About: project facts set as the sheet's fact grid. */
.walk-info {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.walk-info div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
}
.walk-info dt {
  color: var(--sage);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-variation-settings: 'wdth' 118;
}
.walk-info dd {
  margin: 0;
  color: var(--ink);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
/* Client access (staff): the state, what it means, and the one action. */
.walk-pop-body .walk-access-state {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}
.walk-access.is-published .walk-access-state {
  color: var(--lime);
}
.walk-access-action {
  margin-top: 14px;
}
.walk-access:not(.is-published) .walk-access-action {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--lime-ink, #151b06);
  font-weight: 620;
}
.walk-pop-body .walk-access-error:empty {
  display: none;
}
.walk-pop-body .walk-access-error {
  color: var(--danger);
}

/* Setup stepper --------------------------------------------------------------- */
.walk-step {
  left: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
}
.walk-step select {
  height: 36px;
  padding: 0 10px;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: 2px;
  font: inherit;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.walk-step select:hover {
  background: var(--raised);
}
.walk-step option {
  background: var(--surface);
  color: var(--ink);
}

/* Viewpoint plan -------------------------------------------------------------- */
.walkthrough .walk-plan {
  right: 14px;
  bottom: 14px;
  padding: 0 12px;
  max-width: calc(100% - 28px);
}
.walk-plan summary {
  display: flex;
  align-items: center;
  min-height: 42px;
  font-size: 14px;
  cursor: pointer;
}
.walk-plan[open] .walk-plan-content {
  width: min(440px, 70vw);
}
.walk-plan svg {
  display: block;
  width: 100%;
}
.walk-plan-content p {
  margin: 6px 0 12px;
  max-width: 100%;
  color: var(--muted);
  font-size: 13px;
}
.walk-plan .walk-links {
  fill: none;
  stroke: var(--graticule);
  stroke-width: 1;
}
.walk-plan circle {
  fill: var(--surface);
  stroke: var(--muted);
  stroke-width: 1;
}
/* Photo-only setups (no scan of their own) are drawn open and dotted. */
.walk-plan .photo-only circle {
  fill: var(--bg);
  stroke-dasharray: 2 2;
}
.walk-plan text {
  fill: var(--sage);
  font: 12px var(--font);
}
.walk-plan [role='button'] {
  cursor: pointer;
}
.walk-plan [aria-pressed='true'] circle,
.walk-plan .photo-only[aria-pressed='true'] circle {
  fill: var(--lime);
  stroke: var(--lime);
  stroke-dasharray: none;
}
.walk-plan [aria-pressed='true'] text {
  fill: var(--lime-ink, #151b06);
}
.walk-bearing {
  fill: var(--lime);
}
.walk-plan .walk-plan-label {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* Ground rings: a neighbouring setup drawn where its tripod stood ---------------- */
.walk-ring {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}
.walk-ring-mark {
  position: absolute;
  left: 50%;
  top: 50%;
  /* --a: the ring's angular width in radians; --k: pixels per radian at this zoom. */
  width: clamp(18px, calc(var(--a) * var(--k, 470) * 1px), 190px);
  aspect-ratio: 1 / var(--squash, 0.4);
  translate: -50% -50%;
  border: 2px solid var(--plate-white, #fff);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7));
  transition:
    background-color 0.18s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.18s cubic-bezier(0.16, 1, 0.3, 1),
    scale 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.walk-ring-label {
  position: absolute;
  left: 50%;
  bottom: calc(50% + 12px);
  translate: -50% 0;
  color: var(--plate-white, #fff);
  font-size: 11px;
  font-weight: 620;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-shadow:
    0 0 3px #0a0d0a,
    0 0 3px #0a0d0a,
    0 1px 2px #0a0d0a;
  pointer-events: none;
}
.walk-ring:hover .walk-ring-mark,
.walk-ring:focus-visible .walk-ring-mark {
  border-color: var(--lime);
  background: rgba(210, 222, 38, 0.3);
  scale: 1.12;
}
.walk-ring:hover .walk-ring-label,
.walk-ring:focus-visible .walk-ring-label {
  color: var(--lime);
}
.walk-ring:focus-visible {
  outline-offset: 6px;
}

@media (pointer: coarse) {
  .walkthrough {
    --walk-row: 52px;
  }
  .walk-tool,
  .walk-step select {
    width: 44px;
    height: 44px;
  }
  .walk-step select {
    width: auto;
  }
  .walk-modes .button {
    min-height: 44px;
  }
}
@media (max-width: 760px) {
  .walk-top,
  .walk-step {
    left: 10px;
  }
  .walk-top,
  .walk-tools {
    top: 10px;
  }
  .walk-tools,
  .walkthrough .walk-plan {
    right: 10px;
  }
  .walk-step,
  .walkthrough .walk-plan {
    bottom: 10px;
  }
  /* Tools drop beneath the mode switch so neither is squeezed. */
  .walk-tools {
    top: calc(10px + var(--walk-row) + 8px);
    left: 10px;
    right: auto;
  }
  .walk-pop-body {
    right: auto;
    left: -3px;
  }
  /* The status line sits below the tools row. */
  .walkthrough .walk-status {
    margin-top: calc(var(--walk-row) + 8px);
  }
  .walk-modes .button {
    padding: 6px 11px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .walk-ring-mark {
    transition: none;
  }
}

/* The point cloud's own count line sits above the setup stepper, not under it. */
.walkthrough .viewer-note {
  left: 14px;
  bottom: calc(14px + var(--walk-row) + 8px);
  z-index: 130;
}
@media (max-width: 760px) {
  .walkthrough .viewer-note {
    left: 10px;
    bottom: calc(10px + var(--walk-row) + 8px);
  }
}
