/* ZooFly KC: info pages (/p/<slug>) and the 404 / 500 pages.
   Linked only from page.html, 404.html and 500.html. Builds on shop.css tokens and
   components (.h-display, .btn, .chips, .search, .grid, .section-head); redefines none. */

/* ---------- info pages: long-form reading ---------- */
.info { padding-top: var(--s6); padding-bottom: var(--s8); }
.info-grid { display: grid; gap: var(--s7); }
.info-main { min-width: 0; }
.info-head { padding-bottom: var(--s5); border-bottom: 1px solid var(--line); }

.prose {
  --measure: 62ch;
  margin-top: var(--s5); max-width: var(--measure);
  font-size: 16px; line-height: 1.65; color: var(--ink); text-wrap: pretty;
}
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table, .prose figure { margin: 0 0 1em; }
/* the opening paragraph reads as the lede */
.prose > p:first-child {
  margin-bottom: 1.15em; font-size: 19px; line-height: 1.45; letter-spacing: -.005em; text-wrap: pretty;
}
.prose h2 {
  margin: 2.1em 0 .55em; font-size: 20px; line-height: 1.2; font-weight: 800; font-stretch: 90%;
  letter-spacing: -.01em; text-wrap: balance;
}
.prose h3 { margin: 1.8em 0 .4em; font-size: var(--t-base); line-height: 1.3; font-weight: 700; }
.prose h2 + h3 { margin-top: .9em; }
.prose strong, .prose b { font-weight: 700; }
.prose em { font-style: italic; }
.prose a {
  font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
  text-decoration-color: #BDBDBD; overflow-wrap: anywhere; border-radius: 2px;
  transition: text-decoration-color var(--t-fast);
}
.prose a:hover { text-decoration-color: currentColor; }

/* lists: a small ink square, the same box the KC mark sits in */
.prose ul > li, .prose ol > li { position: relative; padding-left: 22px; }
.prose li + li { margin-top: .45em; }
.prose ul > li::before {
  content: ""; position: absolute; left: 2px; top: calc(.825em - 2.5px);
  width: 5px; height: 5px; background: var(--ink); border-radius: 1px;
}
.prose ol { counter-reset: prose-ol; }
.prose ol > li { counter-increment: prose-ol; padding-left: 26px; }
.prose ol > li::before {
  content: counter(prose-ol) "."; position: absolute; left: 0; top: 0;
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.prose li > ul, .prose li > ol { margin: .45em 0 0; }
/* a list of run-in terms ("<li><strong>Holds.</strong> ...") becomes a hairline spec list */
.prose ul:has(> li > strong:first-child) { margin: 1.4em 0; border-top: 1px solid var(--line); }
.prose ul:has(> li > strong:first-child) > li { padding: 14px 0; margin: 0; border-bottom: 1px solid var(--line); }
.prose ul:has(> li > strong:first-child) > li::before { display: none; }
.prose ul:has(> li > strong:first-child) > li > strong:first-child { display: block; margin-bottom: 2px; }

.prose blockquote { padding-left: var(--s4); border-left: 1px solid var(--ink); font-size: var(--t-md); line-height: 1.5; }
.prose hr { margin: 2em 0; border: 0; border-top: 1px solid var(--line); }
.prose img { margin: 1.5em 0; border-radius: var(--r); }
.prose table { width: 100%; border-collapse: collapse; border-top: 1px solid var(--line); font-size: var(--t-ui); line-height: 1.4; font-variant-numeric: tabular-nums; }
.prose th, .prose td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.prose th { font-weight: 500; color: var(--meta); }
.prose code { font-size: .92em; padding: 1px 5px; border-radius: 3px; background: var(--wash); }

/* end of the read: one line in his voice and the way back to the pieces */
.info-end { margin-top: var(--s7); display: grid; gap: var(--s4); justify-items: start; }
.info-end p { font-size: var(--t-md); line-height: 1.4; font-weight: 600; max-width: 40ch; }
.info-actions { display: flex; flex-wrap: wrap; gap: var(--s3); }

/* the other info pages. Phone: a hairline list after the read. Desktop: a quiet left column. */
.info-nav h2 { padding-bottom: var(--s2); font-size: var(--t-sm); font-weight: 700; }
.info-nav ul { border-top: 1px solid var(--line); }
.info-nav a {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  min-height: 52px; border-bottom: 1px solid var(--line); border-radius: 0;
  font-size: var(--t-base); font-weight: 600;
}
.info-nav a svg {
  width: 18px; height: 18px; flex: none; color: var(--meta);
  transition: transform var(--t-fast) var(--ease-out), color var(--t-fast);
}
.info-nav a:active { opacity: .6; }
.info-nav a[aria-current="page"] svg { display: none; }
.info-label { position: relative; }
.info-mark {
  position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; border-radius: 1px;
  background: var(--ink); pointer-events: none;
}

/* ---------- 404 + 500 ---------- */
.oops { padding-top: var(--s6); padding-bottom: var(--s8); }
.oops-head { display: grid; gap: var(--s3); justify-items: start; }
.oops-head p { max-width: 44ch; font-size: var(--t-md); line-height: 1.45; color: var(--meta); text-wrap: pretty; }
.oops-head p a { color: var(--ink); }
.oops-actions { margin-top: var(--s5); display: grid; gap: var(--s3); }
.oops-actions .btn { justify-self: start; }
.oops-actions .search { margin-top: 0; width: 100%; max-width: 420px; }
.oops-actions.oops-buttons { display: flex; flex-wrap: wrap; }
.oops-cats { margin-top: var(--s4); }
.oops-finds { padding-top: var(--s7); }
.oops-note { margin-top: var(--s5); font-size: var(--t-ui); color: var(--meta); }
.oops-note a { color: var(--ink); }

/* ---------- hover-capable pointers ---------- */
@media (hover: hover) {
  .info-nav a:hover svg { transform: translateX(3px); color: var(--ink); }
  .info-nav a:not([aria-current="page"]):hover .info-label {
    text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; text-decoration-color: var(--line-strong);
  }
}

/* ---------- tablet ---------- */
@media (min-width: 700px) {
  .info { padding-top: var(--s7); }
  .prose { font-size: 17px; }
  .prose > p:first-child { font-size: 21px; }
  .prose h2 { font-size: 22px; }
  .info-nav { max-width: 62ch; }
  /* the title rule, the read and the close all share one 616px column (about 73 characters a line) */
  .info-main { max-width: 616px; }
  .prose { max-width: none; }
  .oops-actions .search input { height: 52px; }
  .oops-actions .search > svg { top: 16px; }
  .oops-actions .search button { width: 52px; height: 52px; }
  .oops { padding-top: var(--s8); }
  .oops-actions { grid-template-columns: auto minmax(0, 360px); align-items: center; justify-content: start; gap: var(--s4); }
}

/* ---------- desktop ---------- */
@media (min-width: 1000px) {
  .info { padding-top: var(--s8); padding-bottom: var(--s9); }
  .info-grid { grid-template-columns: 184px minmax(0, 1fr); column-gap: var(--s9); align-items: start; }
  .info-main { grid-column: 2; grid-row: 1; }
  .info-head { padding-bottom: var(--s6); }
  .prose { margin-top: var(--s6); }
  .prose > p:first-child { font-size: 23px; line-height: 1.4; }
  .info-end { margin-top: var(--s8); }

  /* the nav lines up with the title's cap height and stays put while you read */
  .info-nav { grid-column: 1; grid-row: 1; position: sticky; top: calc(var(--hdr-total, var(--hdr)) + var(--s6)); padding-top: 2px; }
  .info-nav h2 {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
  .info-nav ul { border: 0; display: grid; gap: 2px; }
  .info-nav a {
    min-height: 36px; border: 0; border-radius: var(--r); justify-content: flex-start;
    font-size: var(--t-ui); font-weight: 500; color: var(--meta);
    transition: color var(--t-fast);
  }
  .info-nav a:hover { color: var(--ink); }
  .info-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
  .info-nav a svg { display: none; }
  .info-mark { bottom: -5px; view-transition-name: info-mark; }

  .oops { padding-top: var(--s9); padding-bottom: var(--s9); }
  .oops-head p { font-size: 19px; }
  .oops-finds { padding-top: var(--s8); }
}

/* Moving between info pages, the underline under the current page slides to the next one
   while the reading column crossfades. (Desktop only: on phones the list is below the fold.) */
::view-transition-group(info-mark) { animation-duration: 340ms; animation-timing-function: var(--ease-out); }
::view-transition-old(info-mark), ::view-transition-new(info-mark) { animation: none; }
::view-transition-old(info-mark) { display: none; }
