/* ============================================================
   Aquarelle Garden — cozy isometric edition
   Pastel dream sky, floating island, toy-box UI
   ============================================================ */

:root {
  --ink: #5A4E6D;
  --ink-soft: #9B90AC;
  --card: rgba(255, 255, 255, 0.78);
  --edge: rgba(90, 78, 109, 0.12);
  --font-display: "Baloo 2", "Comic Sans MS", cursive;
  --font-body: "Nunito", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-body);
  /* pale diamond-check backdrop, like a cozy game menu */
  background-color: #FBF1F2;
  background-image:
    radial-gradient(ellipse 80% 55% at 50% 112%, #DFF0F3 0%, transparent 60%),
    repeating-conic-gradient(from 45deg, #F6E4E8 0% 25%, #FBF1F2 0% 50%);
  background-size: auto, 108px 108px;
}

/* ---------- the diorama ---------- */

#garden {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* whole island breathes, barely */
#garden .island,
#garden .shadows,
#garden .plants {
  animation: float 9s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

/* plants bob gently, out of sync with each other */
.plant use {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: bob var(--bob-dur, 4s) ease-in-out var(--bob-delay, 0s) infinite alternate;
}

/* this week's plants pop in with a toy-like bounce */
.plant.fresh use {
  animation:
    pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) var(--bob-delay, 0s) backwards,
    bob var(--bob-dur, 4s) ease-in-out calc(var(--bob-delay, 0s) + 0.7s) infinite alternate;
}

@keyframes bob {
  from { transform: translateY(0)      scale(1, 1); }
  to   { transform: translateY(-2.2px) scale(1.015, 0.985); }
}

@keyframes pop {
  0%   { transform: scale(0, 0); }
  70%  { transform: scale(1.12, 1.12); }
  100% { transform: scale(1, 1); }
}

.cloud { animation: drift-x 26s ease-in-out infinite alternate; }
.cloud.drift-b { animation-duration: 34s; animation-direction: alternate-reverse; }

@keyframes drift-x {
  from { transform: translate(var(--tx, 0)) translateX(-24px); }
  to   { transform: translateX(24px); }
}
/* keep clouds' base position: drift on a wrapper transform only */
.sky .cloud { transform-box: fill-box; transform-origin: center; }

.twinkle { animation: twinkle var(--tw-dur, 3s) ease-in-out var(--tw-delay, 0s) infinite; }

@keyframes twinkle {
  0%, 100% { opacity: 0.15; }
  50%      { opacity: 0.9; }
}

.petals ellipse { animation: petal var(--dur, 20s) linear var(--delay, 0s) infinite; }

@keyframes petal {
  0%   { transform: translate(0, 0); }
  50%  { transform: translate(30px, 40px); }
  100% { transform: translate(-12px, 96px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .plant use, .plant.fresh use, .cloud, .twinkle, .petals ellipse, .ripple,
  #garden .island, #garden .shadows, #garden .plants { animation: none; }
}

/* ---------- notebook panel ---------- */

.notebook {
  position: fixed;
  top: 18px;
  left: 18px;
  width: min(320px, calc(100vw - 36px));
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding: 18px 20px 16px;
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--edge);
  border-radius: 22px;
  box-shadow: 0 10px 30px rgba(122, 104, 156, 0.18);
}

.notebook h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.65rem;
  letter-spacing: 0.01em;
}

.notebook .sub {
  margin: 0 0 14px;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
}

.row { display: flex; gap: 8px; margin-bottom: 10px; }

select, button, .file-btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--edge);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
}

select { flex: 1; }

button:hover, .file-btn:hover { background: #fff; transform: translateY(-1px); }
button, .file-btn { transition: transform 0.12s ease, background 0.12s ease; }
button:focus-visible, select:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
button:disabled { opacity: 0.5; cursor: wait; transform: none; }

#fetch-btn {
  width: 100%;
  font-family: var(--font-display);
  font-size: 1rem;
  background: linear-gradient(135deg, #FFB48A, #F58FB0);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(245, 143, 176, 0.45);
}
#fetch-btn:hover:not(:disabled) { filter: brightness(1.05); }

.small-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.small-actions > * { flex: 1; text-align: center; font-size: 0.76rem; }
.file-btn input { display: none; }

#status {
  margin: 12px 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
  min-height: 1.2em;
}

/* ---------- legend ---------- */

#legend-title {
  margin: 16px 0 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
}

#legend {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
}

#legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px dashed var(--edge);
}

#legend .mini { width: 17px; height: 34px; flex: none; }
#legend .lbl  { flex: 1; }
#legend .val  { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
#legend .cnt  { width: 58px; text-align: right; font-weight: 800; }

/* ---------- species pigment strip ---------- */

#palette {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  gap: 9px;
  padding: 10px 16px;
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--edge);
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(122, 104, 156, 0.18);
  max-width: calc(100vw - 24px);
  overflow-x: auto;
}

.well {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  border: 1px solid rgba(90, 78, 109, 0.15);
  background: radial-gradient(circle at 32% 30%, #ffffff66, transparent 45%), var(--well);
  opacity: 0.3;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.well.painted { opacity: 1; }
.well:hover { transform: scale(1.25); }

@media (max-width: 640px) {
  .notebook { top: 10px; left: 10px; padding: 14px 16px; }
  .notebook h1 { font-size: 1.35rem; }
}

.ripple { animation: ripple 7s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.ripple:nth-of-type(2) { animation-delay: -3.5s; }

@keyframes ripple {
  from { transform: scale(0.985); opacity: 0.9; }
  to   { transform: scale(1.015); opacity: 0.45; }
}
