/* ==========================================================================
   Poggy — Documentation (/documentation, documentation.php)
   Builds on store.css (.st, .st-guide, .st-guide__body, .st-masthead).
   Colours come only from the --pg-* / --st-* tokens (css/poggy-theme.css).
   ========================================================================== */

.st.docs { max-width: 1440px; }

/* ---- index ------------------------------------------------------------- */
.docs-find { max-width: 420px; margin: 1.6rem auto 0; }
.docs-find__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.docs-find__input {
  width: 100%; box-sizing: border-box;
  padding: 0.8rem 1rem;
  font: inherit; font-size: 1rem;
  color: var(--st-ink);
  background: rgba(var(--pg-deep-rgb), 0.72);
  border: 1px solid var(--st-rule-strong);
  border-radius: var(--pg-radius);
}
.docs-find__input::placeholder { color: var(--st-ink-faint); }
.docs-find__input:focus { outline: 2px solid var(--pg-accent); outline-offset: 2px; }

.docs-shelf { margin-top: 48px; }
.docs-shelf[hidden] { display: none; }
.docs-shelf__head p { margin: 0.3rem 0 0; color: var(--st-ink-faint); }
.docs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 18px;
}
.docs-card {
  position: relative;
  display: flex; flex-direction: column; gap: 0.5rem;
  padding: 22px 22px 20px;
  background: rgba(var(--pg-deep-rgb), 0.72);
  border: 1px solid var(--st-rule);
  border-radius: var(--pg-radius);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: var(--st-ink);
  text-decoration: none;
  transition: border-color var(--st-hover), transform var(--st-hover), background-color var(--st-hover);
}
.docs-card:hover, .docs-card:focus-visible {
  border-color: var(--pg-accent-soft);
  background: rgba(var(--pg-raise-hi-rgb), 0.85);
  transform: translateY(-2px);
}
.docs-card:focus-visible { outline: 2px solid var(--pg-accent); outline-offset: 3px; }
.docs-card[hidden] { display: none; }
.docs-card--start { border-color: var(--pg-accent2-soft); }
.docs-card h3 { margin: 0; padding-right: 4.5rem; font-family: var(--pg-font-display); font-size: 1.3rem; font-weight: 500; }
.docs-card p { margin: 0; color: var(--st-ink-soft); line-height: 1.6; font-size: 0.97rem; }
.docs-card__ver {
  position: absolute; top: 22px; right: 20px;
  font-family: var(--pg-font-body); font-size: 0.78rem;
  color: var(--st-ink-faint);
  border: 1px solid var(--st-rule); padding: 0.1em 0.5em;
}
.docs-card__parts { font-size: 0.82rem; color: var(--st-ink-faint); line-height: 1.5; }
.docs-card__more {
  margin-top: auto; padding-top: 0.4rem;
  font-family: var(--pg-font-display); font-size: 0.75rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--st-tan);
}
.docs-none { margin: 40px auto; text-align: center; color: var(--st-ink-soft); }
.docs-none a { color: var(--st-tan); }

/* ---- one page: sidebar · article · contents rail ------------------------ */
.docs-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 220px;
  gap: 28px;
  align-items: start;
  margin-top: 22px;
}
.docs-layout .docs-article { max-width: none; margin: 0; min-width: 0; }

.docs-side, .docs-toc--rail {
  position: sticky; top: 90px;
  max-height: calc(100vh - 110px); overflow-y: auto;
  padding: 18px 16px;
  background: rgba(var(--pg-deep-rgb), 0.6);
  border: 1px solid var(--st-rule);
  border-radius: var(--pg-radius);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  scrollbar-width: thin;
}
.docs-side__toggle { display: none; }
.docs-side__nav ul, .docs-toc ol { list-style: none; margin: 0; padding: 0; }
.docs-side__head, .docs-toc__head {
  margin: 1.1rem 0 0.4rem;
  font-family: var(--pg-font-display); font-size: 0.68rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--pg-accent2);
}
.docs-toc__head { margin-top: 0; }
.docs-side a, .docs-toc a {
  display: block;
  padding: 0.32rem 0.6rem;
  border-left: 2px solid transparent;
  color: var(--st-ink-soft);
  text-decoration: none;
  font-size: 0.93rem; line-height: 1.4;
}
.docs-side a:hover, .docs-toc a:hover { color: var(--st-ink); background: var(--pg-surface); }
.docs-side a.is-current, .docs-toc a.is-current {
  color: var(--st-ink);
  border-left-color: var(--pg-accent);
  background: var(--pg-accent-faint);
}
.docs-side__home { font-weight: 600; }

/* article head */
.docs-head__lede { margin: 0.9rem 0 0; font-size: 1.12rem; line-height: 1.65; color: var(--st-ink-soft); max-width: 70ch; }
.docs-meta { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 1.2rem 0 0; padding: 0; }
.docs-meta li { display: inline-flex; border: 1px solid var(--st-rule); font-size: 0.85rem; }
.docs-meta__k { padding: 0.3em 0.6em; color: var(--st-ink-faint); background: var(--pg-surface); }
.docs-meta__v { padding: 0.3em 0.6em; color: var(--st-ink); }
.docs-head__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 1.2rem; }
.docs-behind { margin-top: 1.2rem; }

/* contents inside the article: shown when the rail is not */
.docs-toc--inline {
  display: none;
  margin: 0 0 1.6rem; padding: 14px 16px;
  border: 1px solid var(--st-rule);
  background: var(--pg-surface);
}
.docs-toc--inline ol { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.docs-toc--inline a { border: 1px solid var(--st-rule); border-left-width: 1px; padding: 0.25rem 0.6rem; font-size: 0.88rem; }

/* body */
.docs-section { scroll-margin-top: 90px; }
.docs-body .docs-section:first-child h2 { border-top: 0; padding-top: 0; margin-top: 0.6rem; }
.docs-body h4 { font-size: 1rem; font-weight: 600; margin: 1.3rem 0 0.4rem; color: var(--st-ink); }
.docs-anchor {
  margin-left: 0.45em;
  color: var(--st-ink-faint) !important; text-decoration: none !important;
  opacity: 0; transition: opacity .15s ease;
}
.docs-body h2:hover .docs-anchor, .docs-anchor:focus-visible { opacity: 1; }
.docs-body kbd {
  font-family: var(--pg-font-mono); font-size: 0.85em;
  padding: 0.05em 0.45em;
  border: 1px solid var(--st-rule-strong); border-bottom-width: 2px;
  background: var(--pg-surface-strong); color: var(--st-ink);
}
.docs-body .doc-table { overflow-x: auto; margin: 1rem 0 1.5rem; }
.docs-body .doc-table table { min-width: 540px; }
.docs-body td code, .docs-body th code { white-space: nowrap; }
.docs-body dl dt { font-weight: 600; color: var(--st-ink); margin-top: 1rem; }
.docs-body dl dd { margin: 0.3rem 0 0 0; }

/* numbered steps */
.docs-body ol.doc-steps { list-style: none; counter-reset: step; padding-left: 0; }
.docs-body ol.doc-steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 0.9rem 2.8rem; margin: 0;
  border-left: 1px solid var(--st-rule);
  margin-left: 0.95rem;
}
.docs-body ol.doc-steps > li:last-child { border-left-color: transparent; }
.docs-body ol.doc-steps > li::before {
  content: counter(step);
  position: absolute; left: -0.95rem; top: 0;
  width: 1.9rem; height: 1.9rem; line-height: 1.9rem; text-align: center;
  font-size: 0.9rem; font-weight: 600;
  color: var(--pg-on-accent); background: var(--pg-accent);
}

/* callouts */
.doc-callout {
  margin: 1.2rem 0 1.4rem; padding: 0.9rem 1.1rem;
  border: 1px solid var(--st-rule); border-left: 3px solid var(--pg-info);
  background: var(--pg-info-soft);
}
.doc-callout > :last-child { margin-bottom: 0 !important; }
.doc-callout p { color: var(--st-ink) !important; }
.doc-callout--tip  { border-left-color: var(--pg-success); background: var(--pg-success-soft); }
.doc-callout--warn { border-left-color: var(--pg-warning); background: var(--pg-warning-soft); }

/* article foot */
.docs-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px;
  margin-top: 2.4rem; padding-top: 1.2rem; border-top: 1px solid var(--st-rule-strong);
  color: var(--st-ink-soft);
}
.docs-foot p { margin: 0; }
.docs-foot a { color: var(--st-tan); }

/* ---- narrower screens --------------------------------------------------- */
@media (max-width: 1260px) {
  .docs-layout { grid-template-columns: 220px minmax(0, 1fr); }
  .docs-toc--rail { display: none; }
  .docs-toc--inline { display: block; }
}
@media (max-width: 900px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .docs-side { position: static; max-height: none; padding: 0; }
  .docs-side__toggle {
    display: block; cursor: pointer;
    padding: 0.85rem 1rem;
    font-family: var(--pg-font-display); font-size: 0.78rem; letter-spacing: .14em; text-transform: uppercase;
    color: var(--st-ink);
  }
  .docs-side__nav { padding: 0 14px 14px; }
}
@media (max-width: 640px) {
  .st.docs { padding-left: 16px; padding-right: 16px; }
  .docs-cards { grid-template-columns: 1fr; }
}
