/* The landing page. The other pages only use style.css. */

body.home {
  --content: 70rem;
  --ink: light-dark(#201f1e, #f0eee9);
  --ink-soft: light-dark(#4b4845, #b6b2ab);
  /* The faceplate the Sound Lab's keys are set into, and the keys. */
  --plate: light-dark(#f0eee9, #2b2a28);
  --plate-edge: light-dark(rgb(255 255 255 / 0.75), rgb(255 255 255 / 0.06));
  --plate-shadow:
    inset 0 1px 0 var(--plate-edge), 0 1px 2px rgb(0 0 0 / 0.08),
    0 0.75rem 2rem -1rem rgb(0 0 0 / 0.35);
  --hairline: light-dark(rgb(32 31 30 / 0.1), rgb(240 238 233 / 0.08));
  --cap: light-dark(#2b2a28, #42413f);
  --cap-ink: #f1f0ed;
  /* The Sound Lab's lamps. */
  --led-amber: #faa329;
  --led-red: #ff4238;
  --led-blue: #47adff;
  --led-violet: #ad66ff;

  /* A fixed column, or the hero's phones would widen the page to fit. */
  grid-template-columns: minmax(0, 1fr);
  gap: 0;

  > * {
    max-width: var(--content);
  }

  /* The header keeps the other pages' width, so the icon and nav stay
     where they are there. */
  > header {
    max-width: 768px;
  }

  main {
    align-self: stretch;
    width: 100%;

    ul {
      list-style: none;
      margin: 0;

      li {
        margin: 0;
      }
    }
  }

  footer {
    padding-block: 3rem 1rem;
  }
}

/* ── Hero ─────────────────────────────────────────────────────────────── */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;

  h1 {
    display: block;
    margin-block-start: 2.5rem;
    font-size: clamp(3.5rem, 1.25rem + 9vw, 7.25rem);
    line-height: 0.9;
    letter-spacing: -0.055em;
  }

  .tagline {
    margin-block: 0.75rem 0;
    font-size: clamp(1.35rem, 0.6rem + 2.6vw, 3rem);
    font-weight: var(--weight-bold);
    letter-spacing: -0.045em;
    line-height: 1.15;
    text-wrap: balance;
  }

  .lead {
    max-width: 30rem;
    margin-block: 1rem 0;
    font-size: clamp(1.05rem, 0.98rem + 0.25vw, 1.2rem);
    line-height: 1.5;
    color: var(--ink-soft);
    text-wrap: balance;
  }
}

.get {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  margin-block: 2.25rem 0;

  .store img {
    display: block;
    width: auto;
    height: 3.25rem;
  }
}

/* Three routines side by side, the middle one being marked. On a phone the
   other two peek in from the edges. */
.stage {
  --lead: clamp(15.5rem, 8rem + 17vw, 21rem);
  --side: calc(var(--lead) * 0.84);

  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(1.25rem, 4vw, 3.5rem);
  width: 100%;
  margin-block-start: clamp(2.5rem, 6vw, 4rem);

  > .phone {
    flex: none;
    width: var(--side);
    margin-block-start: calc(var(--lead) * 0.3);
  }

  > .lead {
    flex: none;
    width: var(--lead);
  }

  /* Out to the screen's edges, past the body's padding. */
  @media (max-width: 47.99rem) {
    --lead: min(66vw, 19rem);
    gap: 0.75rem;
    width: calc(100% + 2rem);
    overflow-x: clip;
  }
}

/* ── A phone ──────────────────────────────────────────────────────────── */

/* The screen sits in the bezel's hole with its corners rounded just inside
   the frame's outer edge, so the frame covers the hole's curve exactly. */
.phone {
  position: relative;
  isolation: isolate;
  aspect-ratio: 1380 / 2880;
  width: 100%;

  > .screen {
    position: absolute;
    left: 4.348%;
    top: 2.5%;
    width: 91.304%;
    height: 95%;
    border-radius: 12.7% / 5.85%;
    object-fit: cover;
    background-color: #000;
  }

  &::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url(/images/bezel-air-light.webp) center / 100% 100% no-repeat;
    pointer-events: none;
  }

  &::before {
    content: '';
    position: absolute;
    inset: 1.5% 3% 0.5%;
    z-index: -1;
    border-radius: 15% / 7%;
    box-shadow:
      0 0.35rem 0.8rem rgb(0 0 0 / 0.16),
      0 1.75rem 3.5rem -0.75rem rgb(0 0 0 / 0.38);
  }

  @media (prefers-color-scheme: dark) {
    &::after {
      background-image: url(/images/bezel-air-dark.webp);
    }
  }

  /* iPhone Duo, closed: the outer screen is square on the hinge side. */
  &.duo {
    aspect-ratio: 1574 / 2194;

    > .screen {
      left: 5.591%;
      top: 3.646%;
      width: 88.818%;
      height: 92.707%;
      border-radius: 0 11.09% 11.09% 0 / 0 7.62% 7.62% 0;
    }

    &::after {
      background-image: url(/images/bezel-duo.webp);
    }

    &::before {
      inset: 2.5% 3% 1%;
      border-radius: 4% 15% 15% 4% / 3% 10% 10% 3%;
    }
  }
}

.device {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

button.sound {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.85rem 0.3rem 0.35rem;
  border: none;
  border-radius: 2rem;
  font: inherit;
  font-weight: var(--weight-medium);
  letter-spacing: -0.03em;
  color: var(--ink);
  background: none;
  cursor: pointer;

  &:hover {
    background-color: var(--hairline);
  }

  svg {
    width: 1.6rem;
    height: 1.6rem;
    fill: currentColor;
  }

  &[aria-pressed='false'] .on,
  &[aria-pressed='true'] .off {
    display: none;
  }
}

/* ── Features ─────────────────────────────────────────────────────────── */

.feature {
  --phone: clamp(15rem, 9rem + 11vw, 19.5rem);

  display: grid;
  grid-template-columns: minmax(0, 33rem) var(--phone);
  justify-content: center;
  align-items: center;
  column-gap: clamp(3rem, 9vw, 8rem);
  padding-block: clamp(4.5rem, 11vw, 9rem) 0;

  &:nth-of-type(odd) {
    grid-template-columns: var(--phone) minmax(0, 33rem);

    > .copy {
      order: 2;
    }
  }

  > .device {
    width: var(--phone);
  }

  @media (max-width: 51.99rem) {
    &,
    &:nth-of-type(odd) {
      --phone: min(68vw, 18rem);

      grid-template-columns: minmax(0, 1fr);
      justify-items: center;
      row-gap: 3rem;

      > .copy {
        order: 0;
        justify-self: stretch;
      }
    }
  }
}

.copy {
  h2 {
    margin-block: 1.1rem 1.25rem;
    font-size: clamp(2.25rem, 1.4rem + 3vw, 3.6rem);
    font-weight: var(--weight-heavy);
    line-height: 1;
    letter-spacing: -0.055em;
    text-wrap: balance;
  }

  p {
    margin-block-end: 0.9em;
    max-width: 34rem;
    font-size: clamp(1.05rem, 0.98rem + 0.25vw, 1.2rem);
    line-height: 1.5;
    color: var(--ink-soft);
    text-wrap: pretty;
  }
}

/* A key off the Sound Lab, its lamp lit. */
.copy .key {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  margin: 0;
  padding: 0.6em 1em 0.55em 0.85em;
  border-radius: 0.6rem;
  font-size: 0.72rem;
  font-weight: var(--weight-medium);
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--cap-ink);
  background: linear-gradient(
    color-mix(in srgb, var(--cap), white 7%),
    var(--cap)
  );
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.12),
    inset 0 -1px 0 rgb(0 0 0 / 0.35),
    0 1px 0 light-dark(rgb(255 255 255 / 0.2), rgb(255 255 255 / 0.04)),
    0 2px 6px rgb(0 0 0 / 0.2);

  &::before {
    content: '';
    flex: none;
    width: 0.6em;
    height: 0.6em;
    border-radius: 50%;
    background-color: var(--led);
    box-shadow:
      0 0 0.15em var(--led),
      0 0 0.7em var(--led);
  }
}

.rules {
  margin-block: 1.75rem 1.75rem !important;
  padding-inline: 1.25rem;
  border-radius: 1.4rem;
  background-color: var(--plate);
  box-shadow: var(--plate-shadow);

  li {
    display: grid;
    grid-template-columns: 2.6rem minmax(0, 1fr);
    align-items: center;
    padding-block: 0.8rem;
    line-height: 1.3;

    & + li {
      border-top: 1px solid var(--hairline);
    }
  }

  .mark {
    grid-row: span 2;
    font-size: 1.65rem;
    line-height: 1;
  }

  strong {
    font-weight: var(--weight-bold);
    letter-spacing: -0.04em;
  }

  span:last-child {
    font-size: 0.95rem;
    color: var(--ink-soft);
  }
}

.styles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-block: 1.5rem 1.75rem !important;

  li {
    padding: 0.4rem 0.85rem 0.45rem;
    border-radius: 2rem;
    font-weight: var(--weight-medium);
    letter-spacing: -0.03em;
    background-color: var(--plate);
    box-shadow:
      inset 0 1px 0 var(--plate-edge),
      0 1px 2px rgb(0 0 0 / 0.12);
  }
}

/* ── Share ────────────────────────────────────────────────────────────── */

/* Centered rather than beside a phone, so it reads as more than one feature
   among the rest: one phone hands the file to the next. */
.share {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-block: clamp(5.5rem, 13vw, 10rem) 0;
  text-align: center;

  > .copy {
    max-width: 38rem;

    p {
      margin-inline: auto;
    }
  }

  /* With the features in one column, the words line up with theirs. */
  @media (max-width: 51.99rem) {
    text-align: start;

    > .copy {
      align-self: stretch;
      max-width: none;

      p {
        margin-inline: 0;
      }
    }
  }
}

.handover {
  --air: clamp(7rem, 2rem + 18vw, 15rem);

  display: grid;
  grid-template-columns: var(--air) auto calc(var(--air) * 1574 / 1380);
  align-items: end;
  column-gap: clamp(0.75rem, 3vw, 2.75rem);
  margin-block-start: clamp(2.5rem, 6vw, 4rem);
}

.file {
  --doc: clamp(3.25rem, 2rem + 3.5vw, 5rem);

  position: relative;
  align-self: center;
  translate: 0 25%;
  text-align: center;
  filter: drop-shadow(0 0.4rem 0.6rem rgb(0 0 0 / 0.2));

  /* The way it travels, from one phone to the other. */
  &::before {
    content: '';
    position: absolute;
    inset-inline: calc(-1 * clamp(0.75rem, 3vw, 2.75rem));
    top: calc(var(--doc) / 0.78 / 2);
    z-index: -1;
    border-top: 2px dashed
      light-dark(rgb(32 31 30 / 0.3), rgb(240 238 233 / 0.25));
  }

  figcaption {
    max-width: 7rem;
    margin-block-start: 0.6rem;
    font-size: clamp(0.75rem, 0.7rem + 0.2vw, 0.9rem);
    font-weight: var(--weight-medium);
    line-height: 1.25;
    color: var(--ink-soft);
  }
}

/* A document with its corner turned down, the app's icon on it. */
.doc {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--doc);
  aspect-ratio: 0.78;
  margin-inline: auto;
  border-radius: 0.5rem;
  background-color: #fbfaf8;
  clip-path: polygon(0 0, 68% 0, 100% 25%, 100% 100%, 0 100%);

  &::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 32%;
    aspect-ratio: 1;
    border-bottom-left-radius: 0.2rem;
    background: linear-gradient(to bottom left, transparent 50%, #dcd9d3 50%);
  }

  img {
    width: 62%;
    height: auto;
    border-radius: 22%;
  }
}

/* ── And there's more ─────────────────────────────────────────────────── */

.more {
  padding-block: clamp(5rem, 12vw, 9rem) 0;

  h2 {
    margin-block-end: clamp(2rem, 5vw, 3rem);
    font-size: clamp(2.25rem, 1.4rem + 3vw, 3.6rem);
    font-weight: var(--weight-heavy);
    line-height: 1;
    letter-spacing: -0.055em;
    text-align: center;

    @media (max-width: 51.99rem) {
      text-align: start;
    }
  }

  /* Four in a row, or two, with a shorter last row centered under them. */
  ul {
    --across: 4;

    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;

    @media (max-width: 63.99rem) {
      --across: 2;
    }
    @media (max-width: 35.99rem) {
      --across: 1;
    }
  }

  li {
    flex: none;
    width: calc((100% - (var(--across) - 1) * 1rem) / var(--across));
    padding: 1.5rem 1.5rem 1.6rem;
    border-radius: 1.5rem;
    background-color: var(--plate);
    box-shadow: var(--plate-shadow);

    /* A squircle needs the larger radius to look as round. Only where it's
       drawn, or 3rem would come out as a far rounder plain corner. */
    @supports (corner-shape: squircle) {
      corner-shape: squircle;
      border-radius: 3rem;
    }

    /* One column: the emoji beside the words, so the cards stay short. */
    @media (max-width: 35.99rem) {
      display: grid;
      grid-template-columns: 2.75rem minmax(0, 1fr);
      column-gap: 0.5rem;
      padding: 1.1rem 1.25rem 1.2rem 1rem;

      .mark {
        grid-row: span 2;
        margin: 0;
        text-align: center;
      }
    }
  }

  .mark {
    display: block;
    margin-block-end: 1rem;
    font-size: 2.1rem;
    line-height: 1;
  }

  h3 {
    margin-block: 0 0.35rem;
    font-size: 1.3rem;
    letter-spacing: -0.045em;
    line-height: 1.2;
  }

  p {
    margin: 0;
    line-height: 1.45;
    color: var(--ink-soft);
    text-wrap: pretty;
  }
}

/* ── Closing ──────────────────────────────────────────────────────────── */

.closing {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-block: clamp(4rem, 9vw, 6.5rem) 2rem;

  .get {
    margin: 0;
  }
}
