/* ZeroLoom Build. Colours come from dyes used on a handloom: indigo, madder, turmeric, and a teal. */
@font-face { font-family: "Bricolage"; src: url("/fonts/bricolage.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "JB Mono"; src: url("/fonts/jbmono.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

:root {
  --ink: #1b1f3b;
  --ink-soft: #565b7a;
  --ground: #eef1f6;
  --surface: #ffffff;
  --line: #d5dae6;
  --madder: #c92f5f;
  --teal: #157f80;
  --turmeric: #e8a100;
  --turmeric-ink: #7a5600;
  --danger: #b3261e;
  --r-s: 6px;
  --r-m: 12px;
  --font: "Bricolage", "Segoe UI", system-ui, sans-serif;
  --mono: "JB Mono", ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html { height: 100%; }
body { margin: 0; min-height: 100%; display: flex; flex-direction: column; font: 400 1rem/1.5 var(--font); color: var(--ink); background: var(--ground); }
h1, h2, h3, p, ul, ol, dl { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--turmeric); outline-offset: 2px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 10; }

button { cursor: pointer; border: 1.5px solid var(--ink); background: var(--surface); border-radius: var(--r-s); padding: 0.5rem 0.9rem; font-weight: 500; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--ink); color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled) { background: #2b3160; }
button.quiet { border-color: transparent; background: transparent; }
button.quiet:hover { background: rgba(27, 31, 59, 0.07); }
button.danger { color: var(--danger); }
button.danger-fill { background: var(--danger); border-color: var(--danger); }
textarea, input { width: 100%; border: 1.5px solid var(--line); border-radius: var(--r-s); padding: 0.7rem 0.8rem; background: var(--surface); }
textarea { resize: vertical; line-height: 1.45; }
textarea:focus, input:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(232, 161, 0, 0.45); }
label { display: block; font-weight: 600; margin-bottom: 0.4rem; }
.hint { color: var(--ink-soft); font-size: 0.9rem; }
.problem { color: var(--danger); font-weight: 500; }

/* top bar */
.top { display: flex; align-items: center; gap: 1rem; padding: 0.7rem 1.25rem; }
.wordmark { display: flex; align-items: center; gap: 0.55rem; color: inherit; text-decoration: none; font-weight: 700; font-size: 1.3rem; letter-spacing: -0.02em; }
.top button, .mode { white-space: nowrap; }
.mode { font-size: 0.85rem; color: var(--turmeric-ink); background: #fbeecb; border-radius: 999px; padding: 0.15rem 0.7rem; }
.top-right { margin-left: auto; display: flex; gap: 0.25rem; align-items: center; }
#creditsBtn { font-variant-numeric: tabular-nums; }
main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0.8rem 1.25rem; color: var(--ink-soft); font-size: 0.85rem; }

/* home */
.home { width: min(1080px, 100%); margin: 0 auto; padding: clamp(1.5rem, 5vw, 4rem) 1.25rem 3rem; display: grid; gap: 2.5rem; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; }
.pitch h1 { font-size: clamp(2.4rem, 5.4vw, 4.25rem); line-height: 0.98; letter-spacing: -0.035em; font-weight: 750; }
.lede { margin-top: 1.25rem; font-size: 1.15rem; max-width: 34ch; color: var(--ink-soft); }
.composer { background: var(--surface); border-radius: var(--r-m); padding: 1.25rem; border: 1.5px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.composer textarea { font-size: 1.05rem; min-height: 8.5rem; }
.composer-foot { display: flex; gap: 0.75rem; justify-content: space-between; align-items: flex-end; margin-top: 0.75rem; flex-wrap: wrap; }
.ideas { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ideas button { border: 1.5px solid var(--line); border-radius: 999px; padding: 0.2rem 0.75rem; font-size: 0.9rem; font-weight: 400; }
.ideas button:hover { border-color: var(--ink); }
.composer .hint { margin-top: 0.6rem; }

.threads-explain { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; counter-reset: t; }
.threads-explain li { padding: 1rem 1.25rem 0 0; border-top: 5px solid; display: grid; gap: 0.2rem; }
.threads-explain li b { font-size: 1.1rem; }
.threads-explain li span { color: var(--ink-soft); max-width: 30ch; }
.t-plan { border-color: var(--turmeric) !important; }
.t-ui { border-color: var(--madder) !important; }
.t-be { border-color: var(--teal) !important; }

.mine { grid-column: 1 / -1; }
.mine h2 { font-size: 1.35rem; letter-spacing: -0.01em; margin-bottom: 0.75rem; }
.app-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.75rem; }
.app-list a { display: grid; gap: 0.15rem; padding: 0.9rem 1rem; background: var(--surface); border-radius: var(--r-m); border: 1.5px solid var(--line); color: inherit; text-decoration: none; height: 100%; }
.app-list a:hover { border-color: var(--ink); }
.app-list b { font-size: 1.05rem; }
.app-list span { color: var(--ink-soft); font-size: 0.92rem; }
.app-list .state { font-size: 0.85rem; font-weight: 600; }
.state.building { color: var(--turmeric-ink); }
.state.failed { color: var(--danger); }

/* workbench */
.bench { flex: 1; display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 1rem; padding: 0.25rem 1.25rem 0.5rem; min-height: 0; height: calc(100vh - 7.2rem); }
.rail { overflow-y: auto; padding-right: 0.25rem; display: flex; flex-direction: column; gap: 1rem; }
.back { color: var(--ink-soft); font-size: 0.92rem; }
.app-name { font-size: 1.8rem; line-height: 1.05; letter-spacing: -0.03em; font-weight: 700; overflow-wrap: anywhere; }
.app-tagline { color: var(--ink-soft); margin-top: -0.6rem; }
.said summary { cursor: pointer; color: var(--ink-soft); font-size: 0.92rem; }
.said p { margin-top: 0.4rem; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.95rem; }

/* the loom: one thread per building step */
.loom { display: grid; gap: 0.9rem; background: var(--surface); border-radius: var(--r-m); padding: 1rem; border: 1.5px solid var(--line); }
.thread { --c: var(--ink); display: grid; gap: 0.35rem; }
.thread.plan { --c: var(--turmeric); }
.thread.ui { --c: var(--madder); }
.thread.backend { --c: var(--teal); }
.thread.change { --c: var(--madder); }
.thread-head { display: flex; justify-content: space-between; gap: 0.5rem; font-weight: 600; }
.thread-head small { font-weight: 400; color: var(--ink-soft); font-size: 0.88rem; }
.warp { position: relative; height: 12px; border-radius: 2px; background: repeating-linear-gradient(90deg, var(--line) 0 2px, transparent 2px 7px); overflow: hidden; }
.weft { position: absolute; inset: 0 auto 0 0; width: 0; background: repeating-linear-gradient(90deg, var(--c) 0 5px, color-mix(in srgb, var(--c) 62%, white) 5px 7px); transition: width 0.6s ease-out; }
.thread.done .weft { width: 100% !important; }
.thread.failed .weft { background: repeating-linear-gradient(90deg, var(--danger) 0 3px, transparent 3px 9px); }
.shuttle { position: absolute; top: 1px; left: 0; width: 22px; height: 10px; border-radius: 5px; background: var(--ink); display: none; }
.thread.working .shuttle { display: block; animation: pass 1.5s ease-in-out infinite alternate; }
@keyframes pass { from { left: 0; } to { left: calc(100% - 22px); } }
@media (prefers-reduced-motion: reduce) { .thread.working .shuttle { animation: none; left: calc(50% - 11px); } .weft { transition: none; } }

.change { display: grid; gap: 0.5rem; }
.change label { margin: 0; }
.history h2 { font-size: 1rem; margin-bottom: 0.4rem; }
.history li { padding: 0.55rem 0; border-top: 1px solid var(--line); font-size: 0.93rem; overflow-wrap: anywhere; }
.history time { color: var(--ink-soft); font-size: 0.82rem; display: block; }
.history .result { color: var(--ink-soft); }

.stage { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1.5px solid var(--ink); border-radius: var(--r-m); overflow: hidden; }
.stage-bar { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.5rem 0.6rem; border-bottom: 1.5px solid var(--ink); flex-wrap: wrap; }
.tabs { display: flex; gap: 0.15rem; }
.tabs button { border-color: transparent; background: none; padding: 0.4rem 0.8rem; }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }
.stage-actions { display: flex; gap: 0.35rem; }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pane.scroll { overflow-y: auto; padding: 1.25rem; display: block; }
.sizes { display: flex; gap: 0.25rem; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--line); align-items: center; }
.sizes button { border-color: transparent; padding: 0.2rem 0.65rem; font-size: 0.9rem; font-weight: 400; background: none; }
.sizes button[aria-pressed="true"] { background: var(--ground); font-weight: 600; }
.sizes .reload { margin-left: auto; }
.app-problem { display: flex; gap: 0.75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 0.6rem 0.8rem; background: #fde9e7; border-bottom: 1px solid var(--line); color: #7a1a14; }
.app-problem span { overflow-wrap: anywhere; flex: 1; min-width: 12rem; }
.frame-wrap { flex: 1; min-height: 0; background: repeating-linear-gradient(90deg, #e3e7f0 0 1px, transparent 1px 8px), var(--ground); display: flex; justify-content: center; }
.frame-wrap iframe { width: 100%; height: 100%; border: 0; background: #fff; max-width: 100%; }
.frame-wrap.narrow iframe { border-inline: 1.5px solid var(--ink); }
.preview-wait { align-self: center; color: var(--ink-soft); padding: 2rem; text-align: center; max-width: 34ch; background: var(--ground); }

/* screens + backend panes */
.pane h2 { font-size: 1.25rem; letter-spacing: -0.01em; margin: 1.75rem 0 0.75rem; }
.pane h2:first-child { margin-top: 0; }
.pane .about { max-width: 68ch; }
.screen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.75rem; }
.screen { border: 1.5px solid var(--line); border-top: 5px solid var(--madder); border-radius: var(--r-s); padding: 0.85rem 1rem; display: grid; gap: 0.5rem; align-content: start; }
.screen p { color: var(--ink-soft); font-size: 0.95rem; }
.parts { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.parts li { font-size: 0.85rem; background: #fbe6ed; color: #7d1637; border-radius: 4px; padding: 0.05rem 0.45rem; }
.defs { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.25rem; max-width: 80ch; }
.defs dt { font-weight: 600; }
.defs dd { margin: 0; color: var(--ink-soft); }
.notice { background: #e1f1f1; border-left: 5px solid var(--teal); padding: 0.75rem 1rem; border-radius: 0 var(--r-s) var(--r-s) 0; max-width: 80ch; }
.notice.standin { background: #fbeecb; border-color: var(--turmeric); margin-bottom: 1.25rem; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
caption { text-align: left; font-weight: 700; padding-bottom: 0.3rem; font-family: var(--mono); font-size: 0.95rem; }
th, td { text-align: left; padding: 0.4rem 0.9rem 0.4rem 0; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink-soft); font-weight: 500; font-size: 0.88rem; }
td.mono, .mono { font-family: var(--mono); font-size: 0.88rem; }
.entity { margin-bottom: 1.5rem; max-width: 80ch; }
.method { font-family: var(--mono); font-size: 0.8rem; font-weight: 700; color: var(--teal); }
.method.POST { color: #2d6a1f; } .method.PATCH, .method.PUT { color: var(--turmeric-ink); } .method.DELETE { color: var(--danger); }
.notes li { padding-left: 1rem; position: relative; max-width: 75ch; margin-bottom: 0.3rem; }
.notes li::before { content: ""; position: absolute; left: 0; top: 0.65em; width: 6px; height: 2px; background: var(--ink); }

/* files */
.pane.files { flex-direction: row; }
.file-list { width: 220px; flex: none; border-right: 1px solid var(--line); overflow-y: auto; padding: 0.5rem; }
.file-list button { width: 100%; text-align: left; border-color: transparent; background: none; font-family: var(--mono); font-size: 0.82rem; padding: 0.35rem 0.5rem; font-weight: 400; display: flex; justify-content: space-between; gap: 0.5rem; }
.file-list button small { color: var(--ink-soft); }
.file-list button[aria-current="true"] { background: var(--ground); font-weight: 700; }
.code-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.code-bar button { font-family: var(--font); }
.code-bar { display: flex; justify-content: space-between; align-items: center; padding: 0.25rem 0.5rem 0.25rem 1rem; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 0.85rem; }
pre { margin: 0; flex: 1; overflow: auto; padding: 1rem; font: 400 0.82rem/1.55 var(--mono); background: #fbfcfe; tab-size: 2; }

/* windows */
.dlg { border: 1.5px solid var(--ink); border-radius: var(--r-m); padding: 1.5rem; width: min(420px, calc(100vw - 2rem)); box-shadow: 6px 6px 0 var(--ink); color: var(--ink); }
.dlg.wide { width: min(720px, calc(100vw - 2rem)); }
.dlg::backdrop { background: rgba(27, 31, 59, 0.5); }
.dlg h2 { font-size: 1.5rem; letter-spacing: -0.02em; margin-bottom: 0.5rem; }
.dlg h3 { margin: 1.25rem 0 0.5rem; }
.dlg > p { margin-bottom: 1rem; }
.dlg form:not(.dlg-x) { display: grid; gap: 0.6rem; }
.dlg form label { margin: 0; }
.dlg-x { position: absolute; top: 0.75rem; right: 0.75rem; }
.dlg-x button { border-color: transparent; font-size: 0.9rem; padding: 0.2rem 0.5rem; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.25rem; }
.packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.packs li { border: 1.5px solid var(--line); border-radius: var(--r-s); padding: 0.9rem; display: grid; gap: 0.25rem; }
.packs b { font-size: 1.1rem; }
.packs .price { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.packs span { color: var(--ink-soft); font-size: 0.9rem; }
.packs button { margin-top: 0.5rem; }
#signoutBtn { margin-top: 1rem; }
.numbers { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem 1.25rem; }
.numbers dt { color: var(--ink-soft); font-size: 0.88rem; }
.numbers dd { margin: 0; font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
#ownerPeople input { width: 5.5rem; padding: 0.25rem 0.4rem; }
#ownerPeople button { padding: 0.2rem 0.6rem; font-size: 0.88rem; }

.toast { position: fixed; inset: auto auto 1.5rem 50%; margin: 0; border: 0; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 0.6rem 1rem; border-radius: var(--r-s); z-index: 2147483647; max-width: calc(100vw - 2rem); }

#accountBtn { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; }
.sizes button { white-space: nowrap; }
@media (max-width: 520px) { .mode { display: none; } .top { gap: 0.5rem; padding-inline: 0.9rem; } .top button { padding-inline: 0.55rem; } #accountBtn { max-width: 7.5rem; } .sizes button[data-w="820px"] { display: none; } .tabs button { padding-inline: 0.6rem; } }
@media (max-width: 860px) {
  .home { grid-template-columns: 1fr; gap: 1.75rem; }
  .threads-explain { grid-template-columns: 1fr; gap: 1rem; }
  .bench { grid-template-columns: 1fr; height: auto; }
  .rail { overflow: visible; }
  .stage { height: 80vh; }
  .pane.files { flex-direction: column; }
  .file-list { width: auto; border-right: 0; border-bottom: 1px solid var(--line); max-height: 9rem; }
  .stage-actions { width: 100%; justify-content: space-between; }
  .composer { box-shadow: 4px 4px 0 var(--ink); }
}

/* policy pages */
.plain-link, .foot a { color: inherit; }
.foot a { margin-left: 0.9rem; }
.doc { display: block; width: min(70ch, 100%); margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.doc-nav { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.doc-nav a { color: var(--ink-soft); }
.doc-nav a[aria-current="page"] { color: var(--ink); font-weight: 700; text-decoration: none; }
.doc h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -0.03em; line-height: 1.05; margin-bottom: 0.5rem; }
.doc h2 { font-size: 1.2rem; margin: 1.9rem 0 0.5rem; }
.doc p { margin-bottom: 0.8rem; }
.doc ul { list-style: disc; padding-left: 1.3rem; margin-bottom: 0.8rem; }
.doc li { margin-bottom: 0.4rem; }
.doc a { color: var(--ink); }

/* 0.3.0: voice, examples, undo */
.composer-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.composer-head label { margin: 0; }
.voice { display: flex; gap: 0.35rem; align-items: center; }
.voice select { font: inherit; padding: 0.3rem 0.4rem; border: 1.5px solid var(--line); border-radius: var(--r-s); background: var(--surface); color: inherit; }
.voice button { padding: 0.3rem 0.7rem; font-size: 0.92rem; }
.voice button.listening { background: var(--madder); border-color: var(--madder); color: #fff; }
.example-box { background: #fbeecb; border-left: 5px solid var(--turmeric); border-radius: 0 var(--r-s) var(--r-s) 0; padding: 0.9rem 1rem; display: grid; gap: 0.6rem; }
.rail-extras { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; margin-top: -0.5rem; }
.rail-extras button { padding: 0.3rem 0.5rem; font-size: 0.93rem; text-decoration: underline; }
#adoptBox { margin-top: 1rem; }

/* 0.4.0: Go live */
.live-box { max-width: 62ch; display: grid; gap: 1rem; }
.live-box h2 { margin: 0; }
.live-box .notes { margin: 0; }
.live-form { display: grid; gap: 0.5rem; }
.live-form label { margin: 0; }
.live-name { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; font-family: var(--mono); font-size: 0.88rem; color: var(--ink-soft); }
.live-name input { width: 14rem; font-family: var(--mono); font-size: 0.88rem; padding: 0.4rem 0.5rem; color: var(--ink); }
.live-link { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; background: #e1f1f1; border-left: 5px solid var(--teal); padding: 0.7rem 1rem; border-radius: 0 var(--r-s) var(--r-s) 0; }
.live-link a { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.live-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.price-line { font-size: 0.92rem; color: var(--ink-soft); }

/* 0.4.1: Go Live on the home page, with a real example running in a phone frame */
.live-pitch { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 2.5rem; align-items: center; background: var(--ink); color: #fff; border-radius: var(--r-m); padding: clamp(1.5rem, 4vw, 3rem); }
.live-pitch h2 { font-size: clamp(1.8rem, 3.6vw, 2.8rem); line-height: 1; letter-spacing: -0.03em; margin-bottom: 0.9rem; }
.live-pitch p { color: #d3d7ea; max-width: 44ch; }
.live-pitch .notes { margin: 1.1rem 0; }
.live-pitch .notes li { color: #fff; }
.live-pitch .notes li::before { background: var(--turmeric); height: 3px; width: 8px; }
.live-pitch-price { font-size: 1.15rem; color: #fff !important; font-weight: 600; }
.phone { margin: 0; justify-self: center; display: grid; gap: 0.7rem; justify-items: center; }
.phone-body { box-sizing: content-box; width: 270px; height: 520px; border: 9px solid #0c0e1f; outline: 1.5px solid #5d6391; border-radius: 30px; overflow: hidden; background: #fff; }
.phone-body iframe { width: 390px; height: 751px; border: 0; transform: scale(0.6923); transform-origin: 0 0; background: #fff; }
.phone figcaption { font-size: 0.92rem; color: #d3d7ea; text-align: center; max-width: 30ch; }
.phone figcaption a { color: #fff; margin-left: 0.5rem; white-space: nowrap; }
@media (max-width: 860px) { .live-pitch { grid-template-columns: 1fr; } }

/* Hosting is paid: said plainly, before the button */
.live-paid-note { margin: 0 0 14px; padding: 10px 14px; border-left: 4px solid #E8A100; background: rgba(232,161,0,.10); border-radius: 6px; font-weight: 600; }
.live-pitch-price { font-weight: 600; }

/* Questions people ask */
.faq { grid-column: 1 / -1; max-width: 860px; margin-top: 1rem; }
.faq h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); letter-spacing: -0.02em; margin-bottom: 0.8rem; }
.faq details { border-top: 1px solid var(--line); padding: 0.85rem 0; }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 600; list-style-position: outside; }
.faq details p { margin: 0.5rem 0 0; max-width: 70ch; color: var(--ink-soft); }
.noscript { padding: 1rem; background: #fff3cd; text-align: center; }
.faq summary { list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-weight: 700; color: var(--turmeric-ink); }
.faq details[open] summary::after { content: "\2212"; }
