/* the look every tool shares: bevelled windows and old-computer controls.
   only the pages under tools/ load this; the rest of the site has its own frame */

@font-face {
  font-family: "Old English Gothic Pixel";
  src: url("/assets/fonts/old-english-gothic-pixel.ttf");
  font-display: swap;
}


:root {
  --face: #c0c0c0;
  --tool-heading-font: "Old English Gothic Pixel", Georgia, serif;

  /* window chrome: the four-line bevel every box, button and field is built from */
  --raised:
    inset -1px -1px #000, inset 1px 1px #fff,
    inset -2px -2px #808080, inset 2px 2px #dfdfdf;
  --sunken:
    inset 1px 1px #808080, inset -1px -1px #fff,
    inset 2px 2px #000, inset -2px -2px #dfdfdf;
  --drop: 4px 4px 0 rgb(0 0 0 / 0.55);
  --titlebar: linear-gradient(90deg, #1c0000, #7a0000 45%, #c21a1a);

  /* names the tools were written against */
  --site-surface: var(--face);
  --site-ink: #000000;
  --site-deep: #1e1e1e;
  --site-red: #7a0000;
  --site-steel: #808080;
  --site-wallpaper: url("/assets/tools-wallpaper.jpg");
  --site-ok: #0a4d0a;
  --site-ok-bg: #bfe0bf;
  --site-warn: #6b1a00;
  --site-warn-bg: #ecc6b0;
}


/* every panel is a little window: bevelled face, title bar on top */
.panel {
  background: var(--face);
  box-shadow: var(--raised), var(--drop);
  padding: 3px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 3px;
  padding: 3px 4px 3px 6px;
  background: var(--titlebar);
  color: #fff;
  font-family: var(--tool-heading-font);
  font-size: 17px;
  font-weight: normal;
  line-height: 1.2;
  text-shadow: 1px 1px 0 #000;
}

.panel {
  margin-bottom: 10px;
}

.panel-body {
  padding: 6px 8px 8px;
}

.panel-body p {
  margin: 0 0 0.6em;
}

.panel-body p:last-child {
  margin-bottom: 0;
}

.panel-note {
  margin: 8px 0 0;
  color: var(--site-deep);
  font-size: 0.78em;
}

.panel-subtitle {
  margin: 16px 0 8px;
  color: var(--site-red);
  font-family: var(--tool-heading-font);
  font-size: 18px;
  font-weight: normal;
  line-height: 1;
}

/* a panel's heading is its title bar, whatever level it is */
main .panel-title {
  margin: 0 0 3px;
  color: #fff;
  font-size: 17px;
  line-height: 1.2;
}

main .panel-title :is(h1, h2, h3, h4, h5, h6) {
  margin: 0;
  color: inherit;
  font: inherit;
}

/* one set of controls for every tool. :where() keeps these at the lowest
   priority, so anything a page styles on purpose still wins */

:where(main) :where(button, input[type="button"], input[type="submit"], input[type="reset"]) {
  min-height: 26px;
  padding: 4px 12px;
  border: 0;
  background: var(--face);
  box-shadow: var(--raised);
  color: #000;
  font: 13px var(--font);
  cursor: pointer;
}

:where(main) :where(button, input[type="button"], input[type="submit"], input[type="reset"]):hover {
  background: #d4d4d4;
}

:where(main) :where(button, input[type="button"], input[type="submit"], input[type="reset"]):focus-visible {
  outline: 1px dotted #000;
  outline-offset: -5px;
}

:where(main) :where(button, input[type="button"], input[type="submit"], input[type="reset"]):active:not(:disabled) {
  box-shadow: var(--sunken);
  padding: 5px 11px 3px 13px;
}

:where(main) :where(button, input):disabled {
  color: #808080;
  text-shadow: 1px 1px #fff;
  cursor: not-allowed;
}

:where(main) button:disabled:hover {
  background: var(--face);
}

/* opens a file picker */
:where(main) .uploadish {
  outline: 1px dashed #7a0000;
  outline-offset: -5px;
}

/* a side action: flat until you point at it */
:where(main) .quiet {
  background: transparent;
  box-shadow: none;
  text-decoration: underline;
}

:where(main) .quiet:hover {
  background: var(--face);
  box-shadow: var(--raised);
  text-decoration: none;
}

:where(main) :where(input[type="text"], input[type="number"], input[type="url"], input[type="search"], input:not([type]), select, textarea) {
  min-height: 24px;
  padding: 3px 6px;
  border: 0;
  background: #fff;
  box-shadow: var(--sunken);
  color: #000;
  font: 13px var(--font);
}

:where(main) :where(input, select, textarea):focus-visible {
  outline: 1px dotted #000;
  outline-offset: 1px;
}

:where(main) input[type="color"] {
  min-height: 26px;
  padding: 3px;
  border: 0;
  background: var(--face);
  box-shadow: var(--raised);
  cursor: pointer;
}

:where(main) :where(input[type="checkbox"], input[type="radio"]) {
  accent-color: #7a0000;
}

/* sliders: a sunken groove and a chunky raised block to grab */
:where(main) input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 22px;
  background: transparent;
  cursor: pointer;
}

:where(main) input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: #fff;
  box-shadow: var(--sunken);
}

:where(main) input[type="range"]::-moz-range-track {
  height: 6px;
  background: #fff;
  box-shadow: var(--sunken);
}

:where(main) input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 22px;
  margin-top: -8px;
  border: 0;
  background: var(--face);
  box-shadow: var(--raised);
}

:where(main) input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 22px;
  border: 0;
  border-radius: 0;
  background: var(--face);
  box-shadow: var(--raised);
}

:where(main) input[type="range"]:focus-visible {
  outline: 1px dotted #000;
  outline-offset: 2px;
}

:where(main) input[type="range"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* a "?" that opens an explanation in place */
:where(main) .infoDot {
  width: 18px;
  min-height: 16px;
  height: 16px;
  margin-left: 4px;
  padding: 0;
  font: bold 11px/1 monospace;
  vertical-align: 1px;
}

:where(main) .infoDot:active:not(:disabled) {
  padding: 1px 0 0 1px;
}

/* a button that reads as a link */
:where(main) .linkish {
  min-height: 0;
  padding: 0;
  background: none;
  box-shadow: none;
  color: var(--link-color);
  font: inherit;
  text-decoration: underline;
}

:where(main) .linkish:hover {
  background: none;
  color: #000;
}

:where(main) .linkish:active:not(:disabled) {
  padding: 0;
  box-shadow: none;
}

:where(main) dialog {
  padding: 16px;
  border: 0;
  background: var(--face);
  box-shadow: var(--raised), 6px 6px 0 rgb(0 0 0 / 0.6);
}
