/* Product illustrations drawn in HTML and CSS (Vision, Programs).
   Each figure is a size container: everything inside is measured in em, and
   the stage's font-size is a share of the figure's width, so an illustration
   scales as one piece, like an image, and stays sharp at any size.
   The art is decorative markup behind a single role="img" label. */

.fig {
  position: relative;
  margin: 0;
  container-type: inline-size;
}

.fig-stage {
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  letter-spacing: -0.01em;
  line-height: 1.3;
  user-select: none;
}

.fig-stage * {
  box-sizing: border-box;
}

.fig-mono {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0;
}

/* Window chrome shared by the illustrations. */
.fig-window {
  overflow: hidden;
  border-radius: 1em;
  background: #fff;
  box-shadow:
    0 0 0 0.08em rgb(0 0 0 / 9%),
    0 0.3em 0.8em rgb(20 30 70 / 6%),
    0 2.4em 5em -1.6em rgb(20 30 70 / 24%);
}

.fig-bar {
  display: flex;
  align-items: center;
  gap: 0.6em;
  height: 2.8em;
  padding: 0 1.1em;
  border-bottom: 0.08em solid rgb(0 0 0 / 7%);
  background: #f6f6f8;
  color: #6e6e73;
  font-size: 1em;
  font-weight: 500;
}

.fig-bar i {
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
  border-radius: 50%;
  background: #ff5f57;
}

.fig-bar i:nth-child(2) {
  background: #febc2e;
}

.fig-bar i:nth-child(3) {
  margin-right: 0.6em;
  background: #28c840;
}

/* Elements arrive in sequence once the figure scrolls into view. */
.fig .fig-in {
  opacity: 0;
  transform: translateY(1.2em) scale(0.98);
  transition:
    opacity 700ms ease,
    transform 900ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
  transition-delay: calc(var(--i, 0) * 90ms + 150ms);
}

/* Figures sit in (or are) .reveal blocks; site.ts marks them .visible. */
.visible .fig-in {
  opacity: 1;
  transform: none;
}

/* ---------- Device family (Vision hero) ---------- */
.fig-devices {
  margin: 0 0 clamp(64px, 9vw, 120px);
}

.fig-devices .fig-stage {
  height: 52em;
  font-size: 1cqw;
}

.dv-mac {
  position: absolute;
  top: 0;
  left: 0;
  width: 70em;
  height: 46em;
  display: flex;
  flex-direction: column;
}

.dv-body {
  display: grid;
  flex: 1;
  min-height: 0;
  grid-template-columns: 13em minmax(0, 1fr) minmax(0, 1fr);
}

.dv-files {
  display: grid;
  align-content: start;
  gap: 0.35em;
  padding: 1.4em 0.9em;
  border-right: 0.08em solid rgb(0 0 0 / 6%);
  background: #fafafc;
  color: #3a3a3c;
  font-size: 1.05em;
}

.dv-files b {
  margin-bottom: 0.4em;
  padding: 0 0.6em;
  color: #8e8e93;
  font-size: 0.8em;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.dv-files span {
  padding: 0.3em 0.6em;
  border-radius: 0.45em;
}

.dv-files span.on {
  background: rgb(31 95 224 / 12%);
  color: #1f5fe0;
  font-weight: 600;
}

.dv-code {
  display: grid;
  align-content: start;
  gap: 0.28em;
  padding: 1.4em 1.4em;
  overflow: hidden;
  color: #1d1d1f;
  font-size: 1.05em;
  white-space: nowrap;
}

.dv-code div {
  display: flex;
  gap: 1.1em;
}

.dv-code u {
  width: 1.4em;
  flex-shrink: 0;
  color: #b0b0b5;
  text-align: right;
  text-decoration: none;
}

.dv-code .k {
  color: #ad3da4;
}

.dv-code .c {
  color: #8e8e93;
}

.dv-code .s {
  color: #1f5fe0;
}

.dv-code .cursor {
  display: inline-block;
  width: 0.12em;
  height: 1.1em;
  margin-left: 0.05em;
  vertical-align: -0.15em;
  background: #1f5fe0;
  animation: fig-blink 1.1s steps(1) infinite;
}

@keyframes fig-blink {
  50% {
    opacity: 0;
  }
}

.dv-pdf {
  display: grid;
  place-items: start center;
  padding: 1.8em 1.8em 0;
  background: #e9ebf0;
}

/* A typeset page, abstracted: real headings, grey lines for running text. */
.fig-page {
  width: 100%;
  padding: 2em 2.2em;
  background: #fff;
  box-shadow: 0 0.3em 1.2em rgb(20 30 70 / 10%);
}

.fig-page h4 {
  margin: 0 0 0.3em;
  color: #1d1d1f;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 1.45em;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-align: center;
}

.fig-page .by {
  margin-bottom: 1.2em;
  color: #6e6e73;
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: 0.9em;
  text-align: center;
}

.fig-page h5 {
  margin: 1em 0 0.5em;
  color: #1d1d1f;
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: 1em;
  font-weight: 600;
}

.fig-line {
  height: 0.5em;
  margin-bottom: 0.5em;
  border-radius: 0.25em;
  background: #e3e4e8;
}

.fig-line.w9 { width: 92%; }
.fig-line.w8 { width: 80%; }
.fig-line.w6 { width: 60%; }

.fig-eq {
  margin: 0.9em 0;
  color: #1d1d1f;
  font-family: "Iowan Old Style", "Cambria Math", Georgia, serif;
  font-size: 1.15em;
  font-style: italic;
  text-align: center;
}

.fig-chart {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.7em;
  height: 6em;
  margin: 0.9em 0 0.3em;
  padding: 0 1em;
  border-bottom: 0.1em solid #c7c7cc;
}

.fig-chart i {
  width: 1.6em;
  border-radius: 0.2em 0.2em 0 0;
  background: #1f5fe0;
}

.fig-chart i:nth-child(even) {
  background: #9dbcf7;
}

.fig-caption {
  color: #6e6e73;
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: 0.8em;
  text-align: center;
}

.dv-status {
  display: flex;
  align-items: center;
  gap: 1.2em;
  height: 2.3em;
  padding: 0 1.1em;
  background: #1f5fe0;
  color: #fff;
  font-size: 0.95em;
  font-weight: 500;
}

/* Tablet */
.dv-tablet {
  position: absolute;
  right: 7.5em;
  bottom: 0;
  width: 27.5em;
  height: 38em;
  padding: 1em;
  border-radius: 2.6em;
  background: #1d1d1f;
  box-shadow:
    inset 0 0 0 0.15em #3a3a3c,
    0 3em 6em -2em rgb(20 30 70 / 40%);
}

.dv-tablet .screen {
  height: 100%;
  overflow: hidden;
  padding: 1.6em 1.5em;
  border-radius: 1.7em;
  background: #f2f2f7;
}

.dv-tablet .fig-page {
  position: relative;
  font-size: 0.85em;
}

.fig-mark {
  background: linear-gradient(transparent 15%, rgb(255 214 10 / 55%) 15% 85%, transparent 85%);
}

.fig-note {
  position: absolute;
  bottom: 6.6em;
  left: -1.2em;
  width: 15em;
  padding: 0.9em 1em;
  border-radius: 1em;
  background: #fff;
  box-shadow:
    0 0 0 0.08em rgb(0 0 0 / 6%),
    0 1em 2.4em -0.6em rgb(20 30 70 / 30%);
  color: #1d1d1f;
  font-size: 1.05em;
  line-height: 1.35;
}

.fig-note b {
  display: block;
  margin-bottom: 0.2em;
  color: #ff9f0a;
  font-size: 0.85em;
  font-weight: 600;
}

/* Phone */
.dv-phone {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 15.5em;
  height: 32em;
  padding: 0.7em;
  border-radius: 2.8em;
  background: #1d1d1f;
  box-shadow:
    inset 0 0 0 0.15em #3a3a3c,
    0 3em 6em -2em rgb(20 30 70 / 45%);
}

.dv-phone .screen {
  position: relative;
  height: 100%;
  overflow: hidden;
  padding: 3em 1em 1em;
  border-radius: 2.15em;
  background: #f2f2f7;
}

.dv-phone .screen::before {
  position: absolute;
  top: 0.75em;
  left: 50%;
  width: 4.6em;
  height: 1.35em;
  border-radius: 1em;
  background: #1d1d1f;
  content: "";
  transform: translateX(-50%);
}

.ph-title {
  margin-bottom: 0.8em;
  color: #1d1d1f;
  font-size: 1.9em;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ph-group {
  overflow: hidden;
  border-radius: 0.9em;
  background: #fff;
}

.ph-row {
  display: flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.75em 0.8em;
  color: #1d1d1f;
  font-size: 1em;
}

.ph-row + .ph-row {
  border-top: 0.08em solid rgb(0 0 0 / 7%);
}

.ph-check {
  display: grid;
  width: 1.4em;
  height: 1.4em;
  flex-shrink: 0;
  place-items: center;
  border: 0.12em solid #c7c7cc;
  border-radius: 50%;
}

.ph-check.done {
  border-color: #30d158;
  background: #30d158;
}

.ph-check.done::after {
  width: 0.35em;
  height: 0.6em;
  margin-top: -0.12em;
  border: solid #fff;
  border-width: 0 0.14em 0.14em 0;
  content: "";
  transform: rotate(45deg);
}

.ph-row s {
  color: #8e8e93;
  text-decoration: none;
}

.ph-pill {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-top: 0.9em;
  padding: 0.7em 0.9em;
  border-radius: 0.9em;
  background: #fff;
  color: #1d1d1f;
  font-size: 0.95em;
}

.ph-pill::before {
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  background: #30d158;
  content: "";
}

.fig-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 28px;
  margin-top: clamp(18px, 2.4vw, 28px);
  color: var(--lx-soft, #5d6470);
  font-size: 14px;
}

.fig-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.fig-legend span::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1f5fe0;
  content: "";
}

.fig-legend span.later::before {
  border: 1.5px solid #9aa0ab;
  background: none;
}

/* ---------- Tiles (principles, programs) ---------- */
.fig-tile {
  overflow: hidden;
  border-radius: 22px;
  background: var(--tile, #f2f4f8);
}

.fig-tile .fig-stage {
  display: grid;
  align-content: center;
  height: 24em;
  padding: 2.4em;
  font-size: 3cqw;
}

.tile-blue { --tile: linear-gradient(160deg, #edf3ff, #f7f9fe); }
.tile-orange { --tile: linear-gradient(160deg, #fff2e6, #fff9f3); }
.tile-purple { --tile: linear-gradient(160deg, #f2edff, #faf8ff); }
.tile-green { --tile: linear-gradient(160deg, #e8f8ef, #f6fcf8); }
.tile-red { --tile: linear-gradient(160deg, #fdecee, #fff8f8); }

/* Local folder */
.fd-window {
  font-size: 1.15em;
}

.fd-list {
  display: grid;
  margin: 0;
  padding: 0.5em;
  list-style: none;
}

.fd-list li {
  display: flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.55em 0.6em;
  border-radius: 0.5em;
  color: #1d1d1f;
  font-size: 0.95em;
}

.fd-list li.on {
  background: #1f5fe0;
  color: #fff;
}

.fd-list li em {
  margin-left: auto;
  color: #8e8e93;
  font-size: 0.85em;
  font-style: normal;
}

.fd-list li.on em {
  color: rgb(255 255 255 / 75%);
}

.fd-ic {
  width: 1.2em;
  height: 1.45em;
  flex-shrink: 0;
  border-radius: 0.15em;
  background: #fff;
  box-shadow: inset 0 0 0 0.08em #c7c7cc;
}

.fd-ic.folder {
  height: 1em;
  width: 1.35em;
  background: #5ea8ff;
  box-shadow: none;
}

.fd-ic.tex { box-shadow: inset 0 -0.35em 0 #1f5fe0, inset 0 0 0 0.08em #c7c7cc; }
.fd-ic.bib { box-shadow: inset 0 -0.35em 0 #ff9f0a, inset 0 0 0 0.08em #c7c7cc; }
.fd-ic.pdf { box-shadow: inset 0 -0.35em 0 #ff453a, inset 0 0 0 0.08em #c7c7cc; }

.fig-chip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.6em 1em;
  border-radius: 999px;
  background: #fff;
  box-shadow:
    0 0 0 0.06em rgb(0 0 0 / 6%),
    0 0.8em 2em -0.5em rgb(20 30 70 / 28%);
  color: #1d1d1f;
  font-size: 1em;
  font-weight: 600;
  white-space: nowrap;
}

.fig-chip svg {
  width: 1.1em;
  height: 1.1em;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.fig-chip.green { color: #0d8a55; }
.fig-chip.blue { color: #1f5fe0; }
.fig-chip.purple { color: #7536ef; }

/* Workflow checklist */
.wf-list {
  position: relative;
  display: grid;
  gap: 0.75em;
  margin: 0;
  padding: 0;
  list-style: none;
}

.wf-list::before {
  position: absolute;
  top: 1.2em;
  bottom: 1.2em;
  left: 1.2em;
  width: 0.12em;
  background: #e3c8ae;
  content: "";
}

.wf-list li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.9em;
  padding: 0.55em 0.9em 0.55em 0.55em;
  border-radius: 1.4em;
  background: #fff;
  box-shadow: 0 0.4em 1.2em -0.4em rgb(120 60 10 / 18%);
}

.wf-dot {
  display: grid;
  width: 1.6em;
  height: 1.6em;
  flex-shrink: 0;
  place-items: center;
  border-radius: 50%;
  background: #30d158;
  color: #fff;
}

.wf-dot svg {
  width: 0.95em;
  height: 0.95em;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.wf-list li.next .wf-dot {
  background: #ff9f0a;
}

.wf-list b {
  color: #1d1d1f;
  font-size: 1em;
  font-weight: 600;
}

.wf-list small {
  margin-left: auto;
  color: #8e8e93;
  font-size: 0.85em;
  white-space: nowrap;
}

/* Community orbit */
.orbit {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.orbit-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border: 0.1em dashed rgb(117 54 239 / 28%);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.orbit-ring.r1 { width: 13em; height: 13em; }
.orbit-ring.r2 { width: 19em; height: 19em; }

.orbit-core {
  position: relative;
  width: 5.2em;
  height: 5.2em;
  padding: 0.6em;
  border-radius: 1.3em;
  background: #fff;
  box-shadow: 0 1em 2.4em -0.6em rgb(80 40 160 / 35%);
}

.orbit-core img {
  width: 100%;
  height: 100%;
}

.av {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 2.8em;
  height: 2.8em;
  place-items: center;
  margin: -1.4em 0 0 -1.4em;
  border: 0.18em solid #fff;
  border-radius: 50%;
  color: #fff;
  font-size: 1em;
  font-weight: 700;
  box-shadow: 0 0.5em 1.2em -0.3em rgb(20 30 70 / 30%);
  transform: rotate(var(--a)) translateX(var(--r)) rotate(calc(-1 * var(--a)));
}

.av.a1 { background: #ff9f0a; }
.av.a2 { background: #30b0c7; }
.av.a3 { background: #ff375f; }
.av.a4 { background: #5e5ce6; }
.av.a5 { background: #34c759; }
.av.a6 { background: #1f5fe0; }

/* Compile toast and mini editor (Programs 01) */
.mini-app {
  display: flex;
  height: 100%;
  flex-direction: column;
  font-size: 1em;
}

.mini-body {
  display: grid;
  flex: 1;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.mini-body .dv-code {
  padding: 1em;
  font-size: 0.8em;
}

.mini-body .dv-pdf {
  padding: 1em 1em 0;
}

.mini-body .fig-page {
  padding: 1.1em 1.2em;
  font-size: 0.6em;
}

.fig-toast {
  bottom: 1.6em;
  left: 50%;
  transform: translateX(-50%);
}

.fig .fig-toast.fig-in {
  transform: translate(-50%, 1em);
}

.visible .fig-toast.fig-in {
  transform: translate(-50%, 0);
}

/* Error explained (Programs 02) */
.err-card {
  padding: 1.1em 1.2em;
  border-radius: 1em;
  background: #fff;
  box-shadow:
    0 0 0 0.06em rgb(0 0 0 / 6%),
    0 0.8em 2em -0.8em rgb(120 20 30 / 25%);
  font-size: 1em;
}

.err-card + .err-card {
  margin-top: 1em;
}

.err-head {
  display: flex;
  align-items: center;
  gap: 0.6em;
  color: #1d1d1f;
  font-weight: 600;
}

.err-head::before {
  width: 0.7em;
  height: 0.7em;
  border-radius: 50%;
  background: var(--dot, #ff453a);
  content: "";
}

.err-card.fix {
  --dot: #30d158;
}

.err-card code {
  display: block;
  margin-top: 0.6em;
  padding: 0.5em 0.7em;
  border-radius: 0.5em;
  background: #f5f5f7;
  color: #1d1d1f;
  font-size: 0.9em;
}

.err-card code .k {
  color: #ad3da4;
}

.err-card p {
  margin: 0.5em 0 0 !important;
  color: #6e6e73 !important;
  font-size: 0.92em !important;
  line-height: 1.4 !important;
}

.err-btn {
  display: inline-block;
  margin-top: 0.8em;
  padding: 0.45em 1em;
  border-radius: 999px;
  background: #1f5fe0;
  color: #fff;
  font-size: 0.9em;
  font-weight: 600;
}

/* Review conversation (Programs 03) */
.rv-msg {
  max-width: 80%;
  padding: 0.8em 1em;
  border-radius: 1.2em;
  font-size: 1em;
  line-height: 1.35;
}

.rv-msg b {
  display: block;
  margin-bottom: 0.15em;
  font-size: 0.8em;
  font-weight: 600;
  opacity: 0.75;
}

.rv-msg.them {
  border-bottom-left-radius: 0.35em;
  background: #fff;
  color: #1d1d1f;
  box-shadow: 0 0.4em 1.2em -0.4em rgb(20 30 70 / 18%);
}

.rv-msg.us {
  margin: 0.8em 0 0 auto;
  border-bottom-right-radius: 0.35em;
  background: #1f5fe0;
  color: #fff;
}

.rv-progress {
  margin-top: 1.4em;
  padding: 0.9em 1em;
  border-radius: 1em;
  background: #fff;
  box-shadow: 0 0.4em 1.2em -0.4em rgb(20 30 70 / 18%);
  color: #1d1d1f;
  font-size: 0.95em;
}

.rv-progress div {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

.rv-progress div span {
  color: #8e8e93;
  font-weight: 500;
}

.rv-progress i {
  display: block;
  height: 0.5em;
  margin-top: 0.6em;
  border-radius: 999px;
  background: linear-gradient(90deg, #30d158 86%, #e5e5ea 86%);
}

/* Commit graph (Programs 04): avatars are the commits, sitting on the main
   line (green) or on a pull-request branch (purple) that merges back. */
.git-log {
  position: relative;
  display: grid;
  gap: 1.1em;
  margin: 0;
  padding: 0;
  list-style: none;
}

.git-log::before {
  position: absolute;
  top: 1em;
  bottom: 1em;
  left: 1.25em;
  width: 0.2em;
  border-radius: 0.1em;
  background: #34c759;
  content: "";
}

.git-log li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.8em;
  color: #1d1d1f;
  font-size: 1.05em;
  font-weight: 500;
  white-space: nowrap;
}

.git-log li.branch {
  padding-left: 2.6em;
}

/* The branch line runs between the two branch commits and joins main. */
.git-log li.branch::before {
  position: absolute;
  top: -1.1em;
  bottom: -1.1em;
  left: 3.6em;
  width: 0.2em;
  background: #af82ff;
  content: "";
}

.git-log li.branch + li:not(.branch)::after,
.git-log li:first-child + li.branch::after {
  position: absolute;
  left: 1.35em;
  width: 2.45em;
  height: 1.2em;
  border: 0.2em solid #af82ff;
  content: "";
}

.git-log li:first-child + li.branch::after {
  top: -1.6em;
  border-width: 0 0 0.2em 0.2em;
  border-bottom-left-radius: 1em;
  transform: scaleY(-1);
}

.git-log li.branch + li:not(.branch)::after {
  top: -1.55em;
  border-width: 0 0 0.2em 0.2em;
  border-bottom-left-radius: 1em;
  transform: scaleY(-1);
}

.git-log .av {
  position: relative;
  inset: auto;
  z-index: 1;
  width: 2.5em;
  height: 2.5em;
  margin: 0;
  border-width: 0.18em;
  font-size: 0.85em;
  transform: none;
}

.git-log s {
  margin-left: auto;
  padding: 0.15em 0.6em;
  border-radius: 999px;
  background: rgb(0 0 0 / 5%);
  color: #6e6e73;
  font-size: 0.8em;
  text-decoration: none;
}

/* ---------- Placement on pages ---------- */

/* Principles: an illustration above each principle. */
.lx-principles .fig-tile {
  margin-bottom: 10px;
}

.lx-principles article:has(.fig-tile) {
  padding-top: 0;
  border-top: 0;
}

/* Programs: the illustration fills the space under each heading. */
.lx-row.has-fig h2 {
  grid-column: 2;
}

.lx-row.has-fig .fig-tile {
  grid-column: 2;
  align-self: start;
}

.lx-row.has-fig .lx-row-body {
  grid-column: 3;
  grid-row: 1 / span 2;
}

@media (max-width: 820px) {
  .lx-row.has-fig h2,
  .lx-row.has-fig .fig-tile,
  .lx-row.has-fig .lx-row-body {
    grid-column: 1;
    grid-row: auto;
  }
}

@media (max-width: 560px) {
  /* On phones the device family shows the desktop app on its own, larger. */
  .fig-devices .fig-stage {
    height: 46em;
  }

  .fig-devices .dv-mac {
    width: 100em;
    height: 62em;
    font-size: 0.74em;
  }

  .fig-devices .dv-tablet,
  .fig-devices .dv-phone {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fig .fig-in {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .fig .fig-toast.fig-in {
    transform: translateX(-50%);
  }

  .dv-code .cursor {
    animation: none;
  }
}
