/* Pottery Studio Platform: the same warm, calm look as PotteryDave. Light + dark. */
:root {
  --bg: #f6f1ea;
  --surface: #fffdf9;
  --surface-2: #efe7dc;
  --line: #e0d5c7;
  --text: #2b2420;
  --muted: #736558;
  --accent: #a9502b;        /* terracotta */
  --accent-ink: #ffffff;
  --accent-soft: #f4e0d5;
  --accent-2: var(--accent); /* second color; the same as the main one unless a studio picks its own */
  --ok: #4f7a52;
  --warn: #a8761a;
  --danger: #a33b32;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 16px rgba(60, 40, 20, .06);
  --tabbar-h: 64px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1916;
    --surface: #26211d;
    --surface-2: #312a25;
    --line: #3d352f;
    --text: #efe6dc;
    --muted: #a8998c;
    --accent: #e0835a;
    --accent-ink: #1d1916;
    --accent-soft: #3d2a20;
    --ok: #8fbf8f;
    --warn: #e0b35a;
    --danger: #ef7d73;
    --shadow: 0 1px 2px rgba(0,0,0,.3);

* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: clip; }
body { background: var(--bg); color: var(--text); font: 16px/1.45 var(--font); -webkit-font-smoothing: antialiased; min-height: 100dvh; padding-bottom: 96px; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; }
[hidden] { display: none !important; }

.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 8px; align-items: center; min-width: 0; text-decoration: none; color: var(--text); font-family: var(--serif); font-weight: 600; font-size: 1.1rem; }
.brand svg { color: var(--accent-2); flex: none; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 8px; flex: none; }
main { max-width: 760px; margin: 0 auto; padding: 16px; outline: none; }
/* Cards & lists */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.section { margin-top: 24px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; color: inherit; text-decoration: none; }
.list-item .title { font-weight: 600; }
.chev { color: var(--muted); margin-left: auto; }
/* Chips */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--text); white-space: nowrap; }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.filters button { flex: none; }
/* Buttons */
button, .btn {
  font: inherit; font-weight: 600; font-size: .95rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
}
button:disabled { opacity: .5; cursor: default; }
.btn-primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-ghost, button.ghost { background: transparent; border-color: transparent; }
button.danger { color: var(--danger); }
button.small, .btn.small { min-height: 34px; padding: 0 12px; font-size: .85rem; border-radius: 10px; }
button.pill { border-radius: 999px; min-height: 36px; font-size: .85rem; }
button.pill.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-block { width: 100%; }
.icon-btn { min-width: 44px; padding: 0; }
/* Forms */
form .field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
label, .label { font-size: .85rem; font-weight: 600; color: var(--muted); }
input, select, textarea {
  font: inherit; font-size: 16px; /* prevents iOS zoom */
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text);
}
textarea { min-height: 88px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.hint { font-size: .8rem; color: var(--muted); }
.form-error { color: var(--danger); font-size: .9rem; margin: 8px 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.fact { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.fact .k { font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.fact .v { font-weight: 600; }
/* Modal (native dialog) */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 48px); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(20, 12, 6, .45); }
dialog .dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
dialog .dlg-body { padding: 16px; }
dialog .dlg-foot { padding: 12px 16px 16px; display: flex; gap: 8px; justify-content: flex-end; }

/* Toast & misc */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom)); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 50; font-weight: 600; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }
.toast.error { background: var(--danger); color: #fff; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.auth-wrap { max-width: 400px; margin: 5vh auto 0; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (min-width: 720px) { main { padding: 24px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }
/* ---------- Help assistant ---------- */
.help-fab {
  position: fixed; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 15;
  width: 52px; height: 52px; min-height: 0; padding: 0; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 4px 16px rgba(60, 40, 20, .18); color: var(--accent);
}
.help-fab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
dialog.chat { display: flex; flex-direction: column; width: min(520px, calc(100vw - 16px)); height: min(680px, calc(100dvh - 32px)); max-height: none; }
dialog.chat:not([open]) { display: none; }
.chat-log { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.bubble { max-width: 85%; padding: 9px 12px; border-radius: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.msg.bot .bubble { background: var(--surface-2); border-bottom-left-radius: 4px; }
.msg.user .bubble { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.bubble code, pre.code { font: .85em ui-monospace, SFMono-Regular, Menlo, monospace; }
.msg-links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chat-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px 8px; max-height: 38%; overflow-y: auto; }
.chat-chips button { min-height: 36px; text-align: left; }
.chat-input { display: flex; gap: 8px; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.chat-input input { flex: 1; min-width: 0; }
.typing span { display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
/* ---------- Requests & admin ---------- */
.req-list { padding-top: 4px; padding-bottom: 4px; }
.req { padding: 12px 0; }
.reply { margin-top: 8px; padding: 10px 12px; border-left: 3px solid var(--accent-2); background: var(--surface-2); border-radius: 0 10px 10px 0; font-size: .92rem; }
.chip.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
pre.code { white-space: pre-wrap; background: var(--surface-2); border-radius: 10px; padding: 12px; font-size: .8rem; overflow-x: auto; max-height: 420px; }
.transcript { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
details summary { cursor: pointer; padding: 6px 0; }
.list.card { padding-left: 16px; padding-right: 16px; }

/* ---------- Review Claude's work ---------- */
:root { --add-bg: #e3f3e1; --add-ink: #1f5b25; --del-bg: #fbe3df; --del-ink: #8c2a1f; }
@media (prefers-color-scheme: dark) { :root { --add-bg: #1f3a22; --add-ink: #a9dfa9; --del-bg: #43211c; --del-ink: #f2aba2; } }
.review.deciding { border: 2px solid var(--accent); }
.banner { background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; font-size: .92rem; }
.summary { background: var(--surface-2); border-radius: 10px; padding: 4px 14px; margin: 4px 0 12px; }
.summary p, .summary ul { margin: 10px 0; }
.summary h3 { margin: 12px 0 4px; font-size: 1rem; }
.test-badge { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-weight: 700; border-radius: 10px; padding: 10px 12px; }
.test-badge.pass { background: var(--add-bg); color: var(--add-ink); }
.test-badge.fail { background: var(--del-bg); color: var(--del-ink); }
.test-badge .small { font-weight: 500; }
.warn-list { list-style: none; padding: 0; margin: 10px 0 0; font-size: .9rem; }
.warn-list li { padding: 6px 0; }
.changed-files { list-style: none; padding: 0; margin: 6px 0 8px; }
.changed-files li { display: flex; gap: 8px; align-items: baseline; padding: 5px 0; border-top: 1px solid var(--line); }
.changed-files li:first-child { border-top: 0; }
.diffstat { margin-left: auto; font: 600 .8rem ui-monospace, Menlo, monospace; white-space: nowrap; }
.diffstat .plus { color: var(--add-ink); } .diffstat .minus { color: var(--del-ink); }
details.exact > summary { font-weight: 600; color: var(--accent); }
.diff-file { border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; overflow: hidden; }
.diff-file > summary { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; padding: 8px 10px; background: var(--surface-2); }
.diff { font: .78rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-x: auto; max-height: 520px; overflow-y: auto; }
.dl { white-space: pre-wrap; overflow-wrap: anywhere; padding: 0 10px 0 1.8em; text-indent: -1.4em; }
.dl .sign { display: inline-block; width: 1.4em; text-align: center; opacity: .7; user-select: none; }
.dl.add { background: var(--add-bg); color: var(--add-ink); }
.dl.del { background: var(--del-bg); color: var(--del-ink); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--del-ink) 40%, transparent); }
.dl.ctx { color: var(--muted); }
.dl.hunk { color: var(--muted); background: var(--surface-2); font-style: italic; padding: 4px 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.decide { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.decide button { flex: 1 1 auto; }
/* Section menu (admin and studio) */
.admin-nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 0 14px; padding-bottom: 2px; }
.admin-nav a { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); text-decoration: none; font-size: .85rem; font-weight: 600; }
.admin-nav a.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Classification picker (accepting a request) */
.kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 6px 0 12px; }
.kinds label { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer; font-weight: 500; }
.kinds label strong { font-size: .95rem; }
.kinds label span { font-size: .8rem; color: var(--muted); font-weight: 400; }
.kinds input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.kinds label:has(input:checked) { border: 2px solid var(--accent); background: var(--accent-soft); }
.kinds label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.want-btn.on { border-color: var(--ok); color: var(--ok); }

/* Admin → Deploy */
.deploy-log { max-height: 280px; overflow: auto; font-size: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px; white-space: pre-wrap; }
.warn-text { color: var(--danger); }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list > li + li { margin-top: 10px; }

/* Hosted preview box (review panel and the studio's requests) */
.preview-box { border: 1px dashed #7a3cff; border-radius: 12px; padding: 10px 12px; margin-top: 12px; }
.preview-box .row { justify-content: space-between; }
.preview-box button.primary { background: #7a3cff; border-color: #7a3cff; color: #fff; }

/* People, Roles, Features */
.people .person { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; flex-wrap: wrap; }
.person-actions { gap: 6px; }
.role-picks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px; }
.role-picks label, .perm-list label, .feature-row label { color: var(--text); font-weight: 500; font-size: .95rem; display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.role-picks input, .perm-list input { width: auto; min-height: 0; margin-top: 3px; }
.role-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; align-items: start; }
.role-cards .card + .card { margin-top: 0; }
.perm-list { list-style: none; margin: 0; padding: 0; }
.perm-list li { padding: 8px 0; border-top: 1px solid var(--line); }
.perm-list li:first-child { border-top: 0; }
.changed-dot { color: var(--accent); font-size: .7rem; vertical-align: middle; }
.feature-row { padding: 12px 0; }
.feature-row label { align-items: center; }
input.switch { appearance: none; -webkit-appearance: none; flex: none; width: 46px; min-height: 0; height: 28px; padding: 0; border-radius: 999px; background: var(--line); border: 0; position: relative; cursor: pointer; transition: background .15s; }
input.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: left .15s; }
input.switch:checked { background: var(--ok); }
input.switch:checked::after { left: 21px; }
input.switch:disabled { opacity: .6; }

/* ---------- Studio colors (custom_themes) ---------- */
.color-pick { display: flex; gap: 12px; align-items: center; }
.color-pick input[type=color] { width: 56px; height: 44px; padding: 2px; border-radius: 10px; cursor: pointer; flex: none; }
.color-pick input[type=text] { width: 7.5em; font-family: ui-monospace, monospace; }
.harmonies { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.harmony { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.harmony .dots { display: flex; gap: 4px; }
.dot { width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); display: inline-block; }
button.dot { min-height: 0; padding: 0; }
.theme-sample { border-radius: var(--radius); border: 1px solid; padding: 14px; }
.theme-sample + .theme-sample { margin-top: 10px; }
.theme-sample .s-card { border-radius: 10px; border: 1px solid; padding: 10px 12px; margin-top: 8px; }
.theme-sample .s-btn { display: inline-block; padding: 8px 14px; border-radius: 10px; font-weight: 600; margin-top: 8px; }
.theme-sample .s-pot { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; }

/* ---------- Public website (server/src/site/render.js) ---------- */
body.site { padding-bottom: 0; display: flex; flex-direction: column; }
.preview-banner { background: #7a3cff; color: #fff; padding: 8px 14px; font: 600 14px/1.35 system-ui, sans-serif; text-align: center; }
.site-nav { display: flex; gap: 4px; max-width: 760px; width: 100%; margin: 0 auto; padding: 8px 16px 0; overflow-x: auto; scrollbar-width: none; }
.site-nav a { flex: none; padding: 6px 12px; border-radius: 999px; color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem; }
.site-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.site-main { flex: 1; width: 100%; }
.site-hero { padding: 20px 0 4px; }
.site-hero h1 { font-size: 2.1rem; margin-bottom: .2em; }
.lead { font-size: 1.15rem; color: var(--muted); margin: 0; }
.prose { line-height: 1.6; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h2, .prose h3, .prose h4 { margin-top: 1.2em; }
.announcement h3 { margin-top: 0; }
.announcement.pinned { border-left: 4px solid var(--accent-2); }
.announcement .muted.small { margin: 8px 0 0; }
.post-card { padding: 14px 0; border-top: 1px solid var(--line); }
.post-card:first-of-type { border-top: 0; }
.post-card h3 { margin: 0 0 2px; font-size: 1.15rem; }
.post-card h3 a { color: var(--text); text-decoration: none; }
.post-card h3 a:hover { color: var(--accent); }
.post-card p { margin: 4px 0 0; }
.post h1 { font-size: 2rem; margin-bottom: .1em; }
.post .prose { font-size: 1.05rem; margin-top: 16px; }
.site-facts { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.site-foot { border-top: 1px solid var(--line); margin-top: 32px; padding: 16px; text-align: center; font-size: .9rem; }
.site-foot p { margin: 4px 0; overflow-wrap: anywhere; }

/* Editing the website (web/js/views/website.js) */
.editor textarea { min-height: 220px; font-family: var(--font); line-height: 1.5; }
.edit-preview { border: 1px dashed var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface); }
