/* ============================================================
   topo.css - layout for the contour tool.
   Mirrors conway.css: canvas left, docked sidebar right.
   All controls come from ui.css so the two pages match.
   ============================================================ */

body {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.work {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 264px;
}

/* ---------- stage ----------------------------------------- */

.stage {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 16px;
  overflow: auto;
}

.frame {
  position: relative;
  width: 100%;
  max-width: 1180px;
  border: 1px solid var(--rule-2);
  box-shadow: var(--bevel-in);
  background: var(--surface-3);
  line-height: 0;
}

#view {
  display: block;
  width: 100%;
  height: auto;
}

/* Status text sits on the render, so it carries its own
   backing rather than relying on whatever the map is doing. */
.overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 7px 11px;
  border-top: 1px solid var(--rule-2);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.overlay[hidden] {
  display: none;
}

.overlay--err {
  color: var(--bad);
}

/* ---------- transport ------------------------------------- */

.transport {
  width: 100%;
  max-width: 1180px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 10px;
  border: 1px solid var(--rule-2);
  background: var(--surface);
  box-shadow: var(--bevel);
}

.transport input[type="range"] {
  flex: 1;
}

.transport__count {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tr-mid);
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.transport__count b {
  color: var(--bright);
}

/* ---------- sidebar --------------------------------------- */

.side {
  min-height: 0;
  border-left: 1px solid var(--rule-2);
  background: var(--surface);
  overflow-y: auto;
}

.side__search {
  display: flex;
  gap: 5px;
}

.side__search .field {
  flex: 1;
}

.side__coords {
  display: flex;
  gap: 5px;
  margin-top: 7px;
}

.side__coords .field {
  flex: 1;
  font-size: var(--fs-xs);
}

/* ---------- colour swatches ------------------------------- */

.swatches {
  display: flex;
  gap: 4px;
}

.sw {
  position: relative;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.sw input {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 28px;
  padding: 0;
  border: 1px solid var(--rule-2);
  box-shadow: var(--bevel);
  background: none;
  cursor: pointer;
}

.sw input::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.sw input::-webkit-color-swatch {
  border: none;
}

.sw input::-moz-color-swatch {
  border: none;
}

.sw span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -13px;
  text-align: center;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

/* Preset ramp: the swatch strip is the label. */
.preset__dots {
  display: flex;
  height: 12px;
  border: 1px solid var(--rule-2);
}

.preset__dots i {
  display: block;
  width: 6px;
  height: 100%;
}

/* ---------- motion modes ---------------------------------- */

.modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

/* Odd count would leave a stranded half-width cell. */
.mode:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.mode {
  padding: 7px 8px;
  border: 1px solid var(--rule-2);
  background: var(--surface-2);
  box-shadow: var(--bevel);
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}

.mode:hover {
  background: var(--surface);
  color: var(--bright);
}

.mode[aria-pressed="true"] {
  background: var(--accent-wash);
  box-shadow: var(--bevel-in);
  color: var(--bright);
}

.mode strong {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: var(--tr-mid);
  text-transform: uppercase;
}

.mode span {
  display: block;
  margin-top: 2px;
  font-size: 9.5px;
  line-height: 1.4;
  color: var(--dim);
}

/* ---------- diagnostics + notes --------------------------- */

.diag {
  margin-top: 9px;
  padding: 8px 9px;
  border: 1px solid var(--rule-2);
  background: var(--surface-2);
  box-shadow: var(--bevel-in);
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-xs);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-x: auto;
}

.diag[hidden] {
  display: none;
}

.note {
  margin-top: 10px;
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--dim);
}

.note b {
  font-weight: 600;
  color: var(--muted);
}

/* ---------- narrow ---------------------------------------- */

@media (max-width: 940px) {
  .work {
    grid-template-columns: minmax(0, 1fr);
    overflow-y: auto;
  }

  .stage {
    padding: 10px;
    overflow: visible;
  }

  .side {
    border-left: 0;
    border-top: 1px solid var(--rule-2);
    overflow: visible;
  }

  .bar__seg--hide {
    display: none;
  }
}
