/*
 * sneaki.sh web UI — the single stylesheet (WS7 brand system, direction B).
 * Fonts are self-hosted below; pages make no external requests.
 */

/* Self-hosted fonts (latin subsets; see fonts/LICENSES.txt). */
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("fonts/jetbrains-mono-800.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/inter-600.woff2") format("woff2");
}

/* Design tokens (owner brand guide; exact hex). */
:root {
  --ink: #0F1216;        /* page ground */
  --graphite: #1B2027;   /* surfaces, cards */
  --fog: #8A94A3;        /* muted text on dark */
  --paper: #F5F2EA;      /* primary text on dark */
  --slate: #4A5361;      /* muted on light; borders on dark */
  --flashlight: #FFB020; /* the one accent: "changed" */
  --added: #3FB950;      /* new release, + lines */
  --removed: #F85149;    /* pulled, critical, - lines */
  --info: #58A6FF;       /* promotions, info */
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--ink); }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.65;
}

.mono { font-family: var(--mono); }

.shell {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* Header */
.site-header {
  background: var(--graphite);
  border-bottom: 1px solid var(--slate);
}
.header-row {
  display: flex;
  align-items: center;
  gap: 32px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand-link { display: inline-flex; align-items: center; text-decoration: none; }
.brand-lockup { display: block; }

.site-nav { display: flex; gap: 20px; }
.site-nav a {
  color: var(--fog);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.site-nav a:hover,
.site-nav a:focus { color: var(--paper); }

.session { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.session-user { color: var(--fog); font-size: 13px; }
.logout-form { display: inline; margin: 0; }

/* Footer */
.site-footer { margin-top: auto; border-top: 1px solid var(--slate); }
.footer-note {
  color: var(--fog);
  font-size: 13px;
  padding-top: 14px;
  padding-bottom: 14px;
}

/* Content */
.content { flex: 1 0 auto; padding-top: 32px; padding-bottom: 48px; }
h1 { font-weight: 600; font-size: 28px; margin: 0 0 8px; }
.page-head { margin-bottom: 24px; }
.page-note { color: var(--fog); margin: 0; }
.empty-note { color: var(--fog); }

/* Vendor sections and product rows */
.vendor-section { margin-bottom: 40px; }
.vendor-name { font-weight: 600; font-size: 20px; margin: 0 0 12px; }
.vendor-slug { color: var(--fog); font-size: 13px; margin-left: 8px; }
.product-row {
  display: grid;
  grid-template-columns: minmax(180px, 280px) 150px 1fr;
  background: var(--graphite);
  border: 1px solid var(--slate);
  border-bottom: none;
}
.product-row:last-child { border-bottom: 1px solid var(--slate); }
.product-id { padding: 14px 16px; border-right: 1px solid var(--slate); }
.product-name { font-weight: 600; }
.product-slug { color: var(--fog); font-size: 13px; }
.product-kind {
  padding: 14px 16px;
  border-right: 1px solid var(--slate);
}
.product-sub { padding: 14px 16px; }
.sub-controls { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.sub-actions { display: flex; align-items: center; gap: 12px; padding-bottom: 8px; }
.sub-off { display: inline; margin: 0 0 12px; }

/* Chips */
.chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fog);
  border: 1px solid var(--slate);
  border-radius: 3px;
  padding: 1px 7px;
  white-space: nowrap;
}
.chip-on { color: var(--added); border-color: var(--added); }
.chip-blank { visibility: hidden; }

/* Severity chips (shared with later WS7 units). */
.sev-critical,
.sev-warning,
.sev-notice,
.sev-info {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid;
  border-radius: 3px;
  padding: 1px 7px;
}
.sev-critical { color: var(--removed); border-color: var(--removed); }
.sev-warning { color: var(--flashlight); border-color: var(--flashlight); }
.sev-notice { color: var(--fog); border-color: var(--fog); }
.sev-info { color: var(--info); border-color: var(--info); }

/* Forms */
.field { display: block; margin: 0 0 12px; }
.field-label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fog);
  margin-bottom: 4px;
}
input[type="text"],
input[type="password"],
select {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--slate);
  border-radius: 3px;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 14px;
}
input[type="text"],
input[type="password"] { width: 100%; }
select:focus,
input[type="text"]:focus,
input[type="password"]:focus {
  outline: 1px solid var(--flashlight);
  border-color: var(--flashlight);
}
.field-error { display: block; color: var(--removed); font-size: 13px; margin-top: 4px; }
.form-errors { list-style: none; margin: 0 0 12px; padding: 0; color: var(--removed); }

fieldset.types { border: none; margin: 0 0 8px; padding: 0; }
.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 4px 12px;
}
.type-option {
  display: flex;
  gap: 6px;
  align-items: baseline;
  cursor: pointer;
  font-size: 13px;
}
.type-option input { accent-color: var(--flashlight); }
.type-option .mono { color: var(--fog); }
.hint { color: var(--fog); font-size: 12px; margin: 6px 0 0; }

/* Buttons: paper on graphite; the accent variant is flashlight with ink text. */
.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--graphite);
  color: var(--paper);
  border: 1px solid var(--slate);
  border-radius: 3px;
  padding: 8px 16px;
  cursor: pointer;
}
.btn:hover,
.btn:focus { border-color: var(--fog); }
.btn-accent {
  background: var(--flashlight);
  border-color: var(--flashlight);
  color: var(--ink);
  font-weight: 700;
}
.btn-accent:hover,
.btn-accent:focus { border-color: var(--flashlight); filter: brightness(1.06); }
.btn-danger {
  background: transparent;
  border-color: var(--removed);
  color: var(--removed);
}
.btn-danger:hover,
.btn-danger:focus { background: var(--removed); border-color: var(--removed); color: var(--ink); }
.btn-quiet { padding: 4px 12px; }
.btn-wide { width: 100%; }

/* Login page */
.login-card {
  max-width: 380px;
  margin: 48px auto 0;
  background: var(--graphite);
  border: 1px solid var(--slate);
  padding: 32px;
}
.tagline { color: var(--fog); margin: 10px 0 24px; font-size: 14px; }

/* Feed filters */
.feed-filters {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--graphite);
  border: 1px solid var(--slate);
  padding: 14px 16px;
  margin-bottom: 24px;
}
.feed-filters .field { margin: 0; }
.feed-filters select { min-width: 150px; }
input[type="date"] {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--slate);
  border-radius: 3px;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 14px;
  color-scheme: dark;
}
input[type="date"]:focus {
  outline: 1px solid var(--flashlight);
  border-color: var(--flashlight);
}

/* Feed rows (shared with the related-events list on the detail page) */
.feed-list { display: flex; flex-direction: column; gap: 12px; }
.event-row {
  background: var(--graphite);
  border: 1px solid var(--slate);
  padding: 14px 18px;
}
.event-labels { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.event-meta { color: var(--fog); font-size: 13px; }
.event-meta .mono { font-size: 12px; }
.event-head { font-weight: 600; font-size: 17px; line-height: 1.45; margin: 8px 0 0; }
.event-head a { color: var(--paper); text-decoration: none; }
.event-head a:hover,
.event-head a:focus { color: var(--flashlight); }
.hash-lines { margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.hash-line {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.hash-line code { font-family: inherit; }
.hash-removed { color: var(--removed); }
.hash-added { color: var(--added); }
.hash-sign { display: inline-block; min-width: 1em; }
.event-announce { color: var(--fog); font-size: 13px; margin: 8px 0 0; }

/* Pager */
.pager { display: flex; align-items: center; gap: 12px; margin-top: 24px; }
.pager-state { color: var(--fog); font-size: 13px; }
.pager .btn { text-decoration: none; }

/* Event detail */
.event-headline { font-weight: 600; font-size: 24px; line-height: 1.4; margin: 0 0 8px; }
.detail-product { font-weight: 600; }
.detail-times { display: flex; gap: 24px; margin: 12px 0 0; flex-wrap: wrap; }
.detail-time { display: inline-flex; gap: 8px; align-items: baseline; }
.detail-card {
  background: var(--graphite);
  border: 1px solid var(--slate);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.detail-card h2 {
  font-family: var(--mono);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fog);
  margin: 0 0 12px;
}
.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 6px 24px; margin: 0; }
.kv dt { color: var(--fog); font-size: 13px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.card-generated { border-color: var(--flashlight); }
.generated-text { margin: 0 0 6px; }
.gen-note { color: var(--fog); font-size: 12px; margin: 0; }
.evidence-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.evidence-item { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.evidence-text { font-size: 14px; }
.evidence-hash { font-size: 12px; overflow-wrap: anywhere; }
.kv-table { border-collapse: collapse; margin-top: 10px; }
.kv-table th {
  text-align: left;
  font-weight: 400;
  color: var(--fog);
  padding: 2px 24px 2px 0;
  vertical-align: top;
}
.kv-table td { padding: 2px 0; overflow-wrap: anywhere; }

/* Product page */
.product-vendor { color: var(--fog); font-size: 14px; margin: 0 0 4px; }
.product-slug { color: var(--fog); font-size: 13px; margin: 4px 0 0; }
.product-name-link { color: var(--paper); text-decoration: none; }
.product-name-link:hover,
.product-name-link:focus { color: var(--flashlight); }

/* Source list */
.source-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.source-item { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.source-registry { font-size: 13px; }
.source-cadence { color: var(--fog); font-size: 12px; }
.chip-removed { color: var(--removed); border-color: var(--removed); }

/* Release timeline (product page): pure HTML/CSS, no JavaScript */
.tl-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.tl-legend-item { display: inline-flex; align-items: center; gap: 7px; color: var(--fog); font-size: 12px; }
.tl-sample { display: inline-block; width: 9px; height: 9px; }
.tl-sample-first { border-radius: 50%; background: var(--paper); }
.tl-sample-announced { background: var(--info); transform: rotate(45deg); }
.tl-sample-promotion {
  width: 0;
  height: 0;
  background: none;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 9px solid var(--flashlight);
}
.tl-sample-mirror { width: 2px; height: 10px; background: var(--fog); }

.tl-canvas { position: relative; }
.tl-row { display: grid; grid-template-columns: 150px 1fr; align-items: stretch; }
.tl-label {
  color: var(--paper);
  font-size: 12px;
  line-height: 34px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tl-hairlines {
  position: absolute;
  top: 0;
  bottom: 27px;
  left: 150px;
  right: 0;
  pointer-events: none;
}
.tl-hairline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--slate); }

.tl-mark { position: absolute; top: 50%; transform: translate(-50%, -50%); }
.tl-first { width: 10px; height: 10px; border-radius: 50%; background: var(--paper); }
.tl-announced {
  width: 10px;
  height: 10px;
  background: var(--info);
  transform: translate(-50%, -50%) rotate(45deg);
}
.tl-promotion {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 11px solid var(--flashlight);
  transform: translate(-50%, -58%);
}
a.tl-promotion:hover,
a.tl-promotion:focus { border-bottom-color: var(--paper); }
.tl-mirror {
  top: 6px;
  transform: translateX(-50%);
  width: 2px;
  height: 13px;
  background: var(--fog);
}
.tl-overflow {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fog);
  font-size: 11px;
}
.tl-axis-row { border-top: 1px solid var(--slate); }
.tl-ticks { height: 26px; }
.tl-tick {
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
  color: var(--fog);
  font-size: 11px;
  white-space: nowrap;
}
.tl-tick-left { transform: none; }
.tl-tick-right { transform: translateX(-100%); }

/* Script page */
.script-sha { color: var(--fog); font-size: 13px; overflow-wrap: anywhere; margin: 4px 0 0; }
.url-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.url-origin { color: var(--paper); font-size: 13px; overflow-wrap: anywhere; }
.url-rest { color: var(--fog); font-size: 12px; overflow-wrap: anywhere; padding-left: 14px; }

/* Variant matrix */
.matrix { border-collapse: collapse; width: 100%; }
.matrix th,
.matrix td { text-align: left; padding: 6px 16px 6px 0; vertical-align: baseline; }
.matrix thead th { color: var(--fog); font-weight: 400; font-size: 12px; }
.matrix tbody th { font-weight: 400; }
.matrix td .chip { margin-left: 6px; }
.matrix-blank { color: var(--slate); }
.matrix-corner { color: var(--fog); font-family: var(--sans); font-size: 12px; }

/* Diff viewer (WS7 U5): status chips, file table, unified lines, side-by-side */
.diff-arrow { color: var(--fog); margin: 0 8px; }
.status-added { color: var(--added); border-color: var(--added); }
.status-removed { color: var(--removed); border-color: var(--removed); }
.status-changed { color: var(--flashlight); border-color: var(--flashlight); }
.diff-head,
.files-table { border-collapse: collapse; width: 100%; }
.diff-head th,
.files-table th {
  color: var(--fog);
  font-weight: 400;
  font-size: 12px;
  text-align: left;
  padding: 6px 18px 6px 0;
}
.diff-head td,
.files-table td {
  padding: 6px 18px 6px 0;
  border-top: 1px solid var(--slate);
  vertical-align: baseline;
  overflow-wrap: anywhere;
}
.diff-head tbody tr:first-child td { border-top: none; }
.files-path { font-family: var(--mono); font-size: 13px; }
.files-sha { font-size: 12px; }

.diff-lines { margin-top: 2px; }
.diff-line {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.diff-line-sign { display: inline-block; min-width: 1em; }
.diff-line-del { color: var(--removed); }
.diff-line-ins { color: var(--added); }
.diff-line-ctx { color: var(--fog); }

.scriptlet { margin-bottom: 16px; }
.scriptlet:last-child { margin-bottom: 0; }
.hunk-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.scriptlet-name,
.hunk-kind { font-size: 13px; color: var(--paper); }

.dep-section { margin-bottom: 14px; }
.dep-section:last-child { margin-bottom: 0; }
.dep-heading {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fog);
  margin: 0 0 8px;
}
.dep-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dep-item { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.dep-name { font-size: 13px; }
.dep-constraint { color: var(--fog); font-size: 12px; }
.vuln-id { font-size: 12px; }

.hunk { margin-bottom: 18px; }
.hunk:last-child { margin-bottom: 0; }
.sxs { border-collapse: collapse; width: 100%; table-layout: fixed; }
.sxs th {
  color: var(--fog);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
  padding: 4px 12px 4px 0;
}
.sxs td {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  vertical-align: baseline;
  padding: 2px 12px 2px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.sxs td:empty::after { content: "\00a0"; }
.sxs-del { color: var(--removed); }
.sxs-ins { color: var(--added); }
.diff-open { text-decoration: none; margin-top: 12px; }

/* Narrow screens: stack the product rows. */
@media (max-width: 760px) {
  .header-row { gap: 16px; flex-wrap: wrap; }
  .product-row { grid-template-columns: 1fr; }
  .product-id { border-right: none; border-bottom: 1px solid var(--slate); }
  .product-kind { border-right: none; border-bottom: 1px solid var(--slate); }
}

/* Narrow screens: stack the timeline lanes, hairlines drop out. */
@media (max-width: 760px) {
  .tl-row { grid-template-columns: 1fr; }
  .tl-hairlines { display: none; }
  .tl-label { line-height: 1.4; padding-top: 4px; }
}
