:root {
  --font-sans: Nunito, system-ui;
  --font-children: "Sassoon Infant Pro", system-ui;
  --hover-color: var(--color-subtle-dark);
  --hover-size: 0.15rem;
  --hover-filter: brightness(1);
}

html, body {
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: none;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-sans);
  line-height: 1.4;
  overflow: unset;
  text-rendering: optimizeLegibility;
  text-size-adjust: none;
}

a:not([class]) {
  --hover-size: 0;
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-skip-ink: auto;
}

:where(button, input, textarea, summary, .input, .btn, .item) {
  --outline-size: min(0.2em, 2px);

  appearance: none;
  border: none;
  background-color: transparent;
  font: inherit;
  line-height: inherit;
  text-decoration: none;
  touch-action: manipulation;
  transition: box-shadow 150ms ease, outline-offset 150ms ease, background-color 150ms ease, opacity 150ms ease, filter 150ms ease;

  /* Hover */
  @media (any-hover: hover) {
    &:where(:not(:active):hover) {
      filter: var(--hover-filter);
      box-shadow: 0 0 0 var(--hover-size) var(--hover-color);
    }
  }

  /* Keyboard navigation */
  &:where(:not(:active)):focus-visible {
    outline-width: var(--outline-size);
    outline-color: var(--outline-color, var(--color-link));
    outline-offset: var(--outline-offset, calc(var(--outline-size) * 2));
  }

  /* Pressing */
  &:focus:not(:focus-visible) {
    --outline-offset: 0;
  }

  /* Disabled */
  &:where([disabled]):not(:hover):not(:active) {
    cursor: not-allowed;
    filter: brightness(0.75);
  }
}

::selection {
  background-color: var(--color-selected);
}

:where(ul, ol):where([role="list"]) {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Printing */
@page {
  margin: 1in;
}

@media print {
  .no-print {
    display: none;
  }
}

/* Turbo */
turbo-frame {
  display: contents;
}

/* For settings */
fieldset {
  border: 2px solid var(--fieldset-border-color, var(--color-subtle));
  border-block-end: 0;
  border-inline: 0;
  display: flex;
  flex-direction: column;
  max-inline-size: 50ch;
  padding: var(--block-space) 0;

  &.border {
    border-color: var(--color-subtle-dark);
    border-style: solid;
    border-width: 1px;
  }
}

legend {
  align-items: center;
  display: flex;
  justify-content: center;
  margin-inline: auto;
  text-align: center;
}

/* Misc */
menu {
  outline: 0;
}

/* Nicer scrollbars on Chrome 29+. This is intended for Windows machines, but */
/* there's not a way to target Windows using CSS, so Chrome on Mac will have */
/* slightly thinner scrollbars than normal. #C1C1C1 is the default color on Macs. */
@media screen and (-webkit-min-device-pixel-ratio:0) and (min-resolution:.001dpcm) {
  * {
    scrollbar-color: #C1C1C1 transparent;
    scrollbar-width: thin;
  }
}

.debug {
  turbo-frame {
    border: 1px dashed red;
    display: block;

    &::before {
      content: "Frame #" attr(id) " src=" attr(src) " loading=" attr(loading);
      font-size: 0.75rem;
      position: relative;
      padding: 0.25rem;
      border: 1px dashed red;
      background: white;
    }
  }
}