/* Ignite Hub. Deliberately small: one stylesheet, no framework, no web fonts.
   A font from a third party is a request to that third party on every page load, which is
   exactly the kind of thing the privacy page promises does not happen. */

:root {
  --bg: #0f1115;
  --bg-raised: #161920;
  --text: #e6e8ec;
  --muted: #9aa1ad;
  --border: #272b35;
  --accent: #d9642c;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
.muted { color: var(--muted); }

.topbar, footer {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

footer {
  border-bottom: 0;
  border-top: 1px solid var(--border);
  margin-top: auto;
  justify-content: space-between;
  font-size: 0.9rem;
}

footer nav { display: flex; gap: 1rem; }

.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }

.brand-mark {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.topbar nav { display: flex; gap: 1rem; }
.spacer { flex: 1; }

/*
 * Colour and font are set explicitly, and have to be.
 *
 * A <button> does not inherit either: without them it takes the browser default, which is
 * black text in the system UI font. On an <a class="btn"> that never showed, because a link
 * inherits its colour - so every button rendered as a link looked right and every real
 * button was black-on-near-black until you hovered it.
 */
.btn {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-raised);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  cursor: pointer;
}

.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #c4571f; border-color: #c4571f; color: #fff; }

.btn:hover { border-color: var(--accent); color: var(--text); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn:disabled { opacity: .5; cursor: default; }

main { padding: 2rem 1.5rem; max-width: 60rem; width: 100%; margin: 0 auto; }

.hero h1 { font-size: 2.5rem; margin: 0 0 0.25rem; }
.lead { color: var(--muted); font-size: 1.1rem; margin-top: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; margin-top: 2rem; }

.card {
  display: block;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.card:hover { border-color: var(--accent); color: inherit; }
.card h2 { margin: 0 0 0.35rem; font-size: 1.15rem; }
.card p { margin: 0; color: var(--muted); }

/* Prose is capped narrower than the page: a policy read across a wide monitor is harder to
   follow, and these are the pages most likely to be read properly. */
.prose { max-width: 40rem; }
.prose h2 { margin-top: 2rem; font-size: 1.1rem; }
.prose ul { padding-left: 1.2rem; }

/* ---------------------------------------------------------------- admin */

.subnav {
  display: flex;
  gap: .25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.subnav a {
  padding: .5rem .85rem;
  border-bottom: 2px solid transparent;
  color: var(--muted);
}

.subnav a:hover { color: var(--text); }
.subnav a.active { color: var(--text); border-bottom-color: var(--accent); }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.stats div {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--muted);
  font-size: .85rem;
}

.stats .n { display: block; font-size: 1.8rem; color: var(--text); line-height: 1.2; }

.table { width: 100%; border-collapse: collapse; margin-bottom: 2rem; }
.table th, .table td { padding: .6rem .5rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }

/* A row that is unlisted or banned is still readable - it is being reviewed, after all - but
   should not compete with the live rows for attention. */
.dimmed { opacity: .55; }

.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; justify-content: flex-end; }
.row-actions form { display: flex; gap: .3rem; align-items: center; margin: 0; }

.btn.danger { border-color: #7a3030; color: #e58d8d; }
.btn.danger:hover { background: #7a3030; color: #fff; }

.reason {
  width: 8rem;
  padding: .35rem .5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-inset, #0c0e12);
  color: var(--text);
  font-size: .85rem;
}

.notice {
  padding: .9rem 1.1rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg-raised);
  margin-bottom: 1.5rem;
}

.notice.error { border-left-color: #e06c6c; }

.token { font-size: 1.05rem; padding: .6rem 0; word-break: break-all; }

.tag {
  display: inline-block;
  padding: .05rem .4rem;
  margin-left: .35rem;
  border-radius: 4px;
  background: var(--border);
  color: var(--muted);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.small { font-size: .85em; }
.mono { font-family: var(--mono); }

/* ---------------------------------------------------------------- forms */

.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.view-head h1 { margin-bottom: .25rem; }

.form { max-width: 34rem; display: flex; flex-direction: column; gap: .35rem; }
.form label { margin-top: .9rem; font-size: .9rem; }

.form input[type="text"], .form input[type="url"], .form input:not([type]),
.form textarea, .form select, .form input[type="file"] {
  width: 100%;
  padding: .5rem .6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-raised);
  color: var(--text);
  font: inherit;
}

.form textarea { font-family: var(--mono); font-size: .85rem; resize: vertical; }
.dialog-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.5rem; }

/* A SHA-256 is 64 characters and nobody reads it; they copy it or compare the ends. Truncated
   with the full value available on hover and on copy. */
.hash { display: inline-block; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

.description { white-space: pre-wrap; font-family: var(--sans); margin: 0; }

.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }

/* ---- a server's player-count graph -------------------------------------------------- */

/* Position is for the tooltip, which is absolutely placed against this. */
.chart-wrap { position: relative; margin: 0 0 1.5rem; }

.chart { width: 100%; height: auto; display: block; overflow: visible; }

/* Recessive: the grid is there to be measured against, not read. */
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--sans); }

/* A wash rather than a block - the line carries the value, the fill carries the shape. */
.chart .area { fill: var(--accent); fill-opacity: .1; stroke: none; }

.chart .line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* Ringed in the surface colour so it reads as a marker on the line rather than a kink in it. */
.chart .end { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.chart .focus { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }

.chart-tip {
  position: absolute;
  top: -.25rem;
  transform: translateX(-50%);
  padding: .3rem .55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-raised);
  color: var(--text);
  font-size: .8rem;
  white-space: nowrap;
  pointer-events: none;
}

.chart-data { margin-bottom: 2rem; }
.chart-data summary { cursor: pointer; }
.chart-data .table { margin-top: .75rem; }

/* Where something belongs but has not been written yet. A missing section reads as a site
   that has no room for it; an empty box reads as a space waiting to be filled. */
.empty-box {
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.5rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-box p { margin: 0; }

/* The claim invitation sits above the statistics, so it is wide and short rather than a
   block of text with a button underneath it. */
.notice.claim {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.notice.claim p { margin: .2rem 0 0; }
.notice.claim form { margin: 0; }

/* ---- server list: tags, filters, pages ----------------------------------------------- */

/* Deliberately not .tag: that one is the offline badge, and a shared class here is how an
   unrelated style change silently restyles something else. */
.chip {
  display: inline-block;
  padding: .05rem .4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .02em;
}

.chip:hover { color: var(--text); border-color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }

.filters { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1.25rem 0; }

.tag-link {
  padding: .25rem .65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: .82rem;
}

.tag-link:hover { color: var(--text); }
.tag-link.active { color: var(--text); border-color: var(--accent); background: var(--bg-raised); }

.pager { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin: 0 0 1rem; }

.pager a, .pager span {
  min-width: 2.1rem;
  padding: .35rem .6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: center;
  font-size: .9rem;
}

.pager a:hover { border-color: var(--accent); }
.pager .here { border-color: var(--accent); background: var(--bg-raised); color: var(--text); }

/* The rank and the counts are short and should stay on one line; the name column takes
   whatever is left. */
.table.servers td:first-child { width: 3rem; }
.table.servers td:nth-child(3), .table.servers td:nth-child(4) { width: 5rem; white-space: nowrap; }

/* The description line on a list row. Capped so one owner cannot write three paragraphs and
   push every other server off the screen; the full text is on their own page. */
.blurb {
  margin-top: .25rem;
  max-width: 62ch;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

/* Facts the site derived rather than words the owner wrote. Dimmer, so a real description
   stands out against the rows that are still waiting for one. */
.blurb.unwritten { opacity: .72; }

/* ---- online / offline --------------------------------------------------------------- */

/*
 * A coloured dot and the word, always both.
 *
 * Green against red measures a colour difference of about 3 to a deuteranope - which is to
 * say none at all - and green against grey is still a guess at a glance. The dot is
 * reinforcement; the word is the information. Hence no CSS that hides the label at any
 * width, and aria-hidden on the dot so a screen reader hears the word once.
 */
.status {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-left: .5rem;
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--muted);
  vertical-align: middle;
}

.status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

/* Checked against the page background: 3:1 or better, and inside the lightness band the
   rest of the palette sits in. */
.status.on .dot { background: #2ea043; box-shadow: 0 0 6px rgba(46, 160, 67, .55); }

/* Grey rather than red. A server being off is not a fault, and a red dot on two thirds of
   the list would make the page look broken rather than quiet. */
.status.off .dot { background: var(--muted); opacity: .6; box-shadow: none; }

h1 .status { font-size: .6em; }

/* ---- search and sort ----------------------------------------------------------------- */

.listbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  margin: 1.25rem 0 0;
}

.listbar input[type="search"] {
  flex: 1 1 18rem;
  min-width: 0;
  padding: .45rem .7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-raised);
  color: var(--text);
  font: inherit;
}

.listbar input[type="search"]:focus,
.listbar select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.listbar label { display: flex; align-items: center; gap: .4rem; }

.listbar select {
  padding: .45rem .6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-raised);
  color: var(--text);
  font: inherit;
}

/* ---- admin analytics ------------------------------------------------------------------ */

/* Two columns where there is room, one where there is not. The tallies are independent of
   each other, so they can wrap in any order without losing meaning. */
.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 0 2rem;
}

.columns section { min-width: 0; }

/* The bar sits behind the label rather than in a column of its own: the shape is what is
   being read, and a number beside a number is harder work than a shape. */
.table.tally td { position: relative; }
.table.tally td:first-child { overflow: hidden; }

.table.tally .bar {
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 2px;
  background: var(--accent);
  opacity: .14;
  border-radius: 3px;
  pointer-events: none;
}

.table.tally .count { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table.tally td span.mono { position: relative; word-break: break-all; }
