/* enterworlds.space: the front door of Worlds, laid out like the Worlds book
   (cream paper, terracotta and teal ink, captions on a hairline).
   Decisions: docs/web/DESIGN.md. Pages are generated by web/build-site.mjs.
   Latin and Arabic are separate families on purpose: in one family with
   different weight ranges the browser picks a single face for both. */

@font-face {
  font-family: "Worlds Latin";
  src: url("/fonts/instrument-sans.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Worlds Arabic";
  src: url("/fonts/plex-arabic-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41,
    U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "Worlds Arabic";
  src: url("/fonts/plex-arabic-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41,
    U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "Worlds Mono";
  src: url("/fonts/plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --paper: #f9f1e8;
  --paper-2: #f2e7da;
  --surface: #fffaf4;
  --ink: #2a2420;
  --ink-2: #665c53;
  --line: #e4d7c8;
  --line-2: #d3c3b1;
  --terra: #d4644d;
  --terra-ink: #b4513c;
  --teal: #24706b;
  --label: #5b6f66;
  --pill: #efe6dc;
  --pill-edge: #e0d3c4;
  --shadow: 74 44 20;
  --font: "Worlds Latin", "Worlds Arabic", system-ui, sans-serif;
  --mono: "Worlds Mono", ui-monospace, "Cascadia Mono", monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --wrap: 72rem;
  --gutter: clamp(16px, 4vw, 48px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1714;
    --paper-2: #231e1a;
    --surface: #29231f;
    --ink: #f4ebe1;
    --ink-2: #b9ada1;
    --line: #3a322c;
    --line-2: #4a4038;
    --terra: #ec8a72;
    --terra-ink: #f09a84;
    --teal: #6cc0b5;
    --label: #9db3a9;
    --pill: #2a2420;
    --pill-edge: #3c332d;
    --shadow: 0 0 0;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 24px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--font);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
html[lang="ar"] body { font-size: 1.125rem; line-height: 1.85; }
img, svg { max-width: 100%; }
img { height: auto; display: block; }
a { color: var(--teal); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--terra) 30%, transparent); }

.skip { position: absolute; inset-inline-start: 16px; top: -60px; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 9px; z-index: 10; }
.skip:focus { top: 12px; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

/* Header: the Worlds and imbue lockup from the book cover, then the site links. */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 20px; }
.lockup {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 7px 20px 7px 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--pill) 70%, #fff 30%), var(--pill));
  border: 1px solid var(--pill-edge);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.55), 0 10px 24px -16px rgb(var(--shadow) / 0.45);
  text-decoration: none;
  direction: ltr;
  flex: 0 0 auto;
}
.lockup .logo { width: 46px; height: 46px; border-radius: 12px; }
.lockup .sep { width: 1px; height: 30px; background: var(--line-2); }
.lockup .imbue { height: 26px; width: auto; }
.lockup.small { padding: 5px 14px 5px 5px; gap: 10px; }
.lockup.small .logo { width: 34px; height: 34px; border-radius: 9px; }
.lockup.small .sep { height: 22px; }
.lockup.small .imbue { height: 19px; }
@media (prefers-color-scheme: dark) {
  .lockup { background: var(--pill); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.06); }
}

.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-radius: 9px; font-size: 0.95em; transition: color 110ms var(--ease), background 110ms var(--ease); }
.nav a:hover { color: var(--ink); background: var(--paper-2); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--terra); border-radius: 0; }
.nav .lang { border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 12px; margin-inline-start: 6px; }
.menu { display: none; }
@media (max-width: 860px) {
  .top > .nav { display: none; }
  .menu { display: block; position: relative; }
  .menu > summary { list-style: none; cursor: pointer; border: 1px solid var(--line-2); border-radius: 999px; padding: 6px 16px; color: var(--ink); }
  .menu > summary::-webkit-details-marker { display: none; }
  .menu .nav { flex-direction: column; align-items: stretch; position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 5;
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 8px; min-width: 14rem; box-shadow: 0 18px 40px -20px rgb(var(--shadow) / 0.5); }
  .menu .nav a { padding: 10px 12px; }
  .menu .nav a[aria-current="page"] { box-shadow: none; background: var(--paper-2); border-radius: 9px; }
  .menu .nav .lang { margin: 6px 0 0; text-align: center; }
}

/* Front page */
.hero { padding-block: clamp(20px, 5vw, 56px) clamp(40px, 7vw, 88px); }
.code { direction: ltr; text-align: left; }
.puts { font: 500 clamp(15px, 1.7vw, 20px)/1 var(--mono); color: var(--label); margin: 0 0 clamp(4px, 1vw, 12px); min-height: 1em; }
.puts .caret { display: inline-block; width: 0.55em; height: 1.05em; margin-inline-start: 2px; vertical-align: -0.15em; background: var(--label); animation: blink 1s steps(1) infinite; }
.puts .caret[hidden] { display: none; }
@keyframes blink { 50% { opacity: 0; } }
.hw { display: block; width: min(100%, 64rem); height: auto; overflow: visible; }
.hw-l0 { color: var(--terra); }
.hw-l1 { color: var(--teal); }
.hw-fill { fill: currentColor; transition: opacity 400ms var(--ease); }
.hw path[data-t] { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.hw:not(.is-writing) path[data-t] { display: none; }
.hw.is-writing .hw-fill, .will-write .hw:not(.is-done) .hw-fill { opacity: 0; }
.hw.is-writing path[data-t] { stroke-dasharray: 1 2; stroke-dashoffset: 1; animation: hw-draw var(--d) linear var(--t) both; }
.hw.is-done .hw-fill { opacity: 1; }
@keyframes hw-draw {
  0% { stroke-dashoffset: 1; opacity: 0; }
  0.1% { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}
.run {
  font: 500 13px/1 var(--mono); color: var(--label); background: none; border: 1px solid var(--line-2);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; margin-top: 12px; transition: color 110ms var(--ease), border-color 110ms var(--ease);
}
.run:hover { color: var(--ink); border-color: var(--ink-2); }
.run[hidden] { display: none; }

.cover { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px 48px; align-items: end; margin-top: clamp(28px, 5vw, 56px); }
.rule { grid-column: 2; height: 2px; background: var(--terra); width: min(100%, 22rem); border-radius: 2px; }
.cover-text { grid-column: 1; grid-row: 1; }
.cover h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); line-height: 1.15; margin: 0; font-weight: 600; }
.cover .sub { font-size: clamp(1.3rem, 2.4vw, 1.75rem); line-height: 1.45; margin: 8px 0 0; font-weight: 600; }
.cover .desc { color: var(--ink-2); margin: 14px 0 0; max-width: 32rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 600;
  padding: 11px 20px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink); background: transparent;
  transition: background 110ms var(--ease), border-color 110ms var(--ease), transform 110ms var(--ease);
}
.btn:hover { background: var(--paper-2); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--paper)); }
.textlink { font-weight: 600; padding: 11px 6px; }
@media (max-width: 760px) {
  .cover { grid-template-columns: 1fr; }
  .rule { grid-column: 1; grid-row: 1; width: 8rem; }
  .cover-text { grid-row: 2; }
}

/* Chapters: one idea each, titled like the book. */
.chapter { padding-block: clamp(48px, 8vw, 96px); border-top: 1px solid var(--line); }
.kicker { color: var(--terra-ink); font-weight: 600; margin: 0 0 6px; font-size: 0.95em; }
.chapter h2 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); line-height: 1.25; margin: 0; font-weight: 600; max-width: 36rem; }
.chapter .intro { color: var(--ink-2); max-width: 38rem; margin: 14px 0 0; }
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(24px, 4vw, 56px); align-items: start; margin-top: 32px; }
.split > figure { margin: 0; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

.path { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 2px solid var(--ink); }
.path li { padding: 16px 0 0; padding-inline-end: 24px; }
.path b { display: block; font: 500 0.85rem/1 var(--mono); color: var(--terra-ink); margin-bottom: 10px; }
.path strong { display: block; font-size: 1.1em; }
.path span { color: var(--ink-2); display: block; margin-top: 4px; }
@media (max-width: 760px) { .path { grid-template-columns: 1fr; } .path li + li { border-top: 1px solid var(--line); margin-top: 16px; } }

.kinds { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.kinds li { border-bottom: 1px solid var(--line); }
.kinds a { display: grid; grid-template-columns: 2.4rem 1fr; gap: 2px 12px; padding: 16px 6px; color: inherit; text-decoration: none; border-radius: 9px; transition: background 110ms var(--ease); }
.kinds a:hover { background: var(--paper-2); }
.kinds b { grid-row: span 3; font: 500 0.85rem/2 var(--mono); color: var(--terra-ink); }
.kinds strong { font-size: 1.1em; }
.kinds em { font-style: normal; color: var(--label); font-size: 0.95em; }
.kinds span { color: var(--ink-2); }

.roles { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.roles li { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.roles small { display: block; color: var(--label); font-weight: 600; font-size: 0.85em; }
.roles strong { display: block; margin-top: 4px; }
.roles span { display: block; color: var(--ink-2); margin-top: 6px; font-size: 0.95em; }
.roles .ai { border-color: color-mix(in srgb, var(--teal) 45%, var(--line)); }
@media (max-width: 860px) { .roles { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .roles { grid-template-columns: 1fr; } }

/* Screenshots, and captions on a hairline as in the book. */
figure { margin: 28px 0; }
.shot img { border-radius: 12px; border: 1px solid var(--line); background: var(--surface); width: 100%; }
.shot.art img { border: 0; background: none; border-radius: 0; }
figcaption { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: 0.88em; margin-top: 10px; line-height: 1.5; }
figcaption::before { content: ""; flex: 0 0 auto; width: 56px; height: 1px; background: linear-gradient(90deg, var(--line-2) 0 60%, var(--terra) 60% 100%); }
[dir="rtl"] figcaption::before { background: linear-gradient(270deg, var(--line-2) 0 60%, var(--terra) 60% 100%); }

/* Platforms */
.platforms { width: 100%; border-collapse: collapse; margin-top: 28px; }
.platforms th, .platforms td { text-align: start; padding: 14px 0; padding-inline-end: 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.platforms thead th { color: var(--ink-2); font-weight: 600; font-size: 0.88em; border-bottom: 2px solid var(--ink); }
.platforms tbody th { font-weight: 600; white-space: nowrap; }
.platforms code { font-size: 0.8em; }
.platforms .size { font-family: var(--mono); font-size: 0.85em; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.platforms .note { color: var(--ink-2); }
.platforms .how { white-space: nowrap; }
.platforms .size.txt { font-family: inherit; font-size: 0.95em; }
@media (max-width: 760px) {
  .platforms thead { display: none; }
  .platforms tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
  .platforms th, .platforms td { border: 0; padding: 0; }
  .platforms td.file, .platforms td.note, .platforms td.how { grid-column: 1 / -1; }
}

.open { display: flex; flex-wrap: wrap; gap: 12px 32px; margin-top: 24px; }
.open a { font-weight: 600; }

/* Footer */
.foot { border-top: 1px solid var(--line); margin-top: 48px; padding-block: 32px 48px; color: var(--ink-2); font-size: 0.92em; }
.foot .row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; align-items: flex-start; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; max-width: 30rem; }
.foot nav a { color: var(--ink-2); text-decoration: none; }
.foot nav a:hover { color: var(--ink); text-decoration: underline; }
.foot .credit { max-width: 30rem; }
.foot .credit p { margin: 10px 0 0; }
.foot .fine { margin-top: 24px; font-size: 0.9em; }

/* Docs */
.docs { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: start; padding-block: 16px 24px; }
.side { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; padding-bottom: 24px; font-size: 0.93em; }
.side > summary { display: none; }
.side h2 { font-size: 0.82em; color: var(--label); font-weight: 600; margin: 22px 0 6px; padding-inline: 10px; }
.side h2:first-child { margin-top: 4px; }
.side ul { list-style: none; padding: 0; margin: 0; }
.side a { display: block; color: var(--ink-2); text-decoration: none; padding: 5px 10px; border-radius: 9px; line-height: 1.45; transition: background 110ms var(--ease), color 110ms var(--ease); }
.side a:hover { background: var(--paper-2); color: var(--ink); }
.side a[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: inset 2px 0 0 var(--terra); }
[dir="rtl"] .side a[aria-current="page"] { box-shadow: inset -2px 0 0 var(--terra); }
.side li.sub a { padding-inline-start: 22px; }
@media (max-width: 900px) {
  .docs { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; overflow: visible; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: 0; }
  .side > summary { display: block; cursor: pointer; padding: 12px 16px; font-weight: 600; color: var(--ink); }
  .side .side-list { padding: 0 8px 12px; }
  .side:not([open]) .side-list { display: none; }
}

.article { max-width: 46rem; min-width: 0; }
.article h1 { font-size: clamp(1.9rem, 3.6vw, 2.5rem); line-height: 1.2; margin: 8px 0 0; font-weight: 600; }
.article .lead { font-size: 1.15em; color: var(--ink-2); margin: 12px 0 0; }
.article h2 { font-size: 1.45rem; line-height: 1.3; margin: 2.4em 0 0.4em; font-weight: 600; }
.article h3 { font-size: 1.1rem; margin: 1.6em 0 0.3em; font-weight: 600; }
.article ul, .article ol { padding-inline-start: 1.4em; }
.article li + li { margin-top: 0.3em; }
.article hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.page-solo { padding-block: 16px 24px; }
.page-solo .article { margin-inline: auto; }
.crumb { color: var(--label); font-size: 0.9em; margin: 0; }
.crumb a { color: inherit; text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

.steps { list-style: none; padding: 0 !important; margin: 24px 0; counter-reset: step; }
.steps > li { counter-increment: step; position: relative; padding-inline-start: 3.2rem; padding-bottom: 22px; margin: 0 !important; }
.steps > li::before {
  content: counter(step, decimal-leading-zero); position: absolute; inset-inline-start: 0; top: 0.15em;
  font: 500 0.85rem/1 var(--mono); color: var(--terra-ink); width: 2.2rem; height: 2.2rem; display: grid; place-items: center;
  border: 1px solid color-mix(in srgb, var(--terra) 55%, var(--line)); border-radius: 50%; background: var(--paper);
}
.steps > li::after { content: ""; position: absolute; inset-inline-start: 1.1rem; top: 2.6rem; bottom: 4px; width: 1px; background: var(--line); }
.steps > li:last-child::after { display: none; }
.steps > li > h3 { margin: 0.3em 0 0.3em; }
.steps figure { margin: 16px 0 8px; }

.sketch { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: clamp(10px, 2vw, 20px); }
.sketch svg { display: block; width: 100%; height: auto; font-family: var(--font); }
.k-win { fill: var(--paper); stroke: var(--line-2); stroke-width: 1.5; }
.k-bar { fill: var(--paper-2); stroke: none; }
.k-field { fill: var(--surface); stroke: var(--line-2); stroke-width: 1; }
.k-btn { fill: var(--paper-2); stroke: var(--line-2); stroke-width: 1; }
.k-primary { fill: var(--teal); stroke: none; }
.k-text { fill: var(--ink); }
.k-muted { fill: var(--ink-2); }
.k-on { fill: var(--paper); }
.k-ring { fill: none; stroke: var(--terra); stroke-width: 3; }
.k-num { fill: var(--terra); }
.k-numtext { fill: #fff; font-weight: 600; }
.k-line { stroke: var(--line-2); stroke-width: 1; fill: none; }
@media (prefers-color-scheme: dark) { .k-numtext { fill: #1b1714; } }

.callout { background: var(--paper-2); border-inline-start: 3px solid var(--teal); border-radius: 12px; padding: 12px 16px; margin: 20px 0; }
.callout.warn { border-inline-start-color: var(--terra); }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }

.facts { display: grid; margin: 20px 0; border-top: 1px solid var(--line); }
.facts > div { display: grid; grid-template-columns: minmax(7rem, 12rem) 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--ink-2); font-weight: 600; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .facts > div { grid-template-columns: 1fr; gap: 2px; } }

.article table:not(.platforms) { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 0.95em; display: block; overflow-x: auto; }
.article table:not(.platforms) th, .article table:not(.platforms) td { text-align: start; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.article table:not(.platforms) thead th { border-bottom: 2px solid var(--ink); color: var(--ink-2); font-size: 0.92em; white-space: nowrap; }

code { font-family: var(--mono); font-size: 0.88em; background: var(--paper-2); border-radius: 6px; padding: 0.1em 0.35em; overflow-wrap: anywhere; }
pre { position: relative; direction: ltr; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; overflow-x: auto; margin: 16px 0; line-height: 1.55; }
pre code { background: none; padding: 0; font-size: 0.86em; overflow-wrap: normal; white-space: pre; }
.copy { position: absolute; top: 8px; right: 8px; font: 500 12px/1 var(--mono); color: var(--ink-2); background: var(--paper); border: 1px solid var(--line-2); border-radius: 999px; padding: 5px 10px; cursor: pointer; }
.copy:hover { color: var(--ink); }
kbd { font: 500 0.82em/1 var(--mono); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; padding: 0.2em 0.45em; background: var(--surface); white-space: nowrap; }

.index { list-style: none; padding: 0 !important; margin: 20px 0; border-top: 1px solid var(--line); }
.index li { margin: 0 !important; border-bottom: 1px solid var(--line); }
.index a { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; padding: 12px 6px; color: inherit; text-decoration: none; border-radius: 9px; transition: background 110ms var(--ease); }
.index a:hover { background: var(--paper-2); }
.index strong { color: var(--ink); }
.index span { grid-column: 1; color: var(--ink-2); font-size: 0.95em; }
.index a::after { content: "\2192"; grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--label); transition: transform 110ms var(--ease); }
[dir="rtl"] .index a::after { content: "\2190"; }
.index a:hover::after { transform: translateX(3px); }
[dir="rtl"] .index a:hover::after { transform: translateX(-3px); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); }
.pager a { display: block; text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; transition: background 110ms var(--ease); }
.pager a:hover { background: var(--paper-2); }
.pager small { display: block; color: var(--label); }
.pager .next { grid-column: 2; text-align: end; }

/* The live page (web/live/live.ts): a Worlds page the visitor builds on the front page. */
.stage { padding-block: clamp(20px, 5vw, 56px) clamp(32px, 6vw, 72px); }
.stage-intro { max-width: 46rem; }
.stage-intro h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.05; margin: 0; font-weight: 600; }
.stage-intro .sub { font-size: clamp(1.25rem, 2.4vw, 1.7rem); line-height: 1.4; margin: 10px 0 0; font-weight: 600; }
.stage-intro .desc { color: var(--ink-2); margin: 12px 0 0; max-width: 40rem; }
.stage-links { margin-top: 14px; gap: 8px 24px; }

.live { margin-top: clamp(24px, 4vw, 40px); }
.live-page {
  position: relative; max-width: 56rem; margin-inline: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: clamp(18px, 4vw, 44px) clamp(16px, 5vw, 60px) clamp(20px, 4vw, 36px);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.7), 0 2px 6px -2px rgb(var(--shadow) / 0.12), 0 40px 80px -48px rgb(var(--shadow) / 0.45);
}
@media (prefers-color-scheme: dark) { .live-page { box-shadow: 0 40px 80px -48px rgb(0 0 0 / 0.7); } }
.live-crumb { display: flex; gap: 8px; margin: 0 0 14px; color: var(--ink-2); font-size: 0.85em; }
.live-sep { color: var(--line-2); }
.live-title {
  font-size: clamp(1.7rem, 3.4vw, 2.4rem); font-weight: 600; line-height: 1.2; margin: 0 0 18px;
  outline: none; caret-color: var(--terra); border-radius: 6px;
}
.live-title:focus-visible { box-shadow: 0 2px 0 var(--teal); }
.live-blocks { display: grid; gap: 18px; }
.live-blocks > * { min-width: 0; }

.lb { position: relative; padding-inline-start: 36px; padding-inline-end: 32px; border-radius: 12px; }
.lb-hello { padding-inline: 0; }
.lb-hello .hw { width: 100%; max-width: 44rem; }
.lb-grip, .lb-remove {
  position: absolute; top: 4px; width: 28px; height: 28px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: none; color: var(--ink-2); cursor: grab; opacity: 0;
  transition: opacity 110ms var(--ease), background 110ms var(--ease);
}
.lb-grip { inset-inline-start: 2px; touch-action: none; }
.lb-remove { inset-inline-end: 0; cursor: pointer; }
.lb:hover > .lb-grip, .lb:hover > .lb-remove, .lb:focus-within > .lb-grip, .lb:focus-within > .lb-remove, .lb-grip:focus-visible, .lb-remove:focus-visible { opacity: 1; }
.lb-grip:hover, .lb-remove:hover { background: var(--paper-2); color: var(--ink); }
@media (hover: none) { .lb-grip, .lb-remove { opacity: 0.7; } }
.lb.is-dragging { transform: translateY(var(--drag-y, 0)); z-index: 3; background: var(--surface); box-shadow: 0 18px 40px -20px rgb(var(--shadow) / 0.55); }
.lb.is-dragging > .lb-grip { cursor: grabbing; opacity: 1; }
.lb-enter { animation: lb-in 460ms cubic-bezier(0.2, 0.9, 0.25, 1.15) both; }
@keyframes lb-in { from { opacity: 0; transform: translateY(10px) scale(0.985); } }
.ic { display: block; flex: 0 0 auto; }

.live-add { margin-top: 20px; }
.live-nojs { color: var(--ink-2); margin: 0; }
.is-live .live-nojs { display: none; }
.live-line {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border: 1px dashed var(--line-2); border-radius: 12px; transition: border-color 110ms var(--ease);
}
.live-line:focus-within { border-style: solid; border-color: var(--teal); }
.live-caret { font: 500 1rem/1 var(--mono); color: var(--terra-ink); }
.live-input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; color: var(--ink); outline: none; padding: 2px 0; }
.live-input::placeholder { color: var(--ink-2); opacity: 0.85; }
.live-menu {
  position: absolute; top: calc(100% + 6px); inset-inline-start: 0; z-index: 10; min-width: min(20rem, 100%);
  display: grid; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 24px 48px -24px rgb(var(--shadow) / 0.55);
}
.live-menu[hidden] { display: none; }
.live-menu-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 0; border-radius: 10px;
  background: none; color: var(--ink); font: inherit; text-align: start; cursor: pointer;
}
.live-menu-item.is-active, .live-menu-item:hover { background: var(--paper-2); }
.mi-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--paper-2); color: var(--teal); border: 1px solid var(--line); }
.mi-text strong { display: block; font-weight: 600; }
.mi-text small { display: block; color: var(--ink-2); font-size: 0.85em; }
.live-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.live-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line-2); background: none; color: var(--ink-2); font: inherit; font-size: 0.9em; cursor: pointer;
  transition: background 110ms var(--ease), color 110ms var(--ease);
}
.live-chip:hover { background: var(--paper-2); color: var(--ink); }
.live-chip .ic { color: var(--teal); }
.live-foot { max-width: 56rem; margin: 14px auto 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.live-kept { margin: 0; color: var(--ink-2); font-size: 0.9em; max-width: 32rem; }
.live-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.live-actions .btn { padding: 8px 16px; font-size: 0.95em; }

/* Text */
.lt-text { margin: 0; outline: none; min-height: 1.6em; border-radius: 6px; }
.lt-text:focus-visible { box-shadow: 0 2px 0 var(--teal); }

/* Table */
.tb-bar { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 12px 12px 0 0; background: var(--paper); }
.tb-bar:focus-within { border-color: var(--teal); }
.tb-ref { font: 500 0.85rem/1 var(--mono); color: var(--teal); min-width: 2.4em; }
.tb-fx { font-style: italic; color: var(--ink-2); font-family: Georgia, serif; }
.tb-input { flex: 1; min-width: 0; border: 0; background: none; color: var(--ink); font: 500 0.9rem/1.6 var(--mono); outline: none; direction: ltr; text-align: start; }
.tb-scroll { overflow-x: auto; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; }
.tb-grid { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.tb-grid th, .tb-grid td { border: 1px solid var(--line); padding: 8px 12px; text-align: start; }
.tb-grid tr > :first-child { border-inline-start: 0; }
.tb-grid tr > :last-child { border-inline-end: 0; }
.tb-grid thead th { border-top: 0; }
.tb-grid tbody tr:last-child > * { border-bottom: 0; }
.tb-grid th { background: var(--paper-2); color: var(--ink-2); font: 500 0.75rem/1 var(--mono); text-align: center; width: 2.6em; }
.tb-grid td { min-width: 6rem; cursor: cell; outline: none; transition: background 220ms var(--ease); }
.tb-grid td.is-head { font-weight: 600; }
.tb-grid td.is-num { text-align: end; }
.tb-grid td.is-formula { color: var(--teal); font-weight: 600; }
.tb-grid td.is-sel { box-shadow: inset 0 0 0 2px var(--teal); }
.tb-grid td.is-flash { animation: tb-flash 900ms var(--ease); }
@keyframes tb-flash { 0% { background: color-mix(in srgb, var(--terra) 28%, transparent); } }
.tb-err { color: var(--terra-ink); }
.tb-tip { margin: 8px 0 0; color: var(--ink-2); font-size: 0.88em; }

/* Tasks */
.tk-list { list-style: none; padding: 0; margin: 0; }
.tk-item { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tk-item input { width: 18px; height: 18px; accent-color: var(--teal); margin: 0; }
.tk-item label { flex: 1; min-width: 8rem; transition: color 160ms var(--ease); }
.tk-item.is-done label { color: var(--ink-2); text-decoration: line-through; text-decoration-color: var(--terra); }
.tk-enter { animation: lb-in 380ms cubic-bezier(0.2, 0.9, 0.25, 1.15) both; }
.tk-chip { font-size: 0.8em; padding: 2px 9px; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); white-space: nowrap; }
.tk-chip.is-today { color: var(--terra-ink); }
.tk-chip.is-high { background: color-mix(in srgb, var(--terra) 16%, transparent); color: var(--terra-ink); }
.tk-add { margin-top: 6px; }
.tk-input { width: 100%; border: 0; border-bottom: 1px dashed var(--line-2); background: none; color: var(--ink); font: inherit; padding: 10px 0; outline: none; }
.tk-input:focus { border-bottom-color: var(--teal); border-bottom-style: solid; }
.tk-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 1.8em; margin: 6px 0 0; font-size: 0.92em; color: var(--ink-2); }
.tk-will { color: var(--teal); }

/* Drawing */
.dr-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.dr-swatches { display: flex; gap: 8px; }
.dr-swatch { width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; padding: 0; }
.dr-swatch.is-on { box-shadow: 0 0 0 2px var(--ink-2); }
.dr-0 { background: var(--ink); }
.dr-1 { background: var(--terra); }
.dr-2 { background: var(--teal); }
.dr-space { flex: 1; }
.dr-tool { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: none; color: var(--ink-2); font: inherit; font-size: 0.86em; cursor: pointer; }
.dr-tool.is-on { background: var(--paper-2); color: var(--ink); border-color: var(--ink-2); }
.dr-tool:hover { color: var(--ink); }
.dr-stage { position: relative; }
.dr-canvas {
  display: block; width: 100%; height: clamp(220px, 34vw, 300px); border: 1px solid var(--line); border-radius: 12px;
  background-color: var(--paper); background-image: radial-gradient(circle, var(--line-2) 1px, transparent 1.2px); background-size: 22px 22px;
  touch-action: none; cursor: crosshair;
}
.dr-hint { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 24px; text-align: center; color: var(--ink-2); pointer-events: none; font-size: 0.95em; }
.dr-hint[hidden] { display: none; }

/* Slides */
.sl-stage { aspect-ratio: 16 / 9; display: grid; background: var(--ink); color: var(--paper); border-radius: 14px; overflow: hidden; }
.sl-stage:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.sl-slide { display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: clamp(16px, 4vw, 44px); min-width: 0; }
.sl-slide h3 { margin: 0; font-size: clamp(1.1rem, 2.6vw, 1.7rem); font-weight: 600; }
.sl-cover h3 { font-size: clamp(1.6rem, 4.4vw, 2.8rem); }
.sl-kicker { margin: 0; color: var(--terra); font-weight: 600; }
.sl-text { margin: 0; font-size: clamp(1.05rem, 2.4vw, 1.5rem); line-height: 1.6; }
.sl-tasks { margin: 0; padding-inline-start: 1.2em; display: grid; gap: 6px; font-size: clamp(0.95rem, 2vw, 1.2rem); }
.sl-tasks li.is-done { opacity: 0.55; text-decoration: line-through; }
.sl-tasks small { margin-inline-start: 10px; opacity: 0.7; font-size: 0.75em; }
.sl-table { border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: clamp(0.9rem, 2vw, 1.15rem); }
.sl-table th, .sl-table td { padding: 6px 16px; border-bottom: 1px solid color-mix(in srgb, var(--paper) 22%, transparent); text-align: start; }
.sl-drawing { width: 100%; max-height: 100%; object-fit: contain; background: var(--paper); border-radius: 10px; }
.sl-empty { margin: 0; opacity: 0.7; }
.sl-bar { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.sl-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-2); background: none; color: var(--ink); cursor: pointer; }
.sl-btn:disabled { opacity: 0.35; cursor: default; }
[dir="ltr"] .sl-prev .ic, [dir="rtl"] .sl-next .ic { transform: scaleX(-1); }
.sl-count { font-size: 0.85em; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sl:fullscreen { background: var(--ink); display: grid; place-items: center; padding: 24px; }
.sl:fullscreen .sl-stage { width: min(100%, calc((100vh - 90px) * 16 / 9)); }
.sl:fullscreen .sl-bar { color: var(--paper); }
.sl:fullscreen .sl-btn { color: var(--paper); border-color: color-mix(in srgb, var(--paper) 40%, transparent); }

/* What the full app adds */
.more { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; border-top: 1px solid var(--line); }
.more a { display: block; padding: 16px 6px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); border-radius: 0; transition: background 110ms var(--ease); }
.more a:hover { background: var(--paper-2); }
.more strong { display: block; font-size: 1.05em; }
.more span { display: block; color: var(--ink-2); margin-top: 2px; }
@media (max-width: 760px) { .more { grid-template-columns: 1fr; } .lb { padding-inline-end: 30px; padding-inline-start: 30px; } }
/* A phone: the handle and the remove button sit on a row above the block, so the block gets the whole width. */
@media (max-width: 600px) {
  .lb { padding: 34px 0 0; }
  .lb-hello { padding-top: 0; }
  .lb-grip { inset-inline-start: -4px; top: 0; }
  .lb-remove { inset-inline-end: -4px; top: 0; }
  .live-page { padding-inline: 16px; border-radius: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .puts .caret { display: none; }
}
@media print {
  .top, .side, .foot, .pager, .run, .copy { display: none !important; }
  .docs { display: block; }
}
