/* Responsive overrides — layered on top of app.css + app-extras.css
 * The prototype is designed at 1280px. Below that we progressively:
 *   ≤1080 — shrink gutters & headings
 *   ≤840  — stack 2-col grids, swap nav for hamburger + drawer, vertical timeline
 *   ≤540  — single-column everything, full-width buttons
 */

/* ── Hamburger button + drawer (hidden at desktop) ─────────── */
.nav-burger {
  display: none;
  width: 40px; height: 40px;
  padding: 10px;
  border-radius: 8px;
  background: transparent;
  flex-direction: column; justify-content: space-between;
  align-items: stretch;
}
.nav-burger span {
  display: block;
  height: 2px; width: 100%;
  background: var(--fq-ink);
  border-radius: 2px;
  transition: transform .25s ease, opacity .2s ease;
  transform-origin: center;
}
.nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-drawer {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.nav-drawer.open { opacity: 1; pointer-events: auto; }
.nav-drawer-panel {
  position: absolute; top: 0; right: 0;
  width: min(360px, 86vw); height: 100%;
  background: #fff;
  padding: 88px 28px 32px;
  display: flex; flex-direction: column; gap: 4px;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.22,.61,.36,1);
  box-shadow: -20px 0 60px -20px rgba(16,24,40,0.25);
  overflow-y: auto;
}
.nav-drawer.open .nav-drawer-panel { transform: translateX(0); }
.nav-drawer-panel a:not(.btn) {
  font-family: var(--fq-font-display);
  font-size: 20px; font-weight: 500;
  color: var(--fq-ink);
  padding: 14px 4px;
  border-bottom: 1px solid var(--fq-border);
}
.nav-drawer-panel a:not(.btn).active { color: var(--fq-blue); }
.nav-drawer-cta { margin-top: 24px; justify-content: center; font-size: 15px; padding: 14px 22px; }

/* ── ≤ 1080px — tight tablet landscape ─────────────────────── */
@media (max-width: 1080px) {
  .nav, .topbar { padding-left: 24px; padding-right: 24px; }
  .hero, .about, .pillars, .ecosystem, .qwenda,
  .founders, .stats, .timeline, .subscribe, .trust {
    padding-left: 24px; padding-right: 24px;
  }
  .hero-copy h1 { font-size: 56px; }
  .about h2,
  .eco-head h2,
  .pillars-head h2 { font-size: 44px; }
  .qwenda-head h2 { font-size: 48px; }
  .about-inner,
  .eco-head,
  .pillars-head { gap: 48px; }
}

/* ── ≤ 840px — tablet portrait, start stacking ─────────────── */
@media (max-width: 840px) {
  .nav-links { display: none; }
  .nav-cta { display: none; }
  .nav-burger { display: inline-flex; }
  .nav { padding: 12px 20px; gap: 12px; }

  .topbar { flex-wrap: wrap; gap: 10px 16px; justify-content: center; padding: 10px 20px; }
  .topbar .divider { display: none; }

  /* Hero */
  .hero { grid-template-columns: 1fr; gap: 40px; padding: 48px 20px 64px; }
  .hero-copy h1 { font-size: 44px; }
  .hero-copy .lead { font-size: 17px; max-width: none; }
  .hero-art { min-height: 380px; height: 420px; }
  .hero-meta { flex-wrap: wrap; gap: 20px 32px; }
  .hero-meta > div { min-width: 140px; }

  /* Trust strip — stack label above the marquee on mobile,
     speed up the loop slightly so it doesn't feel idle. */
  .trust-inner {
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
  }
  .trust-marquee { width: 100%; }
  .trust-marquee-row { animation-duration: 32s; }
  .trust-track { gap: 36px; padding-right: 36px; }
  .trust-logo { height: 32px; max-width: 140px; }

  /* About */
  .about { padding: 72px 20px; }
  .about-inner { grid-template-columns: 1fr; gap: 28px; }
  .about h2 { font-size: 38px; }
  .about-body p { font-size: 17px; }

  /* Ecosystem */
  .ecosystem { padding: 72px 20px; }
  .eco-head { grid-template-columns: 1fr; gap: 20px; margin-bottom: 40px; }
  .eco-head h2 { font-size: 36px; }
  .eco-map { grid-template-columns: 1fr; padding: 40px 24px; gap: 28px; }
  .eco-map::before { display: none; }
  .eco-center-q::before,
  .eco-center-q::after { display: none; }

  /* FAIR — mobile: pin the stage, translate cards horizontally as user scrolls vertically */
  .fair-head-wrap { padding: 72px 20px 20px; }
  .fair-head h2 { font-size: 40px; }
  .fair-split {
    padding: 0;
    height: 600vh;            /* more scroll distance so cards pass slowly */
    position: relative;
  }
  .fair-stage {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    gap: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    padding-top: 72px;        /* clear the sticky nav (which overlays y=0..72) */
    box-sizing: border-box;
    overflow: hidden;
    background: var(--fq-surface-3);
    z-index: 1;
  }
  /* Horizontal letter row, visible below the nav */
  .fair-letters {
    position: static;
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 10px 20px 12px;
    gap: 10px;
    flex: 0 0 auto;
    background: var(--fq-surface-3);
  }
  .fair-letter-item {
    font-size: clamp(34px, 11vw, 52px);
    transform: scale(0.92);
  }
  .fair-letter-item--on { transform: scale(1.08); }

  /* Horizontal card track — translated by JS via --tx. Cards size
     to their own content vertically and sit centred inside the
     sticky stage so they don't dominate the viewport. */
  .fair-cards-col {
    flex: 1;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 16px 12vw;
    margin: 0;
    width: max-content;
    transform: translate3d(var(--tx, 0), 0, 0);
    will-change: transform;
    overflow: visible;
  }
  .fair-mini-card {
    flex: 0 0 72vw;
    max-width: 420px;
    padding: 24px 22px;
    display: flex;
    flex-direction: column;
    opacity: 0.35;
  }
  .fair-mini-card--on { opacity: 1; }
  .fair-mini-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
  }
  .fair-mini-letter { font-size: 40px; }
  .fair-mini-title { font-size: 22px; margin: 0 0 10px; }
  .fair-mini-tail  { font-size: 16px; margin: 0 0 12px; }
  .fair-mini-body  { font-size: 14.5px; margin: 0; }
  .fair-mini-panel { display: contents; }

  /* Qwenda */
  .qwenda { padding: 80px 20px; }
  .qwenda-head { grid-template-columns: 1fr; gap: 16px; }
  .qwenda-head h2 { font-size: 40px; }
  .qwenda-grid { grid-template-columns: 1fr; gap: 40px; }

  /* Pillars */
  .pillars { padding: 72px 20px; }
  .pillars-head { grid-template-columns: 1fr; gap: 16px; margin-bottom: 40px; }
  .pillars-head h2 { font-size: 36px; }
  .pillars-grid { grid-template-columns: 1fr; border-top: 0; }
  .pillar,
  .pillar:not(:first-child),
  .pillar:last-child {
    border-right: 0;
    border-bottom: 1px solid var(--fq-border-strong);
    padding: 28px 0;
  }
  .pillar:last-child { border-bottom: 0; }

  /* Stats */
  .stats { padding: 72px 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat { border-right: 1px solid rgba(255,255,255,0.12); }
  .stat:nth-child(2n) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid rgba(255,255,255,0.12); padding-bottom: 32px; margin-bottom: 32px; }
  .stat-num { font-size: 54px; }

  /* Timeline — flip to vertical. Line runs down left rail at x=7px,
     each node is inset by 32px, dots sit on the line at x=7px. */
  .timeline { padding: 72px 20px; }
  .timeline-rail {
    grid-template-columns: 1fr;
    gap: 28px;
    margin-top: 40px;
    padding: 0;
  }
  .timeline-rail::before {
    top: 7px; bottom: 0; left: 7px; right: auto;
    width: 2px; height: auto;
    background: linear-gradient(180deg,
      var(--fq-blue) 0%,
      var(--fq-blue-light) 45%,
      var(--fq-red) 85%,
      rgba(234,81,59,0) 100%);
  }
  .timeline-node {
    padding: 0 0 0 32px;
    text-align: left;
    align-items: flex-start;
    display: flex; flex-direction: column;
  }
  .timeline-dot {
    top: 0; left: 1px;   /* dot-left 1px → dot-centre 8px → matches line centre */
    transform: none;
    margin: 0;
  }
  .timeline-title,
  .timeline-body { max-width: none; }

  /* Founders */
  .founders { padding: 72px 20px; }
  .founders-grid { grid-template-columns: 1fr; gap: 40px; margin-top: 32px; }
  .founder { grid-template-columns: 1fr; gap: 20px; }
  .founder-photo { max-width: 220px; }

  /* Contact modal */
  .contact-modal { padding: 32px 24px 24px; border-radius: 16px; }
  .contact-modal h3 { font-size: 24px; }

  /* Subscribe */
  .subscribe { padding: 80px 20px; }
  .subscribe-title { font-size: 36px; }
  .subscribe-mark { width: 360px; height: 360px; }

  /* Mobile form: drop the desktop "pill wrapper" pattern. The input
     and button each get their own surface so the controls actually
     look like controls in a column. */
  .subscribe-form {
    flex-direction: column;
    gap: 10px;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
  }
  .subscribe-form:focus-within {
    border-color: transparent;
    box-shadow: none;
  }
  .subscribe-form input {
    width: 100%;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid var(--fq-border-strong);
    border-radius: 12px;
    font-size: 16px;             /* ≥16px prevents iOS Safari focus zoom */
    transition: border-color .15s, box-shadow .15s;
  }
  .subscribe-form input:focus {
    border-color: var(--fq-blue);
    box-shadow: 0 0 0 3px rgba(34, 96, 221, 0.15);
  }
  .subscribe-form .btn {
    width: 100%;
    justify-content: center;
    padding: 14px 24px;
    border-radius: 12px;          /* match the input shape on mobile */
  }

  /* Qwenda dashboard mock — stack sidebar on top */
  .qmock-body { grid-template-columns: 1fr; gap: 16px; }
  .qmock-side { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .qmock-side .brand { width: 100%; margin-bottom: 4px; }
  .qmock-kpis { grid-template-columns: 1fr; }
  .qmock-top .url { display: none; }

  /* Footer */
  .footer { padding: 56px 20px 24px; }
  .footer-top { grid-template-columns: 1fr; gap: 32px; }
  .footer-cols { grid-template-columns: repeat(2, 1fr); }
  .footer-bot { flex-direction: column; gap: 8px; text-align: center; }
}

/* ── ≤ 540px — mobile ──────────────────────────────────────── */
@media (max-width: 540px) {
  .nav { padding: 10px 16px; }
  .nav-logo img { height: 26px; }
  .topbar { font-size: 11px; padding: 8px 16px; gap: 8px 12px; }

  .hero { padding: 32px 16px 48px; gap: 32px; }
  .hero-copy h1 { font-size: 36px; line-height: 1.05; margin-bottom: 20px; }
  .hero-copy .lead { font-size: 15px; margin-bottom: 24px; }
  .hero-cta { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 28px; }
  .hero-cta .btn { width: 100%; justify-content: center; }
  .hero-meta { gap: 14px 24px; padding-top: 20px; }
  .hero-meta > div { flex: 1 0 100%; }
  .hero-art { height: 340px; min-height: 340px; }
  .hero-quote { left: 12px; right: 12px; bottom: 12px; padding: 12px 14px; gap: 12px; }
  .hero-quote .avatar { width: 36px; height: 36px; font-size: 14px; }
  .hero-quote .text { font-size: 12px; line-height: 1.35; }


  .trust { padding: 28px 16px; }
  .about { padding: 56px 16px; }
  .about h2 { font-size: 30px; }
  .about-body p { font-size: 16px; }
  .about-body p:first-child::first-letter { font-size: 56px; padding: 6px 10px 0 0; }

  .ecosystem { padding: 56px 16px; }
  .eco-head h2 { font-size: 28px; }
  .eco-map { padding: 28px 18px; gap: 20px; }
  .eco-node { padding: 22px 22px 24px; }
  .eco-node h3 { font-size: 22px; }
  .eco-center-q { width: 72px; height: 72px; }
  .eco-center-q svg { width: 40px; height: 40px; }

  .fair-head-wrap { padding: 56px 16px 16px; }
  .fair-head h2 { font-size: 30px; }
  .fair-head .lead { font-size: 16px; }
  .fair-split { padding: 0; }
  .fair-stage { padding-top: 64px; }
  .fair-letters { padding: 8px 16px 10px; gap: 6px; }
  .fair-letter-item { font-size: clamp(28px, 12vw, 42px); }
  .fair-cards-col {
    gap: 12px;
    padding: 12px 10vw;
  }
  .fair-mini-card {
    flex: 0 0 82vw;
    padding: 22px 20px;
  }
  .fair-mini-letter { font-size: 32px; }
  .fair-mini-title { font-size: 20px; }
  .fair-mini-tail { font-size: 15px; }
  .fair-mini-body { font-size: 14px; }

  .qwenda { padding: 64px 16px; }
  .qwenda-head h2 { font-size: 32px; }
  .qwenda-head p { font-size: 16px; }
  .qwenda-cta { flex-direction: column; align-items: stretch; }
  .qwenda-cta .btn { width: 100%; justify-content: center; }
  .qwenda-feat { grid-template-columns: 28px 1fr; gap: 10px; }
  .qmock-body { padding: 16px; }
  .qmock-top .tab { font-size: 11px; padding: 4px 8px; }

  .pillars { padding: 56px 16px; }
  .pillars-head h2 { font-size: 28px; }
  .pillar h3 { font-size: 22px; }

  .stats { padding: 56px 16px; }
  .stats-head h2 { font-size: 32px; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat { border-right: 0; padding: 20px 0; }
  .stat:nth-child(-n+2) { padding-bottom: 20px; margin-bottom: 0; }
  .stat:not(:last-child) { border-bottom: 1px solid rgba(255,255,255,0.12); margin-bottom: 0; }
  .stat-num { font-size: 44px; }

  .timeline { padding: 56px 16px; }
  .timeline .section-head h2 { font-size: 30px !important; }

  .founders { padding: 56px 16px; }
  .founders .section-head h2 { font-size: 30px !important; }
  .founder-photo { max-width: 100%; }

  .contact-modal { padding: 28px 20px 20px; }
  .contact-modal h3 { font-size: 22px; }
  .contact-modal-actions { flex-direction: column-reverse; align-items: stretch; }
  .contact-modal-actions .btn { width: 100%; justify-content: center; }

  .subscribe { padding: 64px 16px; }
  .subscribe-title { font-size: 30px; }
  .subscribe-mark { width: 280px; height: 280px; }

  .form-row { grid-template-columns: 1fr; gap: 10px; }

  .footer { padding: 48px 16px 24px; }
  .footer-cols { grid-template-columns: 1fr; gap: 24px; }
  .footer-brand img { height: 28px; }
}
