:host {
  display: block;
  --size: var(--brand-size, 4rem);
  --delay: var(--brand-delay, 0s);
  text-align: center;
}

.brand {
  display: grid;
  justify-items: center;
  margin: 0;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: var(--size);
  line-height: 1;
  letter-spacing: 0.005em;
  white-space: nowrap;
  translate: var(--brand-shift, 0) 0;
  opacity: 0;
  transform: translateY(0.12em);
  animation: rise 0.8s cubic-bezier(0.3, 0.8, 0.4, 1) var(--delay) forwards;
}

/* positioned so the layers paint strictly in DOM order (filters would otherwise reorder them) */
.layer { grid-area: 1 / 1; position: relative; }
.second { margin-left: var(--brand-gap, 0em); }

/* each word can be moved as a whole: the home page's scroll morph glides them into the top bar
   (no transform at rest) */
.first, .second {
  display: inline-block;
  transform: var(--morph-first, none);
  transform-origin: 0 0;
  will-change: var(--morph-will, auto);
}
.second { transform: var(--morph-second, none); }
.squiggle, .name { filter: var(--morph-fade-filter, none); }

/* stacked (phones): "sketchy" above "sprouts", left-aligned, the second line stepped in a little;
   the underline and the artist's name move along with it */
:host([stacked]) .brand { justify-items: start; }
:host([stacked]) .layer { display: flex; flex-direction: column; align-items: flex-start; }
:host([stacked]) .second { margin: -0.26em 0 0 var(--stack-indent, 0.42em); }
:host([stacked]) .squiggle,
:host([stacked]) .name { translate: var(--brand-shift, 0) 0; }
:host([stacked]) .squiggle { margin-top: calc(var(--size) * 0.2); }
/* the flower's stem passes behind "sketchy": a soft paper-coloured halo keeps the word crisp */
:host([stacked]) .outline .first {
  --o: 0.05em;
  --halo: var(--color-paper);
  color: var(--halo);
  text-shadow:
    var(--o) 0 var(--halo), calc(var(--o) * -1) 0 var(--halo),
    0 var(--o) var(--halo), 0 calc(var(--o) * -1) var(--halo),
    calc(var(--o) * 0.71) calc(var(--o) * 0.71) var(--halo), calc(var(--o) * -0.71) calc(var(--o) * 0.71) var(--halo),
    calc(var(--o) * 0.71) calc(var(--o) * -0.71) var(--halo), calc(var(--o) * -0.71) calc(var(--o) * -0.71) var(--halo),
    0 0 0.12em var(--halo);
}

/* each letter can move on its own (it's sprung from sketchysprouts.js when something lands on it) */
.ch {
  display: inline-block;
  transform-origin: 50% 86%;
}

/* "sprouts" gets a thick, rounded ink outline (a ring of shadows — text-stroke leaves sharp
   spikes on letter ends) plus a soft drop, like the flower sticker */
.outline .first { color: transparent; }
.outline .second {
  --o: 0.042em;
  --ink: var(--color-ink);
  color: var(--ink);
  text-shadow:
    var(--o) 0 var(--ink), calc(var(--o) * -1) 0 var(--ink),
    0 var(--o) var(--ink), 0 calc(var(--o) * -1) var(--ink),
    calc(var(--o) * 0.92) calc(var(--o) * 0.38) var(--ink), calc(var(--o) * -0.92) calc(var(--o) * 0.38) var(--ink),
    calc(var(--o) * 0.92) calc(var(--o) * -0.38) var(--ink), calc(var(--o) * -0.92) calc(var(--o) * -0.38) var(--ink),
    calc(var(--o) * 0.71) calc(var(--o) * 0.71) var(--ink), calc(var(--o) * -0.71) calc(var(--o) * 0.71) var(--ink),
    calc(var(--o) * 0.71) calc(var(--o) * -0.71) var(--ink), calc(var(--o) * -0.71) calc(var(--o) * -0.71) var(--ink),
    calc(var(--o) * 0.38) calc(var(--o) * 0.92) var(--ink), calc(var(--o) * -0.38) calc(var(--o) * 0.92) var(--ink),
    calc(var(--o) * 0.38) calc(var(--o) * -0.92) var(--ink), calc(var(--o) * -0.38) calc(var(--o) * -0.92) var(--ink),
    0 calc(var(--o) * 2.2) rgba(36, 31, 38, 0.16);
}

/* "sketchy" stays graphite-pencil; "sprouts" is glossy petal pink */
.fill .first {
  color: var(--color-ink);
  filter: url(#pencil);
}
/* each letter carries its own pink fill; the padding lets it reach parts of the glyph that
   overhang the letter's box (e.g. the final "s"), the negative margin keeps spacing unchanged */
.fill .second .ch {
  padding: 0 0.15em;
  margin: 0 -0.15em;
  background: linear-gradient(180deg,
    var(--color-petal-light) 18%,
    var(--color-petal) 58%,
    var(--color-petal-shade) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.squiggle {
  display: block;
  width: 58%;
  height: calc(var(--size) * 0.16);
  margin: calc(var(--size) * -0.02) auto calc(var(--size) * 0.12);
  overflow: visible;
}
.squiggle path {
  fill: none;
  stroke: var(--color-leaf);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 320;
  stroke-dashoffset: 320;
  animation: draw 1.1s ease-in-out calc(var(--delay) + 0.35s) forwards;
}

/* artist credit: a deliberate second line — "by" small and light, the name larger and inked,
   framed by two little leaves that echo the flower */
.name {
  --by-size: var(--name-size, max(calc(var(--size) * 0.28), 1.05rem));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--by-size);
  line-height: 1.1;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(0.3em);
  animation: rise 0.8s ease-out calc(var(--delay) + 0.75s) forwards;
}
.by {
  font-size: 0.72em;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--color-name);
}
.artist {
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-ink);
}

.ornament {
  width: 1.15em;
  height: auto;
  flex: none;
  overflow: visible;
  transform: rotate(-12deg);
}
.mirror { display: inline-flex; transform: scaleX(-1); }
.ornament-leaf {
  fill: var(--color-leaf-light);
  stroke: var(--color-ink);
  stroke-width: 1.8;
  stroke-linejoin: round;
}
.ornament-vein {
  fill: none;
  stroke: var(--color-ink);
  stroke-width: 1.3;
  stroke-linecap: round;
}

.defs { position: absolute; }

@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .brand, .name { animation: none; opacity: 1; transform: none; }
  .squiggle path { animation: none; stroke-dashoffset: 0; }
}
