/* The greenhouse contact form: a cream card with a greenhouse corner on the left (glass panes, a sill with little
   pots, the big terracotta pot with the philodendron) and three wooden plant labels on the right. The scene is drawn
   300 units wide and 360 high; the script draws the plant in it. All the colours are here, so the Playground palette
   can paint it again. */
:root {
  --page: #ffffff;          /* the page around the card */
  --cream: #f6ecd8;         /* the card */
  --glass: #cfe3d2;         /* the greenhouse glass, low */
  --glass-top: #eef5e6;     /* the greenhouse glass, high, where the light comes in */
  --frame: #3f6a5a;         /* the green iron frame of the greenhouse */
  --garden: #9cc79a;        /* the garden outside the glass */
  --leaf: #23693d;          /* the dark green of the leaves */
  --leaf-light: #5fae58;    /* the light green of the leaves */
  --dry: #c9952e;           /* a thirsty leaf */
  --dry-light: #e8c75a;     /* a thirsty leaf, where the light hits it */
  --clay: #cf6b3f;          /* the terracotta */
  --clay-light: #e9905f;    /* the terracotta in the light */
  --clay-dark: #9c4527;     /* the terracotta in the shade */
  --soil: #4c3322;          /* the soil */
  --wood: #d9a465;          /* the wooden labels and the sill */
  --wood-light: #ecc58f;    /* the wood in the light */
  --bloom: #e44d78;         /* the flower and the seed packet */
  --bloom-dark: #b8325b;    /* the shade of the petals and the packet band */
  --water: #3f93cf;         /* the watering can and the water */
  --water-light: #9fd2f2;   /* the light on the can and on the drops */
  --ink: #2c2416;           /* the writing */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Bricolage Grotesque Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
}

/* ---------------------------------------------------------------- the card */
.serra {
  width: min(840px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: clamp(10px, 3vw, 30px);
  align-items: center;
  padding: clamp(10px, 3vmin, 24px);
  border-radius: clamp(16px, 3vmin, 28px);
  background: var(--cream);
  box-shadow: 0 1px 0 rgba(44, 36, 22, 0.06), 0 22px 44px -24px rgba(80, 60, 30, 0.5);
}

.serra__scene {
  display: grid;
  place-items: center;
  min-width: 0;
}

.scene {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(400px, 76vh);
}

.stop-glass-top { stop-color: var(--glass-top); }
.stop-glass { stop-color: var(--glass); }
.stop-leaf-light { stop-color: var(--leaf-light); }
.stop-leaf { stop-color: var(--leaf); }
.stop-dry-light { stop-color: var(--dry-light); }
.stop-dry { stop-color: var(--dry); }
.stop-clay { stop-color: var(--clay); }
.stop-clay-light { stop-color: var(--clay-light); }
.stop-clay-dark { stop-color: var(--clay-dark); }
.stop-can { stop-color: var(--water); }
.stop-can-light { stop-color: var(--water-light); }
.stop-can-dark { stop-color: #2a6f9f; }
.stop-wood { stop-color: var(--wood); }
.stop-wood-light { stop-color: var(--wood-light); }

/* the greenhouse */
.outside__far { fill: var(--garden); opacity: 0.45; }
.outside__near { fill: var(--garden); opacity: 0.75; }
.outside__fern { fill: none; stroke: var(--leaf); stroke-width: 2; stroke-linecap: round; opacity: 0.25; }
.beams path { fill: #ffffff; opacity: 0.16; }
.frame__bar { stroke: var(--frame); stroke-width: 4; }
.frame__rail { stroke: var(--frame); stroke-width: 3.4; }
.glass__shine { stroke: #ffffff; stroke-width: 3; stroke-linecap: round; opacity: 0.35; }
.mist path { fill: #ffffff; opacity: 0.55; }
.sill { fill: var(--wood); }
.sill__top { fill: var(--wood-light); }
.sill__edge { stroke: rgba(90, 55, 20, 0.35); stroke-width: 1.5; }
.scene__edge { fill: none; stroke: rgba(44, 36, 22, 0.12); }

/* the little pots */
.pot__rim-small { fill: var(--clay); }
.succulent path { fill: #8fb89a; stroke: #5d8c6c; stroke-width: 0.8; }
.succulent .succulent__back { fill: #a9c9ae; }
.cactus { fill: #5e9a5a; stroke: #3e7a42; stroke-width: 0.8; }
.cactus__rib { stroke: #3e7a42; stroke-width: 0.8; opacity: 0.7; }
.cactus__flower { fill: var(--bloom); }

/* the big pot */
.pot__shadow { fill: rgba(60, 35, 15, 0.22); }
.pot__saucer { fill: var(--clay-dark); }
.pot__wheel { stroke: rgba(255, 230, 200, 0.18); stroke-width: 1.2; }
.pot__under-rim { fill: rgba(70, 30, 10, 0.3); }
.pot__rim-light { stroke: rgba(255, 230, 200, 0.45); stroke-width: 1.6; stroke-linecap: round; }
.soil { fill: var(--soil); }
.soil__wet { fill: #26170e; opacity: 0; }
.soil__bits ellipse { fill: #b9a58c; }
.moss { fill: #6e9a3f; }

/* the plant */
.stem { fill: none; stroke: var(--leaf); stroke-width: 5; stroke-linecap: round; }
.stem__light { fill: none; stroke: var(--leaf-light); stroke-width: 1.6; stroke-linecap: round; opacity: 0.55; transform: translateX(-1.2px); }
.node { fill: var(--leaf); }
.scar { fill: #8a5a2b; }
.petiole { fill: none; stroke: var(--leaf); stroke-width: 2.6; stroke-linecap: round; }
.leaf__blade { fill: url(#serra-leaf); }
.leaf__dry { fill: url(#serra-dry); }
.leaf__half { fill: rgba(10, 50, 25, 0.22); }
.leaf__vein { fill: none; stroke: rgba(235, 255, 220, 0.55); stroke-width: 0.9; stroke-linecap: round; }
.leaf__rib { fill: none; stroke: rgba(235, 255, 220, 0.75); stroke-width: 1.4; stroke-linecap: round; }
.leaf__edge { fill: none; stroke: rgba(255, 255, 255, 0.35); stroke-width: 1.2; stroke-linecap: round; }
.petal { fill: var(--bloom); }
.petal__shade { fill: var(--bloom-dark); opacity: 0.45; }
.flower__heart { fill: #f6c445; }
.flower__dots { fill: #b9761c; }
.calyx { fill: var(--leaf); }

/* the planted packet */
.marker { opacity: 0; }
.marker__stick { stroke: var(--wood); stroke-width: 2.4; stroke-linecap: round; }
.marker__paper { fill: #fbf3e2; stroke: rgba(150, 95, 40, 0.4); stroke-width: 0.6; }
.marker__band { fill: var(--bloom); }
.marker__leaf { fill: var(--leaf-light); }

/* the watering can and its water */
.can__handle { fill: none; stroke: #2a6f9f; stroke-width: 6; stroke-linecap: round; }
.can__spout-back { stroke: #2a6f9f; stroke-width: 9; stroke-linecap: round; }
.can__spout { stroke: var(--water); stroke-width: 6; stroke-linecap: round; }
.can__rose { fill: #2a6f9f; }
.can__rose-face { fill: none; stroke: var(--water-light); stroke-width: 2; stroke-linecap: round; }
.can__top { fill: #2a6f9f; }
.can__band { stroke: rgba(255, 255, 255, 0.3); stroke-width: 3; }
.can__shine { stroke: rgba(255, 255, 255, 0.55); stroke-width: 3; stroke-linecap: round; }
.stream { fill: none; stroke: var(--water-light); stroke-width: 1.3; stroke-linecap: round; stroke-dasharray: 7 5; }
.drop { fill: var(--water); }
.splash { fill: none; stroke: var(--water-light); stroke-width: 1.2; stroke-linecap: round; }

/* ---------------------------------------------------------------- the side: form, packet and the end, one on the other */
.serra__side {
  position: relative;
  display: grid;
  min-width: 0;
  align-items: center;
}

.serra__side > * {
  grid-area: 1 / 1;
}

.serra__form {
  display: grid;
  gap: clamp(6px, 1.6vmin, 12px);
  padding: 4px 2px;
  min-width: 0;
}

.serra__title {
  margin: 0 0 2px;
  font-size: clamp(16px, 2.6vmin + 6px, 27px);
  font-weight: 720;
  font-stretch: 85%;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

/* a wooden plant label: pointed at the left like the end of a stake, with grain, a knot, a hole and its string */
.tag {
  --cut: clamp(10px, 2vmin, 16px);
  position: relative;
  display: grid;
  padding: clamp(4px, 1vmin, 7px) clamp(10px, 2vmin, 16px) clamp(3px, 0.8vmin, 6px) calc(var(--cut) + 12px);
  background:
    radial-gradient(ellipse 9px 4px at 78% 64%, rgba(120, 70, 25, 0.28), transparent 70%),
    repeating-linear-gradient(177deg, rgba(150, 95, 40, 0) 0 5px, rgba(150, 95, 40, 0.12) 5px 6px, rgba(150, 95, 40, 0) 6px 11px, rgba(150, 95, 40, 0.07) 11px 12px),
    linear-gradient(180deg, var(--wood-light), var(--wood));
  clip-path: polygon(var(--cut) 0, 100% 0, 100% 100%, var(--cut) 100%, 0 50%);
  border-radius: 5px;
  cursor: text;
  transform-origin: 0% 50%;
  box-shadow: inset 0 -2px 0 rgba(120, 70, 25, 0.2);
}

.tag__hole {
  position: absolute;
  left: calc(var(--cut) - 1px);
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: #7a4a1f;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.4);
}

.tag__hole::after {
  content: "";
  position: absolute;
  left: -8px;
  top: 3px;
  width: 12px;
  height: 1.5px;
  background: #b98b5a;
  transform: rotate(-24deg);
  border-radius: 1px;
}

.tag__label {
  font-size: clamp(9px, 1.2vmin + 4px, 12px);
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(70, 42, 14, 0.66);
  cursor: text;
}

.tag__input {
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: #3a2a17;
  font-family: 'Caveat Variable', cursive;
  font-weight: 560;
  font-size: clamp(19px, 2.6vmin + 9px, 28px);
  line-height: 1.1;
  outline: none;
  resize: none;
  caret-color: var(--leaf);
  text-shadow: 0 1px 0 rgba(255, 240, 210, 0.45);
  opacity: 0.88;
}

textarea.tag__input {
  height: 2.2em;
  overflow: hidden;
}

.tag__err {
  position: absolute;
  right: 10px;
  top: clamp(4px, 1vmin, 7px);
  font-size: clamp(9px, 1.2vmin + 4px, 12px);
  font-weight: 700;
  color: #8d2f17;
  opacity: 0;
  max-width: 62%;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag.is-wrong {
  box-shadow: inset 0 -2px 0 rgba(141, 47, 23, 0.55);
}

.tag.is-wrong .tag__err {
  opacity: 1;
}

.tag:focus-within,
.tag.is-focus {
  background:
    radial-gradient(ellipse 9px 4px at 78% 64%, rgba(120, 70, 25, 0.28), transparent 70%),
    repeating-linear-gradient(177deg, rgba(150, 95, 40, 0) 0 5px, rgba(150, 95, 40, 0.12) 5px 6px, rgba(150, 95, 40, 0) 6px 11px, rgba(150, 95, 40, 0.07) 11px 12px),
    linear-gradient(180deg, #f5d7a8, #e7b97c);
}

.tag:focus-within::before,
.tag.is-focus::before {
  content: "";
  position: absolute;
  left: calc(var(--cut) + 12px);
  right: 14px;
  bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: var(--leaf);
}

.serra__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

/* the send button: a green pill with a sprout that grows under the mouse */
.send {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: clamp(40px, 6vmin + 10px, 52px);
  padding: 0 clamp(16px, 3vmin, 24px) 0 clamp(12px, 2.4vmin, 18px);
  border: 0;
  border-radius: 999px;
  background: var(--leaf);
  color: var(--cream);
  font: inherit;
  font-weight: 700;
  font-size: clamp(14px, 1.6vmin + 6px, 17px);
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
  transition: background-color 0.25s, transform 0.2s;
}

.send__sprout {
  width: 1.25em;
  height: 1.25em;
  transform-origin: 50% 100%;
  transform: scale(0.82);
  transition: transform 0.5s cubic-bezier(0.34, 1.8, 0.5, 1);
}

.send__sprout path {
  fill: var(--leaf-light);
  stroke: var(--cream);
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.send__sprout path:first-child {
  fill: none;
}

@media (hover: hover) {
  .send:hover {
    background: #1b5a32;
  }
  .send:hover .send__sprout {
    transform: scale(1.12);
  }
  .again:hover {
    background: rgba(35, 105, 61, 0.12);
  }
}

.send:focus-visible,
.again:focus-visible {
  outline: 3px solid var(--bloom);
  outline-offset: 3px;
}

.send.is-pressed {
  transform: scale(0.96);
}

.send[disabled] {
  cursor: default;
}

/* ---------------------------------------------------------------- the seed packet */
.packet {
  display: grid;
  place-items: center;
  visibility: hidden;
  pointer-events: none;
  perspective: 700px;
}

.packet__body {
  position: relative;
  width: min(100%, 290px);
  transform-origin: 50% 100%;
}

.packet__flap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: clamp(18px, 3.6vmin, 30px);
  transform-origin: 50% 100%;
  transform: translateY(-100%);
  background: var(--bloom-dark);
  clip-path: polygon(0 100%, 0 30%, 6% 0, 12% 30%, 18% 0, 24% 30%, 30% 0, 36% 30%, 42% 0, 48% 30%, 54% 0, 60% 30%, 66% 0, 72% 30%, 78% 0, 84% 30%, 90% 0, 96% 30%, 100% 10%, 100% 100%);
  z-index: 2;
}

.packet__flap-back {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.12));
}

.packet__paper::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(clamp(18px, 3.6vmin, 30px) + 1px);
  border-top: 1px dashed rgba(150, 95, 40, 0.45);
}

.packet__paper {
  position: relative;
  display: grid;
  gap: clamp(3px, 0.9vmin, 7px);
  padding: calc(clamp(18px, 3.6vmin, 30px) + 6px) clamp(10px, 2vmin, 16px) clamp(10px, 2vmin, 16px);
  border-radius: 3px 3px 8px 8px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.05), transparent 8%, transparent 92%, rgba(0, 0, 0, 0.06)),
    repeating-linear-gradient(90deg, rgba(150, 95, 40, 0) 0 11px, rgba(150, 95, 40, 0.04) 11px 12px),
    #fbf3e2;
  box-shadow: 0 16px 28px -16px rgba(80, 60, 30, 0.65), inset 0 0 0 1px rgba(196, 141, 79, 0.35);
}

.packet__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 3px;
  border-bottom: 2px solid var(--bloom);
}

.packet__brand {
  font-size: clamp(15px, 2.2vmin + 6px, 22px);
  font-weight: 780;
  font-stretch: 80%;
  letter-spacing: -0.01em;
  color: var(--leaf);
}

.packet__kind {
  font-size: clamp(9px, 1.2vmin + 4px, 11px);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bloom-dark);
}

.packet__art {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
}

.art__sky { fill: #fde3c4; }
.art__sun { fill: #f6c445; }
.art__ground { fill: var(--clay); }
.art__stem { fill: none; stroke: var(--leaf); stroke-width: 2.4; stroke-linecap: round; }
.art__leaf { fill: var(--leaf-light); stroke: var(--leaf); stroke-width: 0.8; }
.art__bloom ellipse { fill: var(--bloom); }
.art__heart { fill: #f6c445; }

.packet__variety {
  margin: 0;
  font-size: clamp(9px, 1.2vmin + 4px, 12px);
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(70, 42, 14, 0.66);
}

.packet__variety span {
  color: var(--bloom-dark);
}

.packet__note {
  margin: 0;
  font-family: 'Caveat Variable', cursive;
  font-weight: 600;
  font-size: clamp(16px, 2.2vmin + 8px, 24px);
  line-height: 1.05;
  color: #24409a;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.packet__foot {
  display: flex;
  align-items: center;
  gap: 8px;
}

.packet__window {
  position: relative;
  flex: none;
  width: 44px;
  height: 16px;
  border-radius: 8px;
  background: rgba(214, 228, 222, 0.75);
  box-shadow: inset 0 0 0 1px rgba(90, 110, 100, 0.35);
  overflow: hidden;
}

.packet__window i {
  position: absolute;
  bottom: 2px;
  width: 6px;
  height: 4px;
  border-radius: 50%;
  background: #6b4424;
}

.packet__window i:nth-child(1) { left: 5px; }
.packet__window i:nth-child(2) { left: 11px; bottom: 4px; }
.packet__window i:nth-child(3) { left: 17px; }
.packet__window i:nth-child(4) { left: 23px; bottom: 3px; }
.packet__window i:nth-child(5) { left: 29px; }
.packet__window i:nth-child(6) { left: 34px; bottom: 5px; }

.packet__sow {
  font-size: clamp(9px, 1.1vmin + 4px, 11px);
  font-weight: 600;
  color: rgba(70, 42, 14, 0.62);
}

/* ---------------------------------------------------------------- the end */
.done {
  display: grid;
  justify-items: start;
  align-content: center;
  gap: clamp(6px, 1.6vmin, 12px);
  visibility: hidden;
}

.done__title {
  margin: 0;
  font-size: clamp(22px, 3.6vmin + 8px, 38px);
  font-weight: 780;
  font-stretch: 82%;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--leaf);
}

.done__text {
  margin: 0;
  max-width: 26ch;
  font-size: clamp(12px, 1.4vmin + 6px, 16px);
  line-height: 1.35;
  color: rgba(44, 36, 22, 0.75);
}

.again {
  height: clamp(36px, 5vmin + 10px, 46px);
  padding: 0 clamp(14px, 2.6vmin, 20px);
  border: 2px solid var(--leaf);
  border-radius: 999px;
  background: transparent;
  color: var(--leaf);
  font: inherit;
  font-weight: 700;
  font-size: clamp(13px, 1.4vmin + 6px, 16px);
  cursor: pointer;
}

/* ---------------------------------------------------------------- a narrow card: the scene shrinks, the type tightens */
@media (max-width: 560px) {
  .serra {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
    gap: 10px;
  }
  .serra__title {
    font-size: 16px;
  }
  .tag__input {
    font-size: 19px;
  }
  .send {
    gap: 5px;
    padding: 0 12px 0 10px;
    font-size: 13px;
    white-space: nowrap;
  }
  .packet__paper {
    gap: 3px;
    padding: 22px 8px 8px;
  }
  .packet__paper::before {
    top: 17px;
  }
  .packet__flap {
    height: 16px;
  }
  .packet__brand {
    font-size: 14px;
  }
  .packet__variety,
  .packet__sow {
    font-size: 9px;
  }
  .packet__note {
    font-size: 15px;
  }
  .tag__err {
    position: static;
    max-width: none;
    text-align: left;
    white-space: normal;
    display: none;
  }
  .tag.is-wrong .tag__err {
    display: block;
  }
  .packet__art {
    display: none;
  }
}

@media (max-height: 520px) {
  .serra__form {
    gap: 5px;
  }
  textarea.tag__input {
    height: 1.15em;
  }
  .packet__art {
    max-height: 60px;
  }
}
