@import "/styles/base.css";

@keyframes expand-answer {
  from {
    line-height: 0;
    padding-top: 0;
    opacity: 0;
  }

  to {
    line-height: var(--line-height-0);
    padding-top: var(--size-0);
    opacity: 100%;
  }
}

@keyframes collapse-answer {
  from {
    line-height: var(--line-height-0);
    padding-top: var(--size-0);
    opacity: 100%;
  }

  to {
    line-height: 0;
    padding-top: 0;
    opacity: 0;
  }
}

html {
  width: 100vw;
  height: 100vh;
  z-index: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: "Pelago", "Helvetica", "Arial", sans-serif;
  font-size: 10px;
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-0);
  text-wrap: pretty;
  text-rendering: geometricPrecision;
  white-space: wrap;
  vertical-align: middle;

  @media (min-width: 450px) {
    font-size: 12px;
  }

  @media (min-width: 768px) {
    font-size: 14px;
  }

  @media (min-width: 900px) {
    font-size: 16px;
  }
}

a {
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  color: inherit;
  line-height: inherit;
}

a.icon {
  height: auto;
  width: auto;
  max-height: fit-content;
  max-width: fit-content;
}

a.cta {
  min-width: calc(2 * var(--min-height-touch-target));
  min-height: var(--min-height-touch-target);
  padding: 0 var(--size-2);
  display: flex;
  justify-content: center;
  align-items: center;
  border: none;
  border-radius: var(--border-radius-button);
  background-color: var(--brand-base);
  color: var(--fg-primary);
  font-size: var(--size-3);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-0);
  text-align: center;
  text-wrap: nowrap;
  white-space: nowrap;
  @media (min-width: 768px) {
    font-size: var(--size-2);
  }

  @media (prefers-color-scheme: light) {
    box-shadow:
      0.6rem 0.6rem 1rem rgba(0, 0, 0, 0.1),
      -0.6rem -0.6rem 1rem var(--bg-elevated);
  }
}

@media (any-hover: hover) {
  a.cta:hover {
    background-color: var(--brand-strong);
    color: var(--bg-elevated);
  }
}

body {
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: var(--bg-base);
  color: var(--fg-primary);
}

nav,
.coming-soon,
header,
main,
footer {
  width: 100%;
  padding: 0
    max(var(--side-padding), calc((100vw - var(--max-width)) / 2 + var(--side-padding)));
}

nav {
  height: var(--nav-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: var(--font-weight-medium);
  background-color: var(--bg-elevated);
  position: fixed;
  top: 0;
  z-index: 5;
  @media (prefers-color-scheme: light) {
    box-shadow: 0 0 3rem rgba(0, 0, 0, 0.1);
  }

  @media (prefers-color-scheme: dark) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  a:has(img) {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--size-4);
    font-size: var(--size-5);
    font-weight: var(--font-weight-semibold);
    text-wrap: nowrap;
    white-space: nowrap;

    @media (min-width: 768px) {
      font-size: var(--size-4);
    }
  }

  img {
    width: var(--size-5);
    height: var(--size-5);

    @media (min-width: 768px) {
      width: var(--size-4);
      height: var(--size-4);
    }
  }

  ol {
    display: none;
  }
}

@media (min-width: 900px) {
  nav {
    ol {
      display: flex;
      justify-content: space-evenly;
      align-items: center;
      gap: var(--size-3);
      color: var(--fg-secondary);
      font-size: var(--size-2);
      text-wrap: nowrap;
      white-space: nowrap;

      @media (any-hover: hover) {
        a:hover {
          color: var(--brand-accent);
        }
      }
    }
  }
}

.auth-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--size-3);
  color: var(--fg-primary);
  font-size: var(--size-2);

  @media (any-hover: hover) {
    a:not(.cta):hover {
      color: var(--brand-accent);
    }
  }
}

.coming-soon {
  margin-top: var(--nav-height);
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: var(--font-weight-semibold);
  background-color: var(--brand-strong);
  color: var(--bg-elevated);
  line-height: var(--line-height-2);
}

header,
section {
  padding-top: var(--nav-height);

  @media (min-width: 900px) {
    padding-top: calc(var(--nav-height) * var(--golden-number));
  }
}

header {
  display: flex;
  flex-direction: column;
  align-items: center;

  .headlines {
    padding: var(--nav-height) 0;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .headlines h1 {
    text-align: center;
    font-size: var(--size-6);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-2);
  }

  .headlines h1 + p {
    text-align: center;
    font-size: var(--size-4);
    line-height: var(--line-height-2);
  }

  .headlines .cta {
    margin-top: var(--size-4);
    font-size: var(--size-3);
    @media (prefers-color-scheme: light) {
      box-shadow:
        0.6rem 0.6rem 1rem rgba(0, 0, 0, 0.1),
        -0.6rem -0.6rem 1rem var(--bg-base);
    }
  }

  img {
    z-index: 1;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius-card);
    mask: linear-gradient(var(--bg-base) 76%, transparent 100%);
    overflow: hidden;
    @media (prefers-color-scheme: light) {
      box-shadow:
        1rem 1rem 3rem rgba(0, 0, 0, 0.1),
        -1rem -1rem 3rem var(--bg-base);
    }
  }
}

main {
  display: flex;
  flex-direction: column;

  section {
    display: flex;
    flex-direction: column;
    align-items: center;

    h2 {
      font-size: var(--size-5);
      font-weight: var(--font-weight-medium);
      line-height: var(--line-height-2);
      text-align: center;
    }

    h2 + p {
      text-align: center;
      font-size: var(--size-4);
      line-height: var(--line-height-0);
      color: var(--fg-secondary);
      margin-bottom: calc(var(--nav-height) / var(--golden-number));
    }

    .card-row,
    .card-column {
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: var(--size-4);
    }

    .card-grid {
      display: grid;
      grid-template-columns: 1fr;
      grid-template-rows: auto;
      gap: var(--size-4);
    }

    @media (min-width: 768px) {
      .card-row {
        flex-direction: row;
      }

      .card-grid {
        grid-template-columns: 1fr 1fr;
      }
    }

    .card {
      flex: 1;
      display: flex;
      flex-direction: column;
      background-color: var(--bg-elevated);
      border-radius: var(--border-radius-card);
      z-index: 1;
      @media (max-width: 768px) {
        min-width: calc(pow(var(--golden-number), 7) * 1rem);
      }

      @media (prefers-color-scheme: light) {
        box-shadow:
          1rem 1rem 3rem rgba(0, 0, 0, 0.1),
          -1rem -1rem 3rem var(--bg-base);
      }

      @media (prefers-color-scheme: dark) {
        border: 1px solid rgba(255, 255, 255, 0.1);
      }

      h3 {
        font-size: var(--size-4);
        font-weight: var(--font-weight-medium);
        color: var(--fg-primary);
        line-height: var(--line-height-2);
      }

      p {
        font-size: var(--size-2);
        line-height: var(--line-height-1);
        color: var(--fg-secondary);
      }
    }

    .image.card {
      img {
        width: 100%;
        height: auto;
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: var(--border-radius-card) var(--border-radius-card) 0 0;
        object-fit: cover;
        object-position: center;
        overflow: hidden;
      }

      div {
        padding: var(--size-4);
      }
    }

    .text.card {
      padding: var(--size-4);
    }

    .price.card {
      padding: var(--size-4);
      justify-content: space-between;
      gap: var(--size-4);

      span {
        display: flex;
        align-items: center;
        gap: var(--size-1);
      }

      em {
        font-size: var(--size-5);
      }

      .cta {
        margin-top: var(--size-2);
      }
    }

    .suggested.price.card {
      background-color: var(--brand-subtle);

      @media (prefers-color-scheme: light) {
        .cta {
          box-shadow:
            0.6rem 0.6rem 1rem rgba(0, 0, 0, 0.12),
            -0.6rem -0.6rem 1rem var(--brand-subtle);
        }
      }

      @media (prefers-color-scheme: dark) {
        h3,
        em {
          color: var(--brand-strong);
        }

        p {
          color: var(--bg-elevated);
        }
      }
    }

    .question.card {
      padding: var(--size-4);
      display: grid;
      align-items: center;
      grid-template-areas:
        "toggle question"
        ". answer";
      grid-template-columns: auto 1fr;
      max-width: calc(var(--max-width) / var(--golden-number));
      column-gap: var(--size-4);
      user-select: none;
      -webkit-user-select: none;
      cursor: pointer;

      h3 {
        grid-area: question;
        margin-bottom: 0;
        font-size: var(--size-2);
      }

      p {
        grid-area: answer;
        font-size: var(--size-2);
        overflow: hidden;
      }
    }

    .question.card::before {
      grid-area: toggle;
      content: "+";
      font-size: var(--size-5);
      color: var(--brand-base);
      line-height: 1;
      font-family: monospace;
    }

    .question.card:not([data-expanded]) {
      p {
        line-height: 0;
        padding-top: 0;
        opacity: 0;
        animation: collapse-answer 0.2s cubic-bezier(0, 0, 0, 1);
      }
    }

    .question.card[data-expanded] {
      p {
        line-height: var(--line-height-0);
        padding-top: var(--size-0);
        opacity: 100%;
        animation: expand-answer 0.2s cubic-bezier(0, 0, 0, 1);
      }
    }

    .question.card[data-expanded]::before {
      content: "-";
      color: var(--brand-strong);
    }
  }
}

footer {
  margin-top: calc(2 * var(--nav-height));
  padding-bottom: var(--size-4);
  min-height: calc(100vh * pow(1 / var(--golden-number), 2));
  display: grid;
  align-items: center;
  grid-template-areas:
    "company company social"
    "line line line"
    "legal legal legal"
    "copyright copyright copyright";
  grid-template-columns: 1fr 1fr var(--min-height-touch-target);
  grid-template-rows: 1fr 1px auto auto;
  gap: var(--size-4);
  background-color: var(--bg-elevated);
  z-index: 5;
  @media (prefers-color-scheme: light) {
    box-shadow: 0 0 3rem rgba(0, 0, 0, 0.1);
  }

  @media (prefers-color-scheme: dark) {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  @media (min-width: 768px) {
    grid-template-areas:
      "company social"
      "line line"
      "copyright legal";
  }

  .company {
    grid-area: company;

    h2 {
      font-size: var(--size-4);
      font-weight: var(--font-weight-medium);
      line-height: var(--line-height-2);
      color: var(--fg-primary);
    }

    p {
      font-size: var(--size-3);
      line-height: var(--line-height-0);
      color: var(--fg-secondary);
    }
  }

  .social {
    grid-area: social;
    display: flex;
    justify-content: center;

    @media (min-width: 768px) {
      justify-content: flex-end;
    }

    img {
      width: var(--size-4);
      height: var(--size-4);
      opacity: 91%;

      @media (prefers-color-scheme: dark) {
        filter: invert(1);
      }
    }
  }

  hr {
    grid-area: line;
    height: 1px;
    background-color: var(--fg-secondary);
    opacity: 91%;
  }

  .copyright {
    grid-area: copyright;
    display: flex;
    justify-content: center;
    font-size: var(--size-1);
    line-height: 1;
    color: var(--fg-secondary);
    @media (min-width: 768px) {
      justify-content: flex-start;
    }
  }

  .legal {
    grid-area: legal;
    display: flex;
    justify-content: center;
    gap: var(--size-2);
    color: var(--fg-secondary);
    @media (min-width: 768px) {
      justify-content: flex-end;
    }

    @media (any-hover: hover) {
      a:hover {
        color: var(--brand-accent);
      }
    }
  }
}
