/* HiveGate site. One accent (honey) on warm comb brown; hexagons only mean agents. */

:root {
  --comb: #1C1812;
  --comb-raised: #262017;
  --comb-deep: #16130E;
  --propolis: #3A3125;
  --wax: #F2EADB;
  --pollen: #B9AE98;
  --honey: #F0A92E;
  --honey-soft: rgba(240, 169, 46, 0.16);
  --sky: #9CC3E6;

  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --page: 1180px;
  --measure: 70ch;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --radius-s: 6px;
  --radius-m: 10px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }

body {
  margin: 0;
  background: var(--comb);
  color: var(--wax);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; }

a { color: var(--wax); text-decoration-color: var(--honey); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--honey); }

:focus-visible { outline: 2px solid var(--honey); outline-offset: 3px; border-radius: 3px; }

code, pre { font-family: var(--mono); font-size: 0.875rem; }
:not(pre) > code {
  background: var(--comb-raised);
  border: 1px solid var(--propolis);
  border-radius: 4px;
  padding: 0.08em 0.35em;
  overflow-wrap: anywhere;
}

pre {
  background: var(--comb-deep);
  border: 1px solid var(--propolis);
  border-radius: var(--radius-m);
  padding: 1rem 1.15rem;
  margin: 0;
  overflow-x: auto;
  line-height: 1.55;
  color: var(--wax);
  tab-size: 2;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; }

.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 10;
  background: var(--honey); color: var(--comb); padding: 0.5rem 0.9rem; border-radius: var(--radius-s);
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* Header */

.site-header {
  position: sticky; top: 0; z-index: 5;
  background: rgba(28, 24, 18, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--propolis);
}
.nav {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0.85rem var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  color: var(--wax); text-decoration: none; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em;
}
.brand:hover { color: var(--wax); }
.hex-mark { color: var(--wax); flex: none; }
.nav-links { display: flex; align-items: center; gap: clamp(0.9rem, 3vw, 1.75rem); }
.nav-links a { color: var(--pollen); text-decoration: none; font-weight: 500; font-size: 0.975rem; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--wax); }
.nav-github {
  display: inline-flex; align-items: center; gap: 0.45rem;
  border: 1px solid var(--propolis); border-radius: 999px; padding: 0.3rem 0.8rem;
}
.nav-github:hover { border-color: var(--pollen); }
.star-count { color: var(--wax); font-variant-numeric: tabular-nums; }
.star-count::before { content: "★ "; color: var(--honey); }

/* Buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.75rem; padding: 0.6rem 1.2rem;
  border-radius: var(--radius-s);
  font-weight: 700; font-size: 1rem; text-decoration: none; line-height: 1.2;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn-primary { background: var(--honey); color: var(--comb); }
.btn-primary:hover { background: #F7BE56; color: var(--comb); }
.btn-quiet { border: 1px solid var(--propolis); color: var(--wax); background: transparent; }
.btn-quiet:hover { border-color: var(--honey); color: var(--wax); }

.deploy-buttons { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1rem 0; }

/* Home: shared section rhythm */

.home > section { max-width: var(--page); margin: 0 auto; padding: clamp(4rem, 9vw, 7rem) var(--gutter) 0; }
.band-head { max-width: 46rem; margin-bottom: 2.25rem; }
.band-head h2 {
  font-size: clamp(1.75rem, 3.4vw, 2.35rem); line-height: 1.15; letter-spacing: -0.02em;
  margin: 0 0 0.75rem; font-weight: 700;
}
.band-head p { color: var(--pollen); margin: 0; font-size: 1.1rem; max-width: 60ch; }

/* Hero */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.home > .hero { padding-top: clamp(3rem, 8vw, 6.5rem); }
.hero h1 {
  font-size: clamp(2.6rem, 6vw, 4.5rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 700;
  margin: 0 0 1.5rem;
  max-width: 13ch;
}
.hero-lead { font-size: clamp(1.1rem, 1.6vw, 1.25rem); color: var(--pollen); max-width: 36rem; margin: 0 0 2rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.5rem; }
.hero-meta { color: var(--pollen); font-size: 0.95rem; margin: 0; }
.hero-visual { justify-self: center; width: min(100%, 520px); }

/* Hive diagram */

.hive { display: block; width: 100%; height: auto; overflow: visible; }
.hive text { font-family: var(--font); font-size: 14px; font-weight: 500; text-anchor: middle; fill: var(--pollen); }
.hive .cell path, .hive .cell-idle { fill: var(--comb-raised); stroke: var(--propolis); stroke-width: 1.5; }
.hive .cell-idle { opacity: 0.5; }
.hive .cell-supervisor path { fill: var(--honey); stroke: var(--honey); }
.hive .cell-supervisor text { fill: var(--comb); font-weight: 700; }
.hive .is-w1 path, .hive .is-w2 path { fill: var(--honey-soft); stroke: var(--honey); }
.hive .is-w1 text, .hive .is-w2 text { fill: var(--wax); }
.hive .wire { stroke: var(--honey); stroke-width: 2; fill: none; }
.hive .pill rect { fill: var(--comb-deep); stroke: var(--propolis); stroke-width: 1.5; }
.hive .pill text { font-family: var(--mono); font-size: 14px; fill: var(--wax); }
.hive .pill .m { fill: var(--sky); font-weight: 500; }

/* One orchestrated load sequence; the end state is the static state (no JS, reduced motion). */
@media (prefers-reduced-motion: no-preference) {
  .js .hive:not(.is-playing) .pill { opacity: 0; }
  .js .hive:not(.is-playing) .wire { stroke-dasharray: 160; stroke-dashoffset: 160; }
  .js .hive:not(.is-playing) .cell-supervisor path,
  .js .hive:not(.is-playing) .is-w1 path,
  .js .hive:not(.is-playing) .is-w2 path { fill: var(--comb-raised); stroke: var(--propolis); }
  .js .hive:not(.is-playing) .cell-supervisor text { fill: var(--pollen); }
  .hive.is-playing .pill-in { animation: hive-fade 0.5s ease-out both; }
  .hive.is-playing .wire-in { stroke-dasharray: 160; animation: hive-draw 0.5s ease-in 0.4s both; }
  .hive.is-playing .cell-supervisor path { animation: hive-light-sup 0.45s ease-out 0.85s both; }
  .hive.is-playing .cell-supervisor text { animation: hive-text-sup 0.45s ease-out 0.85s both; }
  .hive.is-playing .is-w1 path { animation: hive-light-worker 0.45s ease-out 1.45s both; }
  .hive.is-playing .is-w2 path { animation: hive-light-worker 0.45s ease-out 1.85s both; }
  .hive.is-playing .wire-out { stroke-dasharray: 160; animation: hive-draw 0.5s ease-in 2.5s both; }
  .hive.is-playing .pill-out { animation: hive-fade 0.5s ease-out 2.95s both; }
}
@keyframes hive-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hive-draw { from { stroke-dashoffset: 160; } to { stroke-dashoffset: 0; } }
@keyframes hive-light-sup {
  from { fill: var(--comb-raised); stroke: var(--propolis); }
  to { fill: var(--honey); stroke: var(--honey); }
}
@keyframes hive-text-sup { from { fill: var(--pollen); } to { fill: var(--comb); } }
@keyframes hive-light-worker {
  from { fill: var(--comb-raised); stroke: var(--propolis); }
  to { fill: var(--honey-soft); stroke: var(--honey); }
}

/* API examples */

.api { border: 1px solid var(--propolis); border-radius: var(--radius-m); background: var(--comb-raised); overflow: hidden; }
.api-tabs {
  display: flex; gap: 0.25rem; padding: 0.5rem 0.5rem 0;
  border-bottom: 1px solid var(--propolis);
  overflow-x: auto; scrollbar-width: none;
}
.api-tabs::-webkit-scrollbar { display: none; }
.api-tabs [role="tab"] {
  appearance: none; border: 0; background: none; cursor: pointer;
  font: inherit; font-weight: 500; font-size: 0.975rem; white-space: nowrap;
  color: var(--pollen);
  padding: 0.7rem 1rem 0.8rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.api-tabs [role="tab"]:hover { color: var(--wax); }
.api-tabs [role="tab"][aria-selected="true"] { color: var(--wax); border-bottom-color: var(--honey); }
.api-tabs [role="tab"]:focus-visible { outline-offset: -3px; }
.api-panel { padding: clamp(1rem, 3vw, 1.75rem); }
.api-note { margin: 0 0 1.25rem; color: var(--pollen); max-width: 62ch; }
.api-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.api-code { margin: 0; min-width: 0; }
.api-code figcaption { font-size: 0.875rem; color: var(--pollen); margin-bottom: 0.45rem; }
.api-code pre { height: calc(100% - 1.8rem); font-size: 0.8125rem; }
.api-more { display: inline-block; margin-top: 1.25rem; font-weight: 500; }

.t-m { color: var(--sky); font-weight: 500; }
.t-k { color: var(--sky); }
.t-s { color: var(--wax); }
.t-n { color: var(--honey); }
.t-ok { color: var(--honey); font-family: var(--mono); }

/* What's included */

.included { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5rem clamp(2rem, 5vw, 4rem); }
.included-group { border-top: 1px solid var(--propolis); padding-top: 1.25rem; }
.included-group h3 { font-size: 1.05rem; font-weight: 700; color: var(--honey); margin: 0 0 1rem; }
.included dl { margin: 0; }
.included dt { font-weight: 700; font-size: 1.05rem; margin-top: 1rem; }
.included dt:first-child { margin-top: 0; }
.included dt a { text-decoration: none; }
.included dt a:hover { text-decoration: underline; }
.included dd { margin: 0.2rem 0 0; color: var(--pollen); max-width: 48ch; }

/* Numbered steps (real sequences only) */

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: grid; gap: 0; }
.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 1.75rem 3.25rem;
  min-width: 0;
}
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: -0.1rem;
  width: 2.1rem; height: 2.1rem;
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.95rem; color: var(--honey);
  background: var(--honey-soft);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.steps > li::after {
  content: ""; position: absolute; left: 1.05rem; top: 2.3rem; bottom: 0.3rem;
  border-left: 1px solid var(--propolis);
}
.steps > li:last-child::after { display: none; }
.steps h3 { margin: 0 0 0.3rem; font-size: 1.15rem; }
.steps p { margin: 0; color: var(--pollen); max-width: 60ch; }
.steps pre { margin: 0.6rem 0 0.6rem; }

/* Split band: heading stays beside a long list on wide screens */

.band-split { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.band-split .band-head { position: sticky; top: 6rem; margin-bottom: 0; }

/* Quickstart */

.quickstart { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.quickstart-aside {
  border: 1px solid var(--propolis); border-radius: var(--radius-m);
  padding: 1.5rem; background: var(--comb-raised);
  position: sticky; top: 6rem;
}
.quickstart-aside h3 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.quickstart-aside p { color: var(--pollen); margin: 0 0 0.5rem; }
.quickstart-aside .deploy-buttons { flex-direction: column; }
.quickstart-aside .btn { justify-content: flex-start; }
.small { font-size: 0.925rem; }

/* Tables */

.table-wrap { overflow-x: auto; border: 1px solid var(--propolis); border-radius: var(--radius-m); }
table { width: 100%; border-collapse: collapse; font-size: 0.975rem; }
th, td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--propolis); vertical-align: top; }
thead th { color: var(--pollen); font-weight: 500; font-size: 0.9rem; background: var(--comb-raised); }
tbody th { font-weight: 700; }
tbody tr:last-child > * { border-bottom: 0; }
td code, th code { white-space: nowrap; }
td a code { background: none; border: 0; padding: 0; }

/* FAQ */

.faq { max-width: 50rem; border-top: 1px solid var(--propolis); }
.faq details { border-bottom: 1px solid var(--propolis); }
.faq summary {
  cursor: pointer; list-style: none;
  padding: 1.1rem 2.5rem 1.1rem 0; position: relative;
  font-weight: 700; font-size: 1.1rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 0.25rem; top: 50%; transform: translateY(-50%);
  font-size: 1.4rem; font-weight: 400; color: var(--honey);
}
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 0 1.25rem; color: var(--pollen); max-width: 65ch; }

/* Long-form pages (docs, deploy, synced reference pages) */

.prose {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4rem) var(--gutter) 0;
}
.prose h1 { font-size: clamp(2.1rem, 4.5vw, 2.9rem); line-height: 1.08; letter-spacing: -0.03em; margin: 0 0 1rem; }
.prose h2 {
  font-size: 1.6rem; line-height: 1.2; letter-spacing: -0.015em;
  margin: 3rem 0 0.9rem; padding-top: 1.5rem; border-top: 1px solid var(--propolis);
}
.prose h3 { font-size: 1.2rem; margin: 2rem 0 0.6rem; }
.prose h4 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; }
.prose p, .prose li { color: var(--wax); }
.prose p { margin: 0 0 1rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1rem; }
.prose li { margin: 0.25rem 0; }
.prose li::marker { color: var(--honey); }
.prose pre { margin: 1rem 0 1.5rem; }
.prose hr { border: 0; border-top: 1px solid var(--propolis); margin: 2.5rem 0; }
.prose blockquote { margin: 1.25rem 0; padding: 0.25rem 0 0.25rem 1rem; border-left: 3px solid var(--honey); color: var(--pollen); }
.prose img { height: auto; }
/* Markdown tables: the script wraps each one in .table-wrap so it scrolls inside its own box.
   Without JS, the table itself scrolls. */
.prose table { display: block; overflow-x: auto; margin: 1rem 0 1.5rem; border: 1px solid var(--propolis); border-radius: var(--radius-m); }
.prose .table-wrap { margin: 1rem 0 1.5rem; }
.prose .table-wrap table { display: table; margin: 0; border: 0; border-radius: 0; }
.prose table th, .prose table td { min-width: 7rem; }
a > code { color: inherit; background: none; border-color: transparent; padding: 0; }

/* Copy button on code blocks */

.code-block { position: relative; }
.copy-btn {
  position: absolute; top: 0.5rem; right: 0.5rem;
  font: 500 0.8rem var(--font); color: var(--pollen);
  background: var(--comb-raised); border: 1px solid var(--propolis); border-radius: var(--radius-s);
  padding: 0.25rem 0.6rem; cursor: pointer; opacity: 0;
}
.code-block:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { color: var(--wax); border-color: var(--pollen); }
@media (hover: none) { .copy-btn { opacity: 1; } }

/* Rouge syntax highlighting (Markdown code fences) */

.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs, .highlight .ch { color: #8A806E; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kc, .highlight .kr, .highlight .nb { color: var(--honey); }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .se, .highlight .sh, .highlight .si, .highlight .sx { color: #D9CDB4; }
.highlight .nt, .highlight .na, .highlight .nv, .highlight .vg { color: var(--sky); }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .il { color: var(--honey); }
.highlight .o, .highlight .p { color: var(--pollen); }
.highlight .nf, .highlight .fm, .highlight .nc { color: var(--wax); font-weight: 500; }
.highlight .err { color: inherit; background: none; }
div.highlighter-rouge { margin: 1rem 0 1.5rem; }
div.highlighter-rouge pre { margin: 0; }

/* Footer */

.site-footer {
  margin-top: clamp(5rem, 10vw, 8rem);
  border-top: 1px solid var(--propolis);
  background: var(--comb-deep);
  padding: 3rem 0 1.5rem;
  font-size: 0.95rem;
}
.site-footer .container { max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter); }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 2rem; }
.footer-brand p { color: var(--pollen); margin: 0.75rem 0 0; max-width: 18rem; }
.footer-col { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.footer-col h2 { font-size: 0.95rem; font-weight: 700; color: var(--wax); margin: 0 0 0.25rem; padding: 0; border: 0; }
.footer-col a { color: var(--pollen); text-decoration: none; overflow-wrap: anywhere; }
.footer-col a:hover { color: var(--honey); }
.footer-bottom { margin-top: 2.5rem; }
.footer-bottom p { color: var(--pollen); font-size: 0.875rem; margin: 0; padding-top: 1.25rem; border-top: 1px solid var(--propolis); }
.footer-bottom a { color: var(--pollen); }

/* Responsive */

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .hero h1 { max-width: 16ch; }
  .hero-visual { width: min(100%, 440px); justify-self: start; }
  .quickstart { grid-template-columns: 1fr; }
  .quickstart-aside { position: static; }
  .footer-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .band-split { grid-template-columns: 1fr; }
  .band-split .band-head { position: static; margin-bottom: 2.25rem; }
  .api-pair { grid-template-columns: 1fr; }
  .api-code pre { height: auto; }
  .included { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  /* Stack table rows on phones instead of squeezing three columns. */
  .home .table-wrap thead { display: none; }
  .home .table-wrap tr { display: grid; gap: 0.15rem; padding: 0.9rem 1rem; border-bottom: 1px solid var(--propolis); }
  .home .table-wrap tr:last-child { border-bottom: 0; }
  .home .table-wrap th, .home .table-wrap td { padding: 0; border: 0; }
  .home .table-wrap td { color: var(--pollen); }
  .hive text { font-size: 15px; }
  .hive .pill text { font-size: 15px; }
}
@media (max-width: 520px) {
  .nav-links a:not(.nav-github) { font-size: 0.925rem; }
  .nav-github span:not(.star-count) { display: none; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); gap: 1.75rem; }
  .steps > li { padding-left: 2.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
