/* Server Operator site — BeForth Design System V2.
   Seven tokens, one accent, flat surfaces, 1px rules, square corners. */
:root {
  --paper: #f2f7f9;
  --bone: #d6e7f1;
  --ink: #231f20;
  --ash: #5f6571;
  --signal: #1c75bc;
  --wave: #75bae6;
  --signal-deep: #165b93;
  --rule: rgba(35, 31, 32, 0.12);
  --nav-h: 64px;
  --font-sans: "Plus Jakarta Sans", "Plus Jakarta Fallback", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;
}

/* Metric-matched fallback so the web font swap does not shift the page. */
@font-face {
  font-family: "Plus Jakarta Fallback";
  src: local("Arial");
  size-adjust: 104.3%;
  ascent-override: 98%;
  descent-override: 20%;
  line-gap-override: 0%;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.75;
  font-size: 15.5px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--signal); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

code, .mono { font-family: var(--font-mono); font-size: 0.9em; }

.skip {
  position: absolute; left: 16px; top: -60px; z-index: 200;
  background: var(--ink); color: var(--paper); padding: 10px 16px; text-decoration: none;
}
.skip:focus { top: 12px; }

/* Navigation */
.site-nav {
  position: sticky; top: 0; z-index: 100; min-height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 24px; background: var(--paper); border-bottom: 1px solid var(--rule);
}
@media (min-width: 1024px) { .site-nav { padding: 0 40px; } }
.site-nav__brand {
  display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px;
  color: var(--ink); text-decoration: none; letter-spacing: -0.015em;
}
.site-nav__brand:hover { color: var(--ink); }
.site-nav__logo {
  width: 30px; height: 30px; background: var(--ink); color: var(--paper);
  border-radius: 6px; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; font-family: var(--font-mono);
}
.site-nav__links {
  display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0;
  flex-wrap: wrap; justify-content: flex-end;
}
.site-nav__links a {
  color: var(--ash); padding: 8px 12px; font-size: 14px; font-weight: 500; text-decoration: none;
}
.site-nav__links a:hover, .site-nav__links a[aria-current="page"] { color: var(--signal); }
.site-nav__links a.btn { color: #fff; margin-left: 8px; }
.site-nav__links a.btn:hover { color: #fff; }
@media (max-width: 760px) {
  .site-nav { flex-wrap: wrap; padding: 12px 16px; }
  .site-nav__links { width: 100%; justify-content: flex-start; }
}

/* Buttons: sentence case, 15px, semibold. Hover is a colour change only. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; font-size: 15px; font-weight: 600; font-family: inherit;
  border: 1px solid transparent; cursor: pointer; text-decoration: none; line-height: 1.4;
}
.btn--primary { background: var(--signal); color: #fff; }
.btn--primary:hover { background: var(--signal-deep); color: #fff; }
.btn--secondary { background: transparent; color: var(--ink); border-color: var(--rule); border-color: rgba(35, 31, 32, 0.4); }
.btn--secondary:hover { color: var(--signal); border-color: var(--signal); }
.btn--sm { padding: 8px 16px; font-size: 14px; }

/* Hero */
.hero { padding: 72px 24px 80px; }
@media (min-width: 1024px) { .hero { padding: 96px 40px 104px; } }
.hero__inner {
  max-width: 1280px; margin: 0 auto; display: grid; gap: 48px; align-items: center;
}
@media (min-width: 1024px) { .hero__inner { grid-template-columns: 1.05fr 1fr; } }
.hero__eyebrow, .label {
  margin: 0 0 20px; font-size: 12.5px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ash);
}
.hero h1 {
  margin: 0 0 24px; font-weight: 800; letter-spacing: -0.035em; line-height: 0.98;
  font-size: clamp(2rem, 5.6vw, 4.25rem);
}
.accent { color: var(--signal); }
.hero__lead { margin: 0 0 32px; font-size: clamp(18px, 2vw, 21px); line-height: 1.6; color: rgba(35, 31, 32, 0.8); max-width: 56ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.hero__meta { margin: 0; font-size: 13px; color: var(--ash); }

/* Doodles (inline SVG, decorative). Line work ink, "connected" parts signal, flat bone fills. */
.doodle { display: block; width: 100%; height: auto; max-width: 560px; margin-inline: auto; }
.doodle * { stroke-linecap: round; stroke-linejoin: round; }
.icon * { stroke-linecap: round; stroke-linejoin: round; }
.doodle .l { fill: none; stroke: var(--ink); stroke-width: 2.4; }
.icon .l { fill: none; stroke: var(--ink); stroke-width: 2.4; }
.doodle .a { fill: none; stroke: var(--signal); stroke-width: 2.6; }
.icon .a { fill: none; stroke: var(--signal); stroke-width: 2.6; }
.doodle .b { fill: var(--bone); stroke: var(--ink); stroke-width: 2.4; }
.icon .b { fill: var(--bone); stroke: var(--ink); stroke-width: 2.4; }
.doodle .w { fill: #fff; stroke: var(--ink); stroke-width: 2.4; }
.icon .w { fill: #fff; stroke: var(--ink); stroke-width: 2.4; }
.doodle .k { fill: var(--ink); stroke: none; }
.icon .k { fill: var(--ink); stroke: none; }
.doodle .s { fill: var(--signal); stroke: none; }
.icon .s { fill: var(--signal); stroke: none; }
.doodle .t { fill: var(--ink); stroke: none; font: 600 15px var(--font-mono); }
.icon .t { fill: var(--ink); stroke: none; font: 600 15px var(--font-mono); }
.icon { width: 52px; height: 52px; }
.icon .l, .icon .a, .icon .b, .icon .w { stroke-width: 2.6; }

/* Sections */
.section { padding: 80px 24px; border-top: 1px solid var(--rule); }
@media (min-width: 1024px) { .section { padding: 112px 40px; } }
.section--alt { background: var(--bone); }
.section__inner { max-width: 1280px; margin: 0 auto; }
.section__title {
  margin: 0 0 16px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.1;
  font-size: clamp(1.7rem, 4vw, 3.2rem);
}
.section__subtitle { margin: 0 0 48px; color: var(--ash); max-width: 68ch; font-size: 16px; }
.section__subtitle code { color: var(--ink); }

/* Cards: 1px border, white fill, square. */
.feature-grid, .download-grid, .release-grid { display: grid; gap: 16px; }
.feature-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.download-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.release-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.feature-card, .download-card, .release-card {
  background: #fff; border: 1px solid var(--rule); padding: 28px;
}
.section--alt .feature-card, .section--alt .download-card { background: #fff; }
.feature-card h3, .download-card h3 {
  margin: 14px 0 8px; font-size: 20px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3;
}
.feature-card p, .download-card p { margin: 0; font-size: 13.5px; line-height: 1.65; color: var(--ash); }
.feature-card code, .download-card code { color: var(--ink); }
.feature-card__icon { height: 52px; }
.download-card__platform { font-size: 12.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ash); }
.download-card .btn { margin-top: 16px; }

.feature-row { display: grid; gap: 32px; align-items: center; }
@media (min-width: 900px) { .feature-row { grid-template-columns: 1fr 1.3fr; gap: 56px; } }
.feature-row h3 { font-weight: 600; letter-spacing: -0.015em; }

/* Dark panel */
.code-block {
  background: var(--ink); color: var(--paper); padding: 24px;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.9; overflow-x: auto;
  white-space: nowrap;
}
.code-block .prompt { color: var(--wave); user-select: none; margin-right: 6px; }

.tech-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.tech-list li {
  border: 1px solid rgba(35, 31, 32, 0.3); background: var(--paper); padding: 6px 14px;
  font-size: 13.5px; font-weight: 500; border-radius: 999px;
}

/* Releases */
.release-card { padding: 32px; }
.release-card__header {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px;
  padding-bottom: 20px; margin-bottom: 24px; border-bottom: 1px solid var(--rule);
}
.release-card__header h3 { margin: 8px 0 0; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.release-card__header p { margin: 0; font-size: 13px; color: var(--ash); }
.release-badge {
  display: inline-block; padding: 2px 12px; border-radius: 999px; background: var(--signal);
  color: #fff; font-size: 12px; font-weight: 600; font-family: var(--font-mono);
}
.release-block h4 { margin: 0 0 10px; font-size: 15px; font-weight: 600; }
.release-block ul { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--ash); line-height: 1.65; }
.release-block li + li { margin-top: 8px; }
.release-block code { color: var(--ink); }

.download-note {
  margin-top: 32px; padding: 20px 24px; border: 1px solid var(--rule); background: #fff;
  font-size: 13.5px; color: var(--ash);
}
.download-note strong { color: var(--ink); }
.download-note code.cmd {
  display: block; margin: 10px 0 0; padding: 12px 16px; background: var(--ink); color: var(--wave);
}

.section__head { display: grid; gap: 32px; align-items: center; margin-bottom: 48px; }
.section__head .section__subtitle { margin-bottom: 0; }
@media (min-width: 900px) { .section__head { grid-template-columns: 1.4fr 1fr; } }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); padding: 32px 24px; background: var(--paper); }
@media (min-width: 1024px) { .site-footer { padding: 32px 40px; } }
.site-footer__inner {
  max-width: 1280px; margin: 0 auto; display: flex; flex-wrap: wrap;
  justify-content: space-between; align-items: center; gap: 16px;
}
.site-footer p { margin: 0; font-size: 13.5px; color: var(--ash); }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 20px; }
.site-footer__links a { font-size: 13.5px; color: var(--ash); }
.site-footer__links a:hover { color: var(--signal); }

/* Doodle filters are defined once per page (see the hidden SVG after <body>). */
.doodle .wob { filter: url(#sketch); }
.icon .wob { filter: url(#sketch-md); }
.ulink { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; font-weight: 600; font-size: 15px; align-self: center; }
.ulink:hover { color: var(--signal); }
.doodle--sm { max-width: 320px; }

/* Draw-on-scroll (overrides the design system's "drawings are static" rule). Class .draw is added by app.js only. */
.draw .l, .draw .a, .draw .b, .draw .w {
  stroke-dasharray: 1; stroke-dashoffset: 1; stroke-opacity: 0;
  transition: stroke-dashoffset 0.9s ease var(--d, 0s), stroke-opacity 0.01s linear var(--d, 0s);
}
.draw .b, .draw .w { fill-opacity: 0; transition: stroke-dashoffset 0.9s ease var(--d, 0s), stroke-opacity 0.01s linear var(--d, 0s), fill-opacity 0.5s ease calc(var(--d, 0s) + 0.6s); }
.draw .k, .draw .s, .draw .t { opacity: 0; transition: opacity 0.4s ease calc(var(--d, 0s) + 0.5s); }
.draw.in .l, .draw.in .a, .draw.in .b, .draw.in .w { stroke-dashoffset: 0; stroke-opacity: 1; }
.draw.in .b, .draw.in .w { fill-opacity: 1; }
.draw.in .k, .draw.in .s, .draw.in .t { opacity: 1; }

/* ---- Motion layer (all gated on no-preference; classes below are added by draw.js) ---- */
.doodle .pkt { fill: var(--signal); stroke: none; }
.draw:not(.in) .pkt { visibility: hidden; }
@media (prefers-reduced-motion: no-preference) {
  :root { --ease: cubic-bezier(0.22, 1, 0.36, 1); }

  /* hero entrance */
  @keyframes rise { from { opacity: 0; transform: translateY(16px); } }
  .hero__inner > div > * { animation: rise 0.7s var(--ease) backwards; }
  .hero__inner > div > :nth-child(2) { animation-delay: 0.08s; }
  .hero__inner > div > :nth-child(3) { animation-delay: 0.16s; }
  .hero__inner > div > :nth-child(4) { animation-delay: 0.24s; }

  /* live hero: packets, blinking LEDs, cursor */
  @keyframes blink { 50% { opacity: 0.15; } }
  .draw.in .led { animation: blink 1.6s ease-in-out 2s infinite; }
  .draw.in .led:nth-of-type(odd) { animation-delay: 2.6s; }
  .draw.in .cur { animation: blink 1s steps(1) 2s infinite; }

  /* scroll reveal */
  .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s var(--ease) var(--rd, 0s), transform 0.6s var(--ease) var(--rd, 0s); }
  .reveal.in { opacity: 1; transform: none; }

  /* hover micro-interactions */
  .feature-card, .download-card { transition: border-color 0.2s, transform 0.25s var(--ease), opacity 0.6s var(--ease) var(--rd, 0s); }
  .feature-card:hover, .download-card:hover { border-color: var(--signal); transform: translateY(-3px); }
  .feature-card__icon { transition: transform 0.35s var(--ease); transform-origin: 30% 70%; }
  .feature-card:hover .feature-card__icon { transform: rotate(-6deg) scale(1.08); }
  .btn { transition: background-color 0.15s, color 0.15s, border-color 0.15s, transform 0.15s; }
  .btn:active { transform: translateY(1px); }
  .site-nav__links a:not(.btn) { background: linear-gradient(var(--signal), var(--signal)) 12px calc(100% - 6px) / 0 2px no-repeat; transition: background-size 0.25s var(--ease), color 0.15s; }
  .site-nav__links a:not(.btn):hover, .site-nav__links a.active { background-size: calc(100% - 24px) 2px; }
  .tech-list li { transition: background-color 0.15s, color 0.15s, border-color 0.15s; }
  .tech-list li:hover { background: var(--signal); border-color: var(--signal); color: #fff; }
}
.site-nav__links a.active { color: var(--signal); }
.site-nav.scrolled { border-bottom-color: rgba(35, 31, 32, 0.28); }
#progress { position: fixed; top: 0; left: 0; height: 2px; width: 100%; background: var(--signal); transform: scaleX(0); transform-origin: 0 0; z-index: 300; pointer-events: none; }

/* Performance: skip rendering of off-screen sections, promote the hover-tilted icon wrapper, pause live animation off-screen. */
.section, .site-footer { content-visibility: auto; contain-intrinsic-size: auto 700px; }
.feature-card__icon { will-change: transform; }
.paused .led, .paused .cur { animation-play-state: paused; }
