/* decodestrip: renders a "<numbers> -> <letters>" cipher breakdown.
   Swap the second class on the outer .decodestrip div to change style
   (e.g. "minimal" -> "tiles"). No markup or JS changes needed. */

.decodestrip {
  margin-bottom: 1rem;
}

.decodestrip-numbers,
.decodestrip-letters {
  white-space: pre-wrap;
}

/* once JS has successfully rendered, hide the raw source text */
.decodestrip.decodestrip-js .decodestrip-numbers,
.decodestrip.decodestrip-js .decodestrip-letters {
  display: none;
}

.decodestrip-warning {
  color: #a33;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  margin-top: 4px;
}

/* optional <p class="caption"> — JS positions it below the rendered
   strip regardless of variant, this just styles it */
.decodestrip > .caption {
  margin: 3px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: #7a7364;
}
/* minimal sits inline, so its caption reads better as its own block
   on the line below rather than butting up against the strip */
.decodestrip.minimal > .caption {
  display: block;
  margin-top: 0;
}

/* ---- shared column unit used by every variant ---- */
.decodestrip-render {
  display: flex;
  flex-wrap: wrap;
}
.decodestrip-render .ds-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
}
.decodestrip-render .ds-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #7a7364;
}
.decodestrip-render .ds-letter {
  font-weight: 600;
}
/* rule and mark exist in every variant's markup but are only shown
   where a specific style needs them */
.decodestrip-render .ds-rule,
.decodestrip-render .ds-mark {
  display: none;
}

/* ============ minimal ============
   small number over letter, no box, sits inline in a sentence */
.decodestrip.minimal .decodestrip-render {
  display: inline-flex;
  vertical-align: -6px;
}
.decodestrip.minimal .ds-col {
  padding: 0 2px;
}
.decodestrip.minimal .ds-num {
  font-size: 9.5px;
  line-height: 1.2;
}
.decodestrip.minimal .ds-letter {
  font-size: 14px;
  line-height: 1.2;
}

/* ============ tiles ============
   bordered cell per position, grouped in fives */
.decodestrip.tiles .decodestrip-render {
  gap: 0;
}
.decodestrip.tiles .ds-col {
  width: 34px;
  background: #f8f5ec;
  border: 1px solid #cbc2ac;
  border-radius: 4px;
  padding: 4px 0 5px;
}
.decodestrip.tiles .ds-num {
  font-size: 11px;
  display: block;
}
.decodestrip.tiles .ds-rule {
  display: none;
  height: 1px;
  background: #cbc2ac;
  margin: 0 5px 0;
}
.decodestrip.tiles .ds-letter {
  font-size: 17px;
  margin-top: 0;
  display: block;
}

/* ============ strip ============
   bonus third variant, included for free by the same architecture:
   one continuous row, grouped shading, no per-cell borders */
.decodestrip.strip .decodestrip-render {
  width: max-content;
}
.decodestrip.strip .ds-col {
  width: 30px;
  padding: 8px 0;
}
.decodestrip.strip .ds-col:nth-child(odd) {
  background: rgba(0, 0, 0, 0.025);
}
.decodestrip.strip .ds-num {
  font-size: 11px;
}
.decodestrip.strip .ds-letter {
  font-size: 16px;
  margin-top: 4px;
}

/* ============ copy actions ============
   "Copy numbers" / "Copy letters" buttons. This is the LAST item
   inside .decodestrip-render (added by JS), not a separate overlay --
   it sits right after the last column and wraps with everything else
   on narrow screens. Hidden by default on minimal, see note above. */
.decodestrip-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid #cbc2ac;
}
.decodestrip-copy {
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: #7a7364;
  background: none;
  border: none;
  padding: 2px 3px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}
.decodestrip-copy:hover {
  color: #3f3a30;
}
.decodestrip.minimal .decodestrip-actions {
  display: none;
}
