/* The demo portal: an instrument console. Warm charcoal (paper in light
   mode), one amber signal colour, serif headings, monospace data, and the
   call tape along the bottom. Plain CSS, one file, no web font: the policy
   allows nothing from another origin. */

:root {
  --bg: #12110f;
  --bg-grid: rgba(242, 163, 58, 0.035);
  --panel: #1a1916;
  --panel-2: #222019;
  --line: #2e2b24;
  --line-strong: #47413a;
  --ink: #ece6da;
  --ink-dim: #a59d8f;
  --ink-mute: #6f685d;
  --signal: #f2a33a;
  --signal-ink: #1b1305;
  --cool: #6fb8aa;
  --hot: #ec5d4f;
  --warm: #e0b84f;
  --ok: #78c27e;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Charter, "Bitstream Charter", Georgia, serif;
  --sans: "Seravek", "Gill Sans Nova", "Gill Sans", "Gill Sans MT", Ubuntu, "Trebuchet MS", sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", "Cascadia Mono", "Ubuntu Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 3px;
  --rail: 13rem;
  --tape: 2.6rem;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3efe6;
    --bg-grid: rgba(120, 80, 20, 0.05);
    --panel: #fbf9f4;
    --panel-2: #efe9dc;
    --line: #ddd4c2;
    --line-strong: #c3b8a2;
    --ink: #1f1c17;
    --ink-dim: #5d564b;
    --ink-mute: #8b8374;
    --signal: #b9631a;
    --signal-ink: #fff8ee;
    --cool: #2f7f72;
    --hot: #c0392b;
    --warm: #9a7412;
    --ok: #2f7d3a;
    color-scheme: light;
  }
}

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

/* A layout rule's display must not show what the page hides. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  padding-bottom: calc(var(--tape) + 1rem);
}

a { color: var(--signal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
code, pre, .mono { font-family: var(--mono); font-size: 0.86em; }

/* ---------- the bar ---------- */

.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  padding: 0.7rem 1.25rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 0.75rem; color: inherit; text-decoration: none; margin-right: auto; }
.brand-mark {
  width: 1.6rem; height: 1.6rem; flex: none;
  border: 2px solid var(--signal); border-radius: 50%;
  background: radial-gradient(circle, var(--signal) 0 22%, transparent 24%),
              conic-gradient(from 20deg, color-mix(in srgb, var(--signal) 45%, transparent) 0 18%, transparent 18%);
  animation: sweep 6s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .brand-mark { animation: none; } }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; letter-spacing: 0.01em; }
.brand-sub { font-family: var(--mono); font-size: 0.68rem; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.08em; }

.bar-tenant { display: flex; align-items: center; gap: 0.5rem; }
.bar-tenant label { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-mute); }
.bar-tenant select { min-width: 14rem; max-width: 26rem; }
.bar-user { display: flex; align-items: center; gap: 0.75rem; }
.who { font-size: 0.9rem; color: var(--ink-dim); }

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

.frame { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); align-items: start; }
.signed-out .frame { grid-template-columns: minmax(0, 1fr); }

.rail {
  position: sticky; top: 4.2rem;
  display: flex; flex-direction: column; gap: 1px;
  padding: 1.25rem 0 1.25rem 1.25rem;
}
.rail a {
  display: flex; align-items: baseline; gap: 0.7rem;
  padding: 0.42rem 0.75rem;
  color: var(--ink-dim); text-decoration: none;
  border-left: 2px solid transparent;
  font-size: 0.95rem;
}
.rail a:hover { color: var(--ink); background: var(--panel); }
.rail a.current { color: var(--ink); border-left-color: var(--signal); background: var(--panel); }
.rail-n { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-mute); }
.rail a.current .rail-n { color: var(--signal); }

main { padding: 1.5rem 2rem 2rem; min-width: 0; outline: none; }
main.enter > * { animation: rise 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
main.enter > *:nth-child(2) { animation-delay: 0.05s; }
main.enter > *:nth-child(3) { animation-delay: 0.1s; }
main.enter > *:nth-child(4) { animation-delay: 0.15s; }
main.enter > *:nth-child(n + 5) { animation-delay: 0.2s; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { main.enter > * { animation: none; } }

/* ---------- headings ---------- */

.view-head { margin-bottom: 1.25rem; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; }
h1 { font-size: 2.1rem; line-height: 1.1; letter-spacing: -0.01em; overflow-wrap: anywhere; }
h2 { font-size: 1.25rem; margin-bottom: 0.75rem; overflow-wrap: anywhere; }
h3 { font-size: 1.05rem; margin: 1rem 0 0.5rem; }
.lede { color: var(--ink-dim); margin: 0.4rem 0 0; max-width: 60rem; }

.routes { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0; margin: 0.8rem 0 0; }
.routes code {
  display: inline-block; padding: 0.12rem 0.45rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--ink-dim); font-size: 0.74rem; background: var(--panel);
}

/* ---------- panels, tiles ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.1rem;
}

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.2rem, 1fr)); gap: 0.75rem; margin-bottom: 1.1rem; }
.tile {
  display: flex; flex-direction: column; gap: 0.2rem;
  padding: 0.85rem 1rem;
  background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--line-strong);
  border-radius: var(--radius);
}
.tile.hot { border-top-color: var(--hot); }
.tiles > .refusal { grid-column: 1 / -1; }
.tile-value { font-family: var(--mono); font-size: 1.65rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile.hot .tile-value { color: var(--hot); }
.tile-label { font-size: 0.78rem; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.06em; }

.kv { display: grid; grid-template-columns: minmax(9rem, max-content) minmax(0, 1fr); gap: 0.35rem 1.25rem; margin: 0 0 0.5rem; }
.kv dt { color: var(--ink-mute); font-size: 0.85rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th {
  position: sticky; top: 0;
  background: var(--panel-2); color: var(--ink-mute);
  font-family: var(--mono); font-size: 0.7rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tr.link { cursor: pointer; }
tr.link:hover td, tr.link:focus td { background: color-mix(in srgb, var(--signal) 7%, transparent); }
tr.link:focus { outline: none; }
tr.link:focus td:first-child { box-shadow: inset 2px 0 0 var(--signal); }
tr.empty td { color: var(--ink-mute); font-style: italic; }
td.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
td.strong { font-weight: 600; }
td.mono { overflow-wrap: anywhere; min-width: 8rem; }
td.mono.strong { min-width: 14rem; }
td.time { white-space: nowrap; }
td.clip { max-width: 28rem; }
.matrix th, .matrix td { white-space: nowrap; }

/* ---------- badges ---------- */

.badge {
  display: inline-block; padding: 0.05rem 0.45rem;
  border: 1px solid var(--line-strong); border-radius: 999px;
  font-family: var(--mono); font-size: 0.72rem; white-space: nowrap;
  color: var(--ink-dim);
}
.sev.v-critical { background: var(--hot); border-color: var(--hot); color: #fff; }
.sev.v-high { color: var(--hot); border-color: var(--hot); }
.sev.v-medium { color: var(--warm); border-color: var(--warm); }
.sev.v-low { color: var(--cool); border-color: var(--cool); }
.status.v-affected, .v-open { color: var(--hot); border-color: color-mix(in srgb, var(--hot) 60%, transparent); }
.status.v-version_vulnerable_config_unknown, .status.v-possibly_affected_version_unknown, .v-acknowledged { color: var(--warm); border-color: color-mix(in srgb, var(--warm) 60%, transparent); }
.status.v-fixed, .status.v-not_affected, .status.v-not_affected_feature_off, .v-resolved, .v-done, .v-present { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.muted { color: var(--ink-mute); }

/* ---------- forms, buttons ---------- */

button, .button {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.95rem;
  font: 600 0.88rem var(--sans);
  color: var(--signal-ink); background: var(--signal);
  border: 1px solid var(--signal); border-radius: var(--radius);
  text-decoration: none; cursor: pointer;
}
button:hover, .button:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.55; cursor: progress; }
button.ghost, .button.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
button.ghost:hover, .button.ghost:hover { border-color: var(--signal); color: var(--signal); filter: none; }
button.small { padding: 0.15rem 0.5rem; font-size: 0.76rem; }
.button.big { padding: 0.8rem 1.4rem; font-size: 1rem; margin-top: 1.5rem; }
button:focus-visible, .button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, .rail a:focus-visible {
  outline: 2px solid var(--signal); outline-offset: 2px;
}

input, select, textarea {
  font: 0.9rem var(--sans); color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 0.38rem 0.55rem; max-width: 100%;
}
select[multiple] { min-width: 14rem; }
textarea { width: 100%; resize: vertical; }

.filters, .row { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: end; margin-bottom: 0.9rem; }
.filters label, .row label, .status-form label, .mail-form > label { display: flex; flex-direction: column; gap: 0.25rem; }
.filters label > span, .row label > span, .status-form label > span, .mail-form > label > span {
  font-family: var(--mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-mute);
}
.filters input[type="search"] { min-width: 16rem; }
label.inline { display: flex; flex-direction: row; align-items: center; gap: 0.45rem; margin: 0.5rem 0; color: var(--ink-dim); }
.status-form, .mail-form { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: end; margin-top: 1rem; }
.mail-form { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
.mail-form label.inline { margin: 0; }
.mail-form > button { align-self: flex-start; }
.status-form h3 { flex-basis: 100%; margin: 0; }
.status-form .wide { flex: 1 1 22rem; }
.form-out { flex-basis: 100%; color: var(--ink-dim); font-size: 0.9rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 0.75rem; }
.more { margin-top: 0.6rem; }

/* ---------- notes, refusals ---------- */

.note, .loading { color: var(--ink-dim); font-size: 0.9rem; }
.loading::before { content: "▸ "; color: var(--signal); }
.refusal {
  border-left: 3px solid var(--hot);
  background: color-mix(in srgb, var(--hot) 9%, var(--panel));
  padding: 0.65rem 0.9rem; margin: 0.5rem 0; border-radius: 0 var(--radius) var(--radius) 0;
  max-width: 60rem;
}
.refusal p { margin: 0.2rem 0 0; }
.refusal-code { font-family: var(--mono); font-size: 0.78rem; color: var(--hot); text-transform: uppercase; letter-spacing: 0.06em; }
.refusal-message { color: var(--ink-dim); font-size: 0.88rem; }

pre.json {
  margin: 0 0 0.75rem; padding: 0.75rem; overflow-x: auto;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  white-space: pre-wrap; word-break: break-all;
}
.refs { margin: 0; padding-left: 1.1rem; }
.refs a { word-break: break-all; }
.claim.key { color: var(--signal); font-weight: 600; }
.claim-value { white-space: pre-wrap; word-break: break-all; }
.raw { margin-top: 1rem; }
.raw summary { cursor: pointer; margin-bottom: 0.4rem; }
.history:not(:empty) { margin-top: 0.75rem; }

/* ---------- the signed-out page ---------- */

.hero { max-width: 46rem; margin: 9vh auto 0; padding: 0 0.5rem; }
.eyebrow { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--signal); margin: 0 0 1rem; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.05; }
.hero .lede { font-size: 1.1rem; margin-top: 1.1rem; }

/* ---------- the tape ---------- */

.tape {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  background: var(--panel-2); border-top: 1px solid var(--line-strong);
  font-family: var(--mono); font-size: 0.78rem;
}
.tape-head {
  display: flex; align-items: center; gap: 0.9rem; width: 100%;
  height: var(--tape); padding: 0 1.25rem;
  background: transparent; color: var(--ink-dim); border: 0; border-radius: 0;
  font: inherit; text-align: left;
}
.tape-head:hover { filter: none; color: var(--ink); }
.tape-title { text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-mute); flex: none; }
.tape-count { flex: none; min-width: 1.8rem; padding: 0 0.4rem; text-align: center; border-radius: 999px; background: var(--signal); color: var(--signal-ink); font-weight: 700; }
.tape-last { flex: 1; min-width: 0; overflow: hidden; }
.tape-list {
  list-style: none; margin: 0; padding: 0.25rem 0;
  max-height: 40vh; overflow-y: auto; border-top: 1px solid var(--line);
}
.tape-list li { padding: 0.18rem 1.25rem; }
.tape-list li:first-child { background: color-mix(in srgb, var(--signal) 8%, transparent); }
.tape-line { display: flex; gap: 0.75rem; align-items: baseline; min-width: 0; white-space: nowrap; }
.tape-line time { color: var(--ink-mute); flex: none; }
.tape-line .method { flex: none; width: 3.6rem; font-weight: 700; }
.m-get { color: var(--cool); }
.m-post, .m-put, .m-patch { color: var(--signal); }
.m-delete { color: var(--hot); }
.tape-line .url { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.tape-line .status { flex: none; font-weight: 700; }
.s-ok { color: var(--ok); }
.s-warn { color: var(--warm); }
.s-bad { color: var(--hot); }
.tape-line .ms { flex: none; color: var(--ink-mute); width: 4.5rem; text-align: right; }

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

@media (max-width: 860px) {
  .bar { gap: 0.6rem 1rem; padding: 0.6rem 1rem; }
  .brand-sub { display: none; }
  .bar-tenant { order: 3; flex-basis: 100%; }
  .bar-tenant select { flex: 1; min-width: 0; max-width: none; }
  .frame { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: static; flex-direction: row; overflow-x: auto; gap: 0;
    padding: 0.4rem 1rem; border-bottom: 1px solid var(--line);
    scrollbar-width: thin;
  }
  .rail a { flex: none; border-left: 0; border-bottom: 2px solid transparent; padding: 0.4rem 0.6rem; }
  .rail a.current { border-bottom-color: var(--signal); }
  .rail-n { display: none; }
  main { padding: 1.1rem 1rem 1.5rem; }
  h1 { font-size: 1.6rem; }
  .panel { padding: 0.9rem 0.9rem; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; }
  .kv dd { margin-bottom: 0.45rem; }
  .filters label, .filters input[type="search"] { flex: 1 1 100%; min-width: 0; }
  /* A table keeps its columns' width and scrolls in its frame. */
  .table-wrap table { width: max-content; min-width: 100%; }
  .table-wrap td { max-width: 20rem; }
  .tape-head { padding: 0 1rem; gap: 0.6rem; }
  .tape-title { display: none; }
  .tape-line .ms, .tape-line time { display: none; }
}
