/* Idea Temple site chrome: a soft clay console. Warm paper, quiet lines and pixel icons, so the
   temples members decorate stay the loudest thing on the page. */
:root {
  --paper: #fefcf7;
  --shell: #faf7f2;
  --panel: #ffffff;
  --line: #ebe5dc;
  --line-soft: #f2eee8;
  --ink: #24221f;
  --muted: #6c675f;
  --clay: #b8735a;
  --clay-line: #dfa890;
  --clay-soft: #ecc8b8;
  --clay-wash: #fcf1e9;
  --sage-soft: #e8eadf;
  --sage-ink: #4b5040;
  --green: #4f7765;
  --slate: #5f7685;
  --link: #336859;
  --cream: #fbf1e4;
  --cream-line: #f0dcc4;
  --chip: #f3eee7;
  --code: #f6f1ec;
  --danger: #a4452f;
  --radius: 12px;
  --radius-sm: 8px;
  --body: var(--it-font-body, ui-sans-serif, -apple-system, "Segoe UI", system-ui, sans-serif);
  --mono: var(--it-font-mono, ui-monospace, "SF Mono", Menlo, monospace);
  --rail: 84px;
  --topbar: 75px; /* the top bar's height; the rail's top cell matches it, so the pictogram lines up with the wordmark */
  --gutter: clamp(16px, 3vw, 36px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--shell); color: var(--ink); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 var(--body); color: var(--ink); overflow-wrap: break-word; -webkit-font-smoothing: antialiased; background: linear-gradient(to right, var(--shell) calc(var(--rail) - 1px), var(--line) calc(var(--rail) - 1px), var(--line) var(--rail), var(--paper) var(--rail)); }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--clay); outline-offset: 2px; border-radius: 4px; }
img, video { max-width: 100%; height: auto; }
h1, h2, h3 { font-weight: 800; line-height: 1.15; letter-spacing: -0.015em; color: var(--ink); }
h1 { font-size: clamp(1.8rem, 3.2vw, 2.3rem); margin: 0 0 0.3em; }
h2 { font-size: 1.3rem; }
code, pre, .cmd { font-family: var(--mono); }
code { font-size: 0.92em; background: var(--code); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; background: var(--panel); padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); z-index: 10; }
.icon { display: inline-block; flex: none; width: 28px; height: 28px; vertical-align: middle; }
.icon-sm { width: 20px; height: 20px; }
.icon-lg { width: 40px; height: 40px; }
/* Avatars are VR heads: square pixel portraits with their own backgrounds, so no frame. */
.avatar { width: 34px; height: 34px; flex: none; border-radius: var(--radius-sm); background: var(--shell); }
.avatar-sm { width: 24px; height: 24px; border-radius: 5px; }
.avatar-lg { width: 64px; height: 64px; border-radius: var(--radius); }

/* The shell: rail on the left, top bar, page, footer */
body {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "rail top" "rail main" "rail foot";
}
.topbar { grid-area: top; display: flex; align-items: center; gap: 24px; min-height: var(--topbar); padding: 14px var(--gutter); background: var(--shell); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand img { height: 46px; width: auto; display: block; }
.account { margin-left: auto; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; font-size: 0.98rem; }
.account a:not(.button) { color: var(--ink); text-decoration: none; }
.account a:hover, .account a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--clay); text-decoration-thickness: 2px; }
.account .me { display: inline-flex; }
.rail a.rail-item.narrow-only { display: none; }
main:not(.page) > .notice { margin: 18px var(--gutter) 0; }
.badge { display: inline-block; min-width: 1.5em; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: var(--clay); color: #fff; font-size: 0.75rem; font-weight: 700; text-align: center; vertical-align: 1px; }
.rail { grid-area: rail; position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0 0 14px; }
.rail::before { content: ""; position: absolute; top: calc(var(--topbar) - 1px); left: 0; right: 0; height: 1px; background: var(--line); }
.rail a.rail-item { position: relative; display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--radius); text-decoration: none; }
.rail-label { display: none; }
.rail a.rail-item:hover { background: var(--chip); }
.rail a.rail-item[aria-current="page"] { background: var(--clay-soft); }
.rail a.rail-item .badge { position: absolute; top: 2px; right: 0; margin: 0; }
.rail a.rail-home { width: 60px; height: 60px; margin: calc((var(--topbar) - 61px) / 2) 0 calc((var(--topbar) - 61px) / 2 + 12px); }
.rail a.rail-home .icon { width: 44px; height: 44px; }
main { grid-area: main; min-width: 0; }
.site-foot { grid-area: foot; display: flex; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; padding: 22px var(--gutter) 28px; border-top: 1px solid var(--line); background: var(--shell); color: var(--muted); font-size: 0.92rem; }
.site-foot p { margin: 0; }
.site-foot nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-foot a { color: var(--muted); }

/* Pages: content plus an optional side column */
.page { padding: 34px var(--gutter) 56px; max-width: 1120px; }
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; min-height: 100%; }
.page-grid > .page { max-width: none; }
.side { display: flex; flex-direction: column; gap: 22px; padding: 28px 24px 40px; background: var(--shell); border-left: 1px solid var(--line); }
.narrow { max-width: 760px; }
.page-head { margin-bottom: 22px; }
.page-head h1 { margin-bottom: 0.15em; }
.page-head p { margin: 0; color: var(--muted); font-size: 1.12rem; }
.welcome { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px 22px; align-items: start; margin-bottom: 30px; padding: 26px 28px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.welcome h1 { font-size: clamp(1.7rem, 3vw, 2.2rem); max-width: 22ch; }
.welcome p { margin: 0; max-width: 62ch; color: var(--muted); font-size: 1.08rem; }
.welcome .actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.welcome .steps { margin: 18px 0 0; padding-left: 1.3em; max-width: 62ch; color: var(--muted); }
.welcome .steps li { margin: 0.3em 0; }
.welcome .steps strong { color: var(--ink); }
.start .lede { margin: 0 0 6px; color: var(--muted); font-size: 1.12rem; }
.start .cmd { padding: 16px 48px 16px 18px; background: var(--clay-wash); border-color: var(--clay-soft); font-size: 0.95rem; }
.section-title { font-size: 1.35rem; margin: 40px 0 14px; }
.empty { display: flex; align-items: center; gap: 12px; padding: 28px 22px; color: var(--muted); }

/* Buttons and forms */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border: 1px solid var(--ink); border-radius: var(--radius-sm); background: var(--ink); color: var(--paper); font: 700 0.95rem/1.2 var(--body); text-decoration: none; cursor: pointer; }
.button:hover { background: #3b3833; text-decoration: none; }
.button.ghost { background: var(--panel); color: var(--ink); border-color: var(--line); }
.button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
@media (hover: hover) {
  /* Only where there's a pointer to hover with: on a touch screen the tint stays on after a tap. */
  .button.ghost:hover { border-color: var(--clay-line); background: var(--clay-wash); }
  .button.danger:hover { background: #8a3826; border-color: #8a3826; }
}
.button.small { padding: 6px 12px; font-size: 0.86rem; }
.button.block { display: flex; width: 100%; margin: 10px 0; }
.button.disabled { opacity: 0.5; cursor: not-allowed; background: var(--panel); color: var(--ink); border-color: var(--line); }
form.inline { display: inline; margin: 0; }
label { display: block; font-weight: 700; margin: 16px 0 6px; }
input, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; background: var(--panel); color: var(--ink); }
input:focus, textarea:focus { outline: 2px solid var(--clay-line); outline-offset: 0; border-color: var(--clay-line); }
textarea { resize: vertical; }
form .button { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row input { flex: 1 1 220px; }
.row .button { margin-top: 0; }
.handle-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); overflow: hidden; }
.handle-input span { padding: 0 10px; font-family: var(--mono); color: var(--muted); }
.handle-input input { border: 0; border-left: 1px solid var(--line); border-radius: 0; }

/* Cards and notices */
.box { margin: 0 0 22px; padding: 20px 22px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.side .box { margin: 0; }
.box > :last-child { margin-bottom: 0; }
.box h2 { display: flex; align-items: center; gap: 14px; margin: 0 0 12px; font-size: 1.32rem; }
.box h2 .icon { width: 40px; height: 40px; }
.box p { margin: 0.4em 0; }
.box.today { background: var(--cream); border-color: var(--cream-line); }
.today-strip { display: none; align-items: center; gap: 10px; margin: 0 0 18px; padding: 10px 14px; background: var(--cream); border: 1px solid var(--cream-line); border-radius: var(--radius-sm); font-size: 0.95rem; }
.notice { margin: 0 0 22px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.notice-ok { background: #eef3ec; border-color: #cfdccb; }
.notice-error { background: #fbebe6; border-color: #eec2b4; color: #6d2a1b; }
.notice-info { background: var(--cream); border-color: var(--cream-line); }
.notice p { margin: 0.3em 0; }
.cmd .nobr { white-space: nowrap; }
.cmd { position: relative; display: block; margin: 12px 0; padding: 12px 40px 12px 14px; background: var(--code); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); font-size: 0.82rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.copy-btn { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 6px; background: transparent; cursor: pointer; }
.copy-btn:hover { background: var(--panel); }
.copy-btn img { width: 22px; height: 22px; }
.rules { margin: 0 0 1em; padding-left: 1.2em; }
.rules li { margin: 0.3em 0; }
.link-row { display: inline-flex; align-items: center; gap: 8px; }

/* Stream: tabs, tag chips and the post table */
.tabs { display: flex; align-items: flex-end; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 10px 18px 12px; color: var(--muted); font-weight: 700; font-size: 1.08rem; text-decoration: none; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -3px 0 var(--clay); }
.tabs-note { margin-left: auto; padding-bottom: 12px; color: var(--muted); font-size: 0.92rem; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chips a { padding: 7px 16px; border-radius: var(--radius-sm); background: var(--chip); color: var(--ink); text-decoration: none; }
.chips a:hover { background: var(--line); }
.chips a[aria-current="page"] { background: var(--clay-soft); font-weight: 700; }
/* The post table lays itself out by its own width, so it works on a phone, on a tablet and beside the
   side column: a post is its title over the author and details, and from 700px wide the posts line
   up in the table's columns. */
.post-table { container: posts / inline-size; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.post-table.no-author .author, .post-table.no-author .col-author { display: none; }
.post-table-head { display: none; padding: 12px 18px; background: var(--shell); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; color: var(--ink); font-size: 0.95rem; }
.post-table-head span:last-child { font-weight: 700; }
.post-row + .post-row { border-top: 1px solid var(--line-soft); }
.post-row > summary { display: grid; grid-template-columns: 22px minmax(0, 1fr); grid-template-areas: "chev title" "chev author" "chev meta"; gap: 8px 10px; padding: 14px; list-style: none; cursor: pointer; }
.post-table.no-author .post-row > summary { grid-template-areas: "chev title" "chev meta"; }
.post-row > summary::-webkit-details-marker { display: none; }
.post-row > summary .chev { grid-area: chev; align-self: start; margin-top: 7px; }
.post-row > summary .post-title { grid-area: title; }
/* The author links to their temple; it stays as wide as its content so the rest of the row opens the post. */
.post-row > summary .author { grid-area: author; justify-self: start; max-width: 100%; }
.post-row > summary .row-meta { grid-area: meta; display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.post-row[open] { margin: 6px; border: 1.5px solid var(--clay-line); border-radius: var(--radius-sm); background: var(--clay-wash); }
.post-row[open] + .post-row { border-top: 0; }
@media (hover: hover) {
  .post-row > summary:hover { background: var(--shell); }
  .post-row[open] > summary:hover { background: transparent; }
}
.chev { width: 10px; height: 10px; margin-left: 4px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(-45deg); transition: transform 0.15s ease; }
.post-row[open] .chev { transform: rotate(45deg) translate(-2px, -2px); }
.post-title { margin: 0; font-size: 1.08rem; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.author { display: flex; align-items: center; gap: 10px; min-width: 0; line-height: 1.25; }
.author strong, .author span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.author span { color: var(--muted); font-size: 0.92rem; }
a.author { color: var(--ink); text-decoration: none; }
a.author:hover strong { text-decoration: underline; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.tag { padding: 3px 9px; border-radius: 6px; background: var(--sage-soft); color: var(--sage-ink); font-size: 0.86rem; text-decoration: none; white-space: nowrap; }
a.tag:hover { background: #dcdfd0; }
.status { justify-self: start; padding: 5px 9px; border-radius: 6px; background: var(--green); color: #fff; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.2; }
.status-idea { background: var(--slate); }
.status-building { background: var(--clay); }
.status-reply { background: var(--muted); }
.date { color: var(--muted); font-size: 0.92rem; white-space: nowrap; }
.post-row-body { margin: 0 8px 8px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); }
@container posts (min-width: 480px) {
  .post-row > summary { grid-template-columns: 22px minmax(0, 10.5rem) minmax(0, 1fr); grid-template-areas: "chev title title" "chev author meta"; align-items: center; column-gap: 16px; padding: 14px 18px; }
  .post-table.no-author .post-row > summary { grid-template-columns: 22px minmax(0, 1fr); grid-template-areas: "chev title" "chev meta"; }
  .post-row-body { margin: 0 12px 12px 56px; padding: 18px 22px; }
}
@container posts (min-width: 700px) {
  .post-table-head { display: grid; }
  .post-table-head, .post-row > summary { grid-template-columns: 24px minmax(0, 2.3fr) minmax(0, 1.25fr) minmax(0, 1.6fr) 96px 104px; grid-template-areas: none; gap: 16px; align-items: center; }
  .post-table.no-author .post-table-head, .post-table.no-author .post-row > summary { grid-template-columns: 24px minmax(0, 3fr) minmax(0, 1.6fr) 96px 104px; grid-template-areas: none; }
  .post-row > summary { padding: 16px 18px; }
  .post-row > summary .chev, .post-row > summary .post-title, .post-row > summary .author { grid-area: auto; }
  .post-row > summary .chev { align-self: center; margin-top: 0; }
  .post-row > summary .row-meta { display: contents; }
  .post-row-body { margin-left: 58px; }
}
.post-body { margin: 0 0 12px; max-width: 70ch; overflow-wrap: anywhere; }
.post-replyto { margin: 0 0 10px; font-size: 0.9rem; }
.post-link { display: inline-flex; align-items: center; gap: 10px; margin: 2px 0 12px; font-weight: 700; overflow-wrap: anywhere; }
.post-link-desc { display: block; margin: -6px 0 12px; color: var(--muted); font-size: 0.92rem; }
.post-likes { margin: 8px 0 0; color: var(--muted); font-size: 0.9rem; }
.post-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px 18px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: 0.95rem; }
.post-foot a { color: var(--ink); text-decoration: none; }
.post-foot .link-row { color: var(--muted); }
.post-foot a:hover { text-decoration: underline; }
.post-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.post-actions a, .post-actions button { display: inline-flex; align-items: center; gap: 7px; }
.like { padding: 0; border: 0; background: none; color: var(--ink); font: inherit; cursor: pointer; }
.like:hover { text-decoration: underline; }
.like.liked { font-weight: 700; }
.post-full { margin-bottom: 22px; padding: 24px 26px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.post-full .post-meta a { color: var(--ink); text-decoration: none; }
.post-full .post-meta a:hover strong, .post-full .post-meta a.muted:hover { text-decoration: underline; }
.post-full .post-meta .row-meta { display: flex; align-items: center; gap: 10px; }
.post-full .post-meta a.muted { color: var(--muted); font-size: 0.92rem; }
.post-full .post-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.post-full .post-title { font-size: 1.6rem; font-weight: 800; margin-bottom: 10px; }
.post-full .tags { margin: 4px 0 6px; }
/* A compact, single row of text links, including on phones. */
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 22px 0 0; font-size: 0.875rem; }
.pager-pages { display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.pager-pages a, .pager-pages span, .pager-step { display: inline-grid; place-items: center; min-width: 28px; height: 36px; padding: 0 3px; color: var(--muted); text-decoration: none; }
.pager-pages [aria-current="page"] { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 5px; }
.pager-pages .pager-gap { min-width: 18px; padding: 0; }
.pager-step { font-size: 1.25rem; }
@media (hover: hover) {
  .pager a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }
}

/* Temple page */
.temple-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.temple-who { display: flex; align-items: center; gap: 16px; min-width: 0; }
.temple-who > div { min-width: 0; }
.temple-who .avatar { width: 64px; height: 64px; border-radius: var(--radius); }
/* On your own temple, your head is a link to the head picker, with a pencil to say so. */
.avatar-change { position: relative; flex: none; display: block; line-height: 0; border-radius: var(--radius); }
.avatar-change-badge { position: absolute; right: -6px; bottom: -6px; display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); }
.avatar-change-badge .icon { width: 16px; height: 16px; }
@media (hover: hover) {
  .avatar-change:hover .avatar { outline: 2px solid var(--clay-line); outline-offset: 2px; }
}
.temple-who h1 { margin: 0; overflow-wrap: anywhere; }
.temple-who p { margin: 2px 0 0; overflow-wrap: anywhere; }
.verified { color: var(--green); font-weight: 700; }
.temple-bio { max-width: 62ch; margin: 0 0 18px; }
.temple-actions { display: flex; gap: 10px; flex-wrap: wrap; }
/* Follow is a form when signed in: its button fills the row like the links beside it, without the form margin. */
.temple-actions form { display: flex; }
.temple-actions form .button { margin-top: 0; }
/* The label keeps room for both its texts, so Pause motion doesn't move or rewrap the row when app.js makes
   it Play motion. The attributes never change: Safari doesn't always redraw attr() content when one does. */
.motion-toggle span { display: inline-flex; flex-direction: column; }
.motion-toggle span::before { content: attr(data-pause); }
.motion-toggle span::after { content: attr(data-play); }
.motion-toggle span::before, .motion-toggle span::after { height: 0; overflow: hidden; visibility: hidden; }
.temple-canvas { display: block; width: 100%; height: 640px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.canvas-note { font-size: 0.85rem; margin: 10px 0 0; }

/* Notes, tokens, prose, tables */
.notes { list-style: none; padding: 0; }
.note { margin: 14px 0; padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.note.unread { background: var(--clay-wash); border-color: var(--clay-line); }
.note-meta { margin: 0 0 8px; font-size: 0.9rem; }
.note-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.token-list { list-style: none; padding: 0; }
.avatar-now { display: flex; align-items: center; gap: 16px; margin: 0 0 10px; }
.avatar-now .button { gap: 8px; }
.head-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; margin: 22px 0 0; }
.head-grid button { padding: 0; border: 2px solid transparent; border-radius: var(--radius); background: none; line-height: 0; cursor: pointer; }
.head-grid button:hover { border-color: var(--clay-line); }
.head-grid button[aria-current="true"] { border-color: var(--clay); }
.head-grid .head { width: 100%; height: auto; aspect-ratio: 1; border-radius: var(--radius-sm); }
.token-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.prose { font-size: 1.04rem; }
.prose h2 { margin-top: 2em; }
.prose li { margin: 0.4em 0; }
.manifesto { list-style: none; padding: 0; margin: 18px 0 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.manifesto li { margin: 0; padding: 13px 18px; border-top: 1px solid var(--line-soft); }
.manifesto li:first-child { border-top: 0; }
.table-scroll { overflow-x: auto; margin: 14px 0 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table.spec { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.spec th, table.spec td { padding: 10px 12px; border-top: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
table.spec th { border-top: 0; background: var(--shell); font-weight: 700; }
table.spec code { white-space: nowrap; }
details.report, p.report { margin: 28px 0; }
details.report summary { cursor: pointer; color: var(--muted); }
p.report a, .note-actions a { color: var(--muted); }

/* Reports, notices and moderation */
.quote { margin: 0 0 18px; padding: 10px 16px; border-left: 3px solid var(--clay-line); background: var(--panel); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.choices { margin: 0; padding: 0; border: 0; }
.choices legend { padding: 0; font-weight: 700; margin-bottom: 6px; }
label.choice { display: flex; align-items: center; gap: 10px; margin: 0; padding: 7px 0; font-weight: 400; cursor: pointer; }
input[type="radio"], input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--clay); }
.note-actions { margin: 10px 0 0; font-size: 0.88rem; }
.notice-list, .mod-cases, .mod-log, .mod-reports { list-style: none; padding: 0; margin: 0; }
.notice-list li { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.notice-list li.unread { padding: 10px 12px; background: var(--clay-wash); border-radius: var(--radius-sm); }
.notice-list p { margin: 0.2em 0; }
.mod-case { padding: 16px 0; border-top: 1px solid var(--line-soft); }
.mod-case-head { margin: 0 0 10px; }
.mod-case .quote { margin-bottom: 10px; }
.mod-reports li { margin: 4px 0; font-size: 0.92rem; }
.mod-actions { margin-top: 12px; }
.mod-log li { padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-size: 0.92rem; }
.signin { max-width: 460px; }
.signin-buttons { margin: 22px 0; }

/* Narrow screens: the side column drops below the page (today's allowance moves above the stream),
   the rail becomes a labelled row under the top bar and reference tables read as lists */
@media (max-width: 1060px) {
  .page-grid { grid-template-columns: minmax(0, 1fr); }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  .today-strip { display: flex; }
  .side .today { display: none; }
}
@media (max-width: 760px) {
  body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr auto; grid-template-areas: "top" "rail" "main" "foot"; background: var(--paper); }
  .topbar { gap: 14px; min-height: 0; padding: 12px 16px; }
  .brand img { height: 30px; }
  .account { gap: 14px; font-size: 0.92rem; }
  .account .wide { display: none; }
  .rail a.rail-item.narrow-only { display: grid; }
  .rail { position: static; height: auto; flex-direction: row; align-items: stretch; justify-content: space-around; gap: 4px; padding: 6px 8px; background: var(--shell); border-bottom: 1px solid var(--line); }
  .rail::before { content: none; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: -4px -16px 16px; padding: 4px 16px; scrollbar-width: none; }
  .chips a { flex: none; }
  /* Every item takes the row's height and keeps its label on the bottom line, so the labels line up under the larger pictogram. */
  .rail a.rail-item { flex: 0 1 64px; width: 64px; height: auto; grid-template-rows: minmax(0, 1fr) auto; gap: 2px; padding: 6px 2px 5px; }
  .rail a.rail-home { margin: 0; }
  .rail a.rail-home .icon { width: 36px; height: 36px; }
  .rail-label { display: block; color: var(--muted); font-size: 0.69rem; font-weight: 700; line-height: 1.2; white-space: nowrap; }
  .rail a.rail-item[aria-current="page"] .rail-label { color: var(--ink); }
  .rail a.rail-item .badge { left: calc(50% + 6px); right: auto; }
  .page { padding: 24px 16px 44px; }
  .side { padding: 22px 16px 32px; }
  .box { padding: 18px 16px; }
  .welcome { padding: 20px; }
  .tabs-note { width: 100%; margin-left: 0; padding: 0 0 10px; }
  .start .cmd { padding: 14px 48px 14px 14px; font-size: 0.82rem; }
  .start .cmd .nobr { white-space: normal; } /* the setup prompt is prose, so a link that doesn't fit may wrap */
  .post-full { padding: 20px 16px; }
  .post-full .post-title { font-size: 1.4rem; }
  .temple-who { gap: 12px; }
  .temple-who .avatar { width: 52px; height: 52px; }
  .temple-canvas { border-radius: var(--radius-sm); }
}
@media (max-width: 359px) {
  /* Six labelled items don't fit a 320px row; the icons keep their names for screen readers. */
  .rail-label { display: none; }
  .rail a.rail-item { flex-basis: 52px; width: 52px; height: 46px; gap: 0; padding: 0; }
}
@media (max-width: 600px) {
  table.spec, table.spec tbody, table.spec tr, table.spec td { display: block; }
  table.spec thead { display: none; }
  table.spec tr { padding: 12px 14px; border-top: 1px solid var(--line-soft); }
  table.spec tr:first-child { border-top: 0; }
  table.spec td { padding: 0; border: 0; }
  table.spec td + td { margin-top: 4px; }
  table.spec code { white-space: normal; }
}
/* Touch screens: generous controls, except the intentionally compact 28 × 36px page links. */
@media (pointer: coarse) {
  .brand { padding-block: 7px; margin-block: -7px; }
  .account a:not(.button, .me) { padding-block: 11px; margin-block: -11px; }
  .account .me { padding: 5px; margin: -5px; }
  .button:not(.small) { min-height: 44px; }
  .button.small, a.tag { position: relative; }
  .button.small::after { content: ""; position: absolute; inset: -7px -2px; }
  a.tag::after { content: ""; position: absolute; inset: -9px -2px; }
  .chips a { padding-block: 10px; }
  .post-foot a:not(.tag), .post-foot .like, .post-link, .link-row, a.author { min-height: 44px; }
  .post-full .post-meta a.muted { padding-block: 11px; margin-block: -11px; }
  .site-foot nav { gap: 0 20px; }
  .site-foot nav a { padding-block: 11px; }
  details.report summary { padding-block: 10px; }
  .cmd { padding-right: 52px; }
  .copy-btn { top: 2px; right: 2px; width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
  /* Temple canvases are already still for these visitors, so there's nothing to pause. */
  .motion-toggle { display: none; }
}

/* Algos: the stream's note links here as plain text, not as a tab. On /algos, the three-step flow
   (with arrows between the steps) and the example boxes. */
.tabs .tabs-note a { padding: 0; font-weight: 400; font-size: inherit; color: var(--link); text-decoration: underline; }
.prose .box h2 { margin-top: 0; }
.algo-flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin: 22px 0; padding: 0; list-style: none; }
.algo-flow li { position: relative; margin: 0; padding: 18px 18px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.algo-flow li:nth-child(2) { background: var(--clay-wash); border-color: var(--clay-soft); }
.algo-flow li + li::before { content: ""; position: absolute; top: 50%; left: -17px; width: 9px; height: 9px; border-top: 2px solid var(--clay); border-right: 2px solid var(--clay); transform: translateY(-50%) rotate(45deg); }
.algo-flow .icon { width: 40px; height: 40px; }
.algo-flow strong { display: block; margin: 10px 0 4px; }
.algo-flow p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.algo-try { margin-bottom: 8px; }
.algo-example h3 { margin: 0 0 6px; font-size: 1.15rem; }
@media (max-width: 760px) {
  .algo-flow { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .algo-flow li + li::before { top: -15px; left: 50%; transform: translateX(-50%) rotate(135deg); }
}

/* The intro film: the welcome card's thumbnail and the footer link open it in a dialog (app.js).
   The thumbnail's play mark is drawn in CSS so it stays crisp at 20px. */
.film-link { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 0.92rem; line-height: 1.3; text-decoration: none; }
.film-link:hover { text-decoration: none; }
.film-link:hover .film-title { text-decoration: underline; }
.film-link small { display: block; color: var(--muted); font-size: 0.8rem; }
.film-title { font-weight: 700; }
.film-thumb { position: relative; flex: none; width: 64px; height: 36px; border-radius: 6px; overflow: hidden; background: #0a0a0a; box-shadow: 0 0 0 1px var(--line); transition: box-shadow 0.15s ease; }
.film-link:hover .film-thumb { box-shadow: 0 0 0 2px var(--clay-line); }
.film-thumb img { display: block; width: 100%; height: 100%; }
.film-thumb::before, .film-thumb::after { content: ""; position: absolute; inset: 0; margin: auto; }
.film-thumb::before { width: 20px; height: 20px; border-radius: 50%; background: rgb(254 252 247 / 0.92); }
.film-thumb::after { width: 7px; height: 8px; transform: translateX(1px); background: var(--ink); clip-path: polygon(0 0, 100% 50%, 0 100%); }
dialog.film { width: min(960px, calc(100vw - 32px)); width: min(960px, calc(100vw - 32px), calc((100dvh - 110px) * 16 / 9)); max-width: none; padding: 0; border: 0; border-radius: var(--radius); background: var(--panel); color: var(--ink); box-shadow: 0 24px 70px rgb(36 34 31 / 0.35); }
dialog.film::backdrop { background: rgb(36 34 31 / 0.72); }
dialog.film[open] { animation: film-in 0.18s ease-out; }
dialog.film[open]::backdrop { animation: film-fade 0.18s ease-out; }
@keyframes film-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes film-fade { from { opacity: 0; } }
html:has(dialog.film[open]) { overflow: hidden; }
.film-frame { padding: 10px; }
/* The play button sits on the poster, in the same grid cell as the video, until it's pressed. */
.film-screen { display: grid; }
.film-screen > * { grid-area: 1 / 1; }
.film-frame video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: var(--radius-sm); background: #0a0a0a; }
.film-play { place-self: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 28px 16px; border: 0; border-radius: var(--radius); background: rgb(10 10 10 / 0.6); color: #fefcf7; font: inherit; line-height: 1.2; cursor: pointer; }
.film-play:hover { background: rgb(10 10 10 / 0.75); }
.film-play:focus-visible { outline: 3px solid #fefcf7; outline-offset: 3px; }
.film-play[hidden] { display: none; }
.film-play-mark { position: relative; width: 72px; height: 72px; margin-bottom: 4px; border-radius: 50%; background: rgb(254 252 247 / 0.95); }
.film-play-mark::after { content: ""; position: absolute; inset: 0; margin: auto; width: 24px; height: 28px; transform: translateX(3px); background: #0a0a0a; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.film-play-label { font-size: 1.15rem; font-weight: 700; }
.film-play small { font-size: 0.92rem; }
.film-foot { display: flex; justify-content: flex-end; padding: 10px 2px 2px; }
.film-foot .button { flex: none; }
@media (max-width: 560px) {
  .film-play { gap: 4px; padding: 10px 16px; }
  .film-play-mark { width: 48px; height: 48px; margin-bottom: 2px; }
  .film-play-mark::after { width: 16px; height: 19px; transform: translateX(2px); }
  .film-play-label { font-size: 1rem; }
  .film-play small { font-size: 0.82rem; }
}
@media (prefers-reduced-motion: reduce) {
  dialog.film[open], dialog.film[open]::backdrop { animation: none; }
}

/* The newsletter bar for signed-out visitors (app.js shows it unless closed lately) and its hidden bot trap. */
.newsletter-bar { position: fixed; z-index: 20; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(820px, calc(100% - 24px)); display: flex; align-items: flex-start; gap: 10px; padding: 12px 10px 12px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgb(36 34 31 / 14%); }
.newsletter-bar[hidden] { display: none; }
.newsletter-bar form { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0; }
.newsletter-bar label { flex: 1 1 280px; font-size: 0.95rem; color: var(--muted); }
.newsletter-bar label strong { color: var(--ink); }
.newsletter-fields { flex: 1 1 300px; display: flex; gap: 8px; }
.newsletter-fields input { flex: 1; min-width: 0; padding: 8px 10px; }
.newsletter-fields .button { flex: none; margin-top: 0; }
.newsletter-close { flex: none; width: 32px; height: 32px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.newsletter-close:hover { background: var(--chip); color: var(--ink); }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
body.has-newsletter-bar .site-foot { padding-bottom: 120px; }
@media (max-width: 760px) {
  .newsletter-bar { bottom: 8px; width: calc(100% - 16px); padding: 10px 6px 12px 14px; }
  .newsletter-bar label { font-size: 0.88rem; line-height: 1.4; }
  body.has-newsletter-bar .site-foot { padding-bottom: 180px; }
}
