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: a row of benefit cards — a soft-tinted, rounded-square icon
   badge, then heading and copy, left-aligned. Three across, stacking on
   phones. */
#value-props ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--size-4);

  li {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--size-2);
    padding: var(--size-5);
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
  }

  .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--size-10);
    height: var(--size-10);
    font-size: var(--scale-2);
    color: var(--primary-muted-foreground);
    background-color: var(--primary-muted);
    border-radius: var(--radius-md);
  }

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

  p {
    color: var(--muted-foreground);
  }
}

/* how it works: editorial numbered bands — a large leading-zero numeral in
   the left column, heading and fuller copy on the right, divider rules
   between steps. Reads as a substantial sequence, distinct from the
   benefit-card grid above. */
#how-it-works ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step;
  display: flex;
  flex-direction: column;

  li {
    counter-increment: step;
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: var(--size-5);
    align-items: start;
    padding-block: var(--size-5);
    border-top: 1px solid var(--border);
  }

  li:last-child {
    border-bottom: 1px solid var(--border);
  }

  /* the big leading-zero numeral, e.g. 01 */
  li::before {
    content: counter(step, decimal-leading-zero);
    grid-row: 1 / span 2;
    align-self: start;
    font-size: var(--scale-5);
    font-weight: var(--weight-bold);
    line-height: var(--line-none);
    letter-spacing: var(--letter-sm);
    color: var(--primary);
    font-variant-numeric: tabular-nums;
  }

  h3,
  p {
    grid-column: 2;
  }

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

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

@media (max-width: 600px) {
  #value-props ul {
    grid-template-columns: 1fr;
  }
}

/* slim reassurance strip between the benefits and the how-it-works steps;
   the icon badge mirrors the value-props cards so it reads as part of the set */
#compat-note {
  display: flex;
  align-items: center;
  gap: var(--size-3);
  padding: var(--size-4) var(--size-5);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);

  .compat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: var(--size-10);
    height: var(--size-10);
    font-size: var(--scale-2);
    color: var(--primary-muted-foreground);
    background-color: var(--primary-muted);
    border-radius: var(--radius-md);
  }

  p {
    color: var(--muted-foreground);
  }

  strong {
    color: var(--foreground);
    font-weight: var(--weight-semibold);
  }

  a {
    color: var(--primary);
    font-weight: var(--weight-medium);
    white-space: nowrap;
  }
}

#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);
  }

  .faq-more {
    margin-top: var(--size-6);
    color: var(--muted-foreground);
  }

  /* a contextual link under an answer, e.g. to the compatibility checker;
     tighten the answer's bottom padding so the link reads as attached to it */
  details p:has(+ .faq-cta) {
    padding-bottom: var(--size-2);
  }

  .faq-cta {
    font-weight: var(--weight-medium);
  }
}

#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);
    }
  }
}

/* trust strip: secure-checkout line + the payment marks we accept, sitting
   at the foot of the hero where the buying decision is made. */
#payment-trust {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--size-3);
  margin-top: var(--size-6);

  .trust-lead {
    display: inline-flex;
    align-items: center;
    /* cap to the container so the line wraps on narrow screens instead of
       overflowing the viewport; the icon stays pinned, the text span wraps */
    max-width: 100%;
    gap: var(--size-2);
    font-size: var(--scale-00);
    color: var(--muted-foreground);

    .icon {
      color: var(--success);
    }
  }

  .payment-marks {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--size-2);
    list-style: none;
    padding: 0;
    margin: 0;
  }

  /* height is fixed; width follows each mark's own viewBox aspect, so the
     wider wallet marks (Apple Pay) don't clip against the card-mark width */
  .pay-mark {
    display: block;
    width: auto;
    height: var(--size-8);
  }
}
