/* Grove. The world is the interface; everything else stays quiet. Panes are pixel frames: square, a hard 1px
   edge and a hard offset shadow (no soft glows), frosted just enough to read over the sky. Text is the content:
   Geist for writing, Geist Mono only for the few small labels. Lime means alive. */

@font-face { font-family: "Geist"; src: url("/fonts/Geist-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/fonts/Geist-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/fonts/Geist-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/fonts/GeistMono-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }

:root {
  --ink: #101c36;
  --ink-2: #33466b;
  --faint: #7d8fb0;
  --line: rgba(16, 28, 54, 0.1);
  --paper: rgba(250, 252, 255, 0.9);
  --frame: #101c36;
  --lime: #c6ff3d;
  --lime-ink: #4c7a00;
  --red: #e8473c;
  --font: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a44ad; }
body { color: var(--ink); font: 400 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
a { color: #1f56c9; }
svg { display: block; flex: none; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 1px; }
.grow { flex: 1; min-width: 0; }
.faint { color: var(--faint); }

#world { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; cursor: grab; touch-action: none; image-rendering: pixelated; }

.pane {
  background: var(--paper);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--frame);
  box-shadow: 4px 4px 0 rgba(10, 22, 60, 0.32);
}

/* ---------- top ---------- */

.brand { position: fixed; top: 20px; left: 22px; z-index: 10; pointer-events: none; user-select: none; }
.wordmark { display: block; image-rendering: pixelated; }
.brand .line { margin-top: 8px; display: flex; align-items: center; gap: 7px; font: 500 10.5px var(--mono); letter-spacing: 0.08em; color: rgba(255, 255, 255, 0.85); text-shadow: 1px 1px 0 rgba(10, 22, 60, 0.4); }
.pulse { width: 6px; height: 6px; background: var(--lime); display: block; animation: pulse 2.4s steps(2) infinite; }
.pulse.off { background: var(--red); animation: none; }
@keyframes pulse { 50% { opacity: 0.35; } }

.search { position: fixed; top: 18px; right: 18px; z-index: 12; width: 280px; }
.search label { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; color: var(--faint); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--ink); }
.search input::placeholder { color: var(--faint); }
.results { margin-top: 8px; max-height: 60vh; overflow-y: auto; padding: 4px 0; }

.indexbtn { position: fixed; left: 22px; top: 84px; z-index: 11; font: 500 10.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: #fff; text-shadow: 1px 1px 0 rgba(10, 22, 60, 0.4); padding: 4px 0; }
.indexbtn:hover { color: var(--lime); }

/* ---------- rows (index, lists, search) ---------- */

.row { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 30px; padding: 3px 14px; font-size: 14px; }
button.row:hover, .row.on { background: rgba(198, 255, 61, 0.32); }
.row.cluster { font-weight: 500; }
.row.cluster > button { display: flex; align-items: center; gap: 9px; }
.row.idea { color: var(--ink-2); }
.row .faint { font-size: 12px; }
.caret { width: 12px; color: var(--faint); font: 500 12px var(--mono); text-align: center; }
.swatch { width: 8px; height: 8px; display: block; flex: none; }
.vital { width: 6px; height: 6px; display: block; flex: none; background: #b5c1d6; }
.vital.thriving { background: var(--lime); box-shadow: 0 0 0 1px #7fc31e; }
.vital.active { background: #7fc31e; }
.vital.dormant { background: transparent; box-shadow: inset 0 0 0 1px #b5c1d6; }
.inline-input { margin: 4px 14px 4px 24px; width: calc(100% - 38px); height: 30px; border: 1px solid var(--frame); background: #fff; outline: 0; padding: 0 8px; }

.index { position: fixed; left: 16px; top: 110px; bottom: 90px; width: 270px; z-index: 13; display: flex; flex-direction: column; }
.index-body { flex: 1; overflow-y: auto; padding: 8px 0; }
.index-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12.5px; }
.index-foot a { text-decoration: none; }

/* ---------- panel: an idea's note, a cluster's brief ---------- */

.panel { position: fixed; top: 70px; right: 18px; bottom: 90px; width: 440px; z-index: 13; display: flex; flex-direction: column; }
.panel .close { position: absolute; top: 8px; right: 10px; width: 28px; height: 28px; font-size: 20px; line-height: 26px; text-align: center; color: var(--faint); z-index: 2; }
.panel .close:hover { color: var(--ink); }
.panel-body { flex: 1; overflow-y: auto; padding: 18px 24px 22px; display: flex; flex-direction: column; }
.where { font: 500 10.5px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); min-height: 18px; padding-right: 30px; }
.where button:hover { color: var(--ink); }
.title { width: 100%; border: 0; outline: 0; background: none; padding: 0; margin: 6px 0 8px; resize: none; overflow: hidden; font: 600 23px/1.25 var(--font); letter-spacing: -0.015em; color: var(--ink); display: block; }
.title::placeholder { color: var(--faint); }
.foot { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--faint); }
.foot button:hover { color: var(--ink); text-decoration: underline; }
.list { margin: 8px -24px 0; }
.list .row { padding-left: 24px; padding-right: 24px; }

.history { margin-top: 10px; font-size: 12.5px; display: grid; gap: 2px; }
.hrow { display: flex; gap: 10px; align-items: baseline; padding: 3px 0; }
.hrow button { color: var(--faint); }
.hrow button:hover { color: var(--ink); text-decoration: underline; }

.moveto { display: grid; gap: 0; text-transform: none; letter-spacing: 0; font: 400 13.5px var(--font); }
.moveto input { height: 30px; border: 1px solid var(--frame); outline: 0; padding: 0 8px; background: #fff; color: var(--ink); }
.moveto button { padding: 5px 8px; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.moveto button:hover { background: rgba(198, 255, 61, 0.32); }

/* ---------- the note editor ---------- */

.note { position: relative; flex: 1; display: flex; flex-direction: column; }
.doc { flex: 1; outline: 0; min-height: 80px; font-size: 15px; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; padding-bottom: 8px; }
.note.big .doc { min-height: 180px; }
.doc[data-empty="1"]::before { content: attr(data-placeholder); color: var(--faint); position: absolute; pointer-events: none; }
.doc > :first-child { margin-top: 0; }
.doc p { margin: 0 0 8px; }
.doc h1 { font-size: 19px; font-weight: 600; margin: 16px 0 6px; letter-spacing: -0.01em; }
.doc h2 { font-size: 16px; font-weight: 600; margin: 14px 0 4px; }
.doc ul, .doc ol { margin: 0 0 8px; padding-left: 22px; }
.doc ul ul, .doc ol ol, .doc ul ol, .doc ol ul { margin-bottom: 0; }
.doc li { margin: 2px 0; }
.doc ul.todo { list-style: none; padding-left: 0; }
.doc ul.todo ul.todo { padding-left: 24px; }
.doc ul.todo > li { position: relative; padding-left: 26px; }
.doc ul.todo > li::before {
  content: ""; position: absolute; left: 1px; top: 5px; width: 13px; height: 13px; border: 1.5px solid var(--ink-2); background: #fff; cursor: pointer;
}
.doc ul.todo > li[data-checked="true"] { color: var(--faint); text-decoration: line-through; text-decoration-color: rgba(125, 143, 176, 0.7); }
.doc ul.todo > li[data-checked="true"]::before { background: var(--ink) linear-gradient(var(--lime), var(--lime)) center / 7px 7px no-repeat; border-color: var(--ink); }
.doc img { max-width: 100%; display: block; margin: 6px 0; border: 1px solid var(--line); }
.doc a { color: #1f56c9; }
.doc code { font: 500 13px var(--mono); background: rgba(16, 28, 54, 0.06); padding: 1px 4px; }
.fmt { display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; pointer-events: none; margin-top: 4px; }
.note:focus-within .fmt { opacity: 1; pointer-events: auto; }
.fmt button { width: 30px; height: 28px; display: flex; align-items: center; justify-content: center; color: var(--ink-2); font: 600 13px var(--font); border: 1px solid transparent; }
.fmt button:hover { border-color: var(--frame); background: #fff; }

/* ---------- bottom: plant, time ---------- */

.plant { position: fixed; left: 18px; bottom: 18px; z-index: 12; width: min(440px, calc(100vw - 36px)); }
.plantbox { display: flex; }
.plant textarea { flex: 1; min-width: 0; border: 0; outline: 0; background: none; resize: none; padding: 12px 14px; line-height: 20px; max-height: 180px; min-height: 44px; }
.plant textarea::placeholder { color: var(--ink-2); }
.plant .hint { margin-bottom: 10px; color: #fff; font-size: 14px; text-shadow: 1px 1px 0 rgba(10, 22, 60, 0.45); }
.plant.first .plantbox { box-shadow: 4px 4px 0 rgba(10, 22, 60, 0.32), 0 0 0 3px rgba(198, 255, 61, 0.55); }

.time { position: fixed; right: 18px; bottom: 20px; z-index: 12; display: flex; align-items: center; gap: 12px; color: #fff; font: 500 10.5px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; text-shadow: 1px 1px 0 rgba(10, 22, 60, 0.45); }
.time input[type="range"] { width: 200px; accent-color: var(--lime); }
.time button:hover { color: var(--lime); }

.tip { position: fixed; z-index: 20; pointer-events: none; padding: 6px 9px; max-width: 280px; background: var(--ink); color: #fff; box-shadow: 3px 3px 0 rgba(10, 22, 60, 0.32); font-size: 12px; }
.tip b { display: block; font-weight: 500; font-size: 13.5px; line-height: 1.3; }
.tip span { color: rgba(255, 255, 255, 0.7); }

.toasts { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 30; display: grid; gap: 6px; justify-items: center; }
.toast { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 13.5px; max-width: 520px; animation: rise 0.2s steps(3); }
.toast.err { background: var(--red); color: #fff; }
.toast button { font: 500 10.5px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.toast button:hover { color: var(--ink); }
.who { font: 500 9.5px var(--mono); letter-spacing: 0.1em; padding: 0 4px; background: var(--lime); color: var(--ink); }
@keyframes rise { from { transform: translateY(-6px); opacity: 0; } }

.signin { position: fixed; inset: 0; display: grid; place-items: center; z-index: 60; }
.signin .box { width: min(360px, calc(100vw - 32px)); padding: 28px; display: grid; gap: 14px; justify-items: start; }
.signin p { margin: 0; color: var(--ink-2); }
.btn { height: 40px; padding: 0 16px; display: inline-flex; align-items: center; background: var(--ink); color: #fff; text-decoration: none; font: 500 12px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; box-shadow: 3px 3px 0 rgba(10, 22, 60, 0.3); }
.btn:hover { background: #1f3460; }

@media (max-width: 900px) {
  .brand { top: 14px; left: 14px; }
  .wordmark { height: 22px !important; }
  .brand .line { display: none; }
  .search { left: 118px; right: 10px; top: 10px; width: auto; }
  .indexbtn { top: 46px; left: 14px; }
  .index { left: 8px; right: 8px; top: 84px; bottom: 80px; width: auto; }
  .panel { left: 0; right: 0; top: auto; bottom: 0; height: 70vh; width: auto; box-shadow: 0 -4px 0 rgba(10, 22, 60, 0.25); border-left: 0; border-right: 0; }
  .plant { left: 8px; right: 8px; bottom: 8px; width: auto; }
  .time { display: none; }
}
