/* One plane. Edges are told by light and shadow: a raised thing has a highlight above and to
   the left and a shadow below and to the right; a thing you type into is pressed in. */
:root {
  --ui: "Avenir Next", "Avenir", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --ground: #e9e8ee;
  --ink: #26262d;
  --ink-2: rgba(38, 38, 45, 0.62);
  --ink-3: rgba(38, 38, 45, 0.4);
  --glass: rgba(255, 255, 255, 0.52);
  --edge: rgba(255, 255, 255, 0.9);
  --lift: -5px -5px 12px rgba(255, 255, 255, 0.95), 6px 6px 14px rgba(120, 118, 150, 0.22);
  --lift-big: -10px -10px 30px rgba(255, 255, 255, 0.9), 18px 24px 50px rgba(100, 98, 135, 0.26);
  --press: inset 3px 3px 7px rgba(120, 118, 150, 0.24), inset -3px -3px 7px rgba(255, 255, 255, 0.95);
}
:root[data-theme="dark"] {
  --ground: #1b1b21;
  --ink: #f1f0f5;
  --ink-2: rgba(241, 240, 245, 0.64);
  --ink-3: rgba(241, 240, 245, 0.4);
  --glass: rgba(255, 255, 255, 0.05);
  --edge: rgba(255, 255, 255, 0.12);
  --lift: -4px -4px 10px rgba(255, 255, 255, 0.05), 6px 6px 14px rgba(0, 0, 0, 0.5);
  --lift-big: -10px -10px 30px rgba(255, 255, 255, 0.04), 18px 24px 50px rgba(0, 0, 0, 0.55);
  --press: inset 3px 3px 7px rgba(0, 0, 0, 0.55), inset -3px -3px 7px rgba(255, 255, 255, 0.05);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body.still .topic, body.still .idea, body.still .memory, body.still .msg.new { animation: none; }
body { background: var(--ground); color: var(--ink); font: 400 15px/1.5 var(--ui); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }

#light { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#lines { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
#lines path { fill: none; stroke-width: 1.7; stroke-linecap: round; transition: opacity 0.25s; }
#stage { position: relative; z-index: 1; height: 100%; display: grid; grid-template-columns: minmax(0, 290px) minmax(380px, 760px) minmax(0, 290px); gap: 40px; justify-content: center; padding: 30px 28px; }

/* ---- the chat window ---- */
#chats { min-width: 0; min-height: 0; display: flex; }
.chat {
  position: relative; flex: 1; min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); border-radius: 26px; overflow: hidden;
  background: var(--glass); border: 1px solid var(--edge); box-shadow: var(--lift-big); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
.chat header { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px 12px; }
.chat .title { font: 500 12.5px/1 var(--mono); letter-spacing: 0.04em; color: var(--ink-2); }
.chat .all { display: flex; align-items: center; gap: 8px; font: 400 11.5px/1 var(--mono); color: var(--ink-3); padding: 7px 11px; border-radius: 12px; box-shadow: var(--lift); }
.chat .all:active { box-shadow: var(--press); }
.chat .all i { display: grid; grid-template-columns: 6px 6px; gap: 2px; }
.chat .all i::before, .chat .all i::after { content: ""; width: 6px; height: 8px; border-radius: 2px; background: currentColor; }

.log { grid-row: 2; grid-column: 1; min-height: 0; overflow-y: auto; padding: 6px 22px 18px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; }
.log .day { align-self: center; margin: 12px 0 2px; font: 400 11px/1 var(--mono); letter-spacing: 0.06em; color: var(--ink-3); }
.msg { max-width: 84%; white-space: pre-wrap; overflow-wrap: anywhere; }
/* The frosted pane over the older part of the history. A message in play is clear: it stands
   in front of the pane, in a patch wiped in the frost. Scroll up to read and the frost lifts. */
.frost {
  grid-row: 2; grid-column: 1; align-self: start; height: 57%; z-index: 1; pointer-events: none; transition: opacity 0.3s, height 0.3s;
  border-radius: 0 0 24px 24px; background: rgba(255, 255, 255, 0.3);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85), 0 14px 26px -18px rgba(100, 98, 135, 0.4);
}
:root[data-theme="dark"] .frost { background: rgba(255, 255, 255, 0.04); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12), 0 14px 26px -18px rgba(0, 0, 0, 0.6); }
.chat.reading .frost { opacity: 0; }
.log > * { transition: filter 0.3s, opacity 0.3s; }
.log > .frosted { filter: blur(5px); opacity: 0.55; }
.log > .frosted.clear { filter: none; opacity: 1; }
.chat.reading .log > .frosted { filter: none; opacity: 1; }
.msg.clear { position: relative; z-index: 2; }
.msg.clear::before {
  content: ""; position: absolute; inset: -13px -20px; z-index: -1; border-radius: 30px;
  background: radial-gradient(closest-side, var(--patch) 55%, transparent);
}
.msg.clear.you::before { inset: -11px -16px; }
:root { --patch: rgba(243, 242, 247, 0.97); --card: rgba(244, 243, 248, 0.9); }
:root[data-theme="dark"] { --patch: rgba(34, 34, 41, 0.97); --card: rgba(38, 38, 46, 0.9); }
.msg.au { align-self: flex-start; padding: 2px 2px; }
.msg.you { align-self: flex-end; padding: 9px 15px; border-radius: 18px 18px 6px 18px; background: var(--ground); box-shadow: var(--lift); font-weight: 500; }
.msg.note { color: var(--ink-2); }
.msg.new { animation: rise 0.28s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.composer { display: flex; align-items: center; gap: 10px; margin: 0 16px 16px; padding: 7px 7px 7px 20px; border-radius: 26px; background: var(--ground); box-shadow: var(--press); }
.composer input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font: 500 15.5px/1.4 var(--ui); padding: 9px 0; }
.composer input::placeholder { color: var(--ink-3); font-weight: 400; }
.composer button { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--ground); box-shadow: var(--lift); color: var(--ink-2); }
.composer button:active, .composer .mic.on { box-shadow: var(--press); color: var(--ink); }
.composer .mic.on { color: #d2456a; }
.composer svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.chat::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none; z-index: 4;
  background: linear-gradient(128deg, transparent 58%, rgba(255, 150, 215, 0.55) 72%, rgba(140, 205, 255, 0.6) 84%, rgba(255, 228, 150, 0.55) 96%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

/* ---- what the knowledge graph has in play, at the sides ---- */
.side { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 12px; transition: opacity 0.25s; }
#left { align-items: flex-end; text-align: right; }
#right { align-items: flex-start; }
.side h2 { margin: 14px 0 0; font: 400 11px/1 var(--mono); letter-spacing: 0.06em; color: var(--ink-3); }
.side h2:first-child { margin-top: 0; }
.side .row { display: flex; flex-wrap: wrap; gap: 9px; max-width: 100%; }
#left .row { justify-content: flex-end; }
.memory { cursor: pointer; }
.topic, .idea, .memory { position: relative; background: var(--ground); box-shadow: var(--lift); animation: pop 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.25) both; transition: opacity 0.2s, transform 0.2s; }
.topic.out, .idea.out, .memory.out { opacity: 0; transform: scale(0.85); }
@keyframes pop { from { opacity: 0; transform: translateX(var(--from, 0)) scale(0.8); } }
#left { --from: 26px; }
#right { --from: -26px; }
.topic { padding: 10px 16px; border-radius: 16px; font: 600 17px/1.2 var(--ui); }
.topic small { display: block; margin-top: 4px; font: 400 11px/1 var(--mono); color: var(--ink-3); }
.topic.near { font-weight: 500; font-size: 14.5px; color: var(--ink-2); padding: 8px 13px; }
.idea { padding: 6px 11px; border-radius: 11px; font: 500 12.5px/1 var(--mono); color: var(--ink-2); }
.memory { width: 100%; padding: 12px 15px 13px; border-radius: 16px; font-size: 13.5px; line-height: 1.42; background: var(--card); border: 1px solid var(--edge); }
.memory .meta { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; font: 400 11px/1.2 var(--mono); color: var(--ink-3); white-space: nowrap; }
.memory .meta span { margin-left: auto; padding-left: 8px; overflow: hidden; text-overflow: ellipsis; }
.memory .meta::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--tint); box-shadow: 0 0 8px var(--tint); }
.memory p { margin: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
.side .none { font: 400 12px/1.4 var(--mono); color: var(--ink-3); }

/* ---- zoomed out: every chat, small, side by side ---- */
body.overview .side { opacity: 0; pointer-events: none; }
body.overview #stage { grid-template-columns: 0 1fr 0; gap: 0; }
body.overview #chats { flex-wrap: wrap; gap: 40px; align-items: center; align-content: center; justify-content: center; }
body.overview .chat, body.overview .another { flex: none; width: 760px; height: 820px; zoom: 0.5; cursor: pointer; }
body.overview .chat > * { pointer-events: none; }
body:not(.overview) .chat:not(.here), body:not(.overview) .another { display: none; }
.another { border-radius: 26px; display: grid; place-items: center; font: 400 34px/1.3 var(--mono); color: var(--ink-3); text-align: center; box-shadow: var(--press); }

/* ---- a phone: the window fills the screen, the topics and ideas are a strip above it and the
   memories a strip below, each scrolling sideways. There is no room for lines of light, so a
   message in play carries a dot of its memory's colour instead. ---- */
.msg.clear::after { content: none; }
@media (max-width: 860px) {
  #stage { display: flex; flex-direction: column; gap: 8px; height: var(--tall, 100dvh); padding: max(8px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom)); }
  #lines { display: none; }
  #chats { flex: 1; }
  .side { flex: none; flex-direction: row; align-items: center; justify-content: flex-start; gap: 8px; margin: 0 -10px; padding: 8px 14px 12px; overflow-x: auto; scrollbar-width: none; text-align: left; }
  .side::-webkit-scrollbar { display: none; }
  .side h2 { display: none; }
  .side .row { flex: none; flex-wrap: nowrap; max-width: none; }
  #left, #right { --from: 0px; align-items: center; }
  .topic { padding: 8px 13px; font-size: 15px; white-space: nowrap; }
  .topic.near { font-size: 13.5px; padding: 7px 11px; }
  .topic small { display: none; }
  .idea { white-space: nowrap; }
  .memory { width: 262px; flex: none; padding: 10px 13px 11px; }
  .memory p { -webkit-line-clamp: 3; }
  .chat { border-radius: 22px; }
  .chat header { padding: 12px 16px 8px; }
  .log { padding: 4px 14px 14px; }
  .msg { max-width: 90%; }
  .composer { margin: 0 10px 10px; }
  .composer input { font-size: 16px; }      /* anything smaller and a phone zooms the page when the box is tapped */
  .msg.clear::after { content: ""; position: absolute; right: -11px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--tint); box-shadow: 0 0 8px var(--tint); }
  .msg.clear.au::after { right: auto; left: -11px; }
  body.overview #chats { overflow-y: auto; gap: 24px; padding: 20px 0; align-content: flex-start; }
  body.overview .chat, body.overview .another { zoom: 0.4; }
}
