/* STL viewer and repair (stl-viewer.html): only what style.css doesn't have already. */

.linkish {
  font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px; font-weight: 700;
}
.linkish:hover { color: var(--accent-hover); }

/* the empty viewer is the drop target */
.stl-tool .viewer-empty.stl-empty { pointer-events: auto; }
.stl-empty > div { display: grid; gap: 8px; justify-items: center; max-width: 340px; }
.stl-empty svg { color: var(--accent); margin-bottom: 4px; }
.stl-empty b { color: var(--ink); font-size: 1.05rem; }
.stl-samples { font-size: .86rem; margin-top: 10px; }
body.stl-dragging .viewer { outline: 3px dashed var(--accent); outline-offset: -3px; background: var(--accent-soft); }

.stl-tool .viewer-toolbar-bottom { top: auto; bottom: 12px; }
.stl-tool .viewer-toolbar { flex-wrap: wrap; }
.seg button[aria-pressed="true"]:not(.active) { background: var(--ink); color: #fff; }
.stl-mode-hint {
  position: absolute; left: 50%; bottom: 58px; transform: translateX(-50%); margin: 0; padding: 6px 12px;
  background: var(--ink); color: #fff; border-radius: 999px; font-size: .84rem; font-weight: 700; white-space: nowrap; pointer-events: none;
}
.stl-mode-hint[hidden] { display: none; }
.stl-label {
  position: absolute; transform: translate(-50%, -130%); padding: 6px 10px; border-radius: 8px; pointer-events: none;
  background: rgba(255, 255, 255, .96); border: 1px solid var(--line); box-shadow: var(--shadow); text-align: center; white-space: nowrap;
}
.stl-label b { display: block; font-size: 1rem; font-variant-numeric: tabular-nums; }
.stl-label small { color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; }
.stl-label[hidden] { display: none; }

.stl-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; margin-top: 6px; font-size: .82rem; color: var(--muted); }
.stl-legend[hidden] { display: none; }
.stl-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-right: 6px; vertical-align: -1px; }

/* the dropzone gets small once a file is open */
.dropzone.compact { padding: 12px 14px; }
.dropzone.compact .muted { display: none; }
.dropzone.compact b { margin: 0; font-size: .92rem; }

.stl-parts { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.stl-parts li { display: flex; gap: 6px; align-items: stretch; }
.stl-part {
  flex: 1; min-width: 0; text-align: left; font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid transparent; border-radius: var(--radius-sm); padding: 9px 12px; cursor: pointer;
}
.stl-part:disabled { cursor: default; }
.stl-part.on { border-color: var(--accent); background: var(--accent-soft); }
.stl-part b { display: block; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stl-part small { color: var(--muted); font-size: .8rem; }
.stl-part em { font-style: normal; font-weight: 700; }
.stl-part em.ok { color: var(--accent); }
.stl-part em.bad { color: var(--error); }
.stl-remove {
  flex: none; width: 36px; font: inherit; font-size: 1.2rem; color: var(--muted); background: var(--surface);
  border: 0; border-radius: var(--radius-sm); cursor: pointer;
}
.stl-remove:hover { color: var(--error); }
.stl-part-actions { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 10px; font-size: .9rem; }
.stl-part-actions[hidden], .stl-part-actions [hidden] { display: none; }

.stl-checks { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.stl-checks li { display: flex; gap: 10px; align-items: flex-start; }
.stl-checks b { display: block; font-size: .94rem; }
.stl-checks small { display: block; color: var(--muted); font-size: .84rem; line-height: 1.4; }
.stl-dot {
  flex: none; width: 22px; height: 22px; border-radius: 50%; margin-top: 1px; background: var(--surface-2);
  display: grid; place-items: center; color: #fff; font-size: .8rem; font-weight: 800;
}
.stl-checks li[data-state="ok"] .stl-dot { background: var(--accent); }
.stl-checks li[data-state="ok"] .stl-dot::before { content: "✓"; }
.stl-checks li[data-state="bad"] .stl-dot { background: var(--error); }
.stl-checks li[data-state="bad"] .stl-dot::before { content: "!"; }
.stl-checks li[data-state="bad"] small { color: var(--error); }
.stl-checks li[data-state="info"] .stl-dot { background: var(--muted); }
.stl-checks li[data-state="info"] .stl-dot::before { content: "i"; font-style: italic; font-family: Georgia, serif; }
.stl-report { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); font-size: .9rem; line-height: 1.45; }
.stl-report.ok { background: var(--accent-soft); color: var(--accent-hover); }
.stl-report.bad { background: var(--warn-soft); color: var(--warn); }
.stl-report[hidden] { display: none; }

.stl-dims { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stl-dims label { display: grid; gap: 4px; position: relative; }
.stl-dims span { font-weight: 700; font-size: .82rem; }
.stl-dims input, .stl-unit-input input { padding-right: 34px; font-variant-numeric: tabular-nums; }
.stl-dims i, .stl-unit-input i {
  position: absolute; right: 10px; bottom: 12px; font-style: normal; font-size: .82rem; color: var(--muted); pointer-events: none;
}
.stl-unit-input { position: relative; }
.stl-hint { font-size: .85rem; margin: 0 0 14px; padding: 8px 12px; border-radius: var(--radius-sm); }
.stl-hint.warn { background: var(--warn-soft); color: var(--warn); }
.stl-hint[hidden] { display: none; }
#fit.ok { color: var(--accent); font-weight: 600; }
#fit.bad { color: var(--error); font-weight: 600; }
.stl-custom { grid-template-columns: repeat(3, 1fr); margin-top: 8px; }
.stl-custom[hidden] { display: none; }
.stl-rotate { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stl-rotate .btn { padding-left: 6px; padding-right: 6px; }

.stl-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0 0; }
.stl-stats div { background: var(--surface); border-radius: var(--radius-sm); padding: 10px 12px; min-width: 0; }
.stl-stats dt { font-size: .78rem; color: var(--muted); font-weight: 600; }
.stl-stats dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .95rem; overflow-wrap: anywhere; }

/* the cut block opens and closes */
.stl-cut summary { list-style: none; cursor: pointer; }
.stl-cut summary::-webkit-details-marker { display: none; }
.stl-cut summary h2 { margin-bottom: 4px; }
.stl-cut summary h2::after { content: "+"; margin-left: auto; font-size: 1.3rem; color: var(--muted); font-weight: 500; }
.stl-cut[open] summary h2::after { content: "–"; }
.stl-cut summary small { display: block; color: var(--muted); font-size: .86rem; }
.stl-cut[open] summary { margin-bottom: 14px; }

.stl-status { font-size: .88rem; margin: 12px 0 0; min-height: 1.4em; }
.stl-status.error { color: #ffb4ab; }
#block-download .share-btn { margin-top: 14px; background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
#block-download .share-btn:hover { background: rgba(255,255,255,.08); }

.stl-more { padding: 8px 0 32px; }
.stl-more .section-head { margin-bottom: 20px; }

@media (max-width: 979px) and (min-height: 560px) {
  .stl-tool .tool-stage .stl-legend { display: none; }
  .stl-mode-hint { bottom: 50px; font-size: .78rem; }
}
@media (max-width: 520px) {
  .stl-tool .viewer-toolbar { left: 8px; right: 8px; gap: 6px; }
  .stl-tool .viewer-toolbar-bottom { bottom: 8px; }
  .stl-tool .seg button { padding: 5px 7px; font-size: .76rem; }
}
