/* Gruvbox dark, layered on top of classless.css.
 *
 * classless names its palette by lightness, which reads backwards on a dark theme:
 * --clight is not "a light colour", it is "the surface just off the page background",
 * and --cdark is not "a dark colour", it is "muted secondary text". Mapping them
 * literally is what made captions and <time> render near-invisibly, and put pale text
 * on a cream background inside every input and open <details>.
 *
 * So each variable below is mapped by the job classless gives it, not by its name.
 */
:root {
  width: 100%;
}

:root {
  --font-p: 1em/1.7 monospace;
  --font-h: .9em/1.5 monospace;
  --font-c: .9em/1.4 monospace;
  --width: 70rem;

  /* Page background and body text. */
  --cbg: #282828;  /* bg0 */
  --cfg: #ebdbb2;  /* fg  */

  /* Surfaces set off from the background: nav, inputs, code, open details, table
     row hover. Darker rather than lighter, so it reads as an inset well and every
     foreground colour gains contrast against it rather than losing it — summary
     text on bg1 only reaches 4.3:1, which is under the 4.5:1 threshold. */
  --clight: #1d2021;  /* bg0_h */

  /* Borders, rules and underlines. */
  --cmed: #7c6f64;  /* bg4 */

  /* Muted secondary text: captions, <time>, .text-secondary, disabled buttons.
     Readable against --cbg, but quieter than --cfg. */
  --cdark: #a89984;  /* fg4 */

  --clink: #83a598;  /* blue   */
  --cemph: #fe8019;  /* orange */
  /* Backdrop for .hint callouts. classless only ever uses this behind --cemph. */
  --cemphbg: #fe80192a;

  --c-primary: #b16286;
}

/* Usernames, client identifiers and URLs are shown inline in sentences, and read
   better as accents than as boxed code. */
code {
  background: none;
  color: var(--cemph);
}

/* Something that did not work, or that needs doing before anything else. */
.warn {
  color: var(--cemph);
}

/* classless makes every text input display:block and full width, which is far
   wider than a username or a password, and makes a form of two fields look like
   a page of them. */
form.narrow input:not([type="hidden"]) {
  width: min(24rem, 100%);
}

form.narrow label {
  display: block;
  margin: .8rem 0 .2rem;
  font: var(--font-h);
}

form.narrow button {
  margin: 1.2rem 0 0;
}

/* Session controls sit at the far end of the navigation, away from the links.
   classless lays the items out inline; this only changes where the last one goes. */
nav ul:first-child {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

nav ul:first-child > li.session {
  margin-left: auto;
}

/* Which part of the dashboard this page is in. */
nav a[aria-current="page"] {
  font-weight: bold;
}

/* A form is block-level by default, which would break the row. */
nav form {
  display: inline;
}

nav button {
  margin: 0;
}

/* The consent page. A client's logo is whatever size its owner made it, so it is
   shown at one size whatever it is; the width and height attributes reserve the
   space, and this keeps a logo that is not square from being stretched. */
img.client-logo {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: contain;
}

/* The logo and the line under it that says whose word it is, which belongs to
   the logo and is kept beside it and small, where classless centres a figure. */
figure:has(img.client-logo) {
  margin: 0 0 1rem;
  text-align: left;
}

figure:has(img.client-logo) figcaption {
  font-size: 0.85rem;
}

/* A list of things to tick is not a list of points: no bullets, and each label
   beside its box rather than under it. classless makes inputs display:block. */
ul.choices {
  list-style: none;
  padding-left: 0;
}

ul.choices > li {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  margin: .3rem 0;
}

ul.choices input {
  display: inline-block;
  flex: none;
  width: auto;
  margin: 0;
}

/* "Not you?" and its button on one line, as an aside to the sentence above it. */
form.aside {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
}

form.aside button {
  margin: 0;
}

/* Saying no is always possible and never the prominent thing. */
form#deny {
  margin-top: .6rem;
}

/* A button in a row of a table is part of the row, not a paragraph of its own. */
td form,
td button {
  margin: 0;
}

/* The address the consent page is headed with, and the whole of it beneath. An
   address is one word however long it is, and a browser left to itself breaks
   it at a hyphen if it can, which is somewhere its owner chose: after a prefix
   that reads as somebody else's host. Broken wherever the line runs out, the
   line is full, and plainly goes on. */
.client-address,
#client-id code {
  word-break: break-all;
}

/* Said to a screen reader and not shown: which of several buttons that look the same this one is. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Last in the file deliberately. Controls that only work with JavaScript are
   rendered hidden and revealed by it, and a display rule elsewhere - classless's
   own, or one of the layouts above - would otherwise override the hidden
   attribute's meaning at equal specificity. */
[hidden] {
  display: none;
}
