:root {
  --bg: #f5f4f1;
  --surface: #ffffff;
  --ink: #17191c;
  --ink-soft: #5d636b;
  --line: #e2e0da;
  --accent: #12324d;
  --accent-ink: #ffffff;
  --stage: #8f9094;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  -webkit-text-size-adjust: 100%;
}

body.locked { overflow: hidden; }

a { color: inherit; }

/* ---------- header ---------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 24px;
  max-width: 1560px;
  margin: 0 auto;
  padding: 14px 24px;
}

.brand {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--accent);
}

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 18px;
  font-style: normal;
  font-size: 14px;
  color: var(--ink-soft);
}

.contact a { text-decoration: none; }
.contact a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- layout ---------- */

.stone {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-areas: "viewer panel" "views panel";
  /* a tall details panel must not push the views away from the player */
  grid-template-rows: auto 1fr;
  gap: 12px 28px;
  align-items: start;
  max-width: 1560px;
  margin: 0 auto;
  padding: 4px 24px 32px;
}

.stone[hidden] { display: none; }

.viewer { grid-area: viewer; min-width: 0; }
.views  { grid-area: views; min-width: 0; }
.panel  { grid-area: panel; }

/* ---------- stage ---------- */

.stage {
  position: relative;
  /* as large as the screen allows while keeping controls and views in sight */
  width: min(100%, calc((100vh - 232px) * 4 / 3));
  min-width: min(100%, 420px);
  aspect-ratio: 4 / 3;
  margin: 0 auto;
  background: var(--stage);
  border-radius: var(--radius);
  overflow: hidden;
}

.stage canvas,
.stage video {
  display: block;
  width: 100%;
  height: 100%;
}

.stage canvas {
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.stage canvas.dragging { cursor: grabbing; }
.stage canvas.zoomed { touch-action: none; cursor: move; }

.progress {
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.25);
  transition: opacity 0.4s;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}

.progress.done { opacity: 0; }

.hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  margin: 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(20, 22, 26, 0.55);
  color: #fff;
  font-size: 13px;
  pointer-events: none;
  transition: opacity 0.4s;
}

.hint.gone { opacity: 0; }

/* ---------- controls ---------- */

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 10px 0 2px;
}

.controls[hidden],
.views[hidden] { display: none; }

.controls button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.controls button:hover { border-color: var(--accent); color: var(--accent); }

.controls button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.controls button:disabled { opacity: 0.4; cursor: default; }

.controls svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.controls svg .fill,
.controls .i-play path { fill: currentColor; }

.controls .sep { width: 10px; }

#btn-play .i-play,
#btn-play.paused .i-pause,
#btn-expand .i-collapse,
#btn-expand[aria-pressed="true"] .i-expand { display: none; }

#btn-play.paused .i-play,
#btn-expand[aria-pressed="true"] .i-collapse { display: block; }

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- views (360 / front / back / left / right) ---------- */

.views {
  display: flex;
  justify-content: center;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 6px;
}

.views button {
  flex: 0 0 auto;
  width: 104px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  text-align: center;
  cursor: pointer;
}

.views img,
.views .thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-bottom: 4px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--stage);
  outline: 2px solid transparent;
  outline-offset: 1px;
}

.views button[aria-current="true"] { color: var(--ink); font-weight: 600; }
.views button[aria-current="true"] img { outline-color: var(--accent); }

/* ---------- details panel ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.panel h1 {
  margin: 0 0 16px;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  margin: 0;
}

.facts dt,
.facts dd {
  margin: 0;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 15px;
}

.facts dt { color: var(--ink-soft); padding-right: 18px; }

.facts dd {
  text-align: right;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.more { border-top: 1px solid var(--line); }

.more summary {
  padding: 10px 0;
  font-size: 14px;
  color: var(--accent);
  cursor: pointer;
}

.more .facts dt:first-of-type,
.more .facts dd:first-of-type { border-top: 0; padding-top: 0; }

.comments {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.actions {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.btn {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 550;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn[hidden] { display: none; }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn.primary:hover { color: var(--accent-ink); filter: brightness(1.15); }

.notice {
  max-width: 560px;
  margin: 80px auto;
  padding: 0 24px;
  text-align: center;
  color: var(--ink-soft);
}

/* ---------- full screen ---------- */

.viewer.expanded {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: #101114;
}

.viewer.expanded .stage {
  flex: 1;
  width: 100%;
  min-height: 0;
  aspect-ratio: auto;
  border-radius: 0;
  background: #101114;
}

.viewer.expanded .controls { padding: 10px 0 max(10px, env(safe-area-inset-bottom)); }

.viewer.expanded .controls button {
  background: #1d1f24;
  border-color: #33363d;
  color: #f1f1f1;
}

.viewer.expanded .controls button:hover { border-color: #9fb6cc; color: #fff; }

.viewer.expanded .controls button[aria-pressed="true"] {
  background: #f1f1f1;
  border-color: #f1f1f1;
  color: #101114;
}

/* ---------- small screens ---------- */

@media (max-width: 900px) {
  .site-header { padding: 12px 16px; }

  .stone {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "viewer" "views" "panel";
    grid-template-rows: auto;
    padding: 0 16px 28px;
  }

  .stage { width: 100%; min-width: 0; }
  /* keep all seven buttons on one row on a phone */
  .controls { gap: 4px; }
  .controls button { width: 40px; height: 40px; }
  .controls .sep { width: 4px; }
  .views { justify-content: flex-start; }
  .views button { width: 84px; }
}
