body {
  padding: var(--size-5);
}

header {
  display: flex;
  align-items: center;
  gap: var(--size-2);
}

main {
  display: flex;
  flex-direction: column;
  gap: var(--size-20);
  max-width: var(--width-sm);
  margin-inline: auto;
  padding-block: var(--size-10) var(--size-20);
}

@media (max-width: 480px) {
  main {
    gap: var(--size-14);
    padding-block: var(--size-6) var(--size-14);
  }
}

main h2 {
  font-size: var(--scale-fluid-4);
  letter-spacing: var(--letter-sm);
  margin-bottom: var(--size-6);
}

#hero {
  h1 {
    font-size: var(--scale-fluid-6);
    font-weight: var(--weight-bold);
    letter-spacing: var(--letter-sm);
    line-height: var(--line-xs);
    margin-bottom: var(--size-3);
  }

  .tagline {
    font-size: var(--scale-fluid-2);
    color: var(--muted-foreground);
    max-width: var(--prose-sm);
    margin-bottom: var(--size-6);
  }
}

/* value props and how-it-works share one row layout: a badge in the left
   column (icon / step number), heading and copy on the right. Single
   column, so it never wraps awkwardly — same shape on phones and desktop.
   Value props carry a real .badge span (an icon needs an element to live
   in); how-it-works keeps the generated counter badge. */
#value-props ul,
#how-it-works ol {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--size-6);

  li {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: var(--size-4);

    &::before,
    > .badge {
      grid-row: 1 / span 2;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: var(--size-8);
      height: var(--size-8);
      font-size: var(--scale-00);
      font-weight: var(--weight-semibold);
      color: var(--primary-foreground);
      background-color: var(--primary);
      border-radius: var(--radius-full);
    }
  }

  h3,
  p {
    grid-column: 2;
  }

  h3 {
    font-size: var(--scale-1);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--size-1);
  }

  p {
    color: var(--muted-foreground);
    max-width: var(--prose-sm);
  }
}

#how-it-works ol {
  counter-reset: step;

  li::before {
    counter-increment: step;
    content: counter(step);
  }
}

#faq {
  details {
    border-bottom: 1px solid var(--border);

    summary {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--size-3);
      padding-block: var(--size-4);
      font-weight: var(--weight-medium);
      cursor: pointer;
      /* the chevron icon replaces the default disclosure marker */
      list-style: none;

      &::-webkit-details-marker {
        display: none;
      }

      .icon {
        color: var(--muted-foreground);
        transition: rotate 0.15s var(--ease-out-quad);
      }
    }

    &[open] summary .icon {
      rotate: 180deg;
    }

    p {
      padding-bottom: var(--size-4);
      color: var(--muted-foreground);
      max-width: var(--prose-md);
    }
  }

  details:first-of-type {
    border-top: 1px solid var(--border);
  }
}

#country-search {
  position: relative;
  max-width: var(--width-xs);

  /* magnifier sits inside the input; the input pads left to clear it */
  > .icon {
    position: absolute;
    left: var(--size-3);
    top: 50%;
    translate: 0 -50%;
    color: var(--muted-foreground);
    pointer-events: none;
  }

  input[type="search"] {
    appearance: none;
    width: 100%;
    padding: var(--size-3) var(--size-4);
    padding-inline-start: var(--size-10);
    color: var(--foreground);
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    &::placeholder {
      color: var(--muted-foreground);
    }
  }
}

#country-results {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + var(--size-2));
  z-index: var(--layer-1);
  max-height: min(50dvh, 24rem);
  overflow-y: auto;
  list-style: none;
  padding: var(--size-1);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);

  /* collapse the card entirely until there are matches */
  &:not(:has(li)) {
    display: none;
  }

  a {
    display: flex;
    align-items: center;
    gap: var(--size-2);
    padding: var(--size-2) var(--size-3);
    color: var(--foreground);
    text-decoration: none;
    border-radius: var(--radius-sm);

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

  /* keyboard highlight mirrors hover; aria-selected is set by the active signal */
  li[aria-selected="true"] a {
    background-color: var(--accent);
    color: var(--accent-foreground);
  }
}

#popular-countries {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-2);
  max-width: var(--width-xs);
  margin-top: var(--size-3);

  a {
    display: flex;
    align-items: center;
    gap: var(--size-2);
    padding: var(--size-1) var(--size-3);
    color: var(--foreground);
    text-decoration: none;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);

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