/* Shared by the 3D lesson and the wall-footing comparison on the sample home page. */
.moisture-exhibit {
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink);
  font: 400 16px/1.55 var(--sans);
}
#moisture-dialog {
  width: min(1190px, calc(100vw - 40px)); max-width: none;
  max-height: calc(100dvh - 36px); padding: 0;
  overflow: auto; overscroll-behavior: contain;
  box-shadow: 0 18px 64px rgb(23 25 28 / 22%);
}
#moisture-dialog::backdrop { background: rgb(23 25 28 / 62%); }
.moisture-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--paper); border-bottom: 1px solid var(--line);
  padding: 16px 22px; border-radius: 12px 12px 0 0;
}
#moisture-dialog .moisture-header { position: sticky; z-index: 2; top: 0; }
.moisture-header :is(h1,h2) { margin: 0; font: 650 clamp(23px,2.25vw,32px)/1.3 var(--serif); }
.moisture-header p { margin: 3px 0 0; font-size: 14px; color: var(--muted); }
.moisture-header form { flex: none; margin: 0; }
.moisture-exhibit button, .moisture-strip label span {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); color: var(--ink);
  min-height: 38px; padding: 6px 13px;
  font: 550 14px/1.45 var(--sans); cursor: pointer; touch-action: manipulation;
}
.moisture-exhibit button:focus-visible, .moisture-exhibit input:focus-visible,
.moisture-strip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.moisture-exhibit button:disabled { color: var(--muted); cursor: default; }
@media (hover:hover) {
  .moisture-exhibit button:hover:not(:disabled), .moisture-strip label:hover span { border-color: var(--ink); }
}
.moisture-body { display: grid; grid-template-columns: minmax(0,1fr) clamp(250px,26%,310px); }
.moisture-visual { min-width: 0; margin: 0; display: flex; flex-direction: column; }
.moisture-canvas { position: relative; isolation: isolate; min-width: 0; background: #eae8df; }
#moisture-canvas { height: clamp(290px,47svh,525px); }
#moisture-canvas canvas { position: absolute; display: block; inset: 0; z-index: -1; touch-action: none; }
.moisture-view-hint {
  position: absolute; top: 10px; left: 12px; pointer-events: none;
  padding: 4px 9px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 5px; font-size: 12px;
}
#moisture-error { position: absolute; inset: 48px 12px auto; margin: 0; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
#moisture-error[hidden] { display: none; }
.moisture-caption, .moisture-strip {
  display: flex; align-items: center; gap: 12px 18px; padding: 9px 15px;
  border-top: 1px solid var(--line);
}
.moisture-caption { justify-content: space-between; flex-wrap: wrap; }
.moisture-legend, .moisture-playback { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.moisture-legend { gap: 6px 13px; color: var(--muted); font-size: 13px; }
.moisture-legend span { white-space: nowrap; }
.moisture-legend span::before {
  content: ''; display: inline-block; width: 8px; height: 8px;
  margin-right: 5px; background: var(--flow-color); border-radius: 50%;
}
.moisture-strip { margin-top: auto; border-bottom-left-radius: 12px; background: var(--paper); padding-block: 12px; }
.moisture-strip > strong { flex: none; font-size: 14px; }
.moisture-steps { display: flex; flex-wrap: wrap; gap: 6px; }
.moisture-steps button, .moisture-strip label span { min-height: 40px; }
.moisture-steps button[aria-pressed=true], .moisture-strip input:checked + span {
  border-color: var(--ink); box-shadow: inset 0 -2px var(--accent); font-weight: 700;
}
.moisture-strip label { position: relative; }
.moisture-strip input { position: absolute; width: 1px; height: 1px; top: 2px; left: 2px; margin: 0; opacity: 0; }
.moisture-panel { min-width: 0; border-inline-start: 1px solid var(--line); }
.moisture-block { padding: 20px; }
.moisture-block + .moisture-block { border-top: 1px solid var(--line); }
.moisture-block h3 { margin: 0 0 11px; font-size: 17px; line-height: 1.4; }
.moisture-block p { margin: 0; font-size: 15px; line-height: 1.65; }
.moisture-block .moisture-note { margin-top: 15px; color: var(--muted); font-size: 13px; }
.moisture-switch, .moisture-range-label { display: flex; align-items: center; gap: 8px; font: 550 14px/1.5 var(--sans); }
.moisture-switch { min-height: 36px; cursor: pointer; }
.moisture-switch input { width: 18px; height: 18px; margin: 0; }
.moisture-range-label { justify-content: space-between; margin-top: 15px; }
.moisture-range-label output { color: var(--muted); }
.moisture-panel input { accent-color: var(--ink); }
.moisture-panel input[type=range] { display: block; width: 100%; min-height: 32px; margin: 0; }
@media(max-width:750px) {
  #moisture-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .moisture-body { grid-template-columns: minmax(0,1fr); }
  #moisture-canvas { height: clamp(216px,35svh,350px); }
  .moisture-header, .moisture-block { padding: 13px 15px; }
  .moisture-panel { border-inline-start: 0; border-top: 1px solid var(--line); }
  .moisture-caption, .moisture-strip { gap: 7px 12px; padding: 8px 12px; }
  .moisture-strip { border-radius: 0; flex-wrap: wrap; }
  .moisture-strip .moisture-steps { flex: 1 1 auto; }
  .moisture-steps button, .moisture-strip label span { padding-inline: 8px; min-height: 44px; }
  .moisture-playback button { min-height: 44px; }
}
@media(max-width:440px) {
  #moisture-dialog .moisture-strip > strong { flex-basis: 100%; }
  #moisture-dialog .moisture-steps { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
}
