/* innumerable — calm, paper-like, built for scanning many projects at once. */
:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --ink: #1f1d19;
  --muted: #6d685e;
  --line: #e3dfd5;
  --line-strong: #cfc9bc;
  --accent: #1d6b66;
  --accent-ink: #ffffff;
  --accent-soft: #e2f0ee;
  --danger: #a5352b;
  --fresh: #4f9a6a;
  --warm: #d49a2e;
  --stale: #c0533f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 29, 25, .06), 0 2px 8px rgba(31, 29, 25, .05);
  --shadow-lift: 0 6px 24px rgba(31, 29, 25, .14);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614; --surface: #211f1c; --ink: #ece8df; --muted: #a39d91; --line: #34312c; --line-strong: #4a463f;
    --accent: #5fb3ab; --accent-ink: #0f1a19; --accent-soft: #1f3331; --danger: #e07a6e;
    --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lift: 0 8px 28px rgba(0,0,0,.5);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--sans); color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
img { max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); letter-spacing: -.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.spacer { flex: 1; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 1.2rem clamp(1rem, 3vw, 2rem) 4rem; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 1rem; padding: .6rem clamp(1rem, 3vw, 2rem); border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.brand { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: .4rem; }
.brand-mark { color: var(--accent); font-size: 1.5rem; line-height: 1; }
.topnav { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.topnav .me { display: flex; align-items: center; gap: .5rem; color: var(--ink); text-decoration: none; }
.quiet { color: var(--muted); text-decoration: none; }
.quiet:hover { color: var(--ink); }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: 500 .92rem var(--sans); padding: .5rem .95rem; border-radius: 8px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.small { padding: .3rem .65rem; font-size: .84rem; }
.btn.big { padding: .8rem 1.4rem; font-size: 1.05rem; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--bg); filter: none; }
.link-btn { background: none; border: 0; padding: .2rem .3rem; color: var(--accent); cursor: pointer; font: inherit; border-radius: 4px; }
.link-btn:hover { background: var(--accent-soft); }
.link-btn.danger, .danger { color: var(--danger); }
.file-btn { cursor: pointer; }
input, textarea, select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 7px; padding: .45rem .6rem; width: 100%; }
input:focus, textarea:focus, select:focus, .editable:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
select { width: auto; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .88rem; color: var(--muted); }
label.check, .checks label, .radios label, .group-picks label { flex-direction: row; align-items: center; gap: .45rem; color: var(--ink); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem .9rem; margin: 0; }
legend { font-size: .82rem; color: var(--muted); padding: 0 .3rem; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem .8rem; }
.radios { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .6rem; }
.group-picks { display: flex; flex-wrap: wrap; gap: .3rem .9rem; padding-left: 1.6rem; }

/* ---------- avatars & badges ---------- */
.avatar { border-radius: 50%; object-fit: cover; flex: none; width: 40px; height: 40px; }
.avatar.xs { width: 22px; height: 22px; }
.avatar.sm { width: 28px; height: 28px; }
.avatar.lg { width: 76px; height: 76px; }
.group-mark { display: grid; place-items: center; font: 600 2rem var(--serif); color: #fff; background: hsl(var(--h) 38% 42%); border-radius: 18px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .74rem; color: var(--muted); margin: 0 0 .2rem; }
.eyebrow a { color: inherit; }
.badge, .count { display: inline-block; font: 600 .72rem var(--sans); padding: .1rem .45rem; border-radius: 99px; vertical-align: middle; }
.badge { background: var(--warm); color: #fff; }
.count { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.status { display: inline-block; font-size: .74rem; font-weight: 600; padding: .12rem .5rem; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.status[data-status="paused"], .status[data-status="waiting"], .status[data-status="someday"] { background: #f3ead6; color: #8a6413; }
.status[data-status="done"] { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.status[data-status="idea"] { background: #ece6f6; color: #5a3f8c; }
.vis { font-size: .72rem; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: .08rem .45rem; }
.vis-public { color: var(--fresh); border-color: currentColor; }
.vis-groups { color: #5a6fb0; border-color: currentColor; }
.role { font-size: .72rem; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: .05rem .45rem; }
.role-first-admin { color: var(--accent); border-color: var(--accent); }
.role-admin { color: #5a6fb0; border-color: #5a6fb0; }

/* ---------- landing ---------- */
.landing .hero { max-width: 760px; margin: 8vh auto 3rem; text-align: center; }
.landing .hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 600px; margin: 0 auto 1.6rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; max-width: 1000px; margin: 0 auto; }
.features > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.features p { margin: 0; color: var(--muted); }

/* ---------- page head ---------- */
.page-head { display: flex; gap: 1.5rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin: .6rem 0 1.4rem; }
.who { display: flex; gap: 1rem; align-items: center; min-width: 0; }
.bio { color: var(--muted); max-width: 62ch; margin: .2rem 0 0; white-space: pre-line; }
.head-controls { display: flex; flex-direction: column; align-items: flex-end; gap: .55rem; }
.switch { flex-direction: row; align-items: center; gap: .6rem; cursor: pointer; color: var(--ink); font-size: .92rem; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 40px; height: 22px; border-radius: 99px; background: var(--line-strong); position: relative; transition: background .15s; }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + .track { background: var(--fresh); }
.switch input:checked + .track .thumb { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin: 1.2rem 0; }
.panel.attention { border-color: var(--warm); background: color-mix(in srgb, var(--warm) 7%, var(--surface)); }
.panel h3 { font-size: .9rem; font-family: var(--sans); color: var(--muted); margin-top: .8rem; }
details.panel summary { cursor: pointer; list-style: none; }
details.panel summary::-webkit-details-marker { display: none; }
details.panel summary h2 { display: inline; }
details.panel summary::after { content: "▸"; float: right; color: var(--muted); }
details.panel[open] summary::after { content: "▾"; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 1.2rem; }
.people { list-style: none; padding: 0; margin: .4rem 0; }
.people li { display: flex; align-items: center; gap: .55rem; padding: .45rem 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.people li:first-child { border-top: 0; }
.mini-list { list-style: none; padding: 0; margin: .3rem 0 .8rem; }
.mini-list li { padding: .3rem 0; border-top: 1px solid var(--line); }
.mini-list li:first-child { border-top: 0; }
.inline-form { display: flex; gap: .5rem; }
.empty { color: var(--muted); text-align: center; padding: 2.5rem 1rem; border: 1px dashed var(--line-strong); border-radius: var(--radius); grid-column: 1 / -1; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; position: sticky; top: 53px; z-index: 10; background: var(--bg); padding: .6rem 0; }
.new-project { display: flex; gap: .4rem; flex: 1 1 280px; max-width: 460px; }
.toolbar input[type=search] { width: 160px; }
.toolbar .sort { flex-direction: row; align-items: center; gap: .4rem; }
.section-title { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg button { background: var(--surface); border: 0; padding: .35rem .6rem; cursor: pointer; color: var(--muted); font-size: 1rem; }
.seg button.on { background: var(--accent-soft); color: var(--accent); }
.count-line { margin: 0 0 .8rem; }

/* ---------- project cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 1rem; }
.card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: box-shadow .15s, transform .15s; }
.card:hover { box-shadow: var(--shadow-lift); }
.card-media { display: block; text-decoration: none; aspect-ratio: 16 / 9; background: var(--bg); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph { display: grid; place-items: center; width: 100%; height: 100%; font: 600 2.6rem var(--serif); color: hsl(var(--h) 30% 40%); background: linear-gradient(135deg, hsl(var(--h) 40% 92%), hsl(calc(var(--h) + 40) 40% 86%)); }
@media (prefers-color-scheme: dark) { .ph { color: hsl(var(--h) 40% 75%); background: linear-gradient(135deg, hsl(var(--h) 25% 22%), hsl(calc(var(--h) + 40) 25% 18%)); } }
.drag-handle { position: absolute; top: .45rem; left: .45rem; width: 30px; height: 30px; border-radius: 7px; border: 0; background: rgba(255,255,255,.88); color: #444; font-size: 1.1rem; cursor: grab; display: none; box-shadow: var(--shadow); }
.grid.can-drag .drag-handle { display: grid; place-items: center; }
.drag-handle:active { cursor: grabbing; }
.drag-ghost { opacity: .35; }
.drag-chosen { box-shadow: var(--shadow-lift); }
.card-body { padding: .75rem .9rem .5rem; flex: 1; display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.card-top { display: flex; gap: .4rem; align-items: center; min-height: 1.2rem; }
.card-top .vis { margin-left: auto; }
.card-title { margin: 0; font-size: 1.08rem; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a:hover { color: var(--accent); }
.desc { margin: 0; color: var(--muted); font-size: .88em; white-space: pre-line; }
.stats { list-style: none; padding: 0; margin: .1rem 0 0; display: flex; flex-wrap: wrap; gap: .15rem .8rem; font-size: .78rem; color: var(--muted); }
.card-links { list-style: none; padding: 0; margin: .15rem 0 0; display: flex; flex-wrap: wrap; gap: .25rem .4rem; }
.card-links a { font-size: .78rem; background: var(--bg); border: 1px solid var(--line); border-radius: 99px; padding: .08rem .55rem; text-decoration: none; display: inline-block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staleness { height: 3px; background: var(--line); }
.staleness span { display: block; height: 100%; width: 4%; transition: width .3s; }
.card-actions { display: flex; justify-content: space-between; padding: .25rem .5rem; border-top: 1px solid var(--line); font-size: .84rem; }
.card.flash { animation: flash 1.2s ease; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: var(--shadow); } }

/* compact list view: many projects at a glance */
.grid.list-view { grid-template-columns: 1fr; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.list-view .card { flex-direction: row; align-items: center; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; padding-left: 2.6rem; min-height: 52px; }
.list-view .card:hover { background: var(--bg); box-shadow: none; }
.list-view .card-media { width: 64px; height: 40px; aspect-ratio: auto; border-radius: 5px; flex: none; margin: .35rem 0; }
.list-view .ph { font-size: 1.1rem; }
.list-view .drag-handle { top: 50%; transform: translateY(-50%); left: .4rem; box-shadow: none; background: transparent; }
.list-view .card-body { flex-direction: row; align-items: center; gap: .8rem; padding: .4rem .8rem; flex-wrap: wrap; }
.list-view .card-title { order: -1; font-size: 1rem; min-width: 180px; }
.list-view .desc { -webkit-line-clamp: 1; max-width: 40ch; flex: 1 1 200px; }
.list-view .card-top { min-height: 0; }
.list-view .card-links { display: none; }
.list-view .staleness { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; height: auto; }
.list-view .staleness span { width: 100% !important; height: 100%; }
.list-view .card-actions { border: 0; flex-direction: column; align-items: flex-end; padding-right: .7rem; gap: 0; }

/* ---------- project page canvas ---------- */
.project-head h1 { margin-bottom: .2rem; }
.meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .2rem 0; }
.canvas { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; align-items: start; margin-bottom: 1.5rem; min-height: 40px; }
.blk { grid-column: span 12; min-width: 0; }
.w-3 { grid-column: span 3; } .w-4 { grid-column: span 4; } .w-6 { grid-column: span 6; } .w-8 { grid-column: span 8; }
@media (max-width: 760px) { .canvas .blk { grid-column: span 12; } }
.style-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: var(--shadow); }
.style-accent { background: var(--accent-soft); border-radius: var(--radius); padding: 1rem 1.2rem; border-left: 4px solid var(--accent); }
.rich { font-size: 1.02rem; line-height: 1.65; max-width: 75ch; }
.rich > :first-child { margin-top: 0; }
.rich blockquote, .blk-quote blockquote { margin: .6rem 0; padding: .2rem 0 .2rem 1rem; border-left: 3px solid var(--line-strong); font-family: var(--serif); font-size: 1.12rem; }
.blk-quote cite { display: block; color: var(--muted); font-style: normal; font-size: .9rem; margin-top: .3rem; }
.blk h2.h-xl { font-size: 1.9rem; }
.blk h3 { font-size: 1.4rem; }
.blk h4 { font-size: 1.1rem; }
figure { margin: 0; }
figure img { display: block; border-radius: 8px; }
figure.fit-cover img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
figure.fit-contain img { width: 100%; max-height: 520px; object-fit: contain; background: var(--bg); }
figcaption, .caption { color: var(--muted); font-size: .86rem; margin-top: .35rem; }
.link-card { display: flex; flex-direction: column; gap: .2rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--ink); }
.link-card:hover { border-color: var(--accent); }
.link-title { font-weight: 600; color: var(--accent); }
.link-note { color: var(--ink); font-size: .9rem; white-space: pre-line; }
.link-host { color: var(--muted); font-size: .78rem; }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
hr { border: 0; border-top: 1px solid var(--line-strong); margin: .6rem 0; }

/* ---------- editing ---------- */
.save-state { min-height: 1.2em; text-align: right; }
.save-state.error { color: var(--danger); }
.editing .canvas { padding: .6rem; border-radius: var(--radius); background: repeating-linear-gradient(90deg, transparent 0 calc((100% - 11 * 1.4rem) / 12), color-mix(in srgb, var(--accent) 5%, transparent) 0 calc((100% - 11 * 1.4rem) / 12 + 1.4rem)); }
.canvas.drop { outline: 2px dashed var(--accent); outline-offset: 4px; }
.blk.edit { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 0 .7rem .7rem; background: var(--surface); }
.blk.edit:focus-within { border-style: solid; border-color: var(--accent); }
.blk-bar { display: flex; align-items: center; gap: .4rem; margin: 0 -.7rem .55rem; padding: .3rem .5rem; border-bottom: 1px solid var(--line); font-size: .8rem; color: var(--muted); }
.blk-bar select { padding: .1rem .3rem; font-size: .78rem; }
.blk-handle { cursor: grab; font-size: 1.05rem; padding: 0 .2rem; }
.blk-type { font-weight: 600; }
.blk-bar .icon { border: 0; background: none; cursor: pointer; color: var(--muted); padding: .1rem .35rem; border-radius: 4px; }
.blk-bar .icon:hover { background: var(--bg); color: var(--ink); }
.blk-body { display: flex; flex-direction: column; gap: .45rem; }
.editable { min-height: 4.5em; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.editable:empty::before { content: attr(data-placeholder); color: var(--muted); }
.rich-tools { display: flex; flex-wrap: wrap; gap: 2px; }
.rich-tools button { border: 1px solid var(--line); background: var(--bg); border-radius: 5px; min-width: 30px; height: 28px; cursor: pointer; color: var(--ink); font-weight: 600; }
.rich-tools button:hover { border-color: var(--accent); }
.heading-input { font-family: var(--serif); font-weight: 600; }
.heading-input.lvl-1 { font-size: 1.7rem; } .heading-input.lvl-2 { font-size: 1.35rem; } .heading-input.lvl-3 { font-size: 1.1rem; }
.img-prev { background: var(--bg); border-radius: 7px; min-height: 80px; display: grid; place-items: center; overflow: hidden; }
.img-prev img { max-height: 260px; object-fit: contain; }
.add-bar { position: sticky; bottom: .8rem; z-index: 15; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: .5rem .7rem; box-shadow: var(--shadow-lift); margin: 1rem 0 2rem; }
.add-bar button { border: 1px solid var(--line); background: var(--bg); border-radius: 7px; padding: .3rem .7rem; cursor: pointer; color: var(--ink); font: inherit; font-size: .88rem; }
.add-bar button:hover { border-color: var(--accent); color: var(--accent); }
.add-bar .hint { margin-left: auto; }

/* ---------- dialogs ---------- */
dialog.modal { border: 0; border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog.modal.wide { width: min(860px, calc(100vw - 2rem)); }
dialog::backdrop { background: rgba(20, 18, 15, .45); }
.modal-inner { display: flex; flex-direction: column; gap: .9rem; padding: 1.1rem 1.3rem 1.2rem; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { margin: 0; }
.x { border: 0; background: none; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--muted); padding: .1rem .4rem; border-radius: 6px; }
.x:hover { background: var(--bg); color: var(--ink); }
.modal-foot { display: flex; gap: .5rem; align-items: center; border-top: 1px solid var(--line); padding-top: .9rem; }
.card-editor-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 1.2rem; }
@media (max-width: 720px) { .card-editor-grid { grid-template-columns: 1fr; } }
.image-preview { aspect-ratio: 16 / 9; background: var(--bg); border-radius: 8px; display: grid; place-items: center; overflow: hidden; margin-bottom: .5rem; }
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.url-rows { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .3rem; }
.url-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: .35rem; }
#card-editor .admin-only { display: none; }
#card-editor.is-admin .admin-only { display: revert; }
#card-editor.is-admin fieldset.admin-only { display: block; }
#card-editor.owner-user .if-group, #card-editor.owner-group .if-user { display: none; }
.addr { display: flex; align-items: center; gap: .2rem; }
.addr input { flex: 1; }
.invite-result { display: flex; flex-direction: column; gap: .5rem; background: var(--bg); border-radius: 8px; padding: .8rem; }

/* ---------- discussion ---------- */
.comments { list-style: none; padding: 0; margin: 0 0 .8rem; max-height: 520px; overflow: auto; }
.comment { padding: .55rem 0; border-top: 1px solid var(--line); }
.comment:first-child { border-top: 0; }
.comment-head { display: flex; align-items: center; gap: .45rem; font-size: .88rem; }
.comment-head .link-btn { margin-left: auto; }
.comment-body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: .2rem; }
.comment-form { display: flex; flex-direction: column; gap: .4rem; align-items: flex-end; }

/* ---------- message page & toasts ---------- */
.message-card { max-width: 520px; margin: 10vh auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.6rem 1.8rem; box-shadow: var(--shadow); }
#toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: .4rem; z-index: 100; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: .55rem 1rem; border-radius: 8px; font-size: .9rem; box-shadow: var(--shadow-lift); transition: opacity .5s, transform .5s; max-width: 90vw; }
.toast.error { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }

@media (max-width: 640px) {
  .head-controls { align-items: flex-start; }
  .toolbar { top: 49px; }
  .toolbar input[type=search] { width: 110px; }
  .topnav .me span { display: none; }
}


/* =================================================================== v3: column layout */
.grid.masonry, .canvas.masonry { display: block; position: relative; }
.masonry > .card, .masonry > .el { position: absolute !important; top: 0; left: 0; margin: 0; transition: transform .2s ease, box-shadow .15s; will-change: transform; }
.masonry > .dragging { transition: none; z-index: 60; box-shadow: var(--shadow-lift); opacity: .95; cursor: grabbing; }
body.is-dragging { user-select: none; cursor: grabbing; }
.drag-handle { touch-action: none; }
.grid.masonry .card:hover { transform: none; }

/* =================================================================== card looks
   Shared by project cards (dashboard) and element cards (project page). */
.look { --card-bg: var(--surface); --card-fg: var(--ink); background: var(--card-bg); color: var(--card-fg); }
.look.has-fg .desc, .look.has-fg .stats, .look.has-fg .link-host, .look.has-fg .muted { color: color-mix(in srgb, var(--card-fg) 72%, transparent); }
.look.has-fg .card-title a, .look.has-fg .el-title { color: var(--card-fg); }
.look.has-fg .card-links a, .look.has-fg .el-links a { color: var(--card-fg); border-color: color-mix(in srgb, var(--card-fg) 30%, transparent); background: color-mix(in srgb, var(--card-fg) 6%, transparent); }
.look.has-bg { border-color: color-mix(in srgb, var(--card-bg) 80%, #000); }
.look.bg-none { background: transparent; border-color: transparent; box-shadow: none; }
.look.bg-none:hover { box-shadow: none; }
.look.has-hl { box-shadow: 0 0 0 3px var(--hl), var(--shadow); border-color: transparent; }
.look.has-hl::before { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 22px 22px 0; border-color: transparent var(--hl) transparent transparent; z-index: 2; }

.look.f-sans { font-family: var(--sans); }
.look.f-serif { font-family: var(--serif); }
.look.f-mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", monospace; }
.look.f-rounded { font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Arial Rounded MT Bold", system-ui, sans-serif; }
.look.f-narrow { font-family: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", sans-serif; font-stretch: condensed; }
.look.f-hand { font-family: "Bradley Hand", "Segoe Print", "Chalkboard SE", "Comic Neue", "Comic Sans MS", cursive; }
.look.f-sans .card-title, .look.f-sans .el-title, .look.f-mono .card-title, .look.f-mono .el-title,
.look.f-rounded .card-title, .look.f-rounded .el-title, .look.f-narrow .card-title, .look.f-narrow .el-title,
.look.f-hand .card-title, .look.f-hand .el-title, .el-divider.f-sans .divider-title, .el-divider:not(.f-serif) .divider-title { font-family: inherit; }
.look.sz-s { font-size: 13px; } .look.sz-m { font-size: 15px; } .look.sz-l { font-size: 17.5px; } .look.sz-xl { font-size: 21px; }
.look .card-title { font-size: 1.12em; }
.look .el-title { font-size: 1.25em; margin: 0 0 .35em; font-family: var(--serif); }

/* image placement */
.look-media { display: block; overflow: hidden; background: color-mix(in srgb, var(--card-fg) 5%, transparent); text-decoration: none; }
.look-media img { display: block; width: 100%; }
.el.img-top .look-media img { max-height: 75vh; object-fit: cover; }
.look.img-side.has-img { flex-direction: row; display: flex; }
.el.look.img-side.has-img { display: grid; grid-template-columns: minmax(90px, 38%) 1fr; }
.look.img-side .look-media { width: 38%; min-width: 90px; aspect-ratio: auto; flex: none; }
.el.look.img-side .look-media { width: auto; }
.look.img-side .look-media img { height: 100%; object-fit: cover; }
.card.look.img-side .card-media { aspect-ratio: auto; min-height: 120px; }
.card.look.img-side { flex-wrap: wrap; }
.card.look.img-side .card-body { flex: 1 1 0; }
.card.look.img-side .staleness, .card.look.img-side .card-actions { flex: 0 0 100%; }
.look.img-cover.has-img { position: relative; isolation: isolate; color: #fff; min-height: 220px; }
.look.img-cover.has-img .look-media { position: absolute; inset: 0; aspect-ratio: auto; z-index: -1; }
.look.img-cover.has-img .look-media img { height: 100%; object-fit: cover; }
.look.img-cover.has-img .look-body { margin-top: auto; background: linear-gradient(to top, rgba(0,0,0,.78), rgba(0,0,0,.35) 70%, transparent); color: #fff; padding-top: 2.4rem; }
.el.look.img-cover.has-img { display: flex; flex-direction: column; justify-content: flex-end; }
.el.look.img-cover.has-img .look-body { min-height: 220px; display: flex; flex-direction: column; justify-content: flex-end; }
.look.img-cover.has-img .card-title a, .look.img-cover.has-img .el-title, .look.img-cover.has-img .desc, .look.img-cover.has-img .stats,
.look.img-cover.has-img .link-host, .look.img-cover.has-img a { color: #fff; }
.look.img-cover.has-img .card-links a, .look.img-cover.has-img .el-links a { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.35); }
.look.img-cover.has-img .card-actions { background: var(--card-bg); color: var(--card-fg); }
.look.img-cover.has-img .card-actions .link-btn { color: var(--accent); }
.look.img-cover.has-img .look-body .status { background: rgba(255,255,255,.9); }

/* "See more…" */
.clamp { max-height: calc(var(--lines, 6) * 1.6em); overflow: hidden; position: relative; }
.clamp.overflowing::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2.4em; background: linear-gradient(to bottom, transparent, var(--card-bg, var(--surface))); pointer-events: none; }
.look.bg-none .clamp.overflowing::after { background: linear-gradient(to bottom, transparent, var(--bg)); }
.look.img-cover.has-img .clamp.overflowing::after { display: none; }
.look.img-cover.has-img .clamp.overflowing { -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent); mask-image: linear-gradient(to bottom, #000 60%, transparent); }
.clamp.expanded { max-height: none; }
.see-more { align-self: flex-start; background: none; border: 0; padding: .1rem 0; margin-top: .15rem; color: var(--accent); font: inherit; font-size: .86em; font-weight: 600; cursor: pointer; }
.look.has-fg .see-more, .look.img-cover.has-img .see-more { color: inherit; text-decoration: underline; }
.rich.el-text { line-height: 1.6; font-size: 1em; max-width: none; }

/* =================================================================== element cards */
.el.look { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; min-width: 0; }
.el .look-body { padding: .9rem 1.05rem 1rem; display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.el.look.bg-none .look-body { padding-left: .2rem; padding-right: .2rem; }
.el .rich > :last-child { margin-bottom: 0; }
.el .rich p { margin: 0 0 .6em; }
.el .video { margin: .2rem 0; }
.el-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.el-links a { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .5rem; padding: .45rem .7rem; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; background: color-mix(in srgb, var(--card-fg) 3%, transparent); }
.el-links a:hover { border-color: var(--accent); }
.el-links .link-title { font-weight: 600; }
.el .drag-handle { display: grid; place-items: center; position: absolute; top: .4rem; left: .4rem; opacity: 0; transition: opacity .15s; z-index: 3; }
.el:hover .drag-handle, .el:focus-within .drag-handle, .el .drag-handle:focus { opacity: 1; }
@media (hover: none) { .el .drag-handle { opacity: .9; } }
.el.look:not(.has-img) .look-body { padding-top: 1.1rem; }
.el .card-actions { margin-top: auto; }
.el.look.bg-none .card-actions { border-top-color: transparent; padding-left: 0; }
.el.flash, .card.flash { animation: flash 1.2s ease; }

.el-divider { display: flex; align-items: center; gap: .6rem; padding: .4rem 0 .1rem; color: var(--card-fg, var(--ink)); }
.el-divider .divider-line { flex: 1; display: flex; align-items: center; gap: .8rem; }
.el-divider .divider-line::after { content: ""; flex: 1; border-top: 2px solid var(--hl, var(--line-strong)); }
.el-divider .divider-title { margin: 0; font-size: 1.45em; font-family: var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 80%; }
.el-divider.has-bg { background: var(--card-bg); padding: .5rem .8rem; border-radius: var(--radius); }
.el-divider .drag-handle { position: static; opacity: .5; display: grid; place-items: center; }
.el-divider:hover .drag-handle { opacity: 1; }

/* =================================================================== editor dialogs */
.modal-head { gap: 1rem; }
.type-pick { display: flex; gap: .9rem; margin-right: auto; }
.type-pick label { flex-direction: row; align-items: center; gap: .3rem; color: var(--ink); }
#element-editor.is-divider .only-card { display: none !important; }
.stack-tight { display: flex; flex-direction: column; gap: .3rem; }
.field-label { font-size: .88rem; color: var(--muted); }
#el-html { min-height: 10em; max-height: 42vh; overflow: auto; }
#el-html p { margin: 0 0 .5em; }
.look-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem .8rem; margin-bottom: .7rem; }
.look-grid select { width: 100%; }
.hint { font-size: .74rem; color: var(--muted); margin: 0; }
.color-row { display: flex; align-items: center; gap: .6rem; margin: .35rem 0; }
.color-row > span { font-size: .84rem; color: var(--muted); width: 84px; flex: none; }
.color-field { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0,0,0,.18); cursor: pointer; padding: 0; position: relative; }
.swatch.on, .sw-custom.on { outline: 2px solid var(--accent); outline-offset: 2px; }
.sw-default { background: linear-gradient(135deg, var(--surface) 45%, var(--line-strong) 45% 55%, var(--surface) 55%) !important; }
.sw-default::after { content: "A"; position: absolute; inset: 0; display: grid; place-items: center; font-size: .66rem; color: var(--muted); }
.sw-none { background: repeating-linear-gradient(45deg, var(--surface) 0 4px, var(--line) 4px 8px) !important; }
.sw-custom { width: 26px; height: 24px; padding: 0; border: 1px solid var(--line-strong); border-radius: 6px; cursor: pointer; background: none; }
dialog.modal.wide { width: min(940px, calc(100vw - 2rem)); }
.project-page .toolbar { top: 53px; }
/* list view: every card is a compact row, whatever its look */
.list-view .card.look { flex-wrap: nowrap; min-height: 52px; }
.list-view .look.img-cover.has-img { color: var(--card-fg); min-height: 0; }
.list-view .look.img-cover.has-img .look-media { position: static; z-index: auto; }
.list-view .look.img-cover.has-img .look-body { background: none; color: inherit; padding-top: .4rem; margin: 0; }
.list-view .look.img-cover.has-img .card-title a, .list-view .look.img-cover.has-img .desc, .list-view .look.img-cover.has-img .stats { color: inherit; }
.list-view .card.look.img-side .card-media { min-height: 0; }
.list-view .card.look.img-side .staleness, .list-view .card.look.img-side .card-actions { flex: none; }
.list-view .look.has-hl::before { display: none; }
.list-view .see-more, .list-view .clamp.overflowing::after { display: none; }
.list-view .clamp { max-height: 1.6em; }

/* readable links and actions on coloured cards */
.look.has-fg .link-title, .look.img-cover.has-img .link-title { color: inherit; }
.look.has-fg .card-actions .link-btn { color: var(--card-fg); }
.look.has-fg .card-actions { border-top-color: color-mix(in srgb, var(--card-fg) 18%, transparent); }
.look.img-cover.has-img .card-actions .link-btn { color: var(--card-fg); }
.look.has-hl .card-top .vis { margin-right: 14px; }
/* keep wide cards' pictures from getting huge */
.card.look .card-media { max-height: 240px; }
.card.look .card-media img { height: 100%; object-fit: cover; }
/* look overrides must beat the base element-card rule */
.el.look.has-bg { border-color: color-mix(in srgb, var(--card-bg) 80%, #000); }
.el.look.bg-none { background: transparent; border-color: transparent; box-shadow: none; }
.el.look.has-hl { box-shadow: 0 0 0 3px var(--hl), var(--shadow); border-color: transparent; }
.el.look.bg-none.has-hl { box-shadow: 0 0 0 3px var(--hl); }
