:root {
  --primary-color: #48AE4E;
  --dark-color: #417039;
  --light-color: #B5D9B9;

  --grad-dark: color-mix(in srgb, var(--dark-color) 40%, var(--primary-color) 60%);
  --grad-light: color-mix(in srgb, var(--light-color) 40%, var(--primary-color) 60%);

  --text-color: #1d1d1b;
  --bg-light: #fbfbfb;

  --max-width: 1600px;

  --default-grad: linear-gradient(var(--bg-rotation, 0deg), var(--grad-dark), var(--grad-light));
}

@font-face {
  font-family: 'Metropolis';
  src: url('/fonts/Metropolis-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Metropolis';
  src: url('/fonts/Metropolis-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Metropolis-Fallback";
  src: local("Arial");
  size-adjust: 97%;
  ascent-override: 95%;
}

html {
  font-family: "Metropolis", "Metropolis-Fallback", sans-serif;
  font-weight: 400;
  line-height: 1.4;
  font-size: 16px;
}

body {
  margin: 0;
  color: var(--text-color);

  background: var(--bg-light) url('/images/background.svg');
  background-repeat: repeat;
  background-position: center top;
  background-size: auto 100svh;

  > :is(header, footer) {
    max-width: var(--max-width);
    box-sizing: border-box;
    margin-inline: auto;
  }

  > :is(main) {
    --padding: 1rem;

    gap: 2rem 0;
    display: grid;
    grid-auto-flow: row;
    grid-template-columns:
      [full-start] minmax(var(--padding), 1fr)
      [content-start] repeat(2, min(var(--max-width) / 2, 50% - var(--padding))) [content-end]
      minmax(var(--padding), 1fr) [full-end];

    > * {
      grid-column: content;
    }
  }

  :is(h1, h2, h3, h4, h5) {
    line-height: 1.2;
    text-wrap: balance;
    text-box: trim-both cap alphabetic;
  }

  section[id] {
    scroll-margin-top: 6rem;
  }

  .extended {
    --spacing: 3rem;
    grid-column: full;
    padding-block: var(--spacing);
    background-image: var(--default-grad);

    display: grid;
    grid-template-columns: inherit;

    @media (max-width: 768px) {
      --spacing: 2rem;
      padding-inline: 1rem;

      > :is(button, a.button) {
        place-self: center;
      }
    }

    > * {
      grid-column: content;
    }
  }

  svg.icon {
    width: 1em;
    height: 1em;
  }
}

nav > ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
  outline: none;
}

h1 {
  font-size: 2.25rem;

  @media (max-width: 768px) {
    font-size: 2.1rem;
  }
}

h1, h2, h3, h4, h5, p, a:not(.button) {
  text-shadow:
    2px 2px 4px var(--bg-light),
    -2px -2px 4px var(--bg-light),
    2px -2px 4px var(--bg-light),
    -2px 2px 4px var(--bg-light);
}

header {
  --animation-range: 3rem 16rem;

  top: 0.5rem;
  height: 5rem;
  position: sticky;
  z-index: 10;

  display: flex;
  align-items: stretch;
  justify-content: center;

  /* Logo */
  > a {
    display: block;
    padding: 1rem 3rem;
    border-radius: 100rem;
    color: var(--text-color);

    animation-fill-mode: forwards;
    animation-name: header-scroll-logo;
    animation-timeline: scroll();
    animation-range: var(--animation-range);

    > svg {
      height: 100%;
    }
  }

  /* Navigation */
  > nav {
    align-content: center;

    > button {
      display: none;
      padding: 0.5rem;
      font-size: 1.5rem;
      font-weight: bold;
      cursor: pointer;
      line-height: 2;
      border-radius: 0.5rem;
      color: var(--primary-color);

      animation-fill-mode: forwards;
      animation-name: header-scroll-logo;
      animation-timeline: scroll();
      animation-range: var(--animation-range);
    }

    > ul {
      gap: 0.5rem;
      display: flex;
      padding: 1rem;
      color: white;

      border-radius: 100rem;

      animation-fill-mode: forwards;
      animation-name: header-scroll-nav;
      animation-timeline: scroll();
      animation-range: var(--animation-range);

      a {
        color: inherit;
        display: block;
        font-weight: 700;
        padding: 1rem;
        font-size: 1rem;
        white-space: nowrap;
        text-decoration: none;
        text-box: trim-both cap alphabetic;

        position: relative;

        &:before {
          height: 0;
          color: black;
          overflow: hidden;
          position: absolute;
          content: attr(aria-label);
          text-shadow: 0 0 1px black;
          transition: height 0.3s ease-in-out;
        }

        &:hover:before,
        &:focus:before {
          height: 100%;
        }
      }
    }
  }

  @media (max-width: 768px) {
    justify-content: center;

    > a {
      margin: unset;
    }

    > nav {
      > button {
        top: 50%;
        right: .5rem;
        display: block;
        position: absolute;
        transform: translateY(-50%);
        background: none;
        border: none;
      }

      > ul {
        top: 6rem;
        left: 100%;
        width: 50svw;
        margin: 0;
        position: fixed;
        min-width: fit-content;

        background: white;
        color: var(--primary-color);
        border-radius: 2rem 0 0 2rem;
        box-shadow: rgba(0, 0, 0, 0.15) 0px 2px 10px 0px;

        flex-direction: column;

        animation-name: none;
        transition: left 0.2s ease;

        > li:not(:last-child) {
          padding-bottom: 1rem;
          border-bottom: 1px solid var(--light-color);
        }
      }

      &:focus-within > ul {
        left: 50%;
      }
    }
  }
}

footer {
  address {
    gap: 2rem;
    padding: 1rem 2rem;
    display: flex;
    flex-wrap: wrap;
    font-style: normal;

    a {
      flex: 1;
      text-align: center;
      padding-block: 0.5rem;
    }

    svg {
      font-size: 1.2em;
      margin-right: 0.25rem;
      vertical-align: sub;
    }

    @media (max-width: 768px) {
      a {
        flex: 1 0 calc(50% - 2rem);
        text-align: center;
      }

      svg {
        margin-right: 0;
      }

      span {
        display: none;
      }
    }
  }

  p {
    font-size: 0.75rem;
    text-align: center;
  }

  @media (min-width: 768px) {
    padding-bottom: 2.5rem;
  }

  @media (max-width: 768px) {
    padding-bottom: 4.5rem;
  }
}

main {
  button, a.button, svg.button {
    --color: var(--primary-color);
    --dark-shade: oklch(from var(--color) calc(l - 0.1) c h);
    --light-shade: oklch(from var(--color) calc(l + 0.1) c h);

    --3d-depth: 0.4em;
    --3d-color: color-mix(in srgb, var(--dark-shade), black 20%);

    padding: 2ex 4ex;
    border-radius: 0.5em;

    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    text-box: trim-both cap alphabetic;

    border: none;
    margin-bottom: 0.4em;

    color: white;
    text-decoration: none;
    background-image: linear-gradient(0, var(--dark-shade), var(--light-shade));
    box-shadow:
      0 var(--3d-depth) 0 var(--3d-color),
      0 calc(var(--3d-depth) + 0.3em) 0.5em rgba(0, 0, 0, 0.25);

    .extended & {
      --color: #e7e7e7;
      color: var(--dark-color);
    }

    &:is(:not(svg)) {
      &:focus, &:hover {
        --dark-shade: oklch(from var(--color) calc(l - 0.05) c h);
        --light-shade: oklch(from var(--color) calc(l + 0.15) c h);
        --3d-color: color-mix(in srgb, var(--dark-shade), black 15%);
      }

      &:active {
        --3d-depth: 0.3em;
        transform: translateY(0.1em);
      }
    }

    &:is(svg) {
      padding: 1ex;
      font-size: 2rem;
      --3d-depth: 0.2em;
      border-radius: 0.3em;
    }
  }

  details {
    &:not(:last-child) {
      margin-bottom: 0.5rem;
    }

    summary {
      --color: #e7e7e7;
      --dark-shade: oklch(from var(--color) calc(l - 0.1) c h);
      --light-shade: oklch(from var(--color) calc(l + 0.1) c h);

      cursor: default;
      font-size: 14px;
      padding: 0.25rem 0.5rem;
      border-radius: 0.5rem;
      padding-inline-start: 0.75rem;
      background-image: linear-gradient(0, var(--dark-shade), var(--light-shade));

      &::marker {
        content: "";
      }

      &:focus, &:hover {
        --dark-shade: oklch(from var(--color) calc(l - 0.05) c h);
        --light-shade: oklch(from var(--color) calc(l + 0.15) c h);
      }

      > svg {
        float: right;
        padding: 3px;
        color: #9ba0a3;
      }
    }

    p {
      margin: 0 0.75rem;
      padding: 1rem 0.5rem 0;
      background-color: rgba(from var(--bg-light) r g b / 0.7);

      text-align: justify;
      text-align-last: left;

      &:last-of-type {
        padding-bottom: 1rem;
        border-radius: 0 0 0.5rem 0.5rem;
      }
    }
  }
}

@media (min-width: 768px) {
  body:before {
    top: 0;
    right: 0;
    left: 50%;
    height: max(calc(75svh + 5rem), 45.5rem);

    content: "";
    position: absolute;
    margin-left: calc((min(var(--max-width), 100svw) - 20rem) * -0.1);

    background-image: url('/images/decal.svg?1');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: bottom left;
  }

  section:not(.extended) > :is(h2, h2 + p) {
    text-align: center;
  }

  h1 {
    font-size: 3rem;
  }

  h2 {
    font-size: 2rem;
    margin-block: 1rem;
  }

  h3 {
    font-size: 1.5rem;
  }
}

@media (max-width: 768px) {
  h1, h2, h3, h4, h5 {
    text-align: center;
  }

  h2 + p {
    text-align: center;
  }
}

a#cta {
  right: 2rem;
  bottom: 2rem;
  position: fixed;
  z-index: 10;

  opacity: 0;

  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
  border-radius: 100rem;

  animation-fill-mode: both;
  animation-name: cta-scroll;
  animation-timeline: scroll();
  animation-range: 35svh calc(35svh + 6rem);

  svg {
    margin-right: 0.5ex;
    vertical-align: text-bottom;
  }

  @media (max-width: 768px) {
    right: 1rem;
    bottom: 1rem;
  }
}

section#inicio {
  display: grid;
  min-height: 75svh;

  gap: 2.5rem;
  padding-inline: 1rem;
  padding-bottom: 1.5rem;
  grid-template-rows: 1fr repeat(3, min-content);

  &:before {
    content: "";
    grid-area: 1 / 1;
    place-self: stretch;
    margin-inline: 1.5rem;
    margin-top: -10rem;

    border-radius: 0 0 100rem 100rem;
    background-image: var(--default-grad);
  }

  > :is(img, svg) {
    width: 95%;
    grid-area: 1 / 1;
    place-self: end center;
    margin-bottom: 3rem;
    filter: drop-shadow(0px 4px 10px rgba(0, 0, 0, 0.4));
  }

  > h1, > p {
    margin: 0;
  }

  > a.button {
    font-size: 1.125rem;
    place-self: center;

    svg {
      vertical-align: text-bottom;
    }
  }

  @media (min-width: 768px) {
    padding-left: 2rem;
    grid-template-columns: 42% 1fr;
    grid-template-rows: 1.5fr min-content 1fr;

    &:before {
      display: none;
    }

    > :is(img, svg) {
      width: 80%;
      margin-bottom: 7rem;
      grid-area: 1 / 2 / 4 / 3;
    }

    h1 {
      text-align: left;
      place-self: end start;
    }

    a.button {
      place-self: start start;
    }
  }
}

section#quem-somos {
  @media (min-width: 768px) {
    h2 {
      grid-column: 2 / 3;
      grid-row: 1 / 3;
      place-self: start end;
      margin-right: .5rem;
      padding-left: 30%;
      text-align: right;
    }

    p {
      grid-column: 3 / 4;
      margin-left: .5rem;
      margin-bottom: 0;
    }
  }
}

section#diferenciais {
  > div {
    gap: 2rem;
    display: flex;
    padding: 3rem;

    svg {
      font-size: 4rem;
    }

    > article {
      flex: 1;
      text-align: center;
    }
  }

  @media (max-width: 768px) {
    position: relative;

    > p {
      width: 80%;
      margin-inline: auto;
    }

    > div {
      gap: 3rem;
      overflow-x: scroll;
      padding-inline: 3rem;
      scroll-snap-type: x mandatory;
      scroll-behavior: smooth;
      scrollbar-width: none;

      &::scroll-button(*) {
        top: 50%;
        position: absolute;
        transform: translateY(-50%);

        width: 2rem;
        height: 2rem;
        border: none;
        background: none;
      }

      &::scroll-button(left) {
        left: 0;
        content: "";
        background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 24 24' fill='currentColor'><path d='M.88,14.09,4.75,18a1,1,0,0,0,1.42,0h0a1,1,0,0,0,0-1.42L2.61,13H23a1,1,0,0,0,1-1h0a1,1,0,0,0-1-1H2.55L6.17,7.38A1,1,0,0,0,6.17,6h0A1,1,0,0,0,4.75,6L.88,9.85A3,3,0,0,0,.88,14.09Z'/></svg>");
      }

      &::scroll-button(right) {
        right: 0;
        content: "";
        background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 24 24' fill='currentColor'><path d='M23.12,9.91,19.25,6a1,1,0,0,0-1.42,0h0a1,1,0,0,0,0,1.41L21.39,11H1a1,1,0,0,0-1,1H0a1,1,0,0,0,1,1H21.45l-3.62,3.61a1,1,0,0,0,0,1.42h0a1,1,0,0,0,1.42,0l3.87-3.88A3,3,0,0,0,23.12,9.91Z'/></svg>");
      }

      > article {
        flex: 1 0 100%;
        scroll-snap-align: center;
      }
    }
  }
}

section#como-funciona {
  img, > svg {
    padding-top: 2rem;
  }

  ol {
    padding: 0;
    padding-top: 3rem;
    list-style: none;
    max-width: 500px;
    position: relative;
    place-self: start center;

    &:before {
      top: 0;
      bottom: 0;
      left: calc(2ex + 1rem - 1px);

      width: 2px;
      content: "";
      display: block;
      position: absolute;

      --transparent: rgba(from var(--dark-color) r g b / 0);
      background-image: linear-gradient(0, var(--transparent), var(--primary-color) 10%, var(--primary-color) 90%, var(--transparent));
    }

    li, p {
      text-align: left;
      text-align-last: left;
    }

    li {
      position: relative;
      padding-left: 6rem;
      margin-bottom: 3rem;
    }

    svg {
      left: 0;
      position: absolute;
    }

    h3 {
      margin-top: 0;
    }
  }

  @media (min-width: 768px) {
    gap: 1rem;
    display: grid;
    position: relative;
    grid-template-columns: repeat(2, 1fr);

    h2 {
      grid-column: 2 / 3;
    }

    img, > svg {
      height: 10px;
      min-height: calc(100% - 1rem);
      grid-row: 1 / 3;
      place-self: center;
    }
  }
}

section#faq {
  @media (min-width: 768px) {
    gap: 1rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);

    h2 {
      grid-column: 1 / 3;
    }

    div#faq-items {
      grid-column: 2 / 3;
    }

    aside {
      grid-column: 1 / 2;
      grid-row: 2 / 3;
      place-self: start end;
      text-align: right;

      p {
        margin-top: 0;
        margin-bottom: 2rem;
        padding-left: 20%;
      }
    }
  }

  @media (max-width: 768px) {
    aside {
      display: flex;
      flex-direction: column;
      margin-top: 2rem;

      a.button {
        align-self: center;
      }

      p {
        order: 10;
        font-size: 14px;
        padding-inline: 1rem;
      }
    }
  }
}

section#contribua {
  @media (max-width: 768px) {
    svg {
      display: none;
    }
  }

  @media (min-width: 768px) {
    h2 {
      grid-column: 2 / 3;
      grid-row: 1 / 3;
      text-align: right;
      margin-right: .5rem;
      place-self: start end;
    }

    svg {
      grid-column: 2 / 3;
      grid-row: 1 / 3;
      height: 10px;
      min-height: 50%;
      margin-left: 30%;
      place-self: end start;
    }

    p, a.button {
      grid-column: 3 / 4;
      margin-left: .5rem;
    }

    a.button {
      place-self: start;
    }
  }
}

ul#team-list {
  gap: 2rem;
  padding: 2rem;
  display: flex;
  list-style: none;

  li {
    flex: 1;
    text-align: center;
  }

  strong {
    font-size: 1.2em;
    display: block;
  }

  img {
    max-width: 125px;
    border-radius: 100%;
    margin-bottom: 1rem;
    background-color: var(--primary-color);
  }

  @media (max-width: 768px) {
    flex-wrap: wrap;
  }
}

section#newsletter {
  @media (max-width: 768px) {
    p {
      max-width: 80%;
      margin-inline: auto;
    }
  }
}

form#newsletter-form {
  width: 100%;
  max-width: 30svw;

  display: flex;
  margin: 2rem auto;
  filter: drop-shadow(0px 0.3rem 0.3rem rgba(0, 0, 0, 0.25));

  @media (max-width: 768px) {
    max-width: unset;
    margin-inline: 0;
  }

  button {
    cursor: pointer;
    white-space: nowrap;
    padding-inline: 2ex;
    border-radius: 0 0.5rem 0.5rem 0;
    box-shadow: 0 var(--3d-depth) 0 var(--3d-color);
  }

  input {
    --color: #e7e7e7;
    --dark-shade: oklch(from var(--color) calc(l - 0.1) c h);
    --light-shade: oklch(from var(--color) calc(l + 0.1) c h);

    --3d-depth: 0.4em;
    --3d-color: color-mix(in srgb, var(--dark-shade), black 20%);

    flex: 1;

    padding: 2ex;
    border-radius: 0.5em 0 0 0.5em;

    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    text-box: trim-both cap alphabetic;

    border: none;
    outline: none;
    margin-bottom: 0.4em;

    color: var(--text-color);
    background-image: linear-gradient(0, var(--dark-shade), var(--light-shade));
    box-shadow: 0 var(--3d-depth) 0 var(--3d-color);

    &::placeholder {
      color: rgba(from var(--text-color) r g b / 0.3);
    }
  }
}

@keyframes header-scroll-logo {
  from {
    backdrop-filter: blur(0px) brightness(100%);
    background-color: #ffffff00;
  }
  to {
    backdrop-filter: blur(4px) brightness(110%);
    background-color: #ffffff80;
  }
}

@keyframes header-scroll-nav {
  from { background-color: rgb(from var(--primary-color) r g b / 0%); }
  to { background-color: rgb(from var(--primary-color) r g b / 100%); }
}

@keyframes cta-scroll {
  from {
    display: none;
    opacity: 0;
  }
  to {
    display: block;
    opacity: 1;
  }
}
