/* Patchwright docs shell — prose layout, sidebar, search */

.docs-body {
  background: var(--pw-bg-deep);
  color: var(--pw-text);
  font-family: var(--font-sans);
  line-height: 1.65;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.docs-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--pw-border);
  background: var(--pw-bg);
  position: sticky;
  top: 0;
  z-index: 20;
}

.docs-header__links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-left: auto;
  font-size: var(--t-sm);
}

.docs-header__links a {
  color: var(--pw-text-2);
  text-decoration: none;
}

.docs-header__links a:hover,
.docs-header__links a[aria-current="page"] {
  color: var(--pw-accent);
}

.docs-header__cta {
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--pw-accent);
  color: var(--pw-bg-deepest) !important;
  font-weight: 600;
}

.docs-menu-btn {
  display: none;
  background: var(--pw-panel);
  border: 1px solid var(--pw-border);
  color: var(--pw-text);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.docs-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(160px, 200px);
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 56px);
}

.docs-sidebar {
  border-right: 1px solid var(--pw-border);
  padding: 1rem;
  overflow-y: auto;
  max-height: calc(100vh - 56px);
  position: sticky;
  top: 56px;
}

.docs-search input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--pw-border);
  background: var(--pw-input);
  color: var(--pw-text);
  font-size: var(--t-sm);
}

.docs-search-results {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
}

.docs-search-results a {
  display: block;
  padding: 0.4rem 0.35rem;
  color: var(--pw-text-2);
  text-decoration: none;
  font-size: var(--t-sm);
  border-radius: 4px;
}

.docs-search-results a:hover {
  background: var(--pw-panel);
  color: var(--pw-accent);
}

.docs-nav__list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.docs-nav__list a {
  display: block;
  padding: 0.25rem 0;
  color: var(--pw-text-2);
  text-decoration: none;
  font-size: var(--t-sm);
}

.docs-nav__list a[aria-current="page"] {
  color: var(--pw-accent);
  font-weight: 600;
}

.docs-nav__list--nested {
  margin-left: 0.75rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--pw-border);
}

.docs-nav__section-label {
  display: block;
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pw-text-2);
  margin-top: 0.75rem;
}

.docs-main {
  padding: 2rem clamp(1rem, 3vw, 2.5rem);
  max-width: 72ch;
}

.docs-toc {
  padding: 2rem 1rem;
  font-size: var(--t-sm);
  position: sticky;
  top: 56px;
  align-self: start;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
}

.docs-toc__label {
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pw-text-2);
  margin: 0 0 0.5rem;
}

.docs-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.docs-toc a {
  color: var(--pw-text-2);
  text-decoration: none;
  display: block;
  padding: 0.2rem 0;
}

.docs-toc a:hover {
  color: var(--pw-accent);
}

.docs-pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--pw-border);
  font-size: var(--t-sm);
}

.docs-pager a {
  color: var(--pw-accent);
  text-decoration: none;
}

/* Prose */
.prose h1 {
  font-size: var(--t-2xl);
  color: var(--pw-text-hi);
  margin: 0 0 1rem;
  line-height: 1.2;
}

.prose h2 {
  font-size: var(--t-xl);
  color: var(--pw-text-hi);
  margin: 2rem 0 0.75rem;
  padding-top: 0.5rem;
}

.prose h3 {
  font-size: var(--t-lg);
  color: var(--pw-text-hi);
  margin: 1.5rem 0 0.5rem;
}

.prose p,
.prose li {
  font-size: var(--t-base);
}

.prose a {
  color: var(--pw-accent);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--pw-input);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.prose pre {
  background: var(--pw-input);
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: var(--t-sm);
}

.prose pre code {
  background: none;
  padding: 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-sm);
  margin: 1rem 0;
}

.prose th,
.prose td {
  border: 1px solid var(--pw-border);
  padding: 0.5rem 0.65rem;
  text-align: left;
}

.prose th {
  background: var(--pw-panel);
}

.prose blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--pw-accent);
  background: var(--pw-panel);
  color: var(--pw-text-2);
}

.prose hr {
  border: none;
  border-top: 1px solid var(--pw-border);
  margin: 2rem 0;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.25rem 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--pw-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.prose img + em,
.prose p:has(+ em) {
  display: block;
  font-size: var(--t-sm);
  color: var(--pw-text-2);
  margin-top: -0.75rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 960px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }
  .docs-toc {
    display: none;
  }
  .docs-menu-btn {
    display: block;
    margin-left: auto;
  }
  .docs-header__links {
    display: none;
  }
  .docs-sidebar {
    display: none;
    position: fixed;
    inset: 56px 0 0 0;
    z-index: 15;
    max-height: none;
    background: var(--pw-bg-deep);
  }
  .docs-sidebar.is-open {
    display: block;
  }
}

@media print {
  .docs-header,
  .docs-sidebar,
  .docs-toc,
  .docs-pager {
    display: none !important;
  }
  .docs-main {
    max-width: none;
  }
}
