/* ================================================================
   APM — Advanced Process Manager — Shared Styles
   ================================================================ */

:root {
  --bg:          #080e1a;
  --bg-raised:   #0d1626;
  --bg-card:     #0f1d2e;
  --bg-code:     #050b16;
  --border:      #162030;
  --border-soft: #1a2d42;
  --text:        #cdd9eb;
  --text-dim:    #6e90b0;
  --text-muted:  #3d5570;
  --green:       #3dd68c;
  --green-faint: rgba(61, 214, 140, 0.08);
  --blue:        #5eaeff;
  --blue-faint:  rgba(94, 174, 255, 0.08);
  --amber:       #f5a623;
  --red:         #f06060;
  --nav-h:       58px;
  --sidebar-w:   240px;
  --radius:      6px;
  --radius-lg:   10px;
  --font-sans:   -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono:   ui-monospace, "SFMono-Regular", "Cascadia Code", "Consolas", "Liberation Mono", monospace;
}

[data-theme="light"] {
  --bg:          #f4f7fb;
  --bg-raised:   #edf1f8;
  --bg-card:     #ffffff;
  --bg-code:     #e8eef6;
  --border:      #c8d6e8;
  --border-soft: #dde6f0;
  --text:        #1a2538;
  --text-dim:    #45607e;
  --text-muted:  #8ba3bb;
  --green:       #12a35d;
  --green-faint: rgba(18, 163, 93, 0.08);
  --blue:        #1a6fd4;
  --blue-faint:  rgba(26, 111, 212, 0.08);
  --amber:       #c07800;
  --red:         #c93030;
}

/* ── Reset & Base ─────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ───────────────────────────────────────────────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 32px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo img {
  height: 22px;
  width: auto;
  filter: invert(1);
  opacity: 0.92;
  transition: opacity 0.2s;
}

[data-theme="light"] .nav-logo img {
  filter: none;
  opacity: 1;
}

.nav-logo:hover img { opacity: 1; }
.nav-logo:hover { text-decoration: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.nav-link {
  color: var(--text-dim);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-raised);
  text-decoration: none;
}

.nav-link.active {
  color: var(--text);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.nav-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  padding: 2px 7px;
  border-radius: 4px;
}

.theme-btn {
  background: none;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.theme-btn:hover {
  color: var(--text);
  background: var(--bg-raised);
  border-color: var(--border);
}

.theme-btn svg { width: 16px; height: 16px; pointer-events: none; }
.theme-btn .icon-sun { display: none; }
.theme-btn .icon-moon { display: block; }
[data-theme="light"] .theme-btn .icon-sun { display: block; }
[data-theme="light"] .theme-btn .icon-moon { display: none; }

/* ── Page wrapper ─────────────────────────────────────────────── */

.page { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ── Buttons ──────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:hover { opacity: 0.88; text-decoration: none; }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--green);
  color: #08200f;
}

[data-theme="light"] .btn-primary { color: #052a10; }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border-soft);
}

/* ── Code blocks ──────────────────────────────────────────────── */

pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.7;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

:not(pre) > code {
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--green);
  font-size: 0.83em;
}

.code-block {
  position: relative;
  margin: 16px 0;
}

.code-block pre {
  padding: 18px 20px;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 3px 9px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  z-index: 1;
}

.copy-btn:hover {
  color: var(--text);
  background: var(--bg-card);
  border-color: var(--border);
}

.copy-btn.copied {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 30%, transparent);
}

.qs-hint {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin: 6px 0;
  line-height: 1.5;
}

.qs-hint a { color: var(--blue); }

.code-label {
  position: absolute;
  top: 10px;
  right: 14px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
}

/* Syntax colours (applied via spans) */
.t-cmd   { color: var(--green); }
.t-flag  { color: var(--blue); }
.t-val   { color: var(--amber); }
.t-cmt   { color: var(--text-muted); font-style: italic; }
.t-key   { color: var(--blue); }
.t-str   { color: var(--green); }
.t-dim   { color: var(--text-dim); }
.t-err   { color: var(--red); }
.prompt  { color: var(--text-muted); user-select: none; }

/* In light mode code blocks keep the dark-theme text readable on the light bg */
[data-theme="light"] pre { color: #1a2538; }
[data-theme="light"] .t-cmt   { color: #7a95b0; }
[data-theme="light"] .prompt  { color: #9ab0c8; }
[data-theme="light"] .t-dim   { color: #556a82; }

/* ── Terminal window ──────────────────────────────────────────── */

.terminal {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.terminal-bar {
  background: color-mix(in srgb, var(--bg-raised) 80%, var(--bg-code));
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid var(--border);
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.terminal-dot.red    { background: #ff5f57; }
.terminal-dot.yellow { background: #febc2e; }
.terminal-dot.green  { background: #28c840; }

.terminal-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 6px;
}

.terminal-body {
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.8;
}

.terminal-body .line { display: block; }
.terminal-body .blank { height: 0.8em; display: block; }

/* ── Hero ─────────────────────────────────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 60px;
  padding: 80px 0 72px;
}

.hero-left {}

.hero-logo {
  height: 52px;
  width: auto;
  filter: invert(1);
  margin-bottom: 24px;
  display: block;
}

[data-theme="light"] .hero-logo { filter: none; }

.hero-tagline {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.hero-sub {
  font-size: 1rem;
  color: var(--text-dim);
  margin-bottom: 8px;
  line-height: 1.5;
}

.hero-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 28px;
}

.hero-note span { color: var(--green); }

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Features ─────────────────────────────────────────────────── */

.features {
  padding: 72px 0;
  border-top: 1px solid var(--border);
}

.section-header {
  margin-bottom: 40px;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--green);
  margin-bottom: 8px;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-sub {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-top: 8px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.feature-card {
  background: var(--bg-card);
  padding: 24px;
  transition: background 0.15s;
}

.feature-card:hover {
  background: var(--bg-raised);
}

.feature-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--green-faint);
  border: 1px solid color-mix(in srgb, var(--green) 20%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.feature-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--green);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feature-icon.blue-icon {
  background: var(--blue-faint);
  border-color: color-mix(in srgb, var(--blue) 20%, transparent);
}

.feature-icon.blue-icon svg { stroke: var(--blue); }

.feature-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.feature-desc {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.55;
}

/* ── Quickstart ───────────────────────────────────────────────── */

.quickstart {
  padding: 72px 0;
  border-top: 1px solid var(--border);
}

.qs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-top: 32px;
}

.qs-block h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
}

/* ── Download ─────────────────────────────────────────────────── */

.download {
  padding: 72px 0;
  border-top: 1px solid var(--border);
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 32px;
}

.download-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0.5;
  cursor: not-allowed;
}

.download-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.download-card-header svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-dim);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.download-platform {
  font-weight: 600;
  font-size: 0.9rem;
}

.download-arch {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.download-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  align-self: flex-start;
}

/* ── Language Agnostic section ────────────────────────────────── */

.langs {
  padding: 72px 0;
  border-top: 1px solid var(--border);
}

.langs-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 860px;
  margin: 0 auto 20px;
  padding: 0 24px;
}

.lang-chip {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 5px 14px;
  border-radius: 20px;
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}

.lang-chip:hover {
  border-color: var(--blue);
  color: var(--text);
}

.lang-chip-etc {
  border-style: dashed;
  color: var(--text-muted);
  font-style: italic;
}

.langs-footnote {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  font-family: var(--font-mono);
}

/* ── Community / Support ──────────────────────────────────────── */

.community {
  border-top: 1px solid var(--border);
  padding: 48px 24px;
}

.community-inner {
  max-width: 860px;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
}

.community-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  color: #5865F2;
}

.community-icon svg {
  width: 100%;
  height: 100%;
}

.community-text {
  flex: 1;
  min-width: 0;
}

.community-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}

.community-sub {
  font-size: 0.84rem;
  color: var(--text-dim);
  line-height: 1.55;
}

.community-btn {
  flex-shrink: 0;
  background: #5865F2;
  color: #fff !important;
  border: none;
  gap: 8px;
  white-space: nowrap;
}

.community-btn:hover {
  background: #4752c4;
  text-decoration: none !important;
}

@media (max-width: 640px) {
  .community-inner {
    flex-direction: column;
    text-align: center;
    padding: 24px 20px;
  }
  .community-btn { width: 100%; justify-content: center; }
}

/* ── Footer ───────────────────────────────────────────────────── */

.footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-logo {
  height: 18px;
  filter: invert(1);
  opacity: 0.4;
}

[data-theme="light"] .footer-logo { filter: none; }

.footer-text {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover { color: var(--text-dim); }

.kofi-link {
  color: var(--text-muted) !important;
  font-size: 0.78rem;
  opacity: 0.7;
  transition: opacity 0.2s, color 0.2s !important;
}

.kofi-link:hover {
  opacity: 1;
  color: var(--amber) !important;
  text-decoration: none !important;
}

/* ── Docs layout (manual) ─────────────────────────────────────── */

.docs-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--nav-h));
  max-width: 1180px;
  margin: 0 auto;
}

.docs-sidebar {
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  padding: 24px 0 24px 24px;
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-track { background: transparent; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0 12px 6px;
}

.sidebar-link {
  display: block;
  font-size: 0.84rem;
  color: var(--text-dim);
  padding: 5px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  border-left: 2px solid transparent;
  margin-right: 8px;
}

.sidebar-link:hover {
  color: var(--text);
  background: var(--bg-raised);
  text-decoration: none;
}

.sidebar-link.active {
  color: var(--green);
  border-left-color: var(--green);
  background: var(--green-faint);
}

.docs-main {
  padding: 40px 48px;
  max-width: 860px;
  min-width: 0;
}

/* ── Docs content ─────────────────────────────────────────────── */

.docs-section {
  margin-bottom: 60px;
  padding-bottom: 60px;
  border-bottom: 1px solid var(--border);
}

.docs-section:last-child {
  border-bottom: none;
}

.docs-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  scroll-margin-top: calc(var(--nav-h) + 24px);
}

.docs-section h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 28px 0 10px;
  color: var(--text);
}

.docs-section h4 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 24px 0 8px;
  font-family: var(--font-mono);
}

.docs-section p {
  font-size: 0.93rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 12px;
}

.docs-section ul,
.docs-section ol {
  padding-left: 20px;
  margin-bottom: 12px;
}

.docs-section li {
  font-size: 0.93rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 4px;
}

.docs-intro {
  font-size: 0.95rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

/* ── Param table ──────────────────────────────────────────────── */

.param-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.84rem;
}

.param-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
}

.param-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.5;
}

.param-table tr:last-child td { border-bottom: none; }

.param-table tr:hover td { background: var(--bg-raised); }

.param-table td:first-child {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--blue);
  white-space: nowrap;
}

.param-table td:nth-child(2) {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.param-table td:nth-child(3) {
  color: var(--text-dim);
  font-size: 0.83rem;
}

/* ── Callout ──────────────────────────────────────────────────── */

.callout {
  background: var(--blue-faint);
  border: 1px solid color-mix(in srgb, var(--blue) 25%, transparent);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 0.875rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.callout.green {
  background: var(--green-faint);
  border-color: color-mix(in srgb, var(--green) 25%, transparent);
}

.callout strong { color: var(--text); }

.callout.warn {
  background: color-mix(in srgb, var(--amber) 8%, transparent);
  border-color: color-mix(in srgb, var(--amber) 30%, transparent);
}
.callout.warn strong { color: var(--amber); }

/* ── Responsive ───────────────────────────────────────────────── */

@media (max-width: 1020px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hero {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .hero-terminal { order: -1; }
}

@media (max-width: 860px) {
  .qs-grid { grid-template-columns: 1fr; }
  .download-grid { grid-template-columns: 1fr 1fr; }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); padding: 16px; display: flex; flex-wrap: wrap; gap: 4px; }
  .sidebar-section { margin-bottom: 0; }
  .sidebar-label { display: none; }
  .sidebar-link { border-left: none; margin-right: 0; padding: 4px 8px; font-size: 0.8rem; }
  .docs-main { padding: 24px 20px; }
}

@media (max-width: 640px) {
  .hero-tagline { font-size: 1.4rem; }
  .features-grid { grid-template-columns: 1fr; }
  .download-grid { grid-template-columns: 1fr; }
  .nav-badge { display: none; }
  .page { padding: 0 16px; }
}

/* ── Download card — live (binaries available) ────────────────────────── */

/* combined selector wins over .download-card's opacity:0.5 */
.download-card.download-card-live {
  opacity: 1;
  cursor: default;
}

/* ── Download file rows ───────────────────────────────────────────────── */

.dl-files {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dl-file-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.dl-link {
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.dl-link:hover { color: var(--green); text-decoration: none; }
.dl-link:hover svg { stroke: var(--green); }

.dl-link svg {
  flex-shrink: 0;
  stroke: var(--text-dim);
  transition: stroke 0.15s;
}

.dl-filename {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dl-size {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.dl-tag {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.dl-tag-upx {
  color: var(--amber);
  border-color: color-mix(in srgb, var(--amber) 30%, transparent);
  background: color-mix(in srgb, var(--amber) 8%, transparent);
}

.dl-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-left: 21px;
  flex-wrap: wrap;
}

.dl-md5 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.dl-md5 code {
  font-size: 0.72rem;
  color: var(--text-dim);
  background: none;
  border: none;
  padding: 0;
}

.dl-vt {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--blue);
  text-decoration: none;
  white-space: nowrap;
}

.dl-vt:hover { text-decoration: underline; }

.dl-vt-na {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.dl-checksums {
  margin-top: 24px;
  text-align: center;
}

.dl-checksums-link {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dl-checksums-link:hover { color: var(--text-dim); }

/* ── Releases list (downloads/index.html) ─────────────────────────────── */

.releases-section {
  padding: 72px 0;
}

.releases-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 32px;
}

.releases-header {
  display: grid;
  grid-template-columns: 110px 120px minmax(0, 1fr) auto;
  padding: 10px 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border-soft);
  gap: 20px;
}

.release-row {
  display: grid;
  width: 100%;
  box-sizing: border-box;
  grid-template-columns: 110px 120px minmax(0, 1fr) auto;
  gap: 20px;
  padding: 15px 20px;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.release-row:last-child { border-bottom: none; }

.release-row:hover {
  background: var(--bg-raised);
  text-decoration: none;
}

.release-row-current {
  background: var(--green-faint);
  border-left: 2px solid var(--green);
  padding-left: 18px;
}

.release-row-current:hover {
  filter: brightness(1.06);
}

.release-ver {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.release-date {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-dim);
}

.release-archs {
  font-size: 0.82rem;
  color: var(--text-dim);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.release-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.release-latest {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green);
  background: var(--green-faint);
  border: 1px solid color-mix(in srgb, var(--green) 25%, transparent);
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
}

.release-dl {
  font-size: 0.82rem;
  color: var(--blue);
  white-space: nowrap;
}

.releases-empty {
  padding: 48px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

@media (max-width: 700px) {
  .releases-header,
  .release-row {
    grid-template-columns: 90px minmax(0, 1fr) auto;
    gap: 12px;
    padding: 12px 14px;
  }
  .releases-header > :nth-child(2),
  .release-date { display: none; }
}

/* ─── Connectors page ──────────────────────────────────────────────────────── */

.connectors-section {
  padding: 64px 0 80px;
}

.connectors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 36px;
}

.conn-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.conn-card-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 14px 18px 12px;
  border-bottom: 2px solid var(--border);
}

.conn-lang {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.conn-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.conn-body {
  padding: 14px 18px 16px;
}

.conn-req {
  margin-bottom: 10px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.conn-req code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.78rem;
}

.conn-ver {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.conn-cmds {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}

.conn-cmd-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-raised);
  padding: 7px 10px;
}

.conn-cmd-row + .conn-cmd-row {
  border-top: 1px solid var(--border);
}

.conn-cmd-label {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.5;
  min-width: 44px;
}

.conn-cmd-text {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.conn-copy-btn {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.67rem;
  padding: 2px 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.conn-copy-btn:hover {
  color: var(--text);
  border-color: var(--border);
}
.conn-copy-btn.copied {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 30%, transparent);
}

.conn-update-row {
  margin-top: 4px;
  padding: 3px 10px;
  opacity: 0.6;
}
.conn-update-label {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  min-width: 76px;
  white-space: nowrap;
}
.conn-update-row .conn-cmd-text {
  font-size: 0.68rem;
}
.conn-update-row .conn-copy-btn {
  font-size: 0.6rem;
  padding: 1px 6px;
}

/* ── Story page ───────────────────────────────────────────────── */

.story-intro {
  padding: 64px 0 0;
}

.story-heading {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 8px 0 16px;
  line-height: 1.2;
}

.story-lead {
  font-size: 1rem;
  color: var(--text-dim);
  line-height: 1.65;
  max-width: 640px;
}

/* ── Timeline ─────────────────────────────────────────────────── */

.story-timeline {
  padding: 56px 0 16px;
  border-top: 1px solid var(--border);
  margin-top: 48px;
  position: relative;
}

/* The vertical line */
.story-timeline::before {
  content: '';
  position: absolute;
  left: 84px;
  top: 56px;
  bottom: 32px;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent,
    var(--border-soft) 40px,
    var(--border-soft) calc(100% - 40px),
    transparent
  );
}

.tl-entry {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 0 32px;
  margin-bottom: 32px;
  position: relative;
}

/* Dot on the line */
.tl-entry::before {
  content: '';
  position: absolute;
  left: 78px;
  top: 12px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border-soft);
  z-index: 1;
  transition: border-color 0.2s;
}

.tl-entry:hover::before {
  border-color: var(--green);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 10%, transparent);
}

/* "Today" entry — filled dot */
.tl-entry-now::before {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 15%, transparent);
}

.tl-year {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  padding-top: 14px;
  padding-right: 30px;
  letter-spacing: 0.04em;
  line-height: 1;
}

.tl-entry-now .tl-year {
  color: var(--green);
}

.tl-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px 24px 18px;
  transition: border-color 0.15s;
}

.tl-entry:hover .tl-card {
  border-color: color-mix(in srgb, var(--border-soft) 60%, var(--green) 40%);
}

.tl-card-now {
  border-color: color-mix(in srgb, var(--green) 22%, transparent);
  background: color-mix(in srgb, var(--green) 4%, var(--bg-card));
}

.tl-title {
  font-size: 0.975rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.tl-body {
  font-size: 0.875rem;
  color: var(--text-dim);
  line-height: 1.65;
}

.tl-body p {
  margin-bottom: 8px;
}

.tl-body p:last-child {
  margin-bottom: 0;
}

.tl-body strong {
  color: var(--text);
  font-weight: 600;
}

.tl-list {
  padding-left: 18px;
  margin: 8px 0;
}

.tl-list li {
  margin-bottom: 3px;
  line-height: 1.6;
}

.tl-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.tl-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 3px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.tl-tag-g {
  color: var(--green);
  background: var(--green-faint);
  border: 1px solid color-mix(in srgb, var(--green) 20%, transparent);
}

.tl-tag-b {
  color: var(--blue);
  background: var(--blue-faint);
  border: 1px solid color-mix(in srgb, var(--blue) 20%, transparent);
}

.tl-tag-a {
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber) 22%, transparent);
}

/* ── Story CTA ────────────────────────────────────────────────── */

.story-cta {
  padding: 48px 0 72px;
}

.story-cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
}

.story-cta-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.story-cta-sub {
  font-size: 0.84rem;
  color: var(--text-dim);
}

.story-cta-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .story-heading { font-size: 1.5rem; }

  .story-timeline::before { display: none; }

  .tl-entry {
    grid-template-columns: 1fr;
    gap: 4px 0;
  }

  .tl-entry::before { display: none; }

  .tl-year {
    text-align: left;
    padding-top: 0;
    color: var(--green);
    font-size: 0.68rem;
  }

  .story-cta-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
  }

  .story-cta-actions { width: 100%; }
  .story-cta-actions .btn { flex: 1; justify-content: center; }
}

/* ─── IPC protocol tabs ────────────────────────────────────────────────────── */

.ipc-tabs {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.ipc-tab-bar {
  display: flex;
  background: var(--code-bg);
  border-bottom: 1px solid var(--border);
}

.ipc-tab-btn {
  flex: 1;
  padding: 9px 18px;
  background: none;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ipc-tab-btn:last-child { border-right: none; }
.ipc-tab-btn:hover { background: var(--border); color: var(--text); }
.ipc-tab-btn.active { color: var(--blue); background: color-mix(in srgb, var(--blue) 8%, transparent); }

.ipc-tab-panel { display: none; padding: 20px; }
.ipc-tab-panel.active { display: block; }
.ipc-tab-panel .code-block { margin-bottom: 0; }


/* ── Changelog ────────────────────────────────────────────────────────────── */
.changelog-section {
  max-width: 860px;
  margin: 0 auto 3rem;
  padding: 0 1rem;
}

.changelog {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.6rem 2rem;
  line-height: 1.7;
}

.changelog h2 { font-size: 1.3rem; margin: 0 0 1.2rem; color: var(--text); }
.changelog h3 { font-size: 1.05rem; margin: 1.4rem 0 0.4rem; color: var(--blue); }
.changelog h4 { font-size: 0.95rem; margin: 1rem 0 0.3rem; color: var(--text-dim); }
.changelog p  { margin: 0.3rem 0 0.6rem; color: var(--text-dim); font-size: 0.95rem; }
.changelog ul { margin: 0.3rem 0 0.8rem 1.2rem; padding: 0; }
.changelog li { margin: 0.2rem 0; color: var(--text-dim); font-size: 0.95rem; }
.changelog code { font-family: var(--font-mono); font-size: 0.85em; background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
.changelog strong { color: var(--text); }
