@layer reset, base, layout, components, utilities;

@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/inter-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/inter-italic-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Caveat";
  src: url("../assets/fonts/caveat-cyrillic.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Caveat";
  src: url("../assets/fonts/caveat-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html {
    scroll-behavior: smooth;
    scroll-padding-top: 92px;
    -webkit-text-size-adjust: 100%;
  }

  body,
  h1,
  h2,
  h3,
  h4,
  p,
  ul,
  ol,
  figure,
  blockquote {
    margin: 0;
  }

  ul,
  ol {
    padding: 0;
    list-style: none;
  }

  img,
  svg {
    display: block;
    max-width: 100%;
    height: auto;
  }

  button,
  input,
  textarea,
  select {
    font: inherit;
    color: inherit;
  }

  button {
    cursor: pointer;
    background: none;
    border: none;
  }

  a {
    color: inherit;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
  }
}

@layer base {
  body {
    font-family: var(--font);
    font-optical-sizing: auto;
    background: var(--paper);
    color: var(--ink);
    line-height: 1.55;
    min-height: 100dvh;
    overflow-x: hidden;
  }

  body::before {
    content: "";
    position: fixed;
    inset: 0 0 auto;
    height: 8px;
    z-index: 80;
    background: repeating-linear-gradient(
      90deg,
      var(--cta) 0 28px,
      var(--stamp-green) 28px 56px,
      var(--stamp-sand) 56px 84px,
      var(--water) 84px 112px
    );
  }

  :focus-visible {
    outline: 3px solid var(--water);
    outline-offset: 3px;
  }

  ::selection {
    background: var(--water);
    color: var(--ink-black);
  }

  h1,
  h2,
  h3 {
    text-wrap: balance;
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 0.95;
    color: var(--ink);
  }

  h1 {
    font-size: clamp(2.6rem, 8.4vw, 6.4rem);
  }

  h2 {
    font-size: clamp(1.85rem, 4.6vw, 3.55rem);
  }

  h3 {
    font-size: clamp(1.25rem, 2.2vw, 1.7rem);
  }

  .lede {
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    color: var(--ink-soft);
    max-width: 42ch;
  }

  .accent {
    font-style: italic;
    font-weight: 500;
    color: var(--stamp-green);
    letter-spacing: -0.02em;
  }

  .skip {
    position: absolute;
    left: -999px;
    top: 0;
  }

  .skip:focus {
    left: 12px;
    top: 16px;
    z-index: 100;
    background: var(--white);
    padding: 0.5rem 0.8rem;
    border: 2px solid var(--ink);
  }
}

@layer utilities {
  .container {
    width: min(100% - 2 * var(--pad), var(--max));
    margin-inline: auto;
  }

  .reveal {
    opacity: 0;
    transform: translateY(18px);
    animation: rise 0.7s ease forwards;
    animation-timeline: view();
    animation-range: entry 8% cover 28%;
  }

  @supports not (animation-timeline: view()) {
    .reveal {
      animation: none;
      opacity: 1;
      transform: none;
    }

    .reveal.is-in {
      animation: rise 0.65s ease forwards;
    }
  }

  @keyframes rise {
    to {
      opacity: 1;
      transform: none;
    }
  }
}
