/*
 * Bureau: monospace, monochrome base layer, in the spirit of
 * https://github.com/owickstrom/the-monospace-web
 *
 * This file owns the design tokens and bare-element styling. Component
 * styles (task lists, tags, the shortcuts popover, etc.) live in app.css
 * and should only ever reference these custom properties, never hardcode
 * color/border values.
 */

:root {
  --font-family: ui-monospace, "Cascadia Code", "Cascadia Mono", "SF Mono",
    "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --line-height: 1.25rem;
  --border-thickness: 2px;

  --text-color: #fff;
  --text-color-alt: #aaa;
  --background-color: #000;
  --background-color-alt: #111;

  --font-weight-normal: 500;
  --font-weight-medium: 600;
  --font-weight-bold: 800;
}

@media (prefers-color-scheme: dark) {
  :root {
      --text-color: #000;
      --text-color-alt: #666;
      --background-color: #fff;
      --background-color-alt: #eee;
  }
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  background: var(--background-color);
}

body {
  margin: 0;
  background: var(--background-color);
  color: var(--text-color);
  font-family: var(--font-family);
  font-weight: var(--font-weight-normal);
  font-variant-numeric: tabular-nums lining-nums;
  font-size: 16px;
  line-height: var(--line-height);
}

@media screen and (max-width: 480px) {
  body {
    font-size: 14px;
  }
}

.container {
  max-width: calc(min(80ch, round(down, 100%, 1ch)));
  margin: 0 auto;
  padding: var(--line-height) 2ch;
}

/*
 * The reference framework gives every element a uniform margin-top via
 * a blanket `* + *` sibling rule. This app leans on flex rows for most
 * components (task rows, plan items, forms), where a blanket sibling
 * margin would misalign flex children. Instead, vertical rhythm comes
 * from margin-bottom on block-level elements only.
 */
h1, h2, h3, h4, h5, h6,
p, ul, ol, form, details, hr, table, section {
  margin: 0 0 var(--line-height);
}

section + section {
  margin-top: calc(var(--line-height) * 1.5);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height);
}

h1 {
  font-size: 2rem;
  line-height: calc(2 * var(--line-height));
  text-transform: uppercase;
}

h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

hr {
  position: relative;
  display: block;
  height: var(--line-height);
  border: none;
}

hr::after {
  content: "";
  display: block;
  position: absolute;
  top: calc(var(--line-height) / 2 - var(--border-thickness));
  left: 0;
  width: 100%;
  border-top: calc(var(--border-thickness) * 3) double var(--text-color);
}

a {
  color: var(--text-color);
  text-decoration-thickness: var(--border-thickness);
}

strong {
  font-weight: var(--font-weight-bold);
}

ul, ol {
  padding: 0 0 0 2ch;
}

li {
  margin: 0;
  padding: 0;
}

details {
  border: var(--border-thickness) solid var(--text-color);
  padding: calc(var(--line-height) - var(--border-thickness)) 1ch;
}

summary {
  font-weight: var(--font-weight-medium);
  cursor: pointer;
}

details[open] summary {
  margin-bottom: var(--line-height);
}

details ::marker {
  content: "▶";
}

details[open] ::marker {
  content: "▼";
}

details :last-child {
  margin-bottom: 0;
}

input, button, textarea, select {
  border: var(--border-thickness) solid var(--text-color);
  border-radius: 0;
  padding: calc(var(--line-height) / 2 - var(--border-thickness)) calc(1ch - var(--border-thickness));
  margin: 0;
  font: inherit;
  font-weight: inherit;
  background: var(--background-color);
  color: var(--text-color);
  -webkit-appearance: none;
  appearance: none;
}

textarea {
  width: 100%;
  min-height: calc(var(--line-height) * 3);
}

button {
  text-transform: uppercase;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  height: calc(var(--line-height) * 2);
  border-right: 4px solid var(--text-color);
  border-bottom: 4px solid var(--text-color);
}

button:hover {
  background: var(--background-color-alt);
}

button:active {
  transform: translate(2px, 2px);
}

button:focus, input:focus, textarea:focus, select:focus {
  --border-thickness: 3px;
  outline: none;
}

input[type="checkbox"], input[type="radio"] {
  display: inline-grid;
  place-content: center;
  vertical-align: middle;
  width: 2ch;
  height: var(--line-height);
  cursor: pointer;
}

input[type="checkbox"]:checked::before,
input[type="radio"]:checked::before {
  content: "";
  width: 1ch;
  height: calc(var(--line-height) / 2);
  background: var(--text-color);
}

input[type="radio"], input[type="radio"]::before {
  border-radius: 100%;
}

label {
  display: block;
  font-weight: var(--font-weight-medium);
}

label input, label select, label textarea {
  width: 100%;
  margin-top: calc(var(--line-height) / 4);
}

::placeholder {
  color: var(--text-color-alt);
  opacity: 1;
}

kbd {
  display: inline-block;
  border: 1px solid var(--text-color);
  padding: 0 0.4ch;
  font-family: var(--font-family);
  line-height: calc(var(--line-height) - 2px);
}

.delete-form button {
    background-color: #CE3;
}
