/* Journeys and VR: the viewers' own look. Everything shared (stage, chips, fields, notes) is in site.css.
   A viewer is a .stage that holds one canvas; the controls sit under it and wrap. */

/* a viewer you can focus: the arrow keys work on it, so it needs a visible ring */
.viewer { cursor: default; }
.viewer:focus-visible { outline: 2px solid var(--teal); outline-offset: 4px; border-radius: calc(var(--radius) + 4px); }
.viewer.grab { cursor: grab; touch-action: pan-y; }
.viewer.grabbing { cursor: grabbing; }

/* what shows when there is no JavaScript, or no WebGL: a calm message in the viewer's place */
.viewer-fallback {
  position: absolute; inset: 0; display: none; place-items: center; text-align: center;
  padding: 24px; color: var(--muted); font-size: 0.95rem; line-height: 1.6;
}
.viewer-fallback p { margin: 0; max-width: 46ch; }
html:not(.js) .viewer-fallback, .viewer.no-gl .viewer-fallback { display: grid; }
html:not(.js) .js-only { display: none !important; }
.viewer.no-gl canvas { visibility: hidden; }

/* the little line under a viewer that says what it is */
.viewer-read {
  display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 12px 2px 0;
  font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint);
}
.viewer-read b { font-weight: 400; color: var(--muted); letter-spacing: 0.04em; text-transform: none; font-size: 0.86rem; }

/* controls: groups that wrap, with a quiet label in front */
.ctl-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ctl-label {
  font-size: 0.74rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint);
  margin-right: 4px; white-space: nowrap;
}
.controls.spaced { gap: 14px 28px; align-items: flex-end; }
.controls .field { flex: 1 1 220px; max-width: 360px; }
.chip[disabled] { opacity: 0.5; cursor: not-allowed; }

/* four ways of travelling, four numbered steps: quiet cards */
.steps { counter-reset: step; list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(12px, 2vw, 20px); grid-template-columns: repeat(4, 1fr); }
.steps li {
  counter-increment: step; position: relative; padding: 3.1rem 1.3rem 1.3rem; border: 1px solid var(--line);
  border-radius: var(--radius); background: linear-gradient(160deg, rgba(255,255,255,0.04), rgba(255,255,255,0.012));
  color: var(--muted); font-size: 0.97rem; line-height: 1.6;
}
.steps li::before {
  content: counter(step); position: absolute; top: 1.05rem; left: 1.3rem;
  font-family: var(--serif); font-size: 1.7rem; line-height: 1; color: var(--teal);
}
.steps li b { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.35rem; color: #eef2f5; margin-bottom: 0.25rem; }
@media (max-width: 1000px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }

/* the four shapes of a voyage, the four ways it travels */
.kinds { display: grid; gap: clamp(12px, 2vw, 20px); grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin: 1.4rem 0 0; padding: 0; list-style: none; }
.kinds li { padding: 1.1rem 1.25rem; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,0.025); color: var(--muted); font-size: 0.95rem; line-height: 1.55; }
.kinds li b { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.3rem; color: #eef2f5; }

/* the three hallway flavours and the three ways the comfort numbers read */
.facts { display: grid; gap: 10px 22px; grid-template-columns: max-content 1fr; margin: 0 0 1.2em; }
.facts dt { color: var(--faint); font-size: 0.74rem; letter-spacing: 0.18em; text-transform: uppercase; padding-top: 0.35em; }
.facts dd { margin: 0; color: #c3ccd4; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; gap: 2px; } .facts dd { margin-bottom: 0.8rem; } }

/* an in-page table of contents */
.toc { display: flex; flex-wrap: wrap; gap: 8px 10px; justify-content: center; margin: 1.6rem 0 0; padding: 0; list-style: none; }
.toc a {
  display: inline-block; padding: 8px 15px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none;
  color: var(--muted); font-size: 0.82rem; letter-spacing: 0.1em; text-transform: uppercase;
  transition: color 0.5s var(--ease), border-color 0.5s var(--ease);
}
.toc a:hover { color: var(--text); border-color: var(--line-strong); }

/* the small figures that explain: a drawn diagram is code too (SVG) */
.diagram { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,0.02); padding: clamp(14px, 3vw, 26px); }
.diagram svg { width: 100%; height: auto; }
.diagram figcaption { margin-top: 12px; color: var(--muted); font-size: 0.9rem; }
figure.diagram { margin: 0; }

/* a coalesce meter under the sphere */
.meter { height: 3px; border-radius: 3px; background: rgba(255,255,255,0.08); overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, rgba(127,230,210,0.8), rgba(185,168,244,0.8)); }

/* the two small messages a viewer can show over its black */
.stage-state { text-align: center; padding: 0 20px; }
.stage-state .s-wait { display: none; }
.stage.waiting .stage-state { opacity: 1; }
.stage.waiting .stage-state .s-load { display: none; }
.stage.waiting .stage-state .s-wait { display: inline; }

/* the steps stacked in one column (inside a half-width column) */
.steps.stack { grid-template-columns: 1fr; }
.steps.stack li { padding: 1rem 1.2rem 1rem 3.6rem; }
.steps.stack li::before { top: 0.95rem; left: 1.2rem; }

/* tables whose first cell names the row: the name reads as text, not as a tiny label, and every column may wrap,
   so a phone gets the whole table without pushing the page wider */
table th[scope="row"] { white-space: normal; text-transform: none; letter-spacing: 0.01em; font-size: 0.95rem; color: #e3e9ee; font-weight: 400; min-width: 6.5rem; }
table td { white-space: normal; }
@media (max-width: 640px) {
  th, td { padding: 0.65rem 0.75rem; }
  th[scope="col"] { white-space: normal; letter-spacing: 0.1em; font-size: 0.68rem; }
  table { font-size: 0.9rem; }
}

/* no WebGL: the viewer says so calmly in its own place, and the controls that would drive it step aside */
.viewer.no-gl ~ .controls, .viewer.no-gl ~ .viewer-read, .viewer.no-gl ~ .meter { display: none; }
.viewer.no-gl .stage-caption, .viewer.no-gl .stage-state { display: none; }
html:not(.js) .stage-caption, html:not(.js) .stage-state { display: none; }
