/* IBM Plex, self-hosted — the CSP confines everything to 'self', and a font
   drawn for engineering documentation suits the subject better than the
   system UI stack. Latin subset only; ~88 KB total, cached after first load. */
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}

:root {
  /* Graphite ground, ETS red as the only saturated colour on the page. */
  --bg:        #17181a;
  --panel:     #1e2023;
  --raised:    #26282c;
  --rule:      #33363b;
  --rule-soft: #26282c;

  --ink:       #e9eaec;   /* primary text */
  --dim:       #9b9ea4;   /* secondary text — brand grey, lifted for dark */
  --faint:     #868a91;

  --seal:      #a10f21;   /* brand red: fills and the fuse */
  --seal-hi:   #c01429;
  --seal-text: #e76377;   /* red is unreadable as text on dark; this isn't */
  --seal-wash: #2a1519;

  --sans: "IBM Plex Sans", ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16.5px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--seal-text); }
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 600; }
h1 { font-size: 1.5rem; letter-spacing: -0.015em; }
h2 { font-size: 1.05rem; letter-spacing: -0.005em; }
p { margin: 0 0 0.9rem; max-width: 62ch; }

/* ---------- masthead ---------- */
.masthead {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.75rem;
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
}
.masthead .logo { height: 42px; width: auto; display: block; }
.masthead .who { margin-left: auto; color: var(--dim); font-size: 0.82rem; }
.masthead a { font-size: 0.82rem; color: var(--dim); text-decoration: none; }
.masthead a:hover { color: var(--ink); }
.masthead form { margin: 0; }

/* ---------- shell ---------- */
.wrap { max-width: 34rem; margin: 0 auto; padding: 2.25rem 1.5rem 4rem; }
/* Scoped to .wrap deliberately: an unscoped .wide also matches button.wide,
   and a class selector outranks the bare `button` rule, so the layout padding
   lands inside every full-width button and shoves its label off centre. */
.wrap.wide { max-width: 76rem; padding-top: 1.5rem; }

.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1.3rem;
  margin-bottom: 1.1rem;
}
.panel.sealed { border-top: 2px solid var(--seal); }
.panel > h2 { margin-bottom: 0.3rem; }
.panel .hint { color: var(--dim); font-size: 0.88rem; margin-bottom: 1rem; }

.grid { display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
@media (min-width: 56rem) {
  .grid { grid-template-columns: 21rem minmax(0, 1fr); align-items: start; }
}

/* ---------- the unlock bar ----------
   Optional step, so it reads as a strip rather than the hero of the page. */
.lockbar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--seal);
  border-radius: 3px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 1.1rem;
}
.lockbar .text { flex: 1 1 18rem; min-width: 0; }
.lockbar .text strong { font-weight: 600; font-size: 0.95rem; }
.lockbar .text span { display: block; color: var(--dim); font-size: 0.85rem; }
.lockbar .controls { display: flex; gap: 0.5rem; flex: 0 1 24rem; }
.lockbar input { flex: 1 1 auto; }
.lockbar button { flex: 0 0 auto; }

/* ---------- controls ---------- */
label {
  display: block;
  font-size: 0.8rem;
  color: var(--dim);
  margin: 0 0 0.3rem;
  letter-spacing: 0.01em;
}
input, textarea, select, button { font-family: inherit; font-size: 0.95rem; }

input[type=text], input[type=password], textarea, select {
  width: 100%;
  line-height: 1.2;
  padding: 0.62rem 0.65rem;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--ink);
  border-radius: 3px;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { font-family: var(--mono); resize: vertical; min-height: 4.5rem; }
select { appearance: none; padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%),
                    linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat; }

input:focus-visible, textarea:focus-visible, select:focus-visible,
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--seal-text);
  outline-offset: 1px;
}
.field { margin-bottom: 0.8rem; }
.row { display: flex; gap: 0.6rem; }
.row > * { flex: 1; }

button {
  /* Centred by construction: line-height 1 makes the line box exactly the text
     height, so symmetric padding gives symmetric space. No min-height — that
     leaves leftover room the flex box distributes, which is what threw the
     label off. --btn-nudge is the optical dial: IBM Plex leaves 0.052em more
     room above the caps than below the baseline, so the label reads a touch
     low without it. Raise it if you want the text higher. */
  --btn-nudge: 0.026em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 1px solid var(--raised);
  background: var(--raised);
  color: var(--ink);
  padding: 0.72rem 1rem;
  padding-bottom: calc(0.72rem + var(--btn-nudge));
  padding-top: calc(0.72rem - var(--btn-nudge));
  border-radius: 3px;
  cursor: pointer;
}
button:hover { background: #303338; border-color: #303338; }
button.primary { background: var(--seal); border-color: var(--seal); color: #fff; }
button.primary:hover { background: var(--seal-hi); border-color: var(--seal-hi); }
button.quiet { background: none; color: var(--dim); border-color: var(--rule); }
button.quiet:hover { background: var(--raised); color: var(--ink); }
button:disabled { opacity: 0.4; cursor: default; }
button.wide { width: 100%; }

/* ---------- the fuse ---------- */
.fuse { margin: 0.85rem 0 0; }
.fuse .track { height: 2px; background: var(--rule); overflow: hidden; }
.fuse .burn { height: 2px; background: var(--seal-text); transition: width 1s linear; }
.fuse .clock {
  font: 0.75rem/1.4 var(--mono);
  color: var(--dim);
  margin-top: 0.32rem;
  display: flex;
  justify-content: space-between;
}

.value {
  font-family: var(--mono);
  font-size: 0.95rem;
  word-break: break-all;
  white-space: pre-wrap;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.75rem;
  margin: 0 0 0.7rem;
}
.linkout {
  font-family: var(--mono);
  font-size: 0.78rem;
  word-break: break-all;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.65rem;
  margin-bottom: 0.6rem;
  color: var(--ink);
}

/* ---------- the board: the real subject of the page ---------- */
.board {
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--panel);
  min-height: 20rem;
}
.board header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--rule);
}
.board header h2 { margin-right: auto; }
.pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--seal-text);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none; opacity: 0.8; }
  .fuse .burn { transition: none; }
}

.item { padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--rule-soft); }
.item:last-child { border-bottom: 0; }
.item.ready {
  background: var(--seal-wash);
  border-left: 2px solid var(--seal);
  padding-left: 0.95rem;
}
.item .top { display: flex; align-items: baseline; gap: 0.6rem; }
.item .name { font-weight: 600; }
.item .meta { margin-left: auto; font: 0.76rem/1 var(--mono); color: var(--dim); }
.item .state { font-size: 0.87rem; color: var(--dim); }
.item .actions { display: flex; gap: 0.45rem; margin-top: 0.65rem; flex-wrap: wrap; }
.item .actions button {
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  padding-bottom: calc(0.5rem + var(--btn-nudge));
  padding-top: calc(0.5rem - var(--btn-nudge));
}

.empty { padding: 3.5rem 1.1rem; color: var(--faint); text-align: center; }
.note { font-size: 0.87rem; color: var(--dim); }
.error {
  border-left: 2px solid var(--seal);
  background: var(--seal-wash);
  color: var(--ink);
  padding: 0.65rem 0.85rem;
  border-radius: 0 3px 3px 0;
  margin-bottom: 0.9rem;
  font-size: 0.88rem;
}
.gone { text-align: left; }
.gone h1 { margin-bottom: 0.55rem; }
.hidden { display: none !important; }

.tabs { display: flex; gap: 0; margin-bottom: -1px; }
.tabs button {
  padding: 0.6rem 0.95rem;
  border: 1px solid var(--rule);
  border-bottom-color: var(--panel);
  background: var(--panel);
  color: var(--dim);
  border-radius: 3px 3px 0 0;
  font-size: 0.87rem;
}
.tabs button[aria-selected=false] {
  background: var(--bg);
  border-bottom-color: var(--rule);
}
.tabs button[aria-selected=true] { color: var(--ink); font-weight: 600; }
.tabs + .panel { border-radius: 0 3px 3px 3px; }

input[type=checkbox] { accent-color: var(--seal); }
