/* Guides: /ohjeet and /ohjeet/{slug}. Design: docs/mockups/ohjeet.html.
   Builds on site.css (tokens, cards, .url-box, .channel, .prose). */

/* Breadcrumb above the H1. */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 16px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs svg.i { width: 16px; height: 16px; transform: rotate(-90deg); }

/* ---------- Index ---------- */
.doc-start { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; padding: 28px; margin-top: 32px; text-decoration: none; color: inherit; border-width: 2px; border-color: var(--accent); }
.doc-start:hover { background: var(--surface-2); }
.doc-start h2 { margin-top: 6px; }
.doc-start p { margin-top: 8px; color: var(--muted); max-width: 62ch; }
.doc-start .go { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--on-accent); }
.kicker { font-weight: 600; color: var(--accent-text); }

.doc-group + .doc-group { margin-top: 48px; }
.doc-group > h2 + .lead { margin-top: 8px; }
.doc-cards { list-style: none; margin: 20px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.doc-cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.doc-card { height: 100%; padding: 24px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; }
.doc-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.doc-card h3 { font-size: var(--fs-lg); font-weight: 600; }
.doc-card p { color: var(--muted); flex: 1; }
.doc-meta { color: var(--muted); }

.tool-cards { list-style: none; margin: 20px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.tool-card { height: 100%; padding: 24px; display: flex; gap: 16px; align-items: flex-start; text-decoration: none; color: inherit; }
.tool-card:hover { background: var(--surface-2); }
.tool-card p { color: var(--muted); margin-top: 4px; }

/* ---------- Article ---------- */
.article-head .lead { margin-top: 14px; max-width: 62ch; }
.article-head .doc-meta { margin-top: 16px; }

/* The body band keeps the chain of lines but clears them from behind the
   text: they fade out after entering and fade back in before the node. */
.band--article { padding-top: 64px; }
.band--article .kanava {
  -webkit-mask-image: linear-gradient(to bottom, #000 0, transparent 200px, transparent calc(100% - 260px), #000 100%);
          mask-image: linear-gradient(to bottom, #000 0, transparent 200px, transparent calc(100% - 260px), #000 100%);
}

.article { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 56px; align-items: start; }
.article .prose { max-width: 68ch; min-width: 0; }
.article .prose li::marker { color: var(--muted); }
.prose code { font-family: var(--mono); font-size: 16px; }
/* Code wraps like .url-box: parameter strings are long and a sideways
   scrolling box is hard to read and to reach with the keyboard. */
.prose pre { margin: 0; padding: 16px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; border-radius: var(--radius-sm); background: var(--surface-2); }

/* Markdown tables look like the site's table cards. */
.prose table {
  width: 100%; border-collapse: separate; border-spacing: 0; padding: 8px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.prose th { text-align: left; font-weight: 600; color: var(--muted); padding: 10px; border-bottom: 1px solid var(--border); }
.prose td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td code { white-space: nowrap; }

/* "Tällä sivulla": sticky beside the text; .toc-mobile replaces it on
   narrow screens (see templates/pages/docs_article.html). */
.toc { position: sticky; top: 96px; }
.toc-title { font-weight: 600; }
.toc ol { list-style: none; margin: 12px 0 0; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 6px 0 6px 16px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--text); }
.toc a[aria-current="true"] { color: var(--text); font-weight: 600; border-left-color: var(--accent); }
.toc-mobile { display: none; padding: 4px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.toc-mobile summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; font-weight: 600; }
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary svg.i { color: var(--muted); transition: transform .15s; }
.toc-mobile[open] summary svg.i { transform: rotate(180deg); }
.toc-mobile ol { margin: 0 0 16px; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }

/* Components from the Markdown blocks (internal/docs). */
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: var(--radius-sm); }
.callout > svg.i { margin-top: 3px; }
.callout > div { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.callout.tip { background: var(--ok-soft); }
.callout.tip > svg.i { color: var(--ok); }
.callout.warn { background: var(--warn-soft); }
.callout.warn > svg.i { color: var(--warn); }
.example { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.example figcaption { color: var(--muted); }
.try { padding: 20px 24px; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.try p { color: var(--muted); margin-top: 2px; }
.article-end { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--border); color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .article { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .toc { display: none; }
  .toc-mobile { display: block; }
}
@media (max-width: 860px) {
  .doc-cards, .doc-cards.three, .tool-cards { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .band--article { padding-top: 40px; }
  .doc-start { grid-template-columns: minmax(0, 1fr); padding: 20px; }
  .doc-start .go { display: none; }
  .doc-card, .tool-card, .try { padding: 20px; }
  .try .btn { width: 100%; }
  .article-head h1 { font-size: 28px; }
  /* Tables: one block per row, each value labelled with its column. */
  .prose table, .prose tbody, .prose tr, .prose td { display: block; }
  .prose thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .prose tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .prose tbody tr:last-child { border-bottom: 0; }
  .prose td { padding: 0; border: 0; }
  .prose td:first-child { font-weight: 600; }
  .prose td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
}
