/* dashing: an operations console for one Gitea organisation.
   Quiet graphite chrome, so the one place with colour reads at once: the live
   requests, one colour per Pod. DASHING_COLOR (--accent) is only for links.
   IBM Plex Sans for reading, IBM Plex Mono for anything the machine says.
   Fonts: SIL Open Font License, see fonts/LICENSE-IBM-Plex.txt.
   Redesigned following unslop by Damir Sokolovsky (@heydamir), CC BY 4.0. */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* graphite, light */
  --bg: #fafafa;
  --card: #ffffff;
  --raised: #f4f4f5;
  --text: #171717;
  --text-2: #525252;
  --muted: #737373;
  --line: rgb(23 23 23 / 8%);
  --shadow: 0 1px 2px rgb(0 0 0 / 5%);
  --bad: #dc2626;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141415;
    --card: #19191b;
    --raised: #232325;
    --text: #ededed;
    --text-2: #a1a1a6;
    --muted: #85858b;
    --line: rgb(237 237 237 / 8%);
    --shadow: none;
    --bad: #e5484d;
  }
}

/* The accent as ink. Set here, not on :root, because --accent comes from the
   style attribute on <body>. Darker on light and lighter on dark, so any
   DASHING_COLOR stays readable as link text. */
body { --link: color-mix(in oklab, var(--accent) 78%, #000); }
@media (prefers-color-scheme: dark) {
  body { --link: color-mix(in oklab, var(--accent) 55%, #fff); }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/20px var(--sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
a:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 2px; }
code { font: 400 13px/20px var(--mono); }
h2 { margin: 0 0 16px; font-size: 15px; line-height: 20px; font-weight: 500; }
strong { font-weight: 500; }

/* one column for the whole page, so the header lines up with the cards */
.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding-inline: 32px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding-block: 40px 32px;
}
h1 { margin: 0; font-size: 28px; line-height: 36px; font-weight: 500; }
.tagline { margin: 4px 0 0; font-size: 15px; color: var(--text-2); }
.version { font: 400 13px/20px var(--mono); color: var(--muted); white-space: nowrap; }

main { display: grid; gap: 24px; padding-bottom: 32px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 24px;
  min-width: 0;
}

/* ---------- the live requests: the one place with colour ---------- */

.live {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 32px;
}

.hint { margin: -8px 0 20px; max-width: 64ch; color: var(--text-2); }

/* one cell per answer, oldest on the left; app.js fills the 60 cells */
#strip {
  display: grid;
  grid-template-columns: repeat(60, minmax(0, 1fr));
  gap: 3px;
  height: 40px;
}
#strip span {
  border-radius: 3px;
  background: var(--raised);
}
#strip span.new { animation: arrive 180ms var(--ease); }
#strip span.failed {
  background: repeating-linear-gradient(135deg, var(--bad) 0 2px, transparent 2px 5px);
  box-shadow: inset 0 0 0 1px var(--bad);
}
@keyframes arrive { from { opacity: 0; } }

/* one grid for all rows, so names, versions, bars and counts line up */
#pods {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 8px minmax(0, max-content) auto minmax(48px, 1fr) 40px;
  align-items: center;
  gap: 8px 12px;
  font: 400 13px/20px var(--mono);
}
#pods li { display: contents; }
#pods .version { font-size: 13px; }
#pods .share { height: 4px; border-radius: 2px; background: var(--raised); overflow: hidden; }
#pods .share i { display: block; height: 100%; transform-origin: left; transition: transform 300ms var(--ease); }
#pods .count { text-align: right; color: var(--muted); }
#pods .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pods li.failed > * { color: var(--bad); }

/* the Pod colour dot: wherever a Pod appears, and nowhere else */
.dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.served { padding-left: 32px; border-left: 1px solid var(--line); }
dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; }
dt { color: var(--text-2); }
dd { margin: 0; font: 400 13px/20px var(--mono); overflow-wrap: anywhere; }
dd:first-of-type { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dd .dot { margin-right: 8px; vertical-align: 1px; }

/* ---------- Gitea's data ---------- */

.banner {
  margin-bottom: 24px;
  padding: 16px 20px;
  overflow-wrap: anywhere;
  color: var(--text);
  background: color-mix(in oklab, var(--bad) 8%, var(--card));
  border: 1px solid color-mix(in oklab, var(--bad) 35%, transparent);
  border-radius: 12px;
}
.banner strong { color: var(--bad); }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 24px;
  align-items: start;
}

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.feed li:first-child { border-top: 0; padding-top: 0; }
.feed li:last-child { padding-bottom: 0; }
.feed li > div { min-width: 0; }
.feed p { margin: 0; }
.avatar { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--raised); }
.detail {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font: 400 12px/20px var(--mono);
  color: var(--text-2);
}
.meta { margin-top: 4px !important; font-size: 12px; line-height: 16px; color: var(--muted); }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 0; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
th { padding-top: 0; border-top: 0; font-size: 12px; line-height: 16px; font-weight: 400; color: var(--muted); }
th + th, td + td { padding-left: 16px; text-align: right; white-space: nowrap; font-family: var(--mono); font-size: 13px; }
th + th { font-family: var(--sans); font-size: 12px; }
tbody tr:last-child td { padding-bottom: 0; }
.desc { display: block; margin-top: 4px; font-size: 13px; color: var(--text-2); }
.tag {
  margin-left: 4px;
  padding: 0 4px;
  font: 400 12px/16px var(--mono);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.empty { margin: 0; color: var(--text-2); }
.fetched { margin: 16px 0 0; font-size: 12px; line-height: 16px; color: var(--muted); }

footer { padding-block: 0 32px; font-size: 12px; line-height: 16px; color: var(--muted); }

/* ---------- small screens ---------- */
@media (max-width: 960px) {
  .live, .grid { grid-template-columns: minmax(0, 1fr); }
  .served { padding-left: 0; padding-top: 24px; border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 600px) {
  .wrap { padding-inline: 16px; }
  header { padding-block: 24px; flex-direction: column; align-items: flex-start; gap: 8px; }
  #strip { gap: 2px; height: 32px; }
  #pods { grid-template-columns: 8px minmax(0, max-content) minmax(32px, 1fr) 32px; }
  #pods .version { display: none; }
  .card { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  #strip span.new { animation: none; }
  #pods .share i { transition: none; }
}
