/* The front page of lemmapad.com, in the colours of the app itself. */

:root {
  color-scheme: light dark;
  --paper: #fbfaf7;
  --ink: #1f2328;
  --muted: #5f6672;
  --rule: #e4e2dc;
  --panel: #ffffff;
  --accent: #2f6fde;
  --accent-ink: #ffffff;
  --visual: #8250df;
  --good: #2f855a;
  --shadow: 0 24px 60px rgb(15 23 42 / 0.14), 0 2px 6px rgb(15 23 42 / 0.06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --width: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15171a;
    --ink: #e6e7e9;
    --muted: #a0a8b4;
    --rule: #2b2f36;
    --panel: #1d2025;
    --accent: #6ea2ff;
    --accent-ink: #0d1117;
    --visual: #b392f0;
    --shadow: 0 24px 60px rgb(0 0 0 / 0.5);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 var(--ui);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

code {
  font: 0.88em var(--mono);
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.math {
  font: italic 1.05em var(--serif);
}

/* The bar across the top. */
.bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px max(24px, calc((100% - var(--width)) / 2));
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.brand {
  font: 600 20px var(--ui);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.bar nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 15px;
}

.bar nav a:not(.button) {
  text-decoration: none;
  color: var(--muted);
}

.bar nav a:not(.button):hover {
  color: var(--ink);
}

.button {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent);
}

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

.button.quiet {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--rule);
}

main > section {
  width: min(var(--width), calc(100% - 48px));
  margin: 0 auto;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

/* The opening. */
.hero {
  padding: 88px 0 40px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--visual);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 auto;
  max-width: 15em;
  font-size: clamp(38px, 6vw, 66px);
}

.lede {
  margin: 22px auto 0;
  max-width: 36em;
  color: var(--muted);
  font-size: 19px;
}

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

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

.shot {
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
  background: var(--panel);
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
}

.hero-shot {
  margin-top: 64px;
}

/* What it does. */
.features {
  padding: 96px 0 24px;
}

.features > h2,
.who > h2 {
  text-align: center;
  font-size: clamp(28px, 4vw, 40px);
  margin: 0 0 40px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.grid article {
  padding: 24px 24px 22px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--panel);
}

.grid h3 {
  margin: 0 0 8px;
  font-size: 21px;
}

.grid p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

/* A feature at length: words beside a picture. */
.feature {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 56px;
  align-items: center;
  padding: 72px 0;
}

.feature.flip {
  grid-template-columns: 3fr 2fr;
}

.feature.flip .words {
  order: 2;
}

.feature h2 {
  font-size: clamp(26px, 3.4vw, 36px);
  margin: 0 0 14px;
}

.feature p {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.who {
  padding: 72px 0 24px;
}

.start {
  padding: 96px 0 104px;
  text-align: center;
}

.start h2 {
  font-size: clamp(28px, 4vw, 40px);
  margin: 0 0 14px;
}

.start > p:not(.fine) {
  margin: 0 auto;
  max-width: 36em;
  color: var(--muted);
  font-size: 18px;
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 28px max(24px, calc((100% - var(--width)) / 2));
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 860px) {
  .grid,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .feature,
  .feature.flip {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 48px 0;
  }

  .feature.flip .words {
    order: 0;
  }

  .bar nav a:not(.button) {
    display: none;
  }

  .hero {
    padding-top: 56px;
  }
}

/* A phone: the bar keeps the name and the button, closer together, and
   leaves the theme to the system or the app, which share it. */
@media (max-width: 480px) {
  .bar {
    gap: 12px;
    padding-inline: 16px;
  }

  .theme-pick {
    display: none;
  }

  /* The triangle's description wraps rather than running off the side. */
  /* The demos' lines fit beside their marks, and the field under them. */
  .demo .demo-page {
    padding: 22px 16px;
  }

  .demo-page .demo-row {
    padding-inline: 8px;
    font-size: 14px;
  }

  .demo .demo-prompt {
    min-width: 0;
    max-width: 100%;
  }

  .demo-page .demo-spec {
    display: block;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
}

/* The palette, played out: a small window of the app, in its own look. */
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 0.4em;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--panel);
  font: 600 0.8em/1.7 var(--ui);
  text-align: center;
  color: var(--ink);
}

.demo {
  --pending: #b7791f;
  position: relative;
  height: 430px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: color-mix(in srgb, var(--paper) 70%, var(--panel));
  box-shadow: var(--shadow);
  overflow: hidden;
  font-size: 15px;
}

@media (prefers-color-scheme: dark) {
  .demo {
    --pending: #e0a94a;
  }
}

.demo-bar {
  display: flex;
  gap: 18px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--rule);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
}

.demo-bar b {
  color: var(--ink);
}

.demo-page {
  padding: 26px 34px;
  font-family: var(--serif);
}

.demo-note {
  margin: 0 0 18px;
  font-size: 17px;
}

.demo-line .katex-display {
  margin: 0;
  text-align: left;
}

.demo-line .katex-display > .katex {
  text-align: left;
}

.demo-line {
  min-height: 78px;
  padding: 2px 10px;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  font-size: 20px;
}

.demo.done .demo-line {
  border-left-color: transparent;
  background: none;
}

.demo-prompt {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 6px;
  padding: 8px 12px;
  min-width: 260px;
  border: 1px solid color-mix(in srgb, var(--pending) 55%, var(--rule));
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgb(15 23 42 / 0.12);
  font: 15px/1.4 var(--mono);
}

.demo-prompt[hidden],
.demo-palette[hidden] {
  display: none;
}

.demo-label {
  color: var(--pending);
  font: 12px var(--ui);
}

/* Spaces either side of the caret stay. */
.demo-field {
  white-space: pre-wrap;
}

.demo-caret {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--ink);
  animation: blink 1s steps(1) infinite;
}

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

.demo-palette {
  position: absolute;
  top: 70px;
  left: 50%;
  width: min(440px, calc(100% - 32px));
  transform: translateX(-50%);
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise 0.16s ease-out;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translate(-50%, 6px);
  }
}

.demo-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
  font: 15px var(--ui);
  white-space: nowrap;
  overflow: hidden;
}

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

[data-part="query"]:not(.empty) ~ .demo-placeholder {
  display: none;
}

.demo-palette ul {
  margin: 0;
  padding: 6px;
  list-style: none;
}

.demo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  border-radius: 7px;
}

.demo-item.selected {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.demo-item .title {
  flex: 1;
}

.demo-item .preview {
  color: var(--muted);
}

.demo-item code {
  padding: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.demo-more {
  padding: 6px 10px;
  color: var(--muted);
  font-size: 13px;
}

.demo-key {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 10px;
  background: rgb(31 35 40 / 0.88);
  color: #fff;
  font: 600 14px var(--ui);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
}

.demo-key.shown {
  opacity: 1;
}

/* The demos played out with lines of the page: checking, the algebra, and a
   figure from its description. */
.demo {
  --good: #2f855a;
  --bad: #c53030;
}

@media (prefers-color-scheme: dark) {
  .demo {
    --good: #5fbf8f;
    --bad: #f07178;
  }
}

.demo-hero {
  height: 500px;
  margin-top: 56px;
  text-align: left;
}

.demo-page .demo-note {
  margin: 0 0 12px;
  font-size: 17px;
}

.demo-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.demo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-height: 50px;
  padding: 0 12px;
  border-left: 3px solid transparent;
  border-radius: 2px;
  font-size: 19px;
}

.demo-row.current,
.demo-row.editing {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.demo-row .katex-display {
  margin: 4px 0;
  text-align: left;
}

.demo-row .katex-display > .katex {
  text-align: left;
}

.demo-row-math {
  flex: 1;
  min-width: 0;
}

.demo-mark {
  width: 2em;
  font: 600 18px var(--ui);
  text-align: right;
}

.demo-mark.proved {
  color: var(--accent);
}

.demo-mark.wrong {
  color: var(--bad);
}

.demo-mark.derived-mark {
  color: var(--good);
}

.demo-row > .demo-note {
  flex-basis: 100%;
  margin: -4px 0 8px;
  color: var(--bad);
  font: 14px var(--ui);
}

.demo-row.arriving {
  animation: arrive 0.45s ease-out;
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.demo-rows + .demo-prompt,
.demo-row + .demo-prompt {
  margin: 2px 0 6px 12px;
}

.demo-status {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
  border-top: 1px solid var(--rule);
  background: var(--panel);
  color: var(--muted);
  font: 13px var(--ui);
}

.demo[data-demo="algebra"] .demo-key {
  bottom: 52px;
}

.demo-spec {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: 14px var(--mono);
  overflow: hidden;
  white-space: pre;
}

.demo-spec .demo-caret {
  display: none;
}

.demo-spec.editing {
  border-color: color-mix(in srgb, var(--pending) 55%, var(--rule));
  background: var(--panel);
  box-shadow: 0 8px 24px rgb(15 23 42 / 0.1);
}

.demo-spec.editing .demo-caret {
  display: inline-block;
}

.demo-figure {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.demo-figure svg {
  width: 100%;
  max-width: 380px;
  height: auto;
}

@media (prefers-color-scheme: dark) {
  .demo-key {
    background: rgb(230 231 233 / 0.92);
    color: #15171a;
  }
}

/* The graph demo: its lines, then the graph and its legend. */
.demo-graph-window {
  height: 650px;
}

.demo-rows.compact .demo-row {
  min-height: 40px;
  font-size: 16px;
}

.demo-graph {
  margin-top: 8px;
}

.demo-graph svg {
  display: block;
  width: 100%;
  height: auto;
}

.demo-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  margin-top: 6px;
  font-size: 14px;
}

.demo-legend-entry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.demo-swatch {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--curve);
}

.demo-legend-note {
  color: var(--muted);
  font: 13px var(--ui);
}

/* The theme picker in the bar at the top. */
.theme-pick select {
  padding: 5px 26px 5px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--panel)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.5'/%3E%3C/svg%3E")
    no-repeat right 10px center / 9px 6px;
  color: var(--ink);
  font: 14px var(--ui);
  appearance: none;
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The policy pages: privacy, terms and subprocessors. */
footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

footer a {
  text-decoration: none;
}

footer a:hover {
  color: var(--ink);
}

.legal {
  width: min(46em, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 96px;
  font-size: 17px;
}

.legal h1 {
  font-size: clamp(32px, 5vw, 44px);
  margin: 0 0 8px;
}

.legal h2 {
  font-size: 26px;
  margin: 48px 0 12px;
}

.legal h3 {
  font-size: 19px;
  margin: 28px 0 8px;
}

.legal .updated {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 28px;
}

.legal li + li {
  margin-top: 6px;
}

.legal .summary {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 4px 22px;
}

.legal .toc {
  columns: 2 14em;
  font-size: 15px;
  padding-left: 1.2em;
}

.legal .table-wrap {
  overflow-x: auto;
  margin: 16px 0;
}

.legal table {
  border-collapse: collapse;
  width: 100%;
  font-size: 15px;
}

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

.legal th {
  font-weight: 600;
  border-bottom-width: 2px;
}

/* Marks for the draft: a blank to fill in, and a note for the lawyer. Both
   come out before the page is published as final. */
.draft-banner {
  border: 1px solid #d69e2e;
  background: color-mix(in srgb, #d69e2e 12%, var(--paper));
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 15px;
}

.ph {
  background: color-mix(in srgb, #d69e2e 26%, transparent);
  border-radius: 3px;
  padding: 0 0.25em;
  font-weight: 600;
}

.lawyer {
  border-left: 3px solid var(--visual);
  background: color-mix(in srgb, var(--visual) 8%, transparent);
  padding: 8px 14px;
  font-size: 15px;
  color: var(--ink);
}

.lawyer::before {
  content: "For the lawyer: ";
  font-weight: 700;
  color: var(--visual);
}

/* A wide table becomes one card a row on a phone. */
@media (max-width: 640px) {
  .legal table.stack thead {
    display: none;
  }

  .legal table.stack,
  .legal table.stack tbody,
  .legal table.stack tr,
  .legal table.stack td {
    display: block;
  }

  .legal table.stack tr {
    border: 1px solid var(--rule);
    border-radius: 10px;
    padding: 6px 14px;
    margin-bottom: 14px;
  }

  .legal table.stack td {
    border: 0;
    padding: 6px 0;
  }

  .legal table.stack td::before {
    content: attr(data-label);
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
  }
}

/* The Pro waitlist (pro.html). */
.pro .lede {
  margin: 0 0 28px;
}

.waitlist {
  margin-top: 40px;
  display: grid;
  gap: 18px;
}

.waitlist h2 {
  margin: 0;
}

.waitlist label > span,
.waitlist legend {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.waitlist i {
  font-weight: 400;
  color: var(--muted);
}

.waitlist input[type="email"],
.waitlist textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 10px 12px;
}

.waitlist input[type="email"]:focus,
.waitlist textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.waitlist fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.waitlist fieldset legend {
  width: 100%;
}

.waitlist fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.waitlist .button {
  justify-self: start;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.waitlist .button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.waitlist .status:empty {
  display: none;
}

.waitlist .status[data-kind="done"] {
  color: var(--good);
  font-weight: 600;
}

.waitlist .status[data-kind="error"] {
  color: #c0392b;
}
