/*
 * Ghost Line terminal stylesheet: green on black, monospace, phone friendly.
 *
 * Offline only: no @import, no url(), no web fonts. The font stack names fonts that
 * are normally installed on the device and ends in the generic `monospace`.
 *
 * Color pairs (every one is at least 7:1 on the page background):
 *   --fg    #33ff33 on #000000   main text, borders, inverse-video buttons (black on green)
 *   --dim   #4dd24d on #000000   secondary text (time, empty note, disabled controls)
 *   --warn  #ffb000 on #000000   error region (also labelled "ERROR:" so color is not the only cue)
 *   --focus #ffff00 on #000000   keyboard focus outline
 */

:root {
  --bg: #000000;
  --fg: #33ff33;
  --dim: #4dd24d;
  --warn: #ffb000;
  --focus: #ffff00;
  --font: ui-monospace, "Cascadia Mono", "Cascadia Code", "SF Mono", Menlo, Consolas,
    "DejaVu Sans Mono", "Liberation Mono", "Courier New", monospace;
}

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

[hidden] {
  display: none !important;
}

html {
  font-size: 100%; /* 16px by default, and follows the user's own text-size setting */
  background: var(--bg);
}

body {
  margin: 0;
  padding: 12px;
  max-width: 80ch;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

h1,
h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: bold;
  text-transform: uppercase;
}

h1::before {
  content: "> ";
}

h2 {
  margin-top: 24px;
  padding-top: 8px;
  border-top: 2px dashed var(--fg);
}

p {
  margin: 0 0 12px;
}

/* ---- Connection_Indicator: the text says the state; border and prefix repeat it. ---- */

#connection {
  display: inline-block;
  padding: 0 8px;
  border: 2px solid var(--fg);
}

#connection[data-state="connected"]::before {
  content: "[+] ";
}

#connection[data-state="reconnecting"] {
  border-style: dashed;
  background: var(--fg);
  color: var(--bg);
  font-weight: bold;
}

#connection[data-state="reconnecting"]::before {
  content: "[!] ";
}

/* ---- Form and controls: every interactive control is at least 44 x 44 px. ---- */

label {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

#post-form label[for="handle"],
#post-form label[for="text"] {
  display: flex;
}

input[type="text"] {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid var(--fg);
  border-radius: 0;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}

input[type="checkbox"] {
  width: 44px;
  height: 44px;
  margin: 0 8px 0 0;
  vertical-align: middle;
  accent-color: var(--fg);
}

button {
  min-width: 44px;
  min-height: 44px;
  padding: 8px 24px;
  border: 2px solid var(--fg);
  border-radius: 0;
  background: var(--fg);
  color: var(--bg);
  font: inherit;
  font-weight: bold;
  cursor: pointer;
}

button:active:not(:disabled) {
  background: var(--bg);
  color: var(--fg);
}

button:disabled {
  border-style: dashed;
  background: var(--bg);
  color: var(--dim);
  cursor: not-allowed;
}

/* Visible keyboard focus on everything that can take it. */
a:focus,
input:focus,
button:focus,
select:focus,
textarea:focus,
[tabindex]:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---- Handle prompt: shown while the Handle is empty; the text carries the meaning. ---- */

#handle-prompt {
  padding: 8px 12px;
  border: 2px dashed var(--fg);
  font-weight: bold;
}

#handle-prompt::before {
  content: "[!] ";
}

/* ---- Error region: distinct frame and an ERROR label, shown only while it has text. ---- */

#error-region {
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 3px double var(--warn);
  color: var(--warn);
}
#error-region p {
  margin: 0 0 8px;
}
#error-region .error-label::after {
  content: ":";
}
#error-region button {
  border-color: var(--warn);
  background: var(--warn);
  color: var(--bg);
}

/* ---- Trusted-network notice: always visible and framed. ---- */
.notice {
  padding: 8px 12px;
  border: 2px dashed var(--fg);
}
.notice::before {
  content: "[i] ";
  font-weight: bold;
}

/* ---- Task board: rows wrap at 320 px; controls are at least 44 x 44 px. ---- */
#tasks-empty {
  color: var(--dim);
  font-style: italic;
}
#tasks > .task-row {
  padding: 8px 0;
  border-bottom: 1px dashed var(--dim);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
/* Line 1: "#<id> [<STATE>] <text>". Lines 2 and 3 (poster, owner, note) are secondary. */
#tasks .task-title .seq,
#tasks .task-title .task-state {
  font-weight: bold;
}
#tasks .task-meta,
#tasks .task-note {
  color: var(--dim);
}
#tasks .task-meta .handle,
#tasks .task-meta .owner {
  color: var(--fg);
  font-weight: bold;
}
#tasks .claim-button,
#tasks .resolve-button,
#tasks .assign-button {
  display: block;
  min-width: 44px;
  min-height: 44px;
  margin-top: 8px;
}
#tasks .resolve-form,
#tasks .assign-form {
  margin-top: 8px;
  white-space: normal;
}
#tasks .resolve-form label,
#tasks .assign-form label {
  display: flex;
}
#tasks .note-field,
#tasks .assignee-field {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-height: 44px;
}
#tasks-summary {
  font-weight: bold;
}
/* ---- Timeline ---- */

#timeline-empty {
  color: var(--dim);
  font-style: italic;
}

#timeline > div {
  padding: 4px 0;
  border-bottom: 1px dashed var(--dim);
  white-space: pre-wrap; /* keep typed spacing; lines still wrap */
  overflow-wrap: anywhere; /* long unbroken text wraps instead of scrolling sideways */
}

#timeline .seq,
#timeline .handle {
  font-weight: bold;
}

#timeline .at {
  color: var(--dim);
  text-decoration: underline dotted; /* hint that hovering shows the full timestamp */
  cursor: help;
}

#timeline .action,
#timeline .action,
#timeline .task-marker,
#timeline .task-state {
  font-weight: bold;
}
