/* Global styles shared by the Django pages and the React app (tokens in tokens.css). */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--font-hand);
  font-size: var(--text-md);
  line-height: 1.3;
  /* A soft paper: a warm off-white with a faint grain */
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .4 0 0 0 0 .3 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 400;
}

:focus-visible {
  outline: var(--focus);
  outline-offset: 3px;
}

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

.rough-defs {
  position: absolute;
  width: 0;
  height: 0;
}

/* A hand-drawn box: the stroke and the fill are drawn by ::before, wobbled by the #rough filter, so the text stays
   crisp. Colour it with --fill (and --hatch for hachures). */
.sketch {
  position: relative;
  isolation: isolate;
  border: 0;
  background: none;
}

.sketch::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: var(--stroke) solid var(--sketch-stroke, var(--ink));
  border-radius: var(--radius-sketch);
  background: var(--fill, var(--paper-raised));
  filter: url("#rough");
}

.sketch.hachure::before {
  background:
    repeating-linear-gradient(-45deg, var(--hatch) 0 2px, transparent 2px var(--hachure-gap)),
    var(--fill, var(--paper-raised));
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0.35em 1em;
  border: 0;
  background: none;
  cursor: pointer;
  position: relative;
  isolation: isolate;
  font-size: var(--text-md);
}

.button::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--fill, var(--paper-raised));
  filter: url("#rough");
}

.button-primary {
  --fill: var(--accent);

  color: var(--accent-ink);
}

.field {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 0.4em 0.75em;
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-sketch);
  background: var(--paper-raised);
  font-size: var(--text-md);
}

/* The Django login page */
.login {
  max-width: 26rem;
  margin: 0 auto;
  padding: 3rem 1.25rem;
}

.login-title {
  font-size: 2.6rem;
}

.login-lede {
  margin: 0.25rem 0 1.75rem;
  color: var(--ink-soft);
}

.login-card {
  display: grid;
  gap: 0.6rem;
  padding: 1.5rem 1.25rem;
}

.login-label {
  margin-top: 0.4rem;
}

.login-card .button {
  margin-top: 1rem;
}

.login-error {
  color: var(--danger);
}

.login-error p {
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* More contrast asked for: straight strokes, no hachures behind text, darker rules */
@media (prefers-contrast: more) {
  :root {
    --rule-dash: var(--ink-soft);
  }

  .sketch::before,
  .button::before {
    filter: none;
  }

  .sketch.hachure::before {
    background: var(--fill, var(--paper-raised));
  }
}

@media (forced-colors: active) {
  .sketch::before,
  .button::before {
    filter: none;
    border-color: CanvasText;
  }
}
