/* The site's system: tokens, controls, the header and footer, dialogs, messages. Dark and quiet,
   one gold accent (the in-game manager's), Archivo for headings, the Windows UI face for text, and
   a monospace only for keys, codes and versions. Page layouts: site.css; the admin tables:
   admin.css. */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("../fonts/archivo-latin.woff2") format("woff2");
}

:root {
  color-scheme: dark;

  --bg: oklch(0.155 0.006 255);
  --surface: oklch(0.19 0.007 255);
  --raised: oklch(0.235 0.009 255);
  --raised-hover: oklch(0.27 0.01 255);
  --line: oklch(0.3 0.01 255);
  --line-soft: oklch(0.24 0.008 255);

  --text: oklch(0.94 0.004 255);
  --text-2: oklch(0.79 0.008 255);
  --text-3: oklch(0.66 0.01 255);

  --accent: oklch(0.8 0.12 78);
  --accent-hover: oklch(0.85 0.115 80);
  --accent-ink: oklch(0.22 0.035 75);

  --good: oklch(0.77 0.14 152);
  --bad: oklch(0.7 0.16 24);
  --bad-text: oklch(0.78 0.12 24);
  --info: oklch(0.76 0.09 245);
  --warn: oklch(0.8 0.12 70);

  --display: "Archivo", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, ui-monospace, monospace;
  --radius: 6px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --page: 1120px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

::selection { background: color-mix(in oklab, var(--accent) 34%, transparent); color: var(--text); }

* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

input, button, textarea, select { font: inherit; color: inherit; }

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

h1, h2, h3, p { margin: 0; }

h1, h2, h3 {
  font-family: var(--display);
  font-stretch: 112%;
  font-weight: 650;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

a { color: var(--text); text-decoration-color: var(--text-3); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }

code, .mono {
  font-family: var(--mono);
  font-size: 0.92em;
  font-variant-ligatures: none;
}

kbd {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--raised);
  color: var(--text);
  font: 600 0.8em/1.55 var(--font);
  vertical-align: 0.08em;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.page { width: min(var(--page), 100% - 48px); margin-inline: auto; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--raised);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms, border-color 120ms, color 120ms;
}
.btn:hover { background: var(--raised-hover); }
.btn:active { background: var(--surface); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; background: var(--raised); }
.btn[aria-pressed="true"] { background: var(--raised-hover); border-color: var(--text-3); }

.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; font-weight: 600; }
.btn-block { width: 100%; }
.btn-icon { width: 30px; padding: 0; }

.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent); }
.btn-primary:disabled { background: var(--accent); }

.btn-danger {
  background: color-mix(in oklab, var(--bad) 22%, var(--surface));
  border-color: color-mix(in oklab, var(--bad) 55%, transparent);
  color: var(--bad-text);
}
.btn-danger:hover { background: color-mix(in oklab, var(--bad) 32%, var(--surface)); }
.btn-danger:disabled { background: color-mix(in oklab, var(--bad) 22%, var(--surface)); }

.btn-danger-quiet { color: var(--bad-text); }
.btn-danger-quiet:hover { border-color: color-mix(in oklab, var(--bad) 55%, transparent); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--raised); color: var(--text); }
.btn-ghost:disabled { background: transparent; }

.btn-copy { min-width: 64px; }

.btn .chevron { transition: transform 160ms var(--ease-out); }
.btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }

[aria-busy="true"], [aria-busy="true"] .btn { cursor: progress; }

/* Fields ------------------------------------------------------------------------------------ */

input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input[type="datetime-local"] {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  caret-color: var(--accent);
  transition: border-color 120ms, box-shadow 120ms;
}
input:hover { border-color: oklch(0.36 0.01 255); }
input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent);
}
input::placeholder { color: var(--text-3); }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 1px 0 0; }

.field {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}
.field legend { padding: 0; margin-bottom: 6px; }
.field-hint { color: var(--text-3); font-weight: 400; }
.field input { font-weight: 400; }
.field-hint.block { display: block; margin-top: 1px; font-size: 12.5px; }

/* Messages and chips ------------------------------------------------------------------------ */

.message { font-size: 13.5px; color: var(--text-2); }
.message.is-error { color: var(--bad-text); }
.message.is-ok { color: var(--good); }
.message.is-notice { color: var(--warn); }

.message.boxed {
  padding: 9px 12px;
  border: 1px solid color-mix(in oklab, currentColor 30%, transparent);
  border-radius: var(--radius);
  background: color-mix(in oklab, currentColor 8%, transparent);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.chip {
  --c: var(--text-3);
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 9px;
  border-radius: 11px;
  background: color-mix(in oklab, var(--c) 15%, transparent);
  color: var(--c);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.chip-active { --c: var(--good); }
.chip-unused { --c: var(--info); }
.chip-expired { --c: var(--text-3); }
.chip-revoked { --c: var(--bad-text); }
.chip-other { --c: var(--warn); }

/* Header and footer ------------------------------------------------------------------------- */

.site-header { border-bottom: 1px solid var(--line-soft); background: var(--bg); }
.site-header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  width: min(var(--page), 100% - 48px);
  height: 60px;
  margin-inline: auto;
}
.site-header.is-wide .site-header-inner { width: auto; margin-inline: 20px; }

.brand {
  color: var(--text);
  font-family: var(--display);
  font-size: 16px;
  font-stretch: 118%;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.brand-quiet { color: var(--text-2); font-size: 14px; }

.site-nav { display: flex; gap: 20px; }
.site-nav a, .nav-link {
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: color 120ms;
}
.site-nav a:hover, .nav-link:hover { color: var(--text); }
.nav-link[aria-current="page"] { color: var(--text); text-decoration: underline 2px var(--accent); text-underline-offset: 8px; }

.site-user { display: flex; align-items: center; gap: 16px; margin-left: auto; min-width: 0; }
.user-email { overflow: hidden; color: var(--text-3); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }

.site-footer { margin-top: 96px; border-top: 1px solid var(--line-soft); color: var(--text-3); font-size: 13px; }
.site-footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 24px 0 32px; }
.site-footer a { color: var(--text-2); }

/* Dialog ------------------------------------------------------------------------------------ */

.dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}
.dialog::backdrop { background: oklch(0.08 0.01 255 / 0.66); }
.dialog[open] { animation: dialog-in 200ms var(--ease-out); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.985); } }

.dialog-body { display: grid; gap: 16px; padding: 20px 22px 22px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-body h2 { font-size: 24px; }
.dialog-text { color: var(--text-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }

/* Account form ------------------------------------------------------------------------------ */

.auth-form { display: grid; gap: 14px; }
.auth-intro { color: var(--text-2); font-size: 14px; }

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--bg);
}
.auth-switch-option {
  height: 32px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 120ms, color 120ms;
}
.auth-switch-option:hover { color: var(--text); }
.auth-switch-option[aria-pressed="true"] { background: var(--raised); color: var(--text); }

@media (max-width: 720px) {
  .site-header-inner { flex-wrap: wrap; gap: 8px 16px; height: auto; padding: 12px 0; }
  .site-header.is-wide .site-header-inner { margin-inline: 12px; }
  .site-nav { display: none; }
  .site-user { gap: 10px; }
}

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