/* The garden's motion (js/garden-motion.js), kept to a few places (the owner: "don't exaggerate the
   garden touch ... only in a few places"): ivy round Home's five squares, a vine along How to play's
   progress, and petals when a mansuba is solved or a game is won. Buttons elsewhere stay plain.
   Fine lines in the garden's green with one crimson bud, the logo's colour. Decoration only: it
   never takes the pointer, lasts well under a second, and with reduced motion nothing grows or
   falls (the ivy and the vine simply stand finished). */

:root { --gm-stem: var(--leaf-lo); --gm-leaf: var(--leaf); --gm-leaf-2: color-mix(in srgb, var(--leaf) 70%, var(--leaf-lo)); }

/* ---------- ivy round a square: it grows while the square has the class "ivy", and unwinds after ---------- */
.gm-ivy { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.gm-ivy .gm-stem { fill: none; stroke: var(--gm-stem); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .32s cubic-bezier(.5, 0, .8, .5); }
.gm-ivy .gm-curl { stroke-width: 1.2; }
.gm-ivy .gm-leaf { fill: var(--gm-leaf); transform: scale(0); transition: transform .18s ease-in; }
.gm-ivy .gm-leaf.b { fill: var(--gm-leaf-2); }
.gm-ivy .gm-bud { fill: var(--accent); transform: scale(0); transition: transform .18s ease-in; }
.ivy > .gm-ivy .gm-stem { stroke-dashoffset: 0; transition: stroke-dashoffset var(--gm-grow, .54s) cubic-bezier(.3, .1, .2, 1); }
/* each leaf opens as the stem reaches it, with a small spring */
.ivy > .gm-ivy .gm-leaf, .ivy > .gm-ivy .gm-bud { transform: scale(1); transition: transform .28s cubic-bezier(.3, 1.6, .5, 1) calc(var(--at) * var(--gm-grow, .54s) * .9); }

/* ---------- a vine along a bar: it grows to how far along the visitor is ---------- */
.gm-vinebar { height: 16px; overflow: visible; border-radius: 0; background: none; }
.gm-vine { display: block; width: 100%; height: 16px; overflow: visible; }
.gm-vine .gm-track { fill: none; stroke: color-mix(in srgb, var(--text) 26%, transparent); stroke-width: 2; stroke-linecap: round; }   /* (seen even when nothing has grown on it yet) */
.gm-vine .gm-stem { fill: none; stroke: var(--leaf); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--from)); transition: stroke-dashoffset .6s cubic-bezier(.3, .1, .2, 1); }
.gm-vine.grown .gm-stem { stroke-dashoffset: calc(1 - var(--to)); }
.gm-vine .gm-leaf { fill: var(--leaf); transform: scale(0); }
.gm-vine .gm-leaf.b { fill: var(--gm-leaf-2); }
.gm-vine .gm-leaf.was { transform: scale(1); }
.gm-vine .gm-bud { fill: var(--accent); transform: scale(0); }
.gm-vine.grown .gm-leaf.on, .gm-vine.grown .gm-bud.on { transform: scale(1); transition: transform .28s cubic-bezier(.3, 1.6, .5, 1) calc(.18s + var(--at) * .4s); }

/* ---------- petals: a few fall from the place of a win, once ---------- */
.gm-petals { position: fixed; inset: 0; z-index: 70; overflow: hidden; pointer-events: none; }
.gm-petal { position: absolute; width: 13px; height: 12px; overflow: visible; }
.gm-petal.leaf path { fill: var(--leaf); }
.gm-petal.rose path { fill: var(--rose); }
.gm-petal.pale path { fill: color-mix(in srgb, var(--rose) 40%, #fff7ee); }

@media (prefers-reduced-motion: reduce) {
  .gm-ivy .gm-stem, .gm-ivy .gm-leaf, .gm-ivy .gm-bud, .ivy > .gm-ivy .gm-stem, .ivy > .gm-ivy .gm-leaf, .ivy > .gm-ivy .gm-bud,
  .gm-vine .gm-stem, .gm-vine.grown .gm-leaf.on, .gm-vine.grown .gm-bud.on { transition: none; }
}

/* ---------- the approved motions of 26 Nov 2026 (js/garden-motion.js) ----------
   Night (the dark theme, the default): lighter than the ground, with a faint glow. Day (the light theme):
   darker than the ground, no glow. One set of tokens; each motion has a still version (reduced motion). */
:root {
  --ft-water: #b7d3ee; --ft-glow: drop-shadow(0 0 3px rgba(170, 205, 240, .5));
  --flame: #ffc24a; --flame-core: #fff1b8; --flame-glow: drop-shadow(0 0 4px rgba(255, 190, 80, .75));
  --lantern-ink: #e8dcc0; --lantern-glass: rgba(255, 214, 120, .14);
  --vine-glow: drop-shadow(0 0 2px rgba(160, 230, 130, .55));
  --bf-wing: #f3a9b6; --bf-ink: #f6ecd4;
  --ff: #eaf7a8; --ff-halo: rgba(234, 247, 168, .35);
}
:root[data-theme="light"] {
  --ft-water: #2e7fb8; --ft-glow: none;
  --flame: #e8922a; --flame-core: #ffd774; --flame-glow: none;
  --lantern-ink: #6b5a3a; --lantern-glass: rgba(232, 146, 42, .12);
  --vine-glow: none;
  --bf-wing: #d9677f; --bf-ink: #2a1416;
}

/* (5) the fountain: the loading sign everywhere */
.gm-fountain { display: inline-flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-3); font-size: 14px; font-weight: var(--w-meta); }
.gm-fountain svg { width: 48px; height: 30px; overflow: visible; filter: var(--ft-glow); }
.gm-fountain.small { flex-direction: row; gap: 8px; }
.gm-fountain.small svg { width: 26px; height: 17px; }
.ft-jet { fill: none; stroke: var(--ft-water); stroke-width: 2.2; stroke-linecap: round; transform-origin: 24px 23px; animation: ft-rise 1.8s ease-in-out infinite; }
.ft-jet.j2 { animation-delay: -.6s; stroke-width: 2; }
.ft-jet.j3 { animation-delay: -1.2s; }
.ft-basin { fill: none; stroke: var(--ft-water); stroke-width: 2; stroke-linecap: round; opacity: .55; }
@keyframes ft-rise { 0%, 100% { transform: scaleY(.45); opacity: .55; } 50% { transform: scaleY(1); opacity: 1; } }
.loading .gm-fountain { margin: 0 auto; }

/* (7) the lantern of the daily streak; at night it glows and lights a small pool round it */
.gm-lantern { width: 17px; height: 24px; flex: none; overflow: visible; vertical-align: -5px; }
.gm-lantern .ln-hook, .gm-lantern .ln-cap, .gm-lantern .ln-glass, .gm-lantern .ln-base { fill: none; stroke: var(--lantern-ink); stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }
.gm-lantern .ln-glass { fill: var(--lantern-glass); }
.gm-lantern .ln-cap, .gm-lantern .ln-base { fill: var(--lantern-ink); }
.gm-lantern .ln-fire { transform-origin: 10px 19px; transform: scale(var(--flame-s)); filter: var(--flame-glow); animation: ln-flicker 2.4s ease-in-out infinite; }
.gm-lantern .ln-flame { fill: var(--flame); }
.gm-lantern .ln-core { fill: var(--flame-core); }
@keyframes ln-flicker { 0%, 100% { transform: scale(var(--flame-s)) rotate(0deg); } 30% { transform: scale(calc(var(--flame-s) * 1.06), calc(var(--flame-s) * .95)) rotate(-2deg); } 62% { transform: scale(calc(var(--flame-s) * .96), calc(var(--flame-s) * 1.05)) rotate(1.5deg); } }
.streak.lit { position: relative; isolation: isolate; }
:root:not([data-theme="light"]) .streak.lit::before { content: ""; position: absolute; z-index: -1; left: -10px; top: 50%; width: 40px; height: 40px; transform: translateY(-50%); border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 196, 90, .28), rgba(255, 196, 90, 0)); pointer-events: none; }

/* (8) the vine bars glow a little at night */
.gm-vine .gm-stem, .gm-vine .gm-leaf { filter: var(--vine-glow); }
:root:not([data-theme="light"]) .gm-vine .gm-stem { stroke: #86c777; }
:root:not([data-theme="light"]) .gm-vine .gm-leaf { fill: #6dbb5f; }
:root:not([data-theme="light"]) .gm-vine .gm-leaf.b { fill: #a8dc8c; }

/* (2) visitors on the ivy: a butterfly by day, two fireflies by night */
.gm-visit { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.gm-visit .bf { transform: translate(var(--x), var(--y)) scale(var(--s)); }
.gm-visit .bf-body { animation: bf-land 3.4s cubic-bezier(.3, .7, .3, 1) both; }
.gm-visit .bf-w { fill: var(--bf-wing); stroke: var(--bf-ink); stroke-width: 1; transform-origin: 0 0; animation: bf-flap .26s ease-in-out infinite alternate; }
.gm-visit .bf-w.r { animation-delay: -.13s; }
.gm-visit .bf-trunk { stroke: var(--bf-ink); stroke-width: 1.6; stroke-linecap: round; }
@keyframes bf-land { 0% { transform: translate(-26px, -34px) rotate(-18deg); opacity: 0; } 12% { opacity: 1; } 38% { transform: translate(0, 0) rotate(0deg); } 80% { transform: translate(0, 0) rotate(0deg); opacity: 1; } 100% { transform: translate(30px, -40px) rotate(16deg); opacity: 0; } }
@keyframes bf-flap { from { transform: scaleX(1); } to { transform: scaleX(.35); } }
.gm-visit .ff { transform: translate(var(--x0), var(--y)); animation: ff-drift 3.4s ease-in-out both; }
.gm-visit .ff1 { animation-delay: .35s; }
.gm-visit .ff-dot { fill: var(--ff); }
.gm-visit .ff-halo { fill: var(--ff-halo); }
.gm-visit .ff circle { animation: ff-blink 1.1s ease-in-out infinite; }
.gm-visit .ff1 circle { animation-delay: -.55s; }
@keyframes ff-drift { 0% { transform: translate(var(--x0), var(--y)); opacity: 0; } 15%, 85% { opacity: 1; } 100% { transform: translate(var(--x1), calc(var(--y) - 4px)); opacity: 0; } }
@keyframes ff-blink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* (10) the sky of the theme button: the sun sets behind the wall, or the moon sinks and the sun rises */
.gm-sky .sky-sun circle { fill: currentColor; }
.gm-sky .sky-sun path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.gm-sky .sky-moon path { fill: currentColor; }
.gm-sky .sky-wall { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.gm-sky .sky-moon { transform: translateY(12px); }
.gm-sky.is-night .sky-sun { transform: translateY(12px); }
.gm-sky.is-night .sky-moon { transform: none; }
.gm-sky.go-night .sky-sun { animation: sky-down .3s ease-in forwards; }
.gm-sky.go-night .sky-moon { animation: sky-up .26s .26s ease-out forwards; }
.gm-sky.go-day .sky-moon { animation: sky-down .3s ease-in forwards; }
.gm-sky.go-day .sky-sun { animation: sky-up .26s .26s ease-out forwards; }
@keyframes sky-down { from { transform: none; } to { transform: translateY(12px); } }
@keyframes sky-up { from { transform: translateY(12px); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .ft-jet, .gm-lantern .ln-fire, .gm-visit .bf-body, .gm-visit .bf-w, .gm-visit .ff, .gm-visit .ff circle { animation: none; }
  .gm-visit .ff { transform: translate(var(--x1), var(--y)); }
}

/* (4) petals on a win (js/garden-motion.js winPetals): over the card, never in the way of a click, never a scrollbar */
.gm-win { z-index: 80; }
.gm-win-petal { position: absolute; border-radius: 80% 0 80% 0; pointer-events: none; }
:root:not([data-theme="light"]) .gm-win-petal { box-shadow: 0 0 6px rgba(255, 200, 150, .7); }

/* (12) the gust between sections (js/garden-motion.js gust): a layer above the page that every click passes
   through and that can never make the page scroll. Each leaf is a face with its paler underside over it, which
   the animation shows as the leaf turns over; both are moved by Web Animations (transform and opacity only). */
.gm-gust { position: fixed; inset: 0; z-index: 140; overflow: hidden; pointer-events: none; contain: strict; }
.gm-leaf { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform, opacity; opacity: 0; transform-style: preserve-3d; }
.gm-leaf svg { display: block; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.gm-leaf .gm-under { position: absolute; left: 0; top: 0; transform: rotateY(180deg); }
:root:not([data-theme="light"]) .gm-leaf svg { filter: drop-shadow(0 0 4px rgba(190, 240, 160, .75)); }
.gm-leaf.near svg { filter: blur(.8px); }
:root:not([data-theme="light"]) .gm-leaf.near svg { filter: blur(.8px) drop-shadow(0 0 4px rgba(190, 240, 160, .75)); }
/* in a gust of many leaves, the ones further back: a little blurred, no glow (the cheap ones) */
.gm-leaf.far svg, :root:not([data-theme="light"]) .gm-leaf.far svg { filter: blur(.6px); }
/* in a big gust, the few nearest leaves: more blurred, and by day a soft shadow on the page */
.gm-leaf.near.big svg { filter: blur(1.6px) drop-shadow(0 10px 8px rgba(50, 45, 20, .26)); }
:root:not([data-theme="light"]) .gm-leaf.near.big svg { filter: blur(1.6px) drop-shadow(0 0 5px rgba(190, 240, 160, .6)); }
/* (12b) the leaf wipe, to compare (?motion=wipe; js/garden-motion.js wipe): the band of leaves above everything;
   under it, a still copy of the old page's content over the new page, wiped away behind the band through a soft
   edge that the script moves along the wind. The copy takes a press only to end the wipe, and never scrolls. */
.gm-wipe { z-index: 150; }
:root:not([data-theme="light"]) .gm-wipe .gm-leaf svg { filter: drop-shadow(0 0 3px rgba(190, 240, 160, .6)); }
.gm-wipe .gm-leaf.near svg, :root:not([data-theme="light"]) .gm-wipe .gm-leaf.near svg { filter: blur(1px); }
.gm-was { position: fixed; z-index: 120; overflow: hidden; contain: strict; background: var(--bg); pointer-events: auto; will-change: mask-position;
  -webkit-mask-image: linear-gradient(var(--gm-wipe-deg, 90deg), transparent 48.5%, #000 51.5%); mask-image: linear-gradient(var(--gm-wipe-deg, 90deg), transparent 48.5%, #000 51.5%);
  -webkit-mask-size: 500% 500%; mask-size: 500% 500%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
.gm-was > * { pointer-events: none; }
.gm-was *, .gm-was *::before, .gm-was *::after { animation: none !important; transition: none !important; }   /* the copy stands still: nothing in it lands again */
@media (prefers-reduced-motion: reduce) { .gm-was { display: none; } }
/* (13) the carnival when the garden grows (js/garden-motion.js prepareCarnival): petals, small flowers, leaves and glints,
   above everything, every click passing through; by night they glow */
.gm-carnival { z-index: 160; }
.gm-carnival .gm-piece { transform-style: flat; }
.gm-carnival .gm-piece svg { -webkit-backface-visibility: visible; backface-visibility: visible; }
.gm-carnival .gm-piece.glint svg { filter: drop-shadow(0 0 3px rgba(255, 196, 60, .85)); }
:root:not([data-theme="light"]) .gm-carnival .gm-piece svg { filter: drop-shadow(0 0 4px rgba(255, 226, 190, .7)); }
:root:not([data-theme="light"]) .gm-carnival .gm-piece.glint svg { filter: drop-shadow(0 0 6px rgba(255, 236, 160, .95)) drop-shadow(0 0 12px rgba(255, 210, 120, .6)); }
.gm-carnival .gm-leaf.near svg { filter: blur(1.4px) drop-shadow(0 10px 8px rgba(50, 45, 20, .24)); }
:root:not([data-theme="light"]) .gm-carnival .gm-leaf.near svg { filter: blur(1.4px) drop-shadow(0 0 5px rgba(255, 226, 190, .55)); }
:root .gm-carnival .gm-leaf.far svg, :root:not([data-theme="light"]) .gm-carnival .gm-leaf.far svg { filter: blur(.6px); }
/* for people who ask for reduced motion: a short still glow on the new plant instead */
.gm-glow { position: fixed; z-index: 160; width: 180px; height: 180px; margin: -90px 0 0 -90px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 214, 120, .55), rgba(255, 190, 120, .22) 55%, rgba(255, 190, 120, 0)); }
/* in review mode (?motion=leaves), when the system asks for reduced motion: why nothing shows */
.gm-gust-note { position: fixed; right: 16px; bottom: 64px; z-index: 141; max-width: min(320px, calc(100vw - 32px)); margin: 0; padding: 8px 12px; border-radius: 8px;
  background: var(--panel-3); color: var(--text); font-size: 13px; line-height: 1.4; box-shadow: var(--shadow-lg); }
@media (max-width: 720px) { .gm-gust-note { right: 12px; left: 12px; max-width: none; bottom: calc(124px + env(safe-area-inset-bottom, 0px)); } }
@media (prefers-reduced-motion: reduce) { .gm-gust { display: none; } }
/* for review only (?motion=leaves): two small buttons that play the gust or the wipe again, and what played */
.gm-gust-try { position: fixed; left: 12px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 141; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.gm-gust-try .gm-gust-seed { font-size: 12px; color: var(--text-3); background: var(--panel); padding: 2px 8px; border-radius: 6px; }
@media (min-width: 721px) { .gm-gust-try { left: auto; right: 16px; bottom: 16px; } }

/* (3) the drop inside the main crimson button (js/garden-motion.js dropIn): everything is clipped to the
   button's face, under its words; the button sinks onto its base when the drop lands */
.gm-drop { position: absolute; inset: 0; z-index: -1; overflow: hidden; border-radius: inherit; pointer-events: none; }
.gm-drop-d { position: absolute; top: -10px; width: 7px; height: 9px; margin-left: -3.5px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 35% 35%, #fff, rgba(255, 225, 232, .9) 60%, rgba(255, 190, 205, .8)); }
.gm-drop-r { position: absolute; border-radius: 50%; border: 1.5px solid rgba(255, 238, 242, .85); transform: translate(-50%, -50%) scale(.05); opacity: 0; }
:root:not([data-theme="light"]) .gm-drop-r { border-color: rgba(255, 205, 218, .95); box-shadow: 0 0 6px rgba(255, 150, 175, .5); }
.btn.primary.gm-down { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-lo); }
.btn.primary.big.gm-down { transform: translateY(3px); }
@media (prefers-reduced-motion: reduce) { .gm-drop { display: none; } .btn.primary.gm-down { transform: none; } }
