/* ────────────────────────────────────────────────────────────
   MOBILE & RESPONSIVE — comprehensive overrides
   Tested breakpoints: 320 · 375 · 414 · 768 · 1024 · 1280
   ──────────────────────────────────────────────────────────── */

/* ── Touch targets: 44px min everywhere ──────────────── */
@media (hover: none) and (pointer: coarse) {
  body { cursor: auto; }
  #cursor, #cursor-dot { display: none !important; }

  button, a, [role="button"] {
    min-height: 44px;
  }
  /* but don't break tight inline links in body text */
  p a, li a { min-height: auto; }
}

/* ── 1024px and below — Tablet ───────────────────────── */
@media (max-width: 1024px) {
  :root { --shell-x: 28px; }

  /* Hero stacking */
  .hero-grid { gap: 32px; }
  .hero h1 { font-size: clamp(48px, 9vw, 80px); }
  .hero .sub { font-size: 16px; }
  .dock { grid-template-columns: 1fr; }

  /* Mesh wrap smaller on tablet */
  .mesh-wrap { max-width: 540px; margin: 0 auto; }
}

/* ── 768px and below — Mobile landscape / small tablet ─ */
@media (max-width: 768px) {
  :root { --shell-x: 20px; }

  /* Compact topnav — drop "Rohit · " prefix, just logo */
  .topnav { gap: 8px; padding: 0 16px; }
  .topnav .brand .brand-text { display: none; }
  .topnav .brand .brand-mark { width: 24px; height: 24px; }
  .topnav .topnav-meta { gap: 8px; }
  .topnav-time { display: none; }
  #sound-toggle { padding: 5px 10px 5px 7px; font-size: 9px; }
  #sound-toggle span:nth-child(2) { display: none; }
  .topnav .status { font-size: 9px; padding: 4px 8px 4px 7px; }

  /* Manifesto / hero / sections */
  .hero { padding-top: 90px; }
  .hero h1 { font-size: clamp(40px, 10vw, 64px); line-height: 0.98; }
  .manifesto { padding-block: 80px; }
  .manifesto-text { font-size: clamp(30px, 7vw, 48px); }

  /* Section padding */
  .section { padding-block: 72px; min-height: auto; }

  /* Boot loader scaling */
  .boot-name { font-size: clamp(36px, 11vw, 56px); }
  .boot-checks { font-size: 12px; }

  /* AI Audit form */
  .audit-form { flex-direction: column; gap: 6px; padding: 6px; }
  .audit-form input { width: 100%; padding: 14px 16px; }
  .audit-form button { width: 100%; padding: 14px; justify-content: center; }
  .audit-body { padding: 24px 20px; }

  /* Bento — single column */
  .bento-grid { grid-template-columns: 1fr; }
  .bento-card { padding: 24px; min-height: auto; }
  .bento-card.tall { grid-row: auto; }

  /* Works gallery — single column */
  .works-grid { grid-template-columns: 1fr; }
  .work-card.featured { grid-column: span 1; grid-row: span 1; }
  .work-card.featured .work-thumb { aspect-ratio: 4/3; }
  .work-card.featured .work-meta h4 { font-size: 24px; }

  /* Case study — stack everything */
  .case-grid { grid-template-columns: 1fr; gap: 32px; }
  .case-meta { position: static; }
  .case-chapter { padding: 24px 20px; }
  .beforeafter .handle::before { width: 32px; height: 32px; }

  /* Recognition */
  .rec-grid { grid-template-columns: 1fr; }
  .rec-metrics { grid-template-columns: 1fr 1fr; }

  /* Founder dossier */
  .dossier-grid { grid-template-columns: 1fr; gap: 32px; }
  .dossier-portrait { position: static; }
  .dossier-portrait .frame { max-width: 320px; margin: 0 auto; }
  .dossier-cards { grid-template-columns: 1fr; }

  /* Process */
  .process-grid { grid-template-columns: 1fr; gap: 32px; }
  .process-grid::before { display: none; }
  .process-step { display: grid; grid-template-columns: 64px 1fr; gap: 20px; align-items: start; }
  .process-step .num { margin-bottom: 0; }
  .process-step .wk,
  .process-step h4,
  .process-step p,
  .process-step ul { grid-column: 2; }
  .process-step .num { grid-row: span 4; }

  /* Sandbox / Playground */
  .pg-grid { grid-template-columns: 1fr; }
  .pg-side {
    border-right: none;
    border-bottom: 1px solid var(--line);
    flex-direction: row; flex-wrap: wrap;
    padding: 16px;
  }
  .pg-side > div { width: 100%; }
  .pg-body { padding: 24px 20px; }
  .swatches { grid-template-columns: 1fr 1fr; }
  .sanit-grid, .payload-wrap { grid-template-columns: 1fr; }

  /* SaaS product */
  .bs-grid { grid-template-columns: 1fr; gap: 12px; }
  .bs-block-tall, .bs-block-demo { grid-row: auto; }
  .bs-block-ask { grid-column: auto; }
  .bs-block { padding: 24px 22px; }
  .bs-title-row { flex-direction: column; align-items: flex-start; gap: 18px; }
  .bs-status { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .bs-name { font-size: clamp(48px, 14vw, 72px); }
  .bs-ask-grid { grid-template-columns: 1fr 1fr; }
  .bs-prob-grid { grid-template-columns: 1fr; }
  .bs-cta { flex-direction: column; align-items: flex-start; gap: 16px; padding: 22px 24px; }
  .bs-cta-h { font-size: 22px; }
  .bs-cta-arr { align-self: flex-end; }

  /* Pricing */
  .pricing-grid { grid-template-columns: 1fr; gap: 12px; }
  .tier { padding: 28px 24px; }

  /* Writing */
  .writing-grid { grid-template-columns: 1fr; }

  /* Lead form */
  .form-wrap { grid-template-columns: 1fr; gap: 24px; }
  .form-stage { padding: 24px 20px; min-height: auto; }
  .opt-grid { grid-template-columns: 1fr; }

  /* Booking */
  .book-grid { grid-template-columns: 1fr; padding: 20px; gap: 20px; }
  .book-queue { flex-wrap: wrap; gap: 14px; }
  .book-day { font-size: 11px; }
  .book-day-h { font-size: 9px; }
  .book-slots { grid-template-columns: 1fr 1fr; }
  .book-cal-grid { gap: 2px; }

  /* Footer */
  .footer { padding: 64px 20px 28px; }
  .footer-grid { grid-template-columns: 1fr; gap: 40px; }
  .footer h2 { font-size: clamp(36px, 9vw, 56px); }
  .footer-bottom {
    flex-direction: column; gap: 8px; text-align: center;
  }

  /* Chat bot — pull slightly off the right for thumb reach */
  #chat-toggle { bottom: 16px; right: 16px; width: 54px; height: 54px; }
  #chat-toggle svg { width: 22px; height: 22px; }
  #chat-panel {
    bottom: 84px; right: 16px; left: 16px; width: auto;
    max-width: none; height: calc(100vh - 180px); max-height: 540px;
  }

  /* Legal pages */
  .legal-shell { padding: 96px 20px 56px; }
  .legal-head { padding-bottom: 28px; margin-bottom: 36px; }
  .legal-body section { margin-bottom: 40px; }
  .legal-body h2 { font-size: 22px; }
  .legal-body p, .legal-body li { font-size: 14.5px; }
  .legal-foot { flex-direction: column; gap: 12px; text-align: center; }
}

/* ── 480px and below — Phones ────────────────────────── */
@media (max-width: 480px) {
  :root { --shell-x: 16px; }

  /* Even bigger headlines proportionally on phone (mobile-first feel) */
  .hero h1 { font-size: clamp(38px, 11vw, 56px); }

  /* Studio kicker readable */
  .kicker { font-size: 10px; }

  /* Section headings */
  section .shell h2,
  .section h2 { font-size: clamp(32px, 9vw, 48px); }

  /* Smaller paddings */
  .section { padding-block: 56px; }
  .bento-card, .audit-wrap, .playground, .form-stage, .book-grid, .bs-block { border-radius: 18px; }

  /* Recognition metrics 1-col */
  .rec-metrics { grid-template-columns: 1fr; }

  /* SaaS ask 1-col */
  .bs-ask-grid { grid-template-columns: 1fr; }

  /* Boot loader compact */
  #boot-loader { padding: 0 20px; }
  .boot-name { font-size: clamp(32px, 12vw, 48px); }
  .boot-role { font-size: 11px; margin-bottom: 32px; }
  .boot-checks { gap: 6px; font-size: 11.5px; }
  .boot-progress { margin-top: 36px; }
  .boot-skip { right: 16px; bottom: 16px; font-size: 10px; padding: 6px 12px; }

  /* Hero mesh smaller */
  .mesh-wrap { aspect-ratio: 4 / 5; }
  .mesh-corner { font-size: 9px; padding: 12px 14px; }

  /* Audit cards: single column */
  .audit-result { grid-template-columns: 1fr; }

  /* Pricing tier */
  .tier h4 { font-size: 32px; }
  .tier .tier-price { font-size: 28px; flex-wrap: wrap; }

  /* Lab card */
  .lab-card { padding: 32px 24px; }
  .lab-card h3 { font-size: 36px; }

  /* Footer */
  .footer-col h5 { font-size: 10px; }
  .contact-list li a { font-size: 13.5px; }

  /* SaaS title smaller */
  .bs-name { font-size: clamp(40px, 16vw, 60px); }
}

/* ── Safe-area inset (iPhone notch) ─────────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
  #chat-toggle { bottom: max(16px, env(safe-area-inset-bottom)); }
  #chat-panel { bottom: max(84px, calc(env(safe-area-inset-bottom) + 68px)); }
  .topnav { padding-top: env(safe-area-inset-top); height: calc(52px + env(safe-area-inset-top)); }
}

/* ── Landscape phone — short viewport ───────────────── */
@media (max-height: 480px) and (orientation: landscape) {
  .hero { padding-top: 80px; }
  .hero h1 { font-size: clamp(36px, 7vw, 56px); }
  .section { padding-block: 48px; }
  #boot-loader { justify-content: flex-start; padding-top: 32px; }
}

/* ── Reduced motion ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .section { transform: none !important; filter: none !important; opacity: 1 !important; }
}
