/* tjterminal.com: status page with the connection test (Step 1).
   Colours: lapis ink for the ground, gold for measured values, stone for text.
   System fonts only: the page must be small and must show Tajik letters on every device. */

:root {
  --ink: #0c1a30;
  --ink-raised: #13243f;
  --rule: #26395a;
  --stone: #e6eaf1;
  --stone-dim: #93a1b8;
  --gold: #f0b23a;
  --good: #63c990;
  --poor: #ef6a55;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  background: var(--ink);
  color: var(--stone);
  font-family: var(--sans);
  font-size: 100%;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0 auto;
  max-width: 44rem;
  padding: 1.25rem 1.25rem 3rem;
}

h1, h2, p, dl, dd, dt { margin: 0; }

/* ---- top ---- */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}
.name { font-size: 1.125rem; font-weight: 700; letter-spacing: 0.01em; }
.tagline { color: var(--stone-dim); font-size: 0.9375rem; }

.langs { display: flex; gap: 0.25rem; }
.lang {
  font: inherit;
  font-size: 0.9375rem;
  color: var(--stone-dim);
  background: none;
  border: 1px solid transparent;
  border-radius: 2px;
  padding: 0.3125rem 0.625rem;
  min-height: 2.5rem;
  cursor: pointer;
}
.lang:hover { color: var(--stone); }
.lang[aria-pressed="true"] { color: var(--ink); background: var(--stone); }

/* ---- test ---- */
main { padding-top: 2rem; }
h1 { font-size: 1.75rem; line-height: 1.2; font-weight: 700; }
.lead { margin-top: 0.625rem; color: var(--stone-dim); max-width: 36rem; }

.line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2rem;
  font-size: 0.875rem;
  color: var(--stone-dim);
}
.node { display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
.dot { width: 0.625rem; height: 0.625rem; background: var(--stone); display: inline-block; }
.wire { position: relative; flex: 1 1 4rem; height: 2px; background: var(--rule); overflow: hidden; }
.wire-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 100%;
  background: var(--gold);
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
  transition: transform 0.25s linear;
}
.is-running .wire-fill { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }

.readouts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 1.25rem;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.readout { background: var(--ink-raised); padding: 0.875rem 1rem 1rem; }
.readout dt { font-size: 0.875rem; color: var(--stone-dim); }
.readout dd { margin-top: 0.125rem; white-space: nowrap; }
.value {
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 600;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.value-text { font-size: 1.375rem; line-height: 1.7; }
.unit { font-size: 0.875rem; color: var(--stone-dim); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-top: 1.5rem; }
.start, .send {
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--gold);
  border: 0;
  border-radius: 2px;
  padding: 0.75rem 1.5rem;
  min-height: 3rem;
  cursor: pointer;
}
.start:hover, .send:hover { background: #ffc85a; }
.start:disabled, .send:disabled { background: var(--rule); color: var(--stone-dim); cursor: default; }
.phase { color: var(--stone-dim); min-height: 1.5rem; }

.verdict {
  margin-top: 1.5rem;
  padding: 0.875rem 1rem;
  border-left: 4px solid var(--stone-dim);
  background: var(--ink-raised);
  font-size: 1.0625rem;
}
.verdict.is-good { border-left-color: var(--good); }
.verdict.is-ok { border-left-color: var(--gold); }
.verdict.is-poor { border-left-color: var(--poor); }

/* ---- result ---- */
.result { margin-top: 1.5rem; }
.result-line { font-variant-numeric: tabular-nums; }
.result-line strong { color: var(--gold); font-weight: 600; letter-spacing: 0.04em; white-space: nowrap; }
.result-text {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.625rem;
  font: 0.8125rem/1.4 ui-monospace, "Cascadia Mono", Consolas, "Roboto Mono", Menlo, monospace;
  color: var(--stone);
  background: var(--ink-raised);
  border: 1px solid var(--rule);
  border-radius: 2px;
  resize: vertical;
}
.about { margin-top: 1.75rem; }
h2 { font-size: 1.0625rem; font-weight: 600; }
.fields { display: grid; grid-template-columns: 1fr; gap: 0.75rem; margin-top: 0.75rem; align-items: end; }
.field { display: block; }
.field span { display: block; font-size: 0.875rem; color: var(--stone-dim); margin-bottom: 0.25rem; }
.field select, .field input {
  width: 100%;
  font: inherit;
  color: var(--stone);
  background: var(--ink-raised);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.625rem 0.75rem;
  min-height: 3rem;
}
.form-note { margin-top: 0.5rem; color: var(--stone-dim); min-height: 1.5rem; }

/* ---- details ---- */
.details { margin-top: 2rem; border-top: 1px solid var(--rule); padding-top: 0.75rem; }
.details summary { cursor: pointer; color: var(--stone-dim); padding: 0.375rem 0; }
.details summary:hover { color: var(--stone); }
.facts { width: 100%; border-collapse: collapse; margin-top: 0.5rem; font-size: 0.875rem; }
.facts th, .facts td { text-align: left; vertical-align: top; padding: 0.3125rem 0; border-bottom: 1px solid var(--rule); }
.facts th { width: 38%; padding-right: 1rem; font-weight: 400; color: var(--stone-dim); }
.facts td { word-break: break-word; font-variant-numeric: tabular-nums; }

.old { margin-top: 1.5rem; padding: 0.75rem 1rem; border: 1px solid var(--poor); color: var(--stone); }
.foot { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); color: var(--stone-dim); font-size: 0.875rem; max-width: 36rem; }

[hidden] { display: none !important; }

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

@media (min-width: 36rem) {
  body { padding: 2rem 2rem 4rem; }
  h1 { font-size: 2.125rem; }
  .readouts { grid-template-columns: repeat(4, 1fr); }
  .readouts.is-three { grid-template-columns: repeat(3, 1fr); }
  .fields { grid-template-columns: 1fr 1fr auto; }
}

@media (prefers-reduced-motion: reduce) {
  .wire-fill { transition: none; }
  .is-running .wire-fill { animation: none; }
}
