/* X-Gate website: AEX Tactical Command look. Graphite and silver carry the
   page; cyan marks focus, selection and branding; green positive actions;
   muted gold small rank-like accents; orange sparingly for cautions.
   Fonts are bundled under the SIL Open Font License (assets/fonts). */

@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/Archivo-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/Archivo-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Rajdhani";
  src: url("/assets/fonts/Rajdhani-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Oxanium";
  src: url("/assets/fonts/Oxanium-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #111214;
  --panel: #191b1e;
  --well: #141518;
  --raised: #202328;
  --raised-hover: #282c32;
  --text: #e3e5e8;
  --silver: #b9bec5;
  --muted: #9097a0;
  --line: #2c3036;
  --line-2: #3d434b;
  --cyan: #51caff;
  --cyan-soft: rgba(81, 202, 255, 0.12);
  --green: #9bca78;
  --green-soft: rgba(155, 202, 120, 0.12);
  --gold: #c3b17b;
  --orange: #d29a56;
  --orange-soft: rgba(210, 154, 86, 0.12);
  --red: #e08a7f;
  --red-soft: rgba(224, 138, 127, 0.12);
  --radius-control: 2px;
  --radius-panel: 4px;
  --heading: "Rajdhani", "Arial Narrow", ui-sans-serif, sans-serif;
  --action: "Oxanium", ui-sans-serif, system-ui, sans-serif;
  --body: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--body);
}

a { color: var(--cyan); }
a:hover { color: #8ddcff; }

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

h1, h2, h3 {
  font-family: var(--heading);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
  margin: 0 0 12px;
}
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; margin-top: 20px; color: var(--silver); }
p { margin: 0 0 12px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip { position: absolute; left: -999px; top: 8px; }
.skip:focus { left: 16px; z-index: 10; background: var(--panel); color: var(--text); padding: 6px 10px; }

.muted { color: var(--muted); }
.link { color: var(--cyan); }
.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font-family: var(--action);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------- header */

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  padding: 10px var(--gutter);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}
.brand-mark { height: 32px; width: auto; display: block; }
.brand-gate {
  font-family: var(--action);
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  padding-left: 12px;
  border-left: 1px solid var(--line-2);
}

.find {
  display: flex;
  gap: 6px;
  flex: 1 1 220px;
  max-width: 340px;
}
.find input { flex: 1; min-width: 0; }

.account {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}
.who:hover { color: var(--cyan); }
.who-alias {
  font-weight: 600;
  max-width: 16ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- layout */

main {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px var(--gutter) 48px;
}
main:focus { outline: none; }
h1[tabindex="-1"]:focus { outline: none; }

.page-title { margin-bottom: 16px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  padding: 18px 20px;
  margin-bottom: 16px;
  min-width: 0;
}
.panel-title {
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--silver);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.columns > .panel { margin-bottom: 0; }
.columns + .panel { margin-top: 16px; }

.rule { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

.foot {
  padding: 16px var(--gutter) 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
.foot p { margin: 4px 0; }
.foot a { color: var(--silver); }

/* ---------------------------------------------------------------- controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
  font: 400 0.9rem/1 var(--action);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--raised-hover); border-color: var(--silver); color: var(--text); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn:disabled:hover { background: var(--raised); border-color: var(--line-2); }

.btn-primary { border-color: var(--cyan); color: var(--cyan); background: var(--cyan-soft); }
.btn-primary:hover { background: rgba(81, 202, 255, 0.22); border-color: var(--cyan); color: #c9efff; }
.btn-go { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.btn-go:hover { background: rgba(155, 202, 120, 0.22); border-color: var(--green); color: #d6ecc6; }
.btn-go:disabled:hover { background: var(--green-soft); border-color: var(--green); }
.btn-warn { border-color: var(--orange); color: var(--orange); background: var(--orange-soft); }
.btn-warn:hover { background: rgba(210, 154, 86, 0.22); border-color: var(--orange); color: #f0cfa6; }
.btn-quiet { background: transparent; }
.btn-small { min-height: 30px; padding: 4px 12px; font-size: 0.8rem; }
.btn-large { min-height: 44px; padding: 8px 32px; font-size: 1rem; }

input, select, textarea {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-control);
  background: var(--well);
  color: var(--text);
  font: inherit;
}
textarea { resize: vertical; min-height: 64px; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 0;
  border-color: var(--cyan);
}
input[aria-invalid="true"] { border-color: var(--orange); }
input[type="radio"] { width: auto; min-height: 0; accent-color: var(--cyan); }
input[type="search"]::-webkit-search-cancel-button { filter: invert(0.7); }

.form { display: grid; gap: 6px; }
.form label, .dialog-body > label { font-weight: 600; margin-top: 6px; }
.form-actions { display: flex; gap: 8px; margin-top: 6px; }
.form-result:empty { display: none; }
.form-result { margin-top: 8px; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0; }
.field-check { min-height: 0; margin: 0; font-size: 0.85rem; }
.field-check:empty { display: none; }
.field-check.bad { color: var(--orange); }
.counter { text-align: right; font-variant-numeric: tabular-nums; }
.counter.near { color: var(--orange); }

.choices { border: 0; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.choices legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.choice { display: flex; align-items: center; gap: 8px; cursor: pointer; }

/* ---------------------------------------------------------------- notices and states */

.notice {
  padding: 8px 12px;
  border: 1px solid var(--line-2);
  border-left-width: 3px;
  border-radius: var(--radius-control);
  background: var(--well);
  margin: 0 0 12px;
}
.notice-good { border-color: var(--green); background: var(--green-soft); }
.notice-bad { border-color: var(--red); background: var(--red-soft); }
.notice-warn { border-color: var(--orange); background: var(--orange-soft); }
.notice-info { border-color: var(--cyan); background: var(--cyan-soft); }

.state { padding: 24px 0; max-width: 640px; }
.state-unavailable, .state-empty { color: var(--silver); }
.panel .state { padding: 8px 0; }

.loading { padding: 24px 0; color: var(--muted); }
.spinner { display: inline-flex; align-items: center; gap: 10px; }
.spinner-ring {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line-2);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner-ring { animation-duration: 2.4s; }
}

.badge {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid currentColor;
  border-radius: var(--radius-control);
  font-family: var(--action);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.badge-good { color: var(--green); }
.badge-bad { color: var(--red); }
.badge-warn { color: var(--orange); }

/* ---------------------------------------------------------------- signed out */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  padding: 24px 0;
}
.hero h1 { font-size: clamp(2.6rem, 7vw, 4.2rem); letter-spacing: 0.06em; text-transform: uppercase; }
.lede { font-size: 1.1rem; color: var(--silver); max-width: 56ch; }
.hero-actions { margin: 20px 0 12px; }
.hero-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.hero-points li {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 2px solid var(--gold);
  border-radius: var(--radius-panel);
}
.hero-points strong { font-family: var(--heading); font-size: 1.1rem; letter-spacing: 0.03em; }
.hero-points span { color: var(--silver); font-size: 0.92rem; }

/* ---------------------------------------------------------------- profile */

.avatar {
  display: block;
  flex: none;
  object-fit: cover;
  background: var(--well);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-control);
}
.avatar-large { width: 256px; height: 256px; }
.avatar-medium { width: 64px; height: 64px; }
.who .avatar { width: 32px; height: 32px; }
.avatar-blank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: var(--heading);
  font-size: 1.1rem;
}
.avatar-large.avatar-blank { font-size: 6rem; }

.profile-card {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.profile-card-text { min-width: 0; flex: 1; }
.profile-alias {
  font-family: var(--heading);
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  line-height: 1.1;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}
.profile-country { color: var(--silver); margin-bottom: 8px; }
.profile-about { overflow-wrap: anywhere; max-width: 60ch; }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.past-aliases { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.past-alias { font-weight: 600; }

/* ---------------------------------------------------------------- avatar picker */

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.preset {
  aspect-ratio: 1;
  padding: 4px;
  background: var(--well);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-control);
  cursor: pointer;
}
.preset img { width: 100%; height: 100%; display: block; }
.preset:hover { border-color: var(--silver); }
.preset[aria-pressed="true"] {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan);
  background: var(--cyan-soft);
}
.preset:disabled { opacity: 0.5; cursor: wait; }

.avatar-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.avatar-actions .btn[aria-pressed="true"] { border-color: var(--cyan); color: var(--cyan); }
.file-input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  overflow: hidden;
}
.file-input:focus-visible + .file-label { outline: 2px solid var(--cyan); outline-offset: 2px; }
.file-input:disabled + .file-label { opacity: 0.45; cursor: not-allowed; }

/* ---------------------------------------------------------------- licence */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 0 0 12px;
}
.facts div { background: var(--well); border: 1px solid var(--line); border-radius: var(--radius-control); padding: 8px 12px; }
.facts dt { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }
.facts dd { margin: 2px 0 0; font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; margin-bottom: 10px; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table thead th { color: var(--muted); font-weight: 400; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }
.table tbody th { font-weight: 600; }
.cell-sub { display: block; color: var(--muted); font-weight: 400; font-size: 0.82rem; }
.cell-action { text-align: right; }

/* ---------------------------------------------------------------- dialogs */

.dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 0;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-panel);
}
.dialog::backdrop { background: rgba(5, 6, 8, 0.7); }
.dialog-body { display: grid; gap: 6px; padding: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- narrow screens */

@media (max-width: 860px) {
  .columns { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .top { gap: 10px; }
  .find { order: 3; flex-basis: 100%; max-width: none; }
  .who-alias { max-width: 10ch; }
  .panel { padding: 14px 16px; }
  .profile-card { flex-direction: column; align-items: center; text-align: center; }
  .profile-card .avatar-large { width: min(256px, 100%); height: auto; aspect-ratio: 1; }
  .profile-actions { justify-content: center; }
  .profile-about { margin-left: auto; margin-right: auto; }

  /* The computers table becomes one card per computer. */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table th, .table td { display: block; width: 100%; }
  .table tr { border: 1px solid var(--line); border-radius: var(--radius-control); margin-bottom: 8px; padding: 6px 0; }
  .table th, .table td { border: 0; padding: 4px 12px; }
  .table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
  .cell-action { text-align: left; }
  .cell-action .btn { width: 100%; }
  .dialog-actions .btn { flex: 1; }
}
