/* ---------------------------------------------------------------------------------------------
   Pighaus Games documentation

   The look borrows from an editor viewport rather than a product landing page, because that is
   what these tools are: things you use inside Unreal with a timeline open. Hence the framing
   brackets lifted off the Blendable mark, the spline-and-keyframe dividers, tabular figures on
   anything numeric, and 2px corners instead of the soft consumer radius.

   Deliberately absent: gradient heroes, frosted glass, pill buttons, icon grids, centred columns
   of text. Everything is left-aligned and ruled, the way tool UI is.
   --------------------------------------------------------------------------------------------- */

:root {
  /* A blue-biased graphite rather than black. Pure #000 makes the logo's glow look cut out. */
  --ground: #0b0e13;
  --ground-2: #0f131a;
  --panel: #12171f;
  --rule: #1e2029;
  --rule-2: #262b36;

  --ink: #d8dee8;
  --ink-strong: #f2f5fa;
  --ink-dim: #8b95a6;
  --ink-faint: #5a6473;

  /* Straight off the wordmark. Used as an indicator, not as a wash. */
  --accent: #2e8bff;
  --accent-soft: #1d5cb0;
  --accent-glow: rgba(46, 139, 255, 0.14);

  --warn: #e0a33e;
  --good: #46b67c;

  --chrome: "Barlow Semi Condensed", "Arial Narrow", sans-serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --rail: 268px;
  --toc: 210px;
  --gutter: 40px;

  color-scheme: dark;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 15px/1.68 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* A faint vertical fall-off, so the page has depth without a gradient hero doing the work. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 70% at 50% -10%, rgba(46, 139, 255, 0.05), transparent 60%);
  z-index: 0;
}

a { color: var(--ink-strong); }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #05080d;
  padding: 10px 16px;
  font: 600 13px/1 var(--chrome);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  z-index: 100;
}
.skip:focus { left: 8px; top: 8px; }

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

/* ---- Top bar ------------------------------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--ground);
  border-bottom: 1px solid var(--rule);
}

.topbar__in {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  white-space: nowrap;
  flex: none;
}

/* The framing bracket from the mark, drawn rather than shipped as another image. */
.brand__mark {
  width: 15px;
  height: 15px;
  border: 2px solid var(--accent);
  border-right-color: transparent;
  border-bottom-color: transparent;
  position: relative;
}
.brand__mark::after {
  content: "";
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--accent);
  border-left-color: transparent;
  border-top-color: transparent;
}

.brand__name {
  font: 600 14px/1 var(--chrome);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-strong);
}
.brand__sep { color: var(--ink-faint); font-size: 13px; }
.brand__section {
  font: 500 14px/1 var(--chrome);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* ---- Search ------------------------------------------------------------------------------- */

.search { position: relative; flex: 1; max-width: 460px; margin-left: auto; }

.search input {
  width: 100%;
  height: 32px;
  padding: 0 34px 0 11px;
  background: var(--ground-2);
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  color: var(--ink);
  font: 400 13.5px/1 var(--sans);
}
.search input::placeholder { color: var(--ink-faint); }
.search input:focus { border-color: var(--accent-soft); outline: none; box-shadow: 0 0 0 3px var(--accent-glow); }

.search kbd {
  position: absolute;
  right: 8px;
  top: 7px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  color: var(--ink-faint);
  font: 500 11px/1 var(--mono);
  pointer-events: none;
}
.search input:focus + kbd { opacity: 0; }

.search__results {
  position: absolute;
  top: 38px;
  left: 0;
  right: 0;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  z-index: 50;
}
.search__results a {
  display: block;
  padding: 9px 12px;
  text-decoration: none;
  border-left: 2px solid transparent;
  border-bottom: 1px solid var(--rule);
}
.search__results a:last-child { border-bottom: 0; }
.search__results a:hover,
.search__results a.is-active { background: var(--ground-2); border-left-color: var(--accent); }
.search__results .r-t { display: block; color: var(--ink-strong); font-size: 14px; }
.search__results .r-c {
  display: block;
  color: var(--ink-faint);
  font: 500 11px/1.5 var(--chrome);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-top: 2px;
}
.search__empty { padding: 14px 12px; color: var(--ink-faint); font-size: 13.5px; }

.navtoggle {
  display: none;
  background: var(--ground-2);
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  color: var(--ink);
  padding: 6px 12px;
  font: 600 12px/1 var(--chrome);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  cursor: pointer;
}

/* ---- Shell -------------------------------------------------------------------------------- */

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr) var(--toc);
  gap: 0 48px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  align-items: start;
}

/* ---- Side nav ----------------------------------------------------------------------------- */

.nav {
  position: sticky;
  top: 56px;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 30px 20px 60px 0;
  border-right: 1px solid var(--rule);
  scrollbar-width: thin;
}

.nav__product { display: block; text-decoration: none; margin-bottom: 26px; }
.nav__product img {
  display: block;
  width: 100%;
  max-width: 190px;
  height: auto;
  /* The mark carries its own glow; a touch more makes it sit on the dark ground properly. */
  filter: drop-shadow(0 0 18px rgba(46, 139, 255, 0.28));
}
.nav__version {
  display: inline-block;
  margin-top: 9px;
  padding: 2px 7px;
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  color: var(--ink-dim);
  font: 500 11px/1.5 var(--mono);
}

.nav__group { margin-bottom: 22px; }
.nav__label {
  margin: 0 0 8px;
  font: 600 11px/1 var(--chrome);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav li { margin: 0; }

.nav li a {
  position: relative;
  display: block;
  padding: 5px 10px 5px 12px;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 14px;
  border-left: 1px solid var(--rule);
  transition: color 0.12s ease, border-color 0.12s ease;
}
.nav li a:hover { color: var(--ink); border-left-color: var(--rule-2); }

/* The active page gets the framing brackets, the same gesture as the logo's corner marks. */
.nav li a[aria-current="page"] {
  color: var(--accent);
  border-left-color: var(--accent);
  background: linear-gradient(90deg, var(--accent-glow), transparent 70%);
}
.nav li a[aria-current="page"]::before,
.nav li a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 3px;
  width: 5px;
  height: 5px;
  border: 1px solid var(--accent);
}
.nav li a[aria-current="page"]::before { top: 4px; border-right: 0; border-bottom: 0; }
.nav li a[aria-current="page"]::after { bottom: 4px; border-right: 0; border-top: 0; }

/* ---- On this page ------------------------------------------------------------------------- */

.toc {
  position: sticky;
  top: 56px;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 34px 0 60px;
}
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc a {
  display: block;
  padding: 3px 0 3px 11px;
  border-left: 1px solid var(--rule);
  color: var(--ink-faint);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.45;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.toc a:hover { color: var(--ink); }
.toc a.is-current { color: var(--accent); border-left-color: var(--accent); }
.toc__l3 a { padding-left: 22px; font-size: 12.5px; }

/* ---- Document ----------------------------------------------------------------------------- */

main { min-width: 0; padding: 34px 0 90px; }

.doc { max-width: 74ch; }

.crumb {
  display: flex;
  gap: 8px;
  align-items: center;
  font: 500 11.5px/1 var(--chrome);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 16px;
}
.crumb a { color: var(--ink-dim); text-decoration: none; }
.crumb a:hover { color: var(--accent); }

.eyebrow {
  margin: 0 0 10px;
  font: 600 11.5px/1 var(--chrome);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.page-head { margin-bottom: 34px; }
.page-head h1, .home-head h1 {
  margin: 0 0 12px;
  font: 600 clamp(28px, 3.4vw, 38px)/1.14 var(--sans);
  letter-spacing: -0.021em;
  color: var(--ink-strong);
}

.lede {
  margin: 0;
  font-size: 17px;
  line-height: 1.62;
  color: var(--ink-dim);
}

.doc h2 {
  margin: 46px 0 14px;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  font: 600 22px/1.3 var(--sans);
  letter-spacing: -0.014em;
  color: var(--ink-strong);
}
.doc h3 {
  margin: 32px 0 10px;
  font: 600 16.5px/1.4 var(--sans);
  color: var(--ink-strong);
}
.doc h4 {
  margin: 24px 0 8px;
  font: 600 12px/1 var(--chrome);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.anchor {
  margin-left: 9px;
  color: var(--ink-faint);
  text-decoration: none;
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.12s ease;
}
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }

.doc p { margin: 0 0 16px; }
.doc strong { color: var(--ink-strong); font-weight: 600; }
.doc em { color: var(--ink); }

.doc p a, .doc li a, .lede a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(46, 139, 255, 0.4);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.12s ease;
}
.doc p a:hover, .doc li a:hover, .lede a:hover { text-decoration-color: var(--accent); }

.doc ul, .doc ol { margin: 0 0 16px; padding-left: 20px; }
.doc li { margin: 0 0 7px; }
.doc li::marker { color: var(--ink-faint); }
.doc ul ul, .doc ol ol { margin: 7px 0 0; }

code {
  font: 400 0.875em/1.4 var(--mono);
  background: var(--ground-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.1em 0.36em;
  color: #a8c8f0;
}

.code {
  position: relative;
  margin: 0 0 20px;
  background: var(--ground-2);
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  overflow: hidden;
}
.code::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  right: 0;
  padding: 3px 9px;
  font: 600 10.5px/1.4 var(--chrome);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-left: 1px solid var(--rule-2);
  border-bottom: 1px solid var(--rule-2);
}
.code pre { margin: 0; padding: 15px 16px; overflow-x: auto; }
.code code {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.62;
}

/* ---- Tables ------------------------------------------------------------------------------- */

.table-scroll { overflow-x: auto; margin: 0 0 22px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  padding: 0 14px 8px 0;
  border-bottom: 1px solid var(--rule-2);
  font: 600 11px/1.4 var(--chrome);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
}
tbody td {
  padding: 9px 14px 9px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  color: var(--ink-dim);
}
tbody tr:last-child td { border-bottom: 0; }
tbody td:first-child { color: var(--ink); }
/* Numeric columns line up, which is the whole point of printing a ladder as a table. */
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; padding-right: 22px; }
thead th.num { text-align: right; padding-right: 22px; }

/* ---- Callouts ----------------------------------------------------------------------------- */

.callout {
  position: relative;
  margin: 0 0 22px;
  padding: 15px 18px 3px 20px;
  background: var(--ground-2);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--accent);
  border-radius: 2px;
}
.callout::before {
  content: "";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border: 1px solid var(--rule-2);
  border-left: 0;
  border-bottom: 0;
}
.callout__label {
  margin: 0 0 7px;
  font: 600 11px/1 var(--chrome);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
}
.callout--warn { border-left-color: var(--warn); }
.callout--warn .callout__label { color: var(--warn); }
.callout--key { border-left-color: var(--good); }
.callout--key .callout__label { color: var(--good); }
.callout p { color: var(--ink-dim); }
.callout p strong { color: var(--ink); }

/* ---- Divider: a rule with a keyframe on it ------------------------------------------------ */

.divider {
  position: relative;
  height: 1px;
  margin: 40px 0;
  background: linear-gradient(90deg, var(--rule-2), var(--rule) 60%, transparent);
}
.divider::after {
  content: "";
  position: absolute;
  left: 46px;
  top: -2.5px;
  width: 6px;
  height: 6px;
  background: var(--ground);
  border: 1px solid var(--accent-soft);
  transform: rotate(45deg);
}

/* The home page carries no side nav, so it drops the three-column shell entirely rather than
   reserving space for rails that are not there. */
body.is-home .shell { grid-template-columns: minmax(0, 1fr); max-width: 1120px; }
body.is-home .nav, body.is-home .toc { display: none; }
body.is-home main { padding-top: 56px; }

/* ---- Home --------------------------------------------------------------------------------- */

.doc--home { max-width: 980px; }
.home-head { margin-bottom: 8px; }

.spline { margin: 4px 0 40px; }
.spline svg { display: block; width: 100%; height: 108px; overflow: visible; }
.spline__curve {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  opacity: 0.65;
  stroke-dasharray: 1600;
  stroke-dashoffset: 1600;
  animation: draw 1.5s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  filter: drop-shadow(0 0 6px rgba(46, 139, 255, 0.5));
}
.spline__keys { fill: var(--ground); stroke: var(--accent); stroke-width: 1.5; opacity: 0; animation: fade 0.5s ease 1.1s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .spline__curve { animation: none; stroke-dashoffset: 0; }
  .spline__keys { animation: none; opacity: 1; }
}

.products { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-bottom: 48px; }

.product {
  position: relative;
  display: block;
  padding: 26px 24px 22px;
  background: var(--ground-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.product:hover { border-color: var(--accent-soft); background: var(--panel); }

/* Framing brackets again, this time as the hover state. */
.product__frame::before,
.product__frame::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  border: 1px solid transparent;
  transition: border-color 0.15s ease;
}
.product__frame::before { top: 7px; left: 7px; border-right: 0; border-bottom: 0; }
.product__frame::after { bottom: 7px; right: 7px; border-left: 0; border-top: 0; }
.product:hover .product__frame::before,
.product:hover .product__frame::after { border-color: var(--accent); }

.product__logo {
  display: block;
  width: 100%;
  max-width: 210px;
  height: auto;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 20px rgba(46, 139, 255, 0.25));
}
.product__tag { margin: 0 0 14px; color: var(--ink-dim); font-size: 14.5px; line-height: 1.55; }
.product__meta {
  display: flex;
  gap: 10px;
  margin: 0 0 16px;
  font: 500 11px/1 var(--mono);
  color: var(--ink-faint);
}
.product__meta span { padding: 3px 7px; border: 1px solid var(--rule-2); border-radius: 2px; }
.product__go {
  font: 600 11.5px/1 var(--chrome);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
}
.product__go::after { content: " \2192"; }

/* ---- Footer ------------------------------------------------------------------------------- */

.foot { position: relative; z-index: 1; border-top: 1px solid var(--rule); margin-top: 40px; }
.foot__in {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  justify-content: space-between;
  max-width: 1600px;
  margin: 0 auto;
  padding: 22px var(--gutter);
  color: var(--ink-faint);
  font-size: 13px;
}
.foot p { margin: 0; }

/* ---- Responsive --------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .shell { grid-template-columns: var(--rail) minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 860px) {
  :root { --gutter: 20px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .navtoggle { display: block; }
  .brand__section, .brand__sep { display: none; }
  .nav {
    display: none;
    position: static;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    padding: 20px 0 24px;
  }
  .nav.is-open { display: block; }
  .search { max-width: none; }
  main { padding-top: 24px; }
  .doc h2 { margin-top: 36px; }
}
