/* ==========================================================================
   Page · K07 Elements
   ========================================================================== */

/* shared small-label spacing (on top of .label) */
.spec-title {
  margin-bottom: 12px;
}

/* ---- E.01 · Button matrix ---------------------------------------------- */

.btn-matrix {
  overflow-x: auto;
  border: 1px solid var(--line-strong);
}

.btn-matrix__table {
  min-width: 1080px;
}

/* every row is its own grid: columns size per row, like the original */
.btn-matrix__row {
  display: grid;
  grid-template-columns: 130px repeat(6, 1fr);
  align-items: center;
  border-top: 1px solid var(--line);
}

.btn-matrix__row--head {
  align-items: stretch;
  border-top: 0;
  background: var(--surface);
  font: 500 11px/1 var(--f-mono);
  letter-spacing: .06em;
}

.btn-matrix__head {
  padding: 12px 14px;
}

.btn-matrix__variant {
  padding: 14px;
  font: 500 13px var(--f-mono);
}

.btn-matrix__cell {
  padding: 14px;
}

/* ---- E.01 · Button specimens (variant × state) --------------------------
   Variants set the custom properties, states read them.                   */

.btn-spec {
  --spec-bg: transparent;
  --spec-fg: var(--ink);
  --spec-hover-bg: var(--ink);
  --spec-hover-fg: var(--canvas);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--target);
  padding: 0 20px;
  border: 0;
  background: var(--spec-bg);
  color: var(--spec-fg);
  font: 600 14px/1 var(--f-text);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}

.btn-spec--primary {
  --spec-bg: var(--action);
  --spec-fg: var(--action-ink);
  --spec-hover-bg: var(--action-hover);
  --spec-hover-fg: var(--action-ink);
  clip-path: var(--chamfer-s);
}

.btn-spec--secondary {
  border: 1.5px solid var(--ink);
}

.btn-spec--tertiary {
  --spec-bg: var(--panel);
  --spec-hover-bg: var(--line-strong);
}

.btn-spec--ghost {
  padding: 0 12px;
}

.btn-spec--link {
  --spec-fg: var(--action);
  --spec-hover-bg: transparent;
  --spec-hover-fg: var(--action-hover);
  padding: 0;
  text-transform: none;
  text-decoration: underline;
}

.btn-spec--icon {
  padding: 0 12px;
  border: 1.5px solid var(--line-strong);
}

.btn-spec--destructive {
  --spec-fg: var(--sig-red);
  --spec-hover-bg: var(--sig-red);
  --spec-hover-fg: #fff;
  border: 1.5px solid var(--sig-red);
}

/* states */
.btn-spec--hover {
  background: var(--spec-hover-bg);
  color: var(--spec-hover-fg);
}

.btn-spec--focus {
  clip-path: none;
  box-shadow: 0 0 0 3px var(--canvas), 0 0 0 6px var(--action);
}

.btn-spec--active {
  transform: translateY(1px) scale(.97);
}

.btn-spec--disabled {
  opacity: .4;
}

/* ---- E.01 · Sizes & anatomy -------------------------------------------- */

.button-extras {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 24px;
  margin-top: 32px;
}

.button-sizes {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-size {
  display: inline-flex;
  align-items: center;
  background: var(--action);
  color: var(--action-ink);
  text-transform: uppercase;
  letter-spacing: .05em;
  clip-path: var(--chamfer-s);
}

.btn-size--sm {
  min-height: 36px;
  padding: 0 14px;
  font: 600 13px/1 var(--f-text);
}

.btn-size--md {
  min-height: var(--target);
  padding: 0 20px;
  font: 600 14px/1 var(--f-text);
}

.btn-size--lg {
  gap: 10px;
  min-height: calc(var(--target) + 12px);
  padding: 0 28px;
  font: 600 16px/1 var(--f-text);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.btn-anatomy {
  position: relative;
  display: inline-block;
  padding: 18px 0 28px;
}

.btn-anatomy__button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  background: var(--action);
  color: var(--action-ink);
  font: 600 14px/1 var(--f-text);
  text-transform: uppercase;
  letter-spacing: .05em;
  clip-path: var(--chamfer-s);
  outline: 1px dashed var(--accent);
  outline-offset: 0;
}

.btn-anatomy__note {
  position: absolute;
  left: 0;
  font: 400 11px/1 var(--f-mono);
  color: var(--accent-text);
}

.btn-anatomy__note--top {
  top: 0;
}

.btn-anatomy__note--bottom {
  bottom: 6px;
}

/* ---- E.01 · Do / Don't -------------------------------------------------- */

.rule-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 16px;
  margin-top: 24px;
}

.rule-card {
  padding: 16px 20px;
  background: var(--surface);
  border-top: 4px solid var(--rule-color);
}

.rule-card--do   { --rule-color: var(--sig-green); }
.rule-card--dont { --rule-color: var(--sig-red); }

.rule-card__verdict {
  margin-bottom: 8px;
  font: 600 12px/1 var(--f-mono);
  color: var(--rule-color);
}

.rule-card__text {
  font-size: 15px;
  color: var(--ink-2);
}

/* ---- E.02 · Inputs ------------------------------------------------------ */

.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 24px 20px;
}

.input-grid__wide {
  grid-column: 1 / -1;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font: 500 12px/1 var(--f-mono);
  letter-spacing: .06em;
  color: var(--ink-2);
}

.field-label--disabled {
  color: var(--muted);
}

/* smart search */
.smart-search {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: calc(var(--target) + 12px);
  padding: 0 16px;
  border: 1.5px solid var(--ink);
  background: var(--canvas);
}

.smart-search__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: 500 18px/1 var(--f-mono);
  color: var(--ink);
  outline: none;
}

.smart-search__type {
  padding: 6px 8px;
  background: var(--panel);
  color: var(--ink);
  font: 500 11px/1 var(--f-mono);
  letter-spacing: .06em;
  white-space: nowrap;
}

/* article or serial number recognised */
.smart-search__type--match {
  background: var(--ink);
  color: var(--canvas);
}

.smart-search__hint {
  margin-top: 8px;
  font-size: 14px;
  color: var(--ink-2);
}

/* real form controls */
.form-input {
  width: 100%;
  min-height: var(--target);
  padding: 0 14px;
  border: 1.5px solid var(--line-strong);
  background: var(--canvas);
  color: var(--ink);
  font: 400 var(--fs-body) var(--f-text);
}

.form-input--select {
  padding: 0 12px;
}

.form-input--date {
  padding: 0 12px;
  font: 500 var(--fs-body) var(--f-mono);
}

.form-input--textarea {
  min-height: 0;
  padding: 12px 14px;
  font: 400 var(--fs-body)/1.5 var(--f-text);
  resize: vertical;
}

/* static state specimens */
.input-mock {
  display: flex;
  align-items: center;
  min-height: var(--target);
  padding: 0 14px;
  border: 1.5px solid var(--line-strong);
  background: var(--canvas);
}

.input-mock--focus {
  border-color: var(--action);
  outline: 3px solid var(--action);
  outline-offset: 2px;
}

.input-mock--error {
  border-color: var(--sig-red);
}

.input-mock--success {
  justify-content: space-between;
  border-color: var(--sig-green);
  font-family: var(--f-mono);
}

.input-mock--disabled {
  border: 1.5px dashed var(--line-strong);
  background: var(--surface);
  color: var(--muted);
}

.input-mock__caret {
  width: 1px;
  height: 20px;
  margin-left: 2px;
  background: var(--ink);
}

.input-mock__check {
  color: var(--sig-green);
}

.field-message {
  margin-top: 6px;
  font-size: 14px;
  color: var(--ink-2);
}

.field-message--error {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--sig-red);
}

/* number with unit */
.unit-input {
  display: flex;
  min-height: var(--target);
  border: 1.5px solid var(--line-strong);
  background: var(--canvas);
}

.unit-input__field {
  flex: 1;
  min-width: 0;
  padding: 0 14px;
  border: 0;
  background: transparent;
  font: 500 var(--fs-body) var(--f-mono);
  color: var(--ink);
  outline: none;
}

.unit-input__unit {
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-left: 1px solid var(--line);
  background: var(--surface);
  font: 500 14px var(--f-mono);
  color: var(--ink-2);
}

.unit-input__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.unit-input__alt {
  font: 400 13px var(--f-mono);
  color: var(--muted);
}

.unit-input__toggle {
  font: 500 11px/1 var(--f-mono);
}

/* range */
.range-input {
  width: 100%;
  min-height: var(--target);
  accent-color: var(--action);
}

.range-input__scale {
  display: flex;
  justify-content: space-between;
  font: 400 12px var(--f-mono);
  color: var(--muted);
}

/* quantity stepper */
.stepper {
  display: inline-flex;
  min-height: var(--target);
  border: 1.5px solid var(--ink);
}

.stepper__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--target);
  border: 0;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.stepper__btn--minus {
  font: 500 20px var(--f-mono);
}

.stepper__value {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  font: 500 18px var(--f-mono);
}

.stepper__unit {
  margin-left: 12px;
  font: 400 13px var(--f-mono);
  color: var(--muted);
}

/* file upload */
.upload {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  border: 1.5px dashed var(--ink-2);
  background: var(--canvas);
}

.upload__prompt {
  display: flex;
  gap: 16px;
  align-items: center;
}

.upload__title {
  font-weight: 600;
}

.upload__formats {
  font: 400 13px var(--f-mono);
  color: var(--muted);
}

.upload__file {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font: 400 13px var(--f-mono);
}

/* width of the fill comes from --progress */
.upload__progress {
  position: relative;
  width: 80px;
  height: 4px;
  margin-left: 8px;
  background: var(--panel);
}

.upload__progress::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--progress);
  background: var(--action);
}

/* ---- E.03 · Selection --------------------------------------------------- */

.selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 32px 24px;
}

.choice-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.choice-group--loose {
  gap: 14px;
}

.choice-group--chips {
  gap: 12px;
}

.choice-group__title {
  margin-bottom: 8px;
}

.choice-group__subtitle {
  margin-top: 8px;
}

/* checkbox / radio row */
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--target);
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: 400 var(--fs-body) var(--f-text);
  text-align: left;
  cursor: pointer;
}

.choice--disabled {
  color: var(--muted);
  font: inherit;
  cursor: default;
}

.choice__box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--ink);
  color: var(--action-ink);
}

.choice__box--disabled {
  border: 1.5px dashed var(--line-strong);
}

.choice[aria-checked="true"] .choice__box {
  background: var(--action);
}

.choice[aria-checked="false"] .choice__mark {
  display: none;
}

.choice__radio {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
}

.choice__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.choice[aria-checked="true"] .choice__dot {
  background: var(--action);
}

/* large .switch in body text size (follows the density) */
.switch-demo {
  font-size: var(--fs-body);
}

.switch-demo__text {
  text-align: left;
}

.switch-demo__state {
  font: 500 12px var(--f-mono);
  color: var(--muted);
}

/* segmented · mounting */
.mount-toggle {
  display: flex;
  width: max-content;
  max-width: 100%;
  border: 1.5px solid var(--ink);
}

.mount-toggle__btn {
  min-height: var(--target);
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 600 14px/1 var(--f-text);
  text-transform: uppercase;
  letter-spacing: .04em;
  cursor: pointer;
}

.mount-toggle__btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--canvas);
}

/* filter chips */
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* static tags */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 5px 8px;
  background: var(--panel);
  font: 500 11px/1 var(--f-mono);
  white-space: nowrap;
}

.tag--outline {
  border: 1px solid var(--ink);
  background: none;
}

/* ---- E.04 · Indicators -------------------------------------------------- */

.indicator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}

.indicator {
  padding: 20px;
  border: 1px solid var(--line-strong);
  background: var(--canvas);
}

.indicator--list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.indicator__title {
  margin-bottom: 16px;
}

.indicator__title--tight {
  margin-bottom: 4px;
}

/* stack light: one lit lamp per state */
.stack-lights {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
}

/* one specimen: four-lamp .stack-light + state word */
.stack-light-spec {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* the housing follows the theme ink here */
.stack-light-spec__lamps {
  --lamp-width: 16px;
  --lamp-height: 10px;
  background: var(--ink);
}

.stack-light-spec__label {
  font: 500 11px/1 var(--f-mono);
}

/* availability: shape + word, never color alone */
.availability {
  display: flex;
  gap: 10px;
  align-items: center;
  font: 500 14px var(--f-mono);
}

.availability__shape {
  width: 12px;
  height: 12px;
}

.availability__shape--in-stock {
  border-radius: 50%;
  background: var(--sig-green);
}

.availability__shape--lead-time {
  background: var(--sig-yellow);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.availability__shape--discontinued {
  background: var(--sig-red);
  transform: rotate(45deg) scale(.85);
}

.availability__shape--on-request {
  border: 1.5px solid var(--ink);
}

/* order-code segment display */
.order-code {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.order-code__segment {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.order-code__value {
  padding: 10px 12px;
  background: var(--ink);
  color: var(--canvas);
  font: 500 24px/1 var(--f-mono);
}

.order-code__key {
  font: 400 10px/1 var(--f-mono);
  color: var(--muted);
}

/* tolerance callout (feature control frame) */
.tolerance {
  display: flex;
  align-items: center;
}

.tolerance__leader {
  width: 10px;
  height: 1px;
  background: var(--ink);
}

.tolerance__frame {
  display: flex;
  border: 1.5px solid var(--ink);
  font: 500 16px/1 var(--f-mono);
}

.tolerance__cell {
  padding: 8px 10px;
  border-right: 1px solid var(--ink);
}

.tolerance__cell:last-child {
  border-right: 0;
}

.tolerance__note {
  margin-top: 12px;
  font-size: 14px;
  color: var(--ink-2);
}

/* station label + takt counter */
.indicator__station {
  gap: 12px;
  margin-bottom: 20px;
}

.takt-counter {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.takt-counter__value {
  font: 800 56px/1 var(--f-display);
}

.takt-counter__unit {
  font: 400 12px var(--f-mono);
  color: var(--muted);
}

/* certification placeholders */
.cert-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cert {
  min-width: 56px;
  padding: 10px;
  border: 1.5px solid var(--ink);
  font: 500 12px/1 var(--f-mono);
  text-align: center;
}

.cert-note {
  margin-top: 10px;
  font: 400 11px var(--f-mono);
  color: var(--muted);
}

/* safety signal words: fixed colors, independent of the theme */
.safety-words {
  margin-top: 32px;
}

.safety-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 12px;
}

.safety-sign {
  border: 2px solid #0B0C0D;
  background: #fff;
  color: #0B0C0D;
}

.safety-sign__head {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  font: 800 22px/1 var(--f-display);
  letter-spacing: .06em;
}

.safety-sign__head--danger {
  background: #C8102E;
  color: #fff;
}

.safety-sign__head--warning {
  background: #E8751A;
  color: #0B0C0D;
}

.safety-sign__head--caution {
  background: #F2C230;
  color: #0B0C0D;
}

.safety-sign__head--notice {
  display: block;
  background: #0F4C9A;
  color: #fff;
  font-style: italic;
}

/* warning triangle in the text color of the head */
.safety-sign__triangle {
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 16px solid currentColor;
}

.safety-sign__body {
  padding: 10px 12px;
  font-size: 14px;
}

/* ---- E.05 · Feedback & structure --------------------------------------- */

.feedback-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 32px 24px;
}

.feedback-grid__wide {
  grid-column: 1 / -1;
}

.feedback-note {
  margin-top: 8px;
  font: 400 12px var(--f-mono);
  color: var(--muted);
}

/* segmented progress */
.step-progress {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.step-progress__step {
  height: 8px;
  background: var(--panel);
}

.step-progress__step--done {
  background: var(--ink);
}

.step-progress__step--current {
  background: var(--action);
}

.step-progress__labels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 6px;
  font: 400 11px var(--f-mono);
  color: var(--ink-2);
}

.step-progress__label--current {
  color: var(--ink);
  font-weight: 500;
}

/* indexing loader: the carrier jumps one station per beat */
.index-loader {
  position: relative;
  width: 160px;
  height: 12px;
  border: 1.5px solid var(--ink);
  overflow: hidden;
}

.index-loader__carrier {
  width: 25%;
  height: 100%;
  background: var(--ink);
  animation: takt-index 2400ms steps(1, end) infinite;
}

/* skeleton */
.skeleton {
  display: grid;
  gap: 8px;
}

.skeleton__media {
  height: 80px;
  background: var(--panel);
  clip-path: var(--chamfer-m);
  animation: takt-sk 1200ms steps(4) infinite;
}

.skeleton__line {
  height: 14px;
  background: var(--panel);
}

.skeleton__line--long {
  width: 60%;
}

.skeleton__line--short {
  width: 40%;
}

/* tooltip */
.tooltip-demo {
  position: relative;
  display: inline-block;
  margin-top: 44px;
}

.tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  padding: 8px 10px;
  background: var(--ink);
  color: var(--canvas);
  font: 400 13px/1.4 var(--f-mono);
  white-space: nowrap;
}

.tooltip__arrow {
  position: absolute;
  left: 14px;
  top: 100%;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--ink);
}

.tooltip-demo__term {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1.5px dotted var(--ink);
  font-weight: 600;
}

/* dividers & rail segments */
.dividers {
  display: grid;
  gap: 18px;
}

.divider {
  height: 1px;
  background: var(--line);
}

.divider--strong {
  background: var(--line-strong);
}

.divider--ink {
  height: 1.5px;
  background: var(--ink);
}

.rail-segment {
  display: flex;
  align-items: center;
}

.rail-segment__tick {
  width: 1px;
  height: 13px;
  background: var(--ink);
}

.rail-segment__run {
  flex: 1;
  height: 1px;
  background: var(--line-strong);
}

/* ---- Keyframes ---------------------------------------------------------- */

@keyframes takt-index {
  0%, 20%   { transform: translateX(0); }
  33%, 53%  { transform: translateX(100%); }
  66%, 86%  { transform: translateX(200%); }
  100%      { transform: translateX(300%); }
}

@keyframes takt-sk {
  0%   { opacity: .55; }
  50%  { opacity: 1; }
  100% { opacity: .55; }
}
