/* Grove — Farm Renderer Aesthetics Exploration
 *
 * Design language: organic, living garden.
 * Entities are plants at different lifecycle stages.
 * Clusters are garden beds. Inbox items are scattered seeds.
 * Energy drives glow/opacity — high energy = vibrant, low = faded.
 */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a1208;
  --bg-surface: #111a0e;
  --bg-rail: #080e06;
  --text: #d4e2c8;
  --text-dim: #7a9468;

  /* Lifecycle palette */
  --seed: #f4e8a1;         /* pale gold — dormant potential */
  --sprouting: #7ec87e;    /* fresh green — active growth */
  --harvestable: #e8a838;  /* warm amber — ripe, ready */
  --decaying: #8b6b4a;     /* earthy brown — fading */
  --archived: #4a4a4a;     /* grey — dormant/cold storage */

  /* Glow */
  --glow-seed: rgba(244, 232, 161, 0.4);
  --glow-sprouting: rgba(126, 200, 126, 0.5);
  --glow-harvestable: rgba(232, 168, 56, 0.6);
  --glow-decaying: rgba(139, 107, 74, 0.2);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Georgia', 'Times New Roman', serif;
  min-height: 100vh;
  overflow: hidden;
}

#app {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 48px 1fr 1fr;
  grid-template-rows: 1fr;
  overflow: hidden;
}

/* Gardens Rail */
#rail {
  background: var(--bg-rail);
  border-right: 1px solid rgba(126, 200, 126, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 8px;
}

#garden {
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

/* Right panels container */
#right-panels {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-left: 1px solid rgba(126, 200, 126, 0.08);
}

#plot {
  flex: 6;
  overflow-y: auto;
  border-bottom: 1px solid rgba(126, 200, 126, 0.08);
  padding: 20px;
}

#bench {
  flex: 4;
  display: flex;
  flex-direction: column;
  padding: 0;
}

/* ── Cluster beds ── */
.cluster {
  position: absolute;
  border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%;
  background: var(--bg-surface);
  border: 1px solid rgba(126, 200, 126, 0.08);
  transition: all 0.6s ease;
}

.cluster-label {
  position: absolute;
  top: -24px;
  left: 16px;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── Entity nodes ── */
.entity {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.4s ease;
  /* energy drives filter/glow via inline style */
}

.entity .icon {
  font-size: 22px;
  line-height: 1;
}

.entity .title {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  white-space: nowrap;
  color: var(--text-dim);
  pointer-events: none;
}

/* Lifecycle visual states */
.entity[data-lifecycle="seed"] {
  background: radial-gradient(circle, var(--seed) 30%, transparent 70%);
  box-shadow: 0 0 12px var(--glow-seed);
}
.entity[data-lifecycle="seed"] .icon::after { content: "\1F331"; } /* seedling emoji as placeholder */

.entity[data-lifecycle="sprouting"] {
  background: radial-gradient(circle, var(--sprouting) 30%, transparent 70%);
  box-shadow: 0 0 16px var(--glow-sprouting);
}

.entity[data-lifecycle="harvestable"] {
  background: radial-gradient(circle, var(--harvestable) 25%, transparent 70%);
  box-shadow: 0 0 20px var(--glow-harvestable);
  animation: pulse-harvest 3s ease-in-out infinite;
}

.entity[data-lifecycle="decaying"] {
  background: radial-gradient(circle, var(--decaying) 30%, transparent 70%);
  box-shadow: 0 0 8px var(--glow-decaying);
}

.entity[data-lifecycle="archived"] {
  background: radial-gradient(circle, var(--archived) 30%, transparent 80%);
}

@keyframes pulse-harvest {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* ── Edges ── */
.edge {
  position: absolute;
  pointer-events: none;
}

.edge line {
  stroke: rgba(126, 200, 126, 0.15);
  stroke-width: 1;
}

/* ── Inbox (unlinked seeds) ── */
.inbox-area {
  position: absolute;
  bottom: 24px;
  right: 24px;
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(244, 232, 161, 0.15);
  border-radius: 12px;
}

.inbox-label {
  position: absolute;
  top: -18px;
  left: 8px;
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Selection states */
.entity.selected {
  transform: scale(1.2);
  z-index: 20;
  /* filter brightness handled inline to combine with energy filter */
}

.cluster.selected {
  border-color: rgba(126, 200, 126, 0.25);
}

/* Paths */
.path-warm {
  stroke: rgba(126, 200, 126, 0.3);
  stroke-width: 1.5;
  transition: stroke 0.4s ease, stroke-width 0.4s ease;
}
.path-cold {
  stroke: rgba(126, 200, 126, 0.08);
  stroke-width: 1;
  transition: stroke 0.4s ease, stroke-width 0.4s ease;
}

/* ── Tooltip on hover ── */
.entity:hover .title {
  color: var(--text);
}

.entity:hover {
  transform: scale(1.15);
  z-index: 10;
}

/* ── Plot panel ── */
.plot-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  font-size: 14px;
  font-style: italic;
}
.plot-header { margin-bottom: 16px; }
.plot-title { font-size: 20px; color: var(--text); margin-bottom: 8px; }
.plot-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.plot-lifecycle {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bg);
}
.plot-energy-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.05);
  overflow: hidden;
}
.plot-energy-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}
.plot-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.plot-tag {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: rgba(126, 200, 126, 0.08);
  color: var(--text-dim);
  border: 1px solid rgba(126, 200, 126, 0.1);
}
.plot-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 16px 0 8px;
}
.plot-links { list-style: none; }
.plot-link {
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
}
.plot-link:hover { color: var(--text); }
.plot-link-type {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-dim);
  opacity: 0.6;
  margin-right: 6px;
}
.plot-tended {
  font-size: 11px;
  color: var(--text-dim);
  margin: 12px 0;
}
.tool-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(126, 200, 126, 0.08);
  margin: 16px 0 0 0;
}
.tool-tab {
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.tool-tab:hover { color: var(--text); }
.tool-tab.active {
  color: var(--text);
  border-bottom-color: var(--sprouting);
}
.tool-content {
  padding: 16px 0;
  min-height: 120px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.6;
}

/* ── Bench panel (chat UI) ── */
.bench-scope {
  padding: 8px 16px;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(126, 200, 126, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.bench-collapse-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
}
.bench-collapse-btn:hover { color: var(--text); }
.bench-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bench-message {
  font-size: 13px;
  line-height: 1.5;
  max-width: 85%;
}
.bench-message-user {
  align-self: flex-end;
  background: rgba(126, 200, 126, 0.1);
  padding: 8px 12px;
  border-radius: 12px 12px 4px 12px;
  color: var(--text);
}
.bench-message-assistant {
  align-self: flex-start;
  color: var(--text-dim);
  padding: 8px 0;
}
.bench-input-area {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid rgba(126, 200, 126, 0.06);
}
.bench-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(126, 200, 126, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.bench-input:focus {
  border-color: rgba(126, 200, 126, 0.25);
}
.bench-send {
  background: rgba(126, 200, 126, 0.12);
  border: 1px solid rgba(126, 200, 126, 0.15);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
}
.bench-send:hover {
  background: rgba(126, 200, 126, 0.2);
}
#bench.collapsed .bench-messages,
#bench.collapsed .bench-scope { display: none; }
#bench.collapsed { flex: 0 0 auto; }
