/*
  riseofkd.com — the design system, in one file.

  Extracted from design/prototype/Kingdom SaaS Flow.dc.html so that the eight
  screens in that prototype don't drift apart as they get built. Serves both
  layouts: a kingdom's own site (layouts/kingdom) and the platform chrome
  around it (layouts/platform).

  Every colour is a var() filled by App\Support\KingdomTheme from
  config/platform.php, so a kingdom's chosen palette reaches the whole page
  rather than just its header — and the platform pages, which are never
  themed, get the same tokens from a fixed :root block.

  Three rules when adding to this file:
   - never hardcode a colour, always a token;
   - keep the class vocabulary small — reuse a name before inventing one;
   - a component only one page uses belongs in that page, not here.

  Served static: this repo has no build step, and one <link> needs none.
*/

/* ---------- Reset ---------- */

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

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

body {
  min-height: 100vh;
  padding-bottom: 64px;
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg-bottom);
  background-image: radial-gradient(1200px 700px at 50% -10%, var(--bg-top), var(--bg-bottom));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; height: auto; }

::selection { background: var(--accent-tint); }

/* ---------- Typography ----------

   Monospace is load-bearing in this design: every label, ID, timestamp, metric
   and status pill is mono, and it is the strongest single signal of the look.
   Numbers are tabular everywhere they are compared down a column. */

/* Note .meta is NOT here: it carries explanatory sentences, and a paragraph
   set in mono is markedly harder to read than the same words in the body face. */
.mono, .kd, .label, .pill, .rid, .badge, thead th, td.num, .pager {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

table, td, .value, .num { font-variant-numeric: tabular-nums; }

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.025em; font-weight: 600; color: var(--ink-strong); }
h1 { font-size: clamp(24px, 5vw, 32px); }
h2 { font-size: 20px; }
h3 { font-size: 17px; }

/* The kingdom number over its name — KD2070. */
.kd, .brand {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-soft);
  font-weight: 600;
}

.brand a { color: inherit; }

.meta, .hint, .sub { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.hint { margin-top: 6px; }
.sub { margin-top: 3px; }

.tagline { margin-top: 6px; font-size: 13px; color: var(--muted); letter-spacing: 0.04em; }

.dim { color: var(--ink-dim); }
.faint { color: var(--ink-faint); }

/* ---------- Layout ---------- */

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* Platform pages are forms and lists, not dashboards — they read better narrow. */
.layout-platform .wrap { max-width: 780px; }

header { border-bottom: 1px solid var(--line); margin-bottom: 28px; }
header .wrap { padding-top: 22px; padding-bottom: 16px; }

.layout-platform header .wrap {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.titlebar { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.spacer { flex: 1; min-width: 10px; }

.row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.row .spacer { flex: 1; min-width: 20px; }

/* A heading with something aligned opposite it — a count, a "view all". */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-top: 1px solid var(--line);
  padding-top: 32px;
}

.section-head:first-child { border-top: 0; padding-top: 0; }

/* ---------- Navigation ---------- */

nav { margin-top: 18px; display: flex; gap: 4px; flex-wrap: wrap; }

nav a {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-dim);
}

nav a:hover { color: var(--ink); background: var(--panel); }

nav a[aria-current="page"] {
  color: var(--ink-strong);
  background: var(--panel-raised);
  font-weight: 600;
}

/* ---------- Cards ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 17px 19px;
  margin-bottom: 12px;
}

.card h2 { font-size: 17px; }

/* A grid of metric tiles. */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}

.cards .card { margin-bottom: 0; }

.card .label {
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.card .value {
  margin-top: 8px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink-strong);
}

/* A card that leads the page: the active event, the KvK assignment. */
.card-feature {
  border-color: var(--accent);
  background: linear-gradient(160deg, var(--panel-raised), var(--panel));
}

/* ---------- Tables ---------- */

.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
}

table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 780px; }

th, td { padding: 11px 13px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2) { text-align: left; }

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--line);
}

tbody tr { border-bottom: 1px solid var(--line-soft); }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: var(--panel-raised); }

/* The signed-in governor's own row. */
tbody tr.is-you { background: var(--accent-tint); }
tbody tr.is-you td:first-child { font-weight: 600; }

.gov { display: flex; align-items: center; gap: 9px; }
.gov img { width: 26px; height: 26px; border-radius: 50%; flex: none; background: var(--surface); }
.rid { color: var(--ink-faint); font-size: 11.5px; }

/* ---------- Status pills ----------

   text + fill + border. Never colour alone — the label carries the meaning for
   anyone who cannot separate the hues. */

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.pill-ok      { color: var(--ok);      background: var(--ok-tint);      border-color: var(--ok-line); }
.pill-warn    { color: var(--warn);    background: var(--warn-tint);    border-color: var(--warn-line); }
.pill-bad     { color: var(--bad);     background: var(--bad-tint);     border-color: var(--bad-line); }
.pill-neutral { color: var(--neutral); background: var(--neutral-tint); border-color: var(--neutral-line); }
.pill-accent  { color: var(--accent);  background: var(--accent-tint);  border-color: var(--accent); }

.badge {
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--accent-soft);
}

.badge.owner {
  color: var(--ink-on-accent);
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------- Progress ---------- */

.bar {
  height: 5px;
  margin-top: 6px;
  border-radius: 3px;
  background: var(--panel-raised);
  overflow: hidden;
}

.bar > span { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.bar-ok > span   { background: var(--ok); }
.bar-warn > span { background: var(--warn); }
.bar-bad > span  { background: var(--bad); }

/* ---------- Buttons ---------- */

.btn, .joinbtn {
  display: inline-block;
  padding: 11px 19px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: var(--ink-on-accent);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover, .joinbtn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--ink-on-accent);
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.btn.ghost:hover { background: var(--panel-raised); color: var(--ink-strong); border-color: var(--accent); }

.btn.small { padding: 7px 13px; font-size: 12.5px; border-radius: 8px; }

.linkbtn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent-soft);
  cursor: pointer;
  text-decoration: underline;
}

a.action { color: var(--accent-soft); font-size: 14px; font-weight: 600; }
a.action:hover { color: var(--ink-strong); }

/* ---------- Forms ---------- */

label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
  margin-bottom: 6px;
}

.field { margin-bottom: 18px; }

input[type=text], input[type=search], input[type=number], input[type=url],
input[type=email], select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 14.5px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

textarea { min-height: 90px; resize: vertical; }

::placeholder { color: var(--ink-faint); }

.err { color: var(--bad); font-size: 13px; margin-top: 6px; }

.searchbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.searchbar input { flex: 1 1 260px; }

/* A bare <button> in a search form gets the primary treatment without needing
   a class — the markup is a plain form and should stay that way. */
.searchbar button {
  padding: 11px 19px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: var(--ink-on-accent);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
}

.searchbar button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* A field with a fixed suffix: the slug, with .riseofkd.com after it. */
.slugline { display: flex; align-items: stretch; }
.slugline input { border-top-right-radius: 0; border-bottom-right-radius: 0; }

.slugline .suffix {
  display: flex;
  align-items: center;
  padding: 0 13px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13.5px;
  color: var(--muted);
  white-space: nowrap;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 10px 10px 0;
  background: var(--panel-raised);
}

/* Theme picker in the Site editor. */
.themes { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.theme input { position: absolute; opacity: 0; pointer-events: none; }

.theme span {
  display: block;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.theme input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme input:focus-visible + span { outline: 2px solid var(--accent-soft); outline-offset: 2px; }

.swatch { display: block; height: 26px; border-radius: 7px; margin-bottom: 8px; }

/* ---------- Notices ---------- */

.flash, .announce {
  padding: 11px 15px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--panel);
  font-size: 14px;
}

.flash.bad { border-left-color: var(--bad); color: var(--bad); }

/* Nothing to show yet — an empty roster, a season with no scans. */
.empty { padding: 40px 20px; text-align: center; color: var(--ink-faint); font-size: 14px; }

/* ---------- Pagination ---------- */

.pager { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }

.pager a, .pager span {
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.pager a:hover { color: var(--ink-strong); border-color: var(--accent); }

.pager .active {
  background: var(--accent);
  color: var(--ink-on-accent);
  border-color: var(--accent);
  font-weight: 600;
}

/* ---------- Identity ---------- */

.who { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 9px; }
.who img { width: 26px; height: 26px; border-radius: 50%; background: var(--surface); }

/* ---------- Footer ---------- */

footer {
  margin-top: 34px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-faint);
}

footer a { color: var(--muted); }

/* ---------- Small screens ----------
   Governors read these pages on a phone, between rallies. */

@media (max-width: 640px) {
  header .wrap { padding-top: 18px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 6px; padding-top: 24px; }
  .card .value { font-size: 22px; }
  th, td { padding: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Kingdom site chrome ----------
   The bar above a kingdom's own header, and the header itself. A visitor
   landing from a Discord link should be able to tell whose site this is and
   what it runs on without scrolling. */

.platbar { background: var(--surface); border-bottom: 1px solid var(--line-soft); }

.platbar .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-top: 7px; padding-bottom: 7px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px; letter-spacing: 0.06em; color: var(--ink-faint);
  text-transform: uppercase;
}

.platbar a { color: var(--ink-faint); }
.platbar a:hover { color: var(--muted); }

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg-top) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}

.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  padding-top: 14px; padding-bottom: 14px;
}

.brandblock { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brandblock .name { display: block; font-weight: 600; font-size: 15px; letter-spacing: -0.015em; color: var(--ink-strong); }
.brandblock .kd { display: block; margin-top: 2px; }

.crest {
  width: 34px; height: 34px; flex: none; border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel-raised);
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px; color: var(--ink-faint); letter-spacing: 0.04em;
}

/* ---------- Kingdom hero ---------- */

.hero { border-bottom: 1px solid var(--line); background: var(--panel); }

.hero .wrap {
  display: grid; grid-template-columns: 1.25fr 1fr; gap: 56px; align-items: center;
  padding-top: 76px; padding-bottom: 76px;
}

.hero h1 {
  font-size: clamp(34px, 6vw, 58px); line-height: 1.05; letter-spacing: -0.035em;
  font-weight: 600; margin: 22px 0 0;
}

.hero p { max-width: 520px; margin: 20px 0 0; font-size: 16.5px; line-height: 1.65; color: var(--muted); }
.hero .cta { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.hero .cta .btn { padding: 14px 26px; font-size: 15px; border-radius: 11px; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--panel-raised);
  border-radius: 999px; padding: 6px 13px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em;
}

.hero-badge i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; }

/* At a glance: the panel beside the hero. */
.glance { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.glance .label { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }

.glance-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--line-soft);
}

.glance-row:last-child { border-bottom: 0; }
.glance-row span { font-size: 13.5px; color: var(--muted); }
.glance-row b {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 15px; font-weight: 600; color: var(--ink-strong);
}

/* Two-column body: a leaderboard beside a requirements card. */
.split { display: grid; grid-template-columns: 1.5fr 1fr; gap: 32px; align-items: start; }

.reqlist { display: flex; flex-direction: column; gap: 11px; margin-top: 18px; }
.reqlist div { display: flex; gap: 11px; align-items: flex-start; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.reqlist b { color: var(--ok); font-weight: 600; flex: none; }

@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 32px; padding-top: 48px; padding-bottom: 48px; }
  .split { grid-template-columns: 1fr; gap: 24px; }
  .site-header .wrap { gap: 12px; }
}
