/* ═══════════════════════════════════════════════════════════════
   ASYNC Documentation — Dedicated Stylesheet
   Extends the Phoebuz design system for long-form documentation
   ═══════════════════════════════════════════════════════════════ */

/* ---------- Doc Layout ---------- */
.docs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  max-width: 1320px;
  margin: 0 auto;
  min-height: calc(100vh - 52px);
}

@media (max-width: 1024px) {
  .docs-layout { grid-template-columns: 1fr; }
}

/* ---------- Sidebar / TOC ---------- */
.docs-sidebar {
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  overflow-y: auto;
  padding: 2rem 1.5rem 3rem 2rem;
  border-right: 1px solid rgba(0,0,0,.06);
  background: var(--surface);
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,.12) transparent;
}
.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-thumb { background: rgba(0,0,0,.12); border-radius: 4px; }

@media (max-width: 1024px) {
  .docs-sidebar {
    position: relative;
    top: auto;
    height: auto;
    border-right: none;
    border-bottom: 1px solid rgba(0,0,0,.06);
    padding: 1.5rem;
  }
}

.docs-sidebar-title {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid rgba(0,0,0,.06);
}

.docs-nav { list-style: none; }
.docs-nav li { margin-bottom: .15rem; }
.docs-nav a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .75rem;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: all var(--transition);
  text-decoration: none;
}
.docs-nav a:hover {
  background: rgba(0,113,227,.06);
  color: var(--accent);
}
.docs-nav a.active {
  background: rgba(0,113,227,.08);
  color: var(--accent);
  font-weight: 600;
}
.docs-nav .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: .6;
}
.docs-nav a.active .nav-icon { opacity: 1; }

/* Sub-nav (section anchors) */
.docs-subnav {
  list-style: none;
  padding-left: 2.3rem;
  margin-top: .15rem;
  margin-bottom: .5rem;
}
.docs-subnav a {
  font-size: .8rem;
  padding: .3rem .75rem;
  color: var(--ink-muted);
  font-weight: 400;
}
.docs-subnav a:hover { color: var(--accent); background: none; }
.docs-subnav a.active { color: var(--accent); background: none; font-weight: 600; }

/* ---------- Main Content ---------- */
.docs-main {
  padding: 2.5rem 3rem 5rem;
  max-width: 860px;
  min-width: 0;
}

@media (max-width: 1024px) {
  .docs-main { padding: 2rem 1.5rem 4rem; }
}

/* ---------- Doc Hero (per page) ---------- */
.docs-hero {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.docs-hero .eyebrow {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .75rem;
}
.docs-hero h1 {
  font-size: var(--fs-h1);
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.1;
  margin-bottom: .75rem;
  color: var(--ink);
}
.docs-hero .docs-hero-subtitle {
  font-size: 1.125rem;
  color: var(--ink-muted);
  line-height: 1.6;
  max-width: 640px;
}

/* Role badge */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .3rem .75rem;
  border-radius: 980px;
  margin-right: .5rem;
  margin-top: .75rem;
}
.role-badge.admin { background: rgba(222,53,11,.08); color: #DE350B; }
.role-badge.project-admin { background: rgba(0,135,90,.08); color: #00875A; }
.role-badge.all-users { background: rgba(0,82,204,.08); color: #0052CC; }
.role-badge svg { width: 14px; height: 14px; }

/* ---------- Content Sections ---------- */
.docs-section {
  margin-bottom: 3.5rem;
  scroll-margin-top: 80px;
}
.docs-section h2 {
  font-size: var(--fs-h2);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.15;
  margin-bottom: 1rem;
  color: var(--ink);
  padding-top: .5rem;
}
.docs-section h3 {
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: -.015em;
  margin-top: 2.5rem;
  margin-bottom: .75rem;
  color: var(--ink);
}
.docs-section h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: .5rem;
  color: var(--ink);
}
.docs-section p {
  color: var(--ink-soft);
  line-height: 1.7;
  margin-bottom: 1rem;
}
.docs-section ul, .docs-section ol {
  color: var(--ink-soft);
  line-height: 1.7;
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}
.docs-section li { margin-bottom: .35rem; }
.docs-section li strong { color: var(--ink); }

/* ---------- Screenshot Placeholder ---------- */
.docs-screenshot {
  position: relative;
  background: var(--surface-alt);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1.5rem 0 2rem;
  transition: all var(--transition);
}
.docs-screenshot:hover { box-shadow: var(--shadow-lg); }
.docs-screenshot img {
  width: 100%;
  display: block;
  border-radius: var(--radius);
}
.docs-screenshot-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  gap: .75rem;
  color: var(--ink-muted);
}
.docs-screenshot-placeholder svg {
  width: 48px;
  height: 48px;
  opacity: .3;
}
.docs-screenshot-placeholder span {
  font-size: .8rem;
  font-weight: 500;
  opacity: .6;
}
.docs-screenshot-caption {
  font-size: .8rem;
  color: var(--ink-muted);
  text-align: center;
  padding: .75rem 1rem;
  background: var(--white);
  border-top: 1px solid rgba(0,0,0,.04);
}

/* ---------- Step-by-step Guide ---------- */
.docs-steps {
  counter-reset: step-counter;
  list-style: none;
  padding-left: 0;
  margin: 1.5rem 0 2rem;
}
.docs-step {
  counter-increment: step-counter;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 1.25rem;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(0,0,0,.04);
}
.docs-step:last-child { border-bottom: none; margin-bottom: 0; }
.docs-step-number {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(0,113,227,.08);
  color: var(--accent);
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.docs-step-number::before { content: counter(step-counter); }
.docs-step-content h4 {
  margin-top: 0;
  margin-bottom: .4rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}
.docs-step-content p {
  margin-bottom: .75rem;
}

/* ---------- Callout / Tip / Warning ---------- */
.docs-callout {
  display: flex;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-sm);
  margin: 1.5rem 0;
  line-height: 1.6;
}
.docs-callout p { margin-bottom: 0; }
.docs-callout-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: flex-start;
  padding-top: 2px;
  font-size: 1.1rem;
}
.docs-callout.tip {
  background: rgba(0,113,227,.05);
  border: 1px solid rgba(0,113,227,.12);
  color: var(--ink-soft);
}
.docs-callout.warning {
  background: rgba(255,159,10,.06);
  border: 1px solid rgba(255,159,10,.15);
  color: var(--ink-soft);
}
.docs-callout.info {
  background: rgba(52,199,89,.05);
  border: 1px solid rgba(52,199,89,.12);
  color: var(--ink-soft);
}
.docs-callout.danger {
  background: rgba(222,53,11,.04);
  border: 1px solid rgba(222,53,11,.12);
  color: var(--ink-soft);
}

/* ---------- Inline code / kbd ---------- */
.docs-section code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: .85em;
  background: rgba(0,0,0,.04);
  padding: .15em .45em;
  border-radius: 5px;
  color: var(--ink);
}
.docs-section kbd {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: .8em;
  font-weight: 600;
  background: var(--white);
  border: 1px solid rgba(0,0,0,.12);
  border-bottom-width: 2px;
  padding: .15em .5em;
  border-radius: 5px;
  color: var(--ink);
}

/* ---------- Navigation breadcrumb ---------- */
.docs-breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: var(--ink-muted);
  margin-bottom: 1.5rem;
}
.docs-breadcrumb a { color: var(--ink-muted); font-weight: 500; }
.docs-breadcrumb a:hover { color: var(--accent); }
.docs-breadcrumb .sep { opacity: .4; }

/* ---------- Feature table ---------- */
.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0 2rem;
  font-size: .9rem;
}
.docs-table th {
  text-align: left;
  font-weight: 600;
  font-size: .75rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: .75rem 1rem;
  border-bottom: 2px solid rgba(0,0,0,.08);
  background: var(--surface-alt);
}
.docs-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid rgba(0,0,0,.04);
  color: var(--ink-soft);
  vertical-align: top;
}
.docs-table tr:hover td { background: rgba(0,113,227,.02); }
.docs-table .check { color: var(--green); font-weight: 600; }
.docs-table .cross { color: var(--ink-muted); opacity: .4; }

/* ---------- Accordion ---------- */
.docs-accordion { margin: 1.5rem 0; }
.docs-accordion details {
  border: 1px solid rgba(0,0,0,.06);
  border-radius: var(--radius-sm);
  margin-bottom: .5rem;
  overflow: hidden;
  transition: all var(--transition);
}
.docs-accordion details[open] {
  box-shadow: var(--shadow);
}
.docs-accordion summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .75rem;
  list-style: none;
  color: var(--ink);
  transition: background var(--transition);
}
.docs-accordion summary::-webkit-details-marker { display: none; }
.docs-accordion summary::before {
  content: '';
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  flex-shrink: 0;
  transition: transform var(--transition);
}
details[open] > summary::before { transform: rotate(90deg); }
.docs-accordion summary:hover { background: var(--surface-alt); }
.docs-accordion .accordion-body {
  padding: 0 1.25rem 1.25rem 3rem;
}

/* ---------- Page navigation (prev/next) ---------- */
.docs-page-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(0,0,0,.06);
}
.docs-page-nav a {
  display: block;
  padding: 1.25rem 1.5rem;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  text-decoration: none;
}
.docs-page-nav a:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(0,113,227,.08);
}
.docs-page-nav .nav-label {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: .35rem;
}
.docs-page-nav .nav-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}
.docs-page-nav .next { text-align: right; }

/* ---------- "Last updated" ---------- */
.docs-updated {
  font-size: .75rem;
  color: var(--ink-muted);
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(0,0,0,.04);
}

/* ---------- Print ---------- */
@media print {
  .docs-sidebar, .nav, .footer { display: none; }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-main { padding: 1rem; max-width: 100%; }
  .docs-screenshot { break-inside: avoid; }
}
