/* =========================================================================
   Ascend Explorer — preprod evidence explorer
   Brand tokens lifted verbatim from ascend-perps-client (dark theme):
   src/app/globals.css `.dark` block + DESIGN.md. Delight VF is the app-wide
   face; DM Mono carries hashes and tabular numerics; terracotta #F35233 is
   the accent, reserved for actions and current selection.
   ========================================================================= */

@font-face {
  font-family: "Delight";
  src: url("./assets/delight-vf.ttf") format("truetype-variations");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "DM Mono";
  src: url("./assets/dm-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "DM Mono";
  src: url("./assets/dm-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  /* ascend-perps-client dark tokens (OKLCH, verbatim) */
  --app: oklch(0.17 0.008 320);
  --surface: oklch(0.19 0.008 320);
  --surface-2: oklch(0.23 0.006 310);
  --card: oklch(0.24 0.006 300);
  --line: oklch(0.27 0.005 320);
  --fg: oklch(0.97 0.004 320);
  --muted: oklch(0.66 0.012 260);
  --accent: oklch(0.66 0.19 33);        /* terracotta #F35233 */
  --accent-hover: oklch(0.7 0.18 35);
  --accent-soft: oklch(0.8 0.06 40);
  --long: oklch(0.74 0.19 150);
  --short: oklch(0.68 0.21 28);
  --bg-gradient: #301d19;               /* client's warm body backdrop */

  --font-sans: "Delight", system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --shell: 1180px;
  --radius: 12px;
}

/* Shape rule: containers 12px (--radius), controls 8px, small controls and
   status tags 4-6px. No pill radii; entity references render as plain text. */

* { box-sizing: border-box; }

html { scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--app);
  color: var(--fg);
  font-family: var(--font-sans);
  font-weight: 460;
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--accent);
}

/* Browser surfaces carry the theme too. */
::selection { background: color-mix(in oklab, var(--accent) 40%, transparent); color: var(--fg); }
* { scrollbar-color: var(--surface-2) transparent; scrollbar-width: thin; }
*::-webkit-scrollbar { height: 8px; width: 8px; }
*::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: var(--line); }

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

a { color: var(--fg); }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}
/* Route changes move focus to the new page's h1 for screen readers;
   the heading itself never needs a visible ring. */
h1[tabindex="-1"]:focus { outline: none; }

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.08em 0.35em;
}

.shell { max-width: var(--shell); margin: 0 auto; padding: 0 24px; }

.icon { width: 15px; height: 15px; display: inline-block; vertical-align: -2px; flex: none; }

/* ------------------------------- header ------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in oklab, var(--app) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-row {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 58px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { border-radius: 7px; display: block; }
.brand-word { display: block; height: 15px; width: auto; }
.brand-suffix {
  font-family: var(--font-sans);
  font-size: 12.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 1px; /* optical: align with the wordmark baseline */
}
/* status sits at the right edge of the header; the search (when visible)
   keeps its auto left margin, so the status trails it flush right */
.header-status { white-space: nowrap; }
body[data-route="home"] .header-status { margin-left: auto; }
.header-nav { display: flex; gap: 4px; }
.header-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 450;
  padding: 5px 10px;
  border-radius: 7px;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.header-nav a:hover { color: var(--fg); background: var(--surface-2); }
.header-nav a[aria-current="page"] { color: var(--fg); background: var(--surface-2); }

.header-search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 10px;
  height: 34px;
  width: 300px;
  color: var(--muted);
  transition: border-color 0.15s ease;
}
.header-search:focus-within { border-color: var(--accent); color: var(--fg); }
.header-search input {
  background: none;
  border: 0;
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 13.5px;
  width: 100%;
  height: 100%;
  padding: 0;
}
.header-search input:focus { outline: none; }
.header-search input::placeholder { color: var(--muted); }
body[data-route="home"] .header-search { display: none; }

@media (max-width: 900px) {
  .header-search { width: 100%; order: 3; margin-left: 0; }
  body[data-route="home"] .header-search { display: none; }
}
@media (max-width: 560px) {
  .header-nav { margin-left: auto; }
  .header-nav a { padding: 5px 7px; font-size: 13px; }
  .brand-suffix { font-size: 10px; }
}

/* ------------------------------- main --------------------------------- */
#app { min-height: 62vh; padding-bottom: 64px; }

.boot-skeleton { padding-top: 48px; }
.skel {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  border-radius: 8px;
}
@media (prefers-reduced-motion: no-preference) {
  .skel { animation: shimmer 1.4s linear infinite; }
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skel-title { height: 34px; width: 40%; margin-bottom: 22px; }
.skel-row { height: 52px; margin-bottom: 10px; }

/* ------------------------------ home hero ------------------------------ */
.home-hero {
  padding: 52px 0 34px;
}
.home-hero h1 {
  font-size: clamp(28px, 4.4vw, 42px);
  line-height: 1.08;
  font-weight: 620;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.home-lede { color: var(--muted); font-size: 15.5px; max-width: 74ch; margin: 0 0 26px; }
.home-lede a { color: var(--accent-soft); }

.hero-search {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  height: 54px;
  padding: 0 8px 0 18px;
  max-width: 780px;
  color: var(--muted);
  box-shadow: 0 12px 32px -18px oklch(0 0 0 / 0.55);
  transition: border-color 0.15s ease;
}
.hero-search:focus-within { border-color: var(--accent); }
.hero-search .icon { width: 18px; height: 18px; }
.hero-search input {
  flex: 1;
  background: none;
  border: 0;
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  min-width: 0;
  height: 100%;
  padding: 0;
}
.hero-search input:focus { outline: none; }
.hero-search input::placeholder { color: var(--muted); }
.hero-search button {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 520;
  color: var(--fg);
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  height: 38px;
  padding: 0 20px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.hero-search button:hover { background: var(--accent-hover); }
.search-error {
  margin: 10px 2px 0;
  font-size: 13.5px;
  color: var(--short);
}

/* --------------------------- stat band ---------------------------------
   Not cards: a hairline-divided band on the page surface. The 1px grid gap
   over a line-colored container draws the inner dividers. */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 30px 0 8px;
}
@media (max-width: 860px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .stat-grid { grid-template-columns: 1fr; } }
.stat-card {
  background: var(--app);
  padding: 14px 18px 12px;
  min-width: 0;
}
.stat-card:nth-child(3n + 1) { padding-left: 0; }
@media (max-width: 860px) {
  .stat-card:nth-child(3n + 1) { padding-left: 18px; }
  .stat-card:nth-child(2n + 1) { padding-left: 0; }
}
@media (max-width: 460px) {
  .stat-card, .stat-card:nth-child(3n + 1), .stat-card:nth-child(2n + 1) { padding-left: 0; }
}
.stat-label.has-tip { cursor: help; border-bottom: 1px dotted var(--line); width: fit-content; }
.stat-value-link { text-decoration: none; }
.stat-value-link:hover { color: var(--accent); }
.stat-card .stat-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.stat-card .stat-value {
  display: block;
  font-family: var(--font-sans);
  font-size: 23px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--fg);
  overflow-wrap: anywhere;
}
.stat-card .stat-value .unit { font-size: 13px; color: var(--muted); margin-left: 4px; }
.stat-value.good { color: var(--long); }

/* ------------------------------ sections ------------------------------- */
.page-section { margin-top: 40px; }
.section-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.section-row h2 { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.section-row .section-note { color: var(--muted); font-size: 13px; }
.see-all {
  font-size: 13.5px;
  font-weight: 480;
  color: var(--accent-soft);
  text-decoration: none;
  white-space: nowrap;
}
.see-all:hover { color: var(--accent-hover); }

.page-head { padding: 40px 0 6px; }
.page-head h1 { font-size: 26px; font-weight: 620; letter-spacing: -0.015em; margin: 0 0 6px; }
.page-head .page-sub { color: var(--muted); font-size: 14.5px; margin: 0; max-width: 80ch; }
.page-head .page-sub a { color: var(--accent-soft); }

.crumbs {
  font-size: 13.5px;
  color: var(--muted);
  margin: 22px 0 -26px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--fg); }
.crumbs .sep { opacity: 0.5; }
.crumbs .here { color: var(--fg); }

/* entity title with full hash + copy */
.entity-id {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.entity-hash {
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--accent-soft);
  overflow-wrap: anywhere;
  word-break: break-all;
}
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 9px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
  flex: none;
}
.copy-btn:hover { color: var(--fg); border-color: var(--muted); }
.copy-btn.copied { color: var(--long); border-color: color-mix(in oklab, var(--long) 45%, transparent); }

/* ------------------------------- tables -------------------------------- */
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-variant-numeric: tabular-nums;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table .td-empty { color: var(--muted); text-align: center; padding: 26px 14px; font-size: 13.5px; }

.td-step { font-family: var(--font-sans); font-size: 13.5px; font-weight: 480; color: var(--muted); white-space: nowrap; }
.td-desc { min-width: 240px; }
.td-fee { font-family: var(--font-sans); text-align: right; white-space: nowrap; }
.td-right { text-align: right; }
.td-time { font-family: var(--font-sans); font-size: 13px; color: var(--muted); white-space: nowrap; }
tr.row-ops .td-desc, tr.row-ops .td-fee { color: var(--muted); }

.hash-link {
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--accent-soft);
  text-decoration: none;
  border-bottom: 1px dotted color-mix(in oklab, var(--accent-soft) 55%, transparent);
  white-space: nowrap;
  transition: color 0.15s ease;
}
.hash-link:hover { color: var(--accent-hover); border-bottom-color: var(--accent-hover); }
.hash-link .icon { width: 11px; height: 11px; margin-left: 3px; opacity: 0.7; vertical-align: -1px; }

/* entity references: plain mono text, never boxed; links carry a dotted rule */
.chip {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  text-decoration: none;
}
a.chip {
  border-bottom: 1px dotted color-mix(in oklab, var(--muted) 55%, transparent);
  transition: color 0.15s ease, border-color 0.15s ease;
}
a.chip:hover { color: var(--fg); border-bottom-color: var(--fg); }

/* status vocabulary: quiet colored text for row states, a box only for the
   verifier's PASS/FAIL verdict */
.badge {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-counted { color: color-mix(in oklab, var(--long) 82%, var(--muted)); }
.badge-net {
  color: var(--accent-soft);
  border: 1px solid color-mix(in oklab, var(--accent) 35%, var(--line));
  border-radius: 5px;
  padding: 2px 7px;
}
.section-row .has-tip, .data-table .has-tip { cursor: help; }
.badge-ops { color: color-mix(in oklab, var(--muted) 72%, transparent); }
.badge-pass, .badge-fail { border-radius: 4px; padding: 2px 7px; }
.badge-pass {
  color: var(--long);
  background: color-mix(in oklab, var(--long) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--long) 35%, transparent);
}
.badge-fail {
  color: var(--short);
  background: color-mix(in oklab, var(--short) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--short) 35%, transparent);
}

/* flow reference — plain text link to the filtered list; the accent stays
   reserved for primary entities and selection */
.flow-badge {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  text-decoration: none;
  border-bottom: 1px dotted color-mix(in oklab, var(--muted) 55%, transparent);
  transition: color 0.15s ease, border-color 0.15s ease;
}
a.flow-badge:hover { color: var(--fg); border-bottom-color: var(--fg); }

/* ----------------------------- filter chips ---------------------------- */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 16px;
}
.filter-chip {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 460;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.filter-chip:hover { color: var(--fg); border-color: var(--muted); }
.filter-chip[aria-current="true"] {
  color: var(--fg);
  background: color-mix(in oklab, var(--accent) 18%, var(--surface));
  border-color: color-mix(in oklab, var(--accent) 55%, var(--line));
}
.filter-chip .count { font-family: var(--font-sans); font-size: 12.5px; color: var(--muted); margin-left: 6px; }
.filter-chip[aria-current="true"] .count { color: var(--accent-soft); }

/* ------------------------------ detail kv ------------------------------ */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 20px;
  margin-top: 18px;
}
.panel-title {
  font-size: 15px;
  font-weight: 580;
  margin: 16px 0 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.kv { margin: 0; }
.kv-row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.kv-row:last-child { border-bottom: 0; }
.kv-row dt {
  font-family: var(--font-sans);
  font-size: 12.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 2px;
}
.kv-row dd { margin: 0; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.kv-row dd .mono { font-size: 13.5px; }
@media (max-width: 640px) {
  .kv-row { grid-template-columns: 1fr; gap: 3px; padding: 9px 0; }
}

.desc-line { font-size: 14.5px; }

/* verifier checks */
.check-list { list-style: none; margin: 6px 0 14px; padding: 0; }
.check-list li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--muted);
  padding: 4.5px 0;
}
.check-list .icon { width: 13px; height: 13px; color: var(--long); align-self: center; }
.check-list li.fail .icon { color: var(--short); }
.check-list li .check-text { overflow-wrap: anywhere; }

/* ------------------------------ KEL events ----------------------------- */
.kel-list { margin-top: 4px; }
.kel-event {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 12px 16px;
  margin: 10px 0;
}
.kel-event-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.kel-type {
  font-family: var(--font-sans);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 2px 8px;
  color: var(--fg);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.kel-type.ixn { color: var(--muted); }
.kel-seq { font-family: var(--font-sans); font-size: 13px; color: var(--fg); }
.kel-said { font-family: var(--font-mono); font-size: 13px; color: var(--muted); overflow-wrap: anywhere; min-width: 0; }
.kel-when { font-family: var(--font-sans); font-size: 12.5px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.kel-seals { margin: 10px 0 0; padding: 0; list-style: none; border-top: 1px dashed var(--line); }
.kel-seals li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 7px 0 0;
  font-size: 13px;
  flex-wrap: wrap;
}
.seal-kind { font-family: var(--font-sans); font-size: 12.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); flex: none; }
.seal-digest { font-family: var(--font-mono); font-size: 13px; color: var(--fg); overflow-wrap: anywhere; min-width: 0; }
.kel-note { font-size: 13.5px; color: var(--muted); margin: 8px 2px; }

/* ------------------------------ misc ----------------------------------- */
.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 34px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin-top: 18px;
}
.empty-state .empty-title { color: var(--fg); font-weight: 540; display: block; margin-bottom: 6px; font-size: 15px; }
.empty-state code { font-size: 13px; }

.load-error { color: var(--short); font-size: 14px; font-family: var(--font-sans); padding: 40px 0; }

.fine { color: var(--muted); font-size: 12.5px; margin: 10px 2px 0; overflow-wrap: anywhere; }
.note-line { color: var(--muted); font-size: 13px; margin: 10px 2px 0; }
.note-line a { color: var(--accent-soft); }

/* about page prose — hairline-topped entries, not boxed cards */
.about-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 40px;
  margin-top: 18px;
}
@media (max-width: 720px) { .about-cols { grid-template-columns: 1fr; } }
.about-card {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.about-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 570;
}
.about-card p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.about-card p:last-child { margin-bottom: 0; }
.about-card strong { color: var(--fg); font-weight: 520; }

/* ------------------------------- footer -------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 44px 0 36px;
}
.footer-title { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 16px; }
.disclosures {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px 28px;
  max-width: 100%;
}
.disclosures li {
  color: var(--muted);
  font-size: 13px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}
.disclosures strong { color: var(--fg); font-weight: 540; }
.footer-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 560px) {
  .data-table td, .data-table th { padding: 8px 10px; }
  .page-head { padding-top: 30px; }
  .home-hero { padding-top: 36px; }
}
