/* Styling for pages under /tools/. Loaded after style.css. */

/* Shared by most tools */
textarea {
  width: 100%;
  font-family: monospace;
  font-size: 0.9rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1em;
  margin: 0.75em 0;
}

.controls > * {
  margin: 0;
}

.controls label {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  white-space: nowrap;
}

.hint {
  color: #555;
  font-size: 0.9rem;
}

#error {
  color: #b00000;
}

/* asciiart.html */
table.chars {
  width: 100%;
  table-layout: fixed;
}

table.chars td,
pre.box {
  font-family: monospace;
}

table.chars td {
  border: none;
  padding: 0.3em 0.5em;
  font-size: 1.3rem;
  line-height: 1;
  text-align: center;
}

#boxes,
#bracket-examples {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0.75em 0;
}

.box-example {
  margin: 0;
  min-width: 0;
  max-width: 100%;
}

.box-example figcaption {
  margin-bottom: 0.2rem;
  font-size: 0.85rem;
}

pre.box {
  margin: 0;
  padding: 0.4rem 0.6rem;
  border: 1px solid #ccc;
  font-size: 1rem;
  line-height: 1;
  white-space: pre;
}

/* emoji.html */
table.emojis td {
  border: none;
  padding: 0.3em 0.5em;
  font-size: 1.5rem;
  line-height: 1;
  text-align: center;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

table.emojis td.emoji {
  user-select: all;
  -webkit-user-select: all;
}

body.emoji-page {
  user-select: none;
  -webkit-user-select: none;
}

/* diff.html */
.inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.input-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .4rem;
}

#status {
  min-height: 1.6em;
}

#notice:empty {
  display: none;
}

.comparison {
  max-height: 32rem;
  overflow: auto;
  border: 1px solid #777;
}

.comparison[hidden] {
  display: none;
}

.diff-table {
  width: 100%;
  min-width: 32rem;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.diff-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f5f5;
  text-align: left;
  padding: .4rem .65rem;
  border-bottom: 1px solid #aaa;
}

.diff-table td {
  border: 0;
  padding: .15rem .5rem;
  vertical-align: top;
  background: white;
}

.diff-table th + th,
.diff-table td + td {
  border-left: 1px solid #ccc;
}

.line {
  display: flex;
  gap: .5rem;
  font: .9rem/1.6 monospace;
}

.number {
  flex: 0 0 5ch;
  color: #666;
  text-align: right;
  user-select: none;
}

.text {
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 4;
  unicode-bidi: plaintext;
}

.diff-table .removed,
.removed-key {
  background: #fce2de;
}

.diff-table .added,
.added-key {
  background: #def1e2;
}

.diff-table .spacer,
.spacer-key {
  background: repeating-linear-gradient(135deg, #f2f2f2, #f2f2f2 4px, #e8e8e8 4px, #e8e8e8 5px);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  font-size: .9rem;
}

.legend span {
  padding: .1rem .4rem;
}

/* regex.html */
.pattern-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}

#pattern {
  width: 100%;
  min-width: 0;
}

.flags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1rem;
  margin: .75rem 0;
}

.flags label {
  white-space: nowrap;
}

.editor {
  position: relative;
  margin-top: .4rem;
  background: #fff;
  border: 1px solid #a9a9a9;
  border-radius: 2px;
}

#text,
#highlights {
  margin: 0;
  border: 0;
  padding: 0;
  font: .9rem/1.6 monospace;
  letter-spacing: normal;
  tab-size: 4;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  unicode-bidi: plaintext;
}

#text {
  display: block;
  position: relative;
  overflow: auto;
  background: transparent;
}

#highlights {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  color: transparent;
}

#highlights mark {
  color: transparent;
  background: #fff0a3;
  border-radius: 2px;
}

#highlights mark.alternate {
  background: #dbeeff;
}

#highlights mark.selected {
  outline: 2px solid #5252aa;
}

.empty-match {
  display: inline;
  position: relative;
}

.empty-match::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1px;
  border-left: 2px solid #7770b5;
}

#matches {
  padding-left: 1.8rem;
}

#matches li {
  margin: .75rem 0;
}

#matches pre {
  margin: .35rem 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#matches button {
  margin-left: .5rem;
}

#matches ul {
  padding-left: 1.3rem;
}

/* x509.html */
#output,
#error {
  overflow-wrap: anywhere;
}

#output table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin: 0 0 1em;
}

#output th,
#output td {
  border: 1px solid #999;
  padding: 0.25em 0.5em;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

#output table.kv th {
  width: 9.5em;
}

#output table.ext th:nth-child(1) {
  width: 40%;
}

#output table.ext th:nth-child(2) {
  width: 4.5em;
}

#output pre {
  white-space: pre-wrap;
  margin: 0.25em 0;
  font-size: 0.85rem;
}

#output details {
  margin: 0.25em 0;
}

#output summary {
  cursor: pointer;
}

#output .x509line {
  margin: 0.15em 0;
}

.muted {
  color: #666;
  font-size: 0.9em;
}

/* image-metadata-remover.html */
#drop {
  border: 2px dashed #888;
  padding: 1.5rem;
  margin: 1rem 0;
}

#drop.active {
  border-color: #2626FF;
  background: #fdf8d8;
}

#files {
  max-width: 100%;
}

#selected,
#status {
  overflow-wrap: anywhere;
}

/* hash-generator.html */
#hashes th {
  text-align: left;
}

#hashes td, #status {
  overflow-wrap: anywhere;
}

#status:empty {
  display: none;
}

#hash-inputs {
  grid-template-columns: 1fr auto 1fr;
}

#hash-inputs > div {
  min-width: 0;
}

#hash-inputs > .or {
  align-self: center;
  color: #555;
  font-size: 0.9rem;
}

#hash-inputs > div > p {
  margin: 0;
  height: 100%;
  box-sizing: border-box;
}

#hash-inputs textarea {
  height: 100%;
  box-sizing: border-box;
}

#hash-inputs #drop {
  margin: 0;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#hash-inputs #drop p {
  margin: 0;
}

#hash-inputs #drop > p:last-child {
  margin-top: auto;
}

/* Mobile */
@media (max-width: 600px) {
  table.chars td {
    padding-left: 0.1em;
    padding-right: 0.1em;
  }

  .inputs {
    grid-template-columns: 1fr;
  }

  #hash-inputs > .or {
    text-align: center;
  }
}

@media (forced-colors: active) {
  .diff-table .removed {
    border-left: 2px dashed CanvasText;
  }

  .diff-table .added {
    border-left: 2px solid CanvasText;
  }

  .diff-table .spacer {
    border-block: 1px dotted GrayText;
  }

  #highlights {
    display: none;
  }

  #text {
    background: Canvas;
    color: CanvasText;
  }
}
