/* ------------------------------------------------------------------
   Straits content pages (Chains, Docs)
   Loaded after styles.css; reuses its tokens, header and background.
   ------------------------------------------------------------------ */

/* The swap page pins to one viewport; content pages scroll instead. */
.page-doc {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: clamp(40px, 8vh, 90px);
}

.doc-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 940px;
  margin: clamp(26px, 5vh, 56px) auto 0;
}

/* ---------- Page masthead ---------- */
.doc-head {
  text-align: center;
  margin-bottom: clamp(22px, 4vh, 40px);
}

.doc-eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-size: clamp(11px, 1.3vw, 13px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #ffffff;
  margin-bottom: 10px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 2px 10px rgba(0, 0, 0, 0.75), 0 6px 26px rgba(0, 0, 0, 0.55);
}

.doc-title {
  margin: 0;
  font-size: clamp(28px, 4.6vw, 46px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9), 0 6px 22px rgba(0, 0, 0, 0.7), 0 14px 48px rgba(0, 0, 0, 0.5);
}

.doc-sub {
  margin: 12px auto 0;
  max-width: 620px;
  font-size: clamp(13.5px, 1.6vw, 15.5px);
  line-height: 1.6;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 2px 10px rgba(0, 0, 0, 0.75), 0 6px 26px rgba(0, 0, 0, 0.55);
}

/* ---------- Glass panel shared by both pages ---------- */
.doc-panel {
  background: rgba(16, 16, 18, 0.72);
  backdrop-filter: blur(22px) saturate(120%);
  -webkit-backdrop-filter: blur(22px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

/* ================= Chains page ================= */
.ch-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

.ch-search {
  position: relative;
  flex: 1 1 240px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  height: 42px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
}

.ch-search:focus-within {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.08);
}

.ch-search svg {
  flex-shrink: 0;
  color: #8a8a8a;
}

.ch-search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: 0;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14.5px;
}

.ch-search input::placeholder {
  color: #7a7a7a;
}

.ch-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.ch-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: #c2c2c2;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.ch-chip:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.ch-chip.on {
  background: #fff;
  border-color: #fff;
  color: #111;
}

.ch-chip b {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  opacity: 0.55;
}

/* ---------- Chain grid ---------- */
.ch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 12px;
}

.ch-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px;
  background: rgba(16, 16, 18, 0.72);
  backdrop-filter: blur(18px) saturate(118%);
  -webkit-backdrop-filter: blur(18px) saturate(118%);
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 15px;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.18s ease, background 0.18s ease;
}

.ch-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(24, 24, 27, 0.8);
}

.ch-logo {
  position: relative;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.ch-logo img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 50%;
}

.ch-logo span {
  font-family: var(--font-display);
  font-size: 17px;
  color: #dcdcdc;
}

.ch-body {
  min-width: 0;
  flex: 1;
}

.ch-name {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ch-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
  font-size: 11.5px;
  color: #8e8e8e;
  font-variant-numeric: tabular-nums;
}

.ch-meta em {
  font-style: normal;
  color: #b0b0b0;
  font-family: var(--font-mono);
  font-size: 11px;
}

.ch-tag {
  flex-shrink: 0;
  padding: 2.5px 7px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.ch-tag.t-EVM   { background: rgba(108, 142, 255, 0.14); color: #9db0ff; border-color: rgba(108, 142, 255, 0.28); }
.ch-tag.t-SVM   { background: rgba(153, 105, 229, 0.16); color: #c3a2f5; border-color: rgba(153, 105, 229, 0.3); }
.ch-tag.t-UTXO  { background: rgba(247, 147, 26, 0.15); color: #f0ae62; border-color: rgba(247, 147, 26, 0.3); }
.ch-tag.t-MVM   { background: rgba(77, 162, 255, 0.14); color: #86c2ff; border-color: rgba(77, 162, 255, 0.3); }

.ch-dest {
  margin-left: 6px;
  font-size: 10.5px;
  color: #d09a5a;
}

.ch-empty,
.ch-loading {
  grid-column: 1 / -1;
  padding: 44px 20px;
  text-align: center;
  color: #8a8a8a;
  font-size: 14px;
}

.ch-note {
  margin: 18px auto 0;
  max-width: 700px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: #f2f2f2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 2px 10px rgba(0, 0, 0, 0.75), 0 6px 26px rgba(0, 0, 0, 0.55);
}

/* ================= Docs page ================= */
.doc-layout {
  display: grid;
  grid-template-columns: 186px minmax(0, 1fr);
  gap: clamp(20px, 3vw, 38px);
  align-items: start;
}

.doc-toc {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 14px;
}

.doc-toc a {
  padding: 8px 11px;
  border-radius: 8px;
  color: #9b9b9b;
  font-size: 13px;
  text-decoration: none;
  line-height: 1.35;
  transition: background 0.15s ease, color 0.15s ease;
}

.doc-toc a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.doc-toc a.on {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 500;
}

.doc-body {
  padding: clamp(22px, 3.4vw, 38px);
}

.doc-sec {
  scroll-margin-top: 22px;
}

.doc-sec + .doc-sec {
  margin-top: clamp(30px, 4.6vh, 46px);
  padding-top: clamp(26px, 4vh, 40px);
  border-top: 1px solid rgba(255, 255, 255, 0.075);
}

.doc-body h2 {
  margin: 0 0 14px;
  font-size: clamp(19px, 2.4vw, 24px);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: #fff;
}

.doc-body h3 {
  margin: 26px 0 9px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #ededed;
}

.doc-body p {
  margin: 0 0 13px;
  font-size: 14.5px;
  line-height: 1.68;
  color: #bcbcbc;
}

.doc-body p:last-child {
  margin-bottom: 0;
}

.doc-body a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2.5px;
  text-decoration-color: rgba(255, 255, 255, 0.4);
}

.doc-body a:hover {
  text-decoration-color: #fff;
}

.doc-body strong {
  color: #f0f0f0;
  font-weight: 600;
}

.doc-body code {
  padding: 1.5px 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #e6e6e6;
}

/* Numbered walkthrough */
.doc-steps {
  counter-reset: s;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.doc-steps li {
  position: relative;
  counter-increment: s;
  padding: 0 0 0 42px;
  min-height: 30px;
}

.doc-steps li + li {
  margin-top: 18px;
}

.doc-steps li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  top: -1px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.doc-steps b {
  display: block;
  margin-bottom: 3px;
  font-size: 14.5px;
  font-weight: 600;
  color: #fff;
}

.doc-steps span {
  display: block;
  font-size: 14px;
  line-height: 1.62;
  color: #b2b2b2;
}

/* Fee / spec rows */
.doc-rows {
  margin: 16px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 12px;
  overflow: hidden;
}

.doc-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.022);
}

.doc-row + .doc-row {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.doc-row > b {
  flex: 0 0 148px;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
}

.doc-row > span {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  line-height: 1.58;
  color: #b2b2b2;
}

/* Callout */
.doc-call {
  display: flex;
  gap: 12px;
  margin: 18px 0 0;
  padding: 14px 16px;
  background: rgba(247, 147, 26, 0.07);
  border: 1px solid rgba(247, 147, 26, 0.22);
  border-radius: 12px;
}

.doc-call.is-good {
  background: rgba(86, 196, 130, 0.07);
  border-color: rgba(86, 196, 130, 0.22);
}

.doc-call i {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-style: normal;
  font-size: 15px;
  line-height: 1.5;
  color: #f0ae62;
}

.doc-call.is-good i {
  color: #7fd6a3;
}

.doc-call p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: #cfcfcf;
}

.doc-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 12px 20px;
  background: #fff;
  border-radius: 999px;
  color: #111;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.doc-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4);
  text-decoration: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .doc-layout {
    grid-template-columns: 1fr;
  }

  .doc-toc {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
  }

  .doc-toc a {
    font-size: 12.5px;
    padding: 7px 11px;
    background: rgba(255, 255, 255, 0.05);
  }
}

@media (max-width: 560px) {
  .ch-grid {
    grid-template-columns: 1fr;
  }

  .doc-row {
    flex-direction: column;
    gap: 4px;
  }

  .doc-row > b {
    flex: none;
  }
}

/* ================= Live benchmarks (index) =================
   Recent swaps + volume. Both fed by /api/stats, which only ever
   reports real settled swaps. The section stays hidden until the
   endpoint answers, so a failed fetch leaves no empty furniture. */
.bench {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(14px, 2vw, 22px);
  width: 100%;
  max-width: 920px;
  margin: clamp(40px, 8vh, 84px) auto clamp(20px, 4vh, 40px);
}

/* author display:grid would otherwise override the hidden attribute */
.bench[hidden] {
  display: none;
}

.bench-panel {
  min-width: 0;
  background: rgba(13, 13, 15, 0.74);
  backdrop-filter: blur(22px) saturate(120%);
  -webkit-backdrop-filter: blur(22px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.bench-title {
  margin: 0;
  padding: clamp(18px, 2.6vw, 26px) clamp(16px, 2.4vw, 26px) 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(17px, 2.2vw, 24px);
  font-weight: 400;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #fff;
}

.bench-inner {
  padding: clamp(16px, 2.6vw, 28px) clamp(12px, 4vw, 48px) clamp(20px, 3vw, 34px);
}

/* ---------- empty + error states ---------- */
.bench-empty {
  grid-column: 1 / -1;
  padding: 26px 18px 12px;
  text-align: center;
}

.bench-empty b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #e4e4e4;
}

.bench-empty span {
  display: block;
  margin: 7px auto 0;
  max-width: 330px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #8d8d8d;
}

/* ---------- recent swaps ---------- */
.rs-head,
.rs-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px minmax(0, 1fr) 96px;
  align-items: center;
  gap: 8px;
}

.rs-head {
  padding: 0 10px 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7e7e7e;
}

.rs-row {
  padding: 10px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #e8e8e8;
}

.rs-row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.032);
}

.rs-leg {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.rs-ico {
  position: relative;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
}

.rs-ico img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
}

.rs-ico span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  font-size: 9.5px;
  color: #d0d0d0;
}

.rs-amt {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.rs-arrow {
  display: grid;
  place-items: center;
  color: #6f6f6f;
}

.rs-time {
  text-align: right;
  font-size: 11.5px;
  color: #8d8d8d;
  white-space: nowrap;
}

/* ---------- volume ---------- */
.vol-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(150px, 1fr);
  gap: clamp(14px, 2.4vw, 26px);
  align-items: center;
}

.vol-chart {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  min-width: 0;
}

.vol-chart svg {
  grid-column: 2;
  grid-row: 1;
  display: block;
  width: 100%;
  height: clamp(150px, 20vw, 210px);
  overflow: visible;
}

.vol-y {
  position: relative;
  grid-column: 1;
  grid-row: 1;
  min-width: 44px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: #7c7c7c;
  text-align: right;
}

.vol-y span {
  position: absolute;
  right: 0;
  transform: translateY(-50%);
  white-space: nowrap;
}

.vol-axis {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: #7c7c7c;
}

.vol-figs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
  min-width: 0;
}

.vol-fig {
  min-width: 0;
}

.vol-fig em {
  display: block;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #d6a6ea;
  margin-bottom: 4px;
}

.vol-fig b {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.5vw, 15.5px);
  font-weight: 500;
  color: #fff;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vol-total {
  grid-column: 1 / -1;
  padding: 11px 13px;
  border-radius: 10px;
  background:
    repeating-linear-gradient(-45deg, rgba(255,255,255,0.035) 0 6px, transparent 6px 12px),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.vol-line { fill: none; stroke: #eaa6d6; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.vol-area { fill: url(#volGrad); }
.vol-grid { stroke: rgba(255, 255, 255, 0.07); stroke-width: 1; vector-effect: non-scaling-stroke; }

@media (max-width: 980px) {
  .bench { grid-template-columns: 1fr; }
  .vol-inner { grid-template-columns: 1fr; }
  .vol-figs { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .rs-head,
  .rs-row { grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr) 66px; gap: 5px; font-size: 11.5px; }
  .rs-time { font-size: 10.5px; }
}

.doc-wrap .fine-social { text-align: center; margin: 14px auto 0; max-width: none; }
