/* Bricolage Grotesque and Instrument Serif, both SIL Open Font License (see fonts/). */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/BricolageGrotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/InstrumentSerif-Italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #f6f6f5;
  --surface: #ffffff;
  --text: #1c1c1c;
  --muted: #6b6b6b;
  --line: #e4e4e2;
  --accent: #f5a623;
  --accent-ink: #1c1c1c;
  --board: #ffffff;
  --board-edge: #dcdcda;
  --dots: #d6d6d3;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  /* notation */
  --blue: #3b82f6;
  --blue-fill: #eaf1fe;
  --green: #10b981;
  --green-fill: #e5f7f0;
  --red: #dc3c3c;
  --red-fill: #fdecec;
  --amber: #d48806;
  --amber-fill: #fef4e2;
  --wire: #64748b;
  --lane: #f1f1ef;
  --blue-side: #9dbdf6;
  --green-side: #86d6b9;
  --red-side: #e8a3a3;
  --amber-side: #e9c27a;
  --plate: 18px;
  --plate-side: #e2e2df;
  --plate-front: #d6d6d2;
  --rise: 16px;
  --hero-photo: url("img/honeycomb-edge.webp");
  --honeycomb: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cpath d='M28 0 L56 16 L56 48 L28 64 L0 48 L0 16 Z M28 64 L28 97 M0 48 L0 81 L28 97 L56 81 L56 48' fill='none' stroke='%23000' stroke-opacity='0.08'/%3E%3C/svg%3E");
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --surface: #1e1e1e;
    --text: #ededed;
    --muted: #969696;
    --line: #2c2c2c;
    --accent-ink: #141414;
    --board: #1e1e1e;
    --board-edge: #333333;
    --dots: #2e2e2e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    --blue-fill: #1d2a40;
    --green-fill: #15302a;
    --red-fill: #3a1e1e;
    --amber-fill: #3a2e14;
    --wire: #9c9c9c;
    --lane: #232323;
    --blue-side: #2c4f8f;
    --green-side: #1d6a52;
    --red-side: #7a2e2e;
    --amber-side: #7c5a17;
    --plate-side: #2a2a2a;
    --plate-front: #232323;
    --honeycomb: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cpath d='M28 0 L56 16 L56 48 L28 64 L0 48 L0 16 Z M28 64 L28 97 M0 48 L0 81 L28 97 L56 81 L56 48' fill='none' stroke='%23fff' stroke-opacity='0.07'/%3E%3C/svg%3E");
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16.5px/1.6 "Bricolage Grotesque", -apple-system, "Segoe UI", Roboto, sans-serif;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* ---- Header ------------------------------------------------------------------------------ */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px max(20px, calc((100vw - 1080px) / 2));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.site-header.scrolled {
  border-bottom-color: var(--line);
}

.site-header.over-photo {
  position: absolute;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 0;
  /* Deep honey brown reads better on the light amber comb than white. */
  color: #2b1700;
}

.site-header.over-photo nav a:not(.button) {
  color: rgba(43, 23, 0, 0.82);
  font-weight: 500;
}

.site-header.over-photo nav a:not(.button):hover {
  color: #2b1700;
}

.site-header.over-photo .button.primary {
  background: #fff;
  border-color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  text-decoration: none;
}

.brand img {
  width: 26px;
  height: 26px;
}

.site-header nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 15px;
}

.site-header nav a {
  text-decoration: none;
  color: var(--muted);
}

.site-header nav a:hover {
  color: var(--text);
}

/* ---- Buttons ----------------------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: transform 0.15s, box-shadow 0.15s;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.button.small {
  padding: 7px 14px;
  font-size: 14px;
}

.site-header nav .button.small {
  color: var(--accent-ink);
}

/* ---- Hero + 3D board -------------------------------------------------------------------- */

/* The stage pins the scene while the board rotates from tilted (--p = 0) to flat (--p = 1).
   After that the page scrolls on normally. */
.stage {
  position: relative;
  height: 230vh;
}

.scene::before {
  /* Honeycomb photo as a short band behind the header. */
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 148px;
  /* The photo has its own honeycomb edge (transparent below), so it needs no mask.
     Anchored at the bottom so the edge is always visible. */
  background: var(--hero-photo) center bottom / cover no-repeat;
  pointer-events: none;
}

.scene {
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 600px;
  overflow: hidden;
  perspective: 1500px;
  perspective-origin: 50% 40%;
}

.hero {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 2;
  padding: clamp(96px, 13vh, 140px) 20px 0;
  text-align: center;
  /* Stays in place while the board below it rotates. */
  pointer-events: none;
}

.hero > * {
  pointer-events: auto;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(40px, 6.8vw, 84px);
  line-height: 1;
  font-weight: 650;
  font-stretch: 92%;
  letter-spacing: -0.04em;
}

.hero h1 .soft {
  font-family: "Instrument Serif", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 1.12em;
  letter-spacing: -0.01em;
  color: var(--muted);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  padding: 6px 14px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  font: 500 12px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.eyebrow .hex {
  width: 12px;
  height: 13px;
  background: var(--accent);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.hero p {
  margin: 0 auto 26px;
  max-width: 560px;
  font-size: clamp(16px, 1.8vw, 19px);
  color: var(--muted);
}

.hero .actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero .hint {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

.board-wrap {
  z-index: 1;
  position: absolute;
  /* Centre of the free space below the hero; set by site.js. */
  top: var(--board-top, 62%);
  left: 50%;
  width: 1000px;
  height: 440px;
  margin: -220px 0 0 -500px;
  transform-style: preserve-3d;
  transform:
    translateY(calc((1 - var(--p, 0)) * var(--drop, 30px)))
    scale(calc(var(--fit, 1) * (0.9 + var(--p, 0) * 0.1)))
    rotateX(calc((1 - var(--p, 0)) * 56deg))
    rotateZ(calc((1 - var(--p, 0)) * -32deg));
}

/* The board is a physical plate: a top surface plus four side walls. */
.board {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background-color: var(--board);
  background-image: radial-gradient(var(--dots) 1px, transparent 1.2px);
  background-size: 16px 16px;
  border: 1px solid var(--board-edge);
  transform-style: preserve-3d;
}

.board-side {
  position: absolute;
  background: var(--plate-side);
  backface-visibility: hidden;
}

.board-side.front {
  left: 14px;
  right: 14px;
  top: 100%;
  height: var(--plate);
  transform-origin: top;
  transform: rotateX(-90deg);
  background: var(--plate-front);
}

.board-side.back {
  left: 14px;
  right: 14px;
  bottom: 100%;
  height: var(--plate);
  transform-origin: bottom;
  transform: rotateX(90deg);
}

.board-side.left {
  top: 14px;
  bottom: 14px;
  right: 100%;
  width: var(--plate);
  transform-origin: right;
  transform: rotateY(-90deg);
}

.board-side.right {
  top: 14px;
  bottom: 14px;
  left: 100%;
  width: var(--plate);
  transform-origin: left;
  transform: rotateY(90deg);
}

.floor-shadow {
  position: absolute;
  inset: 24px 0 -16px 16px;
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.14);
  filter: blur(24px);
  transform: translateZ(calc(var(--plate) * -1));
}

.layer {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

/* Soft contact shadows on the board under each platform. */
.shadows {
  position: absolute;
  inset: 0;
  filter: blur(7px);
  opacity: 0.22;
}

.shadows > div {
  position: absolute;
  background: #000;
  border-radius: 12px;
  transform: translate(10px, 14px);
}

.wires {
  position: absolute;
  inset: 0;
  overflow: visible;
  transform: translateZ(1px);
}

.wires path {
  fill: none;
  stroke: var(--wire);
  stroke-width: 1.8;
  stroke-linejoin: round;
}

/* Elements are raised platforms: stacked slabs form the side walls, the node is the lid. */
.slab {
  position: absolute;
  pointer-events: none;
}

.slab.task {
  border-radius: 12px;
  background: var(--blue-side);
}

.slab.event {
  border-radius: 50%;
  background: var(--green-side);
}

.slab.event.end {
  background: var(--red-side);
}

.slab.gateway svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.slab.gateway path {
  fill: var(--amber-side);
  stroke: var(--amber-side);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.node {
  position: absolute;
  display: grid;
  place-items: center;
  font-size: 13px;
  color: var(--text);
  text-align: center;
}

.node.raised {
  transform: translateZ(var(--rise));
}

.node.task {
  border-radius: 12px;
  border: 1.5px solid var(--blue);
  background: var(--blue-fill);
}

.node.event {
  border-radius: 50%;
  background: var(--green-fill);
  border: 2px solid var(--green);
}

.node.event.end {
  background: var(--red-fill);
  border: 4px solid var(--red);
}

.node.gateway svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.gw-shape {
  fill: var(--amber-fill);
  stroke: var(--amber);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.gw-mark {
  stroke: var(--amber);
  stroke-width: 3;
  stroke-linecap: round;
}

.node .label,
.chip {
  white-space: nowrap;
  font-size: 11.5px;
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--board);
  border: 1px solid var(--line);
}

.node .label {
  position: absolute;
  top: calc(100% + 8px);
}

.chip {
  position: absolute;
  transform: translate(-50%, -50%) translateZ(2px);
  color: var(--muted);
}

.pool {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  overflow: hidden;
}

.pool .band {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 34px;
  display: grid;
  place-items: center;
  background: var(--lane);
  border-right: 1px solid var(--board-edge);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.pool .band span {
  transform: rotate(-90deg);
  white-space: nowrap;
}

.pool .lane-name {
  position: absolute;
  left: 46px;
  top: 10px;
  font-size: 11.5px;
  color: var(--muted);
}

.pool .lane-name.second {
  top: calc(50% + 10px);
}

.pool .divider {
  position: absolute;
  left: 34px;
  right: 0;
  top: 50%;
  border-top: 1px solid var(--board-edge);
}

/* ---- Sections ---------------------------------------------------------------------------- */

section.content {
  max-width: 1080px;
  margin: 0 auto;
  padding: 96px 20px 0;
}

/* The flat board fills the scene below the hero, so the next section can follow closely. */
.stage + section.content {
  padding-top: 40px;
  position: relative;
}

section.content h2 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}

section.content > p {
  color: var(--muted);
  max-width: 620px;
  margin: 0 0 36px;
}

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.shots figure {
  margin: 0;
}

.shots img {
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.shots figcaption {
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
}

.downloads {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.download {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 22px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.download:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.download strong {
  font-size: 17px;
}

.download span {
  font-size: 14px;
  color: var(--muted);
}

.download.current {
  border-color: var(--accent);
}

.note {
  margin-top: 20px;
  font-size: 14px;
  color: var(--muted);
}

code {
  font: 13.5px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: color-mix(in srgb, var(--text) 7%, transparent);
  padding: 1px 6px;
  border-radius: 5px;
}

footer {
  max-width: 1080px;
  margin: 120px auto 0;
  padding: 28px 20px 48px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-size: 14px;
  color: var(--muted);
}

footer a {
  color: var(--muted);
}

footer .spacer {
  flex: 1;
}

/* ---- Wiki -------------------------------------------------------------------------------- */

.wiki {
  max-width: 1080px;
  margin: 0 auto;
  padding: 100px 20px 0;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 56px;
}

.wiki aside {
  position: sticky;
  top: 90px;
  align-self: start;
  font-size: 14px;
}

.wiki aside a {
  display: block;
  padding: 5px 10px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--muted);
}

.wiki aside a:hover {
  color: var(--text);
}

.wiki aside a.active {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 7%, transparent);
}

.wiki article {
  max-width: 720px;
  min-width: 0;
}

.wiki article h1 {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.wiki article h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 56px 0 12px;
  scroll-margin-top: 90px;
}

.wiki article h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 28px 0 8px;
}

.wiki article p,
.wiki article li {
  color: color-mix(in srgb, var(--text) 86%, var(--muted));
}

.wiki article .lead {
  color: var(--muted);
  font-size: 18px;
}

.wiki table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  margin: 12px 0;
}

.wiki th,
.wiki td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.wiki th {
  font-weight: 600;
}

.wiki pre {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  overflow-x: auto;
}

.wiki pre code {
  background: none;
  padding: 0;
}

kbd {
  font: 12.5px ui-monospace, "SF Mono", Menlo, monospace;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  background: var(--surface);
}

/* ---- Screenshot viewer ------------------------------------------------------------------- */

.viewer {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.viewer-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.viewer-tabs button {
  font: 500 14px/1 "Bricolage Grotesque", sans-serif;
  color: var(--muted);
  padding: 9px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.viewer-tabs button[aria-selected="true"] {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.window-frame {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.35);
}

.window-bar {
  display: flex;
  gap: 7px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.window-bar i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text) 16%, transparent);
}

.window-frame img {
  width: 100%;
  transition: opacity 0.2s;
}

.viewer-caption {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}

/* ---- Wordmark ---------------------------------------------------------------------------- */

.wordmark {
  margin: 120px auto -0.18em;
  max-width: 1200px;
  text-align: center;
  font-size: clamp(80px, 20vw, 280px);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1;
  color: transparent;
  background: linear-gradient(180deg, color-mix(in srgb, var(--text) 14%, transparent), transparent 85%);
  -webkit-background-clip: text;
  background-clip: text;
  user-select: none;
}

.wordmark + footer {
  margin-top: 0;
}

/* ---- Small screens / reduced motion ------------------------------------------------------ */

@media (max-width: 760px) {
  :root {
    --hero-photo: url("img/honeycomb-edge-small.webp");
  }
  .site-header nav a:not(.button) {
    display: none;
  }
  .board-wrap {
    --drop: 16px;
  }
  .wiki {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .wiki aside {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .stage {
    height: auto;
  }
  .scene {
    position: relative;
  }
}
