/*
 * The page is the logo, centred, growing once and then swaying gently.
 *
 * Every rule below describes the finished picture. The animations only say
 * how to get there, so with motion turned off (or an old browser) the logo is
 * simply shown complete.
 */

:root {
  --page: #f8f8f6;
  --mark: #059669;
  --ink: #1c1917;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0b0f0d;
    --mark: #34d399;
    --ink: #f5f5f4;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--page);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main {
  display: grid;
  min-height: 100%;
  place-content: center;
  justify-items: center;
  gap: clamp(0.75rem, 2.5vmin, 1.25rem);
  padding: 1.5rem;
}

.mark {
  width: clamp(6rem, 28vmin, 11rem);
  height: auto;
  overflow: visible;
  fill: none;
  stroke: var(--mark);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.name {
  margin: 0;
  font-size: clamp(1.5rem, 5vmin, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}

/* Positions here are in the drawing's own 24-unit grid. */
.sprout {
  transform-origin: 12px 21px; /* where the stem meets the ground */
}

.leaf {
  transform-origin: 12px 13px; /* where the leaf joins the stem */
}

.ground,
.stem {
  stroke-dasharray: 1;
}

.ground {
  animation: draw 0.5s cubic-bezier(0.65, 0, 0.35, 1) both;
}

/* Drawn backwards, from the ground up, which is the way a plant grows. */
.stem {
  animation: grow 1.1s 0.35s cubic-bezier(0.45, 0, 0.2, 1) both;
}

.leaf {
  animation: unfurl 0.7s 0.95s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

.name {
  animation: rise 0.7s 1.35s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.sprout {
  animation: sway 6s 1.9s ease-in-out infinite;
}

/* A stroke with round ends shows a dot even at zero length, so each stroke
   is also hidden until it starts. */
@keyframes draw {
  from {
    stroke-dashoffset: 1;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
}

@keyframes grow {
  from {
    stroke-dashoffset: -1;
    opacity: 0;
  }
  5% {
    opacity: 1;
  }
}

@keyframes unfurl {
  from {
    transform: scale(0) rotate(35deg);
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
}

@keyframes rise {
  from {
    transform: translateY(0.4em);
    opacity: 0;
  }
}

@keyframes sway {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(2.5deg);
  }
  75% {
    transform: rotate(-2.5deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ground,
  .stem,
  .leaf,
  .name,
  .sprout {
    animation: none;
  }
}
