/* steppers.css: - / + buttons on number fields (phones and tablets).
   Everything here only matches markup js/steppers.js adds (html.has-stp,
   .stp-tile, .stp, .stp-btn), so desktop with a mouse is untouched. */

/* ── the − / + button ─────────────────────────────────────────── */
.stp-btn {
  flex: none; width: 44px; height: 44px; padding: 0; margin: 0; border: 0; border-radius: 12px;
  display: grid; place-items: center; cursor: pointer;
  background: color-mix(in srgb, var(--fg) 6%, transparent); color: var(--fg);
  transition: background-color .12s ease, color .12s ease, transform .08s ease, box-shadow .12s ease, opacity .12s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.stp-btn svg { width: 18px; height: 18px; display: block; pointer-events: none; }
@media (hover: hover) {
  .stp-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--fg) 12%, transparent); }
}
.stp-btn:active:not(:disabled), .stp-btn.pressed {
  background: color-mix(in srgb, var(--accent2) 20%, transparent); color: var(--accent2);
  box-shadow: inset 0 0 0 1.5px var(--accent2); transform: scale(.94);
}
.stp-btn:disabled { opacity: .3; cursor: default; background: color-mix(in srgb, var(--fg) 3%, transparent); }
.stp-btn:focus-visible { outline: 2px solid var(--accent2); outline-offset: 1px; }
:root[data-theme="dark"] .stp-btn.pressed, :root[data-theme="dark"] .stp-btn:active:not(:disabled) {
  background: color-mix(in srgb, var(--accent2) 30%, transparent);
}

/* ── Survey controls: 2 × 2 tiles, [−] label / value [+] ──────── */
/* compact: the label sits over the value between the buttons, so a
   tile is one 44 px button row tall */
html.has-stp .sc-vals { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 4px; padding: 4px; }
html.has-stp .sv.stp-tile {
  /* the buttons give up to 6 px each before the value is clipped (narrow side sheet) */
  display: grid; grid-template-columns: minmax(38px, 44px) minmax(min-content, 1fr) minmax(38px, 44px); grid-template-rows: auto auto;
  align-items: center; column-gap: 2px; row-gap: 0;
  min-height: 0 !important; padding: 3px !important; border-radius: 12px; cursor: default;
  background: color-mix(in srgb, var(--surface2) 60%, transparent);
}
html.has-stp .sv.stp-tile:hover { background: color-mix(in srgb, var(--surface2) 60%, transparent); }
html.has-stp .sv.stp-tile > .stp-btn { width: 100%; max-width: 44px; justify-self: center; }
html.has-stp .sv.stp-tile > .stp-dn { grid-column: 1; grid-row: 1 / 3; }
html.has-stp .sv.stp-tile > .stp-up { grid-column: 3; grid-row: 1 / 3; }
html.has-stp .sv.stp-tile > .k {
  grid-column: 2; grid-row: 1; align-self: end; text-align: center;
  font-size: 10.5px !important; line-height: 13px; overflow: hidden; text-overflow: ellipsis;
}
html.has-stp .sv.stp-tile > .v {
  grid-column: 2; grid-row: 2; align-self: start; min-width: 0; overflow: hidden;
  border-radius: 7px; cursor: text; line-height: 1;
}
html.has-stp #panel .sv.stp-tile input[type=number] {
  font-size: 16px; min-height: 22px; height: 22px; line-height: 22px;    /* 16 px: no iOS zoom on focus */
}
html.has-stp .sv.stp-tile:focus-within {
  background: var(--surface2); box-shadow: inset 0 0 0 1.5px var(--accent2);
}
html.has-stp .sv.stp-tile:focus-within > .v { background: color-mix(in srgb, var(--accent2) 10%, transparent); }

/* touch tablets in the desktop layout: a wider tool column, so a tile
   fits [44] label / value [44] (300 px left about 35 px for the value) */
html.has-stp:not(.mmap-on) #toolpanels { --tp-w: 340px; }

/* ── form fields: [−][ value ][+] in one rounded control ─────── */
.stp {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 0;
  width: 100%; min-width: 0; height: 46px; padding: 0; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface2);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.stp > .stp-btn { width: 44px; height: 44px; border-radius: 11px; background: transparent; }
.stp > .stp-btn:not(:disabled) { background: color-mix(in srgb, var(--fg) 5%, transparent); }
.stp > .stp-btn.pressed, .stp > .stp-btn:active:not(:disabled) {
  background: color-mix(in srgb, var(--accent2) 20%, transparent); color: var(--accent2);
  box-shadow: inset 0 0 0 1.5px var(--accent2);
}
html.has-stp .stp > input[type=number] {
  width: 100% !important; min-width: 0; max-width: none; height: 44px !important; margin: 0;
  padding: 0 2px !important; border: 0 !important; border-radius: 8px !important;
  background: transparent !important; box-shadow: none !important; outline: none;
  text-align: center; font: 600 16px var(--mono) !important; color: var(--fg);
  -moz-appearance: textfield; appearance: textfield;
}
.stp > input::-webkit-inner-spin-button, .stp > input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stp:focus-within {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent2) 18%, transparent);
}

/* mission planner: two fields per row, each stepper next to its select */
html.has-stp #mission .row > .ctrl { flex: 1 1 calc(50% - 6px); max-width: calc(50% - 3px); justify-content: flex-end; }
html.has-stp #mission .row > .ctrl[hidden] { display: none; }
html.has-stp #mission select.sel { height: 46px; }
/* echosounder editor: the plain typed fields line up with the steppers */
html.has-stp .se-params input[type=number]:not(.stp > input) { height: 46px; font: 600 16px var(--mono); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .stp-btn, .stp, html.has-stp .sv.stp-tile { transition: none; }
  .stp-btn:active:not(:disabled), .stp-btn.pressed { transform: none; }
}
