*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; color-scheme: light dark; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
}

[hidden] { display: none !important; }

/* Zero-size anchors for the view ids, at the top of the page (see index.html). */
.view-anchors { position: absolute; top: 0; left: 0; width: 0; height: 0; overflow: hidden; }

.wrap { max-width: var(--page-max); margin: 0 auto; padding: 0 1rem; }

h1 { font-size: 1.5rem; line-height: 1.25; margin: 1.5rem 0 0.5rem; }
h2 { font-size: 1.125rem; line-height: 1.3; margin: 0 0 0.5rem; }

p { margin: 0 0 1rem; max-width: 42rem; }

a { color: var(--ink); text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px; transition: text-decoration-thickness 120ms linear; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.tour { margin: 1rem 0 3rem; }
.stage { max-width: min(100%, max(18rem, calc((100svh - 30.5rem) * 1.92))); margin-inline: auto; }

figure { margin: 0; }

.titles { margin: 0 0 0.75rem; }
.stack > h2 { margin: 0; }

.still {
  display: block;
  width: 100%;
  height: auto;
  background: var(--plaque);
  border: 1px solid var(--rule-strong);
}

.frame { position: relative; background: var(--plaque); border: 1px solid var(--rule-strong); }
.frame .still { border: 0; }
.move {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  visibility: hidden;
  pointer-events: none;
}
.move.is-shown { visibility: visible; }

.caption { margin-top: 0.75rem; }
.caption p { margin: 0 0 0.25rem; max-width: none; }
.intro { max-width: none; }
.caption .line-two { font-size: var(--step--1); color: var(--ink-muted); }

/* Text that changes with the view is stacked in one grid cell. The cell is as tall as the tallest text, so nothing below it moves. */
.stack { display: grid; }
.stack > * { grid-area: 1 / 1; visibility: hidden; }
.stack > .is-current { visibility: visible; }

.plaque {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--plaque);
  border: 1px solid var(--rule);
  font-size: 0.9375rem;
}
.plaque strong { display: block; font-size: 1rem; }
.plaque.stack > div { grid-area: 1 / 1; }
.plaque-line { display: block; }
/* A museum link sits to the right of the plaque text when there is room, so the plaque is no taller and the controls stay above the fold. */
@media (min-width: 40rem) {
  /* Reserve the height of the tallest plaque (two museum links), so the plaque that tour.js builds after load does not push the controls down. */
  .plaque.stack { min-height: 7.7rem; }
  .plaque.stack > div { display: grid; grid-template-columns: 1fr auto; column-gap: 1rem; align-items: center; }
  .plaque.stack > div > strong, .plaque.stack > div > .plaque-line { grid-column: 1; }
  .plaque.stack > div > .museum-links { grid-column: 2; grid-row: 1 / span 2; margin-top: 0; }
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}
.controls .counter { flex: 1 1 auto; max-width: none; margin: 0; text-align: center; font-weight: 600; }

.btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem 1rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background-color 120ms linear;
}
.btn:hover { background: var(--plaque); }
.controls .btn { flex: 0 0 auto; }
@media (max-width: 29.99rem) {
  /* The counter has its own row, so a longer "Step 2 of 3" text never wraps and never moves the buttons. */
  .controls .counter { flex: 1 0 100%; order: -1; }
  .controls .btn:not(.replay) { flex: 1 1 0; }
  .controls .replay { flex: 1 0 100%; }
}
.btn[aria-disabled="true"] {
  color: var(--ink-muted);
  border-color: var(--rule-strong);
  background: var(--paper);
  cursor: default;
}

/* Phones: the controls sit directly under the still, then the caption and plaque, so Previous, Next and Replay stay above the fold.
   The figure is flattened so its caption can move below the controls. Every text block keeps its stacked cell, so nothing shifts. */
@media (max-width: 39.99rem) {
  h1 { font-size: 1.25rem; margin: 0.5rem 0 0.25rem; }
  .tour { margin: 0.5rem 0 1.5rem; }
  .stage { display: flex; flex-direction: column; max-width: min(100%, max(18rem, calc((100svh - 23rem) * 1.92))); }
  .stage > figure { display: contents; }
  .titles { order: 0; margin-bottom: 0.5rem; }
  .frame { order: 1; }
  .controls { order: 2; margin-top: 0.5rem; gap: 0.5rem; }
  .caption { order: 3; }
  .plaque { order: 4; }
}

/* Phones turned sideways (and other short, wide screens): the still sits on the left, sized by the height left under the header,
   and the title, controls, caption and plaque are stacked on the right. The controls are in view without scrolling.
   The same stacked text cells keep the heights fixed, so nothing shifts. Portrait and desktop are not touched by this block. */
@media (orientation: landscape) and (max-height: 500px) {
  h1 { font-size: 1.125rem; margin: 0.25rem 0 0.25rem; }
  .tour { margin: 0.25rem 0 1.5rem; }
  .stage {
    display: grid;
    max-width: none;
    grid-template-columns: min(60%, max(12rem, calc((100svh - 6.5rem) * 1.92))) minmax(0, 1fr);
    grid-template-rows: auto auto auto 1fr;
    column-gap: 1rem;
    align-content: start;
  }
  .stage > figure { display: contents; }
  .frame { grid-column: 1; grid-row: 1 / span 4; align-self: start; order: 0; }
  .titles { grid-column: 2; grid-row: 1; margin-bottom: 0.5rem; order: 0; }
  .controls { grid-column: 2; grid-row: 2; margin-top: 0; gap: 0.5rem; order: 0; }
  .caption { grid-column: 2; grid-row: 3; margin-top: 0.5rem; order: 0; }
  .plaque { grid-column: 2; grid-row: 4; align-self: start; margin-top: 0.5rem; order: 0; }
  .controls .counter { flex: 1 0 100%; order: -1; }
  .controls .btn:not(.replay) { flex: 1 1 0; }
  .controls .replay { flex: 1 0 100%; }
  .plaque.stack > div { display: block; }
  .plaque.stack > div > .museum-links { margin-top: 0.25rem; }
}

.below { display: grid; gap: 2rem; margin-top: 2rem; }
.steps-box { min-height: 12.5rem; }
.steps-box .one-view { margin: 0; color: var(--ink-muted); }
.stops-list { margin: 0; padding: 0 0 0 1.75rem; }
.stops-list li { margin: 0 0 0.125rem; }
.stops-list .step-btn[aria-current="step"] { font-weight: 700; }

.steps { margin: 0; padding: 0 0 0 1.75rem; }
.steps li { margin: 0 0 0.25rem; }
.step-btn {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.25rem;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: text-decoration-thickness 120ms linear;
}
.step-btn:hover { text-decoration: underline; }
.step-btn[aria-current="step"] {
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.plan svg { display: block; width: 100%; max-width: 40rem; height: auto; color: var(--ink); }
.plan svg * { vector-effect: non-scaling-stroke; }
.plan .plan-outer { stroke-width: 2; }
.plan .plan-rooms { stroke-width: 1; }
.plan .dot { fill: currentColor; stroke: none; }
.plan figcaption { margin-top: 0.5rem; font-size: var(--step--1); color: var(--ink-muted); }

.line-two { font-size: var(--step--1); color: var(--ink-muted); }
.grades { display: grid; gap: 2rem; margin: 1rem 0 3rem; }

@media (min-width: 48rem) {
  .below { grid-template-columns: 1fr 1fr; align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  a, .btn, .step-btn { transition: none; }
  .move, .replay { display: none; }
}

@media (forced-colors: active) {
  :focus-visible { outline-color: Highlight; }
}

/* Skip the move and Replay the move share one width, so the controls row never shifts. */
.controls .replay { min-width: 11rem; text-align: center; }
.museum-links { display: flex; flex-direction: column; }
.museum-link { display: inline-block; margin-top: 0.25rem; padding-block: 0.6875rem; }
