/* Simpel app: en blomst, der springer ud. Kun lokale filer, ingen eksterne biblioteker. */

:root {
  --bg: #f4f7f2;
  --ink: #2d3b2f;
  --accent: #e8608a;
  --stem: #4f8a4a;
}

body {
  margin: 0;
  padding: 24px;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 system-ui, -apple-system, sans-serif;
}

main {
  max-width: 480px;
  margin: auto;
  text-align: center;
}

.intro {
  color: #5a6b5c;
  margin-bottom: 16px;
}

/* Scenen med blomsten */
.scene {
  position: relative;
  height: 320px;
  margin: 8px auto 16px;
  max-width: 320px;
}

.ground {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 180px;
  height: 14px;
  background: #d9e4d3;
  border-radius: 50%;
}

.stem {
  position: absolute;
  bottom: 14px;
  left: 50%;
  width: 6px;
  height: 0;
  margin-left: -3px;
  background: var(--stem);
  border-radius: 3px;
  transition: height 1.2s ease-in-out;
}

/* Blade vokser frem sammen med stænglen */
.leaf {
  position: absolute;
  bottom: 60px;
  width: 56px;
  height: 22px;
  background: var(--stem);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  opacity: 0;
  transform: scale(0.2);
  transition: opacity 0.6s ease, transform 0.8s ease;
}

.leaf-left {
  left: 50%;
  transform-origin: right center;
  margin-left: -62px;
}

.leaf-right {
  left: 50%;
  transform-origin: left center;
  margin-left: 6px;
  bottom: 90px;
}

.planted .stem {
  height: 220px;
}

.planted .leaf {
  opacity: 1;
  transform: scale(1);
}

/* Blomsterhovedet starter som lukket knop */
.bloom {
  position: absolute;
  bottom: 210px;
  left: 50%;
  width: 0;
  height: 0;
  opacity: 0;
}

.planted .bloom {
  width: 140px;
  height: 140px;
  margin-left: -70px;
  opacity: 1;
  transition: width 0.1s, height 0.1s, margin 0.1s, opacity 0.4s ease 1s;
}

.petal {
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: 56px;
  height: 86px;
  margin-left: -28px;
  background: var(--accent);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  transform-origin: 50% 100%;
  --spread: 0deg; /* roteres ekstra via --i og --open */
  transform: rotate(calc(var(--i) * 60deg)) translateY(calc(0 - var(--petal-lift, 0px))) scale(var(--petal-scale, 0.45));
  opacity: var(--petal-opacity, 0.5);
  transition: transform 1.4s cubic-bezier(.34,1.56,.64,1) 1.6s, opacity 0.8s ease 1.6s;
  box-shadow: inset 0 -8px 14px rgba(0,0,0,0.15);
}

.open .petal {
  --petal-scale: 1;
  --petal-opacity: 1;
  --petal-lift: 34px;
}

.core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  background: #f3c14b;
  border-radius: 50%;
  transform: scale(0);
  transition: transform 0.6s cubic-bezier(.34,1.56,.64,1) 2.6s;
  box-shadow: 0 0 0 4px rgba(243,193,75,0.35);
}

.open .core {
  transform: scale(1);
}

/* Knap */
button.primary {
  font: inherit;
  font-weight: 600;
  padding: 12px 24px;
  border: none;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
}

button.primary:hover {
  background: #40543f;
}

button.primary:focus-visible {
  outline: 3px solid #9fc39a;
  outline-offset: 2px;
}

.status {
  min-height: 1.6em;
  margin-top: 12px;
  font-size: 14px;
  color: #5a6b5c;
}

@media (max-width: 400px) {
  .scene {
    transform: scale(0.85);
  }
}
