/* The app onboarding's widget scene: a Home Screen with one mazi widget you can tap through a day.
   Everything inside the scene is sized from its width, as the app sizes it from the page. */
.widget-feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
  align-items: center;
  gap: 64px;
  width: min(calc(100% - 2 * max(24px, var(--safe-left), var(--safe-right))), 1000px);
  margin: 0 auto;
  padding-top: 64px;
}
.onboarding-style .widget-feature h2 {
  font-family: var(--rounded);
  font-weight: 700;
  font-size: 46px;
  line-height: 1.06;
  letter-spacing: -.02em;
  color: var(--charcoal);
  text-wrap: balance;
}
.widget-copy p { max-width: 360px; margin-top: 16px; color: var(--muted); font-size: 18px; line-height: 1.5; text-wrap: pretty; }

/* A 4 by 4 grid of app slots; the widget takes the 2 by 2 block on the left, as in the app. */
.home-screen {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  display: grid;
  grid-template: repeat(4, minmax(0, 1fr)) / repeat(4, minmax(0, 1fr));
  gap: 4.5%;
  aspect-ratio: 1;
  user-select: none;
  -webkit-user-select: none;
}
.home-scenery { position: absolute; z-index: -1; width: 130%; height: auto; left: -12%; top: -6%; pointer-events: none; }
.home-grass { position: absolute; z-index: -1; width: 12cqi; height: auto; right: -9%; bottom: 6%; transform: scaleX(-1); }
/* Blank icons, white over the scenery so they read as apps rather than a pattern. */
.app-slot { border-radius: 5.6cqi; background: #ffffffb3; box-shadow: inset 0 0 0 1px #2f312f14; }
/* Pop-in order. Set here because the CSP blocks inline style attributes. */
.app-slot:nth-of-type(2) { --i: 1; } .app-slot:nth-of-type(3) { --i: 2; } .app-slot:nth-of-type(4) { --i: 3; }
.app-slot:nth-of-type(5) { --i: 4; } .app-slot:nth-of-type(6) { --i: 5; } .app-slot:nth-of-type(7) { --i: 6; }
.app-slot:nth-of-type(8) { --i: 7; } .app-slot:nth-of-type(9) { --i: 8; } .app-slot:nth-of-type(10) { --i: 9; }
.app-slot:nth-of-type(11) { --i: 10; } .app-slot:nth-of-type(12) { --i: 11; }

/* The Porcelain sticker: Charcoal outline with a solid 4px drop, the app's MaziSticker. */
.home-widget {
  position: relative;
  z-index: 1;
  grid-column: 1 / span 2;
  grid-row: 2 / span 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .4cqi;
  padding: 4.3cqi;
  border: 1.5px solid var(--charcoal);
  border-radius: 9.5cqi;
  background: var(--porcelain);
  box-shadow: 0 4px 0 var(--charcoal);
  color: var(--charcoal);
  font-family: var(--rounded);
  line-height: 1.1;
  rotate: -2deg;
}
.home-widget__body { display: flex; flex-direction: column; align-items: flex-start; gap: .4cqi; }
.home-widget__status { display: grid; font-size: 3.6cqi; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
/* The label not shown is also hidden from screen readers. */
.home-widget__status > * { grid-area: 1 / 1; transition: opacity 200ms ease-out, visibility 200ms; }
.home-widget__next { color: var(--signal); }
.home-widget__done { color: var(--signal); opacity: 0; visibility: hidden; }
.home-widget.is-done .home-widget__next { opacity: 0; visibility: hidden; }
.home-widget.is-done .home-widget__done { opacity: 1; visibility: visible; }
.home-widget__task { font-size: 5.3cqi; font-weight: 700; }
.home-widget__time { font-size: 3.8cqi; font-weight: 600; color: #2f312fb3; }
.home-widget__art { position: absolute; width: 23cqi; height: auto; right: 4cqi; bottom: 5cqi; pointer-events: none; }
.home-widget__art.is-leash { width: 25cqi; right: 3cqi; }
/* The widget's one button: an open check until pressed, then filled Signal Blue. */
.home-widget__check {
  appearance: none;
  position: absolute;
  left: 4.3cqi;
  top: 33.9cqi;
  display: grid;
  place-items: center;
  width: 9.6cqi;
  height: 9.6cqi;
  padding: 0;
  border: 1.5px solid var(--charcoal);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  transition: background-color 200ms ease-out;
  -webkit-tap-highlight-color: transparent;
}
.home-widget__check::after { content: ''; position: absolute; inset: -10px; border-radius: 50%; }
.home-widget__check path { stroke: var(--signal); }
.home-widget.is-done .home-widget__check { background: var(--signal); }
.home-widget.is-done .home-widget__check path { stroke: #fff; }
.home-widget__check:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }
.home-widget__check svg { width: 55%; height: 55%; }
.home-widget__check path { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) {
  .home-widget__check:hover { background: #e8effb; }
  .home-widget.is-done .home-widget__check:hover { background: var(--signal); }
}

/* The handwritten note points back at the check, like the hero's "save me a spot". The arrow
   rises straight into the check's centre, and its tail ends where the note starts. Measured in
   cqi from the scene, with the widget's -2deg tilt applied to the check's position. */
.widget-note { position: absolute; z-index: 2; inset: 0; color: var(--signal); pointer-events: none; }
.widget-note svg { position: absolute; left: 5cqi; top: 71cqi; width: 18cqi; height: auto; overflow: visible; }
.widget-note path { stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.widget-note span {
  position: absolute;
  left: 24cqi;
  top: 80.6cqi;
  padding: 0 1.6cqi;
  border-radius: 999px;
  background: #f8f7f4d9;
  font-family: var(--hand);
  font-size: 6.6cqi;
  line-height: 1.2;
  white-space: nowrap;
  rotate: -5deg;
  transform-origin: 0 50%;
}

/* Played once on first view: the scene pops in, then the note points at the button.
   Without motion the scene rests, ready to tap. */
@media (prefers-reduced-motion: no-preference) {
  .motion-ready .home-screen:not(.is-shown) .app-slot { opacity: 0; scale: .85; }
  .motion-ready .home-screen:not(.is-shown) .home-widget { opacity: 0; scale: .9; rotate: -4deg; }
  .motion-ready .home-screen:not(.is-shown) .widget-note path { stroke-dashoffset: 1; }
  .motion-ready .home-screen:not(.is-shown) .widget-note span { opacity: 0; scale: .85; }
  .motion-ready .home-screen .widget-note path { stroke-dasharray: 1; }

  .home-screen.is-shown .app-slot {
    transition: opacity 420ms ease-out, scale 620ms cubic-bezier(.3, 1.25, .5, 1);
    transition-delay: calc(200ms + var(--i, 0) * 28ms);
  }
  .home-screen.is-shown .home-widget { transition: opacity 420ms ease-out 450ms, scale 720ms cubic-bezier(.3, 1.2, .5, 1) 450ms, rotate 720ms cubic-bezier(.3, 1.2, .5, 1) 450ms; }
  .home-screen.is-shown .widget-note path { transition: stroke-dashoffset 600ms cubic-bezier(.3, .7, .3, 1) 1150ms; }
  .home-screen.is-shown .widget-note span { transition: opacity 400ms ease-out 1450ms, scale 480ms cubic-bezier(.3, 1.3, .5, 1) 1450ms; }
}

@media (max-width: 1000px) {
  .widget-feature { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 32px; width: calc(100% - 2 * max(20px, var(--safe-left), var(--safe-right))); padding-top: 48px; text-align: center; }
  .onboarding-style .widget-feature h2 { font-size: 36px; }
  .widget-copy p { margin-inline: auto; max-width: 340px; font-size: 17px; }
  .home-screen { width: min(100%, 340px); }
}
@media (max-width: 600px) {
  .onboarding-style .widget-feature h2 { font-size: clamp(28px, 8.4vw, 34px); }
  .widget-copy p { font-size: 16px; }
}
