/* Guide pages and free tools (app/guides, app/freetools, templates/pagekit).
   Loaded by their layouts on top of site.css and built from its tokens, so a
   guide reads as part of the same site: ink head, paper sections, one accent.
   Every class here starts with pk- and nothing in site.css is redefined. */

/* ---------- Head: trail, heading, answer, date ---------- */

.pk-crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.15rem 0; margin: 0 0 1.1rem; padding: 0;
  font-family: var(--mono); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.pk-crumbs li { display: inline-flex; align-items: center; color: var(--ink-3); }
/* The slash follows its item, so a trail that wraps on a phone never starts a line with one. */
.pk-crumbs li:not(:last-child)::after { content: "/"; margin: 0 0.6rem; color: var(--line-strong); font-weight: 400; }
.pk-crumbs a { color: var(--accent); }
.page-head .pk-crumbs li { color: var(--dark-muted); }
.page-head .pk-crumbs li:not(:last-child)::after { color: rgba(255, 255, 255, 0.28); }

.pk-head h1 { max-width: 24ch; }
.pk-head p.lead { max-width: 44rem; color: #e6eaf3; }
.pk-byline { margin: 1.5rem 0 0; font-size: 0.88rem; color: var(--ink-3); }
.pk-byline span { margin: 0 0.35rem; }
.page-head .pk-byline { color: var(--dark-muted); }
.pk-byline a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: currentColor; }

/* ---------- Body: contents beside the text ---------- */

section.pk-main { padding: clamp(2.2rem, 4vw, 3.6rem) 0 clamp(1rem, 2vw, 1.5rem); }
.pk-layout { display: grid; grid-template-columns: 15rem minmax(0, 46rem); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.pk-layout > .pk-body:only-child { grid-column: 1 / -1; }
.pk-side { position: sticky; top: 5.5rem; max-height: calc(100vh - 7rem); overflow-y: auto; }
.pk-toc-title { font-family: var(--mono); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 0.7rem; }
.pk-toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.pk-toc li { margin: 0; }
.pk-toc a { display: block; padding: 0.32rem 0 0.32rem 0.95rem; margin-left: -2px; border-left: 2px solid transparent;
  color: var(--ink-2); font-size: 0.9rem; line-height: 1.35; }
.pk-toc a:hover { color: var(--accent); border-left-color: var(--accent); text-decoration: none; }

.pk-body { max-width: 46rem; min-width: 0; }
.pk-body > :first-child { margin-top: 0; }
.pk-body h2 { font-size: clamp(1.45rem, 1.3rem + 0.6vw, 1.75rem); margin: 2.8rem 0 0.8rem; scroll-margin-top: 5.5rem; }
.pk-body h3 { scroll-margin-top: 5.5rem; }
.pk-body p, .pk-body li { line-height: 1.7; }
.pk-body code { overflow-wrap: anywhere; }
.pk-body img, .pk-body svg { height: auto; }

@media (max-width: 980px) {
  .pk-layout { grid-template-columns: minmax(0, 1fr); gap: 1.8rem; }
  .pk-side { position: static; max-height: none; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2);
    padding: 1rem 1.15rem 0.9rem; }
  .pk-toc ol { border-left: 0; columns: 2 14rem; column-gap: 1.6rem; }
  .pk-toc li { break-inside: avoid; }
  .pk-toc a { padding-left: 0; margin-left: 0; border-left: 0; color: var(--accent); }
}

/* ---------- Blocks a body may use (templates/pagekit/blocks.html) ---------- */

.pk-table { margin: 1.3rem 0 1.6rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow-xs); overflow-x: auto; }
.pk-facts { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.pk-facts caption { caption-side: top; text-align: left; padding: 0.8rem 1rem 0.7rem; font-family: var(--display); font-weight: 640;
  color: var(--ink); border-bottom: 1px solid var(--line); }
.pk-facts th, .pk-facts td { text-align: left; vertical-align: top; padding: 0.7rem 1rem; border-bottom: 1px solid var(--line-soft); line-height: 1.5; }
.pk-facts tbody tr:last-child th, .pk-facts tbody tr:last-child td { border-bottom: 0; }
.pk-facts thead th { font-family: var(--mono); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-3); background: var(--paper); border-bottom: 1px solid var(--line); }
.pk-facts tbody th { width: 34%; font-weight: 620; color: var(--ink); }
.pk-facts.pk-wide tbody th { width: auto; }
.pk-facts td { color: var(--ink-2); }
@media (max-width: 640px) {
  /* A table wider than a phone becomes one labelled card per row: nothing scrolls sideways. */
  .pk-facts.pk-wide thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .pk-facts.pk-wide, .pk-facts.pk-wide tbody, .pk-facts.pk-wide tr, .pk-facts.pk-wide th, .pk-facts.pk-wide td { display: block; width: auto; }
  .pk-facts.pk-wide tr { padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
  .pk-facts.pk-wide tbody tr:last-child { border-bottom: 0; }
  .pk-facts.pk-wide th, .pk-facts.pk-wide td { border-bottom: 0; padding: 0.2rem 1rem; }
  .pk-facts.pk-wide td[data-label]::before { content: attr(data-label); display: block; font-family: var(--mono); font-size: 0.66rem;
    letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
  .pk-facts tbody th { width: 40%; }
}

.pk-body ol.pk-steps { list-style: none; counter-reset: pk-step; margin: 1.3rem 0 1.6rem; padding: 0; }
.pk-steps li { counter-increment: pk-step; position: relative; margin: 0; padding: 0.15rem 0 1.25rem 3.1rem; }
.pk-steps li::before { content: counter(pk-step); position: absolute; left: 0; top: 0; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: var(--ink); color: #fff;
  font-family: var(--mono); font-size: 0.85rem; font-weight: 600; }
.pk-steps li::after { content: ""; position: absolute; left: 1.05rem; top: 2.4rem; bottom: 0.25rem; width: 1px; background: var(--line); }
.pk-steps li:last-child { padding-bottom: 0; }
.pk-steps li:last-child::after { display: none; }
.pk-steps li > strong:first-child { display: block; font-family: var(--display); font-size: 1.1rem; letter-spacing: -0.015em; margin-bottom: 0.15rem; }

.pk-example { margin: 1.6rem 0; padding: 1.3rem 1.4rem 1.35rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); }
.pk-tag { display: inline-block; margin: 0 0 0.6rem; font-family: var(--mono); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent); }
.pk-body .pk-example h3 { margin: 0 0 0.6rem; font-size: 1.15rem; }
.pk-example > :last-child { margin-bottom: 0; }
.pk-example code { background: var(--surface); }

.pk-callout { margin: 1.5rem 0; padding: 1rem 1.2rem; border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); background: var(--accent-weak); color: var(--ink-2); }
.pk-callout.pk-tip { border-left-color: var(--live); background: var(--live-bg); }
.pk-callout.pk-warning { border-left-color: var(--warn-ink); background: var(--warn-bg); }
.pk-callout-title { margin: 0 0 0.3rem; font-weight: 640; color: var(--ink); }
.pk-callout > :last-child { margin-bottom: 0; }

.pk-known { margin: 1.6rem 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.pk-known-date { margin: 0; padding: 0.65rem 1.2rem; background: var(--paper); border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.pk-known-cols { display: grid; grid-template-columns: 1fr 1fr; }
.pk-known-cols > div { padding: 1.1rem 1.2rem 1rem; min-width: 0; }
.pk-known-cols > div + div { border-left: 1px solid var(--line); }
.pk-body .pk-known h3 { margin: 0 0 0.5rem; font-size: 1.02rem; }
.pk-known ul { margin: 0; padding-left: 1.15rem; }
.pk-known li { margin: 0.3rem 0; font-size: 0.95rem; line-height: 1.55; }
@media (max-width: 640px) {
  .pk-known-cols { grid-template-columns: 1fr; }
  .pk-known-cols > div + div { border-left: 0; border-top: 1px solid var(--line); }
}

.pk-figure { margin: 1.8rem 0; }
.pk-figure-art { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); padding: 1.2rem; overflow-x: auto; }
.pk-figure-art svg, .pk-figure-art img { display: block; margin: 0 auto; max-width: 100%; }
.pk-figure figcaption { margin-top: 0.6rem; font-size: 0.86rem; color: var(--ink-3); }

/* ---------- Sources, questions, related pages ---------- */

/* These three are <section> elements; site.css pads every section as a page band. */
.pk-sources, .pk-faq, .pk-related { margin-top: 3.2rem; padding: 0.2rem 0 0; border-top: 1px solid var(--line); }
.pk-body .pk-sources h2, .pk-body .pk-faq h2, .pk-body .pk-related h2 { margin-top: 2rem; }
.pk-body .pk-sources ol { margin: 0; padding-left: 1.4rem; }
.pk-sources li { margin: 0.6rem 0; padding-left: 0.2rem; font-size: 0.95rem; line-height: 1.5; }
.pk-sources li::marker { font-family: var(--mono); font-size: 0.82rem; color: var(--ink-3); }
.pk-sources a { overflow-wrap: anywhere; }
.pk-checked { display: block; font-size: 0.82rem; color: var(--ink-3); }

.pk-q { padding: 1.15rem 0 0.35rem; border-bottom: 1px solid var(--line-soft); }
.pk-q:first-child { padding-top: 0.2rem; }
.pk-q:last-child { border-bottom: 0; }
.pk-body .pk-q h3 { margin: 0 0 0.4rem; font-size: 1.12rem; }

.pk-body .pk-related ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.6rem; }
.pk-related li { margin: 0; }
.pk-related a { display: block; height: 100%; padding: 0.75rem 0.95rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font-weight: 560; font-size: 0.95rem; line-height: 1.4; text-decoration: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.pk-related a::after { content: " \2192"; color: var(--accent); }
.pk-related a:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }

/* ---------- Closing block ---------- */

section.pk-end { padding: clamp(2.5rem, 5vw, 4rem) 0 0; }
/* Words above, the two buttons on a row of their own below: side by side
   they squeeze the heading into a narrow column. */
.pk-closing { flex-direction: column; align-items: flex-start; gap: 1.6rem; }
.pk-closing > div:first-child { max-width: 40rem; }
.pk-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; max-width: 100%; }
.pk-actions .btn { white-space: normal; text-align: center; max-width: 100%; }
@media (max-width: 560px) {
  .pk-actions { width: 100%; }
  .pk-actions .btn { flex: 1 1 100%; }
}

/* ---------- /guides ---------- */

.pk-index-group { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: clamp(1.2rem, 4vw, 3.5rem); padding: 2rem 0;
  border-top: 1px solid var(--line); }
.pk-index-group:first-child { border-top: 0; padding-top: 0.4rem; }
.pk-index-group h2 { font-size: 1.35rem; margin: 0.15rem 0 0; scroll-margin-top: 5.5rem; }
.pk-index { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: 1.4rem 2.2rem; }
.pk-index li { min-width: 0; }
.pk-index a { font-family: var(--display); font-size: 1.14rem; font-weight: 640; letter-spacing: -0.015em; line-height: 1.25; color: var(--ink); }
.pk-index a:hover { color: var(--accent); }
.pk-index p { margin: 0.3rem 0 0; font-size: 0.94rem; line-height: 1.55; color: var(--ink-2); }
.pk-index p.pk-index-date { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.04em; color: var(--ink-3); }
@media (max-width: 860px) {
  .pk-index-group { grid-template-columns: minmax(0, 1fr); gap: 0.9rem; padding: 1.6rem 0; }
  .pk-index { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- A tool: form, answer, examples ---------- */

section.pk-tool-top { padding: clamp(2.2rem, 4vw, 3.4rem) 0 clamp(2.2rem, 4vw, 3rem); }
.pk-tool-top h1 { font-size: clamp(2rem, 1.5rem + 2vw, 3.1rem); margin-bottom: 0.8rem; }
.pk-tool-lead { font-size: 1.06rem; color: var(--ink-2); max-width: 44rem; margin-bottom: 1.4rem; }
.pk-form { padding: 0.5rem 1.4rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2);
  box-shadow: var(--shadow-sm); }
.pk-form > p { margin: 1.1rem 0 0; }
.pk-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr)); gap: 0 1.2rem; }
.pk-field { min-width: 0; }
.pk-field-wide { grid-column: 1 / -1; }
.pk-optional { font-weight: 400; color: var(--ink-3); }
.pk-input { display: flex; align-items: center; gap: 0.55rem; }
.pk-input input { min-width: 0; font-family: var(--mono); font-size: 0.95rem; }
.pk-unit { flex: none; color: var(--ink-3); font-size: 0.9rem; }
.pk-help { margin: 0.35rem 0 0; font-size: 0.84rem; color: var(--ink-3); line-height: 1.45; }
.pk-form [aria-invalid="true"] { border-color: #c0392b; box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.14); }
.pk-result { scroll-margin-top: 5.5rem; border-color: var(--line-strong); background: var(--surface); box-shadow: var(--shadow-sm); }
.pk-result > :first-child { margin-top: 0; }
.pk-result > :last-child { margin-bottom: 0; }
.pk-result code { overflow-wrap: anywhere; }
.pk-result .pk-table { box-shadow: none; }
.pk-answer { font-family: var(--display); font-size: 1.35rem; font-weight: 640; letter-spacing: -0.015em; color: var(--ink); line-height: 1.25; }
.pk-next { margin: 1rem 0 0; padding: 0.8rem 1.1rem; border-radius: var(--radius-sm); background: var(--accent-weak); font-size: 0.95rem; }
.pk-next-link { font-weight: 620; }
.pk-share { margin: 0.8rem 0 0; overflow-wrap: anywhere; }
.pk-examples { margin-top: 2rem; }
.pk-examples h2 { font-size: 1.25rem; margin: 0 0 0.3rem; }
.pk-example-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; }
.pk-tool-top .pk-byline { margin-top: 1.8rem; }
section.pk-tool-body { padding: clamp(2.4rem, 4.5vw, 3.8rem) 0; }
/* The words sit in the same column as the tool above them. */
.pk-tool-body > .wrap { max-width: 860px; }
.pk-tool-body .pk-body { max-width: none; }
.pk-tool-body .pk-table, .pk-tool-body .pk-known, .pk-tool-body .pk-related a { background: var(--surface); }
.pk-tool-body .pk-example { background: var(--surface); }

.pk-more-tools h2 { margin-bottom: 0.4rem; }
/* auto-fill, not auto-fit: one tool in a group keeps the width of a card. */
.pk-more-tools .tool-grid { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.pk-group-title { margin: 2rem 0 0.9rem; font-family: var(--mono); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-3); }

@media print {
  .pk-side, .pk-end, .pk-form, .pk-examples { display: none; }
}
