/* Chrome, kept as close to nothing as it can get.
 *
 * Two things here are load-bearing on the look rather than decorative. The
 * `screen`-blended glow canvas is how light is allowed to be lighter than the
 * sky while the ink layer never is — the compositor enforces a rule that would
 * otherwise be a comment nobody reads. And the grain is *static*: an animated
 * film grain is exhausting after twenty minutes, and twenty minutes is exactly
 * how long this piece is meant to hold you.
 */

:root {
  --ui: #C9C3B4;
  --ui-dim: rgba(201, 195, 180, 0.34);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #0A1019;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  font: 400 13px/1.6 ui-serif, Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  color: var(--ui);
}

#garden {
  position: fixed;
  inset: 0;
  isolation: isolate;
  cursor: crosshair;
  touch-action: none;
}

#garden.grabbing { cursor: grabbing; }
#garden.over-plant { cursor: pointer; }

#scene, #glow {
  position: absolute;
  inset: 0;
  display: block;
}

#glow {
  mix-blend-mode: screen;
  pointer-events: none;
  /* Upscaled six-fold from its backing store. The softness is the point: a
     bloom that is sharper than the thing blooming looks like a sticker. */
  image-rendering: auto;
}

#grain {
  position: absolute;
  inset: -2px;
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: 0.055;
  background-repeat: repeat;
  background-size: 128px 128px;
  animation: drift 24s steps(4, end) infinite;
}

@keyframes drift {
  0%   { background-position: 0 0; }
  25%  { background-position: 1px 0; }
  50%  { background-position: 1px 1px; }
  75%  { background-position: 0 1px; }
  100% { background-position: 0 0; }
}

#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 46%, transparent 42%, rgba(28, 22, 16, 0.34) 100%);
}

/* ── the one text surface ─────────────────────────────────────────────────── */

#line {
  position: absolute;
  left: 28px;
  bottom: 22px;
  margin: 0;
  max-width: 30rem;
  font-size: 13px;
  letter-spacing: 0.012em;
  color: var(--ui);
  opacity: 0;
  transition: opacity 900ms ease;
  pointer-events: none;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}

#line.show { opacity: 0.78; }

#namefield {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* ── the tray: one glyph until you go looking ─────────────────────────────── */

#tray {
  position: absolute;
  right: 24px;
  bottom: 24px;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 6px;
}

#tray button {
  appearance: none;
  border: 0;
  background: none;
  color: var(--ui);
  opacity: 0.3;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font: 15px/1 ui-serif, Georgia, serif;
  cursor: pointer;
  border-radius: 50%;
  transition: opacity 320ms ease, background 200ms ease;
}

#tray button:hover,
#tray button:focus-visible {
  opacity: 0.85;
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

#tray button:focus-visible { box-shadow: 0 0 0 1px var(--ui-dim); }

#tray.idle button { opacity: 0.12; }
#tray.idle:hover button { opacity: 0.55; }

#tray button[aria-pressed="false"] { text-decoration: line-through; opacity: 0.18; }

#trayItems {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#trayItems[hidden] { display: none; }

/* The hold-to-reset ring, drawn as a conic gradient so it costs no canvas. */
#tray button.holding {
  background: conic-gradient(var(--ui-dim) calc(var(--hold, 0) * 360deg), transparent 0);
}

/* ── goodnight ────────────────────────────────────────────────────────────── */

#garden::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, transparent 0%, #05080d 70%);
  opacity: 0;
  transition: opacity 5s ease-in;
}

#garden.goodnight::after { opacity: 1; }
#garden.goodnight { cursor: default; }

@media (prefers-reduced-motion: reduce) {
  #grain { animation: none; }
  #line { transition-duration: 1ms; }
}
