/* Polybee palette plus neutral greys for contrast and the dark theme; one blue.
 * docs/design.md lists the contrast of each pair and why the primary button's label is white. */
/* IBM Plex Sans 400 and 700, Latin-1 subset, from @ibm/plex-sans 1.1.0 (licence:
 * fonts/IBM-Plex-OFL.txt). Characters outside the subset fall back to Arial. */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/IBMPlexSans-Regular-Latin1.woff2') format('woff2');
  unicode-range:
    U+0000, U+000D, U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC,
    U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+20AC,
    U+2122, U+2212, U+FB01-FB02;
}

@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/IBMPlexSans-Bold-Latin1.woff2') format('woff2');
  unicode-range:
    U+0000, U+000D, U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC,
    U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+20AC,
    U+2122, U+2212, U+FB01-FB02;
}

:root {
  --bg: #ffffff;
  --surface: #f5f5f5;
  --text: #222222;
  --muted: #6f6f6f;
  --border: #dddddd;
  --input: #808080;
  --primary: #3399ff;
  --on-primary: #ffffff;
  --notice-bg: #cce4ff;
  --ring: rgb(34 34 34 / 50%);
  --content-width: 960px;
  --gutter: 16px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --surface: #222222;
    --text: #f5f5f5;
    --muted: #a0a0a0;
    --border: #3a3a3a;
    --notice-bg: #2a2a2a;
    --ring: rgb(245 245 245 / 50%);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    16px/1.6 'IBM Plex Sans',
    Arial,
    sans-serif;
}

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

.bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  /* Lines the header's edges up with main's content. */
  padding: 12px max(var(--gutter), calc((100% - var(--content-width)) / 2 + var(--gutter)));
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.brand {
  font-size: 18px;
  font-weight: 700;
}

.account {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  overflow-wrap: anywhere;
  min-width: 0;
}

/* display: flex above would otherwise show the account area while loading and on the error page. */
.account[hidden] {
  display: none;
}

main {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 32px var(--gutter) 48px;
}

/* Page titles are large and not bold; the Polyblue line under them carries the brand. */
h1 {
  font-size: 28px;
  font-weight: 400;
  line-height: 1.3;
  margin: 0 0 24px;
}

h1::after {
  content: '';
  display: block;
  width: 48px;
  height: 2px;
  margin-top: 8px;
  background: var(--primary);
}

.muted {
  color: var(--muted);
}

.notice {
  padding: 12px 16px;
  border-left: 4px solid var(--primary);
  border-radius: 4px;
  background: var(--notice-bg);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.tile:hover {
  border-color: var(--primary);
}

.tile-name {
  font-size: 18px;
  font-weight: 700;
}

.tile-description {
  color: var(--muted);
  font-size: 14px;
}

/* The one main action of a page: Polyblue under a white, bold 14pt label.
 * White on Polyblue is 2.94:1, an accepted exception (docs/design.md). */
.button {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  /* Invisible normally; forced-colours mode draws it, so the button keeps an edge there. */
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--primary);
  color: var(--on-primary);
  font: inherit;
  font-size: 18.66px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  filter: brightness(0.93);
}

/* Any other action: no fill, a divider border, the text colour. */
.button.secondary {
  border-color: var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  font-weight: 400;
}

/* Darkening a page-coloured button barely shows in the dark theme. */
.button.secondary:hover {
  border-color: var(--input);
  filter: none;
}

/* A row of buttons, wrapping on a narrow screen. */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* A select is as wide as its longest option; keep a long organisation name on screen. */
.org {
  min-width: 0;
  max-width: 100%;
}

select {
  max-width: 100%;
  height: 40px;
  padding: 0 8px;
  border: 1px solid var(--input);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

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