/* Depth: the 3D touches on the homepage.
   1. Floating calendar pages: little tear-off pads (a front page plus a few pages behind it,
      so they have real thickness) drifting around the hero and the closing panel.
   2. The hero product shot is a 3D scene: the browser, the Pridiem card and the popup sit
      at different depths, and the whole rig leans towards the pointer.
   Both are driven by js/depth.js and stay still for people who ask for reduced motion. */

/* ---------- Floating calendar pages ---------- */

.floaters {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  perspective: 900px;
  pointer-events: none;
}

.hero__grid { z-index: 1; }

.ftile {
  position: absolute;
  width: 0;
  height: 0;
}

.ftile__body {
  position: absolute;
  left: -2.25em;
  top: -2.5em;
  width: 4.5em;
  height: 5em;
  transform-style: preserve-3d;
  will-change: transform;
}

/* The pages behind the front one: give the pad its thickness */
.ftile__page,
.ftile__front {
  position: absolute;
  inset: 0;
  border-radius: 0.8em;
  backface-visibility: hidden;
}

.ftile__page {
  background: #e6e9f0;
  transform: translateZ(calc(var(--i) * -0.16em));
  box-shadow: inset 0 0 0 1px rgba(23, 32, 51, 0.08);
}

.ftile__page--back {
  background: #23304f;
  box-shadow: 0 1.2em 2em -0.8em rgba(23, 32, 51, 0.45);
}

.ftile__front {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(23, 32, 51, 0.1);
  text-align: center;
  color: #172033;
}

.ftile__month {
  display: block;
  padding: 0.22em 0 0.16em;
  background: #e03a3a;
  color: #ffffff;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ftile__day {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 0.1em;
  font-size: 2.4em;
  font-weight: 800;
  font-stretch: 62%;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* The page that turns, hinged on the top edge */
.ftile__leaf {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform-origin: 50% 0;
  transform: translateZ(0.05em);
  visibility: hidden;
}

.ftile__leaf-back {
  position: absolute;
  inset: 0;
  border-radius: 0.8em;
  background:
    repeating-linear-gradient(180deg, transparent 0 0.42em, rgba(23, 32, 51, 0.05) 0.42em 0.46em),
    #eceff4;
  box-shadow: inset 0 0 0 1px rgba(23, 32, 51, 0.14);
  transform: rotateX(180deg);
  backface-visibility: hidden;
}

/* On the blue closing panel the pads glow a little */
.floaters--light .ftile__page--back { background: #1e3bd6; }

.closer__inner { position: relative; overflow: hidden; }
.closer__inner > :not(.floaters) { position: relative; z-index: 1; }

/* ---------- The hero product shot as a 3D scene ---------- */

.stage {
  padding: 0;
  perspective: 1600px;
}

.stage__rig {
  position: relative;
  padding: 0 48px 176px 0;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 5deg)) rotateY(var(--ry, -9deg));
}

.stage__rig .demo {
  overflow: visible;
  transform-style: preserve-3d;
}

.stage__rig .demo__bar { border-radius: 16px 16px 0 0; }

/* The card floats above the page it's on, and the popup above both */
.stage__rig .tgcard { transform: translateZ(70px) translateY(-10px) scale(0.98); }
.stage__rig .tgcard--in { transform: translateZ(70px); }

.stage__rig .stage__popup { transform: translateZ(140px) rotate(2deg); }

@media (max-width: 560px) {
  .stage__rig { padding: 0 0 210px; }
  .stage__rig .tgcard,
  .stage__rig .tgcard--in { transform: translateZ(40px); }
  .stage__rig .stage__popup { transform: translateZ(80px) rotate(2deg); }
}
