/* Document (redesign) — page-specific layout.
   Shared primitives in src/styles/redesign.module.css; tokens in tokens.css. */

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 6px 24px 80px;
}

.backBtn {
  margin-bottom: 12px;
  padding-left: 6px;
}

/* ---- header ---- */
.docHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.docTitle {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 27px;
  line-height: 1.15;
  margin: 0;
  color: var(--text);
}
.docMeta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
  flex-wrap: wrap;
  font-size: 12px;
}
.reviewPill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  cursor: pointer;
  font-family: inherit;
}
.reviewPill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

/* ---- trash banner ---- */
.trashBanner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 18px;
  border-radius: var(--radius-card);
  border: 1px solid var(--red);
  background: var(--red-soft);
  flex-wrap: wrap;
}

/* ---- split ---- */
.docSplit {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 26px;
  align-items: start;
}
.docRail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 72px;
}

/* ---- content card ---- */
.contentHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  gap: 12px;
  flex-wrap: wrap;
}
/* scrollable content region (own scrollbar, independent of the rail) */
.contentScroll {
  max-height: calc(100vh - 210px);
  overflow-y: auto;
}
.docSource {
  margin: 0;
  padding: 18px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-dim);
  white-space: pre-wrap;
}
.mdBody {
  padding: 8px 22px 24px;
}

/* ---- chunks ---- */
.chunkList {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}
.chunkItem {
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--surface-2);
}
.chunkHead {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  margin-bottom: 7px;
}
.chunkBody {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-dim);
  margin: 0;
  white-space: pre-wrap;
}

/* ---- rail bits ---- */
.railTitle {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.toc {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
}
.tocLink {
  display: block;
  width: 100%;
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-dim);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  text-align: left;
  background: transparent;
  border: 0;
  white-space: normal;
  word-break: break-word;
}
.tocLink:hover {
  color: var(--text);
  background: var(--surface-2);
}
.tocLvl2 {
  padding-left: 18px;
  font-size: 12.5px;
}
.tocLvl3 {
  padding-left: 28px;
  font-size: 12.5px;
  color: var(--text-faint);
}

.metaDl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 14px;
  margin: 0;
}
.metaDl dt {
  font-size: 12.5px;
  color: var(--text-faint);
}
.metaDl dd {
  font-size: 12.5px;
  color: var(--text);
  margin: 0;
  text-align: right;
}
.metaTags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.metaTag {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-dim);
  display: inline-flex;
  gap: 5px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metaTag b {
  color: var(--text-faint);
  font-weight: 500;
}

.verList {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.verRow {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
}
.verRowActive {
  border-color: var(--primary-line);
  background: var(--primary-soft);
}
.verRowTop {
  display: flex;
  align-items: center;
  gap: 8px;
}
.verLink {
  cursor: pointer;
  border: 1px solid transparent;
  transition: filter 0.12s;
}
.verLink:hover {
  filter: brightness(1.08);
  text-decoration: underline;
}
.verMeta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  padding-left: 2px;
}
.verLock {
  color: var(--blue);
  display: inline-flex;
}

/* version-view banner — blue accent variant of the (red) trash banner */
.versionBanner {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.actList {
  display: flex;
  flex-direction: column;
  gap: 13px;
  max-height: 360px;
  overflow-y: auto;
}
.actRow {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.actDot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.actAgent {
  color: var(--violet);
}

@media (max-width: 860px) {
  .docSplit {
    grid-template-columns: 1fr;
  }
  .docRail {
    position: static;
  }
}
