/* ═══════════════════════════════════════════════════════════
   MOBILE-FIRST OVERRIDES
   Loads last — patches & polishes mobile responsiveness across
   the entire formcierge-site theme.
   Breakpoints: 480px (xs) · 640px (sm) · 768px (md) · 900px (lg)
═══════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════
   1 · GLOBAL BASE
═══════════════════════════════════════════════════════════ */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Consistent touch targets */
button, a, [role="button"] {
  touch-action: manipulation;
}

/* ── Container ── */
@media (max-width: 640px) {
  .wrap          { padding: 0 18px; }
  .nav-inner     { padding: 0 18px; }
  .hero-inner    { padding: 0 18px; }
  .proof-inner   { padding: 0 18px; }
  .post-wrap     { padding: 0 18px; }
}
@media (max-width: 480px) {
  .wrap          { padding: 0 14px; }
  .nav-inner     { padding: 0 14px; }
  .hero-inner    { padding: 0 14px; }
  .proof-inner   { padding: 0 14px; }
  .post-wrap     { padding: 0 14px; }
}

/* ── Section vertical rhythm ── */
@media (max-width: 900px) {
  .sec   { padding: 64px 0; }
  .hero  { padding: 64px 0 48px; }
}
@media (max-width: 640px) {
  .sec   { padding: 48px 0; }
  .hero  { padding: 52px 0 36px; }
}
@media (max-width: 480px) {
  .sec   { padding: 40px 0; }
  .hero  { padding: 44px 0 28px; }
}

/* ── Section headings ── */
@media (max-width: 640px) {
  .sec-head      { margin-bottom: 36px; }
  h2.sec-h2      { font-size: clamp(28px, 8vw, 44px); line-height: 1.05; }
  .sec-sub       { font-size: 16px; }
}

/* ═══════════════════════════════════════════════════════════
   2 · NAVIGATION
═══════════════════════════════════════════════════════════ */

/* Nav height & logo */
@media (max-width: 480px) {
  .nav-inner { height: 60px; }
  .nav-logo  { height: 30px; }
}

/* Mobile menu — full-screen, beautiful */
@media (max-width: 768px) {
  .nav-mobile {
    padding: 0;
    background: var(--paper);
    display: none; /* toggled to flex via .open */
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-mobile.open { display: flex; }

  /* Top bar inside mobile menu */
  .nav-mobile::before {
    content: '';
    display: block;
    height: 68px;
    flex-shrink: 0;
    border-bottom: 1.5px dashed rgba(0,0,0,.18);
  }

  /* Close button — larger touch target */
  .nav-mobile-close {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    top: 12px;
    right: 16px;
  }

  /* Nav links in mobile overlay */
  .nav-mobile > a {
    font-size: 18px;
    font-weight: 700;
    padding: 16px 20px;
    border-bottom: 1.5px dashed rgba(0,0,0,.1);
    border-radius: 0;
    display: flex;
    align-items: center;
    color: var(--ink);
  }

  .nav-mobile > a:hover {
    background: rgba(0,0,0,.05);
  }

  .nav-mobile > a:last-of-type {
    border-bottom: 1.5px dashed rgba(0,0,0,.1);
  }

  /* CTA area */
  .nav-mobile-cta {
    margin: 20px;
    padding: 0;
    border-top: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .nav-mobile-cta .btn,
  .nav-mobile-cta a {
    width: 100%;
    justify-content: center;
    display: flex;
    text-align: center;
    border-radius: 999px;
    padding: 13px 20px;
    font-size: 16px;
    font-weight: 700;
    border-bottom: none !important;
  }

  .nav-mobile-cta a:not(.btn) {
    border: var(--border);
    box-shadow: var(--sh-sm);
    background: var(--box-bg);
    border-radius: 999px;
    color: var(--ink);
    font-family: var(--hand);
  }
}

/* ═══════════════════════════════════════════════════════════
   3 · HERO (homepage)
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .hero-h1    { font-size: clamp(36px, 11vw, 56px); line-height: .98; }
  .hero-sub   { font-size: 17px; margin-bottom: 28px; }
  .hero-tag   { margin-bottom: 14px; }
  .hero-btns  { flex-direction: column; align-items: center; gap: 10px; margin-bottom: 36px; }
  .hero-btns .btn { width: 100%; max-width: 280px; justify-content: center; padding: 14px 24px; font-size: 17px; }
  .hero-stats { gap: 24px; }
  .stat-num   { font-size: 34px; }
}

@media (max-width: 480px) {
  .hero-h1    { font-size: clamp(32px, 12vw, 48px); }
  .hero-sub   { font-size: 16px; }
  .hero-stats { gap: 16px; }
  .stat-num   { font-size: 28px; }
  .stat-lbl   { font-size: 10px; }
}

/* ═══════════════════════════════════════════════════════════
   4 · INNER PAGE HERO
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .page-hero      { padding: 52px 0 40px; }
  .page-hero h1   { font-size: clamp(32px, 8vw, 60px); margin-bottom: 14px; }
  .page-hero-sub  { font-size: 16px; margin-bottom: 22px; }
}

@media (max-width: 480px) {
  .page-hero      { padding: 40px 0 28px; }
  .page-hero h1   { font-size: clamp(28px, 9vw, 48px); }
  .page-hero-sub  { font-size: 15px; }
}

/* ═══════════════════════════════════════════════════════════
   5 · PROOF BAR
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .proof-inner  { gap: 20px; }
  .proof-div    { display: none; }
  .proof-stat   { text-align: center; }
  .proof-stat strong { font-size: 18px; }
}

@media (max-width: 480px) {
  .proof-inner  { flex-direction: column; gap: 14px; align-items: center; }
}

/* ═══════════════════════════════════════════════════════════
   6 · DARK DEMO SECTION
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .dark-video { min-height: 240px; }
  .play-btn   { width: 60px; height: 60px; font-size: 22px; }
  .demo-stats { grid-template-columns: 1fr 1fr; }
  .demo-stat  { padding: 16px 18px; }
  .demo-stat .sn { font-size: 34px; }
}

@media (max-width: 480px) {
  .demo-stats { grid-template-columns: 1fr 1fr; }
  .demo-stat  { padding: 14px 16px; }
  .demo-stat .sn { font-size: 28px; }
}

/* ═══════════════════════════════════════════════════════════
   7 · HOW IT WORKS + FEATURE GRID
═══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .steps-grid,
  .feat-grid  { grid-template-columns: 1fr; gap: 14px; }
  .step-card,
  .feat-card  { padding: 20px; }
  .step-num   { font-size: 40px; }
  .step-title { font-size: 20px; }
}

/* ═══════════════════════════════════════════════════════════
   8 · DEEPDIVE (feature detail split sections)
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .deepdive {
    grid-template-columns: 1fr !important;
    gap: 28px;
  }
  .deepdive-vis { min-height: 260px; }
  .deepdive-text h3 { font-size: clamp(22px, 5.5vw, 34px); }
}

@media (max-width: 480px) {
  .deepdive-vis { min-height: 200px; }
}

/* ═══════════════════════════════════════════════════════════
   9 · PRICING
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .pricing-grid { grid-template-columns: 1fr; max-width: 400px; margin: 0 auto; }
}

/* ═══════════════════════════════════════════════════════════
   10 · TESTIMONIALS
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .testi-grid { grid-template-columns: 1fr; gap: 14px; }
}

/* ═══════════════════════════════════════════════════════════
   11 · SCROLL STORY (cinematic)
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .scroll-story { height: 500vh; }
  .ss-stage     { grid-template-columns: 1fr; gap: 16px; }
  .ss-cap-col   { text-align: left; }
  .ss-dots      { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; }
  .ss-dot       { border-left: none; border-top: 2px dashed rgba(0,0,0,.12); padding-top: 6px; }
  .ss-h2        { font-size: clamp(26px, 7vw, 40px); }
  .ss-sub       { font-size: 15px; }
  .ss-device-wrap { display: none; } /* hide heavy device mockup on phones */
}

/* ═══════════════════════════════════════════════════════════
   12 · FOOTER
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .footer-grid  { grid-template-columns: 1fr; gap: 28px; }
  .footer-desc  { max-width: none; }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    font-size: 11px;
  }
}

/* ═══════════════════════════════════════════════════════════
   13 · BLOG LISTING
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .blog-grid    { grid-template-columns: 1fr; gap: 16px; }
  .blog-card    { border-radius: 12px; }
  .blog-card-title { font-size: 16px; }
}

@media (max-width: 480px) {
  .blog-hero-body { padding: 20px; }
  .blog-hero-title { font-size: clamp(18px, 5.5vw, 26px); }
  .blog-excerpt { font-size: 14px; }
}

/* ═══════════════════════════════════════════════════════════
   14 · SINGLE POST (prose readability)
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .post-header  { padding: 40px 0 28px; margin-bottom: 32px; }
  .post-title   { font-size: clamp(24px, 6.5vw, 40px); letter-spacing: -.02em; }
  .post-excerpt { font-size: 16px; }
  .post-thumb   { margin-bottom: 32px; border-radius: 10px; }
}

@media (max-width: 640px) {
  .post-content { font-size: 16px; line-height: 1.72; }
  .post-content h2 { font-size: clamp(20px, 5.5vw, 26px); margin-top: 2em; }
  .post-content h3 { font-size: clamp(17px, 4.5vw, 22px); }
  .post-content blockquote { padding: 16px 18px; }
  .post-content pre { font-size: 13px; padding: 16px; overflow-x: auto; }
}

@media (max-width: 480px) {
  .post-title { font-size: clamp(22px, 7vw, 34px); }
  .post-author img { width: 36px; height: 36px; }
}

/* Post nav prev/next */
@media (max-width: 480px) {
  .post-nav { grid-template-columns: 1fr !important; gap: 10px; }
}

/* ═══════════════════════════════════════════════════════════
   15 · COMPARE PAGES — comparison tables
   Both .comp-table (front-page) and .fcs-compare-table (pricing)
   are 5-column tables. On mobile we convert each row to a
   feature card: dark header + labelled tool rows below it.
   CSS-only — no HTML changes needed.
═══════════════════════════════════════════════════════════ */

/* ── Shared mixin values ──────────────────────────────────── */
/* card border / shadow / radius applied to both table types  */

@media (max-width: 680px) {

  /* ── comp-table (front-page "vs alternatives") ──────────── */
  .comp-table {
    display: block;
  }
  .comp-table thead {
    display: none;
  }
  .comp-table tbody {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .comp-table tr {
    display: block;
    border: 1.5px dashed rgba(0,0,0,.25);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 3px 3px 0 rgba(0,0,0,.07);
  }
  .comp-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border: none;
    border-bottom: 1px dashed rgba(0,0,0,.1);
    padding: 10px 14px;
    font-size: 13px;
  }
  .comp-table tr td:last-child { border-bottom: none; }

  /* Feature name — full-width dark title row
     !important needed: nth-child(even) rule in design-system.css
     has higher specificity and wins on rows 2 & 4 without it. */
  .comp-table td:first-child {
    background: var(--ink, #1a1a1a) !important;
    color: var(--paper, #fafaf8) !important;
    font-family: var(--display, 'Gloria Hallelujah', cursive);
    font-size: 14px;
    font-weight: 400;
    justify-content: flex-start;
    border-bottom: none;
    padding: 12px 16px;
  }

  /* Tool name labels via ::before — no HTML changes needed */
  .comp-table td:not(:first-child)::before {
    font-family: var(--mono, 'JetBrains Mono', monospace);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-3, #666);
    flex-shrink: 0;
    white-space: nowrap;
  }
  .comp-table td:nth-child(2)::before { content: '⚡ Formcierge'; color: var(--accent, #0f74c5); font-weight: 700; }
  .comp-table td:nth-child(3)::before { content: 'Gravity Forms'; }
  .comp-table td:nth-child(4)::before { content: 'WPForms'; }
  .comp-table td:nth-child(5)::before { content: 'Typeform'; }

  /* Highlight Formcierge row */
  .comp-table td:nth-child(2) { background: rgba(15,116,197,.06); }

  /* ── fcs-compare-table (pricing page partial) ───────────── */
  body.paper-bg .fcs-compare-wrap {
    border: none;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
    background: transparent;
  }
  body.paper-bg .fcs-compare-table {
    display: block;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }
  body.paper-bg .fcs-compare-table thead { display: none; }
  body.paper-bg .fcs-compare-table tbody {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  body.paper-bg .fcs-compare-table tr {
    display: block;
    border: 1.5px dashed rgba(0,0,0,.25) !important;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 3px 3px 0 rgba(0,0,0,.07);
    background: var(--box-bg, #fffdf7) !important;
  }
  body.paper-bg .fcs-compare-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border: none !important;
    border-bottom: 1px dashed rgba(0,0,0,.1) !important;
    background: none !important;
    padding: 10px 14px;
    font-size: 13px;
  }
  body.paper-bg .fcs-compare-table tr td:last-child { border-bottom: none !important; }

  /* Feature name row */
  body.paper-bg .fcs-compare-table td:first-child {
    background: var(--ink, #1a1a1a) !important;
    color: var(--paper, #fafaf8) !important;
    font-family: var(--display, 'Gloria Hallelujah', cursive);
    font-size: 14px;
    font-weight: 400;
    justify-content: flex-start;
    border-bottom: none !important;
    padding: 12px 16px;
  }

  /* Tool labels */
  body.paper-bg .fcs-compare-table td:not(:first-child)::before {
    font-family: var(--mono, 'JetBrains Mono', monospace);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-3, #666);
    flex-shrink: 0;
    white-space: nowrap;
  }
  body.paper-bg .fcs-compare-table td:nth-child(2)::before { content: '⚡ Formcierge'; color: var(--accent, #0f74c5); font-weight: 700; }
  body.paper-bg .fcs-compare-table td:nth-child(3)::before { content: 'Gravity Forms'; }
  body.paper-bg .fcs-compare-table td:nth-child(4)::before { content: 'WPForms'; }
  body.paper-bg .fcs-compare-table td:nth-child(5)::before { content: 'Typeform'; }

  /* Formcierge row highlight */
  body.paper-bg .fcs-compare-table td:nth-child(2) { background: rgba(15,116,197,.06) !important; }

  /* Disable hover state on mobile */
  body.paper-bg .fcs-compare-table tr:hover td { background: none !important; }
  body.paper-bg .fcs-compare-table tr:hover td:nth-child(2) { background: rgba(15,116,197,.06) !important; }

  /* Other grid utilities on compare pages */
  .cmp-price-grid { grid-template-columns: 1fr; gap: 14px; }
  .cmp-hub-grid   { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════
   16 · FEATURE CATEGORY GRID (features overview page)
═══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .feat-cat-grid { grid-template-columns: 1fr; gap: 12px; }
  .feature-split { gap: 24px; }
}

/* ═══════════════════════════════════════════════════════════
   17 · DASHBOARD (customer account)
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .dash-main    { padding: 20px; }
  .dash-panel-title { font-size: 20px; }
  .dash-stat    { padding: 16px 18px; }
  .dash-stat-num { font-size: 28px; }
  .dash-nav-btn { min-width: 80px; padding: 8px 10px; font-size: 12px; }
  .dash-order-row { flex-direction: column; gap: 8px; }
  .dash-dl-row  { flex-wrap: wrap; gap: 10px; }
}

@media (max-width: 480px) {
  .dash-auth    { padding: 40px 16px 48px; }
  .dash-auth-card { padding: 28px 18px; }
  .dash-nav     { gap: 6px; }
  .dash-nav-btn { padding: 8px; font-size: 11px; min-width: 70px; }
}

/* ═══════════════════════════════════════════════════════════
   18 · AUTH PAGES (login / forgot / reset)
═══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .fcs-auth-page  { padding: 32px 14px 48px; }
  .fcs-auth-card  { padding: 28px 18px 24px; border-radius: 14px; }
  .fcs-auth-title { font-size: 20px; }
  .fcs-auth-emoji { font-size: 36px; margin-bottom: 10px; }
  .fcs-auth-tabs  { margin-bottom: 22px; }
}

/* ═══════════════════════════════════════════════════════════
   19 · PRICING PAGE (pricing-specific sections)
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .fcs-addon-grid,
  .fcs-addon-cards { grid-template-columns: 1fr; }
  .fcs-faq-item     { padding: 18px 0; }
  .fcs-faq-q        { font-size: 17px; }
}

/* ═══════════════════════════════════════════════════════════
   20 · BUTTONS — better touch targets
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .btn--lg { padding: 13px 26px; font-size: 16px; }
  .btn     { min-height: 44px; }
}

/* ═══════════════════════════════════════════════════════════
   21 · FAQ
═══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .faq-q  { font-size: 16px; padding: 18px 0; }
  .faq-a  { font-size: 14px; padding-bottom: 18px; }
}

/* ═══════════════════════════════════════════════════════════
   22 · CHANGELOG & ROADMAP
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .fcs-changelog-item { padding: 20px; border-radius: 12px; }
  .fcs-version-badge  { font-size: 11px; }
}

/* ═══════════════════════════════════════════════════════════
   23 · TESTIMONIAL / TRUST
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .trust-logos  { gap: 16px; }
  .trust-logo   { height: 22px; }
}

/* ═══════════════════════════════════════════════════════════
   24 · BACK-TO-TOP BUTTON — smaller on mobile
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .btt-btn { width: 40px; height: 40px; bottom: 20px; right: 16px; }
  .btt-tip { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   25 · SKIP-TO-CONTENT (accessibility)
═══════════════════════════════════════════════════════════ */
.skip-link {
  position: absolute;
  top: -100px;
  left: 20px;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  z-index: 10000;
  transition: top .15s;
}
.skip-link:focus { top: 14px; }

/* ═══════════════════════════════════════════════════════════
   26 · DARK SECTIONS ON MOBILE
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .dark-demo { padding: 48px 0; }
  .dark-demo-hdr { flex-direction: column; align-items: flex-start; gap: 12px; }
  .dark-demo-hdr p { text-align: left; max-width: none; }
}

/* ═══════════════════════════════════════════════════════════
   27 · SCROLL STORY — disable heavy parallax on mobile
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  /* Convert sticky scroll story to a normal section on phones */
  .scroll-story         { height: auto !important; }
  .ss-track             { position: static !important; height: auto; min-height: 0; padding: 40px 0; }
  .ss-track.ss-fixed    { position: static !important; }
  .ss-track.ss-bottom   { position: static !important; }
  .ss-inner             { flex-direction: column; gap: 24px; }
  .ss-skip              { display: none !important; }
  .ss-stage             { display: grid; grid-template-columns: 1fr; gap: 20px; }
}

/* ═══════════════════════════════════════════════════════════
   28 · GENERAL CARD RADIUS & SHADOWS ON MOBILE
═══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .feat-card, .step-card, .fcs-auth-card {
    box-shadow: 4px 4px 0 #000;
  }
  .fcs-auth-card {
    box-shadow: 4px 4px 0 #000;
  }
}

/* ═══════════════════════════════════════════════════════════
   29 · AFFILIATE PAGE
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .aff-hero      { padding: 48px 0 36px; }
  .aff-hero h1   { font-size: clamp(28px, 8vw, 44px); }
  .aff-steps     { grid-template-columns: 1fr; gap: 14px; }
}

/* ═══════════════════════════════════════════════════════════
   30 · HORIZONTAL OVERFLOW PREVENTION
═══════════════════════════════════════════════════════════ */
body { overflow-x: hidden; }

.wrap, .nav-inner, .hero-inner, .post-wrap,
.dark-demo, .proof-bar, .footer-grid {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Large tables — allow horizontal scroll */
.fcs-compare-table-wrap,
.post-content table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: block;
}

/* ═══════════════════════════════════════════════════════════
   31 · SMOOTH MOMENTUM SCROLLING
═══════════════════════════════════════════════════════════ */
@supports (-webkit-overflow-scrolling: touch) {
  body { -webkit-overflow-scrolling: touch; }
}
