/* Tokens, type, controls. Everything that is not layout.
 *
 * The palette is the university's corporate design, carried over from
 * `itp3mcp`'s forms service so the two surfaces read as one system: the same
 * blues, the same square corners, the same 4px focus ring, no shadows, no
 * rounded anything except the status dot and the floating composer.
 *
 * Every colour in this project is declared here. A hex literal anywhere else is
 * a bug and a test says so — the two that were hiding in the old sheet were not
 * cosmetic, they were a button and an input border that failed contrast.
 */

:root {
  /* Corporate design */
  --anthracite: #323232;
  --blue: #004191;          /* CD Mittelblau */
  --light: #00beff;         /* CD Hellblau */
  --paper: #fff;
  --green: #177245;
  --orange: #9a5b00;
  --red: #a60000;
  --violet: #5c3a8c;
  --teal: #0b5d6b;
  --olive: #5a5316;

  /* Neutrals */
  --desk: #e4e4e4;          /* the surface the application sits on */
  --paper-2: #f7f7f7;       /* inset surfaces: cards, rows, code */
  --rail-bg: #fafafa;       /* the side columns (rail, files): set off from the work, barely */
  --soft: #ebebeb;
  --line: #d8d8d8;          /* hairlines */
  --line-strong: #767676;   /* borders of controls; 4.5:1 on white */
  --gray: #666;
  --disabled: #6b6b6b;      /* white on this is 5.7:1; #777 was 4.48:1 */

  /* Message tints. Anthracite text on each is at least 9:1, so every box is
   * comfortably readable and none of them shouts. */
  --tint-input: #e6ecf4;
  --tint-document: #e6f1ec;
  --tint-question: #fdf0dd;
  --tint-error: #f6e6e6;
  --tint-notice: #e0f7ff;
  --tint-filing: #efe9f6;
  --tint-message: #e2f0f2;
  --tint-reply: #f3f0df;
  --tint-mark: #ffd59e;      /* a search word marked in an excerpt; the text on it is 9.3:1 */

  /* File tones, as in the forms catalogue */
  --file-pdf: #c62828;
  --file-document: #1565c0;
  --file-spreadsheet: #2e7d32;
  --file-presentation: #c75b12;
  --file-archive: #686868;
  --file-text: #686868;
  --file-folder: #9a5b00;
  --file-mail: #004191;       /* CD Mittelblau, as a letter would be */
  --file-image: #177245;      /* the green of the answers, a picture being a result */

  /* The working bar's spectrum, laid across its whole width; the light that
   * runs along the bar shows whichever part it is over. Decorative only: it
   * never carries text or meaning a reader has to see, so it is exempt from
   * the contrast rules the palette above is held to. */
  --spectrum: linear-gradient(
    90deg,
    #e40303,
    #ff8c00,
    #ffed00,
    #00a651,
    #00beff,
    #3a3ad6,
    #7a2ab8
  );

  /* Layout constants, so the grid reads in one place */
  --rail-w: 18.75rem;      /* 300px at normal text size; grows with "Groß" */
  --files-w: 20rem;        /* the file column, open */

  /* A column closed down to its icons: the narrow rail, the closed file
   * column. One width for both, so the two edges of the frame match. */
  --strip-w: 3.5rem;

  /* The conversation's measure: the width its text is set in. It stretches
   * with the column between these two, and beyond the upper one the text stays
   * centred while the rows around it keep running to the column's edges. */
  --measure-min: 600px;
  --measure-max: 1000px;   /* also written out in chat.css's container query */
  --gutter: 1.25rem;       /* likewise */

  /* The two columns right of the rail start level and are resized by hand;
   * these are the widths neither may be dragged below. */
  --chat-min: calc(var(--measure-min) + 2 * var(--gutter));
  --doc-min: 20rem;
  --split-w: 7px;

  /* The height every column header is locked to. Three columns whose headers
   * each sized themselves from their own content read as three windows that
   * happen to sit side by side, rather than as one application. */
  --head-h: 4.5rem;

  /* Small controls in a header: one height, whatever the element is. An <a>
   * and a <button> with the same padding are not the same height. */
  --control-h: 2.25rem;
}

@font-face {
  font-family: "Uni Stuttgart Sans";
  src: url("../fonts/UniStuttgartSans-Light.woff2") format("woff2");
  font-weight: normal;
  font-display: swap;
}

@font-face {
  font-family: "Uni Stuttgart Sans";
  src: url("../fonts/UniStuttgartSans-Bold.woff2") format("woff2");
  font-weight: bold;
  font-display: swap;
}

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

/* Any rule that sets `display` outranks the browser's own `[hidden]`, and this
 * sheet sets it on buttons, links and panels. Without this, hiding something
 * in JavaScript silently does nothing. */
[hidden] { display: none !important; }

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

/* "Groß" in the rail. Every size and most spacing is in rem, so moving the root
 * enlarges the whole interface evenly; the body is 17px at the normal root.
 * Widths in px — the conversation's measure — stay, on purpose. */
html[data-schrift="gross"] { font-size: 112.5%; }

body {
  margin: 0;
  font: 1.0625rem/1.55 "Uni Stuttgart Sans", Arial, sans-serif;
  color: var(--anthracite);
  background: var(--desk);
}

h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .7rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--blue); }

/* -- controls ----------------------------------------------------------- */

button,
.button {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 0;
  border-radius: 0;
  padding: .6rem 1rem;
  font: inherit;
  font-weight: bold;
  color: var(--paper);
  background: var(--blue);
  text-decoration: none;
  cursor: pointer;
}

button:disabled { background: var(--disabled); cursor: default; }
.secondary { background: var(--anthracite); }
.btn-yes { background: var(--green); }
.btn-no { background: var(--red); }

/* Named for what the button does, not for where it sits. */
.danger { background: var(--red); }     /* stopping a running turn */
.confirm { background: var(--green); }  /* taking a result away with you */
.neutral { background: var(--gray); }   /* putting something back */

.link-button {
  padding: 0;
  color: var(--blue);
  background: none;
  font-weight: normal;
  text-decoration: underline;
}

input[type="text"],
input[type="search"],
input[type="password"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: .55rem .65rem;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  font: inherit;
  color: inherit;
  background: var(--paper);
}

label {
  display: block;
  margin-bottom: .25rem;
  font-size: .85rem;
  color: var(--gray);
}

.field { margin-bottom: .9rem; }

:focus-visible,
input:focus,
textarea:focus,
select:focus {
  outline: 4px solid var(--light);
  outline-offset: 2px;
}

/* -- small pieces ------------------------------------------------------- */

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: currentColor;
}

.icon-large { width: 2.2em; height: 2.2em; }
.sprite { display: none; }

/* A dot is a state. A tag is a label. One class used to serve both shapes,
 * which is why the old sheet had to exempt the dot by id. */
.dot {
  display: inline-block;
  width: .7em;
  height: .7em;
  border-radius: 50%;
  background: var(--gray);
  flex: none;
}

.dot-green { background: var(--green); }
.dot-orange { background: var(--orange); }
.dot-red { background: var(--red); }
.dot-gray { background: var(--gray); }
.dot-blue { background: var(--blue); }

.tag {
  display: inline-block;
  padding: .1rem .45rem;
  font-size: .78rem;
  color: var(--paper);
  background: var(--gray);
}

.tag-gray { background: var(--gray); }
.tag-blue { background: var(--blue); }

.hint { color: var(--gray); }
.error { color: var(--red); font-weight: bold; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-list { position: absolute; z-index: 100; }

.skip {
  position: absolute;
  left: -9999px;
  padding: .6rem 1rem;
  background: var(--blue);
  color: var(--paper);
}

.skip:focus { left: .5rem; top: .5rem; }

/* -- the modal question -------------------------------------------------- */

/* Used for the one act in this interface that cannot be undone. Square and
 * plain like everything else, with a red rule at the top so it is not mistaken
 * for a notice. */
.ask {
  max-width: 30rem;
  padding: 1.5rem;
  border: 0;
  border-top: 6px solid var(--red);
  color: var(--anthracite);
  background: var(--paper);
}

.ask::backdrop { background: rgb(0 0 0 / 45%); }

.ask h2 { margin-bottom: .6rem; }
.ask-lead { margin: 0 0 .6rem; }

.ask-path {
  margin: 0 0 .8rem;
  padding: .5rem .6rem;
  font-family: ui-monospace, monospace;
  font-size: .85rem;
  background: var(--paper-2);
  overflow-wrap: anywhere;
}

.ask-warn { margin: 0 0 1.2rem; font-weight: bold; color: var(--red); }
.ask-error { margin: 0 0 1rem; color: var(--red); }
.ask-error:empty { display: none; }
.ask-actions { display: flex; gap: .6rem; justify-content: flex-end; }
