/*
 * tiltpane.app, drawn from the icon: a night sky with the moon, mountains
 * in two layers, and mint ground with triangle trees. Each page opens in
 * the sky and its content sits on the ground. Its one script plays the
 * promo, and its policy allows no inline styles, so everything is here.
 */
@font-face {
  font-family: "Google Sans Flex";
  src: url("/fonts/google-sans-flex.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: swap;
}

:root {
  /* The icon's palette, plus one mountain further back. */
  --night: #0d1b2e;
  --sky: #1c3a5e;
  --far: #2f5a86;
  --mountain: #3e6f9e;
  --mint: #9ed2c6;
  --moon: #f4efd8;

  /* Text on the sky, and quieter text on the ground. */
  --sky-ink: #cfd9e4;
  --ground-ink: #1c3a5e;
  --line: rgb(13 27 46 / 0.18);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--night);
}

body {
  margin: 0;
  background: var(--mint);
  color: var(--night);
  font: 17px/1.6 "Google Sans Flex", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--night);
  text-underline-offset: 0.18em;
}

a:focus-visible,
video:focus-visible {
  outline: 3px solid var(--moon);
  outline-offset: 3px;
  border-radius: 6px;
}

h1,
h2,
h3 {
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 {
  font-weight: 680;
  line-height: 1.02;
  margin: 0 0 16px;
}

h2 {
  font-size: clamp(28px, 4.2vw, 48px);
  font-weight: 680;
  line-height: 1.06;
  margin: 0 0 14px;
}

h3 {
  font-size: 22px;
  font-weight: 650;
  line-height: 1.25;
  margin: 0 0 4px;
}

p {
  margin: 0 0 16px;
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 600px) {
  .wrap {
    padding: 0 32px;
  }
}

/* Buttons: verb and object, in the colour that stands out where they sit. */
.button {
  display: inline-block;
  padding: 13px 26px;
  border-radius: 14px;
  font-weight: 650;
  font-size: 18px;
  text-decoration: none;
}

.button.moon {
  background: var(--moon);
  color: var(--night);
}

.button.moon:hover {
  background: #fffaf0;
}

.button.night {
  background: var(--night);
  color: var(--moon);
}

.button.night:hover {
  background: var(--sky);
}

.button.mint {
  background: var(--mint);
  color: var(--night);
}

.button.mint:hover {
  background: #b9e2d8;
}

/* The sky every page opens in, and its header. */
.sky {
  background: var(--sky);
  color: var(--sky-ink);
}

.top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

@media (min-width: 600px) {
  .top {
    padding: 18px 32px;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--moon);
  font-weight: 650;
  font-size: 20px;
  text-decoration: none;
}

.brand img {
  width: 36px;
  height: 36px;
}

.top .early {
  color: var(--moon);
  font-weight: 620;
  font-size: 15px;
  text-decoration: none;
  padding: 8px 15px;
  border: 1.5px solid rgb(244 239 216 / 0.55);
  border-radius: 12px;
}

.top .early:hover {
  border-color: var(--moon);
}

.sky h1 {
  color: var(--moon);
}

.sky a:not(.button) {
  color: var(--moon);
}

/*
 * The home page's opening: words in the sky, then the scene. The ground
 * below the scene stretches to the bottom of the first screen, so the next
 * section starts below it.
 */
.hero {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}

.hero::after {
  content: "";
  flex: 1;
  margin-top: -1px;
  background: var(--mint);
}

.hero-text {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 12px 16px 28px;
  text-align: center;
}

.hero-text h1 {
  font-size: clamp(34px, 5.6vw, 72px);
  margin-bottom: 28px;
}

/* The second half of the title, on its own line in the ground's colour. */
.hero-text h1 .any {
  display: block;
  color: var(--mint);
}

.lead {
  font-size: clamp(17px, 1.9vw, 20px);
  max-width: 32em;
  margin: 0 auto 26px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px 20px;
}

/* Where the Google Play button will go, greyed out until the app is there. */
.button.soon {
  font: inherit;
  font-weight: 650;
  font-size: 18px;
  background: none;
  color: rgb(244 239 216 / 0.6);
  border: 1.5px solid rgb(244 239 216 / 0.3);
  cursor: default;
}

/* Both buttons on one row on a phone. */
@media (max-width: 599px) {
  .actions {
    gap: 10px;
  }

  .actions .button {
    padding: 13px 18px;
    font-size: 16px;
  }
}

/*
 * The scene: a moon, far and near mountains, the phone, then the ground and
 * trees in front. Each layer is the same 1440x680 drawing, kept to the
 * bottom edge and cropped at the sides on narrow screens, so they line up.
 */
.scene {
  position: relative;
  overflow: hidden;
  height: clamp(380px, 54vh, 680px);
  container-type: size;
}

.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/*
 * The moon is placed as if it were drawn at (890, 310) r 80 in the 1440x680
 * drawing, but kept below the top edge where a wide screen crops the drawing.
 */
.scene .moon {
  --unit: max(100cqw / 1440, 100cqh / 680);
  position: absolute;
  left: calc(50% + var(--unit) * 90);
  top: max(3cqh, 100cqh - var(--unit) * 450);
  width: calc(var(--unit) * 160);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--moon);
}

.phone {
  position: absolute;
  left: 50%;
  top: 6%;
  height: 88%;
  aspect-ratio: 600 / 1338;
  translate: -50% 0;
  z-index: 1;
  border: 1.3cqh solid #05080e;
  border-radius: 6cqh;
  overflow: hidden;
  background: var(--sky);
  box-shadow: 0 2cqh 6cqh rgb(5 8 14 / 0.35);
}

.phone video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Scrolling sinks the moon and far mountains, and raises the near mountains and the phone. */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: scroll()) {
    .scene .moon,
    .scene .far,
    .scene .near,
    .scene .phone {
      animation: linear both;
      animation-timeline: scroll(root);
      animation-range: 0 85vh;
    }

    .scene .moon {
      animation-name: sink-moon;
    }

    .scene .far {
      animation-name: sink-far;
    }

    .scene .near {
      animation-name: rise-near;
    }

    .scene .phone {
      animation-name: rise-phone;
    }
  }
}

@keyframes sink-moon {
  to {
    transform: translateY(40cqh);
  }
}

@keyframes sink-far {
  to {
    transform: translateY(24cqh);
  }
}

@keyframes rise-near {
  to {
    transform: translateY(-6cqh);
  }
}

@keyframes rise-phone {
  to {
    transform: translateY(-5cqh);
  }
}

/* The other pages' sky: a heading, then a strip of mountains down to the ground. */
/* As wide as the text below it, so their left edges line up. */
.band-text {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 8px;
}

@media (min-width: 600px) {
  .band-text {
    padding: 28px 32px 8px;
  }
}

.band-text h1 {
  font-size: clamp(36px, 5.4vw, 64px);
  max-width: 13em;
}

.band-text .lead {
  margin: 0;
}

.ridge {
  display: block;
  width: 100%;
  height: clamp(64px, 9vw, 130px);
}

/* The ground, where the content sits. */
.ground {
  padding: clamp(40px, 6vw, 72px) 0 clamp(64px, 8vw, 104px);
}

.hero + .ground {
  padding-top: clamp(64px, 9vw, 104px);
}

.ground section {
  margin-bottom: clamp(64px, 9vw, 112px);
}

.ground section:last-child {
  margin-bottom: 0;
}

.quiet {
  color: var(--ground-ink);
}

.center {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.center p {
  font-size: 19px;
}

/* The second half of a heading, on its own line in blue. */
.center h2 .second {
  display: block;
  color: var(--far);
}

/* Free on moonlight, Pro on night, side by side when there's room. */
.tiers {
  display: grid;
  gap: 20px;
}

@media (min-width: 820px) {
  .tiers {
    grid-template-columns: 1fr 1fr;
    gap: 28px;
  }
}

.card {
  border-radius: 22px;
  padding: 26px 26px 18px;
}

.card.free {
  background: var(--moon);
}

.card.pro {
  background: var(--night);
  color: #e3e9f0;
}

.card h2 {
  font-size: 30px;
  margin: 0;
}

.card.pro h2 {
  color: var(--moon);
}

/* The card's name, with the price on the right when it has one. */
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.card .cost {
  margin: 0;
  font-size: 34px;
  font-weight: 680;
  letter-spacing: -0.02em;
  /* The same line height as the card's name, so both cards' first lines match. */
  line-height: 32px;
}

.card.pro .cost {
  color: var(--mint);
}

.card .sub {
  font-weight: 620;
  color: var(--mountain);
  margin: 0 0 14px;
}

.card.pro .sub {
  color: var(--mint);
}

.card .footnote {
  margin: 10px 0 4px;
  font-size: 14px;
  color: #9fb0c5;
}

/* Lists with a small tree for a bullet. */
.trees {
  list-style: none;
  padding: 0;
  margin: 0;
}

.trees li {
  position: relative;
  padding: 6px 0 6px 26px;
}

.trees li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 13px;
  height: 15px;
  background: var(--mountain);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.pro .trees li::before {
  background: var(--mint);
}

/*
 * The promo, as wide as the cards: upright on an upright screen and wide on
 * a wide one, never taller than the screen. Its poster is a background, as
 * the poster attribute can't change with the screen.
 */
.promo h2 {
  margin-bottom: 24px;
}

.promo video {
  display: block;
  width: min(100%, 85svh * 9 / 16);
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  border-radius: 22px;
  background: var(--night) url("/media/promo.webp") center / cover no-repeat;
}

@media (orientation: landscape) {
  .promo video {
    width: min(100%, 85svh * 16 / 9);
    aspect-ratio: 16 / 9;
    background-image: url("/media/promo-wide.webp");
  }
}

/* What a phone needs: a label, then the detail. */
.specs {
  display: grid;
  margin: 24px 0 0;
}

@media (min-width: 820px) {
  .specs {
    grid-template-columns: 1fr 1fr;
    column-gap: 48px;
  }
}

.specs div {
  padding: 12px 0;
  border-top: 2px solid var(--line);
}

.specs dt {
  font-weight: 680;
}

.specs dd {
  margin: 0;
  color: var(--ground-ink);
}

.specs + .footnote {
  margin: 16px 0 0;
  font-size: 14px;
  color: var(--ground-ink);
}

/* The testing page: plain lists, then numbered steps on moonlight. */
.text {
  max-width: 720px;
}

.text section {
  margin-bottom: 48px;
}

.text h2 {
  font-size: clamp(26px, 3.4vw, 34px);
}

.needs {
  padding-left: 1.2em;
  margin: 0;
}

.needs li {
  margin-bottom: 6px;
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.steps li {
  counter-increment: step;
  position: relative;
  background: var(--moon);
  border-radius: 18px;
  padding: 16px 20px 16px 64px;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 18px;
  top: 15px;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--mountain);
  color: var(--moon);
  font-weight: 700;
  text-align: center;
  line-height: 32px;
}

.steps li p:last-child {
  margin-bottom: 0;
}

.steps .button {
  margin: 4px 0 2px;
}

/* The privacy policy. */
.policy h2 {
  font-size: 26px;
  margin-top: 40px;
}

/* Every page ends at night: mountains up from the ground, then the footer. */
.night {
  background: var(--night);
  color: #e3e9f0;
}

.night h2 {
  color: var(--moon);
}

/* The mountains between the ground and the night stand against the ground's colour:
   the far ones, the near one, then the night's own ground in front, each drawn
   alone so it can move alone. On wide screens the strip is shorter than the
   drawing, so the peaks go past its top; nothing shows past its bottom or sides. */
.ridge.rise {
  position: relative;
  background: var(--mint);
  container-type: size;
  clip-path: inset(-100% 0 0);
}

.ridge.rise svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* On the home page they rise out of the ground as the page reaches its end,
   the near one faster. They move as whole layers, which the browser moves in
   step with the scroll without redrawing them. */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .night {
      view-timeline-name: --night;
    }

    .ridge.lift .far,
    .ridge.lift .near {
      will-change: transform;
      animation: linear both;
      animation-timeline: --night;
      animation-range: entry 0% entry 100%;
    }

    .ridge.lift .far {
      animation-name: rise-far-ridge;
    }

    .ridge.lift .near {
      animation-name: rise-near-ridge;
    }
  }
}

/* In units of the drawing, 80 and 130 of its 160, as the slice scales it. */
@keyframes rise-far-ridge {
  from {
    transform: translateY(calc(max(100cqw / 1440, 100cqh / 160) * 80));
  }
}

@keyframes rise-near-ridge {
  from {
    transform: translateY(calc(max(100cqw / 1440, 100cqh / 160) * 130));
  }
}

.night a {
  color: var(--mint);
}

.early-access {
  max-width: 1040px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) 16px clamp(48px, 7vw, 88px);
  text-align: center;
}

.early-access p {
  font-size: 19px;
  margin-bottom: 26px;
}

footer {
  max-width: 1040px;
  margin: 0 auto;
  padding: 22px 16px 36px;
  border-top: 1px solid rgb(158 210 198 / 0.2);
  color: #9fb0c5;
  font-size: 15px;
  text-align: center;
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 22px;
  margin-bottom: 8px;
}

footer p {
  margin: 0;
}
