/* Styles for assets/explore.js (morph, player, dial). explore.js loads this file itself; a page can also link it
   to have it before the script runs. Colours come only from the --calc-* variables. This file is the source. */

/* ---- morph: blocks that keep their identity while the layout changes ---- */
.ex-morph {
  position: relative;
  overflow: hidden;
  --ex-move: 0.75s cubic-bezier(0.3, 0.7, 0.2, 1);
}
.ex-tile {
  position: absolute;
  z-index: 1;
  box-sizing: border-box;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 4px !important;
  min-height: 0;
  background-image: linear-gradient(160deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0) 48%, rgba(0, 0, 0, 0.09) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: left var(--ex-move), top var(--ex-move), width var(--ex-move), height var(--ex-move), opacity 0.35s, filter 0.15s, box-shadow 0.2s;
  transition-delay: calc(var(--i, 0) * 16ms);
}
.ex-tile.viz-pick:hover {
  z-index: 2;
  filter: brightness(1.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 6px 18px rgba(0, 0, 0, 0.2);
}
.ex-tile.viz-has-arrow::after {
  content: "↗";
  position: absolute;
  top: 5px;
  right: 7px;
  font-size: 0.68rem;
  line-height: 1;
  opacity: 0.55;
  transition: opacity 0.15s, transform 0.15s;
}
.ex-tile.viz-has-arrow:hover::after {
  opacity: 0.95;
  transform: translate(1px, -1px);
}
.ex-tile:focus-visible {
  z-index: 2;
  outline: 2px solid var(--calc-ink);
  outline-offset: -4px;
}
.ex-name,
.ex-val {
  position: absolute;
  z-index: 3;
  margin: 0;
  line-height: 1.18;
  transition: left var(--ex-move), top var(--ex-move), width var(--ex-move), font-size var(--ex-move), transform var(--ex-move), color 0.5s, opacity 0.35s, border-color 0.5s;
}
.ex-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  hyphens: none;
  overflow-wrap: normal;
}
.ex-name.viz-pick:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ex-val {
  font-size: 0.74rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  padding-left: 6px;
  border-left: 3px solid transparent;
}
.ex-morph[data-layout="treemap"] .ex-val {
  padding-left: 0;
  border-left-width: 0;
}
.ex-morph[data-layout="treemap"] .ex-name {
  pointer-events: none;   /* the block under it takes the click */
}
.ex-morph .ex-hide,
.ex-morph .ex-new {
  opacity: 0 !important;
  pointer-events: none !important;
}
.ex-jump,
.ex-jump * {
  transition: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .ex-tile, .ex-name, .ex-val { transition: none; }
}

/* ---- player: play, a slider and the period shown ---- */
.ex-player {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 14px;
  font-size: 0.82rem;
}
.ex-player .ex-play {
  flex: none;
  min-width: 6.6em;
  font: inherit;
  padding: 5px 12px;
  color: var(--calc-bg);
  background: var(--calc-accent);
  border: 1px solid var(--calc-accent);
  border-radius: 999px;
  cursor: pointer;
}
.ex-player .ex-play:hover {
  filter: brightness(1.15);
}
.ex-player .ex-play:focus-visible,
.ex-player input:focus-visible {
  outline: 2px solid var(--calc-accent);
  outline-offset: 3px;
}
.ex-player input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  accent-color: var(--calc-accent);
}
.ex-player .ex-now {
  flex: none;
  min-width: 3.2em;
  text-align: right;
  font-size: 1.15rem;
  color: var(--calc-ink);
  font-variant-numeric: tabular-nums;
}

/* ---- dial: a number in a sentence that drags ---- */
.ex-dial {
  display: inline-block;
  padding: 0 3px;
  color: var(--calc-accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border-bottom: 2px dotted var(--calc-accent);
  line-height: 1.25;
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  border-radius: 3px 3px 0 0;
  transition: background 0.15s;
}
.ex-dial::after {
  content: "↔";
  margin-left: 3px;
  font-size: 0.72em;
  font-weight: 400;
  opacity: 0.65;
}
.ex-dial:hover,
.ex-dial.on,
.ex-dial:focus-visible {
  background: color-mix(in srgb, var(--calc-accent) 14%, transparent);
  outline: 0;
}
.ex-dial:focus-visible {
  border-bottom-style: solid;
}
.ex-dial.ex-changed {
  border-bottom-style: solid;
}

/* ---- slider: a labelled setting ---- */
.ex-slider {
  margin: 0 0 12px;
  font-size: 0.85rem;
}
.ex-slider label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  color: var(--calc-ink);
}
.ex-slider .ex-slider-val {
  flex: none;
  color: var(--calc-accent);
  font-variant-numeric: tabular-nums;
}
.ex-slider input[type="range"] {
  display: block;
  width: 100%;
  margin: 2px 0 0;
  accent-color: var(--calc-accent);
}
.ex-slider input[type="range"]:focus-visible {
  outline: 2px solid var(--calc-accent);
  outline-offset: 3px;
}
