/* tokens.css */
@layer tokens, base, layout, components, utilities;

@layer tokens {
  /* Ropayo tier-2 semantic tokens. Mirrors
     ropayo-customer/lib/config/theme/colors.dart and
     ropayo-web/src/app/globals.css. Raw ramp hex lives in those files; this
     is the same set of values, inlined because the site has no build-time
     token pipeline. Nothing outside this file may name a colour. */
  :root {
    --primary: #235941;
    --surface-fill: #235941;
    --border-primary: #235941;
    --text-primary: #1c4332;
    --text-secondary: #626262;
    --text-on-fill: #ffffff;
    --surface: #ffffff;
    --background-muted: #f5f5f5;
    --surface-tint: #f1f8f4;
    --icon-container: #dcefe2;
    --border-subtle: #d3d3d3;
    --accent-brand: #f4b400;

    --container: 1152px;
    --gutter: 20px;
    --section-y: 64px;
    --radius-card: 16px;
    --radius-pill: 999px;
    --radius-store: 12px;
  }

  @media (min-width: 640px) {
    :root { --gutter: 32px; }
  }

  @media (min-width: 1024px) {
    :root { --section-y: 96px; }
  }
}

/* base.css */
@layer base {
  *, *::before, *::after { box-sizing: border-box; }

  html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: 0.01ms !important; }
  }

  body {
    margin: 0;
    background: var(--surface);
    color: var(--text-primary);
    font: 400 16px/1.6 ui-sans-serif, -apple-system, BlinkMacSystemFont,
          "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
  }

  h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
  p { margin: 0; }
  ul, ol { margin: 0; padding: 0; list-style: none; }

  a { color: var(--primary); }
  a:hover { opacity: 0.85; }

  :focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
  }

  ::selection { background: var(--icon-container); color: var(--text-primary); }

  summary { cursor: pointer; list-style: none; }
  summary::-webkit-details-marker { display: none; }
  details[open] .plus { transform: rotate(45deg); }
  .plus { flex-shrink: 0; transition: transform 0.2s; color: var(--primary); }

  svg { display: block; }
}

/* layout.css */
@layer layout {
  .wrap {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  .section { padding-block: var(--section-y); }

  .section--ruled {
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
  }

  .section__title {
    font-size: clamp(32px, 5vw, 44px);
    line-height: 1.1;
    text-wrap: pretty;
  }

  .section__intro {
    margin-top: 16px;
    max-width: 42rem;
    font-size: 18px;
    line-height: 1.6;
    color: var(--text-secondary);
  }

  .section__note {
    margin-top: 16px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
  }

  .eyebrow {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
  }
}

/* components/buttons.css */
@layer components {
  .btn {
    display: inline-block;
    border: 1px solid var(--primary);
    background: var(--primary);
    color: var(--text-on-fill);
    padding: 12px 24px;
    font: 500 16px/1.2 inherit;
    text-decoration: none;
    cursor: pointer;
  }
  .btn:hover { opacity: 0.9; }
  .btn--pill { border-radius: var(--radius-pill); }
  .btn--lg { padding: 14px 28px; font-size: 17px; font-weight: 600; }

  .btn--light {
    background: var(--surface);
    border-color: var(--surface);
    color: var(--primary);
  }

  .pill {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    gap: 6px 8px;
    border-radius: var(--radius-pill);
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    background: var(--surface-tint);
    color: var(--primary);
  }
  .pill__dot {
    height: 6px;
    width: 6px;
    border-radius: var(--radius-pill);
    background: var(--accent-brand);
  }

  .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
  .chip a { color: inherit; text-decoration: none; }
  .chip {
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    font-size: 14px;
    background: var(--icon-container);
    color: var(--primary);
  }

  .icon-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 56px;
    width: 56px;
    flex-shrink: 0;
    border-radius: var(--radius-pill);
    border: 1px solid var(--surface);
    background: var(--icon-container);
    color: var(--primary);
  }

  .check {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    width: 24px;
    flex-shrink: 0;
    border-radius: var(--radius-pill);
    background: var(--icon-container);
    color: var(--primary);
  }
}

/* components/cta.css */
@layer components {
  .cta {
    background: var(--surface-fill);
    color: var(--text-on-fill);
    padding-block: var(--section-y);
  }

  .cta__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 48px;
    align-items: center;
  }

  .cta__headline {
    max-width: 28rem;
    font-size: clamp(32px, 5vw, 44px);
    line-height: 1.1;
    color: var(--text-on-fill);
    text-wrap: pretty;
  }

  .cta__intro {
    margin-top: 16px;
    max-width: 34rem;
    font-size: 18px;
    line-height: 1.6;
    color: color-mix(in srgb, var(--text-on-fill) 80%, transparent);
  }

  .cta__promo {
    margin-top: 16px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-on-fill);
  }

  .cta__actions { margin-top: 20px; display: flex; flex-direction: column; align-items: center; gap: 20px; }
  .cta__actions .web-cta { order: 2; }
  .cta__actions .stores-block { order: 1; }

  @media (min-width: 1024px) {
    .cta__grid { grid-template-columns: 1fr 1fr; }
    .cta__action { justify-self: end; width: 100%; max-width: 28rem; }
    .cta__actions { align-items: flex-end; }
    .cta__actions .web-cta { order: 1; align-items: flex-end; }
    .cta__actions .stores-block { order: 2; align-items: flex-end; }
  }
}

/* components/disclosure.css */
@layer components {
  .disclosure { padding-bottom: 0; }

  .disclosure__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 8px 24px 20px;
    border-radius: var(--radius-card);
  }
  .disclosure__summary:hover { background: var(--surface-tint); }

  .disclosure__title { display: block; font-size: 18px; font-weight: 500; }
  .disclosure__sub {
    display: block;
    margin-top: 2px;
    font-size: 14px;
    color: var(--text-secondary);
  }

  .disclosure__body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 0 24px 24px;
    border-top: 1px solid var(--border-subtle);
    padding-top: 16px;
  }
  .disclosure__body .price-row { padding-inline: 0; }
  .disclosure__body .eyebrow { padding-bottom: 4px; }

  @media (min-width: 768px) {
    .disclosure__body { grid-template-columns: repeat(2, 1fr); gap: 16px 48px; }
  }
}

/* components/faq.css */
@layer components {
  .faq {
    background: var(--background-muted);
    border-top: 1px solid var(--border-subtle);
    padding-block: var(--section-y);
  }

  .faq__grid { display: grid; grid-template-columns: 1fr; gap: 32px; }
  .faq__intro .section__title { max-width: 20rem; }

  .faq__item { border-top: 1px solid var(--border-subtle); }
  .faq__item:first-child { border-top: 0; }

  .faq__question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-block: 20px;
    font-size: 18px;
    font-weight: 500;
  }

  .faq__answer {
    padding-bottom: 20px;
    max-width: 40rem;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-secondary);
  }

  @media (min-width: 900px) {
    .faq__grid { grid-template-columns: 0.85fr 1.6fr; gap: 64px; }
  }
}

/* components/footer.css */
@layer components {
  .site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border-subtle);
    padding-block: 32px;
  }

  .site-footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }

  .site-footer__nav { display: flex; flex-wrap: wrap; gap: 24px; }
  .site-footer__nav a {
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
  }
  .site-footer__nav a:hover { color: var(--primary); opacity: 1; }

  .site-footer__copy {
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-secondary);
  }
}

/* components/header.css */
@layer components {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(8px);
    background: color-mix(in srgb, var(--surface) 96%, transparent);
  }

  .site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-block: 16px;
  }

  .wordmark {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    text-decoration: none;
  }

  .site-header .btn { padding: 8px 20px; font-size: 14px; flex-shrink: 0; }
}

/* components/hero.css */
@layer components {
  .hero {
    padding-block: 64px 32px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .hero__headline {
    margin-top: 20px;
    max-width: 38rem;
    font-size: clamp(36px, 7vw, 56px);
    line-height: 1.05;
    text-wrap: pretty;
  }

  .hero__subhead {
    margin-top: 20px;
    max-width: 34rem;
    font-size: clamp(17px, 2.5vw, 20px);
    line-height: 1.6;
    color: var(--text-secondary);
  }

  .hero__zip { margin-top: 28px; width: 100%; max-width: 29rem; }

  /* Three destinations, one hierarchy. The order flips at the breakpoint with
     CSS `order`, never UA sniffing: one static artifact, cached identically
     for everyone, still correct with scripts off. Mobile leads with the
     stores (the visitor is already in a native context); desktop leads with
     the browser app. */
  .hero__actions {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }
  .hero__actions .web-cta { order: 2; }
  .hero__actions .stores-block { order: 1; }
  .hero__actions .stores { justify-content: center; }

  @media (min-width: 768px) {
    .hero__actions .web-cta { order: 1; }
    .hero__actions .stores-block { order: 2; }
  }
}

/* components/page.css */
@layer components {
  /* Long-form marketing pages: /pricing and the city pages. */
  .section__title--sub { margin-top: var(--section-y); font-size: clamp(26px, 4vw, 34px); }
  .prices--page { grid-template-columns: 1fr; }
  .card__note { padding: 8px 24px 12px; font-size: 14px; line-height: 1.6; color: var(--text-secondary); }

  .page-cta {
    margin-top: var(--section-y);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .page-cta__title { margin-top: 0; }
  .page-cta__zip { margin-top: 28px; width: 100%; max-width: 29rem; }

  @media (min-width: 768px) {
    .prices--page { grid-template-columns: repeat(2, 1fr); align-items: start; }
  }
}

/* components/payment.css */
@layer components {
  .payment__grid { display: grid; grid-template-columns: 1fr; gap: 40px; align-items: center; }

  .receipt {
    margin: 0;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    background: var(--surface);
    padding: 8px 0 12px;
    max-width: 26rem;
    width: 100%;
  }
  .receipt__lines { display: block; }
  .receipt__line {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 12px 24px;
    border-top: 1px solid var(--border-subtle);
  }
  .receipt__line:first-child { border-top: 0; }
  .receipt__item { display: flex; flex-direction: column; }
  .receipt__detail { font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
  .receipt__line--total { font-weight: 600; background: var(--surface-tint); }
  .receipt__caption { padding: 12px 24px 0; font-size: 13px; color: var(--text-secondary); }

  @media (min-width: 900px) {
    .payment__grid { grid-template-columns: 1.1fr 1fr; gap: 64px; }
    .receipt { justify-self: end; }
  }
}

/* components/prices.css */
@layer components {
  .prices { margin-top: 48px; display: grid; gap: 24px; }

  .card {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    background: var(--surface);
    padding: 16px 0 8px;
  }
  .card > .eyebrow { padding: 4px 24px 8px; }

  .card--tinted {
    background: var(--surface-tint);
    border-color: var(--border-primary);
  }

  .price-list { display: block; }

  .price-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 24px;
    padding: 10px 24px;
    border-top: 1px solid var(--border-subtle);
  }

  .price-row--strong { font-size: 18px; }

  .price {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .price-group { break-inside: avoid; }
  .price-group + .price-group { margin-top: 8px; }
}

/* components/promo.css */
@layer components {
  /* The code is plain selectable text without scripts; promo-copy.js appends
     the copy button and swaps its label on success. */
  .promo-code { display: inline-flex; align-items: center; gap: 6px; vertical-align: baseline; }
  .promo-code__value {
    font: 600 0.95em/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.04em;
    user-select: all;
  }
  .promo-code__copy {
    appearance: none;
    border: 1px solid currentColor;
    border-radius: var(--radius-pill);
    background: transparent;
    color: inherit;
    font: 500 11px/1 inherit;
    padding: 3px 8px;
    cursor: pointer;
  }
  .promo-code__copy:hover { opacity: 0.85; }
  .promo-code__copy.is-copied { background: currentColor; }
  .promo-code__copy.is-copied span { color: var(--surface); }
  .pill .promo-code__copy { padding: 2px 7px; font-size: 10px; }
}

/* components/reasons.css */
@layer components {
  .reasons { margin-top: 32px; display: grid; gap: 24px; max-width: 42rem; }
  .reasons__row { display: flex; align-items: flex-start; gap: 16px; line-height: 1.6; }
}

/* components/steps.css */
@layer components {
  .steps {
    position: relative;
    margin-top: 48px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .steps__label {
    margin-top: 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
  }
  .steps__title { margin-top: 16px; font-size: 20px; letter-spacing: normal; }
  .steps__body {
    margin-top: 8px;
    max-width: 20rem;
    line-height: 1.6;
    color: var(--text-secondary);
  }

  @media (min-width: 768px) {
    .steps { grid-template-columns: repeat(3, 1fr); gap: 24px; }

    /* The spine runs behind the icon circles; each circle carries a 1px
       surface-coloured border so the line appears to stop at its edge. */
    .steps::before {
      content: "";
      position: absolute;
      left: 28px;
      top: 28px;
      width: calc(100% - 3.5rem);
      height: 1px;
      background: var(--border-subtle);
    }
    .steps__item { position: relative; }
  }
}

/* components/store-buttons.css */
@layer components {
  .stores { display: flex; gap: 12px; flex-wrap: wrap; }

  .store {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: var(--radius-store);
    border: 1px solid var(--primary);
    background: var(--primary);
    color: var(--text-on-fill);
    padding: 6px 12px;
    text-decoration: none;
  }
  .store:hover { opacity: 0.9; }

  .store__label { display: flex; flex-direction: column; line-height: 1.15; }
  .store__pre { font-size: 8.8px; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.9; }
  .store__name { font-size: 12px; font-weight: 600; }

  .cta .store {
    background: var(--surface);
    border-color: var(--surface);
    color: var(--primary);
  }
}

/* components/tracking.css */
@layer components {
  .tracking { padding-block: var(--section-y); background: var(--surface-tint); }

  .timeline {
    position: relative;
    margin-top: 40px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
    padding-left: 28px;
  }
  /* One spine behind the dots, like the "How it works" hairline. */
  .timeline::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--icon-container);
  }
  .timeline__step { position: relative; }
  .timeline__dot {
    position: absolute;
    left: -28px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: var(--radius-pill);
    background: var(--primary);
    border: 3px solid var(--surface-tint);
  }
  .timeline__title { font-size: 18px; letter-spacing: normal; }
  .timeline__body { margin-top: 6px; max-width: 30rem; line-height: 1.6; color: var(--text-secondary); }

  @media (min-width: 900px) {
    .timeline { grid-template-columns: repeat(5, 1fr); gap: 24px; padding-left: 0; padding-top: 32px; }
    .timeline::before { left: 8px; right: 8px; top: 7px; bottom: auto; width: auto; height: 2px; }
    .timeline__dot { left: 0; top: -32px; }
    .timeline__body { max-width: none; }
  }
}

/* components/trust-band.css */
@layer components {
  .trust {
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
  }

  .trust__grid { display: grid; grid-template-columns: 1fr; }

  .trust__cell { padding: 24px 16px; text-align: center; }

  /* Dividers as borders on the cells themselves. The design describes a
     `gap:1px` grid over a hairline background, which renders the same in
     principle but leaves 1px slivers at the container edges when the 1fr
     columns land on fractional pixels. */
  .trust__cell + .trust__cell { border-top: 1px solid var(--border-subtle); }

  .trust__heading { font-size: 18px; font-weight: 600; color: var(--primary); }
  .trust__sub { margin-top: 4px; font-size: 14px; color: var(--text-secondary); }

  @media (min-width: 768px) {
    .trust__grid { grid-template-columns: repeat(3, 1fr); }
    .trust__cell + .trust__cell {
      border-top: 0;
      border-left: 1px solid var(--border-subtle);
    }
  }
}

/* components/web-cta.css */
@layer components {
  .web-cta { display: flex; flex-direction: column; align-items: center; gap: 8px; }
  .web-cta__hint { font-size: 14px; color: var(--text-secondary); }
  .web-cta--light .web-cta__hint { color: color-mix(in srgb, var(--text-on-fill) 85%, transparent); }

  /* On mobile the browser app is the no-install fallback beneath the stores,
     so it reads as secondary: outlined, with the "no install?" hint. */
  .web-cta__hint--desktop { display: none; }
  .web-cta .btn--lg {
    background: transparent;
    color: var(--primary);
  }
  .web-cta--light .btn--lg {
    color: var(--text-on-fill);
    border-color: var(--text-on-fill);
  }

  @media (min-width: 768px) {
    .web-cta__hint--desktop { display: block; }
    .web-cta__hint--mobile { display: none; }
    .web-cta .btn--lg { background: var(--primary); color: var(--text-on-fill); }
    .web-cta--light .btn--lg {
      background: var(--surface);
      border-color: var(--surface);
      color: var(--primary);
    }
  }

  .stores-block { display: flex; flex-direction: column; align-items: center; gap: 8px; }
  .stores-block .eyebrow--desktop { display: none; }
  @media (min-width: 768px) {
    .stores-block .eyebrow--desktop { display: block; }
    .stores-block .eyebrow--mobile { display: none; }
  }

  /* A served ZIP swaps the standing web CTA for the one inside the result
     region, directly under the confirmation, so the two never stack. */
  [data-zip-scope].is-served .web-cta { display: none; }
}

/* components/zip.css */
@layer components {
  .zip { display: flex; gap: 12px; justify-content: center; }

  .zip__input {
    min-width: 0;
    flex: 1;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-subtle);
    background: transparent;
    padding: 12px 20px;
    font: 400 16px/1.2 inherit;
    color: var(--text-primary);
  }
  .zip__input::placeholder { color: var(--text-secondary); }

  /* Reserved height so a result never shifts the layout below it. */
  .zip__result {
    margin-top: 12px;
    min-height: 1.5rem;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
  }
  .zip__message { min-height: 1.5rem; }
  .zip__cta { margin-top: 12px; }
  .zip__cta[hidden] { display: none; }

  .zip--light .zip__input {
    background: var(--surface);
    border-color: var(--surface);
  }
  .zip__result--light { color: color-mix(in srgb, var(--text-on-fill) 85%, transparent); }
  .zip__result--light a:not(.btn) { color: var(--text-on-fill); }
}

/* legal.css */
@layer components {
  /* Long-form documents: privacy, terms, contact, 404. Same container and
     tokens as the landing page, tuned for reading rather than scanning. */
  .legal { padding-block: 56px var(--section-y); }

  .legal h1 { font-size: clamp(28px, 4vw, 36px); line-height: 1.15; }

  .legal h2 {
    margin-top: 40px;
    margin-bottom: 8px;
    font-size: 20px;
    letter-spacing: -0.01em;
  }

  .legal p,
  .legal li { max-width: 38rem; line-height: 1.7; }

  .legal p + p { margin-top: 12px; }

  .legal ul {
    margin-top: 12px;
    padding-left: 20px;
    list-style: disc;
  }
  .legal li { margin-bottom: 8px; }

  .legal .updated {
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-secondary);
  }

  .callout {
    margin-block: 24px;
    max-width: 38rem;
    background: var(--surface-tint);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--primary);
    border-radius: 8px;
    padding: 16px 20px;
  }
  .callout p { margin: 0; }
  .callout p + p { margin-top: 12px; }
}
