/* Gridkeepers: black ink on paper */
:root {
  --bg: #f6f5f1; --paper: #fffefb; --ink: #0b0b0b; --soft: #5c5b57; --faint: #8e8c86;
  --line: #dcdad3; --ring: #b9b6ad; --wash: #ecebe5; --wash2: #e4e2db;
  --sans: 'Manrope', system-ui, sans-serif; --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --r: 14px; --gut: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0b0b0b; --paper: #121211; --ink: #f3f2ee; --soft: #a3a19b; --faint: #74726c;
    --line: #2a2927; --ring: #474540; --wash: #1a1918; --wash2: #23221f;
  }
}
:root[data-theme='dark'] {
  --bg: #0b0b0b; --paper: #121211; --ink: #f3f2ee; --soft: #a3a19b; --faint: #74726c;
  --line: #2a2927; --ring: #474540; --wash: #1a1918; --wash2: #23221f;
}
* { box-sizing: border-box }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased }
img { display: block; max-width: 100% }
a { color: inherit; text-underline-offset: 3px }
button, input, textarea, select { font: inherit; color: inherit }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; line-height: 1.1 }
p { margin: 0 }
[hidden] { display: none !important }
.mono { font-family: var(--mono) }
.eyebrow { font: 500 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--soft) }
.soft { color: var(--soft) }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0) }

/* buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border: 1px solid var(--ink); border-radius: 999px; background: var(--ink); color: var(--bg); font: 600 15px/1 var(--sans); text-decoration: none; cursor: pointer; transition: transform .15s, opacity .15s }
.btn:hover { opacity: .88 }
.btn:active { transform: scale(.98) }
.btn:disabled { opacity: .4; cursor: default }
.btn.ghost { background: none; color: var(--ink) }
.btn.small { min-height: 34px; padding: 0 14px; font-size: 13px }
.btn.wide { width: 100% }
.link { padding: 0; border: 0; background: none; color: var(--soft); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 14px }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0 }
.field > span { font: 500 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--soft) }
.field small { color: var(--faint); font-size: 12px }
.input { width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); outline: none; transition: border-color .15s }
.input:focus { border-color: var(--ink) }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.45 }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--soft); cursor: pointer }
.check input { width: 16px; height: 16px; accent-color: var(--ink) }
.err { min-height: 20px; font-size: 14px; color: var(--ink) }
.err:not(:empty)::before { content: '× '; font-family: var(--mono) }

/* place search */
.where { position: relative }
.where ul { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; margin: 0; padding: 4px; list-style: none; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: 0 12px 30px rgba(0, 0, 0, .12); max-height: 260px; overflow: auto }
.where li button { width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; text-align: left; cursor: pointer; font-size: 14px }
.where li button:hover, .where li button.on { background: var(--wash) }
.where li small { color: var(--faint); margin-left: 6px }

/* chips, type, avatars */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--soft); background: none }
.chip.ink { background: var(--ink); color: var(--bg); border-color: var(--ink) }
button.chip { cursor: pointer; min-height: 30px }
button.chip[aria-pressed='true'] { background: var(--ink); color: var(--bg); border-color: var(--ink) }
.chips { display: flex; flex-wrap: wrap; gap: 6px }
.av { flex: none; width: 48px; height: 48px; border-radius: 50%; background: var(--wash2); overflow: hidden; display: grid; place-items: center; font: 600 17px/1 var(--sans); color: var(--soft); filter: grayscale(1) }
.av img { width: 100%; height: 100%; object-fit: cover }
.av.big { width: 88px; height: 88px; font-size: 30px }
.av.tiny { width: 32px; height: 32px; font-size: 13px }

/* top bar */
.top { position: fixed; inset: 0 0 auto; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; padding: 0 var(--gut); pointer-events: none }
.top > * { pointer-events: auto }
.top.scrolled { pointer-events: auto; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line) }
.logo { display: inline-flex; align-items: center; gap: 10px; font: 600 13px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; text-decoration: none }
.logo i { width: 18px; height: 18px; border: 1.5px solid currentColor; border-radius: 50%; background: linear-gradient(90deg, transparent 47%, currentColor 47% 53%, transparent 53%), linear-gradient(transparent 47%, currentColor 47% 53%, transparent 53%) }
.top nav { display: flex; align-items: center; gap: 18px; font-size: 14px }
.top nav a:not(.btn) { text-decoration: none; color: var(--soft) }
.top nav a:not(.btn):hover { color: var(--ink) }

/* home: the earth and the three inputs */
.hero { position: relative; height: 100svh; min-height: 640px; overflow: hidden }
.hero canvas.globe { position: absolute; inset: 0; width: 100%; height: 100% }
.hero .ask { position: absolute; left: 50%; bottom: max(28px, 5vh); transform: translateX(-50%); width: min(920px, calc(100% - 2 * var(--gut))); display: flex; flex-direction: column; gap: 16px; align-items: center; text-align: center }
.hero h1, .hero .sub { text-shadow: 0 0 18px var(--bg), 0 0 8px var(--bg), 0 0 3px var(--bg) }
.hero h1 { font-size: clamp(34px, 6vw, 68px); font-weight: 700; max-width: 14ch }
.hero .sub { color: var(--soft); max-width: 46ch }
.birth { width: 100%; display: grid; grid-template-columns: 1fr 1fr 1.5fr auto; gap: 8px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 22px; background: color-mix(in srgb, var(--paper) 82%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); text-align: left }
.birth .field > span { padding-left: 4px }
.birth .time { display: flex; flex-direction: column; gap: 6px }
.birth .time .check { font-size: 12px; padding-left: 4px }
.birth .btn { min-height: 46px; margin-top: 17px }
.birth .err { grid-column: 1 / -1; min-height: 0 }
.scrollhint { position: absolute; left: 50%; top: 74px; transform: translateX(-50%); font: 500 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint) }

.wrap { width: min(1120px, calc(100% - 2 * var(--gut))); margin: 0 auto }
.section { padding: 96px 0; border-top: 1px solid var(--line) }
.section h2 { font-size: clamp(28px, 4vw, 44px); font-weight: 700; max-width: 22ch }
.section .lede { margin-top: 12px; color: var(--soft); max-width: 56ch }
.head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 36px }

/* people cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px }
.card { display: flex; flex-direction: column; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); text-align: left; cursor: pointer; transition: border-color .15s, transform .2s }
.card:hover { border-color: var(--ring) }
.card .who { display: flex; gap: 12px; align-items: center }
.card .who div { min-width: 0 }
.card .who b { display: block; font-size: 17px }
.card .who small { display: block; color: var(--faint); font: 400 12px/1.3 var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.card .why { font-size: 15px; line-height: 1.45 }
.card .foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: auto }
.card.pick { border-color: var(--ink) }
.places { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 28px }
.empty { padding: 28px; border: 1px dashed var(--ring); border-radius: var(--r); color: var(--soft) }

.join { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: center; padding: 40px; border-radius: 24px; background: var(--ink); color: var(--bg) }
.join h2 { color: var(--bg) }
.join p { color: color-mix(in srgb, var(--bg) 70%, transparent); margin-top: 10px }
.join .btn { background: var(--bg); color: var(--ink); border-color: var(--bg) }
.join ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font: 400 13px/1.4 var(--mono); color: color-mix(in srgb, var(--bg) 75%, transparent) }
.join ul li::before { content: '— ' }

.consult { display: grid; grid-template-columns: 220px 1fr; gap: 36px; align-items: center }
.consult img { width: 220px; height: 220px; border-radius: 50%; object-fit: cover; filter: grayscale(1) contrast(1.05) }
.consult blockquote { margin: 14px 0 20px; font-size: 18px; line-height: 1.5; color: var(--soft); max-width: 52ch }
.foot-bar { padding: 40px 0 56px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font: 400 12px/1.4 var(--mono); color: var(--faint) }

/* the app */
.app { display: grid; grid-template-columns: minmax(360px, 440px) 1fr; height: 100svh; padding-top: 60px }
.app .top { background: var(--bg); border-bottom: 1px solid var(--line) }
.side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line) }
.tabs { display: flex; gap: 2px; padding: 8px var(--gut); border-bottom: 1px solid var(--line) }
.tabs button { position: relative; flex: 1; min-height: 38px; border: 0; border-radius: 10px; background: none; font: 600 13px/1 var(--sans); color: var(--soft); cursor: pointer }
.tabs button[aria-selected='true'] { background: var(--wash); color: var(--ink) }
.tabs .dot { position: absolute; top: 8px; right: 14px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--ink); color: var(--bg); font: 600 10px/16px var(--mono) }
.pane { flex: 1; min-height: 0; overflow: auto; padding: 18px var(--gut) 40px; display: flex; flex-direction: column; gap: 12px }
.pane h3 { font-size: 13px; font-family: var(--mono); font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--soft); margin: 10px 0 2px }
.stage { position: relative; min-height: 0 }
.stage canvas.globe { position: absolute; inset: 0; width: 100%; height: 100% }
.stage .legend { position: absolute; left: 16px; bottom: 16px; display: flex; flex-wrap: wrap; gap: 12px; font: 400 11px/1 var(--mono); color: var(--soft); pointer-events: none }
.legend i { display: inline-block; width: 22px; height: 0; margin-right: 6px; vertical-align: middle; border-top: 1.5px solid var(--ink) }
.legend i.ic { border-top-style: dotted }
.legend i.asc { border-top-style: dashed }
.legend i.dsc { border-top: 1.5px dashed var(--soft) }
.mobile-map { display: none }

/* sign in */
.gate { min-height: 100svh; display: grid; place-items: center; padding: 80px var(--gut) 40px }
.gate form { width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px }
.gate h1 { font-size: 34px; font-weight: 700 }

/* profile editor */
.editor { display: flex; flex-direction: column; gap: 18px }
.editor fieldset { margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; gap: 14px; background: var(--paper) }
.editor legend { padding: 0 6px; font: 500 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--soft) }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px }
.project { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px dashed var(--ring); border-radius: 12px }
.project .rm { align-self: flex-end }
.photo-pick { display: flex; align-items: center; gap: 14px }
.seg { display: flex; flex-wrap: wrap; gap: 6px }
.seg label { cursor: pointer }
.seg input { position: absolute; opacity: 0; pointer-events: none }
.seg span { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--soft) }
.seg input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink) }
.seg input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px }
.save { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%); display: flex; gap: 10px; align-items: center }

/* person drawer */
.drawer { position: fixed; top: 60px; right: 0; bottom: 0; z-index: 40; width: min(460px, 100%); display: flex; flex-direction: column; background: var(--bg); border-left: 1px solid var(--line); transform: translateX(100%); visibility: hidden; transition: transform .3s cubic-bezier(.2, .8, .2, 1), visibility 0s .3s }
.drawer.open { transform: none; visibility: visible; box-shadow: -20px 0 40px rgba(0, 0, 0, .08); transition: transform .3s cubic-bezier(.2, .8, .2, 1) }
.drawer .bar { display: flex; justify-content: space-between; align-items: center; padding: 12px var(--gut); border-bottom: 1px solid var(--line) }
.drawer .body { flex: 1; overflow: auto; padding: 20px var(--gut) 40px; display: flex; flex-direction: column; gap: 18px }
.person-head { display: flex; gap: 16px; align-items: center }
.person-head h2 { font-size: 28px }
.person-head small { display: block; margin-top: 4px; font: 400 12px/1.3 var(--mono); color: var(--faint) }
.why-box { padding: 16px; border-radius: var(--r); background: var(--ink); color: var(--bg); font-size: 16px; line-height: 1.45 }
.projects { display: flex; flex-direction: column; gap: 8px }
.projects a, .projects div.p { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none }
.projects b { display: block }
.projects span { display: block; font-size: 14px; color: var(--soft); margin-top: 2px }
.projects small { display: block; margin-top: 6px; font: 400 11px/1 var(--mono); color: var(--faint) }
.actions { display: flex; gap: 8px; flex-wrap: wrap }

/* chat */
.threads { display: flex; flex-direction: column; gap: 4px }
.thread { display: flex; gap: 12px; align-items: center; padding: 10px; border: 0; border-radius: 12px; background: none; text-align: left; cursor: pointer; width: 100% }
.thread:hover { background: var(--wash) }
.thread div { flex: 1; min-width: 0 }
.thread b { display: flex; justify-content: space-between; gap: 8px; font-size: 15px }
.thread b time { font: 400 11px/1.6 var(--mono); color: var(--faint) }
.thread span { display: block; font-size: 14px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.thread.unread span { color: var(--ink); font-weight: 600 }
.convo { display: flex; flex-direction: column; min-height: 0; flex: 1; margin: -18px calc(-1 * var(--gut)) -40px }
.convo .who { display: flex; align-items: center; gap: 10px; padding: 10px var(--gut); border-bottom: 1px solid var(--line) }
.convo .who button.name { border: 0; background: none; padding: 0; font-weight: 700; cursor: pointer }
.msgs { flex: 1; overflow: auto; padding: 16px var(--gut); display: flex; flex-direction: column; gap: 6px }
.msg { max-width: 82%; padding: 9px 13px; border-radius: 16px; background: var(--wash); font-size: 15px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere }
.msg.mine { align-self: flex-end; background: var(--ink); color: var(--bg) }
.msg time { display: block; margin-top: 2px; font: 400 10px/1 var(--mono); opacity: .55 }
.seen { align-self: flex-end; font: 400 10px/1 var(--mono); color: var(--faint) }
.compose { display: flex; gap: 8px; padding: 10px var(--gut) 14px; border-top: 1px solid var(--line) }
.compose textarea { min-height: 46px; max-height: 140px; resize: none }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translate(-50%, 20px); opacity: 0; padding: 12px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 14px; transition: .25s; pointer-events: none }
.toast.on { transform: translate(-50%, 0); opacity: 1 }

@media (max-width: 860px) {
  .birth { grid-template-columns: 1fr 1fr; border-radius: 18px }
  .birth .place, .birth .btn { grid-column: 1 / -1 }
  .birth .btn { margin-top: 4px }
  .join, .consult { grid-template-columns: 1fr }
  .join { padding: 28px }
  .consult img { width: 160px; height: 160px }
  .app { grid-template-columns: 1fr }
  .stage { display: none }
  .stage.show { display: block; position: fixed; inset: 60px 0 0; z-index: 35; background: var(--bg) }
  .mobile-map { display: inline-flex }
  .top nav .hide-s { display: none }
  .section { padding: 64px 0 }
  .hero .ask { gap: 12px }
  .hero .sub { font-size: 15px }
}
@media (max-width: 420px) {
  .row2 { grid-template-columns: 1fr }
  .cards { grid-template-columns: 1fr }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important } }
section[id], [id].section { scroll-margin-top: 72px }
.add-row { display: flex; gap: 8px } .add-row .input { flex: 1 }
