/* PocketCtl daemon docs — technical editorial layout on the shared landing theme. */
.docs-page {
  --docs-sidebar: 268px;
  --docs-content: 820px;
  min-height: 100vh;
  background:
    linear-gradient(90deg, transparent 49px, color-mix(in srgb, var(--border) 35%, transparent) 50px, transparent 51px) 0 0 / 50px 50px,
    radial-gradient(ellipse 55% 36% at 72% 0%, var(--glow-accent), transparent 72%),
    var(--bg);
}

.docs-nav { position: fixed; }
.docs-brand-label {
  color: var(--fg-tertiary); font-family: var(--font-mono); font-size: 11px;
  font-weight: 650; letter-spacing: .13em; text-transform: uppercase;
  border-left: 1px solid var(--border-light); padding-left: 10px; margin-left: 2px;
}
.docs-nav-actions { display: flex; align-items: center; gap: 8px; }
.docs-home-link {
  color: var(--fg-secondary); font-size: 14px; font-weight: 550; text-decoration: none;
  padding: 7px 11px; border-radius: 8px; transition: color .15s, background .15s;
}
.docs-home-link:hover { color: var(--fg); background: var(--surface-hover); }
.docs-mobile-toc { display: none; width: auto; padding: 0 10px; gap: 7px; }
.docs-mobile-toc span { font-size: 12px; font-weight: 650; }

.docs-shell { display: grid; grid-template-columns: var(--docs-sidebar) minmax(0, 1fr); min-height: 100vh; }
.docs-sidebar {
  position: fixed; z-index: 70; top: 64px; bottom: 0; left: 0; width: var(--docs-sidebar);
  border-right: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(18px); overflow-y: auto; scrollbar-width: thin;
}
.docs-sidebar-inner { min-height: 100%; display: flex; flex-direction: column; padding: 34px 24px 24px 30px; }
.docs-sidebar-kicker {
  color: var(--accent); font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: .16em; margin: 0 0 20px 10px;
}
.docs-toc { display: flex; flex-direction: column; gap: 2px; }
.docs-toc p {
  margin: 21px 0 7px 10px; color: var(--fg-tertiary); font-size: 10px; font-weight: 750;
  letter-spacing: .13em; text-transform: uppercase;
}
.docs-toc p:first-child { margin-top: 0; }
.docs-toc a {
  position: relative; display: block; padding: 7px 10px; border-radius: 7px;
  color: var(--fg-secondary); font-size: 13px; font-weight: 520; text-decoration: none;
  transition: color .15s, background .15s, transform .15s;
}
.docs-toc a:hover { color: var(--fg); background: var(--surface-hover); transform: translateX(2px); }
.docs-toc a.active { color: var(--accent); background: var(--accent-subtle); }
.docs-toc a.active::before {
  content: ""; position: absolute; left: -1px; top: 9px; bottom: 9px; width: 2px;
  border-radius: 2px; background: var(--accent);
}
.docs-sidebar-help {
  margin-top: auto; padding: 20px 10px 4px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--fg-tertiary);
}
.docs-sidebar-help a { color: var(--accent); text-decoration: none; font-weight: 600; }

.docs-main { grid-column: 2; min-width: 0; }
.docs-hero, .docs-article, .docs-footer { width: min(var(--docs-content), calc(100% - 56px)); margin-inline: auto; }
.docs-hero { padding: 142px 0 82px; }
.docs-version {
  display: inline-flex; align-items: center; gap: 9px; padding: 6px 10px 6px 8px;
  border: 1px solid var(--border); border-radius: 999px; background: color-mix(in srgb, var(--surface) 85%, transparent);
  color: var(--fg-secondary); font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  animation: fade-in-up .45s ease both;
}
.docs-version > span:first-child { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px var(--success-bg); }
.docs-hero h1 {
  max-width: 720px; margin: 24px 0 20px; font-family: var(--font-display);
  font-size: clamp(42px, 6.6vw, 68px); font-weight: 780; line-height: 1.04; letter-spacing: -.045em;
  animation: fade-in-up .5s ease .06s both;
}
.docs-hero > p {
  max-width: 650px; color: var(--fg-secondary); font-size: clamp(17px, 2vw, 20px); line-height: 1.75;
  animation: fade-in-up .5s ease .12s both;
}
.docs-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; animation: fade-in-up .5s ease .18s both; }
.docs-hero-actions a {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 28px;
  padding: 12px 16px; border-radius: 9px; font-size: 14px; font-weight: 650; text-decoration: none;
  transition: transform .16s, background .16s, border-color .16s;
}
.docs-primary-action { min-width: 160px; color: #fff; background: var(--primary-btn); box-shadow: 0 8px 28px rgba(35,134,54,.18); }
.docs-primary-action:hover { background: var(--primary-btn-hover); transform: translateY(-2px); }
.docs-secondary-action { color: var(--fg); border: 1px solid var(--border-light); background: var(--surface); }
.docs-secondary-action:hover { border-color: var(--accent); transform: translateY(-2px); }
.docs-quickline {
  display: flex; align-items: center; margin-top: 54px; padding: 17px 20px;
  border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--surface) 72%, transparent);
  box-shadow: var(--shadow-sm); animation: fade-in-up .5s ease .24s both;
}
.docs-quickline > span { display: flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--fg-secondary); font-size: 12px; }
.docs-quickline b { font-family: var(--font-mono); color: var(--accent); font-size: 10px; }
.docs-quickline i { flex: 1; min-width: 20px; height: 1px; margin: 0 14px; background: var(--border-light); position: relative; }
.docs-quickline i::after { content: ""; position: absolute; right: -1px; top: -2px; width: 5px; height: 5px; border-top: 1px solid var(--fg-tertiary); border-right: 1px solid var(--fg-tertiary); transform: rotate(45deg); }

.docs-section { scroll-margin-top: 88px; padding: 72px 0; border-top: 1px solid var(--border); }
.section-heading { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.section-heading > span {
  margin-top: 6px; font-family: var(--font-mono); font-size: 10px; font-weight: 750;
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  background: var(--accent-subtle); padding: 4px 6px; border-radius: 5px;
}
.section-heading p { color: var(--fg-tertiary); font-size: 10px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 3px; }
.section-heading h2 { font-family: var(--font-display); font-size: clamp(27px, 4vw, 36px); line-height: 1.16; letter-spacing: -.025em; }
.section-lead { color: var(--fg-secondary); font-size: 17px; line-height: 1.85; margin-bottom: 30px; }
.docs-section > p:not(.section-lead):not(.reference-more) { color: var(--fg-secondary); font-size: 15px; line-height: 1.85; margin-top: 22px; }
.docs-section h3 { font-size: 15px; line-height: 1.5; margin: 27px 0 10px; }
.docs-section p code, .docs-section li code, .reference-more code {
  padding: 2px 6px; border: 1px solid var(--border); border-radius: 5px;
  background: var(--code-bg); color: var(--accent); font-family: var(--font-mono); font-size: .88em;
}
.docs-section a { color: var(--accent); }

.architecture-strip {
  display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; align-items: stretch;
  margin: 30px 0; padding: 18px; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.architecture-strip > div { display: flex; min-width: 0; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 12px 7px; }
.architecture-strip > div.accent { border-radius: 10px; background: var(--accent-subtle); }
.arch-icon { font-family: var(--font-mono); color: var(--accent); font-size: 19px; height: 28px; }
.architecture-strip b { font-size: 12px; }
.architecture-strip small { color: var(--fg-tertiary); font-size: 9px; line-height: 1.35; margin-top: 3px; }
.arch-link { width: 20px; align-self: center; height: 1px; background: var(--border-light); position: relative; }
.arch-link::after { content: ""; position: absolute; right: -1px; top: -2px; width: 5px; height: 5px; border-top: 1px solid var(--fg-tertiary); border-right: 1px solid var(--fg-tertiary); transform: rotate(45deg); }
.arch-link em { position: absolute; left: 50%; bottom: 7px; transform: translateX(-50%); color: var(--fg-tertiary); font-family: var(--font-mono); font-size: 7px; font-style: normal; }

.docs-note { display: flex; align-items: flex-start; gap: 13px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 10px; margin-top: 24px; }
.docs-note > span { flex: 0 0 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; font-family: var(--font-mono); font-size: 11px; font-weight: 750; }
.docs-note p { color: var(--fg-secondary); font-size: 13px; line-height: 1.7; }
.docs-note.info { background: var(--accent-subtle); border-color: color-mix(in srgb, var(--accent) 24%, var(--border)); }
.docs-note.info > span { color: var(--accent); background: var(--accent-muted); }
.docs-note.tip { background: var(--success-bg); border-color: color-mix(in srgb, var(--success) 25%, var(--border)); }
.docs-note.tip > span { color: var(--success); background: color-mix(in srgb, var(--success) 16%, transparent); }
.docs-note.warning { background: var(--warning-bg); border-color: color-mix(in srgb, var(--warning) 26%, var(--border)); }
.docs-note.warning > span { color: var(--warning); background: color-mix(in srgb, var(--warning) 17%, transparent); }

.requirements-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 24px 0 28px; }
.requirements-grid > div { padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.requirements-grid b, .requirements-grid span { display: block; }
.requirements-grid b { font-size: 13px; margin-bottom: 3px; }
.requirements-grid span { color: var(--fg-tertiary); font-size: 11px; font-family: var(--font-mono); }
.code-block { position: relative; overflow: hidden; margin: 14px 0 20px; border: 1px solid var(--border-light); border-radius: 12px; background: var(--code-bg); box-shadow: var(--shadow-sm); }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 11px 9px 15px; border-bottom: 1px solid var(--border); color: var(--fg-tertiary); font-family: var(--font-mono); font-size: 10px; letter-spacing: .04em; }
.code-block pre { overflow-x: auto; padding: 19px 20px 21px; color: var(--fg); font-family: var(--font-mono); font-size: 13px; line-height: 1.8; }
.copy-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 55px; height: 28px; padding: 0 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--fg-secondary); font-family: var(--font-body); font-size: 11px; font-weight: 600; cursor: pointer; transition: border-color .15s, color .15s, background .15s; }
.copy-btn:hover { color: var(--fg); border-color: var(--border-light); background: var(--surface-hover); }
.copy-btn.copied { color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, var(--border)); }
.copy-btn.icon-only { min-width: 28px; width: 28px; padding: 0; }
.copy-btn.icon-only::before { content: ""; width: 9px; height: 10px; border: 1px solid currentColor; border-radius: 2px; box-shadow: 3px -3px 0 -1px var(--code-bg), 3px -3px 0 0 currentColor; }
.copy-btn.icon-only.copied::before { content: "✓"; width: auto; height: auto; border: 0; box-shadow: none; }
.code-block.compact { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 0; }
.code-block.compact pre { padding: 13px 15px; font-size: 12px; }
.code-block.compact .copy-btn { margin-right: 9px; }

.step-list { margin-top: 10px; }
.step-row { display: grid; grid-template-columns: 38px 1fr; gap: 16px; padding: 18px 0 22px; border-top: 1px solid var(--border); }
.step-row:first-child { border-top: 0; }
.step-row > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: var(--accent); background: var(--accent-subtle); border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border)); font-family: var(--font-mono); font-size: 11px; }
.step-row h3 { margin: 4px 0 0; }
.success-card { display: flex; align-items: flex-start; gap: 14px; margin-top: 24px; padding: 20px; border: 1px solid color-mix(in srgb, var(--success) 28%, var(--border)); border-radius: 12px; background: var(--surface); }
.success-mark { flex: 0 0 30px; height: 30px; display: grid; place-items: center; color: var(--success); background: var(--success-bg); border-radius: 8px; font-weight: 750; }
.success-card b { display: block; font-size: 14px; margin-bottom: 4px; }
.success-card p { color: var(--fg-secondary); font-size: 13px; line-height: 1.65; }

.agent-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.agent-card { position: relative; overflow: hidden; min-height: 210px; padding: 21px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); }
.agent-card.featured::after { content: ""; position: absolute; width: 110px; height: 110px; right: -50px; top: -48px; border-radius: 50%; background: var(--glow-accent); }
.agent-top { display: flex; gap: 11px; align-items: center; margin-bottom: 15px; }
.agent-glyph { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; color: var(--accent); background: var(--accent-subtle); border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border)); font-family: var(--font-mono); font-size: 14px; font-weight: 750; }
.agent-top h3 { margin: 0; font-size: 14px; }
.agent-top div span { display: block; color: var(--fg-tertiary); font-size: 10px; margin-top: 1px; }
.agent-card > p { min-height: 66px; color: var(--fg-secondary); font-size: 12px; line-height: 1.65; }
.agent-card > code, .mini-command { display: block; margin-top: 15px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--code-bg); color: var(--accent); font-family: var(--font-mono); font-size: 9px; }
.mini-command { display: flex; align-items: center; justify-content: space-between; padding: 5px 5px 5px 10px; }
.mini-command .copy-btn { transform: scale(.88); }

.command-list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.command-list > div { display: grid; grid-template-columns: minmax(250px, .9fr) 1fr; gap: 22px; align-items: center; padding: 15px 18px; border-top: 1px solid var(--border); }
.command-list > div:first-child { border-top: 0; }
.command-list code { color: var(--accent); font-family: var(--font-mono); font-size: 11px; overflow-wrap: anywhere; }
.command-list span { color: var(--fg-secondary); font-size: 12px; }

.ops-divider { position: relative; margin: 44px 0 4px; padding: 34px 30px; border: 1px dashed color-mix(in srgb, var(--warning) 38%, var(--border)); border-radius: 14px; background: linear-gradient(120deg, var(--warning-bg), transparent 68%); }
.ops-divider span { display: block; color: var(--warning); font-family: var(--font-mono); font-size: 10px; font-weight: 750; letter-spacing: .12em; }
.ops-divider p { max-width: 620px; margin-top: 8px; color: var(--fg-secondary); font-size: 13px; line-height: 1.65; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.two-col > div { padding: 18px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.two-col h3 { margin: 0 0 6px; font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.two-col p { color: var(--fg-secondary); font-size: 12px; line-height: 1.7; }
.docs-list { margin: 24px 0 0; padding-left: 0; list-style: none; }
.docs-list li { position: relative; margin: 10px 0; padding-left: 22px; color: var(--fg-secondary); font-size: 14px; line-height: 1.75; }
.docs-list li::before { content: "→"; position: absolute; left: 0; color: var(--accent); font-family: var(--font-mono); }

.env-table, .reference-table { overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.env-row { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 16px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--border); }
.env-row:first-child { border-top: 0; }
.env-row.header, .ref-row.header { background: var(--bg-secondary); color: var(--fg-tertiary); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.env-row code { color: var(--accent); font-family: var(--font-mono); font-size: 10px; overflow-wrap: anywhere; }
.env-row span { color: var(--fg-secondary); font-size: 11px; line-height: 1.5; }
.env-row.header span { color: var(--fg-tertiary); }

.diagnostic-flow { margin: 0; padding: 0; list-style: none; }
.diagnostic-flow li { display: grid; grid-template-columns: 36px 1fr; gap: 14px; padding: 18px 0; border-top: 1px solid var(--border); }
.diagnostic-flow li:first-child { border-top: 0; }
.diagnostic-flow li > span { width: 28px; height: 28px; display: grid; place-items: center; color: var(--accent); background: var(--accent-subtle); border-radius: 7px; font-family: var(--font-mono); font-size: 10px; }
.diagnostic-flow b, .diagnostic-flow code { display: inline-block; }
.diagnostic-flow b { min-width: 120px; font-size: 13px; }
.diagnostic-flow code { color: var(--accent); font-family: var(--font-mono); font-size: 11px; }
.diagnostic-flow p { margin-top: 5px; color: var(--fg-secondary); font-size: 12px; }

.boundary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.boundary-card { padding: 24px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); }
.boundary-card > span { display: inline-block; margin-bottom: 18px; padding: 4px 7px; border-radius: 5px; font-family: var(--font-mono); font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.local-card > span { color: var(--success); background: var(--success-bg); }
.relay-card > span { color: var(--warning); background: var(--warning-bg); }
.boundary-card h3 { margin: 0 0 14px; font-size: 15px; }
.boundary-card ul { padding-left: 17px; }
.boundary-card li { margin: 8px 0; color: var(--fg-secondary); font-size: 12px; line-height: 1.6; }

.ref-row { display: grid; grid-template-columns: 1.25fr 1fr; gap: 20px; align-items: center; padding: 14px 17px; border-top: 1px solid var(--border); }
.ref-row:first-child { border-top: 0; }
.ref-row code { color: var(--accent); font-family: var(--font-mono); font-size: 10px; overflow-wrap: anywhere; }
.ref-row span { color: var(--fg-secondary); font-size: 12px; }
.ref-row.header span { color: var(--fg-tertiary); }
.reference-more { color: var(--fg-secondary); font-size: 13px; margin-top: 18px; }
.danger-code { border-color: color-mix(in srgb, var(--error) 30%, var(--border)); }

.docs-end-card { margin: 72px 0 92px; padding: clamp(30px, 6vw, 52px); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); border-radius: 18px; background: radial-gradient(circle at 92% 18%, var(--accent-muted), transparent 35%), var(--surface); box-shadow: var(--shadow-lg); }
.docs-end-card > span { color: var(--success); font-family: var(--font-mono); font-size: 10px; font-weight: 750; letter-spacing: .16em; }
.docs-end-card h2 { max-width: 610px; margin: 13px 0 12px; font-family: var(--font-display); font-size: clamp(27px, 4vw, 38px); line-height: 1.16; letter-spacing: -.025em; }
.docs-end-card p { max-width: 560px; color: var(--fg-secondary); font-size: 14px; line-height: 1.7; }
.docs-end-card div { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 24px; }
.docs-end-card a { color: var(--accent); font-size: 13px; font-weight: 650; text-decoration: none; }
.docs-footer { display: flex; justify-content: space-between; gap: 20px; padding: 28px 0 42px; border-top: 1px solid var(--border); color: var(--fg-tertiary); font-size: 11px; }
.docs-footer div { display: flex; gap: 18px; }
.docs-footer a { color: var(--fg-tertiary); text-decoration: none; }
.docs-footer a:hover { color: var(--fg-secondary); }

@media (max-width: 960px) {
  .docs-page { --docs-sidebar: 0px; }
  .docs-shell { display: block; }
  .docs-main { grid-column: auto; }
  .docs-sidebar { width: min(310px, 88vw); transform: translateX(-102%); box-shadow: var(--shadow-xl); transition: transform .22s ease; }
  .docs-sidebar.open { transform: translateX(0); }
  .docs-backdrop { position: fixed; z-index: 65; inset: 64px 0 0; background: var(--overlay); backdrop-filter: blur(3px); }
  .docs-mobile-toc { display: inline-flex; }
  .docs-home-link { display: none; }
}

@media (max-width: 680px) {
  .docs-nav { padding-inline: 17px; }
  .docs-nav-actions { gap: 5px; }
  .docs-brand-label, .docs-nav-actions > a.nav-btn { display: none; }
  .docs-hero, .docs-article, .docs-footer { width: min(100% - 34px, var(--docs-content)); }
  .docs-hero { padding: 112px 0 58px; }
  .docs-hero h1 { font-size: 42px; }
  .docs-quickline { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
  .docs-quickline i { display: none; }
  .docs-section { padding: 58px 0; }
  .architecture-strip { grid-template-columns: 1fr 1fr; gap: 8px; }
  .arch-link { display: none; }
  .architecture-strip > div { min-height: 82px; border: 1px solid var(--border); border-radius: 9px; }
  .requirements-grid, .agent-grid, .two-col, .boundary-grid { grid-template-columns: 1fr; }
  .agent-card { min-height: 0; }
  .agent-card > p { min-height: 0; }
  .command-list > div { grid-template-columns: 1fr; gap: 5px; }
  .env-row { grid-template-columns: 1fr; gap: 4px; }
  .env-row.header { display: none; }
  .diagnostic-flow b, .diagnostic-flow code { display: block; }
  .diagnostic-flow code { margin-top: 5px; }
  .ref-row { grid-template-columns: 1fr; gap: 5px; }
  .ref-row.header { display: none; }
  .docs-footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .docs-hero > *, .docs-version { animation: none !important; }
  .docs-sidebar, .docs-toc a, .docs-hero-actions a { transition: none !important; }
}
