/* Resonance — the page.
 *
 * One stylesheet for every screen. Sizes and radii come from tokens.css;
 * colours are declared here for light and dark. No external resources: the
 * origin serves `default-src 'self'`.
 */

[hidden] { display: none !important; }

:root {
  color-scheme: light;
  --paper: #f7f4ee;
  --paper-2: #fffdf9;
  --paper-3: #eee9df;
  --ink: #1c1915;
  --ink-2: #514b43;
  --ink-3: #7c756b;
  --line: rgba(28, 25, 21, 0.14);
  --line-soft: rgba(28, 25, 21, 0.08);
  --accent: #9a5b25;
  --accent-ink: #7a4519;
  --accent-soft: rgba(154, 91, 37, 0.10);
  --sage: #3f7548;
  --sage-soft: rgba(63, 117, 72, 0.12);
  --rust: #b0402b;
  --rust-soft: rgba(176, 64, 43, 0.10);
  --focus: #1c1915;
  --shadow: 0 1px 2px rgba(28, 25, 21, 0.05), 0 8px 24px rgba(28, 25, 21, 0.06);
  --masthead-bg: rgba(247, 244, 238, 0.9);
  --serif: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: clamp(14px, 3vw, 36px);
  --measure: 66ch;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #17150f;
  --paper-2: #1f1c16;
  --paper-3: #2a261f;
  --ink: #efe9df;
  --ink-2: #bfb7aa;
  --ink-3: #928a7d;
  --line: rgba(239, 233, 223, 0.16);
  --line-soft: rgba(239, 233, 223, 0.09);
  --accent: #d8a86e;
  --accent-ink: #e6bf8b;
  --accent-soft: rgba(216, 168, 110, 0.13);
  --sage: #95c39b;
  --sage-soft: rgba(149, 195, 155, 0.14);
  --rust: #e58367;
  --rust-soft: rgba(229, 131, 103, 0.13);
  --focus: #efe9df;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  --masthead-bg: rgba(23, 21, 15, 0.9);
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper);
  font: var(--text-body)/1.5 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
h1, h2, h3, h4 { margin: 0; font-weight: 500; text-wrap: balance; }
p, ul, ol, dl, blockquote, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-ink); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
code, pre { font-family: var(--mono); }
textarea, input[type="text"], select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper-2); color: var(--ink); font-size: var(--text-body);
}
textarea { resize: vertical; min-height: 70px; }
select { width: auto; max-width: 100%; }
progress { width: 100%; height: 6px; border: 0; border-radius: var(--radius-pill); background: var(--paper-3); overflow: hidden; accent-color: var(--accent); }
progress::-webkit-progress-bar { background: var(--paper-3); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; left: 16px; top: -64px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--ink); color: var(--paper); transition: top 120ms ease; }
.skip-link:focus { top: 12px; }

/* ---- frame ---------------------------------------------------------------- */

/* The footer stays at the bottom of the window however short the screen is:
   the shell is a column as tall as the viewport and the view takes the slack. */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter) 32px; }
.view { flex: 1 0 auto; }
.page-foot { margin-top: auto; padding-top: 20px; }
.masthead {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px;
  margin: 0 calc(-1 * var(--gutter)); padding: 10px var(--gutter);
  border-bottom: 1px solid var(--line-soft); background: var(--masthead-bg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.brand-title { margin: 0; font-size: inherit; font-weight: inherit; line-height: 1; }
.brand { display: inline-flex; align-items: center; min-height: 32px; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--accent); box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 6px var(--accent); flex: none; }
.wordmark { font-family: var(--serif); font-size: var(--text-xl); letter-spacing: -0.01em; }
.page-nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-left: 12px; }
.page-nav::-webkit-scrollbar { display: none; }
.nav-link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: var(--radius-pill);
  color: var(--ink-2); font-size: var(--text-base); text-decoration: none; white-space: nowrap;
}
.nav-link:hover { background: var(--paper-3); color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--paper-3); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.nav-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--accent); color: var(--paper); font-size: var(--text-xs); font-weight: 600; }
.masthead-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.account-slot { display: flex; align-items: center; gap: 8px; }
@media (max-width: 720px) {
  .page-nav { order: 3; width: 100%; margin-left: 0; flex-wrap: wrap; overflow: visible; }
}

.menu { position: relative; }
.menu__button { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 2px 10px 2px 2px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--paper-2); cursor: pointer; }
.menu__button:hover { border-color: var(--ink-3); }
.menu__name { font-size: var(--text-base); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: var(--text-sm); font-weight: 600; flex: none; }
.avatar--quiet { background: var(--paper-3); color: var(--ink-2); }
.menu__panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: min(320px, calc(100vw - 32px)); padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-2); box-shadow: var(--shadow); display: grid; gap: 8px; }
.menu__caption { color: var(--ink-3); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.menu__value { font-size: var(--text-body); font-weight: 500; overflow-wrap: anywhere; }
.menu__note { color: var(--ink-2); font-size: var(--text-md); }
.menu__row { display: grid; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.menu__out { padding-top: 8px; border-top: 1px solid var(--line-soft); }
.segmented { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--paper); }
.segmented__option { position: relative; display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: var(--radius-pill); color: var(--ink-2); font-size: var(--text-md); cursor: pointer; }
.segmented__option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented__option:has(input:checked) { background: var(--ink); color: var(--paper); }
.segmented__option:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }

.notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 0; padding: 10px 14px; border: 1px solid var(--rust); border-radius: var(--radius-sm); background: var(--rust-soft); color: var(--ink); }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 30; transform: translateX(-50%); padding: 10px 16px; border-radius: var(--radius-pill); background: var(--ink); color: var(--paper); box-shadow: var(--shadow); font-size: var(--text-md); }

.view { display: grid; gap: 22px; padding: 26px 0 40px; align-content: start; }
.view:focus { outline: none; }
.loading { padding: 40px 0; }

.page-foot { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; border-top: 1px solid var(--line-soft); color: var(--ink-3); font-size: var(--text-md); }
.foot-identity { max-width: 60ch; }
.foot-name { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-family: var(--serif); font-size: var(--text-lg); }
.foot-claim { margin-top: 6px; }
.foot-nav ul { display: flex; gap: 16px; }
.foot-nav a { color: var(--ink-2); }

/* ---- type ------------------------------------------------------------------- */

.page-head { display: grid; gap: 8px; max-width: var(--measure); }
.page-head h1, .hero__title { font-family: var(--serif); font-size: var(--text-2xl); line-height: 1.1; letter-spacing: -0.01em; }
.lede { color: var(--ink-2); font-size: var(--text-body); max-width: var(--measure); }
.section__title { font-family: var(--serif); font-size: var(--text-xl); line-height: 1.2; }
.panel__title { font-family: var(--serif); font-size: var(--text-lg); line-height: 1.25; }
.eyebrow, .label { display: block; color: var(--ink-3); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.label { margin-bottom: 6px; }
.quiet { color: var(--ink-3); font-size: var(--text-md); }
.hint { color: var(--ink-3); font-size: var(--text-md); max-width: var(--measure); }
.count { color: var(--ink-2); font-size: var(--text-md); }
.status { min-height: 1.2em; color: var(--ink-2); font-size: var(--text-md); }
.status--error { color: var(--rust); }
.crumbs { font-size: var(--text-md); }
.crumbs a { text-decoration: none; }
.their-words { padding: 8px 12px; border-left: 3px solid var(--line); color: var(--ink-2); font-style: italic; overflow-wrap: anywhere; }
.arrow { color: var(--ink-3); }

/* ---- controls --------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--paper-2); color: var(--ink);
  font-size: var(--text-base); font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn--primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn--primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: var(--paper-2); }
.btn--quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn--quiet:hover { border-color: var(--line); color: var(--ink); }
.btn--danger { background: var(--rust); border-color: var(--rust); color: var(--paper-2); }
.btn--small { min-height: 32px; padding: 0 12px; font-size: var(--text-md); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.compose-row { display: flex; gap: 8px; align-items: flex-end; }
.compose-row textarea, .compose-row input { flex: 1 1 auto; }
.chip { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: var(--radius-pill); background: var(--paper-3); color: var(--ink-2); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.chip--discoverable, .chip--ok, .chip--doing { background: var(--sage-soft); color: var(--sage); }
.chip--withdrawn, .chip--muted { background: var(--paper-3); color: var(--ink-3); }
.chip--new, .chip--done { background: var(--accent-soft); color: var(--accent-ink); }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line-soft); }
.tab { min-height: 36px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--ink-2); font-size: var(--text-base); cursor: pointer; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabpanel { display: grid; gap: 16px; }
.disclosure > summary { cursor: pointer; min-height: 24px; color: var(--ink-2); font-size: var(--text-md); }
.disclosure[open] > summary { margin-bottom: 8px; }
.picker { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.picker .label { margin: 0; }

/* ---- panels and cards ------------------------------------------------------- */

.panel { display: grid; gap: 12px; padding: 20px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--paper-2); box-shadow: var(--shadow); }
.cards { display: grid; gap: 12px; }
.card { display: grid; gap: 8px; padding: 18px 20px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--paper-2); }
.card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.card__title { font-family: var(--serif); font-size: var(--text-lg); line-height: 1.25; }
.card__title a { color: inherit; text-decoration: none; }
.card__meta { color: var(--ink-2); font-size: var(--text-md); }
.card__when { color: var(--ink-3); font-size: var(--text-sm); }
.card__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 4px; }
.confirm { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); }
.composer-offer { display: grid; gap: 6px; justify-items: start; }
.composer { max-width: 760px; }
.empty { display: grid; gap: 6px; padding: 24px; border: 1px dashed var(--line); border-radius: var(--radius); max-width: var(--measure); }
.empty__title { font-family: var(--serif); font-size: var(--text-lg); }
.empty__body { color: var(--ink-2); font-size: var(--text-md); }

/* ---- structure -------------------------------------------------------------- */

.structure { display: grid; gap: 14px; }
.chains { display: grid; gap: 0; }
/* a hairline between blocks, so where one cause ends and the next begins is
   visible without adding a box around each */
.chain + .chain { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
/* The cause is the subject of its little block, so it takes the serif the
   page already gives to titles. It used to be set in the same sans at the
   same size as its effects, so a stack of chains read as one undifferentiated
   run of text with no way to see where each began. */
.chain__from { margin: 0; font-family: var(--serif); font-size: var(--text-body);
  line-height: 1.3; color: var(--ink); }
/* the rule is the cause; what hangs off it are its effects */
.chain__outs { display: grid; gap: 4px; margin: 5px 0 0; padding-left: 12px; border-left: 2px solid var(--line); }
.chain__out { display: grid; grid-template-columns: max-content 1fr; gap: 8px; align-items: baseline;
  font-size: var(--text-base); line-height: 1.35; color: var(--ink-2); }
.chain__type { color: var(--accent-ink); font-family: var(--mono); font-size: var(--text-xs); text-transform: lowercase; }
.chain__to { min-width: 0; overflow-wrap: anywhere; }
.structure__loose { margin: 0; color: var(--ink-3); font-size: var(--text-sm); line-height: 1.35; }

/* ---- home -------------------------------------------------------------------- */

.landing { display: grid; gap: 28px; }
.hero { display: grid; gap: 12px; max-width: 760px; padding-top: 8px; }
.hero__lede { color: var(--ink-2); font-size: var(--text-lg); line-height: 1.45; }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 6px; }
.hero__why { flex-basis: 100%; color: var(--ink-3); font-size: var(--text-md); max-width: var(--measure); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.step { display: grid; gap: 6px; padding: 18px 20px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--paper-2); }
.step__n { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: var(--text-sm); font-weight: 600; }
.step__title { font-family: var(--serif); font-size: var(--text-lg); }
.step__body { color: var(--ink-2); font-size: var(--text-md); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.tile { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--paper-2); color: var(--ink); text-decoration: none; }
.tile:hover { border-color: var(--ink-3); }
.tile__big { font-family: var(--serif); font-size: var(--text-lg); }
.tile__small { color: var(--ink-3); font-size: var(--text-md); }
.news { display: grid; gap: 12px; }
.news__list { display: grid; gap: 8px; }
.news__item { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center; padding: 12px 16px; border: 1px solid var(--line-soft); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); background: var(--paper-2); }
.news__text { grid-column: 1; font-size: var(--text-body); }
.news__meta { grid-column: 1; color: var(--ink-3); font-size: var(--text-sm); }
.news__actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 6px; }
@media (max-width: 560px) { .news__item { grid-template-columns: 1fr; } .news__actions { grid-column: 1; grid-row: auto; } }

/* ---- people ------------------------------------------------------------------ */

.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.match-list { display: grid; gap: 8px; }
.match__open { display: grid; gap: 4px; width: 100%; padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--paper-2); text-align: left; cursor: pointer; }
.match__open:hover { border-color: var(--ink-3); }
.match.is-selected .match__open { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.match__top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.match__person { font-weight: 600; }
.match__domain { color: var(--ink-3); font-size: var(--text-sm); }
.match__topic { font-family: var(--serif); font-size: var(--text-lg); line-height: 1.25; }
.match__verdict { color: var(--accent-ink); font-size: var(--text-md); }
.match__why { color: var(--ink-2); font-size: var(--text-md); }
.match__depth { color: var(--ink-3); font-size: var(--text-sm); }
.strength { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; font-size: var(--text-sm); color: var(--ink-2); }
.detail { position: sticky; top: 76px; }
.evidence { display: grid; gap: 10px; padding: 20px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--paper-2); box-shadow: var(--shadow); }
.evidence__title { font-family: var(--serif); font-size: var(--text-xl); line-height: 1.2; }
.evidence__verdict { color: var(--accent-ink); }
.evidence__score { color: var(--ink-2); font-size: var(--text-md); }
.mapping { display: grid; gap: 4px; }
.mapping__head { display: grid; grid-template-columns: 1fr 24px 1fr; color: var(--ink-3); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; }
.mapping__row { display: grid; grid-template-columns: 1fr 24px 1fr; gap: 6px; padding: 6px 0; border-top: 1px solid var(--line-soft); font-size: var(--text-base); }
.evidence__actions { display: grid; gap: 8px; padding-top: 6px; }
.near__list { display: grid; gap: 4px; font-size: var(--text-md); }

/* ---- talk -------------------------------------------------------------------- */

.requests { display: grid; gap: 10px; }
.split--talk { grid-template-columns: minmax(0, 3fr) minmax(0, 7fr); }
.convo-list { display: grid; gap: 4px; margin-top: 8px; }
.convo { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; }
.convo:hover { background: var(--paper-3); }
.convo.is-selected { background: var(--paper-3); box-shadow: inset 3px 0 0 var(--accent); }
.convo__when { color: var(--ink-3); font-size: var(--text-sm); }
.thread__box { display: grid; gap: 12px; padding: 20px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--paper-2); }
.messages { display: grid; gap: 8px; max-height: 60vh; overflow-y: auto; }
.message { display: grid; gap: 2px; max-width: 80%; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--paper-3); }
.message--me { justify-self: end; background: var(--accent-soft); }
.message__who { color: var(--ink-3); font-size: var(--text-xs); font-weight: 600; }
.message__body { white-space: pre-wrap; overflow-wrap: anywhere; }
.message__when { color: var(--ink-3); font-size: var(--text-xs); }

/* ---- groups ------------------------------------------------------------------ */

.parts { display: grid; gap: 6px; }
.part { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--paper-2); }
.part--done .part__title { color: var(--ink-3); text-decoration: line-through; }
.standing { display: grid; gap: 10px; padding: 16px 18px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--paper-2); }
.side { display: grid; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.side h4 { font-size: var(--text-base); }
.side__block ul { display: grid; gap: 2px; font-size: var(--text-md); }
.contribution { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.members { display: grid; gap: 6px; }
.member { display: flex; align-items: center; gap: 10px; }

/* ---- connect ----------------------------------------------------------------- */

.url-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.url { padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); font-size: var(--text-base); overflow-wrap: anywhere; }
.code { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--paper-3); font-size: var(--text-md); overflow-x: auto; }
.asks { display: grid; gap: 6px; color: var(--ink-2); }
.tool-status { display: flex; flex-wrap: wrap; gap: 6px; }
.tool-status > * { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius-pill); font-size: var(--text-xs); color: var(--ink-2); }

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

/* ---- maps ---------------------------------------------------------------------- */

.map-panel { gap: 10px; }
.map-frame { display: grid; place-items: center; }
.map-frame svg { width: min(100%, 520px); height: auto; }
.map-frame--world svg { width: 100%; }
.rmap__ring { fill: none; stroke: var(--line); stroke-dasharray: 2 4; }
.rmap__ring-label { fill: var(--ink-3); font-family: var(--mono); font-size: var(--text-xs); }
.rmap__sector { fill: var(--paper-3); opacity: 0.35; }
.rmap__sector--direct, .rmap__sector--approximate { fill: var(--sage); opacity: 0.07; }
.rmap__sector--analogical, .rmap__sector--complementary { fill: var(--accent); opacity: 0.07; }
.rmap__link { stroke: var(--line-2, var(--line)); }
.rmap__link.is-dashed { stroke-dasharray: 4 4; stroke: var(--rust); }
.rmap__hit { fill: transparent; }
.rmap__dot { fill: var(--accent); stroke: var(--paper-2); stroke-width: 2; }
.rmap__dot--direct, .rmap__dot--approximate { fill: var(--sage); }
.rmap__dot--negative { fill: var(--ink-3); }
.rmap__person { cursor: pointer; }
.rmap__person.is-selected .rmap__dot { stroke: var(--ink); stroke-width: 3; }
.rmap__person:focus-visible { outline: none; }
.rmap__person:focus-visible .rmap__dot { stroke: var(--focus); stroke-width: 3; }
.rmap__name { fill: var(--ink); font-size: var(--text-sm); paint-order: stroke; stroke: var(--paper-2); stroke-width: 3px; }
.rmap__you { fill: var(--ink); }
.rmap__you-label { fill: var(--ink-2); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--text-md); color: var(--ink-2); }
.map-legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; }
.swatch--direct, .swatch--approximate { background: var(--sage); }
.swatch--negative { background: var(--ink-3); }
.wmap__ground { fill: var(--paper-3); stroke: var(--line); stroke-width: 1; }
.wmap__water { fill: var(--paper-2); stroke: none; }
.wmap__hit { fill: transparent; }
.wmap__dot { fill: var(--accent); stroke: var(--paper-2); stroke-width: 2; }
.wmap__person { cursor: pointer; }
.wmap__person.is-faint .wmap__dot { fill: var(--ink-3); }
.wmap__person.is-selected .wmap__dot { stroke: var(--ink); stroke-width: 3; }
.wmap__you { fill: var(--ink); }
.wmap__name { fill: var(--ink); font-size: var(--text-sm); paint-order: stroke; stroke: var(--paper-2); stroke-width: 3px; }
.place-row { display: grid; gap: 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-base); }

/* ---- redesign: shared pieces ------------------------------------------------------- */
.view--in { animation: view-in 180ms ease-out; }
@keyframes view-in { from { opacity: 0.6; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view--in { animation: none; } }

.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: 0 0 auto; border-radius: 50%; font-size: var(--text-sm); font-weight: 600; letter-spacing: 0.02em; color: hsl(var(--hue, 200) 45% 22%); background: hsl(var(--hue, 200) 60% 84%); }
.avatar--big { width: 44px; height: 44px; font-size: var(--text-base); }
.avatar--small { width: 24px; height: 24px; font-size: var(--text-xs); }
.avatar--quiet { color: var(--ink-2); background: var(--paper-3); }
.avatar--group { color: var(--accent-ink); background: var(--paper-3); }
[data-theme="dark"] .avatar { color: hsl(var(--hue, 200) 60% 88%); background: hsl(var(--hue, 200) 35% 28%); }
.avatar-stack { display: flex; align-items: center; gap: 6px; }
.avatar-stack .avatar { margin-right: -10px; box-shadow: 0 0 0 2px var(--paper-2); }
.avatar-stack .quiet { margin-left: 14px; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); display: inline-block; flex: 0 0 auto; }
.dot--discoverable { background: var(--sage); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sage) 25%, transparent); }
.dot--withdrawn { background: var(--rust); }
.state { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--ink-2); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-tab { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--paper-2); color: var(--ink-2); font: inherit; font-size: var(--text-md); cursor: pointer; }
.chip-tab:hover { border-color: var(--ink-3); color: var(--ink); }
.chip-tab.is-on { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.chip-tab__n { font-family: var(--mono); font-size: var(--text-xs); opacity: 0.75; }
.chip--ok { color: var(--sage-ink, var(--accent-ink)); border-color: var(--sage); }
.chip--muted { opacity: 0.6; }

.kebab { position: relative; margin-left: auto; }
.kebab__button { border: 0; background: transparent; color: var(--ink-3); font: inherit; font-size: var(--text-lg); line-height: 1; padding: 2px 8px; border-radius: var(--radius-xs); cursor: pointer; }
.kebab__button:hover, .kebab__button[aria-expanded="true"] { color: var(--ink); background: var(--paper-3); }
.kebab__panel { position: absolute; right: 0; top: 100%; z-index: 20; min-width: 168px; display: grid; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper-2); box-shadow: var(--shadow); }
.kebab__item { border: 0; background: transparent; font: inherit; font-size: var(--text-md); color: var(--ink); text-align: left; padding: 8px 10px; border-radius: var(--radius-xs); cursor: pointer; }
.kebab__item:hover { background: var(--paper-3); }
.kebab__item.is-danger { color: var(--rust); }

/* `align-items: start` so a card is its own height. Grid items stretch to the
   tallest in the row by default, and `.card__actions { margin-top: auto }`
   then pushed the footer to the bottom of that borrowed height -- which is
   why a short thought showed its title floating in the middle of an empty
   card next to a long one. */
.card-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.card__head { display: flex; align-items: center; gap: 10px; }
.card__when { color: var(--ink-3); font-size: var(--text-sm); }
.card__title { font-family: var(--serif); font-size: var(--text-lg); line-height: 1.25; margin: 0; }
.card__meta { color: var(--ink-2); font-size: var(--text-md); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.card__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; }
.pill { display: inline-block; padding: 1px 8px; border-radius: var(--radius-pill); background: var(--paper-3); color: var(--ink-2); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; }
.confirm { display: grid; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--paper-3); font-size: var(--text-md); }
.btn--danger { background: var(--rust); border-color: var(--rust); color: var(--paper); }
.thought--withdrawn .card__title, .thought--private .card__title { color: var(--ink-2); }
.page-head--row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; max-width: none; }
.page-head--row > div { max-width: 60ch; }
.empty { display: grid; gap: 8px; justify-items: start; padding: 28px 24px; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty__title { font-family: var(--serif); font-size: var(--text-lg); margin: 0; }
.empty__body { color: var(--ink-2); margin: 0; max-width: 60ch; }
.edit-list { display: grid; gap: 8px; justify-items: start; }
.edit-row { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; width: 100%; }
.edit-row--link { grid-template-columns: 1fr auto 1fr auto; }
.edit-row input, .edit-row select { min-width: 0; }
.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--paper-3), var(--paper-2), var(--paper-3)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton--map { height: 320px; }
.skeleton-grid { display: grid; gap: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.meter { width: 96px; height: 6px; border-radius: var(--radius-pill); background: var(--paper-3); overflow: hidden; }
.meter__fill { height: 100%; background: var(--accent); }

/* ---- home dashboard ----------------------------------------------------------------- */
.dash-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .dash-grid { grid-template-columns: 1fr; } }
.skeleton--row { height: 48px; }
.dash-panel { display: grid; gap: 10px; align-content: start; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section__all { font-size: var(--text-sm); color: var(--ink-2); }
.rows, .person-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.row-item, .person-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: var(--radius-sm); }
.row-item:hover, .person-row:hover { background: var(--paper-3); }
.row-item__body, .person-row__body { display: grid; gap: 2px; min-width: 0; flex: 1; }
.row-item__title, .person-row__name { font-weight: 600; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item__meta, .person-row__meta { color: var(--ink-3); font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-row__strength { display: grid; gap: 2px; justify-items: end; font-size: var(--text-xs); }
.news--quiet { padding: 12px 0; }
.news__item { grid-template-columns: auto 1fr auto; }
.news__item .avatar { grid-row: 1 / span 2; }
.news__body { grid-column: 2; display: grid; gap: 2px; }
.news__actions { grid-column: 3; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.step { display: grid; gap: 6px; padding: 18px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--paper-2); }
.step__n { font-family: var(--mono); color: var(--accent-ink); font-size: var(--text-sm); }
.step__title { font-family: var(--serif); font-size: var(--text-lg); margin: 0; }
.step__body { color: var(--ink-2); margin: 0; }
.landing { display: grid; gap: 28px; }

/* ---- people --------------------------------------------------------------------------- */
.people-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .people-layout { grid-template-columns: 1fr; } }
.viz { display: grid; gap: 10px; position: sticky; top: 12px; }
.map-frame { border-radius: var(--radius); overflow: hidden; background: var(--paper-2); }
.map-frame svg { display: block; width: 100%; height: auto; }
.map-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; font-size: var(--text-sm); color: var(--ink-2); }
.map-legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; }
.swatch--direct, .swatch--approximate { background: var(--sage); }
.swatch--negative { background: var(--ink-3); }
.person-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.person__open { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; width: 100%; padding: 14px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--paper-2); text-align: left; font: inherit; color: inherit; cursor: pointer; }
.person__open:hover { border-color: var(--ink-3); }
.person.is-selected .person__open { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.person__body { display: grid; gap: 4px; min-width: 0; }
.person__top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.person__name { font-weight: 600; }
.person__topic { font-family: var(--serif); font-size: var(--text-base); line-height: 1.3; margin: 0; }
.person__verdict { color: var(--accent-ink); font-size: var(--text-md); margin: 0; }
.person__depth { color: var(--ink-3); font-size: var(--text-sm); margin: 0; }
.person__score { display: grid; align-content: start; justify-items: end; gap: 2px; font-family: var(--mono); font-size: var(--text-lg); }
.person__score .quiet { font-family: var(--sans); font-size: var(--text-xs); text-align: right; }
.profile { display: grid; gap: 3px; margin: 4px 0; }
.profile__row { display: grid; grid-template-columns: 64px 1fr 32px; align-items: center; gap: 8px; font-size: var(--text-xs); }
.profile__label { color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
.profile__bar { height: 5px; border-radius: var(--radius-pill); background: var(--paper-3); overflow: hidden; }
.profile__fill { height: 100%; background: var(--accent); border-radius: var(--radius-pill); }
.profile__row:first-child .profile__fill { background: var(--sage); }
.profile__value { font-family: var(--mono); color: var(--ink-2); text-align: right; }
.count { color: var(--ink-2); font-size: var(--text-md); margin: 0; }
.near__list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: var(--text-md); }
.near__list li { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.connections { display: grid; gap: 8px; margin-top: 8px; }
.eyebrow { color: var(--ink-3); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; margin: 0; }
.corr-frame { border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--paper); overflow-x: auto; }
.corr-frame svg { display: block; width: 100%; height: auto; min-width: 360px; }

/* drawer */
.drawer-host { position: fixed; inset: 0; z-index: 40; }
.drawer-backdrop { position: absolute; inset: 0; background: color-mix(in srgb, var(--ink) 30%, transparent); }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(520px, 100%); display: grid; align-content: start; gap: 14px; padding: 20px; background: var(--paper); box-shadow: var(--shadow); overflow-y: auto; animation: drawer-in 200ms ease-out; }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }
.drawer__head { display: flex; align-items: center; gap: 12px; }
.drawer__head > div { flex: 1; min-width: 0; }
.drawer__title { font-family: var(--serif); font-size: var(--text-xl); margin: 0; line-height: 1.2; }
.drawer__actions { display: grid; gap: 8px; }
.drawer .evidence { box-shadow: none; }

/* constellation */
.cmap { background: radial-gradient(circle at 50% 50%, var(--paper-2), var(--paper)); }
.cmap__link { stroke: var(--line); stroke-linecap: round; }
.cmap__link--direct, .cmap__link--approximate { stroke: var(--sage); }
.cmap__link--analogical, .cmap__link--complementary { stroke: var(--accent); }
.cmap__link--negative { stroke: var(--ink-3); }
.cmap__link.is-dashed { stroke-dasharray: 5 5; }
.cmap__link.is-hot { filter: drop-shadow(0 0 3px currentColor); }
.cmap__halo { fill: var(--accent); opacity: 0.08; }
.cmap__centre { fill: var(--ink); stroke: var(--paper); stroke-width: 3; }
.cmap__node { cursor: pointer; }
.cmap__hit { fill: transparent; }
.cmap__dot { fill: var(--accent); stroke: var(--paper); stroke-width: 2; }
.cmap__dot--direct, .cmap__dot--approximate { fill: var(--sage); }
.cmap__dot--negative { fill: var(--ink-3); opacity: 0.55; }
.cmap__link--negative { stroke-opacity: 0.15 !important; }
.cmap__node.is-selected .cmap__dot { stroke: var(--ink); stroke-width: 3; }
.cmap__node:focus-visible { outline: none; }
.cmap__node:focus-visible .cmap__dot { stroke: var(--focus); stroke-width: 3; }
.cmap__name { fill: var(--ink); font-size: var(--text-sm); paint-order: stroke; stroke: var(--paper); stroke-width: 3px; pointer-events: none; }
.cmap__name--centre { font-weight: 600; font-size: var(--text-md); }
.cmap__name--dim { fill: var(--ink-3); }

/* correspondence */
.corr__head { fill: var(--ink-3); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; }
.corr__box { fill: var(--paper-2); stroke: var(--line); rx: 6; }
.corr__idea--mine .corr__box { stroke: var(--sage); }
.corr__idea--theirs .corr__box { stroke: var(--accent); }
.corr__idea.is-alone .corr__box { stroke-dasharray: 3 3; opacity: 0.7; }
.corr__idea.is-contested .corr__box { stroke: var(--rust); }
.corr__label { fill: var(--ink); font-size: var(--text-sm); }
.corr__pair { stroke: var(--accent); stroke-width: 2; fill: none; opacity: 0.7; }
.corr__kept { stroke: var(--sage); stroke-width: 2; fill: none; opacity: 0.7; }
.corr__idea.is-hot .corr__box { stroke-width: 2.5; }
.corr__pair.is-hot, .corr__kept.is-hot { opacity: 1; stroke-width: 3.5; }

/* heat matrix */
.heat-wrap { overflow-x: auto; }
.heat { border-collapse: separate; border-spacing: 3px; font-size: var(--text-sm); }
.heat th { font-weight: 500; color: var(--ink-2); text-align: left; padding: 4px 8px; white-space: nowrap; }
.heat th.heat__col { max-width: 160px; white-space: normal; font-size: var(--text-xs); vertical-align: bottom; }
.heat__cell { width: 44px; height: 32px; border-radius: var(--radius-xs); background: color-mix(in srgb, var(--accent) calc(var(--heat, 0) * 100%), var(--paper-3)); color: var(--ink); text-align: center; font-family: var(--mono); font-size: var(--text-xs); cursor: pointer; }
.heat__cell.is-empty { background: var(--paper-3); opacity: 0.4; cursor: default; }
.heat tr.is-selected th { color: var(--ink); font-weight: 600; }
.heat tr.is-selected .heat__cell { box-shadow: 0 0 0 2px var(--ink); }
.heat__none { width: 44px; text-align: center; color: var(--ink-3); }
.heat__cell--near { background: var(--paper-3); color: var(--ink-3); }
.heat__cell[data-kind^="Same"], .heat__cell[data-kind^="Close"] { background: color-mix(in srgb, var(--sage) calc(var(--heat, 0) * 100%), var(--paper-3)); }

/* talk & groups polish */
.convo { display: flex; align-items: center; gap: 10px; }
.thread__head { display: flex; align-items: center; gap: 12px; }
.member { display: flex; align-items: center; gap: 10px; }
.request .card__head { align-items: center; }
.group-card { display: grid; gap: 8px; }
.url-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.url { font-family: var(--mono); font-size: var(--text-md); padding: 6px 10px; border-radius: var(--radius-xs); background: var(--paper-3); }

/* radar */
.radar { background: radial-gradient(circle at 50% 50%, var(--paper-2), var(--paper)); }
.radar__ring { fill: none; stroke: var(--line-soft); }
.radar__ring--outer { stroke: var(--line); }
.radar__spoke { stroke: var(--line-soft); }
.radar__tick { fill: var(--ink-3); font-family: var(--mono); font-size: var(--text-xs); }
.radar__axis { fill: var(--ink-2); font-size: var(--text-sm); }
.radar__series { cursor: pointer; transition: opacity 160ms ease; }
.radar__series.is-dim { opacity: 0.35; }
.radar__poly { fill: hsl(var(--hue) 50% 45% / 0.22); stroke: hsl(var(--hue) 50% 36%); stroke-width: 2; stroke-linejoin: round; }
.radar__series.is-selected .radar__poly { fill: hsl(var(--hue) 50% 45% / 0.36); stroke-width: 3; }
.radar__series:hover .radar__poly { fill: hsl(var(--hue) 50% 45% / 0.36); }
.radar__series:focus-visible { outline: none; }
.radar__series:focus-visible .radar__poly { stroke-width: 4; }
.radar__dot { fill: hsl(var(--hue) 50% 36%); stroke: var(--paper); stroke-width: 1.5; }
[data-theme="dark"] .radar__poly { fill: hsl(var(--hue) 55% 65% / 0.22); stroke: hsl(var(--hue) 55% 70%); }
[data-theme="dark"] .radar__series.is-selected .radar__poly, [data-theme="dark"] .radar__series:hover .radar__poly { fill: hsl(var(--hue) 55% 65% / 0.36); }
[data-theme="dark"] .radar__dot { fill: hsl(var(--hue) 55% 70%); }
.series-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.series-legend__item { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--paper-2); font: inherit; font-size: var(--text-sm); color: var(--ink-2); cursor: pointer; }
.series-legend__item.is-on { border-color: var(--ink); color: var(--ink); }
.series-legend__swatch { width: 12px; height: 12px; border-radius: var(--radius-xs); background: hsl(var(--hue) 50% 45% / 0.7); border: 1.5px solid hsl(var(--hue) 50% 36%); }
[data-theme="dark"] .series-legend__swatch { background: hsl(var(--hue) 55% 65% / 0.6); border-color: hsl(var(--hue) 55% 70%); }
.series-legend__item--you .series-legend__swatch { background: transparent; border: 1.5px dashed var(--ink-3); }
.radar__series--you .radar__poly { fill: none; stroke: var(--ink-3); stroke-dasharray: 4 4; stroke-width: 1.5; }
.radar__series--you .radar__dot { display: none; }
.drawer .radar { max-height: 320px; }

/* Over the length the server can read. Said in the page's own error colour,
   because the previous behaviour was to enforce it by silence. */
.hint--warn { color: var(--rust); }
