/* Tuckwell landing page. Colors are Tuckwell's app palette (HeldPalette.swift): canvas, ink,
   secondary, the lavender primary action and the category tints. Shadows are plum. */

@font-face {
  font-family: "Newsreader";
  src: url("assets/fonts/newsreader-500.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader";
  src: url("assets/fonts/newsreader-500-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Figtree";
  src: url("assets/fonts/figtree-500-700.woff2") format("woff2");
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
}

:root {
  --paper: #f8f5ff;
  --ink: #171529;
  --muted: #6e6580;
  --primary: #8063bd;
  --accent: #7857ba;
  --decorative: #b4a0e0;
  --wash: #eee7fc;
  --tint-feed: #fbeff5;
  --tint-sleep: #eee7fb;
  --tint-diaper: #eaf5f0;
  --tint-moment: #fff4df;
  --rose: #c88ba8;
  --serif: "Newsreader", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Figtree", system-ui, sans-serif;

  /* The wall scales with the viewport's short side (900px is the 1440x900 design), and with
     the width on squarish screens so 4:3 windows keep the same breathing room. */
  --vm: clamp(560px, min(100vh, 62.5vw), 1080px);
  --base: 900;
}

@supports (height: 1svh) {
  :root {
    --vm: clamp(560px, min(100svh, 62.5vw), 1080px);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  color-scheme: light;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

.symbols {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.page {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
}

a {
  color: inherit;
}

/* Wordmark ------------------------------------------------------------- */

.wordmark {
  position: absolute;
  z-index: 6;
  top: 36px;
  left: 48px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-decoration: none;
  border-radius: 8px;
}

.wordmark svg {
  width: 0.5em;
  height: 0.5em;
  margin-bottom: 0.22em;
  color: var(--decorative);
}

.wordmark:focus-visible,
.footer a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
}

/* The wall ------------------------------------------------------------- */

.wall {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Each piece sits at (--x, --y) percent of the page. --p* values reseat it on phones. */
.seat {
  --cx: var(--x);
  --cy: var(--y);
  --cw: var(--w, 100);
  --cf: var(--f, 1);
  --cr: var(--r, 0deg);
  --cd: var(--d, 0s);
  position: absolute;
  top: calc(var(--cy) * 1%);
  left: calc(var(--cx) * 1%);
  transform: translate(-50%, -50%) rotate(var(--cr));
  pointer-events: auto;
}

.seat.obj,
.seat.shape {
  width: calc(var(--vm) * var(--cw) / var(--base));
}

.seat.sticker {
  font-size: calc(var(--vm) * 16 * var(--cf) / var(--base));
}

.seat img,
.seat svg {
  display: block;
  width: 100%;
  height: auto;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  user-select: none;
}

.seat.shape svg {
  overflow: visible;
}

.phone-only {
  display: none;
}

/* The entrance: every piece springs out from the page center. */
@keyframes pop {
  0% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(var(--s0));
  }

  30% {
    opacity: 1;
  }

  100% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
}

.pop {
  --dx: calc((50 - var(--cx)) * 0.34vw);
  --dy: calc((50 - var(--cy)) * 0.34vh);
  --s0: 0.45;
  animation: pop 420ms cubic-bezier(0.2, 1.25, 0.4, 1) both;
  animation-delay: var(--cd);
}

.shape .pop {
  --s0: 0.3;
}

.js .pop.pending {
  animation-play-state: paused;
}

/* Widget stickers: a white die-cut margin around an app-style surface. */
.stk {
  padding: 0.4em;
  color: var(--ink);
  font-family: var(--sans);
  white-space: nowrap;
  background: #fff;
  border-radius: 1.65em;
  box-shadow:
    0 0.12em 0.16em rgba(52, 40, 90, 0.26),
    0 0.7em 1.4em -0.6em rgba(52, 40, 90, 0.22);
}

.w {
  background: var(--wash);
  border-radius: 1.25em;
}

.w.row {
  display: flex;
  align-items: center;
  gap: 0.8em;
  padding: 0.85em 1.3em 0.85em 0.85em;
}

.w.feed {
  background: var(--tint-feed);
}

.w.sleep {
  background: var(--tint-sleep);
}

.ic {
  display: flex;
  width: 2.6em;
  height: 2.6em;
  flex: none;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: #fff;
  border-radius: 50%;
}

.seat .ico {
  width: 1.35em;
  height: 1.35em;
}

.tx {
  display: flex;
  flex-direction: column;
}

.lb {
  color: var(--muted);
  font-size: 0.75em;
  font-weight: 600;
  line-height: 1.3;
}

.val {
  font-size: 1.4em;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.val.sm {
  font-size: 0.98em;
  letter-spacing: -0.005em;
}

.sb {
  color: var(--muted);
  font-size: 0.75em;
  font-weight: 500;
  line-height: 1.35;
}

.w.sq {
  display: flex;
  width: 8.4em;
  height: 8.4em;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.9em;
  background: var(--tint-diaper);
}

.big {
  font-size: 2.8em;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.w.moment {
  display: flex;
  flex-direction: column;
  gap: 0.2em;
  padding: 1em 1.4em 1.05em 1.1em;
  background: var(--tint-moment);
}

.seat .hrt {
  width: 1.4em;
  height: 1.4em;
  margin-bottom: 0.35em;
  color: var(--rose);
}

.mt {
  font-family: var(--serif);
  font-size: 1.3em;
  font-style: italic;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.stk.pill,
.w.pill {
  border-radius: 99em;
}

.w.pill {
  display: flex;
  align-items: center;
  gap: 0.65em;
  padding: 0.55em 1.3em 0.55em 0.55em;
}

.ck {
  display: flex;
  width: 2.2em;
  height: 2.2em;
  flex: none;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--primary);
  border-radius: 50%;
}

.seat .ck .ico {
  width: 1.2em;
  height: 1.2em;
}

.seat .watch {
  width: 7.6em;
  overflow: visible;
  filter: drop-shadow(0 0.12em 0.1em rgba(52, 40, 90, 0.28)) drop-shadow(0 0.6em 0.9em rgba(52, 40, 90, 0.14));
}

/* Hover: stickers tilt on a spring; each flat shape reacts once (the script adds .play). */
.wig {
  transform-origin: 50% 55%;
}

@keyframes beat {
  0% { transform: scale(1); }
  14% { transform: scale(1.16); }
  28% { transform: scale(0.97); }
  42% { transform: scale(1.1); }
  70%, 100% { transform: scale(1); }
}

@keyframes rock {
  0% { transform: rotate(0); }
  22% { transform: rotate(-16deg); }
  48% { transform: rotate(11deg); }
  70% { transform: rotate(-5deg); }
  86% { transform: rotate(2deg); }
  100% { transform: rotate(0); }
}

@keyframes squish {
  0% { transform: scale(1, 1); }
  28% { transform: scale(1.14, 0.84); }
  52% { transform: scale(0.93, 1.1); }
  74% { transform: scale(1.04, 0.97); }
  100% { transform: scale(1, 1); }
}

/* Star and sparkle end on a symmetric angle, so dropping the rotation afterwards is invisible. */
@keyframes turn-star {
  to { transform: rotate(144deg); }
}

@keyframes turn-sparkle {
  to { transform: rotate(180deg); }
}

@media (hover: hover) {
  .seat.obj,
  .seat.sticker {
    transition: transform 520ms cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .seat.obj:hover {
    transform: translate(-50%, -50%) rotate(calc(var(--cr) + 8deg)) scale(1.07);
  }

  .seat.sticker:hover {
    transform: translate(-50%, -50%) rotate(calc(var(--cr) + 7deg));
  }
}

.heart .wig.play { animation: beat 1100ms ease-in-out; }
.moon .wig.play { animation: rock 1600ms ease-in-out; }
.drop .wig.play { animation: squish 700ms ease-out; }
.star .wig.play { animation: turn-star 1400ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.sparkle .wig.play { animation: turn-sparkle 1200ms cubic-bezier(0.2, 0.8, 0.2, 1); }

/* The copy ------------------------------------------------------------- */

.hero {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  display: flex;
  width: min(860px, calc(100% - 48px));
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
  transform: translate(-50%, -50%);
}

h1,
.hero p {
  margin: 0;
}

h1 {
  font-family: var(--serif);
  font-size: clamp(64px, min(7.2vw, 11.6vh), 104px);
  font-optical-sizing: auto;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.025em;
}

h1 span {
  display: block;
  white-space: nowrap;
}

.hero p {
  max-width: 560px;
  color: var(--muted);
  font-size: 20px;
  font-weight: 500;
  line-height: 29px;
  text-wrap: pretty;
}

/* The button: the app's lavender capsule. With a mouse it springs open into a QR card. */
.cta-shell {
  position: relative;
  z-index: 5;
  width: 232px;
  height: 56px;
  margin-top: 12px;
}

.cta {
  position: absolute;
  right: 50%;
  bottom: 0;
  display: inline-flex;
  width: 232px;
  height: 56px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  background: var(--primary);
  border-radius: 1000px;
  isolation: isolate;
  transform: translateX(50%);
  box-shadow: 0 0 0 rgba(52, 40, 90, 0);
  transition:
    width 300ms cubic-bezier(0.34, 1.56, 0.64, 1),
    height 300ms cubic-bezier(0.34, 1.56, 0.64, 1),
    border-radius 240ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 300ms ease,
    opacity 120ms ease;
}

.cta:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.cta:active {
  opacity: 0.84;
}

.cta-text {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  line-height: 24px;
  letter-spacing: -0.005em;
  transition: opacity 140ms ease;
}

.apple {
  width: 18px;
  height: 18px;
  margin-top: -2px;
  flex: none;
}

.cta-qr {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease 90ms;
}

/* The code sits on a white tile so any camera reads it off the lavender card. */
.qr-tile {
  display: block;
  padding: 10px;
  background: #fff;
  border-radius: 18px;
}

.qr {
  display: block;
  width: 176px;
  height: 176px;
}

.cta-caption {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 16px;
}

/* Footer --------------------------------------------------------------- */

.footer {
  position: absolute;
  z-index: 6;
  right: 0;
  bottom: 28px;
  left: 0;
  display: flex;
  justify-content: center;
  gap: 28px;
  font-size: 13px;
  font-weight: 500;
  line-height: 16px;
}

.footer a {
  color: var(--muted);
  text-decoration: none;
  border-radius: 4px;
}

.footer a:hover {
  color: var(--ink);
}

/* Desktop: one screen, no scroll, and the QR reveal for mice and trackpads. */
@media (min-width: 1024px) {
  html,
  body {
    overscroll-behavior-y: none;
  }

  .page {
    height: 100vh;
    height: 100svh;
    min-height: 560px;
  }
}

/* Compact desktops (narrow or short windows) move a few seats clear of the copy. */
@media (min-width: 1024px) and (max-width: 1279.98px), (min-width: 1024px) and (max-height: 680px) {
  .seat {
    --cx: var(--nx, var(--x));
    --cy: var(--ny, var(--y));
  }
}

@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  /* An invisible hit area a little larger than the card keeps its edges from flickering. */
  .js .cta-shell::before {
    position: absolute;
    right: 50%;
    bottom: -4px;
    width: 240px;
    height: 64px;
    content: "";
    border-radius: 1000px;
    transform: translateX(50%);
  }

  .js .cta-shell:hover::before,
  .js .cta-shell:has(:focus-visible)::before {
    width: 280px;
    height: 320px;
    border-radius: 34px;
  }

  .js .cta-shell:hover .cta,
  .js .cta-shell:has(:focus-visible) .cta {
    width: 268px;
    height: 306px;
    border-radius: 30px;
    box-shadow:
      0 60px 140px -20px rgba(52, 40, 90, 0.34),
      0 30px 80px -10px rgba(52, 40, 90, 0.22),
      0 8px 24px rgba(52, 40, 90, 0.16);
  }

  .js .cta-shell:hover .cta-text,
  .js .cta-shell:has(:focus-visible) .cta-text {
    opacity: 0;
  }

  .js .cta-shell:hover .cta-qr,
  .js .cta-shell:has(:focus-visible) .cta-qr {
    opacity: 1;
  }

  .cta:active {
    opacity: 1;
  }
}

/* Phones and tablets ----------------------------------------------------- */

@media (max-width: 1023.98px) {
  /* Phones scale by width, or by height on short phones, keeping the 390x844 proportions. */
  :root {
    --vm: clamp(300px, min(100vw, 46.2vh), 520px);
    --base: 390;
  }

  @supports (height: 1svh) {
    :root {
      --vm: clamp(300px, min(100vw, 46.2svh), 520px);
    }
  }

  .page {
    height: 100vh;
    height: 100svh;
    min-height: 600px;
  }

  .wordmark {
    top: calc(22px + env(safe-area-inset-top));
    left: calc(24px + env(safe-area-inset-left));
    font-size: 26px;
  }

  .seat {
    --cx: var(--px, var(--x));
    --cy: var(--py, var(--y));
    --cw: var(--pw, var(--w, 100));
    --cf: var(--pf, var(--f, 1));
    --cr: var(--pr, var(--r, 0deg));
    --cd: var(--pd, var(--d, 0s));
  }

  .desktop-only {
    display: none;
  }
}

@media (max-width: 1023.98px) and (max-height: 740px) {
  .seat {
    --cx: var(--sx, var(--px, var(--x)));
    --cy: var(--sy, var(--py, var(--y)));
  }
}

@media (max-width: 1023.98px) {

  .phone-only {
    display: block;
  }

  .hero {
    top: 52%;
    width: calc(100% - 48px - env(safe-area-inset-left) - env(safe-area-inset-right));
    gap: 18px;
  }

  h1 {
    font-size: clamp(36px, 10.5vw, 44px);
    line-height: 1.04;
  }

  .hero p {
    max-width: 320px;
    font-size: 16px;
    line-height: 23px;
  }

  .cta-shell {
    width: 220px;
    height: 52px;
    margin-top: 6px;
  }

  .cta {
    width: 220px;
    height: 52px;
    font-size: 17px;
    transition: opacity 120ms ease;
  }

  .footer {
    bottom: calc(26px + env(safe-area-inset-bottom));
  }
}

/* Reduced motion: no entrance, no hover motion, no replay (the script checks too). */
@media (prefers-reduced-motion: reduce) {
  .pop,
  .wig.play {
    animation: none;
  }

  .seat.obj,
  .seat.sticker,
  .cta,
  .cta-text,
  .cta-qr {
    transition: none;
  }

  .seat.obj:hover,
  .seat.sticker:hover {
    transform: translate(-50%, -50%) rotate(var(--cr));
  }
}
