/* The growth walkthrough (src/grow.html). Stage, type and dock come from
   walkthrough.css; this lays out the four scenes around the plant grow.js draws. */

@media (prefers-reduced-motion: no-preference) {
  .wt.is-live .wt-scene.is-active :is(.gr-areas > li > button, .gr-note, .gr-chores > li, .gr-total, .gr-proof, .gr-switch, .gr-letter, .gr-moments > li > button, .gr-end) {
    animation: wt-in 1s var(--intro-ease) calc(.7s + var(--i, 0) * 75ms) backwards;
  }
  /* the plant takes a moment to arrive, so the words that sit on it wait for it */
  .wt.is-live .wt-scene.is-active .gr-moments > li > button { animation-delay: calc(1.6s + var(--i, 0) * 90ms); }
  .wt.is-live .wt-scene.is-active .gr-areas > li > button { animation-delay: calc(1.5s + var(--i, 0) * 70ms); }
  .wt.is-live .wt-scene.is-active .gr-star-key { animation: wt-fade 1.2s var(--intro-ease) 2.4s backwards; }
  .wt.is-live .wt-scene.is-active :is(.gr-period, .gr-count) { animation: wt-fade 1s var(--intro-ease) 1.4s backwards; }
}

/* ---- 1 · a cell becomes a seedling ---- */
.wt.is-live .gr-time { flex-direction: row; align-items: center; gap: 32px; }
.gr-time .wt-head { flex: 0 0 min(460px, 38%); }
.gr-chores { display: grid; gap: 6px; margin-top: clamp(16px, 3svh, 28px) !important; }
.wt-page .wt .gr-chores button { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid #ffffff12; background: #ffffff04; font: 500 14.5px/1.3 'Inter', sans-serif; color: var(--wt-soft); text-align: left; transition: border-color .3s, background .3s, color .3s; }
.wt-page .wt .gr-chores button:hover { border-color: #ffffff2a; color: var(--wt-ink); }
.gr-chores button i { position: relative; width: 16px; height: 16px; border-radius: 50%; border: 1px solid #ffffff44; transition: background .3s, border-color .3s, box-shadow .3s; }
.gr-chores button b { font: 500 13px 'Inter', sans-serif; color: hsl(345 70% 76%); transition: color .3s; }
.wt-page .wt .gr-chores button[aria-pressed='true'] { border-color: hsl(95 70% 66% / .42); background: hsl(95 60% 50% / .07); color: var(--wt-ink); }
.gr-chores button[aria-pressed='true'] i { border-color: transparent; background: hsl(95 85% 70%); box-shadow: 0 0 10px hsl(95 85% 60% / .6); }
.gr-chores button[aria-pressed='true'] i::after { content: ''; position: absolute; left: 4px; top: 4px; width: 7px; height: 4px; border: solid #142016; border-width: 0 0 1.8px 1.8px; transform: rotate(-45deg); }
.gr-chores button[aria-pressed='true'] b { color: hsl(95 80% 74%); }
.jdi-services.wt-page .gr-total { margin-top: clamp(14px, 2.6svh, 22px); font: 400 14px/1.4 Inter, sans-serif; color: var(--wt-muted); }
.gr-total b { margin-right: 6px; font: 500 clamp(40px, 4vw, 56px)/1 'Inter', sans-serif; letter-spacing: -.03em; color: hsl(95 85% 74%); font-variant-numeric: tabular-nums; vertical-align: -6px; }
.gr-total span { font: 500 16px 'Inter', sans-serif; color: var(--wt-ink); }
.gr-total small { display: block; margin-top: 8px; font-size: 13px; color: var(--wt-muted); }
.gr-cell { position: relative; flex: 1; align-self: stretch; min-width: 0; }
.jdi-services.wt-page .gr-cue { position: absolute; left: 0; top: 0; margin: 0; font: 500 13px 'Inter', sans-serif; color: hsl(95 80% 76%); white-space: nowrap; opacity: 0; transition: opacity .9s; pointer-events: none; }
.jdi-services.wt-page .gr-cue.is-shown { opacity: 1; }

/* ---- 2 · the seedling takes root ---- */
.wt.is-live .gr-roots { flex-direction: row; align-items: center; gap: 32px; }
.gr-roots .wt-head { flex: 0 0 min(480px, 40%); }
.gr-proof { margin-top: clamp(18px, 3.4svh, 30px); padding-top: 18px; border-top: 1px solid hsl(200 60% 70% / .2); }
.jdi-services.wt-page .gr-proof-who { font: 500 13px/1.4 Inter, sans-serif; color: hsl(200 70% 80%); }
.gr-proof-nums { display: grid; gap: 10px; margin: 14px 0 0; }
.gr-proof-nums div { display: grid; grid-template-columns: 140px minmax(0, 1fr); align-items: baseline; gap: 12px; }
.gr-proof-nums dt { font: 400 13px/1.4 Inter, sans-serif; color: var(--wt-muted); }
.gr-proof-nums dd { display: flex; align-items: baseline; gap: 10px; margin: 0; font: 500 24px/1.1 'Inter', sans-serif; letter-spacing: -.02em; color: var(--wt-ink); font-variant-numeric: tabular-nums; }
.gr-proof-nums dd b { font-weight: 500; }
.gr-proof-nums dd b:first-child { font-size: 17px; color: var(--wt-muted); }
.gr-proof-nums dd i { align-self: center; width: 18px; height: 1px; background: currentColor; opacity: .35; }
.gr-proof-nums em { font: 500 13px Inter, sans-serif; font-style: normal; color: hsl(140 70% 70%); }
.jdi-services.wt-page .gr-proof-note { margin-top: 12px; font: 400 12px/1.5 Inter, sans-serif; color: var(--wt-faint); }
.wt-page .gr-proof-link { margin-top: 14px; font-size: 13.5px; }
.gr-proof-link svg { width: 16px; height: 16px; }
.gr-earth { position: relative; flex: 1; align-self: stretch; min-width: 0; }
.wt-page .wt .gr-period { position: absolute; left: auto; right: 0; top: 0; z-index: 3; display: inline-grid; grid-template-columns: 1fr 1fr; transform: none; }
.wt-page .wt .gr-period button { padding: 8px 14px; font-size: 12.5px; }
.wt-page .wt .gr-period button[aria-pressed='true'] { color: #07151c; }
.gr-period.is-after i { transform: translateX(100%); }
.jdi-services.wt-page .gr-count { position: absolute; right: 0; bottom: 6px; z-index: 3; margin: 0; display: grid; justify-items: end; text-align: right; pointer-events: none; text-shadow: 0 1px 14px #02060a, 0 0 4px #02060a; }
.gr-count b { font: 500 clamp(34px, 3.4vw, 50px)/1 'Inter', sans-serif; letter-spacing: -.035em; color: hsl(192 95% 84%); font-variant-numeric: tabular-nums; }
.gr-count span { margin-top: 6px; font: 500 13px Inter, sans-serif; color: var(--wt-soft); }
.gr-count small { margin-top: 4px; font: 400 11.5px Inter, sans-serif; color: var(--wt-faint); }

/* ---- 3 · the young tree under the moon ---- */
.wt.is-live .gr-night { flex-direction: row; align-items: center; gap: 24px; }
.gr-night .wt-head { flex: 0 0 min(440px, 36%); }
.wt-page .wt .gr-switch { position: relative; left: auto; top: auto; z-index: 1; display: inline-grid; grid-template-columns: 1fr 1fr; margin-top: clamp(18px, 3.4svh, 30px); transform: none; }
.wt-page .wt .gr-switch button { padding: 9px 16px; }
.gr-switch.is-after i { transform: translateX(100%); }
.jdi-services.wt-page .gr-letter { min-height: 4.6em; margin: clamp(16px, 3svh, 26px) 0 0; transition: opacity .17s; }
.gr-letter.is-swapping { opacity: 0; }
.gr-letter b { display: block; font: 500 12.5px Inter, sans-serif; color: hsl(262 80% 84%); }
.gr-letter span { display: block; margin-top: 6px; font: italic 400 clamp(16px, 1.3vw, 19px)/1.45 'Inter', sans-serif; color: var(--wt-ink); text-wrap: pretty; }
.gr-sky { position: relative; flex: 1; align-self: stretch; min-width: 0; }
.gr-moments { position: absolute; inset: 0; pointer-events: none; }
.gr-moments > li { position: absolute; left: 0; top: 0; pointer-events: auto; }
.gr-moments > li:nth-child(1) { --i: 0; } .gr-moments > li:nth-child(2) { --i: 1; } .gr-moments > li:nth-child(3) { --i: 2; }
.gr-moments > li:nth-child(4) { --i: 3; } .gr-moments > li:nth-child(5) { --i: 4; } .gr-moments > li:nth-child(6) { --i: 5; }
.wt-page .wt .gr-moments button { padding: 6px 12px; border-radius: 99px; border: 1px solid #ffffff17; background: #0b0a14d9; font: 500 13px/1.2 'Inter', sans-serif; color: var(--wt-soft); white-space: nowrap; transition: border-color .3s, color .3s, box-shadow .3s; }
.wt-page .wt .gr-moments button:hover { color: var(--wt-ink); }
.wt-page .wt .gr-moments button.is-on { border-color: hsl(48 90% 76% / .6); color: var(--wt-ink); box-shadow: 0 0 18px hsl(48 90% 66% / .22); }
.jdi-services.wt-page .gr-star-key { position: absolute; right: 0; bottom: 4px; margin: 0; font: 400 12px Inter, sans-serif; color: var(--wt-faint); }

/* ---- 4 · the full tree of growth ---- */
.wt.is-live .gr-full { padding-bottom: calc(var(--wt-dock) + 4px); }
.gr-garden { position: relative; flex: 1; min-height: 0; }
.jdi-services.wt-page .gr-note { position: absolute; left: 50%; bottom: 4px; width: 400px; margin: 0 0 0 -200px; text-align: center; pointer-events: none; }
.gr-note b { display: block; font: 500 17px/1.3 'Inter', sans-serif; color: var(--wt-ink); transition: color .5s; }
.gr-note span { display: block; margin-top: 6px; font: 400 14px/1.55 Inter, sans-serif; color: var(--wt-soft); text-wrap: balance; }
.gr-note.is-on b { color: hsl(var(--note-hue, 330) 85% 80%); }
.gr-note > * { transition: opacity .17s; text-shadow: 0 1px 12px #020d0c; }
.gr-note.is-swapping > * { opacity: 0; }
.gr-areas { position: absolute; inset: 0; pointer-events: none; }
.gr-areas > li { position: absolute; left: 0; top: 0; pointer-events: auto; will-change: transform; }
.wt-page .wt .gr-areas button { position: relative; display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 4px; font: 500 16px/1.2 'Inter', sans-serif; letter-spacing: -.2px; color: var(--wt-soft); white-space: nowrap; transition: color .5s var(--wt-ease), opacity .5s var(--wt-ease); }
.gr-areas li.is-left button { flex-direction: row-reverse; text-align: right; }
.gr-areas [data-icon] { flex: none; width: 38px; height: 38px; }
.gr-areas [data-dot] { flex: none; width: 2px; height: 2px; }
.gr-areas small { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.gr-garden.has-focus .gr-areas button { opacity: .5; }
.wt-page .wt .gr-garden .gr-areas button.is-on { opacity: 1; color: hsl(var(--hue) 85% 82%); }
@media (hover: hover) { .wt-page .wt .gr-garden.has-focus .gr-areas button:hover { opacity: .9; } }
.jdi-services.wt-page .gr-end { position: relative; z-index: 2; display: flex; justify-content: center; gap: 28px; margin: 10px 0 0; }
.gr-end .wt-link { font-size: 13.5px; }
.gr-end svg { width: 15px; height: 15px; }

/* ---- moving on: everything but the plant steps aside ---- */
.wt.gr-away .wt-scene.is-active > *, .wt.gr-away :is(.wt-dock, .wt-hint) { opacity: 0; filter: blur(6px); transform: translateY(-10px); pointer-events: none; transition: opacity .6s var(--wt-ease), filter .6s var(--wt-ease), transform .8s var(--wt-ease); }
.wt.gr-away .wt-dock { transform: none; }

/* Arriving on the homepage, the page change itself is a cross-fade. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .5s; }

/* ---------------------------------------------------------------- tablet */
@media (max-width: 1020px) {
  .wt.is-live :is(.gr-time, .gr-roots, .gr-night) { flex-direction: column; align-items: stretch; gap: 0; }
  :is(.gr-time, .gr-roots, .gr-night) .wt-head { display: contents; }
  :is(.gr-time, .gr-roots, .gr-night) .wt-title { order: 1; }
  :is(.gr-time, .gr-roots, .gr-night) .wt-lede { order: 2; max-width: 640px; }
  .gr-cell, .gr-earth, .gr-sky { order: 3; flex: 1; min-height: 150px; }
  .gr-chores { order: 4; grid-template-columns: 1fr 1fr; }
  .gr-total { order: 5; }
  .gr-time .wt-sample { order: 6; }
  .gr-proof { order: 4; }
  .gr-switch { order: 4; justify-self: start; align-self: flex-start; }
  .gr-letter { order: 5; }
  .gr-garden { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
  .gr-areas { position: relative; inset: auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 6px; width: 100%; max-width: 640px; margin-top: auto; pointer-events: auto; }
  .gr-areas > li { position: relative; transform: none !important; }
  .wt-page .wt .gr-areas button { flex-direction: column !important; justify-content: flex-start; gap: 6px; width: 100%; height: auto; padding: 6px 0 8px; font-size: 13.5px; line-height: 1.2; text-align: center !important; white-space: normal; }
  .gr-areas [data-dot] { position: absolute; }
  .gr-areas span { text-shadow: 0 1px 10px #020d0c, 0 0 3px #020d0c; }
  .gr-garden.has-focus .gr-areas button { opacity: .62; }
  .gr-night .wt-sample { display: none; }
  .jdi-services.wt-page .gr-note { position: relative; left: auto; bottom: auto; width: 100%; max-width: 400px; min-height: 4.4em; margin: 4px 0 0; }
}

/* ----------------------------------------------------------------- phone */
@media (max-width: 760px) {
  .gr-page :is(.gr-time, .gr-roots, .gr-night, .gr-full) .wt-lede, .gr-night .wt-sample { display: none; }
  .gr-chores { gap: 6px; margin-top: 10px !important; }
  .wt-page .wt .gr-chores button { grid-template-columns: 14px minmax(0, 1fr) auto; gap: 7px; padding: 7px 9px; font-size: 12px; }
  .gr-chores button i { width: 13px; height: 13px; }
  .gr-chores button[aria-pressed='true'] i::after { left: 3px; top: 3px; width: 5px; height: 3px; }
  .gr-chores button b { font-size: 11.5px; }
  .jdi-services.wt-page .gr-total { margin-top: 10px; font-size: 12.5px; }
  .gr-total b { font-size: 34px; vertical-align: -4px; }
  .gr-total span { font-size: 14px; }
  .gr-total small { margin-top: 4px; font-size: 12px; }
  .jdi-services.wt-page .gr-cue { font-size: 11.5px; }
  .gr-proof { margin-top: 6px; padding-top: 12px; }
  .gr-proof-nums { margin-top: 8px; gap: 6px; }
  .gr-proof-nums div { grid-template-columns: 112px minmax(0, 1fr); }
  .gr-proof-nums dt { font-size: 12px; }
  .gr-proof-nums dd { font-size: 19px; gap: 8px; }
  .gr-proof-nums dd b:first-child { font-size: 14px; }
  .jdi-services.wt-page .gr-proof-note { display: none; }
  .wt-page .gr-proof-link { margin-top: 8px; font-size: 12.5px; }
  .wt-page .wt .gr-period button { padding: 6px 10px; font-size: 11px; }
  .gr-count b { font-size: 28px; }
  .gr-count span { margin-top: 3px; font-size: 11.5px; }
  .gr-count small { font-size: 10.5px; }
  .wt-page .wt .gr-switch { margin-top: 10px; }
  .wt-page .wt .gr-switch button { padding: 7px 12px; font-size: 12px; }
  .jdi-services.wt-page .gr-letter { min-height: 5.6em; margin-top: 10px; }
  .gr-letter span { margin-top: 3px; font-size: 14.5px; }
  .wt-page .wt .gr-moments button { padding: 5px 9px; font-size: 11.5px; }
  .jdi-services.wt-page .gr-star-key { font-size: 11px; }
  .wt-page .wt .gr-areas button { gap: 4px; font-size: clamp(11px, 3.1vw, 12.5px); }
  .gr-areas [data-icon] { width: clamp(24px, 4svh, 34px); height: clamp(24px, 4svh, 34px); }
  .gr-note b { font-size: 15px; }
  .gr-note span { margin-top: 3px; font-size: 13px; }
  .jdi-services.wt-page .gr-end { gap: 20px; margin-top: 4px; }
  .gr-end .wt-link { font-size: 12.5px; }
}
@media (max-height: 760px) and (min-width: 761px) {
  .jdi-services.wt-page .gr-proof-note { display: none; }
  .wt-page .wt .gr-chores button { padding-block: 7px; }
}
@media (max-height: 700px) and (max-width: 760px) {
  .gr-page .wt-sample, .gr-note span, .gr-total small, .gr-star-key { display: none !important; }
}
@media (max-height: 500px) and (min-width: 561px) {
  .wt.is-live :is(.gr-time, .gr-roots, .gr-night) { flex-direction: row; align-items: stretch; gap: 20px; }
  :is(.gr-time, .gr-roots, .gr-night) .wt-head { display: block; flex: 0 0 42%; align-self: center; }
  .gr-chores, .gr-proof-nums, .gr-letter, .jdi-services.wt-page .gr-note, .gr-end { display: none; }
  .gr-areas { max-width: 520px; }
  .wt-page .wt .gr-areas button { flex-direction: row !important; padding: 5px 0; font-size: 11.5px; text-align: left !important; }
  .gr-areas [data-icon] { width: 22px; height: 22px; }
}

/* Without script the scenes read in order. */
.wt:not(.is-live) :is(.gr-areas, .gr-moments) { position: static; display: flex; flex-wrap: wrap; gap: 10px 24px; margin-top: 24px !important; }
.wt:not(.is-live) :is(.gr-areas, .gr-moments) > li { position: static; }
.wt:not(.is-live) .gr-areas small { position: static; width: auto; height: auto; clip: auto; white-space: normal; }
.wt:not(.is-live) :is(.gr-cell, .gr-note, .gr-switch, .gr-period, .gr-count, .gr-star-key, .gr-letter) { display: none; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0s; }
}

/* Missed touchpoints look dormant and retain their clickable examples. */
.wt-page .wt .gr-night[data-follow-up="without"] .gr-moments button {
  border-style: dashed;
  color: var(--wt-soft);
  box-shadow: none;
}
.wt-page .wt .gr-night[data-follow-up="without"] .gr-moments button:is(.is-on, :hover) {
  border-color: hsl(38 48% 66% / .66);
  color: var(--wt-ink);
}
.gr-night[data-follow-up="without"] .gr-letter b { color: hsl(38 52% 76%); }
.gr-night[data-follow-up="without"] .gr-letter span { font-style: normal; }
