/* The Stuffed home page: one pay period, start to finish.

   Hero (headline, Apple's badge, the price, the payday scene), then a
   fortnight told in five days, then the rest of the app as envelopes, what
   stays private, the plans, five answers and a last way to the App Store.
   The scene is the one thing that moves on its own. Everything else comes
   from style.css. */

.home h2 {
  font: 400 clamp(32px, 4.4vw, 46px)/1.08 var(--serif);
  letter-spacing: -.8px;
  margin: 0;
  text-wrap: balance;
}

/* ---------- hero ---------- */

.hero {
  max-width: 1000px;
  margin: 0 auto;
  padding: 56px var(--pad) 0;
  text-align: center;
}
.hero h1 {
  font: 400 clamp(42px, 7.4vw, 80px)/1.0 var(--serif);
  letter-spacing: -1.6px;
  margin: 0 auto;
  max-width: 11em;
  text-wrap: balance;
}
.hero-lede {
  font: 400 clamp(18px, 2.1vw, 21px)/1.55 var(--sans);
  color: var(--sub);
  max-width: 600px;
  margin: 22px auto 0;
  text-wrap: pretty;
}
.hero-cta { margin-top: 30px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.hero-price { font: 400 16px/1.5 var(--sans); color: var(--sub); margin: 0; }
.hero-price a { font-weight: 700; white-space: nowrap; }
.hero-scene { margin: 34px auto 0; max-width: 900px; }

/* ---------- a fortnight, in five days ---------- */

.pay { max-width: var(--shell); margin: 0 auto; padding: 112px var(--pad) 0; }
.pay-head { max-width: 640px; }
.pay-head p { font: 400 19px/1.6 var(--sans); color: var(--sub); margin: 16px 0 0; text-wrap: pretty; }

.days { list-style: none; margin: 40px 0 0; padding: 0; }
.day {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 48px 80px;
  align-items: center;
  padding: 56px 0;
  border-top: 1px solid var(--hair-soft);
}
.day:first-child { border-top: 0; padding-top: 24px; }
.day:nth-child(even) { grid-template-columns: 300px minmax(0, 1fr); }
.day:nth-child(even) .day-text { order: 2; }
.day-text { max-width: 480px; }
.day:nth-child(odd) .day-text { justify-self: end; }
.day-when {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font: 700 15px var(--sans);
  color: var(--link);
  margin: 0;
}
/* The pay period as the app draws it: fourteen days, filled up to today. */
.ruler {
  position: relative;
  display: block;
  width: 182px;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--card-2);
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 11px, transparent 11px 13px);
  mask: repeating-linear-gradient(90deg, #000 0 11px, transparent 11px 13px);
}
.ruler::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--terracotta);
  transform-origin: left center;
  transform: scaleX(calc(var(--day) / 14));
}
.day h3 { font: 400 clamp(26px, 3vw, 34px)/1.12 var(--serif); letter-spacing: -.4px; margin: 18px 0 0; }
.day-text > p:last-child { font: 400 18px/1.65 var(--sans); color: var(--sub); margin: 14px 0 0; text-wrap: pretty; }

/* The phones. Measured off an iPhone 17 Pro and sized in cqw, so the band,
   bezel and corners keep their proportions at any width: the screen's corner
   is 13.7% of its width, and each ring outside it adds its own thickness to
   the radius, so every curve runs parallel to the one inside it. */
.device {
  --band: .8cqw;
  --bezel: 2.3cqw;
  --screen-r: 12.9cqw;
  container-type: inline-size;
  position: relative;
  margin: 0;
}
.device-band {
  position: relative;
  padding: var(--band);
  border-radius: calc(var(--screen-r) + var(--bezel) + var(--band));
  /* Warm titanium: light catching the top left edge and the lower right. */
  background: linear-gradient(135deg, #D9CBBE 0%, #9A887B 16%, #6B5B51 34%, #8C7A6E 52%,
    #B8A698 70%, #6B5B51 86%, #C9B8AA 100%);
  box-shadow:
    inset 0 0 0 .2cqw rgba(255, 255, 255, .22),
    0 0 0 .15cqw rgba(46, 33, 28, .45),
    0 1px 2px rgba(63, 46, 39, .18),
    0 14px 28px -10px rgba(63, 46, 39, .30),
    0 40px 64px -28px rgba(63, 46, 39, .42);
}
.device-bezel {
  position: relative;
  padding: var(--bezel);
  border-radius: calc(var(--screen-r) + var(--bezel));
  background: #0B0807;
  box-shadow: inset 0 0 0 .3cqw #000;
}
.device img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--screen-r);
  background: #F2E8DA;
}
/* A faint sheen on the glass, so the screen reads as behind something. */
.device-bezel::after {
  content: "";
  position: absolute;
  inset: var(--bezel);
  border-radius: var(--screen-r);
  background: linear-gradient(118deg, rgba(255, 255, 255, .13) 0%, rgba(255, 255, 255, .04) 24%,
    rgba(255, 255, 255, 0) 40%);
  pointer-events: none;
}
/* Buttons: Action, then volume up and down on the left; the side button on
   the right. Behind the band, so only their outer edge shows. */
.device-band::before,
.device-band::after,
.device-bezel::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 1.1cqw;
  border-radius: .6cqw;
  background: linear-gradient(90deg, #5E4F46, #B3A193 55%, #7A695E);
}
.device-band::before { left: -.55cqw; top: 40cqw; height: 7.5cqw; }
.device-band::after { left: -.55cqw; top: 55cqw; height: 13cqw; box-shadow: 0 17cqw 0 #8C7A6E; }
.device-bezel::before { right: calc(-.55cqw - var(--band)); top: 60cqw; height: 21cqw; }
/* ---------- the rest of the app, as envelopes ---------- */

.more { max-width: var(--shell); margin: 0 auto; padding: 96px var(--pad) 0; }
.envs {
  list-style: none;
  margin: 40px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 44px 32px;
}
.env-card .help-env { width: 72px; }
.env-card .help-env-seal { width: 30px; height: 30px; margin: -15px 0 0 -15px; font-size: 16px; }
.env-card h3 { font: 700 18px/1.3 var(--sans); margin: 18px 0 0; }
.env-card p { font: 400 16.5px/1.55 var(--sans); color: var(--sub); margin: 6px 0 0; text-wrap: pretty; }
.env-card a { font-weight: 700; }

/* ---------- what stays private ---------- */

.yours { max-width: var(--shell); margin: 112px auto 0; padding: 0 var(--pad); }
.yours-in {
  background: #2E211C;
  color: #F4EAE0;
  border-radius: 28px;
  padding: 52px 56px;
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 20px 56px;
  align-items: start;
}
.yours h2 { color: #F4EAE0; }
.yours ul { list-style: none; margin: 0; padding: 0; grid-row: span 2; }
.yours li {
  font: 400 18px/1.55 var(--sans);
  color: rgba(244, 234, 224, .8);
  padding: 14px 0;
  border-top: 1px solid rgba(244, 234, 224, .14);
}
.yours li:first-child { border-top: 0; padding-top: 4px; }
.yours li b { color: #F4EAE0; }
.yours p { margin: 0; align-self: end; }
.yours a { color: #F0A387; font: 700 16px var(--sans); }
.yours a:hover { color: #F7BFA9; }
/* ---------- plans ---------- */

.plans { max-width: var(--shell); margin: 0 auto; padding: 112px var(--pad) 0; text-align: center; }
.plans-lede { font: 400 19px/1.6 var(--sans); color: var(--sub); margin: 16px auto 0; max-width: 560px; }
.plan-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  max-width: 880px;
  margin: 40px auto 0;
  align-items: stretch;
}
.plan {
  position: relative;
  background: var(--card);
  border: 1px solid var(--hair-soft);
  border-radius: 22px;
  padding: 30px 22px 26px;
}
.plan--pick { border: 2px solid var(--terracotta); box-shadow: var(--lift); }
.plan-tag {
  position: absolute;
  top: -14px; left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font: 700 14px var(--sans);
  color: var(--cream);
  background: var(--button);
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.plan h3 { font: 700 18px var(--sans); margin: 0; }
.plan-price { font: 400 40px/1.1 var(--serif); letter-spacing: -.6px; margin: 14px 0 0; }
.plan-per { font: 400 16px/1.45 var(--sans); color: var(--sub); margin: 6px 0 0; }
.plan-trial {
  font: 700 15px var(--sans);
  color: var(--ink);
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--hair-soft);
}
.plans-cta { margin: 34px 0 0; }
.plans-note { font: 400 15px/1.6 var(--sans); color: var(--sub); margin: 16px auto 0; max-width: 560px; }

/* ---------- answers ---------- */

.answers { max-width: 760px; margin: 0 auto; padding: 112px var(--pad) 0; }
.answers .faq { margin-top: 32px; }
.answers-more { margin: 22px 0 0; font: 700 16px var(--sans); }

/* ---------- the last word ---------- */

.last { max-width: 640px; margin: 0 auto; padding: 120px var(--pad) 40px; text-align: center; }
.last-icon {
  width: 112px; height: 112px;
  margin: 0 auto 28px;
  border-radius: 25px;
  box-shadow: 0 2px 4px rgba(63, 46, 39, .12), 0 16px 36px rgba(63, 46, 39, .2);
}
.last p { font: 400 18px/1.6 var(--sans); color: var(--sub); margin: 16px 0 0; text-wrap: pretty; }
.last .btn { margin-top: 28px; }
.last .last-note { font-size: 15px; margin-top: 12px; }

/* ---------- smaller screens ---------- */

@media (max-width: 960px) {
  .envs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day, .day:nth-child(even) { grid-template-columns: minmax(0, 1fr) 240px; gap: 32px 40px; }
  .day:nth-child(even) .day-text { order: 0; }
  .day:nth-child(odd) .day-text { justify-self: start; }
  .yours-in { grid-template-columns: 1fr; padding: 44px 40px; }
  .yours ul { grid-row: auto; }
}

@media (max-width: 760px) {
  .hero { padding-top: 36px; }
  /* The scene scales with the page; its words must not. Scoped to the hero
     so these win over scene.css, which loads after this file. */
  .hero-scene .scene .name { font-size: 27px; }
  .hero-scene .scene .amt { font-size: 31px; }
  .hero-scene .scene .pay-label { font-size: 25px; }
  .pay, .more, .plans, .answers { padding-top: 80px; }
  .yours { margin-top: 80px; }
  .last { padding-top: 88px; }
}

@media (max-width: 620px) {
  .hero-scene { margin: 26px -8px 0; }
  .days { margin-top: 24px; }
  .day, .day:nth-child(even) {
    grid-template-columns: 1fr;
    gap: 26px;
    padding: 40px 0;
  }
  .day .device { width: min(68%, 260px); margin: 0 auto; }
  .envs { gap: 32px 18px; }
  .env-card .help-env { width: 60px; }
  .env-card .help-env-seal { width: 26px; height: 26px; margin: -13px 0 0 -13px; font-size: 14px; }
  .env-card h3 { font-size: 17px; margin-top: 14px; }
  .env-card p { font-size: 15.5px; }
  .yours { padding: 0 12px; }
  .yours-in { padding: 34px 24px; border-radius: 24px; }
  .yours li { font-size: 17px; }
  .plan-row { grid-template-columns: 1fr; gap: 24px; max-width: 360px; }
  .plan--pick { order: -1; }
  .last .btn, .plans-cta .btn { width: 100%; max-width: 360px; white-space: normal; }
}

/* ---------- motion ----------
   One rhythm for the whole page: things settle in with a soft ease out, and
   small pops use a gentle spring. Only opacity and transform move, so nothing
   reflows. motion.js adds .is-in as each piece scrolls into view; every rule
   here sits under .js, so without the script nothing is hidden, and Reduce
   Motion shows everything in place at the end of this file. */

:root {
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.45, .64, 1);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}

/* The hero arrives once, word by word, then the payday scene starts dealing. */
.hero h1 .w { display: inline-block; }
.js .hero h1 .w { animation: rise .8s var(--ease-out) both; animation-delay: calc(var(--i) * 80ms); }
.js .hero-lede { animation: rise .8s var(--ease-out) .32s both; }
.js .hero-cta { animation: rise .8s var(--ease-out) .44s both; }
.js .hero-scene { animation: rise .9s var(--ease-out) .56s both; }
.js .hero-scene .scene :is(.flap, .flap-up, .fly, .amt) { animation-delay: .9s; }

/* Anything marked data-reveal rises into place, in its --d order. */
.js [data-reveal] {
  transition: opacity .6s var(--ease-out), transform .8s var(--ease-out);
  transition-delay: calc(var(--d, 0) * 70ms);
}
.js [data-reveal]:not(.is-in) { opacity: 0; transform: translateY(26px); }

/* The fortnight: each phone is set down on the desk, its text follows, and
   the pay period bar fills up to that day. */
.js .day[data-reveal]:not(.is-in) { opacity: 1; transform: none; }
.js .day .device { transition: opacity .7s var(--ease-out), transform 1s var(--ease-out); }
.js .day .day-text { transition: opacity .7s var(--ease-out) .12s, transform .9s var(--ease-out) .12s; }
.js .day:not(.is-in) .device { opacity: 0; transform: translateY(70px) rotate(-3deg) scale(.96); }
.js .day:nth-child(even):not(.is-in) .device { transform: translateY(70px) rotate(3deg) scale(.96); }
.js .day:not(.is-in) .day-text { opacity: 0; transform: translateY(24px); }
.js .day .ruler::after { transition: transform 1.1s var(--ease-out) .35s; }
.js .day:not(.is-in) .ruler::after { transform: scaleX(0); }

/* The rest of the app, dealt in like envelopes onto a table. */
.js .env-card[data-reveal] { transition: opacity .5s var(--ease-out), transform .7s var(--ease-spring); transition-delay: calc(var(--d, 0) * 70ms); }
.js .env-card[data-reveal]:not(.is-in) { transform: translateY(-18px) rotate(-6deg); }
.js .env-card:nth-child(even)[data-reveal]:not(.is-in) { transform: translateY(-18px) rotate(6deg); }

/* The yearly plan's saving pops in once its card has landed. */
.js .plan-tag { transition: opacity .3s var(--ease-out) .45s, transform .5s var(--ease-spring) .45s; }
.js .plan--pick:not(.is-in) .plan-tag { opacity: 0; transform: translateX(-50%) scale(.5); }

/* The icon at the end lands with a small bounce. */
.js .last-icon[data-reveal] { transition: opacity .5s var(--ease-out), transform .8s var(--ease-spring); }
.js .last-icon[data-reveal]:not(.is-in) { transform: translateY(24px) scale(.8) rotate(-8deg); }

/* Hover and press on the badge. The plan cards aren't links, so they stay put. */
.badge { transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out); }
.badge:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(63, 46, 39, .18); }
.badge:active { transform: scale(.97); }

@media (prefers-reduced-motion: reduce) {
  .js .hero h1 .w, .js .hero-lede, .js .hero-cta, .js .hero-scene { animation: none; }
  .js [data-reveal], .js .day .device, .js .day .day-text, .js .day .ruler::after, .js .plan-tag {
    transition: none !important;
  }
  .js [data-reveal]:not(.is-in), .js .day:not(.is-in) .device, .js .day:not(.is-in) .day-text { opacity: 1; transform: none; }
  .js .day:not(.is-in) .ruler::after { transform: scaleX(calc(var(--day) / 14)); }
  .js .plan--pick:not(.is-in) .plan-tag { opacity: 1; transform: translateX(-50%); }
  .badge:hover { transform: none; }
}
