/* huly-mcp-selfhost — project site. Plain CSS, no build step. */

:root {
  --bg: #fafaf9;
  --bg-sunken: #f2f2f0;
  --fg: #171717;
  --fg-2: #4d4d4b;
  --fg-3: #737370;
  --line: #e2e2df;
  --line-strong: #cfcfcb;
  --accent: #b5522f;
  --accent-soft: rgba(181, 82, 47, 0.1);
  --code-bg: #111111;
  --code-fg: #e6e6e3;
  --code-dim: #8a8a86;
  --code-line: #262626;
  --add: #7fc28b;
  --del: #e88f8f;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --max: 68rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --radius: 6px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c0c;
    --bg-sunken: #141414;
    --fg: #ededeb;
    --fg-2: #b4b4b0;
    --fg-3: #85857f;
    --line: #232323;
    --line-strong: #333333;
    --accent: #e08a5f;
    --accent-soft: rgba(224, 138, 95, 0.12);
    --code-bg: #111111;
    --code-line: #232323;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c0c0c;
  --bg-sunken: #141414;
  --fg: #ededeb;
  --fg-2: #b4b4b0;
  --fg-3: #85857f;
  --line: #232323;
  --line-strong: #333333;
  --accent: #e08a5f;
  --accent-soft: rgba(224, 138, 95, 0.12);
  --code-bg: #111111;
  --code-line: #232323;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

code, pre, kbd, .mono { font-family: var(--mono); }
code { font-size: 0.875em; }
p code, li code, td code, dd code {
  padding: 0.1em 0.35em;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-sunken);
  overflow-wrap: anywhere; /* long URLs/identifiers must not widen the page on small screens */
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* ── Top bar ─────────────────────────────────────────────────────────────── */

.bar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar .wrap { display: flex; align-items: center; gap: 1.5rem; min-height: 3.5rem; }
.brand { font: 500 0.875rem var(--mono); text-decoration: none; white-space: nowrap; }
.brand span { color: var(--fg-3); }

/* Section links: one row on wide screens, a scrollable strip below the bar on narrow ones. */
.sections { display: flex; align-items: center; gap: 0.25rem; font-size: 0.875rem; }
.sections a {
  position: relative;
  padding: 0.4rem 0.6rem; border-radius: var(--radius);
  text-decoration: none; color: var(--fg-2); white-space: nowrap;
  transition: color 120ms ease, background-color 120ms ease;
}
.sections a:hover { color: var(--fg); background: var(--bg-sunken); }
.sections a[aria-current="true"] { color: var(--fg); }
.sections a[aria-current="true"]::after {
  content: ""; position: absolute; left: 0.6rem; right: 0.6rem; bottom: -0.55rem;
  height: 2px; border-radius: 1px; background: var(--accent);
}
.sections .docs-sm { display: none; }

.bar-end { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; font-size: 0.875rem; }
.bar-end .docs { text-decoration: none; color: var(--fg-2); }
.bar-end .docs:hover { color: var(--fg); }
.icon-link, .theme {
  display: inline-grid; place-items: center;
  width: 2rem; height: 2rem; padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: transparent; color: var(--fg-2); cursor: pointer;
}
.icon-link:hover, .theme:hover { color: var(--fg); border-color: var(--line-strong); }
.icon-link svg, .theme svg { width: 1rem; height: 1rem; }
.btn.btn-sm { height: 2rem; padding: 0 0.85rem; font-size: 0.875rem; white-space: nowrap; }

@media (max-width: 64rem) {
  .bar .wrap { flex-wrap: wrap; gap: 0 0.75rem; }
  .bar-end .docs { display: none; }
  .sections {
    order: 3; flex: 0 0 100%;
    margin: 0 calc(var(--gutter) * -1); padding: 0.15rem var(--gutter) 0.5rem;
    overflow-x: auto; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent 100%);
  }
  .sections::-webkit-scrollbar { display: none; }
  .sections a { font-size: 0.8125rem; padding: 0.35rem 0.6rem; background: var(--bg-sunken); }
  .sections a[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }
  .sections a[aria-current="true"]::after { display: none; }
  .sections .docs-sm { display: inline-block; }
}
@media (max-width: 24rem) {
  .brand { font-size: 0.8125rem; }
  .brand span { display: none; }
}

/* Anchored sections land below the sticky bar (its height is set by app.js; fallback here). */
:root { --bar-h: 3.5rem; }
@media (max-width: 64rem) { :root { --bar-h: 6rem; } }
section[id] { scroll-margin-top: calc(var(--bar-h) + 0.5rem); }

.skip {
  position: absolute; left: 1rem; top: -3rem; z-index: 20;
  padding: 0.5rem 0.75rem; border-radius: var(--radius);
  background: var(--fg); color: var(--bg); text-decoration: none; font-size: 0.875rem;
}
.skip:focus { top: 0.5rem; }

/* ── Sections ────────────────────────────────────────────────────────────── */

section { padding: clamp(3.5rem, 9vw, 6.5rem) 0; border-top: 1px solid var(--line); }
section.hero { border-top: 0; padding-top: clamp(3.5rem, 10vw, 7rem); }

.label {
  display: block;
  margin: 0 0 1rem;
  font: 500 0.75rem/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.label b { color: var(--accent); font-weight: 500; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.25rem); line-height: 1.15; max-width: 22ch; }
h3 { font-size: 1rem; letter-spacing: -0.005em; }
.lede { margin: 1rem 0 0; max-width: 60ch; color: var(--fg-2); font-size: 1.0625rem; }
.muted { color: var(--fg-3); }

.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
@media (max-width: 56rem) { .split { grid-template-columns: minmax(0, 1fr); } }

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

.hero h1 {
  font-size: clamp(2.4rem, 7.2vw, 4.75rem);
  line-height: 1;
  letter-spacing: -0.045em;
  font-weight: 600;
}
.hero-lines {
  margin: 1.75rem 0 0; padding: 0; list-style: none;
  font-size: clamp(1.15rem, 2.4vw, 1.5rem); line-height: 1.45;
  letter-spacing: -0.015em;
}
.hero-lines li:first-child { color: var(--fg); }
.hero-lines li { color: var(--fg-2); }
.byline { margin: 2rem 0 0; font: 400 0.9375rem var(--mono); color: var(--fg-3); }
.byline em { font-style: normal; color: var(--accent); }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2.25rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  height: 2.5rem; padding: 0 1rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  font: 500 0.9375rem var(--sans); text-decoration: none; color: var(--fg);
  background: transparent;
  transition: border-color 120ms ease, background-color 120ms ease;
}
.btn:hover { border-color: var(--fg-3); background: var(--bg-sunken); }
.btn.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.primary:hover { background: color-mix(in srgb, var(--fg) 86%, var(--bg)); }
.btn .arrow { font-family: var(--mono); font-size: 0.875rem; opacity: 0.7; }

.hero-meta {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem;
  margin: 3rem 0 0; padding: 1rem 0 0; border-top: 1px solid var(--line);
  font: 400 0.8125rem var(--mono); color: var(--fg-3);
}
.hero-meta a { color: inherit; text-decoration: none; }
.hero-meta a:hover { color: var(--fg); }
.hero-meta a b { color: var(--fg-2); font-weight: 500; }

/* ── Terminal / code ─────────────────────────────────────────────────────── */

.term {
  border: 1px solid var(--code-line);
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-fg);
  overflow: hidden;
}
.term-head {
  display: flex; align-items: center; gap: 0.75rem;
  min-height: 2.5rem; padding: 0 0.5rem 0 1rem;
  border-bottom: 1px solid var(--code-line);
  font: 400 0.75rem var(--mono); color: var(--code-dim);
}
.term-head .file { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term pre {
  margin: 0; padding: 1rem 1.1rem 1.15rem;
  overflow-x: auto;
  font-size: 0.8125rem; line-height: 1.7;
  tab-size: 2;
}
.term pre code { font-size: inherit; }
.term .c { color: var(--code-dim); }
.term .p { color: var(--code-dim); user-select: none; }
.term .k { color: #e6b38a; }
.term .add { color: var(--add); }
.term .del { color: var(--del); }

.copy {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 0.4rem;
  height: 1.75rem; padding: 0 0.6rem;
  border: 1px solid var(--code-line); border-radius: 4px;
  background: transparent; color: var(--code-fg);
  font: 500 0.75rem var(--mono); cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease;
}
.copy:hover { border-color: #444; }
.copy[data-state="copied"] { color: var(--add); border-color: color-mix(in srgb, var(--add) 45%, transparent); }
.copy[data-state="failed"] { color: var(--del); }
.copy svg { width: 0.85rem; height: 0.85rem; }

/* ── Quick setup ─────────────────────────────────────────────────────────── */

.setup-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1.5rem; }
.setup-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; margin: 2.25rem 0 0.75rem; }

.tabs { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.tab {
  height: 2.25rem; padding: 0 0.9rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: transparent; color: var(--fg-2);
  font: 500 0.875rem var(--sans); cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
}
.tab:hover { color: var(--fg); border-color: var(--line-strong); }
.tab[aria-selected="true"] { color: var(--fg); border-color: var(--fg); background: var(--bg-sunken); }

.seg { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius); }
.seg button {
  height: 1.9rem; padding: 0 0.75rem;
  border: 0; border-radius: 4px; background: transparent;
  color: var(--fg-3); font: 500 0.8125rem var(--mono); cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--bg-sunken); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); }

.setup-note { margin: 0.9rem 0 0; font-size: 0.875rem; color: var(--fg-3); }

/* ── Definition rows (what it does, tools) ───────────────────────────────── */

.rows { margin: 2.5rem 0 0; border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: minmax(10rem, 14rem) minmax(0, 1fr) auto;
  gap: 0.5rem 2rem; align-items: baseline;
  padding: 1rem 0; border-bottom: 1px solid var(--line);
}
.row dt, .row h3 { font-weight: 600; font-size: 0.9375rem; margin: 0; }
.row dd { margin: 0; color: var(--fg-2); }
.row .count { font: 400 0.8125rem var(--mono); color: var(--fg-3); text-align: right; }
@media (max-width: 44rem) {
  .row { grid-template-columns: minmax(0, 1fr) auto; }
  .row dd { grid-column: 1 / -1; }
}

.toolnames { display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; font: 400 0.8125rem/1.7 var(--mono); color: var(--fg-2); }
.toolnames .w::before { content: "●"; color: var(--accent); font-size: 0.55em; margin-right: 0.45em; vertical-align: 0.25em; }
.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 1.25rem 0 0; font: 400 0.8125rem var(--mono); color: var(--fg-3); }
.legend .w::before { content: "●"; color: var(--accent); font-size: 0.55em; margin-right: 0.45em; vertical-align: 0.25em; }

.stats { display: flex; flex-wrap: wrap; gap: 2.5rem; margin: 2rem 0 0; }
.stat b { display: block; font-size: 2rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font: 400 0.8125rem var(--mono); color: var(--fg-3); }

/* ── Diagrams (HTML/CSS, no images) ──────────────────────────────────────── */

.flow { display: flex; flex-direction: column; align-items: center; font-family: var(--mono); font-size: 0.8125rem; }
.node {
  width: min(100%, 22rem);
  padding: 0.7rem 1rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg);
  text-align: center;
}
.node small { display: block; margin-top: 0.15rem; color: var(--fg-3); font-size: 0.75rem; }
.node.accent { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.node.dim { border-style: dashed; color: var(--fg-2); }
.edge { width: 1px; height: 1.6rem; background: var(--line-strong); position: relative; }
.edge::after {
  content: ""; position: absolute; left: -3px; bottom: -1px;
  border: 3.5px solid transparent; border-top: 4px solid var(--line-strong); border-bottom: 0;
}
.edge:has(.edge-label) { height: 2.5rem; }
.edge-label {
  position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
  width: max-content; max-width: min(17rem, 40vw);
  color: var(--fg-3); font-size: 0.75rem; line-height: 1.3; overflow-wrap: anywhere;
}

.fork { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; width: min(100%, 30rem); position: relative; margin-top: 1rem; padding-top: 1.6rem; }
.fork::before { /* horizontal rail joining the two branches */
  content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 1px; background: var(--line-strong);
}
.fork::after { /* stem from the manager node down to the rail */
  content: ""; position: absolute; top: -1rem; left: 50%; width: 1px; height: 1rem; background: var(--line-strong);
}
.branch { display: flex; flex-direction: column; align-items: center; position: relative; }
.branch::before { content: ""; position: absolute; top: -1.6rem; left: 50%; width: 1px; height: 1.6rem; background: var(--line-strong); }
.branch .node { width: 100%; }
.branch .edge { height: 1.2rem; }

.rules { margin: 0; padding: 0; list-style: none; }
.rules li { position: relative; padding: 0.85rem 0 0.85rem 1.75rem; border-bottom: 1px solid var(--line); color: var(--fg-2); }
.rules li:first-child { border-top: 1px solid var(--line); }
.rules li::before { content: "→"; position: absolute; left: 0; top: 0.85rem; font-family: var(--mono); color: var(--accent); }
.rules li strong { color: var(--fg); font-weight: 600; }

/* Architecture layers */
.layers { margin: 2.5rem 0 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.layer {
  display: grid; grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr);
  gap: 0.25rem 2rem; padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.layer:last-child { border-bottom: 0; }
.layer:nth-child(even) { background: var(--bg-sunken); }
.layer .name { font: 500 0.875rem var(--mono); }
.layer .name small { display: block; margin-top: 0.2rem; font-size: 0.75rem; color: var(--fg-3); font-weight: 400; }
.layer p { margin: 0; color: var(--fg-2); font-size: 0.9375rem; }
.layer .per { font-family: var(--mono); font-size: 0.8125rem; color: var(--fg-3); }
@media (max-width: 44rem) { .layer { grid-template-columns: minmax(0, 1fr); } }

/* Tables */
.table-wrap { margin: 1.5rem 0 0; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { padding: 0.7rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th { font: 500 0.75rem var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--fg-3); background: var(--bg-sunken); white-space: nowrap; }
td code { white-space: nowrap; }

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 2rem; margin: 2.5rem 0 0; }
.cols.wide { grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); }
.col h3 { font-family: var(--mono); font-weight: 500; font-size: 0.9375rem; }
.col p { margin: 0.6rem 0 0; color: var(--fg-2); font-size: 0.9375rem; }
.col .term { margin-top: 1rem; }

.callout { margin: 1.5rem 0 0; padding: 0.9rem 1.1rem; border: 1px solid var(--line); border-left: 2px solid var(--accent); border-radius: var(--radius); color: var(--fg-2); font-size: 0.9375rem; }
.callout strong { color: var(--fg); }

.more { display: inline-block; margin-top: 1.75rem; font: 500 0.875rem var(--mono); color: var(--accent); text-decoration: none; }
.more:hover { text-decoration: underline; }

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

footer { border-top: 1px solid var(--line); padding: 2.5rem 0 3rem; font: 400 0.8125rem var(--mono); color: var(--fg-3); }
footer .wrap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 1rem 2rem; }
footer .name { color: var(--fg); font-weight: 500; }
footer nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
footer nav a { text-decoration: none; }
footer nav a:hover { color: var(--fg); }
footer .sig { margin-left: auto; }
footer .sig em { font-style: normal; color: var(--accent); }
@media (max-width: 40rem) { footer .sig { margin-left: 0; width: 100%; } }

/* 3.5: default-toolset tag, benchmark chart */
.row h3 .def { margin-left: 0.4rem; font: 500 0.6875rem var(--mono); color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; vertical-align: 0.1em; }
.chart { display: block; width: 100%; height: auto; margin: 2rem 0 0.75rem; border-radius: var(--radius); }
