/* ---------------------------------------------------------------------------
   Sikons theme: two colours, one pixel of border, and a handful of 8x8
   dither patterns standing in for everything a modern UI would do with
   shadows and greys.
   ------------------------------------------------------------------------ */

/* Chicago and Geneva only exist on Apple systems; drop a bitmap webfont into
   assets/fonts/ and name it "Sikons UI" to pin the look everywhere else. */
@font-face {
  font-family: 'Sikons UI';
  src:
    local('ChiKareGo2'),
    local('ChicagoFLF'),
    local('Chicago'),
    local('Charcoal'),
    local('Geneva');
  font-display: swap;
}

:root {
  --ink: #000000;
  --paper: #ffffff;
  /* Stands in for a 50% dither on text that cannot be dithered (disabled
     labels). Everything with a surface uses a real pattern instead. */
  --dim: #808080;

  --font-ui: 'Sikons UI', Chicago, Charcoal, Geneva, 'Lucida Grande', Verdana, system-ui, sans-serif;
  --font-mono: 'Monaco', 'SF Mono', 'DejaVu Sans Mono', 'Courier New', monospace;
  --size-ui: 12px;
  --size-small: 11px;

  --line: 1px solid var(--ink);
  --drop: 2px 2px 0 var(--ink);
  --gap: 8px;

  --dither-50: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='2'%3E%3Crect width='1' height='1' fill='%23000'/%3E%3Crect x='1' y='1' width='1' height='1' fill='%23000'/%3E%3C/svg%3E");
  --dither-25: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect width='1' height='1' fill='%23000'/%3E%3Crect x='2' y='2' width='1' height='1' fill='%23000'/%3E%3C/svg%3E");
  --dither-12: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect width='1' height='1' fill='%23000'/%3E%3C/svg%3E");
  --stripes: repeating-linear-gradient(to bottom, var(--ink) 0 1px, var(--paper) 1px 2px);
}

body {
  font-family: var(--font-ui);
  font-size: var(--size-ui);
  line-height: 1.35;
  color: var(--ink);
  background-color: var(--paper);
  background-image: var(--dither-50);
  background-size: 2px 2px;
  -webkit-font-smoothing: none;
  font-smooth: never;
  text-rendering: geometricPrecision;
}

/* --------------------------------------------------------------- utilities */

.dither-50 {
  background-color: var(--paper);
  background-image: var(--dither-50);
  background-size: 2px 2px;
}

.dither-25 {
  background-color: var(--paper);
  background-image: var(--dither-25);
  background-size: 4px 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.row--end {
  justify-content: flex-end;
}

.grow {
  flex: 1 1 auto;
  min-width: 0;
}

.hint {
  font-size: var(--size-small);
  color: var(--dim);
}

.rule {
  height: 1px;
  background: var(--ink);
  border: 0;
  margin: 2px 0;
}

/* ---------------------------------------------------------------- controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 20px;
  padding: 1px 10px;
  background: var(--paper);
  border: var(--line);
  border-radius: 8px;
  box-shadow: 1px 1px 0 var(--ink);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.btn:active,
.btn[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper);
  box-shadow: none;
  transform: translate(1px, 1px);
}

.btn[disabled] {
  color: var(--dim);
  border-color: var(--dim);
  box-shadow: none;
  cursor: default;
}

.btn--default {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  font-weight: 700;
}

.btn--square {
  min-width: 20px;
  padding: 1px 4px;
  border-radius: 0;
}

.btn--plain {
  border-radius: 0;
  box-shadow: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.field > span {
  font-size: var(--size-small);
}

input[type='text'],
input[type='search'],
input[type='number'],
select,
textarea {
  padding: 2px 4px;
  background: var(--paper);
  border: var(--line);
  border-radius: 0;
  box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.25);
  appearance: none;
}

select {
  padding-right: 18px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 10px) 8px, calc(100% - 6px) 8px;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}

input[type='range'] {
  appearance: none;
  height: 14px;
  background: transparent;
  cursor: pointer;
}

input[type='range']::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--paper);
  border: var(--line);
}

input[type='range']::-moz-range-track {
  height: 4px;
  background: var(--paper);
  border: var(--line);
}

input[type='range']::-webkit-slider-thumb {
  appearance: none;
  width: 9px;
  height: 14px;
  margin-top: -6px;
  background: var(--paper);
  border: var(--line);
  box-shadow: 1px 1px 0 var(--ink);
}

input[type='range']::-moz-range-thumb {
  width: 9px;
  height: 14px;
  border-radius: 0;
  background: var(--paper);
  border: var(--line);
}

/* Square one-bit checkboxes and radios. */
input[type='checkbox'],
input[type='radio'] {
  appearance: none;
  width: 12px;
  height: 12px;
  margin: 0;
  flex: none;
  background: var(--paper);
  border: var(--line);
  display: inline-grid;
  place-content: center;
  cursor: pointer;
}

input[type='radio'] {
  border-radius: 50%;
}

input[type='checkbox']::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--ink);
  transform: scale(0);
}

input[type='radio']::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
  transform: scale(0);
}

input[type='checkbox']:checked::before,
input[type='radio']:checked::before {
  transform: scale(1);
}

label.check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
}

/* Chunky one-bit scrollbars. */
.scroll {
  overflow: auto;
  scrollbar-color: var(--paper) var(--ink);
}

.scroll::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

.scroll::-webkit-scrollbar-track {
  background-color: var(--paper);
  background-image: var(--dither-50);
  background-size: 2px 2px;
  border-left: var(--line);
  border-top: var(--line);
}

.scroll::-webkit-scrollbar-thumb {
  background: var(--paper);
  border: var(--line);
}

.scroll::-webkit-scrollbar-corner {
  background: var(--paper);
}
