/* mojulo.ai — the BAY theme.

   The site now speaks the same language as the app (mojulo/control's
   app/globals.css + components/brand/). It replaced `instrument.css`, a light
   plastic panel that read as a SaaS landing page wearing a hardware costume.
   This is the workshop itself: a near-black void, one instrument frame standing
   on it, regions divided by shared hairlines, and every icon and mark drawn as
   a dot-relief sample of one lattice.

   Four rules carry the whole thing:

   1. THE SURFACE OWNS THE FIELD, THE MARK OWNS THE INK. `.moj-field` is the
      11px lattice of latent space — "room that can be minted into". It belongs
      to a plate. Marks and icons draw ink only (see assets/brand-dots.js), so
      an `m` on a field plate is ONE lattice with the letterform condensed out
      of it, never two grids at different pitches fighting.
   2. ONE FRAME, SHARED HAIRLINES. A surface is one bordered frame divided into
      regions by rules those regions share — never a stack of cards with
      borders and gaps, which is what makes a page read as separate documents
      instead of one instrument. Padding, never margin.
   3. ELEVATION BY VALUE, NOT BY SHADOW. void → floor → bench. One shadow, on
      the frame.
   4. THE TYPEFACE SAYS WHO WROTE THE LINE. Whatever a recipe stores or an agent
      typed is mono; whatever a person wrote is sans. */

:root {
  /* the bay, by value */
  --bay-void: #07090c;
  --bay-floor: #0d1117;
  --bay-bench: #151b23;
  --bay-rail: #1e2530;
  --bay-rail-lit: #2c3540;

  --ink-primary: #e8edf2;
  --ink-secondary: #a3aebb;
  --ink-muted: #6b7684;

  --field-dot: #2c3540;
  --field-dot-faint: #1e2530;

  /* mode hues. `--h` is the local hue a region sets on itself; everything
     inside reads `--h` and needs no rule of its own. */
  --live: #5eead4;        --live-idle: #4a9d92;   --live-strong: #2dd4bf;
  --forge: #f4a86a;       --forge-idle: #b57c4f;  --forge-strong: #ef8f4c;
  --think: #a5b4fc;       --think-idle: #7b83b8;  --think-strong: #818cf8;
  --seal: #d8b4fe;
  --fault: #f87171;
  --h: var(--think);
  --h-idle: var(--think-idle);

  --radius-shell: 20px;
  --radius-bay: 12px;
  --radius-card: 8px;
  --radius-control: 4px;

  --sans: 'Geist', ui-sans-serif, system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --display: 'Outfit', var(--sans);
}

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

body {
  margin: 0;
  background: var(--bay-void);
  color: var(--ink-primary);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--h); text-decoration: none; }
:focus-visible { outline: 2px solid var(--h); outline-offset: 3px; }
img, svg, video { display: block; max-width: 100%; }

/* ── the brand layer, ported from control's globals.css ───────────────────── */

.moj-shell {
  border: 1px solid var(--bay-rail-lit);
  border-radius: var(--radius-shell);
  overflow: hidden;
  background: var(--bay-floor);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.45);
}
.moj-frame {
  border: 1px solid var(--bay-rail-lit);
  border-radius: var(--radius-bay);
  overflow: hidden;
  background: var(--bay-floor);
}
/* ONE side contributes the rule, so a division is never 2px and `:last-child`
   drops it — safe to apply across a list. */
.moj-part-b { border-bottom: 1px solid var(--bay-rail); }
.moj-part-b:last-child { border-bottom: 0; }
.moj-part-r { border-right: 1px solid var(--bay-rail); }
.moj-part-r:last-child { border-right: 0; }

.moj-field {
  background-image: radial-gradient(circle, var(--field-dot) 1px, transparent 1.4px);
  background-size: var(--pitch, 11px) var(--pitch, 11px);
}
.moj-field-faint {
  background-image: radial-gradient(circle, var(--field-dot-faint) 1px, transparent 1.4px);
  background-size: var(--pitch, 11px) var(--pitch, 11px);
}

.moj-relief { fill: currentColor; }
.moj-relief circle { transform-box: fill-box; transform-origin: center; }

/* The print pass: one band of swell travels the lattice left→right and settles,
   like a print head making a pass. Each circle carries its column in `--dc`, so
   a per-column delay is the whole mechanism. The trigger is always an ancestor
   — the plate, the chip, the row — never the icon alone. */
@keyframes moj-dot-pass {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.5); }
  100% { transform: scale(1); }
}
.moj-hover-wave:hover .moj-relief circle,
.door:hover .moj-relief circle {
  animation: moj-dot-pass 0.55s cubic-bezier(0.33, 1, 0.68, 1) both;
  animation-delay: calc(var(--dc, 0) * 16ms);
}

@media (prefers-reduced-motion: reduce) {
  .moj-hover-wave:hover .moj-relief circle,
  .door:hover .moj-relief circle { animation: none; }
}

/* ── the page: one shell standing on the void ─────────────────────────────── */

.bay { padding: clamp(12px, 3vw, 40px); }
.shell { max-width: 1080px; margin: 0 auto; }

/* Every region is a shell child divided by a shared rule — see rule 2. */
.region { padding: clamp(20px, 3.4vw, 34px); }

/* A rail names a region: hue dot-icon, mono label, hairline running to the
   edge. This is the app's section header, and it is the only heading furniture
   on the page — there are no "What it is" / "How it works" signposts. */
.rail {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--h);
  margin: 0 0 20px;
  white-space: nowrap;
}
.rail i { display: block; width: 14px; height: 14px; flex: none; }
.rail::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--bay-rail);
}
.rail em { font-style: normal; color: var(--ink-muted); letter-spacing: 0.14em; }
@media (max-width: 620px) { .rail em { display: none; } }

/* ── top rail ─────────────────────────────────────────────────────────────── */

.top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  padding: 10px clamp(14px, 2.4vw, 22px);
  background: var(--bay-void);
}
.top .brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink-primary); }
.top .brand i { display: block; width: 28px; height: 23px; }
.top .brand b { font-family: var(--display); font-weight: 400; font-size: 15px; letter-spacing: 0.01em; }
.top .slash { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-muted); }
.top .spacer { flex: 1; }
.top a.chip:not(.key) { color: var(--ink-secondary); }
/* The strapline is the one thing here that repeats the h1 below it, so it is
   what gets dropped when the rail runs out of room. */
@media (max-width: 620px) { .top .slash { display: none; } }

/* mono chips — the app's pill chrome. A chip is a control, so it takes the
   region's hue on hover and nothing else moves. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-secondary);
  background: var(--bay-bench);
  border: 1px solid var(--bay-rail);
  border-radius: 999px;
  padding: 6px 13px;
  transition: color 0.12s, border-color 0.12s, background-color 0.12s;
}
a.chip:hover, button.chip:hover { color: var(--h); border-color: var(--h); }
.chip.lit { color: var(--h); border-color: color-mix(in srgb, var(--h) 45%, var(--bay-rail)); }
.chip.lit::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--h);
  flex: none;
}
.chip.sq { border-radius: var(--radius-control); }
.chip.key {
  color: var(--bay-void);
  background: var(--h);
  border-color: var(--h);
  font-weight: 500;
}
a.chip.key:hover { background: var(--think-strong); border-color: var(--think-strong); color: var(--bay-void); }

/* language menu — a details disclosure in the top rail. The summary is a chip
   showing the current code; open, a short column of codes drops under it.
   Plain links: switching is navigation, not script. */
.langs { position: relative; }
.langs summary { list-style: none; cursor: pointer; user-select: none; }
.langs summary::-webkit-details-marker { display: none; }
.langs summary::after {
  content: ""; width: 5px; height: 5px; flex: none;
  border-right: 1px solid currentColor; border-bottom: 1px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.15s ease;
}
.langs[open] summary::after { transform: translateY(1px) rotate(225deg); }
.langs summary:hover, .langs[open] summary { color: var(--h); border-color: var(--h); }
.langs .menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  display: grid; min-width: 100%;
  background: var(--bay-bench);
  border: 1px solid var(--bay-rail-lit);
  border-radius: var(--radius-card);
  padding: 4px;
  box-shadow: 0 14px 34px rgb(0 0 0 / 0.45);
}
.langs .menu a {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em;
  color: var(--ink-secondary); padding: 6px 12px; border-radius: var(--radius-control);
  white-space: nowrap;
}
.langs .menu a:hover { color: var(--h); background: var(--bay-void); }
.langs .menu a[aria-current] { color: var(--ink-primary); }
.langs .menu a[aria-current]::after { content: " ·"; color: var(--h); }

/* ── hero ─────────────────────────────────────────────────────────────────── */

.hero > * { min-width: 0; }

/* The wordmark, rendered live on canvas — treatment 07 from the wordmark
   sheet, the standing animation (see the script at the foot of index.html).
   `--cell` sizes the 64-column lattice off the viewport; the canvas draws its
   own latent dots at the same pitch, so it needs no field plate behind it. */
.wordmark {
  --cell: clamp(4px, calc((100vw - 70px) / 64), 12px);
  width: calc(var(--cell) * 64);
  max-width: 100%;
}
.wordmark canvas { display: block; width: 100%; }

.hero h1 {
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(26px, 4.2vw, 40px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--ink-primary);
  margin: 22px 0 0;
  max-width: 17ch;
}
.hero h1 b { font-weight: 600; color: var(--h); }
.hero .lede { margin: 12px 0 0; color: var(--ink-secondary); max-width: 56ch; }
.hero .controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; align-items: center; }

/* The install line is a readout, not a button — mono, because the machine
   authored it and you are meant to copy it verbatim. */
.readout {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
  background: var(--bay-void);
  border: 1px solid var(--bay-rail);
  border-radius: var(--radius-control);
  padding: 9px 13px;
  overflow-x: auto;
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
}
.readout b { color: var(--live); font-weight: 400; }
.readout .sep { color: var(--bay-rail-lit); padding: 0 4px; }

/* ── the doors — four tiles, one lattice icon and one machine line each ───── */

.doors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .doors { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .doors { grid-template-columns: minmax(0, 1fr); } }

.doors .door { border-right: 1px solid var(--bay-rail); border-bottom: 1px solid var(--bay-rail); }
.doors .door:last-child { border-right: 0; }
@media (min-width: 901px) { .doors .door { border-bottom: 0; } }
@media (max-width: 900px) {
  .doors .door:nth-child(2n) { border-right: 0; }
  .doors .door:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (max-width: 520px) {
  .doors .door { border-right: 0; }
  .doors .door:last-child { border-bottom: 0; }
}

.door { padding: 18px 20px 20px; display: block; color: inherit; }
.door .plate {
  width: 60px; height: 60px;
  display: grid; place-items: center;
  color: var(--h-idle);
  border: 1px solid var(--bay-rail);
  border-radius: var(--radius-card);
  transition: color 0.12s, border-color 0.12s, background-color 0.12s;
}
.door .plate i { display: block; width: 36px; height: 36px; }
.door:hover .plate { color: var(--h); border-color: var(--h); background: color-mix(in srgb, var(--h) 6%, var(--bay-void)); }
.door h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  color: var(--ink-primary);
  margin: 14px 0 5px;
}
/* mono, because these are the machine's own terms of art — the grid, the seed,
   the recipe — not marketing lines a person wrote about them. */
.door p { font-family: var(--mono); font-size: 11.5px; line-height: 1.65; color: var(--ink-muted); margin: 0; }

/* ── the loop — the builder and the recipe it builds, side by side ────────── */

.loop-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.loop-grid > * { min-width: 0; }
@media (min-width: 820px) { .loop-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; } }

.b-display { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius-bay); overflow: hidden;
  background: var(--bay-void); border: 1px solid var(--bay-rail); }
.b-display canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.b-display .b-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 0.3s ease; }
.b-display.on-photo canvas { opacity: 0; }
.b-display.on-photo .b-photo { opacity: 1; }
.b-stepper { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.b-step { font-family: var(--mono); font-size: 14px; line-height: 1; color: var(--ink-secondary);
  width: 26px; height: 26px; flex: none; border: 1px solid var(--bay-rail); border-radius: var(--radius-control);
  cursor: pointer; background: var(--bay-bench); transition: color 0.12s, border-color 0.12s; }
.b-step:hover { color: var(--h); border-color: var(--h); }
.b-readout { flex: 1; min-width: 0; margin: 0; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.02em; color: var(--ink-muted); }
.b-readout b { color: var(--h); font-weight: 400; }
.b-idx { color: var(--bay-rail-lit); margin-right: 7px; font-variant-numeric: tabular-nums; }

.recipe {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink-secondary);
  white-space: pre;
  background: var(--bay-void);
  border: 1px solid var(--bay-rail);
  border-radius: var(--radius-bay);
  padding: 14px 16px;
  margin: 0;
  overflow-x: auto;
  min-width: 0;
}
.recipe .note { color: var(--h); }
.recipe .k { color: var(--think); }

.cap { font-family: var(--mono); font-size: 11px; line-height: 1.7; color: var(--ink-muted); margin: 14px 0 0; }
.cap b { color: var(--h); font-weight: 400; }
.say { margin: 0 0 18px; color: var(--ink-secondary); max-width: 68ch; }
.say b { color: var(--ink-primary); font-weight: 600; }

/* ── what leaves — export chips over a poster row ─────────────────────────── */

.strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.posters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 700px) { .posters { grid-template-columns: minmax(0, 1fr); } }
.poster { display: block; border: 1px solid var(--bay-rail); border-radius: var(--radius-bay);
  overflow: hidden; background: var(--bay-void); color: inherit; transition: border-color 0.12s; }
.poster:hover { border-color: var(--h); }
.poster img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; transition: opacity 0.12s; }
.poster:hover img { opacity: 0.86; }
.poster span { display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-muted); padding: 9px 11px; border-top: 1px solid var(--bay-rail); }
.poster:hover span { color: var(--ink-secondary); }

/* ── house rules ──────────────────────────────────────────────────────────── */

.rules { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
@media (min-width: 820px) { .rules { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.rules h3 { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-muted); margin: 0 0 12px; font-weight: 400; }
.rules p { margin: 0 0 12px; color: var(--ink-secondary); font-size: 14px; }
.rules p b { color: var(--ink-primary); font-weight: 600; }

/* ── status bar — the app's footer readout, and this page's whole footer ──── */

.status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding: 11px clamp(14px, 2.4vw, 22px);
  background: var(--bay-void);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}
.status .spacer { flex: 1; }
.status a { color: var(--ink-muted); }
.status a:hover { color: var(--ink-secondary); }
.status .origin { font-size: 13px; line-height: 1; letter-spacing: 0; }
.status .live::before {
  content: "";
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--h);
  margin-right: 7px;
  vertical-align: middle;
}

.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
