/* TileMap Studio — guide pages. Loaded after home.css and reuses its tokens,
   nav, buttons, FAQ and footer. Adds: page header, reading column with a
   sticky table of contents, code, tables, the autotile atlas diagram. */

:root { --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace; }

.page-head { padding-block: 56px 36px; }
.crumbs { font-size: 13.5px; color: var(--text-3); }
.crumbs a { color: var(--text-2); text-decoration: none; }
.crumbs a:hover { color: #fff; }
.page-head h1 {
  margin-top: 14px;
  max-width: 24ch;
  font-size: clamp(30px, 4.4vw, 46px);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #fff;
}
.answer { margin-top: 18px; max-width: 68ch; font-size: 18.5px; line-height: 1.6; color: var(--text); }
.updated { margin-top: 14px; font-size: 13.5px; color: var(--text-3); }

.page-grid {
  display: grid;
  grid-template-columns: 210px minmax(0, 720px);
  gap: 56px;
  padding-bottom: 72px;
  border-top: 1px solid var(--line);
  padding-top: 40px;
}
.page-grid:not(:has(.toc)) { grid-template-columns: minmax(0, 760px); }

/* table of contents */
.toc { position: sticky; top: 84px; align-self: start; font-size: 14px; }
.toc p { color: var(--text-3); font-size: 13px; margin-bottom: 10px; }
.toc ol { list-style: none; display: grid; gap: 2px; border-left: 1px solid var(--line-2); }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--text-2); text-decoration: none; line-height: 1.35; }
.toc a:hover { color: #fff; border-left-color: var(--blue); }

/* reading column */
.prose { min-width: 0; }
.prose > * + * { margin-top: 18px; }
.prose h2 { margin-top: 52px; font-size: 24px; line-height: 1.25; font-weight: 600; color: #fff; letter-spacing: -0.01em; scroll-margin-top: 84px; }
.prose > h2:first-child, .prose > figure:first-child + h2 { margin-top: 0; }
.prose > figure:first-child + h2 { margin-top: 44px; }
.prose h3 { font-size: 17px; font-weight: 600; color: #fff; }
.prose p, .prose li { color: var(--text-2); font-size: 16.5px; line-height: 1.7; }
.prose ul, .prose ol { padding-left: 22px; display: grid; gap: 8px; }
.prose li::marker { color: var(--text-3); }
.prose strong { color: var(--text); }
.prose em { color: var(--text); }
.note { font-size: 14.5px !important; color: var(--text-3) !important; }

code, kbd { font-family: var(--mono); font-size: 0.86em; }
:not(pre) > code { padding: 1px 6px; border-radius: 4px; background: var(--raised); border: 1px solid var(--line); color: var(--text); overflow-wrap: anywhere; }
kbd { display: inline-block; min-width: 1.7em; padding: 0 6px; text-align: center; border-radius: 4px; background: var(--raised); border: 1px solid var(--line-2); border-bottom-width: 2px; color: var(--text); line-height: 1.6; }
pre {
  overflow-x: auto;
  padding: 18px 20px;
  border-radius: 8px;
  background: var(--chrome);
  border: 1px solid var(--line);
  tab-size: 4;
}
pre code { font-size: 13.5px; line-height: 1.65; color: #cdd3ea; white-space: pre; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
tbody tr:last-child > * { border-bottom: 0; }
thead th { font-weight: 600; color: #fff; background: var(--chrome); white-space: nowrap; }
td { color: var(--text-2); }
.compare { min-width: 640px; }
.compare th, .compare td { padding: 10px 12px; font-size: 14.5px; }
.compare tbody th { font-weight: 600; color: var(--text); white-space: nowrap; background: var(--chrome); }
.compare thead th:nth-child(2), .compare td:nth-child(2) { background: rgba(137, 180, 250, 0.06); }

/* step lists inside prose: numbered squares like the homepage steps */
.steps-inline { list-style: none; padding-left: 0 !important; counter-reset: s; gap: 12px !important; }
.steps-inline li { counter-increment: s; position: relative; padding-left: 40px; }
.steps-inline li::before {
  content: counter(s);
  position: absolute; left: 0; top: 2px;
  width: 26px; height: 26px; border-radius: 6px;
  display: grid; place-items: center;
  font: 600 13px/1 var(--sans); color: var(--blue-ink); background: var(--blue);
}

.lesson-list { list-style: none; padding-left: 0 !important; gap: 20px !important; }
.lesson-list li { border-left: 2px solid var(--green); padding-left: 18px; }
.lesson-list h3 { margin-bottom: 4px; }

/* playable demo on /autotiling */
.page-demo { max-width: 560px; }

/* atlas diagram */
.atlas-diagram { margin-block: 28px !important; }
.atlas-diagram ol { list-style: none; padding: 0 !important; display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px !important; max-width: 560px; }
.atlas-diagram li { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--chrome); }
.atlas-tile {
  grid-row: span 2;
  width: 48px; height: 48px;
  background: url('../assets/spritelab-grass-dirt.png') no-repeat;
  background-size: 192px 192px;
  background-position: calc(var(--x) * -48px) calc(var(--y) * -48px);
  image-rendering: pixelated;
  border-radius: 3px;
}
.atlas-bits { display: grid; grid-template-columns: 7px 7px; gap: 2px; width: max-content; }
.atlas-bits i { width: 7px; height: 7px; border-radius: 1px; background: var(--line-2); }
.atlas-bits i.on { background: var(--green); }
.atlas-name { font-size: 12px; line-height: 1.3; color: var(--text-3); }
.atlas-name b { color: var(--text); font-weight: 600; margin-right: 2px; }
.atlas-diagram figcaption { margin-top: 14px; font-size: 14px; color: var(--text-3); max-width: 62ch; }

/* free tileset downloads */
.tileset-downloads { list-style: none; padding: 0 !important; gap: 16px !important; }
.tileset-downloads > li { display: grid; grid-template-columns: 160px 1fr; gap: 22px; align-items: start; padding: 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--chrome); }
.tileset-downloads img { width: 160px; height: auto; image-rendering: pixelated; border-radius: 4px; background: #0a0a10; }
.tileset-downloads h3 { margin-bottom: 6px; }
.tileset-downloads p { font-size: 15.5px !important; margin-bottom: 14px; }

/* hub page */
.guide-list { list-style: none; padding: 0 !important; gap: 0 !important; border-top: 1px solid var(--line-2); }
.guide-list li { display: grid; grid-template-columns: minmax(0, 15em) 1fr; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.guide-list a { color: #fff; text-decoration: none; }
.guide-list a:hover { color: var(--blue); }
.guide-list span { color: var(--text-2); font-size: 15.5px; }

/* FAQ inside the column */
.page-faq { padding: 0 !important; border-top: 0 !important; margin-top: 52px !important; }
.page-faq h2 { margin-bottom: 8px; }

/* related guides */
.related { padding-block: 56px; border-top: 1px solid var(--line); }
.related h2 { font-size: 22px; font-weight: 600; color: #fff; }
.related-list { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 28px; margin-top: 22px; }
.related-list a { display: grid; gap: 4px; padding: 14px 0; border-top: 1px solid var(--line-2); text-decoration: none; }
.related-list strong { color: #fff; font-weight: 600; }
.related-list span { color: var(--text-2); font-size: 14.5px; line-height: 1.5; }
.related-list a:hover strong { color: var(--blue); }

@media (max-width: 960px) {
  .page-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .toc { position: static; }
  .toc ol { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .related-list { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .page-head { padding-block: 36px 28px; }
  .answer { font-size: 17px; }
  .prose h2 { margin-top: 40px; font-size: 21px; }
  .atlas-diagram ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tileset-downloads > li { grid-template-columns: 1fr; }
  .guide-list li { grid-template-columns: 1fr; gap: 4px; }
  .related-list { grid-template-columns: 1fr; }
}
