/* The shared layout: the shell with its rail, top bar and page, the panel a guest page's form or
   message sits in, a tool's status line and its lines of help, and the list whose rows open
   somewhere. Every colour and size names a token (tokens.css), but the one-pixel box of the text
   that is only read aloud. A tool's pages add a stylesheet of their own. */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg-app);
  color: var(--text-1);
  font: var(--weight-text) var(--fs-3) / var(--lh-3) var(--font-ui);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
}
h1,
h2,
p,
ul,
dl,
dd {
  margin: 0;
}
button,
input {
  font: inherit;
  color: inherit;
}
.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
}
.t2 {
  color: var(--text-2);
}
.t3 {
  color: var(--text-3);
}
.fs-2 {
  font-size: var(--fs-2);
  line-height: var(--lh-2);
}
/* Read aloud, never seen. */
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
/* An outline, not a shadow, so the ring survives forced colours. */
:focus-visible {
  outline: var(--ring) solid var(--focus);
  outline-offset: var(--ring);
}
.icon {
  width: var(--icon);
  height: var(--icon);
  flex: none;
  fill: none;
  stroke: currentcolor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* The icons' shapes, drawn by reference from each page. */
.defs {
  position: absolute;
  width: 0;
  height: 0;
}
/* Above the top of the page until it is focused. */
.skip-link {
  position: absolute;
  left: var(--sp-4);
  bottom: 100%;
  z-index: 20;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  background: var(--bg-panel);
}
.skip-link:focus {
  bottom: auto;
  top: var(--sp-2);
}

/* Buttons: primary, secondary and quiet. A page has one primary action. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--ctl);
  padding: 0 var(--sp-4);
  border: var(--rule) solid var(--border-control);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text-1);
  font-weight: var(--weight-medium);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover {
  background: var(--bg-hover);
}
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text-on);
}
.btn--primary:hover {
  background: var(--accent);
  filter: brightness(1.08);
}
.btn--ghost {
  border-color: transparent;
  background: transparent;
}
.btn--ghost:hover {
  background: var(--bg-hover);
}
.btn--md {
  min-height: var(--ctl-md);
}
/* The theme toggle is shown only with the script, which is all it works by. Its icon is the theme
   in force, the moon in the dark, whether chosen or the system's, so it is right before the
   script runs. */
.theme-toggle,
.theme-toggle__moon,
:root[data-theme="dark"] .theme-toggle__sun {
  display: none;
}
.has-js .theme-toggle {
  display: inline-flex;
}
:root[data-theme="dark"] .theme-toggle__moon {
  display: block;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle__sun {
    display: none;
  }
  :root:not([data-theme]) .theme-toggle__moon {
    display: block;
  }
}

/* The shell: the rail, the top bar and the page. A guest has no rail. */
.shell {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100%;
}
.shell--guest {
  grid-template-columns: minmax(0, 1fr);
}
.sidebar {
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-3);
  background: var(--bg-panel);
  border-right: var(--rule) solid var(--border-2);
}
.brand {
  display: inline-flex;
  align-items: center;
  min-height: var(--row);
  padding: 0 var(--sp-2);
  border-radius: var(--radius);
  font-size: var(--fs-4);
  font-weight: var(--weight-strong);
  text-decoration: none;
}
.navigation-close,
.navigation-toggle {
  display: none;
}
.sidebar__group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
/* A group of the rail's entries is named in capitals, quieter than they are. */
.sidebar__label {
  padding: 0 var(--sp-2);
  color: var(--text-3);
  font-size: var(--fs-1);
  line-height: var(--lh-1);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}
.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: var(--sp-0);
}
.sidebar__nav a,
.sidebar__nav .unbuilt {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--row);
  padding: 0 var(--sp-2);
  border-radius: var(--radius);
  color: var(--text-2);
  text-decoration: none;
}
.sidebar__nav a:hover {
  background: var(--bg-hover);
  color: var(--text-1);
}
/* The page that is open, or the tool whose tab is, marked by an accent rule at its left; its
   words stay where they were. */
.sidebar__nav a[aria-current] {
  padding-left: calc(var(--sp-2) - var(--mark));
  border-left: var(--mark) solid var(--accent);
  background: var(--bg-selected);
  color: var(--text-1);
  font-weight: var(--weight-medium);
}
.sidebar__nav .unbuilt {
  color: var(--text-3);
  justify-content: space-between;
}
.sidebar__bottom {
  margin-top: auto;
}

/* The account menu opens upwards, from the foot of the rail. */
.account-menu {
  position: relative;
}
.account-menu summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--row);
  padding: 0 var(--sp-2);
  border-radius: var(--radius);
  cursor: pointer;
}
.account-menu summary::-webkit-details-marker {
  display: none;
}
.account-menu summary:hover {
  background: var(--bg-hover);
}
.avatar {
  display: grid;
  place-items: center;
  width: var(--avatar);
  height: var(--avatar);
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text-on);
  font-size: var(--fs-2);
  font-weight: var(--weight-strong);
}
.account-menu__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + var(--sp-1));
  display: flex;
  flex-direction: column;
  gap: var(--sp-0);
  padding: var(--sp-2);
  background: var(--bg-panel);
  border: var(--rule) solid var(--border-1);
  border-radius: var(--radius-lg);
}
.account-menu__who {
  padding: var(--sp-1) var(--sp-2) var(--sp-2);
  margin-bottom: var(--sp-1);
  border-bottom: var(--rule) solid var(--border-2);
}
.account-menu__panel .btn {
  justify-content: flex-start;
  width: 100%;
  padding: 0 var(--sp-2);
}
.account-menu__panel form {
  display: contents;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--topbar);
  padding: 0 var(--sp-6);
  background: var(--bg-app);
  border-bottom: var(--rule) solid var(--border-2);
}
.topbar__context {
  color: var(--text-2);
  font-size: var(--fs-2);
}
.topbar__context > span {
  margin: 0 var(--sp-1);
  color: var(--text-3);
}
.topbar__page {
  display: none;
  font-weight: var(--weight-strong);
  text-decoration: none;
}
.topbar__end {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}

.main {
  min-width: 0;
  padding: var(--sp-6);
}
.shell--guest .main {
  display: grid;
  place-items: start center;
  padding: 10vh var(--sp-4) var(--sp-6);
}
.page {
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
  max-width: var(--page);
}
.page-header h1 {
  font-size: var(--fs-title);
  line-height: var(--lh-title);
  font-weight: var(--weight-heading);
  letter-spacing: var(--tracking-heading);
  text-wrap: balance;
}

/* A tool's status line, under the page's title: one quiet line, the exact time beneath. */
.status {
  display: flex;
  flex-direction: column;
  gap: var(--sp-0);
  color: var(--text-2);
}
.status .exact {
  color: var(--text-3);
  font-size: var(--fs-2);
  line-height: var(--lh-2);
}
/* A line of help, beneath what it explains. */
.help {
  color: var(--text-3);
  font-size: var(--fs-2);
  line-height: var(--lh-2);
}

/* A list whose every row opens somewhere: the whole row is the link. */
.rows {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  border-top: var(--rule) solid var(--border-2);
}
.rows > li {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--sp-1);
  padding: var(--sp-3) var(--sp-2);
  border-bottom: var(--rule) solid var(--border-2);
}
.rows > li:has(a):hover {
  background: var(--bg-hover);
}
.rows .linked__link {
  font-weight: var(--weight-medium);
  text-decoration: none;
}
.rows .linked__link::after {
  content: "";
  position: absolute;
  inset: 0;
}
.rows .linked__link:focus-visible {
  outline: none;
}
.rows > li:has(.linked__link:focus-visible) {
  outline: var(--ring) solid var(--focus);
  outline-offset: calc(var(--ring) * -1);
}
.rows .not-yet {
  color: var(--text-3);
  font-weight: var(--weight-medium);
}
.rows .about {
  color: var(--text-2);
  font-size: var(--fs-2);
  line-height: var(--lh-2);
}

/* A panel: what a guest page holds on its own, a form such as sign-in or one message. Django's
   form rows are its divs. */
.panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  width: min(100%, var(--panel));
  padding: var(--sp-6);
  background: var(--bg-panel);
  border: var(--rule) solid var(--border-2);
  border-radius: var(--radius-lg);
}
.panel__title {
  font-size: var(--fs-5);
  line-height: var(--lh-5);
  font-weight: var(--weight-heading);
  letter-spacing: var(--tracking-heading);
}
.panel > div {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.panel label {
  color: var(--text-2);
  font-size: var(--fs-2);
  line-height: var(--lh-2);
  font-weight: var(--weight-medium);
}
.panel input {
  width: 100%;
  min-height: var(--ctl-md);
  padding: 0 var(--sp-3);
  background: var(--bg-panel);
  color: var(--text-1);
  border: var(--rule) solid var(--border-control);
  border-radius: var(--radius);
}
.panel .helptext,
.panel .helptext ul {
  color: var(--text-3);
  font-size: var(--fs-2);
  line-height: var(--lh-2);
  padding-left: 0;
  list-style: none;
}
/* A refused sign-in, or a field's fault: in words and a restrained colour. */
.errorlist {
  list-style: none;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  background: var(--bg-inset);
  color: var(--danger-quiet);
  font-size: var(--fs-2);
  line-height: var(--lh-2);
}
.panel > .form-actions {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-top: var(--sp-2);
}
.form-actions__aside {
  color: var(--text-2);
  font-size: var(--fs-2);
  line-height: var(--lh-2);
}

/* Narrow: the rail is a drawer behind the menu button. Without the script, which the root
   says it has by .has-js, the rail stands above the page instead, and everything still works. */
@media (width < 1100px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
  }
  .sidebar {
    grid-row: auto;
  }
  /* Shut, it is hidden once the slide ends, so the keyboard and screen readers pass it by. */
  .has-js .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 5;
    width: min(var(--rail), 85vw);
    transform: translateX(-100%);
    visibility: hidden;
    transition:
      transform 0.18s ease-out,
      visibility 0s 0.18s;
  }
  .has-js .sidebar.is-open {
    transform: none;
    visibility: visible;
    transition: transform 0.18s ease-out;
  }
  /* Open, the page behind it is dimmed; a click there closes it (shell.js). */
  .has-js .shell:has(.sidebar.is-open)::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 4;
    background: var(--backdrop);
  }
  .has-js .navigation-close,
  .has-js .navigation-toggle {
    display: inline-flex;
  }
  .navigation-close {
    position: absolute;
    right: var(--sp-2);
    top: var(--sp-3);
  }
  .navigation-toggle {
    margin-left: calc(var(--sp-2) * -1);
  }
  .topbar {
    padding: 0 var(--sp-4);
  }
  .topbar__context {
    display: none;
  }
  .topbar__page {
    display: inline;
  }
  .main {
    padding: var(--sp-4);
  }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar {
    transition: none;
  }
}
