/* Dark, like a page before it's typeset. Headings in Latin Modern, the face of the papers people
   write here; body in the Mac's own sans. Vermilion marks edits, green marks a compiled PDF. */

@font-face {
  font-family: "Latin Modern Roman";
  src: url("fonts/lmroman10-regular.otf") format("opentype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Latin Modern Roman";
  src: url("fonts/lmroman10-bold.otf") format("opentype");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Latin Modern Math";
  src: url("fonts/latinmodern-math.otf") format("opentype");
  font-display: block;
}

:root {
  --bg: #0b0b0a;
  --surface: #131311;
  --surface-2: #1a1a17;
  --rule: #262622;
  --text: #f1efe8;
  --muted: #8f8c83;
  --dim: #55534d;
  --accent: #ff5b3a;
  --accent-soft: rgba(255, 91, 58, 0.14);
  --ok: #58d08a;
  --ok-soft: rgba(88, 208, 138, 0.14);
  --marker: #f3d36b;
  --serif: "Latin Modern Roman", "Computer Modern Serif", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

a {
  color: inherit;
}

.grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
  opacity: 0.07;
  mix-blend-mode: overlay;
}

h1,
h2 {
  font-family: var(--serif);
  font-weight: 400;
  margin: 0;
}

h2 {
  font-size: clamp(38px, 5vw, 72px);
  line-height: 1.02;
  margin-bottom: 32px;
}

p {
  margin: 0 0 16px;
  max-width: 62ch;
}

code {
  font: 0.86em var(--mono);
  color: var(--text);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
}

em {
  font-style: italic;
}

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

/* Buttons */

.button,
button {
  font: 15px/1 var(--sans);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 12px 20px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.25s var(--ease), background 0.2s, border-color 0.2s, color 0.2s;
}

.button:hover,
button:hover {
  border-color: var(--muted);
  background: var(--surface-2);
}

.button:active,
button:active {
  transform: scale(0.97);
}

.button.light,
button.light {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.button.light:hover,
button.light:hover {
  background: #fff;
}

button.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

/* Nav */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 16px clamp(20px, 4vw, 48px);
  transition: background 0.3s, border-color 0.3s;
  border-bottom: 1px solid transparent;
}

.nav.scrolled {
  background: rgba(11, 11, 10, 0.72);
  backdrop-filter: blur(14px) saturate(1.4);
  border-color: var(--rule);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.nav nav {
  display: flex;
  gap: 26px;
  margin-left: auto;
  font-size: 15px;
}

.nav nav a {
  text-decoration: none;
  color: var(--muted);
  transition: color 0.2s;
}

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

.nav .button {
  padding: 9px 16px;
  font-size: 14px;
}

.nav nav + .star {
  margin-left: 4px;
}

/* Hero */

.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: center;
  padding: 120px clamp(20px, 5vw, 64px) 80px;
  overflow: hidden;
  cursor: crosshair;
}

.field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 45%, #000 40%, transparent 100%);
}

.hero-inner {
  position: relative;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  pointer-events: none;
}

.hero-inner a,
.hero-inner button {
  pointer-events: auto;
}

/* The headline arrives as LaTeX source, then compiles into type. */
.compile-title {
  position: relative;
  font-size: clamp(44px, 6.4vw, 100px);
  line-height: 0.96;
  margin-bottom: 36px;
  text-shadow: 0 0 22px var(--bg), 0 0 8px var(--bg);
}

.compile-title .src {
  position: absolute;
  inset: 0;
  font: clamp(14px, 1.6vw, 22px) / 1.6 var(--mono);
  color: var(--muted);
  transition: opacity 0.5s var(--ease), filter 0.5s var(--ease), transform 0.6s var(--ease);
}

.compile-title .out > span,
.compile-title .out em > span {
  display: inline-block;
  opacity: 0;
  filter: blur(14px);
  transform: translateY(0.18em);
  transition: opacity 0.7s var(--ease), filter 0.7s var(--ease), transform 0.9s var(--ease),
    text-decoration-color 0.8s var(--ease) 0.9s;
}

.compile-title em {
  font-style: italic;
}

/* Each word carries its own underline: decorations don't reach into inline-block children. */
.compile-title em > span {
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.12em;
  text-decoration-color: transparent;
}

.compile-title.compiled .src {
  opacity: 0;
  filter: blur(8px);
  transform: translateY(-0.6em);
}

.compile-title.compiled .out span {
  opacity: 1;
  filter: none;
  transform: none;
}

.compile-title.compiled em > span {
  text-decoration-color: var(--accent);
}

.lede {
  font-size: clamp(17px, 1.5vw, 20px);
  color: #cfccc3;
  max-width: 46ch;
  text-shadow: 0 0 14px var(--bg), 0 0 6px var(--bg);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 30px 0 18px;
}

/* The app, rising out of perspective as you scroll. */

.stage {
  position: relative;
  overflow-x: clip;
  padding: 0 clamp(16px, 4vw, 48px);
  perspective: 1400px;
  margin-top: -6vh;
}

.tilt {
  max-width: 1320px;
  margin: 0 auto;
  transform-origin: 50% 0%;
  transform: rotateX(calc(var(--tilt, 1) * 24deg)) scale(calc(1 - var(--tilt, 1) * 0.08));
  opacity: calc(1 - var(--tilt, 1) * 0.5);
  will-change: transform;
}

.tilt img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 60px 140px -40px rgba(0, 0, 0, 0.9), 0 0 120px -30px rgba(255, 91, 58, 0.12);
}

.requirements {
  text-align: center;
  margin: 28px auto 0;
  font-size: 13px;
  color: var(--dim);
  max-width: none;
}

/* Editing */

.editing {
  height: 360vh;
  margin-top: 120px;
  padding: 0 clamp(16px, 5vw, 64px);
}

.editing-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  padding-top: 40px;
}

.editing-copy {
  text-align: center;
}

.editing h2 {
  font-size: clamp(32px, 3.6vw, 48px);
  margin-bottom: 14px;
}

.editing-copy p {
  margin: 0 auto;
  max-width: 44ch;
  color: #cfccc3;
}

.demo-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  counter-reset: s;
}

.demo-steps li {
  counter-increment: s;
  font-size: 13px;
  color: var(--dim);
  padding-top: 10px;
  border-top: 2px solid var(--rule);
  cursor: pointer;
  transition: color 0.3s, border-color 0.3s;
}

.demo-steps li::before {
  content: counter(s) "  ";
  font-family: var(--mono);
}

.demo-steps li.done {
  color: var(--text);
  border-color: var(--text);
}

.demo-steps li:last-child.done {
  border-color: var(--accent);
}

.editing-copy p {
  color: #cfccc3;
}

/* Keycaps sized to the heading's x-height and sat on its baseline. */
.keys {
  display: inline-flex;
  gap: 0.12em;
  margin-left: 0.1em;
  white-space: nowrap;
  vertical-align: baseline;
}

.key {
  display: inline-block;
  min-width: 1.15em;
  padding: 0.14em 0.2em 0.1em;
  font: 500 0.48em/1 var(--sans);
  text-align: center;
  color: var(--text);
  background: linear-gradient(#26261f, #18181500);
  background-color: #1a1a17;
  border: 1px solid #3a3933;
  border-radius: 0.22em;
  box-shadow: 0 0.12em 0 #050504, inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transform: translateY(-0.12em);
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}

.keys.pressed .key {
  transform: translateY(-0.04em);
  box-shadow: 0 0.02em 0 #050504;
  border-color: var(--accent);
}

.demo {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 0 0 1px var(--rule), 0 40px 100px -40px rgba(0, 0, 0, 0.8);
  padding: 0 0 20px;
}

.demo-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
  color: var(--muted);
}

.demo-model {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
}

.demo-model i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

.demo-text {
  font: 15px/1.8 var(--mono);
  padding: 22px 24px 4px;
  margin: 0;
  max-width: none;
  /* Room for the longest state (the diff) so the box doesn't jump between steps. */
  min-height: calc(5 * 1.8em + 26px);
  color: #dedbd2;
}

.demo-text .cmd {
  color: var(--accent);
}

.demo-text .arg {
  color: #9fbbe6;
}

.demo-text mark.sel {
  background: rgba(255, 91, 58, 0.16);
  color: inherit;
}

.demo-text del {
  color: var(--accent);
  text-decoration: none;
  background: linear-gradient(var(--accent), var(--accent)) 0 55% / 0% 1.5px no-repeat;
  animation: strike 0.5s var(--ease) forwards;
}

@keyframes strike {
  to {
    background-size: 100% 1.5px;
  }
}

.demo-text ins {
  text-decoration: none;
  background: var(--ok-soft);
  color: #c6f0d6;
  border-radius: 2px;
  animation: settle 0.5s var(--ease) both 0.25s;
}

@keyframes settle {
  from {
    opacity: 0;
    filter: blur(6px);
  }
}

.demo-text .streaming {
  color: var(--muted);
}

.demo-status {
  font-size: 14px;
  color: var(--muted);
  padding: 0 24px;
  margin: 12px 0 0;
  max-width: none;
}

.demo-status.running::after {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 1em;
  margin-left: 4px;
  vertical-align: -0.15em;
  background: var(--accent);
  animation: blink 0.9s steps(1) infinite;
}

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

.demo-status.held {
  color: var(--accent);
}

.demo-status.ok {
  color: var(--ok);
}

.demo-review,
.demo-actions {
  display: flex;
  gap: 8px;
  padding: 16px 24px 0;
}

.demo-review button,
.demo-actions button {
  font-size: 14px;
  padding: 9px 16px;
}

.tex {
  font: 19px/1.7 var(--mono);
  color: #dedbd2;
  background: var(--surface-2);
  border-radius: 10px;
  overflow-x: auto;
}

.tex .cmd {
  color: var(--accent);
}

.ink-eq {
  font: italic 42px/1.2 "Bradley Hand", "Noteworthy", "Segoe Print", cursive;
  color: #e9e4d6;
  border-radius: 10px;
  background: #1e2a24;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.5);
  transform: rotate(-1.5deg);
  display: flex;
  align-items: center;
  gap: 12px;
}

.ink-eq sub {
  font-size: 0.5em;
}

.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.7em;
  line-height: 1.15;
}

.frac span:first-child {
  border-bottom: 2px solid currentColor;
  padding: 0 6px 2px;
}

/* Questions */

.questions {
  max-width: 880px;
  margin: 170px auto 0;
  padding: 0 clamp(20px, 5vw, 64px);
}

details {
  border-top: 1px solid var(--rule);
}

details:last-child {
  border-bottom: 1px solid var(--rule);
}

summary {
  cursor: pointer;
  list-style: none;
  padding: 22px 40px 22px 0;
  font-size: 19px;
  position: relative;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font: 26px var(--serif);
  color: var(--muted);
  transition: transform 0.3s var(--ease);
}

details[open] summary::after {
  transform: translateY(-50%) rotate(45deg);
}

details p {
  color: var(--muted);
  padding-bottom: 20px;
}

/* End */

.end {
  text-align: center;
  margin: 120px auto 0;
  padding: 0 24px;
}

.end h2 {
  font-size: clamp(56px, 9vw, 140px);
  margin-bottom: 40px;
}

.therefore {
  color: var(--accent);
  font-family: "Latin Modern Math", var(--serif);
}

footer {
  display: flex;
  gap: 24px;
  align-items: center;
  max-width: 1180px;
  margin: 160px auto 0;
  padding: 28px clamp(20px, 5vw, 64px) 48px;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  color: var(--muted);
}

footer .logo {
  color: var(--text);
  margin-right: auto;
}

/* Reveal on scroll */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  filter: blur(6px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease), filter 0.9s var(--ease);
  transition-delay: var(--delay, 0s);
}

.reveal.in {
  opacity: 1;
  transform: none;
  filter: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .compile-title .out span {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    transition: none !important;
  }
  .compile-title .src {
    display: none;
  }
  .tilt {
    transform: none;
    opacity: 1;
  }
}

@media (max-width: 860px) {
  .nav nav {
    display: none;
  }
  .nav .button {
    margin-left: auto;
  }
  .editing {
    grid-template-columns: 1fr;
  }
}

/* Star button */

.star {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
  transition: color 0.2s, background 0.2s;
}

.star:hover {
  color: var(--marker);
  background: var(--surface-2);
}

.stars {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  margin-left: 2px;
}

h3 {
  font-family: var(--serif);
  font-weight: 400;
  margin: 0 0 8px;
}

/* Familiar */

.familiar {
  max-width: 1180px;
  margin: 180px auto 0;
  padding: 0 clamp(20px, 5vw, 64px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: center;
}

.same {
  list-style: none;
  margin: 0;
  padding: 0;
}

.same li {
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  color: #cfccc3;
}

.same b {
  color: var(--text);
  font-weight: 600;
}

/* Coming soon */

.soon {
  max-width: 1180px;
  margin: 170px auto 0;
  padding: 0 clamp(20px, 5vw, 64px);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 820px;
}

.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 24px;
  align-items: start;
  padding: 0 0 30px 26px;
  --row: 32px;
}

/* A thin rail with a dot per step; the next step is vermilion. */
.timeline li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: calc(var(--row) / 2);
  bottom: calc(var(--row) / -2);
  width: 1px;
  background: var(--rule);
}

.timeline li:last-child::before {
  display: none;
}

.timeline li::after {
  content: "";
  position: absolute;
  left: 0;
  top: calc(var(--row) / 2 - 4.5px);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: inset 0 0 0 1.5px var(--muted);
}

.timeline li:first-child::after {
  background: var(--accent);
  box-shadow: none;
}

.timeline .when {
  font-size: 14px;
  line-height: var(--row);
  color: var(--muted);
}

.timeline li:first-child .when {
  color: var(--accent);
}

.timeline p {
  margin: 0;
  font: 23px/32px var(--serif);
  color: var(--text);
}

.soon > .note {
  margin-top: 28px;
}

/* Why */

.why {
  max-width: 1180px;
  margin: 170px auto 0;
  padding: 0 clamp(20px, 5vw, 64px);
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(32px, 6vw, 96px);
}

.letter p {
  font: 21px/1.6 var(--serif);
  color: #dedbd2;
  max-width: 34em;
}

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

@media (max-width: 860px) {
  .story,
  .familiar,
  .why {
    grid-template-columns: 1fr;
  }
  .familiar h2 {
    position: static;
  }
  .nav .star {
    margin-left: auto;
  }
  .nav .star + .button {
    margin-left: 0;
  }
}

/* Features: the section pins for a few screens while scrolling steps through the points. */

.different {
  max-width: 1180px;
  margin: 120px auto 0;
  padding: 0 clamp(20px, 5vw, 64px);
  height: 420vh;
}

.pin {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 44px;
}

.different h2 {
  margin: 0;
}

.story {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
}

.claims {
  list-style: none;
  margin: 0;
  padding: 0;
}

.claims > li {
  position: relative;
  padding: 18px 0 20px;
  border-top: 1px solid var(--rule);
  cursor: pointer;
}

.claims > li:last-child {
  border-bottom: 1px solid var(--rule);
}

.claims h3 {
  font-size: clamp(24px, 2.4vw, 32px);
  line-height: 1.15;
  margin: 0;
  color: var(--dim);
  transition: color 0.35s var(--ease);
}

.claims > li:hover h3 {
  color: var(--muted);
}

.claims > li.active h3 {
  color: var(--text);
}

.claims > li > p {
  color: #cfccc3;
  margin: 0;
  font-size: 16px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.45s var(--ease), opacity 0.35s var(--ease), margin 0.45s var(--ease);
}

.claims > li.active > p {
  max-height: 4em;
  opacity: 1;
  margin-top: 8px;
}

/* Progress through the active point, drawn along its top rule. */
.tick {
  position: absolute;
  left: 0;
  top: -1px;
  height: 1px;
  width: 0;
  background: var(--accent);
}

.claims > li.active .tick {
  width: calc(var(--step, 0) * 100%);
}

.panel {
  position: relative;
  height: 360px;
  border-radius: 16px;
  background: radial-gradient(120% 90% at 80% 0%, #1d1c19, var(--surface) 60%);
  box-shadow: 0 0 0 1px var(--rule), 0 50px 120px -50px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.scene {
  position: absolute;
  inset: 0;
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.5s var(--ease), transform 0.6s var(--ease);
  pointer-events: none;
}

.panel[data-active="0"] .s0,
.panel[data-active="1"] .s1,
.panel[data-active="2"] .s2,
.panel[data-active="3"] .s3,
.panel[data-active="4"] .s4 {
  opacity: 1;
  transform: none;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: 1px;
}

.dot.ok {
  background: var(--ok);
  box-shadow: 0 0 0 4px var(--ok-soft);
}

/* Scene 0: the on-device model answers */
.chip-row {
  font-size: 13px;
  color: var(--muted);
}

.bubble {
  align-self: flex-end;
  background: var(--surface-2);
  border-radius: 14px 14px 4px 14px;
  padding: 10px 14px;
  font-size: 15px;
}

.reply {
  font: 14px/1.7 var(--mono);
  color: #dedbd2;
  max-width: 30em;
}

.reply {
  min-height: 5.1em;
}

.meter {
  display: grid;
  grid-template-columns: repeat(3, auto 1fr);
  gap: 6px 10px;
  margin-top: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--muted);
}

.meter b {
  font-weight: 600;
  color: var(--ok);
}

/* Scene 2: a dropped citation is caught */
.edit-line {
  font: 15px/1.6 var(--mono);
  margin: 0;
  color: #dedbd2;
}

.edit-line .cite {
  color: var(--accent);
  border-radius: 4px;
  transition: background 0.3s;
}

.edit-line.out {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--accent);
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.4s var(--ease) 0.6s, transform 0.5s var(--ease) 0.6s;
}

.verdict {
  font-size: 15px;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.4s var(--ease) 1.3s;
}

.panel[data-active="2"] .edit-line .cite {
  background: var(--accent-soft);
  outline: 1px solid var(--accent);
  outline-offset: 2px;
  transition-delay: 1.3s;
}

.panel[data-active="2"] .edit-line.out,
.panel[data-active="2"] .verdict {
  opacity: 1;
  transform: none;
}

/* Scene 3: TeX installs itself */
.install-label {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.bar {
  height: 6px;
  border-radius: 6px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ok);
  border-radius: 6px;
}

.panel[data-active="3"] .bar i {
  animation: fill 2.2s var(--ease) 0.2s forwards;
}

@keyframes fill {
  to {
    width: 100%;
  }
}

.pkgs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pkgs li {
  font: 12px var(--mono);
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--dim);
  transition: color 0.3s, background 0.3s;
}

.panel[data-active="3"] .pkgs li {
  color: var(--ok);
  background: var(--ok-soft);
}

.panel[data-active="3"] .pkgs li:nth-child(1) { transition-delay: 0.3s; }
.panel[data-active="3"] .pkgs li:nth-child(2) { transition-delay: 0.55s; }
.panel[data-active="3"] .pkgs li:nth-child(3) { transition-delay: 0.8s; }
.panel[data-active="3"] .pkgs li:nth-child(4) { transition-delay: 1.05s; }
.panel[data-active="3"] .pkgs li:nth-child(5) { transition-delay: 1.3s; }
.panel[data-active="3"] .pkgs li:nth-child(6) { transition-delay: 1.55s; }
.panel[data-active="3"] .pkgs li:nth-child(7) { transition-delay: 1.8s; }
.panel[data-active="3"] .pkgs li:nth-child(8) { transition-delay: 2.05s; }

.install-done {
  margin: 0;
  font-size: 15px;
  color: var(--ok);
  opacity: 0;
  transition: opacity 0.4s 2.4s;
}

.panel[data-active="3"] .install-done {
  opacity: 1;
}

/* Switching: a zip slides into the app and unpacks, tied to scroll */

.familiar .deadline {
  color: var(--muted);
}

.familiar .deadline b {
  color: var(--accent);
  font-weight: 500;
}

.same {
  margin-top: 28px !important;
}

.drop {
  position: relative;
  padding-top: 110px;
}

.window {
  position: relative;
  height: 320px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--rule), 0 40px 100px -40px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.win-bar {
  display: flex;
  align-items: center;
  padding: 0 14px;
  height: 34px;
  flex: none;
  border-bottom: 1px solid var(--rule);
  font-size: 12px;
  font-weight: 600;
}

.win-body {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-columns: 38% 1fr;
}

/* The drop plays as a short timed sequence each time it comes into view (.play). */
.target {
  position: absolute;
  inset: 18px;
  border: 2px dashed var(--dim);
  border-radius: 10px;
  display: grid;
  place-items: end center;
  padding-bottom: 28px;
  font-size: 15px;
  color: var(--muted);
  background: var(--surface);
  z-index: 1;
}

.zip {
  position: absolute;
  left: 50%;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font: 13px var(--mono);
  color: var(--text);
  z-index: 2;
  transform: translate(-280%, -10px) rotate(-10deg);
  opacity: 0;
}

.zip svg:first-child {
  width: 60px;
  height: 76px;
  fill: #2a2925;
  stroke: var(--text);
  stroke-width: 1.2;
}

.cursor {
  position: absolute;
  right: -18px;
  bottom: 14px;
  width: 18px;
  height: 24px;
  fill: #fff;
  stroke: #000;
  stroke-width: 1;
}

.replay {
  position: absolute;
  right: 0;
  bottom: -46px;
  font-size: 13px;
  padding: 6px 12px;
  color: var(--muted);
}

.drop.play .zip {
  animation: zip-in 1.3s var(--ease) forwards;
}

.drop.play .target {
  animation: target 1.3s var(--ease) forwards;
}

.drop.play .tree li,
.drop.play .win-pdf {
  animation: unpack 0.5s var(--ease) both;
}

.drop.play .tree li:nth-child(1) { animation-delay: 1s; }
.drop.play .tree li:nth-child(2) { animation-delay: 1.05s; }
.drop.play .tree li:nth-child(3) { animation-delay: 1.1s; }
.drop.play .tree li:nth-child(4) { animation-delay: 1.15s; }
.drop.play .tree li:nth-child(5) { animation-delay: 1.2s; }
.drop.play .win-pdf { animation-delay: 1.25s; }

@keyframes zip-in {
  0% { opacity: 0; transform: translate(-280%, -10px) rotate(-10deg); }
  10% { opacity: 1; }
  45% { opacity: 1; transform: translate(-50%, 150px) rotate(0deg) scale(1.05); }
  62% { opacity: 1; transform: translate(-50%, 185px) scale(0.9); }
  78% { opacity: 0; transform: translate(-50%, 200px) scale(0.5); }
  100% { opacity: 0; transform: translate(-50%, 200px) scale(0.5); }
}

@keyframes target {
  0%, 30% { border-color: var(--dim); background: var(--surface); color: var(--muted); opacity: 1; }
  45%, 65% { border-color: var(--accent); background: #2a1712; color: var(--text); opacity: 1; }
  80%, 100% { opacity: 0; border-color: var(--accent); }
}

@keyframes unpack {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.tree {
  list-style: none;
  margin: 0;
  padding: 14px;
  border-right: 1px solid var(--rule);
  font: 12px/2 var(--mono);
  color: var(--muted);
}

.tree li {
  opacity: 0;
}

.tree li.main {
  color: var(--text);
}

.win-pdf {
  margin: 14px;
  border-radius: 4px;
  background: #f4f2ec;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  opacity: 0;
}

.win-pdf i {
  height: 5px;
  border-radius: 3px;
  background: #c9c5bb;
}

.win-pdf i:first-child {
  width: 60%;
  height: 8px;
  align-self: center;
  background: #8f8a80;
  margin-bottom: 8px;
}

.win-pdf i:last-child {
  width: 70%;
}

/* Scanning line over the photo */

.ink-eq {
  position: relative;
  overflow: hidden;
}

.ink-eq::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 40%;
  background: linear-gradient(transparent, rgba(255, 91, 58, 0.28) 85%, var(--accent) 100%);
  transform: translateY(-110%);
}

@keyframes scan {
  to {
    transform: translateY(260%);
  }
}

@keyframes reveal-tex {
  to {
    clip-path: inset(0 0 0 0);
  }
}

/* Why: words brighten as you read down */

.letter .w {
  color: #4a4843;
  transition: color 0.25s;
}

.letter .w.lit {
  color: #e9e6dd;
}

/* End */

.end {
  position: relative;
  padding: 120px 24px 140px;
  overflow: hidden;
  cursor: crosshair;
}

.end h2,
.end .end-actions {
  position: relative;
}

.end-field {
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, #000 30%, transparent 100%);
}

@media (max-width: 860px) {
  .panel {
    position: relative;
    top: 0;
    height: 380px;
    order: -1;
  }
  .claims {
    padding: 0;
  }
  .claims > li {
    padding: 28px 0;
    opacity: 1;
  }
  .drop {
    height: auto;
  }
}

.editing h2 {
  margin-bottom: 26px;
}

.try {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--accent);
  border-radius: 999px;
  padding: 3px 9px;
}

/* Roadmap tags */

/* Scene 1: Wi-Fi off, work still finishes */
.s1 {
  padding-top: 64px;
}

.menubar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 9px 18px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--rule);
  font-size: 12.5px;
  color: var(--muted);
}

.menubar > span:first-child {
  color: var(--text);
  font-weight: 600;
}

.menubar .spacer {
  flex: 1;
}

.wifi-off {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
}

.wifi-off svg {
  width: 18px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.wifi-off svg circle {
  fill: currentColor;
  stroke: none;
}

.wifi-off .slash {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 26;
  stroke-dashoffset: 26;
  transition: stroke-dashoffset 0.5s var(--ease) 0.3s;
}

.panel[data-active="1"] .wifi-off .slash {
  stroke-dashoffset: 0;
}

.log {
  list-style: none;
  margin: 0;
  padding: 0;
}

.log li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
  opacity: 0.25;
  transition: opacity 0.4s var(--ease);
}

.log li::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--dim);
  transition: background 0.3s, box-shadow 0.3s;
}

.log b {
  margin-left: auto;
  font-weight: 400;
  font-size: 13px;
  color: var(--muted);
  font-family: var(--mono);
}

.panel[data-active="1"] .log li {
  opacity: 1;
}

.panel[data-active="1"] .log li::before {
  background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.5l2.2 2.2 4.8-5' fill='none' stroke='%230b0b0a' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / 100%;
  box-shadow: none;
}

.panel[data-active="1"] .log li:nth-child(1),
.panel[data-active="1"] .log li:nth-child(1)::before { transition-delay: 0.8s; }
.panel[data-active="1"] .log li:nth-child(2),
.panel[data-active="1"] .log li:nth-child(2)::before { transition-delay: 1.5s; }
.panel[data-active="1"] .log li:nth-child(3),
.panel[data-active="1"] .log li:nth-child(3)::before { transition-delay: 2.2s; }

/* Scene 4: photo to LaTeX */
.s4 {
  align-items: flex-start;
  gap: 22px;
}

.s4 .ink-eq {
  font-size: 34px;
  padding: 20px 26px;
}

.s4 .tex {
  font-size: 15px;
  padding: 16px 20px;
  margin: 0;
  width: 100%;
  clip-path: inset(0 100% 0 0);
}

.panel[data-active="4"] .ink-eq::after {
  animation: scan 0.6s var(--ease) 0.1s;
}

.panel[data-active="4"] .tex {
  animation: reveal-tex 0.5s steps(30) 0.5s forwards;
}

@media (max-width: 860px) {
  .different {
    height: auto;
  }
  .pin {
    position: static;
    height: auto;
  }
  .claims > li > p {
    max-height: none;
    opacity: 1;
    margin-top: 8px;
  }
  .claims h3 {
    color: var(--text);
  }
  .timeline li {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* Phones */
@media (max-width: 600px) {
  body {
    font-size: 15px;
  }
  h2 {
    font-size: clamp(28px, 8vw, 34px);
    margin-bottom: 20px;
  }
  .nav {
    gap: 12px;
    padding: 12px 16px;
  }
  .nav .button {
    padding: 8px 14px;
  }
  .hero {
    padding: 88px 20px 48px;
    min-height: 100svh;
  }
  .compile-title {
    font-size: clamp(34px, 10vw, 42px);
    margin-bottom: 20px;
  }
  .lede {
    font-size: 16px;
  }
  
  .stage {
    margin-top: 0;
  }
  .requirements {
    font-size: 12px;
  }

  .different,
.familiar,
.soon,
.why,
.questions {
    margin-top: 110px;
    padding: 0 20px;
  }
  .claims h3 {
    font-size: 20px;
  }
  .panel {
    height: 330px;
  }
  .scene {
    padding: 22px;
  }

  /* The pinned demo is centred in the screen, which already leaves room above and below it. */
  .editing {
    margin-top: 0;
    padding: 0 14px;
  }
  .editing-pin {
    gap: 14px;
    padding-top: 56px;
  }
  .editing h2 {
    font-size: 28px;
    margin-bottom: 0;
  }
  .editing-copy p {
    font-size: 15px;
    margin-top: 8px;
  }
  .demo-bar {
    padding: 10px 14px;
  }
  .demo-bar .file {
    display: none;
  }
  .demo-text {
    font-size: 12.5px;
    line-height: 1.65;
    padding: 14px 16px 0;
    min-height: calc(9 * 1.65em + 14px);
  }
  .demo-status {
    font-size: 13px;
    padding: 0 16px;
    margin-top: 10px;
  }
  .demo-review,
  .demo-actions {
    padding: 10px 16px 0;
  }
  .demo-review button,
  .demo-actions button {
    font-size: 13px;
    padding: 7px 12px;
  }
  .demo {
    padding-bottom: 14px;
  }
  .demo-steps {
    gap: 6px;
  }
  .demo-steps li {
    font-size: 11.5px;
    padding-top: 7px;
  }

  .ink-eq {
    font-size: 30px;
    padding: 18px 20px;
  }
  .tex {
    font-size: 14px;
    padding: 18px 20px;
  }
  
  .window {
    height: 260px;
  }
  .timeline li {
    padding-left: 24px;
    padding-bottom: 24px;
    --row: 22px;
  }
  .timeline p {
    font-size: 16.5px;
    line-height: 1.4;
  }
  .letter p {
    font-size: 16.5px;
  }
  summary {
    font-size: 15.5px;
  }
  .end {
    padding: 80px 20px 100px;
  }
  .end h2 {
    font-size: 38px;
  }
  footer {
    flex-wrap: wrap;
    gap: 14px 20px;
    margin-top: 80px;
  }
}

@media (max-width: 860px) {
  .story {
    grid-template-columns: 1fr;
  }
  .different .panel {
    display: none;
  }
  .claims > li > p,
  .claims > li.active > p {
    max-height: none;
    opacity: 1;
    margin-top: 8px;
  }
  .claims > li h3 {
    color: var(--text);
  }
  .tick {
    display: none;
  }
}

.demo-text .blocked-label {
  display: inline-block;
  font: 600 11px var(--sans);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--accent);
  border-radius: 4px;
  padding: 1px 7px;
  margin-right: 8px;
}

.demo-text .blocked {
  opacity: 0.6;
}

.demo-text .blocked ins {
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
}

@media (prefers-reduced-motion: reduce) {
  .tree li,
  .win-pdf {
    opacity: 1;
  }
  .zip,
  .target {
    display: none;
  }
}

.nav .spacer {
  flex: 1;
}

/* Scroll cue under the hero */
.scroll-cue {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: max-content;
  margin: -96px auto 48px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}

.scroll-cue i {
  position: relative;
  width: 1px;
  height: 44px;
  background: var(--rule);
  overflow: hidden;
}

.scroll-cue i::after {
  content: "";
  position: absolute;
  left: 0;
  top: -40%;
  width: 1px;
  height: 40%;
  background: var(--text);
  animation: cue 1.8s var(--ease) infinite;
}

@keyframes cue {
  to {
    top: 100%;
  }
}

.nav.scrolled ~ main .scroll-cue,
.scroll-cue.gone {
  opacity: 0;
  transition: opacity 0.4s;
}

/* Simple pages: privacy, download */
.page .nav {
  position: sticky;
}

.doc {
  max-width: 760px;
  margin: 0 auto;
  padding: 80px clamp(20px, 5vw, 48px) 0;
}

.doc h1 {
  font-size: clamp(44px, 7vw, 72px);
  line-height: 1;
  margin-bottom: 20px;
}

.doc h2 {
  font-size: 30px;
  margin: 56px 0 16px;
}

.lede-doc {
  font-size: 19px;
  color: #cfccc3;
}

.doc p,
.doc li {
  color: #cfccc3;
}

.doc li {
  margin: 8px 0;
}

.doc b {
  color: var(--text);
  font-weight: 600;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  margin: 8px 0 20px;
}

.doc th,
.doc td {
  text-align: left;
  vertical-align: top;
  padding: 12px 16px 12px 0;
  border-top: 1px solid var(--rule);
}

.doc th {
  font-weight: 500;
  color: var(--muted);
  font-size: 13px;
}

.dl-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0 16px;
}

@media (max-width: 600px) {
  .doc table,
  .doc tbody,
  .doc tr,
  .doc td {
    display: block;
  }
  .doc th {
    display: none;
  }
  .doc td {
    border: none;
    padding: 2px 0;
  }
  .doc tr {
    border-top: 1px solid var(--rule);
    padding: 12px 0;
  }
  .doc td:first-child {
    color: var(--text);
    font-weight: 600;
  }
  .scroll-cue {
    display: none;
  }
}

.kicker {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 14px;
}

.doc .figures {
  margin: 24px 0;
}

.doc .figures div {
  border-top: 1px solid var(--rule);
  padding: 14px 0;
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 16px;
  align-items: baseline;
}

.doc .figures dt {
  font: 32px/1 var(--serif);
  color: var(--text);
}

.doc .figures dd {
  margin: 0;
  color: var(--muted);
}

/* The Homebrew command: click to copy */
.brew {
  position: relative;
  border-radius: 10px;
  background: rgba(19, 19, 17, 0.8);
  backdrop-filter: blur(6px);
  overflow: hidden;
  padding: 12px 16px;
}

.brew code {
  background: none;
  padding: 0;
  font-size: 13px;
  color: var(--muted);
}

.brew .copy-icon {
  width: 14px;
  height: 14px;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
}

.brew:hover code {
  color: var(--text);
}

.brew:hover .copy-icon {
  stroke: var(--text);
}

.brew .copied {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--ok);
  color: var(--bg);
  font-weight: 600;
  transform: translateY(100%);
  transition: transform 0.35s var(--ease);
}

.brew.done .copied {
  transform: none;
}

.shots {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  margin: 16px 0 4px;
}

.shots figure {
  margin: 0;
  flex: 1 1 140px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shots figure:last-child {
  flex-basis: 240px;
}

.shots img {
  width: 100%;
  height: auto;
  border-radius: 10px;
}

.shots figcaption {
  font-size: 13px;
  color: var(--muted);
}

.dl-meta {
  margin: -4px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.doc .alt {
  margin: 12px 0 8px;
  color: var(--muted);
}

.doc li .brew {
  max-width: 100%;
}

.doc li .brew code {
  overflow-wrap: anywhere;
  text-align: left;
}

@media (max-width: 600px) {
  .brew code {
    font-size: 11.5px;
  }
}

/* Phones: the drop animation sits under the section's intro, before the list. */
@media (max-width: 600px) {
  .familiar {
    gap: 0;
  }
  .familiar > .reveal {
    display: contents;
  }
  .familiar {
    margin-top: 0;
  }
  .familiar .drop {
    order: 1;
    padding-top: 64px;
    margin-bottom: 28px;
  }
  .familiar .same {
    order: 2;
  }
  .familiar .deadline {
    margin-bottom: 0;
  }
  .doc h1 {
    font-size: 34px;
  }
  .doc h2 {
    font-size: 24px;
  }
  .lede-doc {
    font-size: 16.5px;
  }
  .doc p,
  .doc li {
    font-size: 15px;
  }
}

/* The per-point copies of the features panel: phones and tablets only. */
.claims .panel {
  display: none;
}

@media (max-width: 860px) {
  .different .claims .panel {
    display: block;
    height: 240px;
    margin-top: 16px;
  }
  .claims .scene {
    padding: 22px;
  }
  .claims .edit-line {
    font-size: 14px;
  }
  .claims .tex {
    font-size: 13px;
    white-space: pre-wrap;
  }
}
