1// One look for every page bind.ws serves: the landing, the relay page, the2// invite page. Paper, ink, thick borders, hard shadows, a handwritten3// display face. Pages import the shell and drop their markup into it.45export const FONTS = `<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>6<link href="https://fonts.googleapis.com/css2?family=Pangolin&family=Instrument+Sans:ital,wght@0,400;0,500;0,600;1,400&family=DM+Mono:wght@400;500&display=swap" rel="stylesheet">`;78export const FAVICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><rect x="2" y="2" width="28" height="28" rx="8" fill="#f2d16b" stroke="#1c1b18" stroke-width="2.5"/><circle cx="16" cy="16" r="5" fill="#1c1b18"/><circle cx="16" cy="16" r="10" fill="none" stroke="#2f6b45" stroke-width="2.5" stroke-dasharray="6 5"/></svg>`;910export const BASE_CSS = `11:root {12 --paper: #fffdf9; --head: #faf9f6; --ink: #1c1b18; --ink-2: #625e56; --ink-3: #9c968c; --line: #e2ddd3; --line-2: #cfc8bb;13 --forest: #2f6b45; --forest-2: #3f8a5b; --forest-soft: #dfeae2; --moss: #b9cfae; --sun: #f2d16b; --red: #b8442f; --red-soft: #f8e8e4;14 --id-2: #c9a227; --id-3: #7ba7c7;15 --mint: #d9efe1; --butter: #fbeec1; --peach: #fadad0; --sky: #d7e6f6; --lilac: #e7def4;16 --display: "Pangolin", "Instrument Sans", cursive; --sans: "Instrument Sans", system-ui, sans-serif; --mono: "DM Mono", ui-monospace, monospace;17}18* { box-sizing: border-box; }19html { background-color: #f8f4ec; }20body { margin: 0; color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; min-height: 100vh;21 background-image: radial-gradient(40rem 22rem at -5% 0%, rgba(215,230,246,.8), transparent 60%), radial-gradient(36rem 20rem at 105% 20%, rgba(250,218,208,.8), transparent 60%), radial-gradient(44rem 26rem at 50% 110%, rgba(217,239,225,.9), transparent 60%); }22main { max-width: 64rem; margin: 0 auto; padding: 2.5rem 1.5rem 4rem; }23a { color: inherit; }24.mono { font-family: var(--mono); font-size: .86em; }25.hidden { display: none !important; }26.muted, .dim { color: var(--ink-3); }27.note { font-size: 13px; color: var(--ink-2); }28.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }29h1 { margin: 0; font: 400 5.6rem/1 var(--display); letter-spacing: -.02em; color: var(--ink); text-shadow: 3px 3px 0 var(--sun), 6px 6px 0 var(--forest); display: inline-block; cursor: default; user-select: none; -webkit-user-select: none; transition: transform .18s cubic-bezier(.34,1.56,.64,1), text-shadow .18s ease; word-break: break-all; }30h1:hover { transform: translate(-3px, -3px) rotate(-3deg); text-shadow: 5px 5px 0 var(--sun), 10px 10px 0 var(--forest); }31h1:active { transform: translate(2px, 2px) rotate(1deg); text-shadow: 1px 1px 0 var(--sun), 2px 2px 0 var(--forest); transition-duration: .06s; }32h1 em { font-style: normal; color: var(--forest); }33h2 { margin: 0 0 .5rem; font: 400 2.4rem/1 var(--display); letter-spacing: -.01em; }34h2::after { content: ""; display: block; width: 3.2rem; height: 6px; margin-top: .45rem; background: var(--ink); border-radius: 3px; transform: rotate(-2deg); }35h3 { margin: 0 0 .5rem; font: 600 .95rem var(--sans); }36p.lead { margin: 0 0 1.1rem; color: var(--ink-2); }37section, .card { position: relative; background: var(--paper); border: 2px solid var(--ink); border-radius: 18px; box-shadow: 6px 6px 0 var(--ink); padding: 1.3rem 1.5rem 1.5rem; margin: 2.2rem 0; }38.btn { font: 600 14px var(--sans); padding: .45rem .85rem; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer; border-radius: 999px; box-shadow: 2px 2px 0 var(--ink); text-decoration: none; display: inline-block; }39.btn:active { transform: translate(2px, 2px); box-shadow: none; }40.btn.pri { background: var(--forest); color: #fff; }41.btn.danger { color: var(--red); }42.btn:disabled, .ib:disabled { opacity: .5; cursor: default; }43.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; margin-right: .2rem; }44.ib { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); color: var(--ink); cursor: pointer; box-shadow: 2px 2px 0 var(--ink); vertical-align: middle; }45.ib svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }46.ib:hover { background: var(--sun); }47.ib:active { transform: translate(2px, 2px); box-shadow: none; }48.ib.pri { background: var(--forest); color: #fff; }49.ib.danger { color: var(--red); }50.ib.danger:hover { background: var(--red-soft); }51.ib + .ib { margin-left: .3rem; }52input.txt, select.txt, textarea, .sats { font: 15px var(--sans); width: 100%; outline: none; color: var(--ink); border: 2px solid var(--ink); border-radius: 10px; background: var(--paper); padding: .4rem .6rem; }53input.txt:focus, select.txt:focus, textarea:focus, .sats:focus-within { box-shadow: 0 0 0 3px var(--moss); }54input.txt.num { width: 6rem; text-align: right; }55input.txt.mono { font-family: var(--mono); font-size: 13px; }56textarea { resize: vertical; min-height: 4rem; }57/* WebKit keeps its own chrome on selects unless appearance is reset; draw the chevron ourselves. */58select.txt { -webkit-appearance: none; appearance: none; padding-right: 1.9rem; cursor: pointer;59 background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231c1b18' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");60 background-repeat: no-repeat; background-position: right .55rem center; background-size: 14px; }61code.pill { font: 500 14px var(--mono); color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; padding: .3rem .6rem; box-shadow: 2px 2px 0 var(--ink); }62.av { display: inline-block; width: 20px; height: 20px; border-radius: 50%; vertical-align: -5px; margin-right: .45rem; background: conic-gradient(from var(--h, 0deg), var(--forest), var(--id-2), var(--id-3), var(--forest)); flex: 0 0 auto; }63.chip { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font: 700 11px var(--sans); letter-spacing: .05em; text-transform: uppercase; border: 2px solid var(--ink); background: var(--sun); margin-right: .3rem; }64footer.pg { display: flex; align-items: center; gap: 1rem; margin-top: 3rem; color: var(--ink-3); font-size: 13px; }65footer.pg p { margin: 0; } footer.pg a { font-family: var(--mono); font-size: 12px; text-decoration: none; color: var(--ink-3); } footer.pg a::before { content: "-> "; color: var(--forest); } footer.pg a:hover { color: var(--ink); }66#toast { position: fixed; z-index: 50; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1rem); background: var(--ink); color: var(--paper); padding: .6rem 1rem; border-radius: 999px; font-size: .9rem; opacity: 0; transition: .25s; pointer-events: none; max-width: 90vw; border: 2px solid var(--paper); box-shadow: 2px 2px 0 var(--ink); }67#toast.show { opacity: 1; transform: translate(-50%, 0); }68@media (max-width: 52rem) { h1 { font-size: 4rem; } }69`;7071// page wraps a body in the shared shell.72export function page(title: string, body: string, extraCSS = "", head = ""): string {73 return `<!doctype html>74<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">75<title>${escapeHTML(title)}</title>76<link rel="icon" href="/favicon.svg" type="image/svg+xml">77${head}78${FONTS}79<style>${BASE_CSS}${extraCSS}</style>80</head><body>${body}<div id="toast"></div></body></html>`;81}8283export function escapeHTML(s: string): string {84 return s.replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]!);85}