/* Tutorial page. Builds on styles.css (colours, theme, buttons, topbar). */

.tutorial-page {
  display: block;
  height: auto;
  min-height: 100%;
}
.tutorial-page .topbar {
  position: sticky;
  top: 0;
  z-index: 5;
}
.tutorial-page a.brand {
  color: inherit;
  text-decoration: none;
}
.tutorial-page a.btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.tut-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  max-width: 1180px;
  margin: 0 auto;
  gap: 40px;
  padding: 0 24px;
}

/* Contents */
.tut-toc {
  position: sticky;
  top: 64px;
  align-self: start;
  max-height: calc(100vh - 80px);
  overflow: auto;
  padding: 24px 0;
  font-size: 13.5px;
}
.tut-toc-title {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.tut-toc ol {
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
}
.tut-toc li {
  padding: 2px 0;
}
.tut-toc a {
  color: var(--text);
  text-decoration: none;
}
.tut-toc a:hover {
  color: var(--accent-2);
}

/* Article */
.tut-main {
  padding: 24px 0 80px;
  max-width: 780px;
  line-height: 1.65;
}
.tut-main h1 {
  font-size: 30px;
  margin: 8px 0 8px;
}
.tut-main h2 {
  font-size: 21px;
  margin: 0 0 10px;
}
.tut-main h3 {
  font-size: 15px;
  margin: 18px 0 6px;
}
.tut-main section {
  padding: 26px 0 8px;
  border-top: 1px solid var(--border);
  margin-top: 26px;
  scroll-margin-top: 64px;
}
.tut-main a {
  color: var(--accent-2);
}
.tut-main code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  overflow-wrap: anywhere;
}
.tut-main pre.code {
  font-size: 12.5px;
  line-height: 1.55;
  padding: 14px 16px;
  border-radius: var(--radius);
  overflow-x: auto;
}
.tut-main pre.code .c {
  color: var(--muted);
}
.tut-main kbd {
  font-family: var(--mono);
  font-size: 0.82em;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--panel);
  white-space: nowrap;
}
.lead {
  font-size: 16.5px;
  color: var(--text);
}
.note,
.muted-note {
  border-left: 3px solid var(--accent);
  background: var(--panel);
  padding: 10px 14px;
  border-radius: 0 6px 6px 0;
}
.muted-note {
  border-left-color: var(--border);
  color: var(--muted);
  font-size: 13.5px;
}
.steps li {
  margin-bottom: 6px;
}
.pill {
  font-family: var(--mono);
  font-size: 12px;
  padding: 1px 7px;
  border-radius: 99px;
}
.pill.ok {
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 15%, transparent);
}
.dot {
  color: var(--warn);
}

/* Tables */
.tut-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin: 10px 0 14px;
}
.tut-table th,
.tut-table td {
  text-align: left;
  vertical-align: top;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
}
.tut-table th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.tut-table.compact td:first-child {
  white-space: nowrap;
  width: 1%;
}

/* Layout diagram */
.diagram {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  font-size: 12px;
  background: var(--panel);
  margin: 10px 0;
}
.d-top,
.d-box,
.d-side {
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--muted);
}
.d-top {
  margin-bottom: 8px;
}
.d-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
}
.d-col {
  display: grid;
  gap: 6px;
}
.d-box.tall {
  min-height: 70px;
}

/* Timing legend */
.wf-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 13px;
  margin: 8px 0;
}
.wf-legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
}

/* FAQ */
.faq dt {
  font-weight: 600;
  margin-top: 12px;
}
.faq dd {
  margin: 2px 0 0;
  color: var(--muted);
}
.tut-foot {
  display: flex;
  gap: 8px;
  margin-top: 40px;
}

@media (max-width: 860px) {
  .tut-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .tut-toc {
    position: static;
    max-height: none;
    border-bottom: 1px solid var(--border);
  }
  .tut-toc ol {
    columns: 2;
  }
}
