/* /range-state board + the /s/<symbol> range-state card (feat/range-state).
   Dark design tokens from style.css only; logical properties throughout so the
   Arabic edition (dir=rtl) mirrors correctly. The position bar and the price
   cells are forced LTR: a price scale reads low -> high in every language. */

.rs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 640px), 1fr));
  gap: 14px;
  margin-block: 14px 8px;
}

.rs-market {
  padding: 14px 16px 10px;
  min-width: 0;
}
.rs-market.rs-compact {
  margin-block: 10px 8px;
}

.rs-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-block-end: 8px;
}
.rs-title {
  font-size: 1.05rem;
  flex: 0 0 auto;
}
.rs-title a {
  color: var(--text);
}
.rs-name {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 0.85rem;
}
.rs-asof {
  margin-inline-start: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--text-dim);
  text-align: end;
}
.rs-stale {
  color: var(--warn);
  border-color: var(--warn);
}

/* alignment: five segments, one per board timeframe */
.rs-align {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.rs-align-bar {
  display: inline-flex;
  gap: 2px;
  direction: ltr;
}
.rs-align-bar > span {
  width: 14px;
  height: 8px;
  border-radius: 2px;
  background: var(--border);
}
.rs-align-bar .rs-seg-up {
  background: var(--live);
}
.rs-align-bar .rs-seg-dn {
  background: var(--warn);
}

/* direction colors: hue AND shape (arrow) carry the meaning */
.rs-up {
  color: var(--live);
}
.rs-dn {
  color: var(--warn);
}
.rs-arrow {
  font-size: 0.95rem;
}
.rs-hist {
  display: inline-flex;
  gap: 3px;
  font-size: 0.8rem;
  direction: ltr;
}
.rs-none {
  color: var(--text-dim);
}

.rs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.rs-table th,
.rs-table td {
  padding: 6px 8px;
  text-align: start;
  border-block-end: 1px solid var(--border);
  white-space: nowrap;
}
.rs-table thead th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  font-weight: 600;
}
.rs-table tbody tr:last-child > * {
  border-block-end: 0;
}
.rs-table tbody th {
  font-weight: 700;
}
.rs-table .rs-num {
  text-align: end;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  direction: ltr;
  unicode-bidi: isolate;
}
.rs-empty {
  color: var(--text-dim);
  font-style: italic;
}

/* position of the last close inside the range: 0% = low edge, 100% = high edge */
.rs-pos-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.rs-pos {
  position: relative;
  display: inline-block;
  width: 88px;
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  direction: ltr;
}
.rs-pos-mid {
  position: absolute;
  inset-block: -2px;
  left: 50%;
  width: 1px;
  background: var(--text-dim);
  opacity: 0.6;
}
.rs-pos-dot {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-raised);
}
.rs-pos-num {
  min-width: 3ch;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* context under the board */
.rs-context {
  margin-block-start: 18px;
}
.rs-read {
  max-width: 78ch;
}
.rs-base {
  margin-block: 14px;
}
.rs-base h2 {
  margin-block: 0 4px;
  font-size: 1.05rem;
}
.rs-base-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
}
.rs-base-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.rs-base-tf {
  color: var(--text-dim);
  font-size: 0.8rem;
  min-width: 2.2ch;
}
.rs-base-list strong {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}
.rs-base-n {
  color: var(--text-dim);
  font-size: 0.72rem;
}
.rs-disclaimer {
  max-width: 78ch;
}
.rs-emptystate {
  margin-block: 14px;
}

/* ---- mobile: the table becomes one labelled card per timeframe ---------- */
@media (max-width: 640px) {
  .rs-market {
    padding: 12px;
  }
  .rs-asof {
    margin-inline-start: 0;
    flex-basis: 100%;
    text-align: start;
  }
  .rs-table,
  .rs-table tbody {
    display: block;
  }
  .rs-table thead {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .rs-table tr.rs-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 14px;
    padding: 10px 12px;
    margin-block-end: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
  }
  .rs-table tr.rs-row > th,
  .rs-table tr.rs-row > td {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0;
    border: 0;
    white-space: normal;
  }
  .rs-table tr.rs-row > th {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: baseline;
    font-size: 1rem;
  }
  .rs-table tr.rs-row > th::before {
    content: none;
  }
  .rs-table tr.rs-row > td::before {
    content: attr(data-label);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-dim);
  }
  .rs-table tr.rs-row > td.rs-num {
    text-align: start;
  }
  .rs-table tr.rs-row-empty > td {
    grid-column: 1 / -1;
  }
  .rs-table tr.rs-row-empty > td::before {
    content: none;
  }
  .rs-pos {
    width: 100%;
    max-width: 140px;
  }
}
