/* HIVE PAGE — hive-specific styles, scoped to .hive-page.
   Shared chrome (header, footer, type, buttons, pills, truth strip) comes
   from tokens.css + base.css + interior.css + components.css. Nothing here
   is global: every rule is scoped under .hive-page so it cannot leak onto
   other routes. Tokens are the page's own nine-colour design system. */

/* --- tokens (scoped; the shared palette lives in tokens.css) --- */
.hive-page {
  --night:   #101b24;
  --forest:  #1b302b;
  --lime:    #b8f58a;
  --mist:    #e5f0e9;
  --void:    #111426;
  --core:    #25345a;
  --signal:  #8ce7f4;
  --neural:  #a98bff;
  --amber:   #f2b441;

  --surface:      #0c141b;
  --surface-2:    #101b24;
  --surface-3:    #16242f;
  --line:         rgba(229, 240, 233, 0.10);
  --line-strong:  rgba(229, 240, 233, 0.22);
  --text:         #e5f0e9;
  --text-dim:     #8fa6b3;
  --text-faint:   #7d94a1;

  --display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --ui:      "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, "Cascadia Mono", Menlo, monospace;
  --accent:  "JetBrains Mono", ui-monospace, monospace;

  --step-0: 0.8125rem;
  --step-1: 0.9375rem;
  --step-2: 1.125rem;
  --step-3: 1.5rem;
  --step-4: clamp(1.9rem, 4vw, 3rem);

  --gap: 0.5rem;
  --radius: 10px;
  --hex-w: 148px;
  --hex-h: 168px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* --- page surface: keeps the hive page's own dark gradient --- */
body.hive-page {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(37, 52, 90, 0.55), transparent 70%),
    radial-gradient(900px 500px at 90% 10%, rgba(169, 139, 255, 0.08), transparent 60%),
    var(--surface);
  color: var(--text);
  font-family: var(--ui);
  font-size: var(--step-1);
  line-height: 1.55;
}

/* --- sections: shared .section padding, hive divider between them --- */
.hive-page .section { border-bottom: 1px solid var(--line); }
.hive-page .section:last-of-type { border-bottom: 0; }

/* --- hero actions row (member entry buttons) --- */
.hive-page .hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 1.7rem; }

/* --- status pills row under the hero lead --- */
.hive-page .statusbar {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin-top: 1.6rem;
}

/* --- the seam toggle is a real button wearing chip styling --- */
.hive-page .chip {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.34rem 0.62rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text-dim);
  white-space: nowrap;
}
.hive-page .chip:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.hive-page .chip--btn { cursor: pointer; background: none; min-height: 44px; }

/* --- links inside the page content (buttons keep their own colours) --- */
.hive-page main a:not(.btn) { color: var(--lime); text-underline-offset: 2px; }
.hive-page main a:not(.btn):hover { color: var(--signal); }

/* --- the honeycomb -----------------------------------------------------
   Cells are hexagons because the brand says so, and because a hive is the one
   diagram where a hexagon carries meaning rather than decoration: each chamber
   is adjacent to six others, and the wall between neighbours is exactly where
   the eight fragile seams live.
   ---------------------------------------------------------------------- */
.hive-page .hive { display: flex; flex-direction: column; align-items: center; gap: 0.55rem; }
.hive-page .row { display: flex; gap: 0.55rem; justify-content: center; flex-wrap: nowrap; }
.hive-page .row.offset { transform: translateX(calc((var(--hex-w) + 0.55rem) / 2)); }

.hive-page .cell {
  position: relative;
  width: var(--hex-w);
  height: var(--hex-h);
  padding: 0;
  border: 0;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  text-align: center;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  transition: background 160ms var(--ease), transform 160ms var(--ease);
}
.hive-page .cell:hover { background: var(--surface-3); transform: translateY(-2px); }
.hive-page .cell::before {           /* focus ring: clip-path would cut a normal outline */
  content: "";
  position: absolute;
  inset: 5px;
  clip-path: inherit;
  border: 2px solid transparent;
  transition: border-color 140ms var(--ease);
  pointer-events: none;
}
.hive-page .cell:focus-visible { outline: none; }
.hive-page .cell:focus-visible::before { border-color: var(--lime); }

.hive-page .cell .num {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.10em;
  color: var(--text-dim);
}
.hive-page .cell .name {
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.01em;
  max-width: 92px;
  overflow-wrap: normal;
}
.hive-page .cell .live {
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.hive-page .cell .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--lime);
  margin-top: 0.1rem;
}
.hive-page .cell.pointer { background: var(--void); }
.hive-page .cell.pointer .name { color: var(--text-dim); }
.hive-page .cell.pointer .dot  { background: var(--neural); }
.hive-page .cell.source { background: var(--forest); }
.hive-page .cell.source .name { color: var(--lime); }
/* The source cell sits on forest; the faint live label fails 4.5:1 there
   (4.4:1), so it takes the dim tone (5.5:1) instead. */
.hive-page .cell.source .live { color: var(--text-dim); }

.hive-page .cell.gate {
  width: calc(var(--hex-w) * 1.28);
  height: calc(var(--hex-h) * 1.28);
  background: linear-gradient(160deg, var(--core), var(--void));
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.hive-page .cell.gate .name { font-size: 0.92rem; max-width: 118px; color: var(--mist); }
.hive-page .cell.gate .num { color: var(--signal); }
.hive-page .cell.gate .live { color: var(--signal); }

body.hive-page.seams-on .cell[data-seam="1"] { background: #2a2418; }
body.hive-page.seams-on .cell[data-seam="1"]::after {
  content: "";
  position: absolute;
  inset: 12px;
  clip-path: inherit;
  border: 2px dashed var(--amber);
  pointer-events: none;
}

.hive-page .legend {
  display: flex; flex-wrap: wrap; gap: 1.1rem;
  margin-top: 1.6rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}
.hive-page .legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.hive-page .swatch-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); }
.hive-page .swatch-dot.p { background: var(--neural); }
.hive-page .swatch-dot.a { background: var(--amber); }

/* --- detail panel ------------------------------------------------------- */
.hive-page .panel {
  margin-top: 2rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 1.15rem 1.3rem;
  min-height: 8.5rem;
}
.hive-page .panel .pnum {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--signal);
}
.hive-page .panel h3 {
  font-family: var(--display);
  font-size: var(--step-2);
  margin: 0.15rem 0 0.4rem;
  font-weight: 600;
}
.hive-page .panel p { margin: 0.2rem 0; color: var(--text-dim); }
.hive-page .panel .seamnote {
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--amber);
  line-height: 1.5;
}

/* --- roles and ranks subheads ------------------------------------------- */
.hive-page .subhead {
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 600;
  margin: 1.7rem 0 0.45rem;
}

/* --- gate pipeline ------------------------------------------------------ */
.hive-page .pipeline { display: grid; gap: 0.75rem; grid-template-columns: repeat(5, 1fr); }
.hive-page .step {
  border: 1px solid var(--line);
  border-top: 2px solid var(--lime);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 0.9rem 0.95rem;
}
.hive-page .step .n {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--text-faint);
}
.hive-page .step h3 {
  font-family: var(--display);
  font-size: 0.98rem;
  margin: 0.2rem 0 0.35rem;
  font-weight: 600;
}
.hive-page .step p { margin: 0 0 0.5rem; font-size: var(--step-0); color: var(--text-dim); }
.hive-page .step code {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--signal);
  overflow-wrap: anywhere;
  line-height: 1.45;
}

/* --- services ----------------------------------------------------------- */
.hive-page .services { display: grid; gap: 0.7rem; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.hive-page .svc {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 0.85rem 0.95rem;
}
.hive-page .svc .label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.hive-page .svc .port {
  font-family: var(--mono);
  font-size: 1.15rem;
  color: var(--mist);
  margin: 0.1rem 0 0.25rem;
}
.hive-page .svc .state { font-size: 0.76rem; color: var(--text-dim); }
.hive-page .svc .state b { color: var(--lime); font-weight: 600; }
.hive-page .svc .state .down { color: var(--amber); font-weight: 600; }

/* --- gate table --------------------------------------------------------- */
.hive-page table { width: 100%; border-collapse: collapse; font-size: var(--step-0); }
.hive-page caption {
  text-align: left;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  padding-bottom: 0.6rem;
}
.hive-page th, .hive-page td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--line); }
.hive-page th {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 500;
}
.hive-page td.check { font-family: var(--mono); color: var(--mist); white-space: nowrap; }
.hive-page td .verdict { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em; }
.hive-page td .verdict.pass { color: var(--lime); }
.hive-page td .verdict.debt { color: var(--amber); }
.hive-page td.detail { color: var(--text-dim); }

/* --- tokens ------------------------------------------------------------- */
.hive-page .tokens { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); }
.hive-page .sw {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}
.hive-page .sw .chip-color { height: 46px; }
/* Swatch fills use the page tokens, not inline style attributes, so the page
   CSP can hash its styles. No new colours: each maps to a :root token. */
.hive-page .chip-color--night  { background: var(--night); }
.hive-page .chip-color--forest { background: var(--forest); }
.hive-page .chip-color--lime   { background: var(--lime); }
.hive-page .chip-color--mist   { background: var(--mist); }
.hive-page .chip-color--void   { background: var(--void); }
.hive-page .chip-color--core   { background: var(--core); }
.hive-page .chip-color--signal { background: var(--signal); }
.hive-page .chip-color--neural { background: var(--neural); }
.hive-page .chip-color--amber  { background: var(--amber); }
.hive-page .sw .meta { padding: 0.5rem 0.65rem; }
.hive-page .sw .meta .n { font-family: var(--display); font-size: 0.82rem; font-weight: 600; }
.hive-page .sw .meta .h { font-family: var(--mono); font-size: 0.68rem; color: var(--text-faint); }

.hive-page .typeramp { margin-top: 1.6rem; display: grid; gap: 0.6rem; }
.hive-page .type-row { display: flex; align-items: baseline; gap: 1rem; border-bottom: 1px solid var(--line); padding-bottom: 0.5rem; }
.hive-page .type-row .role {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  width: 6.5rem;
  flex: none;
}
.hive-page .type-row .sample { font-size: 1.1rem; }
.hive-page .type-row .sample.display { font-family: var(--display); font-weight: 600; }
.hive-page .type-row .sample.mono { font-family: var(--mono); font-size: 0.9rem; color: var(--signal); }
.hive-page .type-row .sample.accent { font-family: var(--accent); font-size: 0.95rem; letter-spacing: 0.04em; }

/* --- about-this-page note --- */
.hive-page .about-note { color: var(--text-dim); font-size: var(--step-0); max-width: 68ch; }
.hive-page .about-note code { font-family: var(--mono); color: var(--signal); }
.hive-page .about-note .rule {
  border-left: 2px solid var(--amber);
  padding-left: 0.9rem;
  margin: 1.2rem 0;
  color: var(--text-dim);
}

/* --- responsive + motion ------------------------------------------------ */
@media (max-width: 900px) {
  .hive-page { --hex-w: 112px; --hex-h: 128px; }
  .hive-page .pipeline { grid-template-columns: repeat(2, 1fr); }
  .hive-page .cell .name { font-size: 0.7rem; max-width: 88px; }
}
@media (max-width: 560px) {
  /* Four 80px hexes + gaps = 334px, inside the 342px wrap at a 390px viewport.
     The stagger offset is dropped here — it would push the row past the wrap —
     and rows may wrap instead of overflowing. Names shrink so DOCUMENTATION
     (13 chars, no underscore to break on) still fits its hexagon. */
  .hive-page { --hex-w: 80px; --hex-h: 96px; --gap: 0.35rem; }
  .hive-page .row { gap: 0.3rem; flex-wrap: wrap; }
  .hive-page .row.offset { transform: none; }
  .hive-page .pipeline { grid-template-columns: 1fr; }
  .hive-page .cell .name { font-size: 0.58rem; max-width: 74px; }
  .hive-page .cell .live { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hive-page * { transition: none !important; }
  .hive-page .cell:hover { transform: none; }
}
.hive-page .sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- guild page additions (2026-12-04) -----------------------------------
   The bounty flow wears the signal colour; the roadmap marks its current
   phase in amber; the payout is a three-segment bar in payment order; the
   data loop is an inline SVG ring whose styles live here, not in attributes,
   so the page CSP can keep style-src-attr 'none'. */

/* --- pipeline step variants --- */
.hive-page .step--sig { border-top-color: var(--signal); }
.hive-page .step--now { border-top-color: var(--amber); }
.hive-page .step--now .n { color: var(--amber); }
.hive-page .step--next h3 { color: var(--text-dim); }

/* --- payout bar --------------------------------------------------------- */
.hive-page .paybar {
  display: flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 0.4rem;
}
.hive-page .payseg { flex: 1 1 0; padding: 1rem 1.1rem; }
.hive-page .payseg--hive { background: var(--core); }
.hive-page .payseg--guild { background: var(--forest); }
.hive-page .payseg--members { background: var(--surface-3); }
.hive-page .payseg .k {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--mist);
}
.hive-page .payseg .v {
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--mist);
  margin-top: 0.25rem;
  line-height: 1.3;
}
.hive-page .paynotes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
  margin: 0.9rem 0 1.2rem;
}
.hive-page .paynotes p { margin: 0; font-size: var(--step-0); color: var(--text-dim); }

/* --- inference data loop ------------------------------------------------ */
.hive-page .loopwrap {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2.2rem;
  align-items: center;
  margin-top: 0.6rem;
}
.hive-page .loopring { width: 100%; height: auto; max-width: 320px; justify-self: center; }
.hive-page .loopring .ring { fill: none; stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 6; }
.hive-page .loopring .arc { fill: none; stroke: var(--amber); stroke-width: 2; }
.hive-page .loopring .lhead { fill: var(--amber); }
.hive-page .loopring .node { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1; }
.hive-page .loopring .nnum {
  fill: var(--mist);
  font-family: var(--mono);
  font-size: 13px;
  text-anchor: middle;
  dominant-baseline: central;
}
.hive-page .loopring .ctext {
  fill: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-anchor: middle;
}
.hive-page .loopsteps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.hive-page .loopsteps li { display: flex; gap: 0.9rem; align-items: baseline; }
.hive-page .loopsteps .n {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--amber);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  width: 1.6rem; height: 1.6rem;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(0.35rem);
}
.hive-page .loopsteps h3 {
  font-family: var(--display);
  font-size: 0.98rem;
  font-weight: 600;
  margin: 0 0 0.2rem;
}
.hive-page .loopsteps p { margin: 0; font-size: var(--step-0); color: var(--text-dim); }
.hive-page .loopnote {
  margin-top: 1.4rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  line-height: 1.6;
  color: var(--text-faint);
  max-width: 72ch;
}

@media (max-width: 900px) {
  .hive-page .loopwrap { grid-template-columns: 1fr; gap: 1.4rem; }
  .hive-page .paynotes { grid-template-columns: 1fr; gap: 0.5rem; }
}
@media (max-width: 560px) {
  .hive-page .paybar { flex-direction: column; }
}
