/* TAP 2026 design system (redesign-oct30). Layers: legacy (old page styles) < reset < tokens < base < components < pages < utilities */
@layer legacy, reset, tokens, base, components, pages, utilities;

@font-face { font-family: "Space Grotesk"; src: url("/fonts/space-grotesk-latin-wght-normal.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body { margin: 0; }
  img, picture, video, svg { display: block; max-width: 100%; height: auto; }
  button, input { font: inherit; color: inherit; }
}

@layer tokens {
  :root {
    color-scheme: light dark;
    --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
    --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem; --space-5: 1.5rem; --space-6: 2rem; --space-7: 3rem; --space-8: 4.5rem; --space-9: 7rem;
    --radius-s: .5rem; --radius-m: 1rem; --radius-l: 1.75rem; --radius-pill: 999px;
    --step--1: clamp(.83rem, .8rem + .15vw, .9rem);
    --step-0: clamp(1rem, .96rem + .2vw, 1.0625rem);
    --step-1: clamp(1.15rem, 1.08rem + .35vw, 1.35rem);
    --step-2: clamp(1.4rem, 1.25rem + .75vw, 1.9rem);
    --step-3: clamp(1.8rem, 1.5rem + 1.5vw, 2.75rem);
    --step-4: clamp(2.3rem, 1.8rem + 2.6vw, 4.25rem);
    --wrap: 72rem;
    --ease: cubic-bezier(.2,.7,.2,1);

    /* light */
    --bg: #f6f7fb; --bg-2: #ffffff; --surface: #ffffff; --surface-2: #eef1f8;
    --ink: #0b1020; --ink-2: #3a4258; --muted: #5a6378; --line: #dde2ee;
    --brand: #066678; --brand-ink: #ffffff; --brand-2: #6d4df2;
    --cta: #0b1020; --cta-ink: #ffffff; --cta-hover: #1d2640;
    --glow: color-mix(in oklab, #22d3ee 35%, transparent);
    --focus: #6d4df2;
    --shadow: 0 1px 2px rgb(11 16 32 / .06), 0 12px 32px -12px rgb(11 16 32 / .18);
  }
  :root[data-theme="dark"] {
    --bg: #070a12; --bg-2: #0c1120; --surface: #10172a; --surface-2: #151d34;
    --ink: #eef2ff; --ink-2: #c3cbe0; --muted: #9aa4bd; --line: #222c47;
    --brand: #5ee6f7; --brand-ink: #04121a; --brand-2: #a993ff;
    --cta: #5ee6f7; --cta-ink: #04121a; --cta-hover: #8cf0fb;
    --glow: color-mix(in oklab, #22d3ee 28%, transparent);
    --focus: #a993ff;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 16px 40px -16px rgb(0 0 0 / .7);
  }
}

@layer base {
  html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
  body { font-family: var(--font-body); font-size: var(--step-0); line-height: 1.6; color: var(--ink); background: var(--bg); min-height: 100vh; overflow-x: clip; }
  h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.1; letter-spacing: -.02em; margin: 0 0 var(--space-4); color: var(--ink); text-wrap: balance; }
  h1 { font-size: var(--step-4); font-weight: 700; }
  h2 { font-size: var(--step-3); font-weight: 700; }
  h3 { font-size: var(--step-1); font-weight: 600; }
  p { margin: 0 0 var(--space-4); text-wrap: pretty; }
  a { color: var(--brand); text-underline-offset: .18em; }
  a:hover { color: var(--brand-2); }
  :focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
  code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; overflow-wrap: anywhere; }
  ::selection { background: color-mix(in oklab, var(--brand) 30%, transparent); }
  @view-transition { navigation: auto; }
}

@layer components {
  .skip { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--cta); color: var(--cta-ink); padding: .75rem 1rem; border-radius: var(--radius-s); }
  .skip:focus { left: 1rem; top: 1rem; }
  .wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }

  /* header */
  .t-head { position: sticky; top: 0; z-index: 40; background: color-mix(in oklab, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid color-mix(in oklab, var(--line) 70%, transparent); view-transition-name: t-head; }
  .t-head__in { display: flex; align-items: center; gap: var(--space-4); min-height: 4rem; }
  .t-brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; letter-spacing: .04em; }
  .t-brand img { inline-size: 2.5rem; block-size: 2.5rem; object-fit: contain; border-radius: .55rem; flex: none; }
  .t-nav { display: flex; gap: var(--space-5); margin-inline-start: var(--space-5); }
  .t-nav a { color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .95rem; }
  .t-nav a:hover, .t-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; }
  .t-head__end { margin-inline-start: auto; display: flex; align-items: center; gap: var(--space-2); }
  .t-icon-btn { inline-size: 2.75rem; block-size: 2.75rem; display: grid; place-items: center; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
  .t-icon-btn svg { width: 1.2rem; height: 1.2rem; }
  .t-menu { display: none; }
  @media (max-width: 52rem) {
    .t-menu { display: grid; }
    .t-nav { display: none; position: absolute; inset: 100% 0 auto 0; flex-direction: column; gap: 0; margin: 0; background: var(--bg-2); border-bottom: 1px solid var(--line); padding: var(--space-2) 1.25rem var(--space-4); box-shadow: var(--shadow); }
    .t-head:has(.t-menu[aria-expanded="true"]) .t-nav { display: flex; }
    .t-nav a { padding: .85rem 0; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
    .t-head .t-play--head { display: none; }
  }

  /* Google Play CTA: the one primary action */
  .t-play { display: inline-flex; align-items: center; gap: .7rem; min-block-size: 3.5rem; padding: .7rem 1.4rem .7rem 1.1rem; border-radius: var(--radius-m); background: var(--cta); color: var(--cta-ink); text-decoration: none; font-weight: 600; line-height: 1.15; box-shadow: 0 10px 30px -10px var(--glow), var(--shadow); transition: transform .18s var(--ease), background-color .18s; }
  .t-play:hover { background: var(--cta-hover); color: var(--cta-ink); transform: translateY(-2px); }
  .t-play svg { width: 1.6rem; height: 1.6rem; flex: none; }
  .t-play small { display: block; font-size: .72rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; opacity: .8; }
  .t-play span span { display: block; font-size: 1.1rem; font-family: var(--font-display); font-weight: 700; }
  .t-play--head { min-block-size: 2.75rem; padding: .45rem 1rem; font-size: .92rem; border-radius: var(--radius-pill); box-shadow: none; }
  .t-play--head svg { width: 1.1rem; height: 1.1rem; }
  .t-play--big { min-block-size: 4rem; padding-inline: 1.3rem 1.8rem; }
  .t-cta-note { margin: var(--space-3) 0 0; font-size: var(--step--1); color: var(--muted); }
  .t-cta-note a { color: var(--muted); }

  .t-btn { display: inline-flex; align-items: center; justify-content: center; min-block-size: 2.75rem; padding: .55rem 1.1rem; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; cursor: pointer; }
  .t-btn:hover { border-color: var(--ink-2); color: var(--ink); }

  /* sticky mobile CTA: only when no other Play button is visible; page reserves room so it never covers content */
  .t-sticky { position: fixed; inset: auto 0 0 0; z-index: 50; padding: .65rem 1rem calc(.65rem + env(safe-area-inset-bottom)); background: color-mix(in oklab, var(--bg-2) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); display: flex; align-items: center; gap: .75rem; transform: translateY(110%); transition: transform .25s var(--ease); }
  .t-sticky.is-on { transform: none; }
  .t-sticky img { inline-size: 2.5rem; block-size: 2.5rem; object-fit: contain; border-radius: .55rem; flex: none; }
  .t-sticky p { margin: 0; font-size: .85rem; line-height: 1.25; color: var(--ink-2); flex: 1; }
  .t-sticky p strong { display: block; color: var(--ink); font-family: var(--font-display); font-size: 1rem; }
  .t-sticky .t-play { min-block-size: 2.9rem; padding: .5rem 1rem; font-size: .95rem; }
  .t-sticky .t-play svg { width: 1.2rem; height: 1.2rem; }
  @media (max-width: 52rem) { body.has-sticky { padding-bottom: 4.75rem; } }
  @media (min-width: 52.01rem) { .t-sticky { display: none; } }
  @media (prefers-reduced-motion: reduce) { .t-sticky { transition: none; } }

  /* footer */
  .t-foot { border-top: 1px solid var(--line); background: var(--bg-2); padding: var(--space-7) 0 var(--space-6); color: var(--muted); font-size: .92rem; }
  .t-foot__grid { display: grid; gap: var(--space-6); grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
  .t-foot h2 { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); font-family: var(--font-body); font-weight: 700; margin-bottom: var(--space-3); }
  .t-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
  .t-foot a { color: var(--ink-2); text-decoration: none; display: inline-block; padding: .3rem 0; }
  .t-foot a:hover { color: var(--brand); text-decoration: underline; }
  .t-foot__legal { margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--line); font-size: .85rem; }

  .kicker { display: inline-flex; align-items: center; gap: .5rem; font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--brand); margin-bottom: var(--space-3); }
  .kicker::before { content: ""; inline-size: .55rem; block-size: .55rem; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
}

@layer pages {
  /* ---------- home ---------- */
  .hero { position: relative; isolation: isolate; padding: var(--space-6) 0 var(--space-8); overflow: clip; }
  .hero::before { content: ""; position: absolute; inset: -20% -10% auto; block-size: 140%; z-index: -1; background: radial-gradient(40rem 26rem at 78% 30%, color-mix(in oklab, #22d3ee 22%, transparent), transparent 70%), radial-gradient(30rem 22rem at 10% 80%, color-mix(in oklab, #7c5cff 16%, transparent), transparent 70%); }
  .hero__grid { display: grid; gap: var(--space-6); align-items: center; grid-template-columns: 1fr; }
  @media (min-width: 52rem) { .hero__grid { grid-template-columns: 1.1fr .9fr; gap: var(--space-8); } .hero { padding-block: var(--space-8) var(--space-9); } }
  .hero h1 { margin-bottom: var(--space-4); }
  .hero h1 em { font-style: normal; background: linear-gradient(100deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .hero__lead { font-size: var(--step-1); color: var(--ink-2); max-inline-size: 34ch; margin-bottom: var(--space-5); }
  .hero__ticks { list-style: none; padding: 0; margin: var(--space-5) 0 0; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; font-size: .92rem; color: var(--ink-2); }
  .hero__ticks li { display: inline-flex; gap: .4rem; align-items: center; }
  .hero__ticks li::before { content: ""; inline-size: 1rem; block-size: 1rem; background: var(--brand); mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z"/></svg>') center/contain no-repeat; }
  /* mobile: CTA must sit above the fold, so the card goes after the copy and stays compact */
  .hero__media { display: grid; place-items: center; }
  .stage { position: relative; inline-size: min(68vw, 19rem); aspect-ratio: 300 / 565; }
  @media (max-width: 52rem) { .hero { padding-top: var(--space-5); } }
  .share-vis { position: relative; inline-size: min(100%, 30rem); }
  .share-vis__photo { inline-size: 100%; border-radius: var(--radius-l); box-shadow: var(--shadow); }
  .share-vis .stage { position: absolute; inline-size: clamp(6.5rem, 30%, 10.5rem); inset: auto -.75rem -1.5rem auto; }
  @media (max-width: 52rem) { .share-vis .stage { inline-size: 6.5rem; inset: auto .5rem -1.25rem auto; } }
  .stage__card { position: absolute; inset: 0; border-radius: 1.4rem; overflow: hidden; box-shadow: 0 30px 60px -20px rgb(0 0 0 / .45), 0 0 0 1px rgb(255 255 255 / .06); transition: opacity .6s var(--ease), transform .6s var(--ease); }
  .stage__card img { inline-size: 100%; block-size: 100%; object-fit: cover; }
  .stage__card.is-back { opacity: 0; transform: translateY(12px) scale(.97); }
  .stage::after { content: ""; position: absolute; inset: 8% -18% -6%; z-index: -1; background: radial-gradient(closest-side, var(--glow), transparent); filter: blur(10px); }
  .stage__ctrl { margin-top: var(--space-6); display: flex; justify-content: center; }
  .stage__ctrl .t-btn { font-size: .85rem; min-block-size: 2.5rem; }

  .feature { padding: var(--space-8) 0; border-top: 1px solid var(--line); container-type: inline-size; }
  .feature:nth-of-type(even) { background: var(--bg-2); }
  .feature__grid { display: grid; gap: var(--space-6); align-items: center; }
  @container (min-width: 50rem) { .feature__grid { grid-template-columns: 1fr 1fr; gap: var(--space-8); } .feature--flip .feature__media { order: 2; } }
  .feature__copy p { color: var(--ink-2); max-inline-size: 44ch; }
  .feature__copy .t-play { margin-top: var(--space-3); }
  .feature__grid > * { min-inline-size: 0; }
  .feature__media { display: grid; place-items: center; }
  .feature__media picture { max-inline-size: 100%; }
  .feature__media img.medid { inline-size: min(100%, 26rem); }
  .feature__media > picture img, .feature__media > img { border-radius: var(--radius-l); box-shadow: var(--shadow); }

  .steps { list-style: none; counter-reset: s; padding: 0; margin: var(--space-5) 0; display: grid; gap: var(--space-3); }
  @container (min-width: 50rem) { .steps--row { grid-template-columns: repeat(3, 1fr); } }
  .steps li { counter-increment: s; display: grid; grid-template-columns: 2.5rem 1fr; gap: var(--space-3); align-items: start; padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
  .steps li::before { content: counter(s); inline-size: 2.5rem; block-size: 2.5rem; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; color: var(--brand-ink); background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
  .steps strong { display: block; font-family: var(--font-display); }
  .steps span { color: var(--muted); font-size: .95rem; }
  .remote { padding: var(--space-4); border-radius: var(--radius-m); background: color-mix(in oklab, var(--brand) 10%, var(--surface)); border: 1px solid color-mix(in oklab, var(--brand) 30%, var(--line)); }
  .remote strong { font-family: var(--font-display); }

  /* card studio: one big card at a time, pick a design */
  .studio { display: grid; gap: var(--space-4); justify-items: center; }
  .studio__big { inline-size: min(70vw, 18rem); aspect-ratio: 300/565; border-radius: 1.4rem; overflow: hidden; box-shadow: 0 30px 60px -24px rgb(0 0 0 / .5); view-transition-name: studio-card; }
  .studio__big img { inline-size: 100%; block-size: 100%; object-fit: cover; }
  .studio__picks { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; max-inline-size: 26rem; }
  .studio__picks button { inline-size: 2.75rem; block-size: 2.75rem; padding: 0; border-radius: .6rem; overflow: hidden; border: 2px solid transparent; background: var(--surface-2); cursor: pointer; }
  .studio__picks button img { inline-size: 100%; block-size: 100%; object-fit: cover; object-position: center 22%; }
  .studio__picks button[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand) 30%, transparent); }
  .studio__cap { font-size: .9rem; color: var(--muted); margin: 0; }

  .more { padding: var(--space-8) 0; border-top: 1px solid var(--line); }
  .more__grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); margin-top: var(--space-5); }
  .more__grid article { padding: var(--space-5); border-radius: var(--radius-m); border: 1px solid var(--line); background: var(--surface); }
  .more__grid h3 { margin-bottom: var(--space-2); }
  .more__grid p { margin: 0; color: var(--muted); font-size: .95rem; }

  .final { padding: var(--space-8) 0; text-align: center; background: radial-gradient(40rem 20rem at 50% 0%, color-mix(in oklab, #22d3ee 18%, transparent), transparent 70%), var(--bg-2); border-top: 1px solid var(--line); }
  .final img.logo { inline-size: 4.5rem; block-size: 4.5rem; object-fit: contain; margin: 0 auto var(--space-4); border-radius: 1rem; }
  .final p { color: var(--ink-2); max-inline-size: 40ch; margin-inline: auto; }

  /* scroll-driven reveal, motion-safe only */
  @media (prefers-reduced-motion: no-preference) {
    @supports (animation-timeline: view()) {
      .reveal { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% cover 28%; }
      @keyframes rise { from { opacity: 0; transform: translateY(2rem); } to { opacity: 1; transform: none; } }
    }
  }
  @media (prefers-reduced-motion: reduce) { .stage__card { transition: none; } ::view-transition-group(*) { animation: none; } }

  /* ---------- inner pages ---------- */
  .prose * { animation: none !important; }
  main#main { padding: 0 !important; margin: 0 !important; max-width: none !important; width: auto !important; background: none !important; }
  .page-hero { padding: var(--space-7) 0 var(--space-5); background: radial-gradient(36rem 16rem at 85% 0%, color-mix(in oklab, #22d3ee 14%, transparent), transparent 70%); }
  .page-hero__cta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); margin-top: var(--space-5); }
  .page-hero__cta p { margin: 0; flex: 1 1 14rem; color: var(--ink-2); }
  .prose { padding-bottom: var(--space-8); }
  .prose > * { max-inline-size: 100%; }
  .prose :is(h1) { font-size: var(--step-3); }
  .prose :is(h2) { font-size: var(--step-2); margin-top: var(--space-6); }
  .prose :is(h3) { margin-top: var(--space-5); }
  .prose :is(ul, ol) { padding-inline-start: 1.25rem; }
  .prose li { margin-bottom: .4rem; }
  .prose li::marker { color: var(--brand); }
  .prose table { border-collapse: collapse; inline-size: 100%; display: block; overflow-x: auto; }
  .prose :is(th, td) { border: 1px solid var(--line); padding: .5rem .75rem; text-align: start; vertical-align: top; }
  .prose :is(img, video) { border-radius: var(--radius-m); }
  .prose .section-card, .prose .card, .prose .release, .prose .faq-item, .prose .contact-card, .prose .step, .prose .flow-step, .prose .mockup-tile { background: var(--surface) !important; color: var(--ink) !important; border: 1px solid var(--line) !important; border-radius: var(--radius-m) !important; box-shadow: none !important; padding: var(--space-5); margin-block: var(--space-4); backdrop-filter: none !important; }
  .prose .section-card > :last-child { margin-bottom: 0; }
  .prose :is(.grid, .two-col) { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
  .prose :is(.grid, .two-col) > * { margin-block: 0; }
  .prose :is(.pill, .badge, .eyebrow) { display: inline-flex; align-items: center; gap: .4rem; font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--brand) !important; background: color-mix(in oklab, var(--brand) 10%, transparent) !important; border: 0 !important; border-radius: var(--radius-pill); padding: .3rem .7rem; margin-bottom: var(--space-3); }
  .prose .dot { inline-size: .45rem; block-size: .45rem; border-radius: 50%; background: var(--brand) !important; box-shadow: none !important; display: inline-block; }
  .prose :is(.lead, .thesis, .synopsis) { font-size: var(--step-1); color: var(--ink-2) !important; }
  .prose :is(.accent, .highlight) { color: var(--brand) !important; background: none !important; -webkit-text-fill-color: currentColor; }
  .prose :is(.meta, .delta-label) { color: var(--muted) !important; font-size: .85rem; }
  .prose :is(p, li, em, small, div) { color: var(--ink-2) !important; -webkit-text-fill-color: currentColor; }
  .prose :is(h1, h2, h3, h4, strong, b) { color: var(--ink) !important; -webkit-text-fill-color: currentColor; background: none !important; }
  .prose a, .prose a :is(strong, span, em) { color: var(--brand) !important; text-decoration: underline; -webkit-text-fill-color: currentColor; }
  .prose a.btn { text-decoration: none; }
  .prose a.btn-primary, .prose a.btn-primary * { color: var(--cta-ink) !important; }
  .prose .btn { display: inline-flex; align-items: center; justify-content: center; min-block-size: 2.75rem; padding: .55rem 1.1rem; border-radius: var(--radius-pill); border: 1px solid var(--line) !important; background: var(--surface) !important; color: var(--ink) !important; -webkit-text-fill-color: currentColor; text-decoration: none; font-weight: 600; font-family: var(--font-body) !important; letter-spacing: 0 !important; box-shadow: none !important; margin: .25rem .25rem .25rem 0; }
  .prose .btn-primary { background: var(--cta) !important; color: var(--cta-ink) !important; border-color: var(--cta) !important; }
  .prose :is(.btn-row, .quiet-links) { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
  .prose .release { container-type: inline-size; }
  .prose .release.current { border-color: var(--brand) !important; }
  .prose a { overflow-wrap: anywhere; }
}

@layer utilities {
  .vh { position: absolute !important; inline-size: 1px; block-size: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  [hidden] { display: none !important; }
}
