/* Figures for "Two ears, three dimensions". */

.te-fig {
  margin: 1.75rem 0 2rem;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: var(--fs-sm, 0.875rem);
}

.te-wide {
  width: min(760px, 94vw);
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

/* The canvas's own background colour (COL.bg in two-ears.js), so the panel
   and the dithered drawing meet without a seam. */
.te-panel {
  position: relative;
  background: #141427;
  border: 1px solid var(--border, rgba(235, 225, 210, 0.18));
  border-radius: 10px;
  overflow: hidden;
}

.te-canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  image-rendering: pixelated;
}

/* Controls float over the bottom of the drawing */
.te-controls {
  position: absolute;
  left: 0.6rem;
  bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.te-play {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  cursor: pointer;
}

.te-play::before {
  content: '';
  width: 14px;
  height: 16px;
  background: var(--accent, #F0B365);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.te-play.playing::before {
  width: 12px;
  background: none;
  border-left: 4px solid var(--accent, #F0B365);
  border-right: 4px solid var(--accent, #F0B365);
  clip-path: none;
}

.te-play:focus-visible,
.te-toggle:focus-visible {
  outline: 2px solid var(--accent, #F0B365);
  outline-offset: 2px;
}

.te-toggle {
  font: inherit;
  font-family: var(--font-mono, monospace);
  font-size: var(--fs-xs, 0.8rem);
  color: var(--muted, #B3A898);
  background: none;
  border: 0;
  padding: 0.2rem 0;
  cursor: pointer;
  text-decoration: line-through;
}

.te-toggle.active {
  color: var(--accent, #F0B365);
  text-decoration: none;
}

/* The depth slider, drawn like the site's scrollbar: a dark square track and
   a dithered strip of sea for the thumb. */
.te-depth {
  -webkit-appearance: none;
  appearance: none;
  width: 160px;
  height: 14px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.te-depth::-webkit-slider-runnable-track { height: 14px; background: #05030a; box-shadow: inset 0 0 0 1px var(--border); }
.te-depth::-moz-range-track { height: 14px; background: #05030a; box-shadow: inset 0 0 0 1px var(--border); }
.te-depth::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 30px;
  height: 14px;
  border: 3px solid #05030a;
  border-radius: 0;
  background: var(--bayer-dither-low) 0 0 / 12px 12px, linear-gradient(to right, #1f6680, #0e3f52);
}
.te-depth::-moz-range-thumb {
  box-sizing: border-box;
  width: 30px;
  height: 14px;
  border: 3px solid #05030a;
  border-radius: 0;
  background: var(--bayer-dither-low) 0 0 / 12px 12px, linear-gradient(to right, #1f6680, #0e3f52);
}
.te-depth:active::-webkit-slider-thumb { background: var(--accent); }
.te-depth:active::-moz-range-thumb { background: var(--accent); }
.te-depth:focus { outline: none; }
.te-depth:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.te-fig figcaption {
  color: var(--muted, #B3A898);
  margin-top: 0.6rem;
  line-height: 1.5;
}

.te-reset {
  font: inherit;
  font-family: var(--font-mono, monospace);
  font-size: var(--fs-xs, 0.8rem);
  color: var(--muted, #B3A898);
  background: none;
  border: 0;
  padding: 0.2rem 0;
  cursor: pointer;
}

.te-walk {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  opacity: 0.5;
}

.te-walk.active { opacity: 1; }

.te-walk canvas { display: block; }

.te-reset:focus-visible,
.te-walk:focus-visible {
  outline: 2px solid var(--accent, #F0B365);
  outline-offset: 2px;
}
