/* Node delegation rewards, feature layer on top of static/style.css.
   Same world as the snapshot pages: SNAPSHOT-DIENSTREGELING signage.
   style.css owns the tokens, fonts, station band, boards, tables, service
   classes, and buttons; this file only adds what the nodes pages need:
   the week board, the per-node row, the collapsible epoch ledger, the
   share bar, and the loading state.
   Every node is a service on the K line, so magenta stays the accent. */

/* ---- lookup form (shares the snapshot ticket-gate grammar) ---- */
.lookup-card { padding: 20px 22px; --card-line: var(--accent); }
.lookup-form label {
  display: block;
  font-family: var(--font-sign);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 9px;
}
.input-row {
  display: flex; gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
}
.lookup-form input {
  flex: 1 1 240px;
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid var(--line);
  background: var(--bg-inset);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: border-color 0.15s;
}
.lookup-form input::placeholder { color: var(--fg-dim); }
.lookup-form input:focus { border-color: var(--accent); }

.lookup-form .btn-primary, .btn-primary {
  font-family: var(--font-sign);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-on-plate);
  background: var(--plate);
  border: 1px solid var(--plate);
  padding: 12px 20px;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: #ffffff; }
.btn-primary:active { transform: translateY(1px); }

.connect-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg-muted);
  font-family: var(--font-sign);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: color 0.15s, border-color 0.15s;
}
.connect-btn[hidden] { display: none; }
.connect-btn:hover:not(:disabled) { color: var(--fg); border-color: #45454f; }
.connect-btn:disabled { opacity: 0.5; cursor: progress; }
.connect-btn .connect-icon {
  width: 16px; height: 16px;
  border-radius: 3px;
  background: var(--accent);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0;
}
.connect-btn .connect-icon::after { content: "K"; }
.connect-status {
  font-size: 12px;
  margin: 11px 0 0;
  color: var(--fg-dim);
}
.connect-status[data-kind="ok"] { color: var(--green); }
.connect-status[data-kind="err"] { color: var(--red); }
.hint {
  font-size: 12px; color: var(--fg-dim);
  margin: 12px 0 0; line-height: 1.6;
  max-width: 68ch;
}
.form-error {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--red);
  font-size: 12.5px;
  margin: 12px 0 0;
  padding: 10px 12px;
  background: var(--red-soft);
  border: 1px solid rgba(255, 84, 112, 0.45);
}
.form-error::before {
  content: "";
  width: 8px; height: 8px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask-image: var(--gl-cross); mask-image: var(--gl-cross);
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}

/* ---- hero board variants used by the nodes payload ---- */
.hero-card-kunai .hero-card-value { color: #ff8dff; }
.hero-card-green .hero-card-value { color: var(--green); }
.hero-usd {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--fg-muted);
}

/* ---- empty and loading states ---- */
.empty-card { padding: 34px 24px; text-align: center; }
.empty-card h2 {
  font-family: var(--font-sign);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin: 0 0 10px;
}
.empty-card::before {
  content: "";
  display: block;
  width: 18px; height: 18px;
  margin: 0 auto 14px;
  background: var(--fg-dim);
  -webkit-mask-image: var(--gl-hollow); mask-image: var(--gl-hollow);
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.empty-card p { color: var(--fg-muted); margin: 0; }
.empty-card code {
  background: var(--bg-inset);
  padding: 2px 6px;
  border: 1px solid var(--line-soft);
  font-size: 11px;
  word-break: break-all;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--fg-muted);
  font-family: var(--font-sign);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
/* Departure-board style waiting indicator: three ticks, not a spinner. */
.spinner {
  width: 26px; height: 8px;
  background:
    linear-gradient(var(--accent) 0 0) 0 0 / 6px 8px no-repeat,
    linear-gradient(var(--accent) 0 0) 10px 0 / 6px 8px no-repeat,
    linear-gradient(var(--accent) 0 0) 20px 0 / 6px 8px no-repeat;
  animation: board-tick 1s steps(3, end) infinite;
}
@keyframes board-tick {
  0%   { opacity: 0.25; }
  50%  { opacity: 1; }
  100% { opacity: 0.25; }
}

/* The results container is a single flex item, so its own children need
   the column rhythm that main.wrap gives top-level boards. */
#results {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ---- week board ---- */
.week-card { --card-line: var(--accent); padding: 0; }
.week-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 13px 22px;
  cursor: pointer;
  background: var(--bg-card-2);
  border-bottom: 1px solid var(--line);
  transition: background 0.15s;
}
.week-header:hover { background: #1c1c21; }
.week-header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.week-chevron {
  width: 8px; height: 8px;
  flex: 0 0 auto;
  font-size: 0;
  background: var(--accent);
  -webkit-mask-image: var(--gl-play); mask-image: var(--gl-play);
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  transition: transform 0.15s;
}
.week-card.week-open .week-chevron { transform: rotate(90deg); }
.week-label {
  font-family: var(--font-sign);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg);
  white-space: nowrap;
}
.week-nodes-count {
  font-size: 11.5px;
  color: var(--fg-dim);
  white-space: nowrap;
}
.week-header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.week-total {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 700;
  color: #ff8dff;
  white-space: nowrap;
}
.week-nodes { padding: 0; }
.week-card:not(.week-open) .week-nodes { display: none; }
.week-card:not(.week-open) .week-header { border-bottom-color: transparent; }

/* ---- per-node service row ---- */
.node-week-card { border-bottom: 1px solid var(--line-soft); }
.node-week-card:last-child { border-bottom: none; }
.node-week-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 22px;
  cursor: pointer;
  transition: background 0.15s;
}
.node-week-header:hover { background: rgba(245, 244, 240, 0.03); }
.node-week-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
/* The line badge: every node is a stop on the K line. */
.node-dot {
  width: 18px; height: 18px;
  flex: 0 0 auto;
  border-radius: 4px;
  background: var(--accent);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sign);
  font-size: 10px;
  font-weight: 700;
}
.node-dot::after { content: "K"; }
.node-week-name {
  font-family: var(--font-sign);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg);
  white-space: nowrap;
}
.node-week-epochs { font-size: 11.5px; color: var(--fg-dim); white-space: nowrap; }
.node-week-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.node-week-kunai {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 700;
  color: #ff8dff;
  min-width: 110px;
  text-align: right;
}
.node-week-tx { min-width: 80px; text-align: right; }
.tx-dash { color: var(--fg-dim); font-size: 12px; }
.chevron {
  width: 8px; height: 8px;
  font-size: 0;
  display: inline-block;
  background: var(--fg-dim);
  -webkit-mask-image: var(--gl-play); mask-image: var(--gl-play);
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  transition: transform 0.15s;
}
.node-week-card.open .chevron { transform: rotate(90deg); background: var(--accent); }

/* ---- collapsible epoch ledger ---- */
/* Collapse via grid-template-rows so the transition composites instead of
   re-running layout on every frame. */
.node-week-detail {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  transition: grid-template-rows 0.25s ease;
  background: var(--bg-inset);
  border-top: 1px solid var(--line-soft);
}
.node-week-detail > * { min-height: 0; overflow: hidden; }
.node-week-card.open .node-week-detail { grid-template-rows: 1fr; }
.node-week-card:not(.open) .node-week-detail { border-top-color: transparent; }
@media (prefers-reduced-motion: reduce) {
  .node-week-detail { transition: none; }
}
.epoch-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 0;
}
.epoch-detail-table th {
  text-align: left;
  padding: 8px 14px 8px 30px;
  color: var(--fg-dim);
  font-family: var(--font-sign);
  font-weight: 700;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.epoch-detail-table th.num,
.epoch-detail-table td.num { text-align: right; }
.epoch-detail-table td {
  padding: 8px 14px 8px 30px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.epoch-detail-table tr:last-child td { border-bottom: none; }
.epoch-detail-table .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
}
.epoch-detail-label {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--fg-muted);
}
.epoch-detail-row td { padding-top: 6px; padding-bottom: 6px; }
/* Secondary measured values keep one muted mono voice. */
.epoch-rate { color: var(--fg-dim); }
.epoch-reward { color: #ff8dff; font-weight: 700; }
.epoch-usd { font-size: 12px; color: var(--fg-muted); }

/* ---- share bar ---- */
.pct-bar { display: flex; align-items: center; gap: 8px; }
.pct-track {
  flex: 1 1 auto;
  min-width: 44px;
  height: 7px;
  background: var(--line-soft);
}
.pct-fill { height: 100%; background: var(--accent); }
.pct-label {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--fg-muted);
  min-width: 46px;
  text-align: right;
}

/* Caption under a rendered result set (the page owns the only footer). */
.results-caption {
  margin: 0;
  padding: 4px 2px 0;
  font-size: 11.5px;
  color: var(--fg-dim);
  text-align: center;
}

/* ---- links ---- */
.hash-link {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
}
.hash-link::after {
  content: "";
  width: 8px; height: 8px;
  background: currentColor;
  -webkit-mask-image: var(--gl-ext); mask-image: var(--gl-ext);
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.hash-link:hover { color: var(--fg); }

/* ---- legacy epoch table (kept for compatibility) ---- */
.epoch-table-wrap { overflow-x: auto; }
.epoch-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.epoch-table th {
  font-family: var(--font-sign);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-dim);
  text-align: left;
  padding: 9px 12px;
  background: var(--bg-card-2);
  border-bottom: 1px solid var(--line);
}
.epoch-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.epoch-table .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.epoch-label, .epoch-num, .epoch-date, .epoch-summary, .epoch-kunai-total, .node-name {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---- responsive ---- */
@media (max-width: 980px) {
  .node-week-right { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  #results { gap: 14px; }
  .week-header { padding: 12px 14px; }
  .node-week-header { padding: 11px 14px; flex-wrap: wrap; }
  .node-week-left { flex-wrap: wrap; gap: 8px; }
  .node-week-right { width: 100%; justify-content: flex-end; gap: 10px; }
  .node-week-kunai { min-width: auto; }
  .node-week-tx { min-width: auto; }
  .node-week-detail { overflow-x: auto; }
  .epoch-detail-table th,
  .epoch-detail-table td { padding: 7px 10px; }
  .epoch-detail-table { font-size: 11.5px; }
}
@media (max-width: 480px) {
  .input-row { flex-direction: column; gap: 8px; }
  .lookup-form input,
  .btn-primary,
  .connect-btn { flex: 0 0 auto; width: 100%; justify-content: center; }
  /* 16px keeps iOS Safari and the Telegram webview from zooming on focus. */
  .lookup-form input { font-size: 16px; }
  .lookup-card { padding: 16px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; opacity: 1; }
}
