/* Onchain Stocks: light theme. Layout inspired by the Stitch reference (docs/design-refs). All colors are tokens. */
:root {
  --page: #f7f8fd;
  --card: #ffffff;
  --tint: #eef1fc;
  --tint-strong: #e2e7fa;
  --border: #dde2f0;
  --border-strong: #b8bdd0;
  --text: #141b2b;
  --muted: #4d5566;
  --signal: #3563ad;        /* logo blue; one job: action (links, buttons, selection). 5.93:1 on white */
  --signal-hover: #2c5596;  /* same color, pressed/hover state. 7.38:1 on white */
  --warn-text: #7a4100;
  --stop-text: #93000a;
  --radius: 6px;
  --radius-lg: 10px;
  --font: "Libre Franklin", "Franklin Gothic Medium", "Helvetica Neue", Arial, sans-serif; /* Franklin Gothic lineage: US stock tables and financial print */
  --bar-h: 0px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--text); font: 16px/1.55 var(--font); font-variant-numeric: tabular-nums; padding-bottom: var(--bar-h); }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 40px; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 23px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0; }
a { color: var(--signal); text-underline-offset: 2px; }
a:hover { color: var(--signal-hover); }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; border-radius: 3px; }
code { font-size: 14px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* Header and demo strip */
.site-header { background: var(--card); border-bottom: 1px solid var(--border); }
.site-header .container { display: flex; align-items: center; gap: 32px; min-height: 64px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 9px; font-size: 21px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); text-decoration: none; white-space: nowrap; }
.logo span { font-weight: 400; margin-left: -3px; }
.logo:hover { color: var(--text); }
.nav { display: flex; gap: 24px; flex-wrap: wrap; font-size: 15px; font-weight: 500; }
.nav .soon { color: var(--muted); }
.search { margin-left: auto; display: flex; gap: 8px; align-items: center; position: relative; }
.search input { width: 240px; }
.search-msg { position: absolute; top: 100%; right: 0; margin-top: 4px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; font-size: 14px; width: 280px; z-index: 5; }
.proto-bar { background: var(--tint); border-bottom: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.proto-bar .container { padding-top: 7px; padding-bottom: 7px; }

/* Controls */
input, select { font: inherit; color: inherit; border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 8px 10px; background: var(--card); min-height: 44px; }
select { width: 100%; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; min-height: 44px; padding: 10px 18px; border-radius: var(--radius); border: 1px solid var(--signal); background: var(--signal); color: #fff; text-decoration: none; cursor: pointer; text-align: center; }
.btn:hover { background: var(--signal-hover); color: #fff; }
.btn-block { width: 100%; }
.btn-secondary { background: var(--card); color: var(--signal); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--tint); color: var(--signal-hover); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--tint); color: var(--muted); border-color: var(--border); cursor: not-allowed; }
.btn-note { font-size: 13px; color: var(--muted); text-align: center; margin-top: 8px; }

/* Tags and statuses: always a text label, color only reinforces */
.tag { font-size: 13px; font-weight: 600; color: var(--muted); }  /* a label is text, not a chip (K12) */
.tag-demo { font-weight: 400; font-style: italic; }
.tag-code { font-size: 15px; font-weight: 700; color: var(--muted); }
.asset-title .tag-code { font-size: 24px; font-weight: 600; }
.tag-warn { color: var(--warn-text); }
.tag-stop { color: var(--stop-text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.caveat { display: block; font-size: 13px; margin-top: 2px; }
.caveat.is-warn { color: var(--warn-text); }
.caveat.is-stop { color: var(--stop-text); }
.missing { color: var(--muted); font-style: italic; }

/* Cards and page grid */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.crumbs { font-size: 13px; color: var(--muted); padding: 18px 0 14px; }
.crumbs a { color: var(--muted); }
.page { padding-bottom: 64px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "head aside" "main aside"; gap: 24px 28px; align-items: start; }
.layout > .l-head { grid-area: head; }
.layout > .l-main { grid-area: main; min-width: 0; }
.layout > .l-aside { grid-area: aside; position: sticky; top: 16px; }
.section { margin-top: 36px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head p { margin-top: 4px; }

/* Asset header */
.asset-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.asset-meta { color: var(--muted); margin-top: 6px; font-size: 15px; }
.asset-desc { margin-top: 14px; max-width: 68ch; }
.data-panel { margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--tint); font-size: 14px; }
.data-panel strong { display: block; color: var(--text); }

/* Asset logos (monogram when no logo is available) */
.asset-logo { flex: none; width: var(--size); height: var(--size); display: inline-grid; place-items: center; border: 1px solid var(--border); border-radius: calc(var(--size) / 4); background: var(--card); overflow: hidden; }
.asset-logo img { width: 62%; height: 62%; }
.asset-logo.is-mono { background: var(--tint); color: var(--signal); font-weight: 700; font-size: calc(var(--size) * 0.3); letter-spacing: -0.02em; }
.product-cell { display: inline-flex; gap: 10px; align-items: flex-start; }
.cta-sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* Sourced data */
.key-fact { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--border-strong); background: var(--card); border-radius: var(--radius); font-size: 15px; max-width: 68ch; }
.key-fact strong { font-weight: 800; }
.cell-sub { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; white-space: normal; }
.ident { display: block; overflow-wrap: anywhere; }
.ident + .ident { margin-top: 6px; }
ul.plain { margin: 0; padding-left: 18px; }
ul.plain li + li { margin-top: 3px; }
details.more { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
details.more summary, details.sources summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--signal); }
details.sources { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
details.sources ul { margin: 8px 0 0; padding-left: 18px; }
details.sources li { margin-top: 6px; overflow-wrap: anywhere; }

/* Versions table: stacked blocks on mobile, same labels */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 14px; font-weight: 700; color: var(--text); background: var(--tint); border-bottom: 1px solid var(--border); padding: 10px 14px; }
.table td { border-bottom: 1px solid var(--border); padding: 16px 14px; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-selected td { background: #f5f7ff; }
.table .row-actions { text-align: right; white-space: nowrap; }
.table-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); padding: 10px 2px 0; }

/* Versions table column widths (desktop only: on mobile rows become stacked blocks) */
@media (min-width: 721px) {
  .table.versions { table-layout: fixed; }
  .table.versions th:nth-child(1) { width: 27%; }
  .table.versions th:nth-child(2) { width: 19%; }
  .table.versions th:nth-child(3) { width: 15%; }
  .table.versions th:nth-child(5) { width: 150px; }
  .table.versions .row-actions { white-space: normal; }
  .table.versions .row-actions .btn { white-space: nowrap; }
}

/* Collapsible explainer */
details.explain { background: var(--tint); border: 1px solid var(--border); border-radius: var(--radius-lg); }
details.explain summary { cursor: pointer; padding: 16px 20px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details.explain summary::-webkit-details-marker { display: none; }
details.explain summary::after { content: "+"; color: var(--signal); font-weight: 700; }
details.explain[open] summary::after { content: "–"; }
.explain-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; padding: 0 20px 20px; font-size: 15px; }
.explain-grid h3 { font-size: 15px; margin-bottom: 6px; }

/* Characteristics compare */
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
dl.fields { margin: 12px 0 0; display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 14px; font-size: 15px; }
dl.fields dt { color: var(--muted); }
dl.fields dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.source { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }

/* Related content */
.related { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.related .item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.related .kind { font-size: 13px; color: var(--muted); }
.related .title { font-weight: 600; margin-top: 4px; }

/* Buy gateway (sticky aside) */
.gateway h2 { font-size: 20px; margin-top: 4px; }
.gateway .intro { font-size: 14px; color: var(--muted); margin: 6px 0 16px; }
.tiles { display: grid; gap: 8px; }
.tile { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; background: var(--card); }
.tile input { margin: 3px 0 0; width: 18px; height: 18px; min-height: 0; accent-color: var(--signal); }
.tile:has(input:checked) { border-color: var(--signal); box-shadow: inset 0 0 0 1px var(--signal); background: #f5f7ff; }
.tile .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.gateway .btn-block { margin-top: 16px; }
.gateway .alt { display: block; text-align: center; font-size: 14px; margin-top: 10px; }
.gateway .rules { list-style: none; padding: 14px 0 0; margin: 16px 0 0; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.gateway .rules li + li { margin-top: 4px; }

/* Buy page */
.buy-head { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
.buy-head .lead { margin-top: 8px; color: var(--muted); max-width: 60ch; }
.country-box { background: var(--tint); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.country-box label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.country-box .note { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.selected-bar { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; border-top: 1px solid var(--border); margin-top: 20px; padding-top: 16px; }
.selected-bar .label { font-size: 14px; font-weight: 700; }
.selected-bar select { width: auto; max-width: 100%; }
.routes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.route-tabs { display: none; }
.route-head { display: flex; gap: 12px; align-items: flex-start; padding-bottom: 14px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.route-num { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius); font-weight: 700; font-size: 14px; color: var(--signal); background: var(--tint); }
.profile { background: var(--tint); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; font-size: 14px; margin-bottom: 14px; }
.option + .option { margin-top: 10px; }
.option-name { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 600; }
.steps-title { font-size: 15px; margin: 18px 0 8px; }
ol.steps { margin: 0; padding-left: 22px; font-size: 15px; }
ol.steps li { padding: 3px 0; }
.route-cta { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.empty { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 14px 16px; color: var(--muted); font-size: 15px; background: var(--card); }
.swap { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 14px; background: var(--tint); margin-top: 16px; }
.swap .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 12px; }
.swap label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }
.swap input { width: 100%; }
.info-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; font-size: 15px; }
.info-cols > div { border-left: 2px solid var(--border); padding-left: 14px; }
.info-cols h3 { font-size: 15px; margin-bottom: 6px; }

/* Mobile sticky bar */
.mbar { display: none; }

.site-footer { border-top: 1px solid var(--border); background: var(--card); padding: 24px 0 32px; font-size: 14px; color: var(--muted); }

@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "aside" "main"; }
  .layout > .l-aside { position: static; }
  .gateway .btn-block, .gateway .alt, .gateway .rules { display: none; }
  .buy-head { grid-template-columns: minmax(0, 1fr); }
  .routes { grid-template-columns: minmax(0, 1fr); }
  .route-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--tint); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 14px; }
  .route-tabs button { font: inherit; font-weight: 600; min-height: 52px; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--muted); cursor: pointer; }
  .route-tabs button[aria-selected="true"] { background: var(--card); color: var(--signal); border-color: var(--signal); }
  .route-tabs button .sub { display: block; font-size: 12px; font-weight: 400; }
  .routes > .route.is-hidden-mobile { display: none; }
  .info-cols, .explain-grid, .related { grid-template-columns: minmax(0, 1fr); }
  :root { --bar-h: 76px; }
  .mbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--card); border-top: 1px solid var(--border); box-shadow: 0 -2px 10px rgba(20, 27, 43, 0.06);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); align-items: center; gap: 12px; }
  .mbar .what { flex: 1; min-width: 0; font-size: 13px; line-height: 1.3; color: var(--muted); }
  .mbar .what strong { display: block; font-size: 15px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mbar .btn { flex: none; }
}

@media (max-width: 720px) {
  .container { padding: 0 16px; }
  h1 { font-size: 27px; }
  .card { padding: 18px; }
  .site-header .container { gap: 10px 20px; padding-top: 12px; padding-bottom: 12px; }
  .nav { order: 3; width: 100%; gap: 16px; font-size: 14px; }
  .search { margin-left: 0; width: 100%; order: 2; }
  .search input { flex: 1; width: auto; min-width: 0; }
  .search-msg { left: 0; width: auto; }
  .table-wrap { background: transparent; border: 0; border-radius: 0; overflow: visible; }
  .table-wrap { position: relative; }
  .table thead { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table thead tr, .table thead th { display: block; width: 1px; padding: 0; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 8px 14px; }
  .table tr + tr { margin-top: 10px; }
  .table tr.is-selected { border-color: var(--signal); box-shadow: inset 0 0 0 1px var(--signal); }
  .table td, .table tr:last-child td { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); background: transparent; }
  .table tr td:last-child { border-bottom: 0; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: 13px; }
  .table .row-actions { text-align: left; white-space: normal; }
  .table .row-actions .btn { width: 100%; }
  dl.fields { grid-template-columns: 100px minmax(0, 1fr); }
  .swap .row { grid-template-columns: minmax(0, 1fr); }
}

/* External link icon (replaces a glyph) */
.ext { width: 0.8em; height: 0.8em; margin-left: 3px; vertical-align: -0.05em; }

/* Signature detail: the claim chain. What the reader actually holds, read top-down from them to the share. */
.chain { display: flex; flex-direction: column; align-items: flex-start; margin: 14px 0 6px; font-size: 13.5px; }
.chain .node { border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 6px 10px; background: var(--card); line-height: 1.3; max-width: 100%; }
.chain .node b { display: block; font-weight: 700; }
.chain .node.is-you { background: var(--text); color: #fff; border-color: var(--text); }
.chain .node.is-none { border-style: dashed; color: var(--stop-text); }
.chain .node.is-unknown { border-style: dashed; color: var(--muted); }
.chain .link { display: flex; align-items: center; gap: 8px; padding: 3px 0 3px 14px; color: var(--muted); font-size: 12.5px; }
.chain .link::before { content: ""; width: 0; height: 20px; border-left: 1px solid var(--border-strong); }
