/* Profiler content and responsive layout, on top of the MenuBar styles. */
@layer product {
  body {
    overflow-x: clip;
    overflow-y: auto;
  }

  /* Ambient colors adapted from the QuickEmoji landing page. */
  .bg {
    inset: -25%;
    isolation: isolate;
    filter: blur(64px) saturate(1.08);
    background: none;
  }

  .bg__hub {
    display: block;
    width: 100%;
    height: 100%;
    animation: none;
  }

  .orb {
    inline-size: 42vmax;
    border-radius: 46% 54% 52% 48% / 50% 46% 54% 50%;
    opacity: 0.42;
    mix-blend-mode: multiply;
  }

  .orb:nth-child(1) {
    top: -14%;
    left: -6%;
    background: radial-gradient(closest-side, oklch(0.82 0.14 20 / 0.9), transparent);
  }

  .orb:nth-child(2) {
    top: -18%;
    right: -8%;
    background: radial-gradient(closest-side, oklch(0.83 0.13 60 / 0.9), transparent);
  }

  .orb:nth-child(3) {
    bottom: -20%;
    left: 12%;
    background: radial-gradient(closest-side, oklch(0.78 0.16 330 / 0.9), transparent);
  }

  .orb:nth-child(4) {
    bottom: -14%;
    right: 2%;
    background: radial-gradient(closest-side, oklch(0.76 0.16 288 / 0.9), transparent);
  }

  .orb:nth-child(5) {
    top: 24%;
    left: 34%;
    background: radial-gradient(closest-side, oklch(0.8 0.14 222 / 0.85), transparent);
  }

  .orb:nth-child(6) {
    top: 44%;
    right: 24%;
    background: radial-gradient(closest-side, oklch(0.82 0.13 352 / 0.85), transparent);
  }

  a:focus-visible {
    outline: 2px solid var(--text-soft);
    outline-offset: 4px;
  }

  .page {
    overflow-x: clip;
    padding-block: 5rem;
    padding-inline: clamp(1.5rem, 4vw, 4rem);
  }

  .hero {
    --hero-gap: clamp(3rem, 5vw, 6rem);
    grid-template-columns: minmax(22rem, 0.95fr) minmax(0, 1.45fr);
    gap: var(--hero-gap);
    max-width: 90rem;
  }

  .content {
    justify-self: start;
    width: 100%;
    max-width: 28rem;
    text-align: start;
  }

  .page--error .content {
    justify-self: center;
  }

  /* The privacy policy, rendered from PRIVACY.md. */
  .prose {
    max-width: 36rem;
    gap: 1rem;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-soft);

    h1 {
      margin-block-end: 0.5rem;
      font-size: 2rem;
      font-weight: 800;
      letter-spacing: -0.03em;
      color: var(--text);
    }

    strong {
      color: var(--text);
    }

    ul {
      display: grid;
      gap: 0.5rem;
      padding-inline-start: 1.25rem;
      list-style: disc;
    }

    a {
      color: var(--text);
      text-decoration: underline;
    }
  }

  .title {
    display: grid;
    grid-template-columns: max-content;
    gap: 0.5rem;
    font-size: clamp(3.5rem, 6vw, 6.5rem);
    font-weight: 500;
    margin-inline: 0;
    margin-block-end: clamp(2.5rem, 4vw, 4rem);
  }

  .title > span:nth-child(1) {
    grid-column: 1 / -1;
    font-weight: 900;
  }

  .title > span:nth-child(2) {
    grid-column: 1 / -1;
    font-family: var(--font);
    font-size: 1em;
    font-weight: 800;
    letter-spacing: inherit;
    color: #25272c;
  }

  .title__descriptor {
    grid-column: 1 / -1;
    font-family: var(--font);
    font-size: 0.4em;
    font-weight: 500;
    color: var(--text);
    letter-spacing: -0.03em;
    justify-self: start;
  }

  .actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, max-content);
    justify-content: start;
    gap: 0.625rem;
    margin-inline: 0;
    margin-block-end: 0;
  }

  .browser-logos {
    display: none;
  }

  .btn {
    min-width: 0;
    min-height: 3.25rem;
    justify-content: flex-start;
    gap: 0.875rem;
    padding-inline: 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
  }

  .btn-ring {
    display: flex;
    min-width: 0;

    .btn {
      width: 100%;
      border: 1px solid rgb(255 255 255 / 68%);
      backdrop-filter: blur(14px) saturate(1.8);
      box-shadow:
        0 1px 3px rgb(0 0 0 / 7%),
        inset 0 1px 0 rgb(255 255 255 / 72%);
    }
  }

  .btn.btn--secondary {
    background: rgb(255 255 255 / 52%);
    color: var(--text);

    &::before {
      display: none;
    }

    &:is(:hover, :focus-visible) {
      background: var(--text);
      border-color: var(--text);
      color: #fff;
      box-shadow:
        0 1px 2px rgb(0 0 0 / 12%),
        0 4px 12px rgb(0 0 0 / 10%);
    }
  }

  .browser-icon {
    width: 34px;
    height: 34px;
    flex: none;
  }

  .btn__label {
    display: grid;
    gap: 0.125rem;
    text-align: start;
    line-height: 1.25;
  }

  .btn__label small {
    font-size: 0.6875rem;
    font-weight: 400;
    color: var(--text-soft);
    white-space: nowrap;
    transition: color 150ms ease-out;
  }

  .btn:is(:hover, :focus-visible) .btn__label small {
    color: rgb(255 255 255 / 62%);
  }

  .lede {
    width: 100%;
    max-width: none;
    margin-block-end: 2rem;
    font-size: clamp(0.9375rem, 1.2vw, 1.0625rem);
    line-height: 1.6;
    color: var(--text-soft);
    text-wrap: balance;
  }

  .lede a {
    font-weight: 500;
  }

  .highlight {
    background: var(--text);
    color: #fff;
    border-block-end: 0;
    padding: 0.1em 0.3em;
    box-decoration-break: clone;
  }

  .lede .highlight:hover {
    color: #fff;
    background: #34363b;
  }

  .project-link {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: start;
    width: 100%;
    gap: 1.5rem;
    margin-block: 1.75rem;
    font-size: 0.8125rem;
    font-stretch: semi-condensed;
    color: var(--text-soft);
  }

  .disclaimer {
    width: 100%;
    max-width: none;
    margin-block-start: 0;
    text-wrap: balance;
  }

  .visual {
    min-width: 0;
    margin: 0;
    filter: drop-shadow(0 20px 30px rgb(0 0 0 / 32%)) drop-shadow(0 4px 6px rgb(0 0 0 / 20%));
  }

  .visual img {
    width: calc(100% + 16rem);
    max-width: none;
    height: auto;
    clip-path: inset(0 round 1.5% / 2%);
  }

  .visual__cropped {
    display: none;
  }

  /* The demo video replaces the static capture, except in showcase mode and with reduced motion. */
  .visual__video {
    display: block;
    width: calc(100% + 16rem);
    max-width: none;
    height: auto;
    clip-path: inset(0 round 1.5% / 2%);

    body.showcase & {
      display: none;
    }

    @media (prefers-reduced-motion: reduce) {
      display: none;
    }

    @media (max-width: 48rem) {
      width: 100%;
    }
  }

  @media (prefers-reduced-motion: no-preference) {
    body:not(.showcase) .visual {
      & > img {
        display: none;
      }

      @media (max-width: 48rem) {
        aspect-ratio: auto;
      }
    }
  }

  @media (max-width: 65rem) {
    .hero {
      --hero-gap: 2rem;
      grid-template-columns: minmax(22rem, 1fr) minmax(0, 1fr);
    }

    .btn {
      gap: 0.625rem;
      font-size: 0.875rem;
    }
  }

  @media (max-width: 48rem) {
    .topnav {
      display: none;
    }

    .page {
      padding-block: 0 2.5rem;
      padding-inline: 1.5rem;
    }

    .hero {
      grid-template-columns: minmax(0, 1fr);
      gap: 0;
    }

    .content {
      display: contents;
    }

    .title {
      grid-row: 2;
      justify-self: start;
      grid-template-columns: max-content max-content;
      font-size: clamp(1.625rem, 5.2vw, 2.5rem);
      column-gap: 0.2em;
      row-gap: 0.45em;
      margin-block-end: 2.5rem;
    }

    .title > span:nth-child(1),
    .title > span:nth-child(2) {
      grid-column: auto;
      grid-row: 1;
    }

    .title__descriptor {
      grid-row: 2;
      font-size: 0.65em;
    }

    .lede {
      grid-row: 3;
      margin-block-end: 2.5rem;
    }

    .actions {
      grid-row: 4;
      grid-template-columns: repeat(2, max-content);
      justify-self: start;
      width: 100%;
      gap: 0.75rem;
      margin-block-end: 0;
    }

    .btn {
      min-height: 3rem;
      justify-content: flex-start;
      padding-inline: 1rem;
    }

    .disclaimer {
      grid-row: 6;
      margin: 0;
    }

    .project-link {
      grid-row: 5;
      justify-self: start;
      justify-content: start;
      margin-block: 2.5rem;
    }

    .visual {
      position: relative;
      grid-row: 1;
      order: 0;
      width: 100%;
      aspect-ratio: 2880 / 1680;
      margin-block-end: 2rem;
      filter: drop-shadow(0 12px 15px rgb(0 0 0 / 20%));
    }

    .visual img {
      position: absolute;
      inset-inline-start: 0;
      bottom: 0;
      width: 100%;
    }

    .footer {
      position: relative;
      flex-wrap: wrap;
      pointer-events: auto;
    }
  }

  @media (max-width: 22rem) {
    .actions {
      grid-template-columns: max-content;
    }
  }

  body.showcase {
    --hero-inset: max(clamp(1.5rem, 4vw, 4rem), calc((100vw - 90rem) / 2));

    .content {
      width: calc(100% + var(--hero-gap) + var(--hero-inset));
      max-width: none;
      margin-inline-start: calc(-1 * var(--hero-inset));
    }

    .page {
      height: 100dvh;
      min-height: 0;
      padding-block: 2rem;
    }

    .hero {
      height: 100%;
      min-height: 0;
      grid-template-rows: minmax(0, 1fr);
    }

    .topnav,
    .footer,
    .lede,
    .actions,
    .project-link,
    .disclaimer {
      display: none;
    }

    .title {
      width: max-content;
      max-width: none;
      font-size: clamp(3.5rem, 7.5vw, 8.5rem);
      margin-inline: auto;
      margin-block-end: 0;
    }

    .title__descriptor {
      grid-row: 3;
    }

    .browser-logos {
      display: flex;
      grid-row: 4;
      grid-column: 1 / -1;
      justify-content: space-around;
      margin-block-start: 0.3em;
    }

    .browser-logos img {
      width: clamp(2.5rem, 3.5vw, 4rem);
      height: auto;
    }

    .content,
    .visual {
      align-self: center;
    }

    @media (min-width: 48.001rem) and (min-aspect-ratio: 4 / 3) {
      .title {
        position: relative;
        translate: 0 -3dvh;
      }

      .browser-logos {
        position: absolute;
        grid-area: auto;
        top: calc(50% + 31dvh);
        inset-inline-start: 0;
        width: 100%;
        margin-block-start: 0;
        translate: 0 -50%;
      }

      .browser-logos img {
        width: clamp(5rem, 7vw, 8rem);
      }

      .visual {
        --capture-height: calc((100dvh - 4rem) * 1.5);
        align-self: start;
      }

      .visual > img {
        display: none;
      }

      .visual__cropped {
        display: block;
        width: calc(var(--capture-height) * 2880 / 2100);
        overflow: hidden;
        border-radius: 18px;
      }

      .visual__page,
      .visual__profiler {
        background: url("assets/browser-profiler.png") left top / 100% auto no-repeat;
      }

      .visual__page {
        height: calc(var(--capture-height) * 0.3);
      }

      .visual__profiler {
        height: calc(var(--capture-height) * 0.552);
        background-position: left bottom;
      }
    }

    @media (max-width: 48rem) {
      .content {
        width: 100%;
        margin-inline-start: 0;
      }

      .page {
        padding-block: 0 2rem;
      }

      .page,
      .hero {
        height: auto;
      }

      .hero {
        grid-template-rows: auto;
      }

      .title {
        font-size: clamp(1.625rem, 5.2vw, 2.5rem);
      }

      .title__descriptor {
        grid-row: 2;
      }

      .browser-logos {
        grid-row: 3;
      }
    }
  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation: none;
      transition: none;
    }
  }
}
