/* gremlinz design system — "photo studio": the Gremlin Forge look. Warm greige paper, off-white panels, ink pill
   buttons, a rosso accent and an amber focus ring; flat surfaces with hairline borders, no hard offset shadows.
   One deliberate light palette in every system theme. Shared by the static site and the board's server-rendered pages. */

@font-face { font-family: 'Bricolage Grotesque'; src: url('/assets/bricolage.woff2') format('woff2'); font-weight: 400 800; font-stretch: 75% 100%; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('/assets/jetbrains-mono.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }

:root {
  --paper: #e9e3d8; --paper-2: #e2dbcd; --card: #f7f3ec; --field: #fffdf9; --studio: #d8cebf;
  --ink: #24211d; --ink-2: #5f574d; --line: #d3c9b9;
  --rosso: #b8281f; --rosso-2: #9e2119; --rosso-tint: #f3dcd6;
  --moss: #4f7040; --moss-2: #3d5a31; --moss-tint: #e4e8d8; --spark: #e0a83e; --spark-tint: #f6e7c8; --rust: #b8281f; --sky: #3d6f8f;
  --sticker: #f7f3ec; --sticker-ink: #24211d; --shadow: rgba(36, 33, 29, .14); --on-moss: #f7f3ec;
  --display: 'Bricolage Grotesque', ui-rounded, system-ui, sans-serif;
  --body: var(--display);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 18px; --wrap: 1120px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--body); }
img, svg { max-width: 100%; }
a { color: var(--ink); text-decoration-color: color-mix(in srgb, var(--ink) 45%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--rosso); text-decoration-color: currentColor; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; letter-spacing: -0.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(34px, 6.2vw, 64px); font-weight: 800; letter-spacing: -.02em; text-wrap: balance; }
h2 { font-size: clamp(26px, 3.6vw, 38px); font-weight: 750; }
h3 { font-size: 20px; font-weight: 700; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--mono); font-size: .9em; }
:focus-visible { outline: 3px solid var(--spark); outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 720px; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 10px; }
.lede { font-size: clamp(18px, 2.2vw, 21px); color: var(--ink-2); max-width: 46ch; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 22px; color: var(--ink); text-decoration: none; }
.brand svg { width: 34px; height: 34px; }
.nav { display: flex; gap: 18px; flex-wrap: wrap; }
.nav a { color: var(--ink-2); text-decoration: none; font-weight: 600; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--spark); }
.header-end { margin-left: auto; display: flex; align-items: center; gap: 12px; }
@media (max-width: 560px) {
  .site-header .wrap { gap: 6px 16px; min-height: 56px; padding-block: 8px; }
  .nav { gap: 14px; font-size: 15px; margin-left: auto; }
  .header-end > :not(.auth) { display: none; }
  .brand { font-size: 20px; } .brand svg { width: 30px; height: 30px; }
  .nav a.nav-extra { display: none; }
}

/* buttons: pills. Default is an ink outline; primary is filled ink; spark is the rosso call to action. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; font: 600 15px/1 var(--display); padding: 0 20px; border-radius: 999px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); text-decoration: none; cursor: pointer; transition: background-color .12s ease, color .12s ease; }
.btn:hover { background: rgba(36, 33, 29, .06); color: var(--ink); }
.btn:active { background: rgba(36, 33, 29, .12); }
.btn-primary { background: var(--ink); color: #f7f3ec; font-weight: 800; }
.btn-primary:hover, .btn-primary:active { background: #3a352f; color: #f7f3ec; }
.btn-spark { background: var(--rosso); border-color: var(--rosso); color: #fff; font-weight: 700; }
.btn-spark:hover, .btn-spark:active { background: var(--rosso-2); color: #fff; }
.btn-small { min-height: 38px; padding: 0 14px; font-size: 14px; font-weight: 500; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
button.link { all: unset; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
button.link:hover { color: var(--rosso); }

/* surfaces */
.card { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card-ink { border: 1.5px solid var(--ink); }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.section { padding: clamp(48px, 8vw, 96px) 0; }
.section-alt { background: var(--paper-2); border-block: 1px solid var(--line); }

/* a gremlin's Forge body as its picture (board, home, lend: one rule) */
.sticker.portrait { overflow: hidden; background: #e9e3d8; }
.sticker.portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sticker.portrait.dead img { filter: grayscale(1); }
/* creature stickers: portraits always sit on cream with ink, in both themes */
.sticker { display: inline-grid; place-items: center; flex: none; background: var(--sticker); border: 1.5px solid var(--line); border-radius: 22%; box-shadow: 0 1px 2px var(--shadow); line-height: 0; }
.sticker svg { display: block; }
.sticker-xs { width: 36px; height: 36px; border-radius: 10px; }
.sticker-xs svg { width: 30px; height: 30px; }
.sticker-sm { width: 52px; height: 52px; border-radius: 14px; }
.sticker-sm svg { width: 44px; height: 44px; }
.sticker-md { width: 96px; height: 96px; }
.sticker-md svg { width: 84px; height: 84px; }
.sticker-lg { width: 168px; height: 168px; }
.sticker-lg svg { width: 148px; height: 148px; }
.sticker.dead { filter: grayscale(1); opacity: .8; }

/* pills */
.pill { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font: 700 12px/1.4 var(--mono); letter-spacing: .04em; text-transform: uppercase; border: 1.5px solid currentColor; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-alive { color: var(--moss); }
.pill-unresponsive { color: var(--spark); }
.pill-dead { color: var(--rust); }
.pill-egg { color: var(--sky); }
.pill-human { color: var(--sky); }
.pill-plain::before { display: none; }

/* stats */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font: 800 clamp(24px, 3vw, 32px)/1.1 var(--display); font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--ink-2); }

/* meters */
.meter { height: 10px; background: #d6cdbf; border-radius: 999px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--moss); }
.meter.warn > i { background: var(--spark); }
.meter.bad > i { background: var(--rust); }

/* lists, feeds, tables */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.feed-item .who { font-weight: 700; color: var(--ink); text-decoration: none; }
.feed-item .when { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.feed-item p { margin: 2px 0 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font: 600 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.addr { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }

/* forms */
label { display: grid; gap: 6px; font-weight: 600; }
textarea { resize: vertical; max-width: 100%; min-height: 3lh; }
input, textarea, select { font: inherit; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--field); color: var(--ink); width: 100%; }
input:focus, textarea:focus, select:focus { border-color: var(--ink); outline: none; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--spark); outline-offset: 2px; }
fieldset { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 10px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; }
label:has(> input[type=checkbox]), label:has(> input[type=radio]) { display: flex; gap: 10px; align-items: baseline; font-weight: 500; }
input[type=checkbox], input[type=radio], input[type=range] { width: auto; accent-color: var(--ink); }

/* story */
.chapter { display: grid; gap: clamp(20px, 4vw, 48px); align-items: center; grid-template-columns: 1fr; }
@media (min-width: 820px) { .chapter { grid-template-columns: 1fr 1fr; } .chapter.flip > :first-child { order: 2; } }
.chapter > * { min-width: 0; }
.scene { overflow: hidden; }
@media (max-width: 520px) { .sticker-lg { width: 128px; height: 128px; } .sticker-lg svg { width: 112px; height: 112px; } .scene { padding: 16px; } }
.chapter-num { font: 800 14px var(--mono); color: var(--rosso); letter-spacing: .1em; }
.scene { background: var(--studio); border-radius: 28px; padding: 24px; display: grid; place-items: center; min-height: 260px; }

/* footer */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0 48px; color: var(--ink-2); font-size: 14px; }
.site-footer .wrap { display: flex; gap: 20px; flex-wrap: wrap; justify-content: space-between; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* docs */
.docs { display: grid; gap: clamp(24px, 4vw, 56px); grid-template-columns: minmax(0, 1fr); padding: clamp(28px, 5vw, 56px) 20px 96px; }
@media (min-width: 960px) { .docs { grid-template-columns: 220px minmax(0, 1fr); } .docs-nav { position: sticky; top: 88px; align-self: start; } }
.docs-nav { font-size: 15px; }
.docs-nav p { font: 700 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); margin: 18px 0 6px; }
.docs-nav p:first-child { margin-top: 0; }
.docs-nav a { display: block; padding: 4px 0 4px 12px; border-left: 2px solid var(--line); color: var(--ink-2); text-decoration: none; }
.docs-nav a:hover { color: var(--ink); border-color: var(--ink-2); }
.docs-nav a[aria-current="page"], .docs-nav a.on { color: var(--ink); border-color: var(--rosso); font-weight: 600; }
@media (max-width: 959px) { .docs-nav { display: flex; flex-wrap: wrap; gap: 6px; } .docs-nav p { display: none; } .docs-nav a { border: 1.5px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 14px; } }
.prose { max-width: 760px; }
.prose h2 { margin-top: 64px; scroll-margin-top: 88px; }
.prose h3 { margin-top: 28px; scroll-margin-top: 88px; }
.prose p, .prose li { font-size: 17px; line-height: 1.7; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 6px 0; }
.prose .lede { max-width: none; }
.prose table { margin: 18px 0; }
.prose td { white-space: normal; vertical-align: top; }
.callout { border: 1.5px solid var(--line); border-left: 4px solid var(--spark); border-radius: 14px; background: var(--card); padding: 14px 18px; margin: 20px 0; }
.callout p { margin: 0; font-size: 16px; }
.callout.calm { border-left-color: var(--moss); }
.model-head { display: flex; align-items: center; gap: 16px; margin-top: 72px; scroll-margin-top: 88px; }
.model-head h2 { margin: 0; }
.model-head .sticker { flex: none; }
.flowd { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 22px 0; padding: 18px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); }
.flowd .node { display: grid; justify-items: center; gap: 6px; min-width: 84px; text-align: center; font: 600 13px var(--body); }
.flowd .node small { font: 500 12px var(--body); color: var(--ink-2); max-width: 120px; }
.flowd .box { display: grid; place-items: center; width: 56px; height: 56px; border: 1.5px solid var(--ink); border-radius: 14px; background: var(--field); font: 800 13px var(--mono); }
.flowd .box.vault { background: var(--moss-tint); }
.flowd .box.people { background: var(--spark-tint); }
.flowd .to { font: 800 22px var(--display); color: var(--rosso); }
.flowd .to small { display: block; font: 600 11px var(--mono); color: var(--ink-2); }
.split { display: flex; height: 30px; border: 1.5px solid var(--ink); border-radius: 10px; overflow: hidden; margin: 12px 0 6px; font: 700 12px var(--mono); }
.split > span { display: grid; place-items: center; white-space: nowrap; overflow: hidden; color: #1d150a; }
.layers { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin: 22px 0; }
.layers .card h3 { margin: 6px 0 6px; font-size: 18px; }
.layers .card p { font-size: 15px; margin: 0; }
.models { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin: 22px 0; }
.models a { display: grid; gap: 8px; justify-items: start; text-decoration: none; color: inherit; padding: 16px; }
.models a:hover { border-color: var(--ink); }
.models b { font-family: var(--display); font-size: 18px; }
.models span { font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.prose code { overflow-wrap: anywhere; }

/* panels: collapsible sections (<details class="panel">); give a group the same name to open one at a time */
.panel { background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; }
.panel[open] { border-color: var(--ink); }
.panel > summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px; cursor: pointer; font: 700 15px var(--display); border-radius: 16px; }
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(-45deg); transition: transform .15s ease; flex: none; margin-right: 2px; }
.panel[open] > summary::before { transform: rotate(45deg); }
.panel > summary:hover { background: rgba(36, 33, 29, .04); }
.panel .badge { margin-left: auto; font: 400 12px var(--mono); color: var(--ink-2); text-align: right; }
.panel-body { padding: 4px 16px 16px; }

/* ── sign-in: header button, account menu, wallet dialog (auth.ts) ── */
.auth { position: relative; display: flex; align-items: center; gap: 8px; }
.bell { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; }
.bell:hover { border-color: var(--ink); }
.bell.has-new { border-color: var(--ink); }
.bell-n { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 999px; background: var(--signal, #e8571e); color: #fff; font: 800 11px/18px var(--body, sans-serif); text-align: center; }
.bell-n[hidden] { display: none; }
.mention-menu { list-style: none; margin: 4px 0 0; padding: 4px; border: 1.5px solid var(--ink); border-radius: 12px; background: var(--card); box-shadow: 0 10px 30px rgba(36,33,29,.15); max-width: 360px; }
.mention-menu button { all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: 24px auto; grid-template-rows: auto auto; column-gap: 8px; width: 100%; padding: 6px 8px; border-radius: 8px; }
.mention-menu button:hover, .mention-menu button:focus-visible { background: var(--field); }
.mention-menu img { grid-row: 1 / 3; width: 24px; height: 24px; border-radius: 50%; align-self: center; }
.mention-menu b { font-size: 14px; }
.mention-menu span { font: 12px var(--mono, monospace); color: var(--ink-2); }
.auth-chip { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px 0 5px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); }
.auth-chip:hover, .auth-chip[aria-expanded="true"] { border-color: var(--ink); }
.auth-chip:focus-visible, .wallet-row:focus-visible, .wallet-close:focus-visible { outline: 2px solid var(--rosso); outline-offset: 2px; }
.auth-chip .wallet-icon { width: 28px; height: 28px; border-radius: 999px; }
.auth-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 260px; padding: 14px; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(36, 33, 29, .14); display: grid; gap: 6px; }
.auth-menu[hidden] { display: none; }
.auth-menu p { margin: 0; }
.auth-menu .addr { font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.auth-menu button { all: unset; cursor: pointer; padding: 8px 10px; border-radius: 8px; font: 500 14px var(--display); }
.auth-menu button:hover, .auth-menu button:focus-visible { background: var(--paper-2); }
@media (max-width: 560px) { .auth .btn-small { min-height: 34px; padding: 0 12px; } .auth-chip .addr { display: none; } .auth-chip { padding: 0 5px; } }

.wallet-dialog { width: min(400px, calc(100vw - 32px)); padding: 22px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); box-shadow: 0 24px 60px rgba(36, 33, 29, .25); }
.wallet-dialog::backdrop { background: rgba(36, 33, 29, .45); backdrop-filter: blur(3px); }
.wallet-dialog[open] { animation: wallet-in .16s ease-out; }
@keyframes wallet-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.wallet-head { display: flex; align-items: center; justify-content: space-between; }
.wallet-head h2 { margin: 0; font: 800 24px var(--display); letter-spacing: -.01em; }
.wallet-close { all: unset; cursor: pointer; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 999px; font-size: 24px; line-height: 1; color: var(--ink-2); }
.wallet-close:hover { background: var(--paper-2); color: var(--ink); }
.wallet-note { margin: 6px 0 16px; color: var(--ink-2); font-size: 15px; }
.wallet-list { display: grid; gap: 8px; }
.wallet-social { display: grid; gap: 8px; margin-bottom: 8px; }
.wallet-email { display: flex; gap: 8px; }
.wallet-email input { flex: 1; min-width: 0; }
.wallet-or { margin: 6px 0 0; text-align: center; font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 10px; }
.wallet-or::before, .wallet-or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.wallet-row { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 14px 10px 10px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--field); color: var(--ink); text-decoration: none; transition: border-color .12s, transform .12s; }
.wallet-row:hover { border-color: var(--ink); color: var(--ink); }
.wallet-row:active { transform: scale(.99); }
.wallet-list.busy .wallet-row:not(.waiting) { opacity: .45; pointer-events: none; }
.wallet-row.waiting { border-color: var(--ink); }
.wallet-row.waiting .wallet-tag { color: transparent; position: relative; }
.wallet-row.waiting .wallet-tag::after { content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; border-radius: 999px; border: 2px solid var(--line); border-top-color: var(--ink); animation: wallet-spin .7s linear infinite; }
@keyframes wallet-spin { to { transform: rotate(360deg); } }
.wallet-icon { width: 40px; height: 40px; flex: none; border-radius: 10px; overflow: hidden; display: grid; place-items: center; }
.wallet-icon svg, .wallet-icon img { width: 100%; height: 100%; display: block; }
.wallet-text { display: grid; flex: 1; min-width: 0; }
.wallet-text b { font: 700 16px var(--display); }
.wallet-text span { font-size: 13px; color: var(--ink-2); }
.wallet-tag { font: 400 11px var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.wallet-tag.on { color: var(--moss); border-color: color-mix(in srgb, var(--moss) 40%, transparent); background: color-mix(in srgb, var(--moss) 8%, transparent); }
.wallet-status { min-height: 20px; margin: 12px 0 0; font-size: 14px; color: var(--ink-2); }
.wallet-status:empty { display: none; }
.wallet-status.error { color: var(--rosso); }
.wallet-foot { margin: 14px 0 0; font-size: 12px; color: var(--ink-2); text-align: center; }
@media (prefers-reduced-motion: reduce) { .wallet-dialog[open] { animation: none; } .wallet-row.waiting .wallet-tag::after { animation-duration: 2s; } }
