/* Interactive viewer — reuses the project's palette from style.css */

body { padding-bottom: 24px; }

header { padding: 28px 0 18px; }
h1 { font-size: clamp(28px, 4.5vw, 40px); margin-bottom: 6px; }
.sub { font-size: 15px; }
.back { font-size: 14px; margin: 8px 0 0; }
.back a { text-decoration: none; }

/* ------------------------------------------------------------- viewport */
/* No background colour. The canvas is alpha-transparent (viewer.js sets
   alpha:true and scene.background = null) so it composites over whatever the
   page paints here, which is what makes the space around and - seen from below
   - through the machine read as space rather than as a slab of grey at a fixed
   distance. The #808080 that used to live here was duplicated inside
   scene.background, and the pair of them is why orbiting underneath the
   machine showed no ground at all. */
#viewport {
  position: relative;
  width: 100%;
  height: min(68vh, 640px);
  min-height: 380px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: transparent;
}

#viewport canvas { display: block; width: 100%; height: 100%; }

#loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #fff;
  font-size: 15px;
  background: #808080;
  text-align: center;
}

.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- panel */
#panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px 24px;
  margin-top: 22px;
}

.group h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  font-weight: 600;
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.btns { display: flex; flex-wrap: wrap; gap: 6px; }

.btn {
  font: inherit;
  font-size: 13px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.btn:hover { border-color: var(--accent); }
.btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.wide { width: 100%; margin-top: 8px; }

.chk {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 3px 0;
  cursor: pointer;
  user-select: none;
}

.chk input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

.axis { display: flex; gap: 6px; margin: 8px 0; }
.axis button { flex: 1; font-size: 13px; padding: 5px 0; }

.slider { display: block; font-size: 13px; margin-bottom: 12px; }
.slider span { display: flex; justify-content: space-between; color: var(--ink-soft); margin-bottom: 5px; }
.slider output { font-variant-numeric: tabular-nums; color: var(--ink); }

input[type=range] {
  width: 100%;
  accent-color: var(--accent);
  height: 18px;
  cursor: pointer;
}

#clipVal {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dims div {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px dotted var(--line);
}

.dims span { color: var(--ink-soft); }
.dims b { font-variant-numeric: tabular-nums; }

.note { font-size: 11px; color: var(--ink-soft); margin: 8px 0 0; line-height: 1.5; }

.hint {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--ink-soft);
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

@media (max-width: 600px) {
  #viewport { height: 56vh; }
  #panel { grid-template-columns: repeat(2, 1fr); }
}
