/* SetEngine website. Matte charcoal, one green, one cable. */

:root {
  --bg: #0f1011;
  --bg-raise: #141517;
  --panel: #18191b;
  --line: #292b2e;
  --line-hi: #414448;

  --text: #e8eae4;
  --muted: #a3a7a0;
  --dim: #6f736e;

  --green: #3f9d68;      /* the app icon's green */
  --green-hi: #67c692;
  --green-deep: #2b6b49;
  --green-ink: #0d1711;

  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --body: "Instrument Sans", "Helvetica Neue", Helvetica, sans-serif;
  --mono: "Martian Mono", ui-monospace, Menlo, monospace;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --pad: clamp(1.25rem, 4.5vw, 4rem);
  --max: 80rem;
  --gap-y: clamp(7rem, 15vw, 13rem);
}

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

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

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

/* Film grain: what makes the flat greys read as matte rather than as a screen. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3, p, dl, dd, ol, figure { margin: 0; }
ol { padding: 0; list-style: none; }
a { color: inherit; }
em { font-style: normal; }

::selection { background: var(--green); color: var(--green-ink); }

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

.skip {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.5rem 0.9rem;
  background: var(--text);
  color: var(--bg);
  border-radius: 6px;
  transform: translateY(-300%);
}
.skip:focus { transform: none; }

/* ---------- Nav ---------- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0.9rem var(--pad);
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s, border-color 0.3s;
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
}
.brand-mark {
  width: 1.9rem;
  height: 1.9rem;
  fill: none;
  stroke: var(--green);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-links {
  display: flex;
  gap: 1.75rem;
  margin-left: auto;
  font-size: 0.94rem;
}
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--body);
  font-weight: 600;
  text-decoration: none;
  border-radius: 10px;
  transition: background-color 0.2s, transform 0.25s var(--ease);
}
.btn svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.35s var(--ease);
}
.btn:hover svg { transform: translateY(2px); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  padding: 1rem 1.5rem;
  background: var(--green);
  color: var(--green-ink);
  font-size: 1.06rem;
}
.btn-primary:hover { background: var(--green-hi); }

.btn-large {
  padding: 1.2rem 1.9rem;
  font-size: 1.15rem;
}

.btn-ghost {
  padding: 1rem 1.4rem;
  border: 1px solid var(--line-hi);
  color: var(--text);
  font-size: 1.06rem;
}
.btn-ghost:hover { background: var(--panel); border-color: var(--dim); }
.module .btn-ghost:hover { background: var(--bg-raise); }
.btn-ghost.btn-large { padding: 1.2rem 1.7rem; font-size: 1.15rem; }
.btn .gh-icon { fill: currentColor; stroke: none; }
.btn:hover .gh-icon { transform: none; }

.text-link {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--green);
  text-underline-offset: 4px;
}
.text-link:hover { color: var(--green-hi); }

.btn-small {
  padding: 0.5rem 0.95rem;
  font-size: 0.9rem;
  border: 1px solid var(--line-hi);
  color: var(--text);
}
.btn-small:hover { background: var(--panel); }

/* ---------- Shared type ---------- */

.eyebrow,
.channel,
.module figcaption,
.module-cap {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.led {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.7em;
  border-radius: 50%;
  background: var(--line-hi);
  vertical-align: 0.08em;
  transition: background-color 0.4s;
}
/* 124 BPM: one beat is 60 / 124 s. */
.led-beat {
  background: var(--green-hi);
  animation: beat 0.4839s steps(1, end) infinite;
}
@keyframes beat {
  0% { opacity: 1; }
  35% { opacity: 0.25; }
}

/* ---------- The cable ---------- */

.page {
  position: relative;
  overflow: clip;
}

.wire {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}
.wire path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.wire-ghost {
  stroke: var(--line);
  stroke-width: 1.5;
  stroke-dasharray: 2 9;
}
.wire-live {
  stroke: var(--green);
  stroke-width: 2.5;
}
.wire-head { opacity: 0; transition: opacity 0.3s; }
.wire-head.on { opacity: 1; }
.wire-head-dot { fill: var(--green-hi); }
.wire-head-ring {
  fill: none;
  stroke: var(--green);
  stroke-width: 1.5;
  transform-box: fill-box;
  transform-origin: center;
  animation: ring 1.9s var(--ease) infinite;
}
@keyframes ring {
  from { transform: scale(0.4); opacity: 0.9; }
  to { transform: scale(1.5); opacity: 0; }
}

main, .footer { position: relative; z-index: 1; }

.jack {
  position: absolute;
  left: 50%;
  width: 13px;
  height: 13px;
  margin: -6.5px 0 0 -6.5px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--line-hi);
  transition: border-color 0.4s, background-color 0.4s;
}
.jack-in { top: 0; }
.jack-out { top: 100%; }
.jack.live {
  border-color: var(--green);
  background: var(--green-deep);
}

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1rem, 3vw, 3rem);
  max-width: var(--max);
  min-height: 100svh;
  margin: 0 auto;
  padding: 6.5rem var(--pad) 4rem;
}

.hero-title {
  margin-top: 1.4rem;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(3.6rem, 8.5vw, 8.2rem);
  white-space: nowrap;
  line-height: 0.84;
  letter-spacing: -0.005em;
  text-transform: uppercase;
}
.hero-title .line {
  display: block;
  /* clip only top and bottom (for the rise-in); never the sides of the letters */
  clip-path: inset(0 -1em);
  padding-top: 0.06em;
}
.hero-title .line > span {
  display: block;
  animation: rise 1.1s var(--ease) both;
}
.hero-title .line:nth-child(2) > span { animation-delay: 0.09s; }
.hero-title .line:nth-child(3) > span { animation-delay: 0.18s; }
.hero-title em { color: var(--green); }

@keyframes rise {
  from { transform: translateY(105%); }
  to { transform: none; }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.hero .eyebrow { animation: fade-up 0.9s var(--ease) both; }
.hero-sub {
  max-width: 31rem;
  margin-top: 1.8rem;
  font-size: clamp(1.05rem, 1.35vw, 1.22rem);
  color: var(--muted);
  animation: fade-up 0.9s var(--ease) 0.35s both;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
  margin-top: 2.2rem;
  animation: fade-up 0.9s var(--ease) 0.48s both;
}
.cta-note {
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--muted);
}
.hero-note {
  margin-top: 1.2rem;
  animation: fade-up 0.9s var(--ease) 0.56s both;
}
.cta-note strong { color: var(--text); font-weight: 600; }

.hero-art {
  position: relative;
  /* bleeds off the right edge on wide screens */
  width: min(118%, 46rem);
  justify-self: start;
}
.deck { display: block; width: 100%; height: auto; overflow: visible; }

.deck path, .deck circle { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.s-struct { stroke: var(--line-hi); stroke-width: 2; }
.s-green { stroke: var(--green); stroke-width: 2; }
.s-heavy { stroke-width: 7; }
.s-faint { stroke-opacity: 0.4; }

.hd {
  stroke-dasharray: 1 2;
  stroke-dashoffset: 1;
  animation: draw 1.7s var(--ease) forwards;
  animation-delay: calc(var(--i) * 85ms + 150ms);
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.deck .strobe {
  stroke: var(--green);
  stroke-width: 5;
  stroke-opacity: 0.55;
  stroke-linecap: butt;
  /* 30 marks. Dense dots alias against the frame rate and look almost still. */
  stroke-dasharray: 5 44.43;
  animation: fade-in 1.2s 0.9s both;
}
.deck .spindle, .deck .pivot {
  fill: var(--green);
  stroke: none;
  animation: fade-in 0.8s 1.2s both;
}
.deck .arm-mask { stroke: var(--bg); stroke-width: 26; }
.deck .arm-mask-fill { fill: var(--bg); stroke: none; }
.label-text {
  font-family: var(--mono);
  font-size: 13.5px;
  letter-spacing: 0.2em;
  fill: var(--green);
  animation: fade-in 1.2s 1.3s both;
}
.deck-text {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  fill: var(--dim);
  animation: fade-in 1.2s 1.5s both;
}
@keyframes fade-in { from { opacity: 0; } }

.jack-hero { top: 91.67%; left: 48.5%; }

/* ---------- Features ---------- */

.features {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(4rem, 9vw, 8rem) var(--pad) 0;
}

.features-intro { max-width: 34rem; }
.features-intro h2,
.module-wide h2,
.module-final h2 {
  font-family: var(--display);
  font-weight: 900;
  text-transform: uppercase;
  line-height: 0.88;
}
.features-intro h2 {
  margin-top: 1rem;
  font-size: clamp(3rem, 7.5vw, 6.5rem);
}
.features-intro p:last-child {
  max-width: 24rem;
  margin-top: 1.4rem;
  color: var(--muted);
  font-size: 1.12rem;
}

.feature {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 6rem);
  margin-top: var(--gap-y);
}
.feature:nth-of-type(even) { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); }
.feature:nth-of-type(even) .feature-copy { order: 2; }

.channel span {
  margin-right: 0.9em;
  color: var(--green-hi);
}
.channel b {
  margin-left: 0.8em;
  padding: 0.2em 0.55em;
  border: 1px solid var(--line-hi);
  border-radius: 4px;
  font-weight: 400;
  font-size: 0.9em;
  color: var(--text);
}

.feature h3 {
  margin-top: 1rem;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.5rem, 4.6vw, 4.1rem);
  line-height: 0.92;
  text-transform: uppercase;
}
.feature-copy > p:not(.channel) {
  max-width: 30rem;
  margin-top: 1.4rem;
  color: var(--muted);
}

.specs {
  max-width: 30rem;
  margin-top: 1.9rem;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
}
.specs div {
  display: grid;
  grid-template-columns: 5.8rem 1fr;
  gap: 1rem;
  padding: 0.72rem 0;
  border-bottom: 1px solid var(--line);
}
.specs dt {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  padding-top: 0.28em;
}

/* ---------- Modules (the drawn panels) ---------- */

.module {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.module figcaption,
.module-cap {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem 0;
  font-size: 0.66rem;
  color: var(--dim);
}
.module.live .led { background: var(--green-hi); }
.module > svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Everything drawn inside a module. main.js drives dashoffset / opacity. */
.module .d {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1 2;
  stroke-dashoffset: 1;
}
.js .module .f { opacity: 0; }
.module .g { stroke: var(--green); }
.module .gh { stroke: var(--green-hi); }
.module .m { stroke: var(--line-hi); }
.module .thin { stroke-width: 1.25; }
.module .bar { stroke-width: 3; }
.module .dash { stroke: var(--dim); stroke-width: 2; stroke-dasharray: 3 7; fill: none; stroke-linecap: round; }

.module text {
  font-family: var(--mono);
  font-size: 11.5px;
  fill: var(--muted);
}
.module text.end { text-anchor: end; }
.module text.mid { text-anchor: middle; }
.module text.dim { fill: var(--dim); }
.module text.grn { fill: var(--green-hi); }
.module text.big { font-family: var(--body); font-size: 15px; font-weight: 500; fill: var(--text); }
.module text.key { font-size: 12.5px; fill: var(--text); }
.module .dot { fill: var(--green); }
.module .node { fill: var(--panel); stroke: var(--green); stroke-width: 2.5; }

/* Camelot wheel */
.seg { cursor: pointer; outline: none; }
.seg path {
  fill: transparent;
  stroke: none;
  transition: fill 0.25s;
}
.seg text {
  font-size: 11px;
  fill: var(--dim);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  transition: fill 0.25s;
}
.seg:hover path { fill: color-mix(in srgb, var(--green) 12%, transparent); }
.seg:focus-visible path { stroke: var(--green-hi); stroke-width: 2; }
.seg.near path { fill: color-mix(in srgb, var(--green) 30%, transparent); }
.seg.near text { fill: var(--text); }
.seg.sel path { fill: var(--green); }
.seg.sel text { fill: var(--green-ink); font-weight: 500; }

/* ---------- The three smaller tools, in one panel ---------- */

.module-trio { margin-top: var(--gap-y); }
.trio-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem 2rem;
  padding: 1.6rem clamp(1.25rem, 4vw, 3.5rem) 0;
}
.module-wide.module-trio h2 {
  padding: 0;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
}
.trio-head p { color: var(--muted); }
.trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.5rem, 3vw, 3rem);
  margin-top: 1.2rem;
  padding: 0 clamp(1.25rem, 4vw, 3.5rem);
}
.trio svg { display: block; width: 100%; height: auto; }
.trio h3 {
  margin-top: 0.4rem;
  font-size: 1.15rem;
  font-weight: 600;
}
.trio p {
  margin-top: 0.45rem;
  font-size: 0.94rem;
  color: var(--muted);
}
/* the drawings are about half size here, so their labels are set larger */
.trio text { font-size: 16px; }
.trio text.big { font-size: 20px; }
.trio text.key { font-size: 17px; }
.trio .seg text { font-size: 14.5px; }
.trio .d { stroke-width: 2.6; }
.trio .bar { stroke-width: 3.4; }

/* ---------- Install ---------- */

.install, .finale {
  max-width: var(--max);
  margin: var(--gap-y) auto 0;
  padding: 0 var(--pad);
}

.module-wide { padding-bottom: clamp(2rem, 4vw, 3.5rem); }
.module-wide .module-cap,
.module-final .module-cap { padding: 1.25rem clamp(1.25rem, 4vw, 3.5rem) 0; }
.module-wide h2 {
  padding: 2rem clamp(1.25rem, 4vw, 3.5rem) 0;
  font-size: clamp(2.6rem, 6vw, 5.2rem);
}

.steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 3.5rem);
  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding: 2rem clamp(1.25rem, 4vw, 3.5rem) 0;
}
/* the rule the steps hang from: a dim track, and a green one drawn by scroll */
.steps::before, .steps::after {
  content: "";
  position: absolute;
  top: 0;
  left: clamp(1.25rem, 4vw, 3.5rem);
  right: clamp(1.25rem, 4vw, 3.5rem);
  height: 2px;
  background: var(--line);
}
.steps::after {
  background: var(--green);
  transform: scaleX(var(--p, 1));
  transform-origin: left;
}
.step-n {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--green-hi);
}
.steps h3 {
  margin-top: 0.7rem;
  font-size: 1.22rem;
  font-weight: 600;
  line-height: 1.25;
}
.steps p {
  margin-top: 0.6rem;
  font-size: 0.95rem;
  color: var(--muted);
}
.steps b { color: var(--text); font-weight: 600; }

/* ---------- Open source ---------- */

.open-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(2rem, 5vw, 5rem);
  padding: 2rem clamp(1.25rem, 4vw, 3.5rem) 0;
}
.module-open h2 { padding: 0; }
.open-copy {
  max-width: 32rem;
  font-size: 1.12rem;
  color: var(--muted);
}
.open-copy p + p { margin-top: 1rem; }
.open-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.6rem;
  margin-top: 2rem;
  font-size: 1rem;
}

/* ---------- Finale ---------- */

.module-final {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: clamp(3.5rem, 8vw, 7rem);
  text-align: center;
  transition: border-color 0.8s;
}
.module-final .module-cap { align-self: flex-start; }
.module-final h2 {
  margin-top: clamp(2.5rem, 6vw, 5rem);
  padding: 0 1rem;
  font-size: clamp(3rem, 9vw, 8rem);
}
.final-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
  margin-top: clamp(2rem, 4vw, 3.2rem);
  padding: 0 1.25rem;
}
.module-final .cta-note {
  margin-top: 1.6rem;
  padding: 0 1.25rem;
}
.module-final .cta-note a {
  color: var(--text);
  text-decoration-color: var(--green);
  text-underline-offset: 3px;
}
.module-final.live { border-color: var(--green-deep); }

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

.footer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.5rem 3rem;
  width: min(100% - 2 * var(--pad), var(--max) - 2 * var(--pad));
  margin: clamp(5rem, 10vw, 9rem) auto 0;
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.86rem;
  color: var(--dim);
}
.footer .brand { font-size: 1.25rem; color: var(--text); }
.footer nav { display: flex; gap: 1.5rem; }
.footer nav a { color: var(--muted); text-decoration: none; }
.footer nav a:hover { color: var(--text); }

/* ---------- Reveal on scroll ---------- */

.js .reveal > * {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.js .reveal.in > * { opacity: 1; transform: none; }
.reveal.in > *:nth-child(2) { transition-delay: 0.07s; }
.reveal.in > *:nth-child(3) { transition-delay: 0.14s; }
.reveal.in > *:nth-child(4) { transition-delay: 0.21s; }

/* ---------- Narrow screens: the cable runs down a left gutter ---------- */

@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav .btn-small { margin-left: auto; }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    padding-top: 7rem;
    padding-bottom: 2rem;
  }
  .hero-art {
    width: min(100%, 30rem);
    margin-top: 1rem;
  }

  .feature,
  .feature:nth-of-type(even) {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.5rem;
  }
  .feature:nth-of-type(even) .feature-copy { order: 0; }

  .gutter { padding-left: 2.6rem; }
  .jack-in, .jack-out { left: 19px; }
  /* leave from the deck's left edge, so the cable drops straight into the gutter */
  .jack-hero { left: 5.55%; top: 78%; }
  .deck-out { display: none; }

  .open-grid { grid-template-columns: minmax(0, 1fr); padding-left: 2.6rem; }
  .trio { grid-template-columns: minmax(0, 1fr); padding-left: 2.6rem; }
  .trio-head { padding-left: 2.6rem; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .steps::before, .steps::after { display: none; }
  .steps li { padding-top: 1.25rem; border-top: 1px solid var(--line); }
  .module-wide h2, .steps, .module-wide .module-cap { padding-left: 2.6rem; }

  .footer { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .wire-head-ring { display: none; }
}
