/* ============================================================
   Hybrid — Web styles
   Slab design system, ported from the iOS app
   (ios/Hybrid/DesignSystem/Slab.swift). Light-led: bone bg,
   ink text, Electric Blue accent. Archivo Black display,
   Inter body, IBM Plex Mono data.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&family=IBM+Plex+Mono:wght@400;500&family=Inter:wght@400;500;600&display=swap');

/* ---- Design tokens (exact Slab.swift values) ---- */
:root {
  --bg:          #F4F3F1;                 /* bone */
  --raise:       #FAFAF8;                 /* cards */
  --ink:         #2D2D2D;
  /* Slab's ink@50% / ink@30% render 2.87:1 and 1.79:1 on bone — both fail
     WCAG AA for text (4.5:1). Strengthened to the lightest values that pass
     while keeping two distinct tiers: 6.4:1 and 4.7:1. */
  --muted:       rgba(45, 45, 45, 0.78);
  --faint:       rgba(45, 45, 45, 0.68);
  --line:        rgba(45, 45, 45, 0.13);
  --line-strong: rgba(45, 45, 45, 0.24);
  --surface:     rgba(45, 45, 45, 0.035);
  --blue:        #3171C6;                 /* Electric Blue — fills, large type */
  /* Pure white on Electric Blue is 4.88:1 (AA); bone (#F4F3F1) was only 4.39:1. */
  --blue-ink:    #FFFFFF;                 /* text on blue */
  --blue-soft:   rgba(49, 113, 198, 0.10);
  /* Electric Blue is 4.39:1 on bone — fine for fills and large display type,
     just under AA for body-size text. This darker step (5.4:1) is for blue text. */
  --blue-text:   #2A63AE;
  --danger:      #B4533A;                 /* borders, icons */
  --danger-text: #8E3F2B;                 /* AA-passing danger text */

  --font-display: 'Archivo Black', 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --space-xs: 6px; --space-sm: 10px; --space-md: 16px;
  --space-lg: 24px; --space-xl: 36px;
  --corner: 14px; --field-corner: 10px;
  --maxw: 1080px; --nav-h: 64px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth; -webkit-text-size-adjust: 100%;
  /* Keep anchored sections clear of the sticky nav — without this, tapping
     "Engine"/"Method"/"FAQ" lands their headings underneath it. */
  scroll-padding-top: calc(var(--nav-h) + 16px);
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--ink);
  line-height: 1.6; font-size: 16px;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ---- Utilities ---- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--space-lg); }
.section { padding: 96px 0; }
.section--tight { padding: 64px 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.secondary { color: var(--muted); }
.accent { color: var(--blue); }
/* Inline links in body copy need a non-colour cue (and AA-strength blue) so they
   don't rely on hue alone to read as links. */
a.accent { color: var(--blue-text); text-decoration: underline; text-underline-offset: 3px; }
.nowrap { white-space: nowrap; }

.overline {
  font-size: 12px; font-weight: 600; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--blue-text);
}
.label-slab {
  font-family: var(--font-display); font-weight: 400;
  text-transform: uppercase; letter-spacing: 0.08em; font-size: 15px;
}

/* ---- Type scale ---- */
h1, h2 { font-family: var(--font-display); font-weight: 400; line-height: 1.05; letter-spacing: -0.01em; color: var(--ink); }
h3, h4 { font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: clamp(38px, 6vw, 60px); }
h2 { font-size: clamp(26px, 4vw, 38px); }
h3 { font-size: clamp(19px, 2.4vw, 24px); }
h4 { font-size: 17px; }
p  { color: var(--muted); }
.lede { font-size: clamp(17px, 2vw, 20px); color: var(--muted); line-height: 1.6; }

/* ---- Scroll reveal (progressive enhancement) ---- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s cubic-bezier(.22, 1, .36, 1); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm);
  height: 52px; padding: 0 28px;
  font-family: inherit; font-size: 16px; font-weight: 600;
  border-radius: var(--field-corner); border: 1px solid transparent;
  cursor: pointer; transition: background .15s ease, transform .15s cubic-bezier(.32, 1.6, .5, 1), border-color .15s ease, color .15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--blue); color: var(--blue-ink); }
.btn--primary:hover { background: #2A63AE; }
.btn--secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--secondary:hover { border-color: var(--blue); color: var(--blue-text); }
.btn--ghost { background: transparent; color: var(--muted); height: auto; padding: 0; }
.btn--ghost:hover { color: var(--blue-text); transform: none; }
.btn--sm { height: 44px; padding: 0 18px; font-size: 14px; }
.btn--block { width: 100%; }

/* ============================================================
   Navigation
   ============================================================ */
.nav {
  position: sticky; top: 0; z-index: 50; height: var(--nav-h);
  background: rgba(244, 243, 241, 0.88);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav__inner { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.nav__links { display: flex; align-items: center; gap: 28px; }
.nav__links a { color: var(--muted); font-size: 14px; font-weight: 500; transition: color .15s; }
.nav__links a:hover { color: var(--ink); }
.nav__cta { display: flex; align-items: center; gap: 14px; }

.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand__mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--blue);
  display: grid; place-items: center;
  color: var(--blue-ink); font-family: var(--font-display); font-weight: 400; font-size: 15px;
}
.brand__word { font-family: var(--font-display); font-weight: 400; font-size: 17px; letter-spacing: 0.02em; text-transform: uppercase; }

.nav__toggle {
  display: none; background: none; border: 0; color: var(--ink); cursor: pointer;
  padding: 10px; min-width: 44px; min-height: 44px;   /* Apple HIG tap target */
  align-items: center; justify-content: center;
}

/* ============================================================
   Cards / grids / section heads
   ============================================================ */
.grid { display: grid; gap: var(--space-md); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--raise); border: 1px solid var(--line);
  border-radius: var(--corner); padding: 28px;
  transition: border-color .2s ease, transform .2s ease;
}
.card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.card h3 { font-size: 19px; margin-bottom: 8px; }
.card p { font-size: 15px; }

.section__head { max-width: 680px; margin: 0 auto 56px; text-align: center; }
.section__head h2 { margin: 14px 0 14px; }
.section__head p { font-size: 17px; }

.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--raise); font-size: 13px; color: var(--muted);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }

/* ============================================================
   Pricing
   ============================================================ */
.toggle {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--raise); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 4px; margin: 0 auto 40px;
}
.toggle button {
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--muted);
  background: transparent; border: 0; cursor: pointer;
  padding: 9px 20px; border-radius: 999px; transition: all .15s ease;
}
.toggle button.is-active { background: var(--blue); color: var(--blue-ink); }
.toggle .save { font-size: 11px; color: var(--blue-text); margin-left: 6px; }
.toggle button.is-active .save { color: var(--blue-ink); }

.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 360px)); gap: var(--space-md); justify-content: center; }
.plan { background: var(--raise); border: 1px solid var(--line); border-radius: var(--corner); padding: 34px; }
.plan--featured { border-color: var(--blue); position: relative; background: linear-gradient(180deg, var(--blue-soft), var(--raise) 55%); }
.plan__tag {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--blue); color: var(--blue-ink);
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 5px 12px; border-radius: 999px;
}
.plan__name { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.plan__price { display: flex; align-items: baseline; gap: 6px; margin: 16px 0 4px; }
.plan__amount { font-family: var(--font-display); font-weight: 400; font-size: 44px; letter-spacing: -0.02em; }
.plan__period { color: var(--muted); font-size: 15px; }
.plan__sub { color: var(--muted); font-size: 13px; min-height: 18px; margin-bottom: 24px; }
.plan ul { list-style: none; display: grid; gap: 12px; margin-bottom: 28px; }
.plan li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--ink); }
.plan li svg { flex: 0 0 auto; margin-top: 3px; color: var(--blue); }
.price-annual { display: none; }

/* ============================================================
   FAQ (accordion)
   ============================================================ */
.faq { max-width: 760px; margin: 0 auto; }
.faq__item { border-bottom: 1px solid var(--line); }
.faq__q {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  font-family: inherit; font-size: 17px; font-weight: 500; color: var(--ink);
  padding: 24px 40px 24px 0; position: relative;
}
.faq__q::after {
  content: "+"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  font-size: 24px; color: var(--blue); font-weight: 400; transition: transform .2s ease;
}
.faq__item.is-open .faq__q::after { content: "\2212"; }
.faq__a { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.faq__a p { padding: 0 0 24px; color: var(--muted); font-size: 15px; }

/* ============================================================
   Footer
   ============================================================ */
.footer { border-top: 1px solid var(--line-strong); padding: 56px 0 40px; background: var(--surface); }
.footer__top { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; margin-bottom: 40px; }
.footer__brand { max-width: 280px; }
.footer__brand p { font-size: 14px; color: var(--muted); margin-top: 12px; }
.footer__cols { display: flex; gap: 64px; flex-wrap: wrap; }
.footer__col h5 { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); margin-bottom: 14px; }
.footer__col a { display: block; color: var(--muted); font-size: 14px; padding: 5px 0; transition: color .15s; }
.footer__col a:hover { color: var(--blue-text); }
.footer__bottom { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding-top: 28px; border-top: 1px solid var(--line); font-size: 13px; color: var(--faint); }

/* ============================================================
   Content pages (legal / support / checkout / status)
   ============================================================ */
.page { padding: 72px 0 96px; }
.page--narrow { max-width: 760px; margin: 0 auto; }
.page h1 { font-size: clamp(30px, 5vw, 40px); margin-bottom: 8px; }
.page .updated { color: var(--faint); font-size: 14px; margin-bottom: 40px; }
.prose h2 { font-size: 22px; margin: 40px 0 12px; }
.prose h3 { font-size: 18px; margin: 28px 0 8px; }
.prose p, .prose li { color: var(--ink); font-size: 16px; line-height: 1.7; }
.prose ul, .prose ol { margin: 12px 0 12px 22px; display: grid; gap: 8px; }
/* :not(.btn) so a button inside prose keeps its own fill/text colours. */
.prose a:not(.btn) { color: var(--blue-text); text-decoration: underline; text-underline-offset: 3px; }
.prose strong { color: var(--ink); }

.status { min-height: calc(100vh - var(--nav-h)); display: grid; place-items: center; text-align: center; padding: 60px var(--space-lg); }
/* 100vh on iOS Safari is the URL-bar-retracted height, so the block ends up
   taller than what's actually visible. dvh tracks the real viewport. */
@supports (height: 100dvh) {
  .status { min-height: calc(100dvh - var(--nav-h)); }
}
.status__inner { max-width: 480px; }
.status__icon { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 28px; }
.status__icon--ok { background: var(--blue-soft); color: var(--blue); border: 1px solid var(--blue); }
.status__icon--warn { background: rgba(180, 83, 58, 0.10); color: var(--danger); border: 1px solid var(--danger); }
.status h1 { font-size: 30px; margin-bottom: 12px; }
.status p { margin-bottom: 28px; }

.checkout { max-width: 520px; margin: 0 auto; }
.checkout__card { background: var(--raise); border: 1px solid var(--line); border-radius: var(--corner); padding: 32px; }
.checkout__row { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.checkout__row:last-of-type { border-bottom: 0; }
.checkout__total { display: flex; justify-content: space-between; align-items: baseline; padding: 20px 0 24px; }
.checkout__total .amt { font-family: var(--font-display); font-weight: 400; font-size: 30px; }
.opt {
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid var(--line-strong); border-radius: var(--field-corner);
  padding: 16px 18px; cursor: pointer; transition: border-color .15s, background .15s; margin-bottom: 12px;
}
.opt.is-active { border-color: var(--blue); background: var(--blue-soft); }
.opt__label { font-weight: 600; }
.opt__price { color: var(--muted); }
.opt__radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); flex: 0 0 auto; }
.opt.is-active .opt__radio { border-color: var(--blue); background: radial-gradient(circle, var(--blue) 0 5px, transparent 6px); }
.trust { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; font-size: 13px; color: var(--faint); }

.notice {
  background: rgba(180, 83, 58, 0.07); border: 1px solid var(--danger);
  border-radius: var(--field-corner); padding: 14px 16px; font-size: 13px; color: var(--ink);
  margin: 20px 0;
}
.notice strong { color: var(--danger-text); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 860px) {
  .grid--3 { grid-template-columns: 1fr; }
  .grid--2 { grid-template-columns: 1fr; }
  .plans { grid-template-columns: 1fr; max-width: 400px; margin: 0 auto; }
  .nav__links { display: none; }
  .nav__toggle { display: inline-flex; }
  .nav.is-open .nav__links {
    display: flex; flex-direction: column; gap: 0;
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px var(--space-lg);
  }
  .nav.is-open .nav__links a { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .section { padding: 72px 0; }
  .footer__top { flex-direction: column; }
}

/* ============================================================
   Touch devices: bigger tap targets, no sticky hover states
   ============================================================ */
@media (pointer: coarse) {
  /* Apple HIG asks for 44x44. These read fine with a mouse but are small
     under a thumb, so they only grow on touch. */
  .footer__col a { display: flex; align-items: center; min-height: 44px; padding: 0; }
  .brand { min-height: 44px; }
  .btn--ghost { min-height: 44px; }
  .toggle button { min-height: 44px; }
  .faq__q { padding-top: 20px; padding-bottom: 20px; }
  /* A tapped element keeps :hover on iOS until you tap elsewhere, which leaves
     the lift transforms stuck. Colour-only hover feedback is harmless. */
  .btn:hover, .card:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
