/* ==========================================================================
   Yapdoc — design system (mobile-first)
   Spacing philosophy: generous rhythm inspired by Linear / Stripe / Apple.
   Mobile first; desktop enhancements via min-width media queries.
   ========================================================================== */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f0f3f7;
  --text: #0f1a24;
  --muted: #5c6b7a;
  --primary: #0e6ea8;
  --primary-strong: #0a5a89;
  --primary-soft: #e3f0fa;
  --accent: #0e7c66;
  --accent-soft: #e3f3ee;
  --border: #e5eaf0;
  --shadow-sm: 0 1px 2px rgb(15 26 36 / 5%);
  --shadow: 0 2px 6px rgb(15 26 36 / 5%), 0 12px 32px rgb(15 26 36 / 9%);
  --shadow-lg: 0 24px 64px rgb(15 26 36 / 16%);
  --radius: 18px;
  --radius-sm: 12px;
  --nav-h: 64px;
  /* 8pt rhythm */
  --s1: 8px;  --s2: 16px; --s3: 24px; --s4: 32px;
  --s5: 48px; --s6: 64px; --s7: 88px; --s8: 120px;
  --section-y: clamp(72px, 9vw, 120px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1118;
    --surface: #141d28;
    --surface-2: #1a2532;
    --text: #e9eef4;
    --muted: #93a5b5;
    --primary: #6cc0f5;
    --primary-strong: #8fd0f8;
    --primary-soft: #122a3e;
    --accent: #58c9ab;
    --accent-soft: #0f2b24;
    --border: #243444;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow: 0 2px 6px rgb(0 0 0 / 35%), 0 12px 32px rgb(0 0 0 / 30%);
    --shadow-lg: 0 24px 64px rgb(0 0 0 / 45%);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 1.03rem;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--primary); color: #fff;
  padding: 12px 20px; border-radius: 0 0 12px 0; z-index: 100;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

::selection { background: var(--primary-soft); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-wrap {
  max-width: 1120px;
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  flex: none;
}
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-links > a {
  color: var(--text);
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 0.96rem;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.nav-links > a:hover { background: var(--surface-2); text-decoration: none; }
.nav-links > a[aria-current="page"] {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 700;
}
.nav-cta { margin-left: 12px; }

.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  color: var(--text);
}
.nav-toggle svg { margin: auto; }

@media (max-width: 880px) {
  .nav-toggle { display: grid; }
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 12px 16px 20px;
  }
  .nav-links.open { display: flex; }
  .nav-links > a {
    padding: 16px;
    font-size: 1.08rem;
    border-radius: 14px;
    min-height: 56px;
    display: flex;
    align-items: center;
  }
  .nav-cta { margin: 10px 0 0; text-align: center; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--primary);
  color: #fff;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  border: 2px solid transparent;
  cursor: pointer;
  min-height: 52px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}
.btn:hover {
  text-decoration: none;
  filter: brightness(1.06);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.btn:active { transform: translateY(0); }
.btn.secondary {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--border);
}
.btn.secondary:hover { border-color: var(--primary); }
.btn.small { padding: 10px 20px; min-height: 44px; font-size: 0.9rem; }

@media (max-width: 520px) {
  .hero-actions .btn { width: 100%; }
}

/* ---------- Layout & rhythm ---------- */
main { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
section {
  padding: var(--section-y) 0;
  scroll-margin-top: calc(var(--nav-h) + 16px);
}
section + section { border-top: 1px solid var(--border); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px 15px;
  border-radius: 999px;
  margin-bottom: 20px;
}
h1 {
  font-size: clamp(2.35rem, 7.5vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 800;
}
h2 {
  font-size: clamp(1.65rem, 4.5vw, 2.4rem);
  letter-spacing: -0.025em;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 16px;
}
h3 { font-size: 1.15rem; font-weight: 700; }
.lead {
  color: var(--muted);
  font-size: clamp(1.05rem, 2.6vw, 1.25rem);
  line-height: 1.65;
  max-width: 620px;
}
.section-head { max-width: 760px; margin-bottom: clamp(32px, 5vw, 56px); }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head.center .lead { margin-inline: auto; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: clamp(56px, 8vw, 110px) 0 clamp(64px, 9vw, 120px);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -30% -20% auto;
  height: 140%;
  background:
    radial-gradient(640px 340px at 12% 18%, var(--primary-soft), transparent 70%),
    radial-gradient(540px 320px at 88% 8%, var(--accent-soft), transparent 70%);
  pointer-events: none;
}
.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(32px, 6vw, 72px);
  align-items: center;
}
.hero .lead { margin: 22px 0 34px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.87rem;
  font-weight: 600;
}

/* Phone mockup */
.phone {
  width: min(310px, 82vw);
  margin-inline: auto;
  border-radius: 42px;
  border: 9px solid var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  aspect-ratio: 9 / 18.5;
}
.phone-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding: 20px 16px;
  gap: 13px;
}
.phone-greeting { font-weight: 800; font-size: 1.05rem; }
.phone-search {
  background: var(--surface-2);
  border-radius: 13px;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 10px 13px;
}
.phone-scan {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  text-align: center;
  font-weight: 700;
  border-radius: 16px;
  padding: 14px;
  font-size: 0.97rem;
}
.phone-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 12px 13px;
  display: flex;
  gap: 11px;
  align-items: center;
}
.phone-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--primary-soft);
  display: grid;
  place-items: center;
  font-size: 1rem;
  flex: none;
}
.phone-card .t { font-weight: 700; font-size: 0.84rem; }
.phone-card .s { color: var(--muted); font-size: 0.73rem; }
.phone-conf {
  margin-left: auto;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.73rem;
  border-radius: 999px;
  padding: 4px 10px;
}

@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; gap: 0; }
  .phone { display: none; }
}

/* ---------- Cards ---------- */
.grid { display: grid; gap: 20px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 940px) { .grid.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) {
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(24px, 3vw, 32px);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card .icon {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  background: var(--primary-soft);
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  margin-bottom: 20px;
}
.card p { color: var(--muted); font-size: 0.97rem; margin-top: 8px; }
.card h3 { margin-bottom: 6px; }

/* Steps */
.steps { counter-reset: step; }
.step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 30px 30px 82px;
  min-height: 140px;
}
.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 24px;
  top: 28px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.step h3 { margin-bottom: 6px; }
.step p { color: var(--muted); font-size: 0.97rem; }

/* Pricing */
.price-card { position: relative; display: flex; flex-direction: column; }
.price-card .price {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 10px 0 2px;
}
.price-card .per { color: var(--muted); font-size: 0.92rem; }
.price-card ul {
  list-style: none;
  margin: 22px 0 28px;
  display: grid;
  gap: 12px;
}
.price-card li { display: flex; gap: 11px; align-items: flex-start; font-size: 0.97rem; }
.price-card li::before { content: "✓"; color: var(--accent); font-weight: 800; }
.price-card .btn { margin-top: auto; width: 100%; }
.price-card.popular { border: 2px solid var(--primary); box-shadow: var(--shadow-lg); }
.popular-tag {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 5px 16px;
}

/* FAQ */
details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  overflow: hidden;
}
details summary {
  cursor: pointer;
  padding: 20px 24px;
  font-weight: 700;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  min-height: 56px;
}
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; font-size: 1.4rem; color: var(--primary); font-weight: 700; }
details[open] summary::after { content: "–"; }
details .faq-body {
  padding: 0 24px 22px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.7;
}

/* Download list */
.dl-list { display: grid; gap: 16px; }
.dl-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.dl-item .name { font-weight: 700; word-break: break-all; }
.dl-item .meta { color: var(--muted); font-size: 0.88rem; width: 100%; }
.dl-item .grow { flex: 1; min-width: 220px; }
.hash {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  word-break: break-all;
  display: block;
  margin-top: 8px;
  color: var(--muted);
}
.copy-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}
.copy-btn:hover { border-color: var(--primary); color: var(--primary); }
@media (max-width: 640px) {
  .dl-item { display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .dl-item .meta { grid-column: 1 / -1; width: auto; margin-top: -4px; }
  .dl-item .copy-btn { order: 3; }
  .dl-item .btn { order: 4; }
  .dl-item .grow { grid-column: 1 / -1; }
}

.notice {
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 24px 0;
  font-size: 0.97rem;
}

/* Prose pages */
.prose { max-width: 780px; }
.prose h2 { margin-top: 44px; }
.prose p, .prose li { color: var(--muted); }
.prose ul, .prose ol { padding-left: 24px; margin: 16px 0; display: grid; gap: 8px; }
.prose strong { color: var(--text); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 0;
  background: var(--surface);
}
.footer-grid {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(44px, 6vw, 72px) 24px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
}
.footer-grid h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 16px;
}
.footer-grid a { display: block; color: var(--text); padding: 6px 0; font-size: 0.95rem; }
.footer-grid a:hover { color: var(--primary); text-decoration: none; }
.footer-brand p { color: var(--muted); font-size: 0.94rem; max-width: 300px; margin-top: 12px; }
.footer-bottom {
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
  padding: 22px;
}
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px 24px; }
}

/* Scroll reveal (progressive enhancement, JS adds .in) */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.5s ease, transform 0.5s ease;
  }
  .reveal.in { opacity: 1; transform: none; }
}

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