@layer reset, tokens, base, layout, components, motion;

@layer tokens {
  :root {
    --paper: #eef0f3;
    --card: #fff;
    --ink: #121417;
    --muted: #5c6370;
    --faint: #8a909a;
    --line: color-mix(in srgb, var(--ink) 10%, transparent);
    --blue: #1a56c4;
    --blue-ink: #fff;
    --flag-red: #d52b1e;
    --flag-blue: #0039a6;

    --font: "Onest", "Segoe UI", sans-serif;

    --fs-xs: clamp(0.72rem, 0.68rem + 0.16vw, 0.8rem);
    --fs-sm: clamp(0.86rem, 0.82rem + 0.2vw, 0.95rem);
    --fs-base: clamp(1.02rem, 0.96rem + 0.28vw, 1.125rem);
    --fs-md: clamp(1.12rem, 1.02rem + 0.45vw, 1.28rem);
    --fs-lg: clamp(1.55rem, 1.15rem + 1.6vw, 2.15rem);
    --fs-hero: clamp(1.55rem, 1.05rem + 2vw, 2.45rem);

    --pad: clamp(1.1rem, 3.4vw, 3rem);
    --max: 1080px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --z-nav: 20;
    --z-skip: 80;
    --radius: 18px;
  }
}

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html, body { margin: 0; }
  img, svg { display: block; max-width: 100%; height: auto; }
  button, a { font: inherit; }
  ul, ol { margin: 0; padding: 0; list-style: none; }
}

@layer base {
  html { scroll-behavior: smooth; }
  body {
    min-height: 100svh;
    font-family: var(--font);
    font-size: var(--fs-base);
    line-height: 1.5;
    color: var(--ink);
    background: var(--paper);
    text-rendering: optimizeLegibility;
  }
  h1, h2 {
    letter-spacing: -0.035em;
    line-height: 1.08;
    font-weight: 800;
  }
  a { color: inherit; }
  :focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
  }
  .skip {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: var(--z-skip);
    padding: 0.6rem 0.9rem;
    background: var(--blue);
    color: var(--blue-ink);
    font-weight: 700;
    text-decoration: none;
  }
  .skip:focus { top: 1rem; }
}

@layer layout {
  .top {
    position: relative;
    z-index: var(--z-nav);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: var(--max);
    margin: 0 auto;
    padding: 1rem var(--pad) 0;
  }
  .brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    text-decoration: none;
    font-weight: 800;
    font-size: var(--fs-sm);
    letter-spacing: -0.03em;
  }
  .brand img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .product {
    max-width: var(--max);
    margin: 0 auto;
    padding: 1.4rem var(--pad) 0.4rem;
  }
  .product__head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: clamp(1rem, 3vw, 1.6rem);
    align-items: start;
    padding: 1.35rem 1.4rem 1.5rem;
    background: var(--card);
    border-radius: var(--radius);
  }
  .product__icon {
    width: 96px;
    height: 96px;
    border-radius: 22px;
    box-shadow: 0 10px 24px rgba(18, 20, 23, 0.12);
  }
  .product__copy h1 {
    margin: 0 0 0.7rem;
    font-size: var(--fs-hero);
    max-width: 18ch;
  }
  .stats {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 1rem;
    margin: 0 0 0.85rem;
    color: var(--muted);
    font-size: var(--fs-sm);
  }
  .stats strong {
    color: var(--ink);
    font-size: 1.35rem;
    letter-spacing: -0.04em;
  }
  .lede {
    margin: 0 0 1.2rem;
    max-width: 42ch;
    color: var(--muted);
    font-size: var(--fs-md);
    font-weight: 500;
    line-height: 1.4;
  }

  .shots {
    max-width: var(--max);
    margin: 0 auto;
    padding: 1.1rem 0 2.4rem;
  }
  .shots ul {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 0 var(--pad) 0.4rem;
    -webkit-overflow-scrolling: touch;
  }
  .shots li {
    flex: 0 0 min(220px, 58vw);
    scroll-snap-align: start;
  }
  .shots img {
    width: 100%;
    aspect-ratio: 9 / 16;
    object-fit: cover;
    object-position: top center;
    border-radius: 16px;
    background: #d8dde4;
    box-shadow: 0 18px 36px rgba(18, 20, 23, 0.14);
  }

  .about {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 var(--pad) 3.2rem;
  }
  .about h2 {
    margin: 0 0 0.7rem;
    font-size: var(--fs-lg);
  }
  .about > p {
    margin: 0 0 1.4rem;
    max-width: 54ch;
    color: var(--muted);
  }
  .feats {
    display: grid;
    gap: 0;
    max-width: 40rem;
    border-top: 1px solid var(--line);
  }
  .feats li {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    letter-spacing: -0.02em;
  }

  .meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem 1.2rem;
    max-width: var(--max);
    margin: 0 auto 2.2rem;
    padding: 1.1rem var(--pad);
    color: var(--muted);
    font-size: var(--fs-sm);
  }
  .meta strong {
    display: block;
    color: var(--ink);
    font-size: var(--fs-base);
    margin-bottom: 0.15rem;
  }

  .close {
    max-width: var(--max);
    margin: 0 auto;
    padding: 2.2rem var(--pad) 3.4rem;
    border-top: 1px solid var(--line);
  }
  .close h2 {
    margin: 0 0 1.15rem;
    font-size: var(--fs-lg);
    max-width: 14ch;
  }

  .foot {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem 1.4rem;
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 var(--pad) 2.2rem;
    font-size: var(--fs-xs);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--faint);
  }
}

@layer components {
  .cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 0.85rem 1.4rem;
    background: var(--blue);
    color: var(--blue-ink);
    text-decoration: none;
    font-weight: 800;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
  }
  .cta:hover { filter: brightness(1.06); }
  .cta:active { transform: translateY(1px); }
  .cta.is-busy { opacity: 0.72; }
  .cta--sm {
    min-height: 42px;
    padding: 0.45rem 0.95rem;
    font-size: var(--fs-sm);
  }

  .kicker {
    margin: 0 0 1rem;
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--blue);
  }

  .dl-body {
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding: var(--pad);
  }
  .dl-card { width: min(28rem, 100%); }
  .dl-card h1 {
    margin: 0 0 0.8rem;
    font-size: clamp(1.8rem, 4vw, 2.4rem);
  }
  .dl-card p {
    margin: 0 0 0.45rem;
    color: var(--muted);
  }
  .dl-card .cta { margin-top: 1.3rem; }
  .back {
    display: inline-block;
    margin-top: 1rem;
    color: var(--muted);
    font-size: var(--fs-sm);
  }
}

@layer motion {
  @media (prefers-reduced-motion: no-preference) {
    .product__head, .shots li {
      animation: rise 700ms var(--ease) both;
    }
    .shots li:nth-child(2) { animation-delay: 50ms; }
    .shots li:nth-child(3) { animation-delay: 90ms; }
    .shots li:nth-child(4) { animation-delay: 130ms; }
  }
  @keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
  }
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .product__head, .shots li { animation: none; }
  }
}

@media (max-width: 720px) {
  .product__head {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 1.1rem;
  }
  .product__icon {
    width: 72px;
    height: 72px;
    border-radius: 16px;
  }
  .meta {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .top .cta--sm { display: none; }
  .product__head { grid-template-columns: 1fr; }
  .product__icon { width: 84px; height: 84px; }
}
