/* Documentation and quest-log pages - medieval pixel theme */

body.medieval-docs {
  background: var(--stone-deep);
  image-rendering: auto;
}

.doc-page {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 1.25rem;
  padding: 2rem 0 3.5rem;
  align-items: start;
}

@media (max-width: 768px) {
  .doc-page {
    grid-template-columns: 1fr;
  }
}

.doc-sidebar {
  position: sticky;
  top: calc(var(--site-scroll-padding, 88px) + 0.35rem);
  padding: 1rem 1rem 1.25rem;
}

.doc-main h2[id],
.doc-main h3[id],
.doc-main h4[id] {
  scroll-margin-top: var(--site-scroll-padding, 88px);
}

.doc-sidebar__title {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--torch);
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

.doc-sidebar a {
  display: block;
  font-family: var(--font-pixel);
  font-size: 7px;
  line-height: 2.2;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

.doc-sidebar a:hover,
.doc-sidebar a.is-active {
  color: var(--blood);
}

.doc-sidebar a.is-active {
  text-decoration: underline;
}

.doc-main {
  padding: 1.75rem 2rem 2.25rem;
  min-width: 0;
  overflow-x: auto;
}

.doc-main h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 400;
  color: var(--stone-deep);
  margin-bottom: 0.5rem;
  line-height: 1.05;
}

.doc-main > p:first-of-type,
.doc-lead {
  font-size: 1.1rem;
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
  max-width: 42rem;
}

.doc-main h2 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 400;
  color: var(--blood);
  margin: 2rem 0 0.65rem;
  padding-top: 0.5rem;
  border-top: 3px solid var(--parchment-dark);
}

.doc-main h2:first-of-type {
  margin-top: 1rem;
  border-top: none;
  padding-top: 0;
}

.doc-main h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--stone);
  margin: 1.25rem 0 0.4rem;
}

.doc-main p,
.doc-main li {
  margin-bottom: 0.75rem;
  color: var(--ink);
  max-width: 44rem;
}

.doc-main ul,
.doc-main ol {
  margin: 0 0 1rem 1.25rem;
  padding: 0;
}

.doc-main li {
  margin-bottom: 0.5rem;
}

.doc-main a {
  color: var(--blood);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.doc-main a:hover {
  color: var(--gold);
}

.doc-main code {
  font-family: var(--font-pixel);
  font-size: 7px;
  background: rgba(0, 0, 0, 0.06);
  padding: 3px 7px;
  border: 2px solid var(--parchment-dark);
  border-radius: 0;
  word-break: normal;
  overflow-wrap: anywhere;
}

.doc-main pre {
  font-family: var(--font-pixel);
  font-size: 7px;
  line-height: 1.7;
  background: var(--stone-deep);
  color: var(--parchment-mid);
  border: var(--frame) solid var(--pixel);
  box-shadow: 4px 4px 0 var(--pixel);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1rem 0 1.25rem;
  max-width: 100%;
}

.doc-main pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.doc-main strong {
  color: var(--stone-deep);
  font-weight: 600;
}

/* Quest steps (how-it-works) */
.quest-steps {
  list-style: none;
  margin: 1.5rem 0 2rem;
  padding: 0;
  counter-reset: quest;
}

.quest-steps li {
  counter-increment: quest;
  position: relative;
  margin: 0 0 0.85rem;
  padding: 1rem 1rem 1rem 3.5rem;
  background: rgba(255, 255, 255, 0.35);
  border: 2px solid var(--parchment-dark);
  box-shadow: 3px 3px 0 var(--pixel);
  max-width: 44rem;
}

.quest-steps li::before {
  content: counter(quest, upper-roman);
  position: absolute;
  left: 0.85rem;
  top: 0.95rem;
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--gold);
  line-height: 1;
}

.doc-index-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.doc-index-list li {
  margin: 0 0 0.65rem;
  padding: 0.85rem 1rem;
  border: 2px solid var(--parchment-mid);
  background: rgba(255, 255, 255, 0.25);
}

.doc-index-list a {
  font-family: var(--font-display);
  font-size: 1.2rem;
  text-decoration: none;
  color: var(--blood);
}

/* On-this-page TOC (api-reference, stream-studio, etc.) */
.doc-toc {
  box-sizing: border-box;
  padding: 1.15rem 1.3rem 1.2rem 1.55rem;
  margin-bottom: 1.5rem;
  background: rgba(255, 255, 255, 0.3);
  overflow: visible;
}

.doc-toc__title {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--torch);
  letter-spacing: 0.04em;
  margin: 0 0 0.6rem;
  padding-left: 4px;
  text-transform: uppercase;
}

.doc-toc a {
  display: block;
  font-family: var(--font-pixel);
  font-size: 7px;
  line-height: 2.2;
  padding-left: 4px;
  color: var(--ink-soft);
  text-decoration: none;
}

.doc-toc a:hover {
  color: var(--blood);
}

.api-table {
  width: 100%;
  max-width: 44rem;
  border-collapse: collapse;
  margin: 0.75rem 0 1.25rem;
  font-size: 0.95rem;
  table-layout: auto;
}

.api-table th,
.api-table td {
  border: 2px solid var(--parchment-dark);
  padding: 0.5rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.api-table th {
  background: rgba(0, 0, 0, 0.05);
  font-family: var(--font-pixel);
  font-size: 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stone);
}

.api-table th code,
.api-table td code {
  font-size: 7px;
  text-transform: none;
  letter-spacing: 0.04em;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  display: inline-block;
  vertical-align: baseline;
  max-width: none;
}

.api-table thead th:first-child,
.api-table tbody td:first-child {
  white-space: nowrap;
  width: 1%;
}

.endpoint-card {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.28);
  border: 2px solid var(--parchment-mid);
  box-shadow: 3px 3px 0 var(--pixel);
  max-width: 44rem;
}

.endpoint-card__line {
  margin-bottom: 0.5rem;
  font-family: var(--font-serif);
}

.method {
  display: inline-block;
  font-family: var(--font-pixel);
  font-size: 6px;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.45rem;
  margin-right: 0.35rem;
  border: 2px solid var(--pixel);
  vertical-align: middle;
}

.method--get {
  background: var(--emerald);
  color: #fff;
}

.method--post {
  background: var(--gold);
  color: var(--stone-deep);
}

.method--patch {
  background: var(--torch);
  color: var(--stone-deep);
}

.method--delete {
  background: var(--blood);
  color: #fff;
}

.doc-index-list a:hover {
  color: var(--gold);
}

.doc-index-list span {
  display: block;
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-top: 0.25rem;
  font-family: var(--font-serif);
}

.doc-back {
  display: inline-block;
  margin-top: 1.5rem;
  font-family: var(--font-pixel);
  font-size: 8px;
}

.doc-table {
  width: 100%;
  max-width: 44rem;
  border-collapse: collapse;
  margin: 0.75rem 0 1.25rem;
  font-size: 0.95rem;
  table-layout: auto;
}

.doc-table th,
.doc-table td {
  border: 2px solid var(--parchment-dark);
  padding: 0.5rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.doc-table th {
  font-family: var(--font-pixel);
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(0, 0, 0, 0.05);
  color: var(--stone-deep);
}

/* Identifier columns: keep field names on one line (no mid-word breaks). */
.doc-table th code,
.doc-table td code {
  font-size: 7px;
  text-transform: none;
  letter-spacing: 0.04em;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  display: inline-block;
  vertical-align: baseline;
  max-width: none;
}

.doc-table thead th:nth-child(2),
.doc-table tbody td:nth-child(2) {
  white-space: nowrap;
  width: 1%;
}

/* Default / Range column in 4-column tables only (not last column). */
.doc-table thead th:nth-child(3):not(:last-child),
.doc-table tbody td:nth-child(3):not(:last-child) {
  white-space: nowrap;
  width: 1%;
}

.doc-callout {
  max-width: 44rem;
  padding: 0.85rem 1rem;
  margin: 1rem 0;
  border: 2px solid var(--torch);
  background: rgba(255, 154, 60, 0.12);
  box-shadow: 3px 3px 0 var(--pixel);
}

/* Single-column pages without sidebar */
.doc-page--solo {
  grid-template-columns: 1fr;
  max-width: 720px;
}

.doc-page--solo .doc-main {
  max-width: none;
}
