/* Hi - Harness Intelligence | Mobile Optimization
   =========================================================
   Phone-native overrides for screens ≤ 768px.
   Loaded on all pages; @media query controls activation.
   ========================================================= */

@media (max-width: 768px) {

  /* ============================================
     NAVIGATION — Compact header, better hamburger
     ============================================ */
  :root {
    --nav-height: 64px;
  }

  .site-nav {
    height: var(--nav-height);
    padding: 0 1rem;
  }

  .nav-inner {
    gap: 0;
    justify-content: space-between;
  }

  .nav-cta {
    display: none !important;
  }

  .nav-logo {
    position: static;
    transform: none;
    order: -1;
  }

  .nav-logo img {
    height: 48px;
  }

  .nav-toggle {
    right: 1rem;
    padding: 0.75rem;
  }

  .nav-toggle span {
    width: 22px;
    height: 2px;
    margin: 4px 0;
  }

  /* Mobile menu dropdown — positioned below compact nav */
  .nav-links.open {
    top: var(--nav-height);
    padding: 0.75rem 1.25rem 1rem;
    gap: 0;
  }

  .nav-links.open li {
    width: 100%;
  }

  .nav-links.open a {
    display: block;
    padding: 0.75rem 0;
    font-size: 1rem;
    border-bottom: 1px solid var(--hi-border);
  }

  .nav-links.open li:last-child a {
    border-bottom: none;
  }

  /* ============================================
     GLOBAL TYPOGRAPHY — Phone-appropriate sizing
     ============================================ */
  h1 {
    font-size: 2rem !important;
    line-height: 1.2 !important;
  }

  h2 {
    font-size: 1.6rem !important;
    line-height: 1.25 !important;
  }

  h3 {
    font-size: 1.15rem !important;
  }

  .section h2 {
    font-size: 1.6rem !important;
    margin-bottom: 0.75rem;
  }

  .section p {
    font-size: 0.95rem;
    line-height: 1.7;
  }

  /* ============================================
     CONTAINER — Tighter side padding on phone
     ============================================ */
  .container {
    padding: 0 1.25rem;
  }

  /* ============================================
     HERO SECTION — Compact, phone-native
     ============================================ */
  .hero {
    margin: 0 1rem;
    height: auto;
    min-height: 200px;
    padding: 1.5rem 0;
    border-radius: 1.5rem;
  }

  .hero .container {
    border-radius: 1.5rem;
    padding: 1.5rem 1.25rem;
    height: auto;
    width: 100%;
  }

  .hero h1 {
    font-size: 1.8rem !important;
    margin-bottom: 0.5rem;
  }

  .hero-subtitle {
    font-size: 1rem !important;
    line-height: 1.5;
  }

  /* Hero section variant (pages like insights) */
  .hero-section {
    padding: 2.5rem 0 1.5rem;
  }

  .hero-section h1 {
    font-size: 2rem !important;
  }

  .hero-section .page-subtitle {
    font-size: 1rem;
  }

  .hero-split {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 2rem 0;
  }

  /* ============================================
     SECTIONS — Reduced vertical padding
     ============================================ */
  .section {
    padding: 2.5rem 0;
  }

  .section-header {
    margin-bottom: 1.5rem;
  }

  /* ============================================
     CONTENT SPLITS — Stacked, text-first, compact
     ============================================ */

  /* Clear visual separator between split sections */
  .content-split {
    padding: 2rem 0;
    border-bottom: 1px solid #e8e8e8;
  }
  .content-split:last-of-type {
    border-bottom: none;
  }

  .split-content {
    flex-direction: column !important;
    gap: 1rem !important;
  }

  /* Force text ALWAYS first, image ALWAYS second.
     Prevents image-image pileups between sections. */
  .split-text {
    order: 1 !important;
    flex: 1 1 100% !important;
    width: 100% !important;
  }
  .split-image {
    order: 2 !important;
    flex: 1 1 100% !important;
    width: 100% !important;
  }

  /* Split images use pre-cropped mobile versions via <picture>.
     Display at natural aspect ratio — no forced height clipping. */
  .split-image {
    border-radius: 0.75rem !important;
    overflow: hidden;
    position: relative;
  }


  .split-image img {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    border-radius: 0.75rem !important;
    display: block;
  }

  /* Hide images that don't work at mobile scale (e.g. dense info-graphics) */
  .split-image--hide-mobile {
    display: none !important;
  }

  /* ============================================
     QUOTE BLOCK — Scaled for phone screen
     ============================================ */
  .quote-block {
    padding: 2rem 1rem;
  }

  .quote-block blockquote,
  .quote-block blockquote p {
    font-size: 1.4rem !important;
    line-height: 1.4 !important;
  }

  .quote-block .quote-author,
  .quote-block cite {
    font-size: 0.95rem;
  }

  /* ============================================
     PURPOSE TEXT (About page)
     ============================================ */
  .purpose-text {
    font-size: 1.1rem !important;
    line-height: 1.7 !important;
  }

  /* ============================================
     SOLUTIONS PAGE — Inline grid overrides
     Solutions uses inline style="display: grid; grid-template-columns: 1fr 1fr"
     which the 768px breakpoint doesn't catch.
     ============================================ */
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  /* Reset any inline order for stacked layout */
  [style*="order: 2"],
  [style*="order: 1"] {
    order: 0 !important;
  }

  /* ============================================
     CARDS — Single column, compact
     ============================================ */
  .card-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }

  .card-image img {
    height: 180px;
    object-position: top center;
  }

  .card-body {
    padding: 1.25rem;
  }

  .card-body h3 {
    font-size: 1.05rem !important;
  }

  /* ============================================
     TESTIMONIALS — Single column, compact quotes
     ============================================ */
  .testimonials {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }

  .testimonial {
    font-size: 0.9rem;
    line-height: 1.7;
  }

  .testimonial::before {
    font-size: 2.5rem;
    margin-bottom: 0.25rem;
  }

  /* ============================================
     TEAM SECTION — Stacked bios
     ============================================ */
  /* Inline grid overrides handle the team grid via [style*="grid-template-columns"] */

  /* Team member flex layout → stacked on phone */
  [style*="display: flex"][style*="gap: 1.5rem"] {
    flex-direction: column !important;
  }

  /* Team photos — centered, nicely sized when stacked */
  [style*="width: 160px"][style*="height: 160px"] {
    width: 140px !important;
    height: 140px !important;
    border-radius: 50% !important;
    align-self: center;
  }

  /* ============================================
     ADVISOR GRID — 2 columns instead of 4
     ============================================ */
  .advisor-grid,
  [style*="grid-template-columns: repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.25rem !important;
  }

  /* ============================================
     INTELLIPRINT COMPONENTS
     ============================================ */
  .ip-components {
    grid-template-columns: 1fr !important;
  }

  .ip-benefits {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }

  /* ============================================
     BUTTONS — Full width, touch-friendly
     ============================================ */
  .btn {
    width: 100%;
    height: auto;
    min-height: 48px;
    padding: 0.85rem 1.5rem;
    font-size: 0.95rem;
  }

  .btn-filled {
    width: 100%;
    min-height: 48px;
    padding: 0.85rem 1.5rem;
  }

  .button-group {
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
  }

  /* ============================================
     CONTACT PAGE — Banner and form card
     ============================================ */
  .contact-banner {
    border-radius: 0;
    max-height: 200px;
  }

  .contact-banner img {
    height: 200px;
  }

  .contact-form-card {
    margin-top: -40px;
    padding: 1.75rem 1.25rem;
    border-radius: 0.75rem;
  }

  /* Form inputs — larger touch targets */
  .form-group input,
  .form-group textarea,
  .form-control {
    font-size: 16px !important; /* Prevents iOS zoom on focus */
    padding: 0.85rem 0;
  }

  .form-row {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
  }

  /* ============================================
     BLOG / INSIGHTS
     ============================================ */
  .blog-search {
    max-width: 100%;
    margin-bottom: 2rem;
  }

  .blog-search input {
    font-size: 16px; /* Prevents iOS zoom */
  }

  /* ============================================
     BLOG ARTICLE — Readable on phone
     ============================================ */
  .article-header {
    padding: 2rem 0 1rem;
  }

  .article-header h1 {
    font-size: 1.75rem !important;
    line-height: 1.25 !important;
    max-width: 100%;
  }

  .article-body {
    padding: 1.5rem 0 2.5rem;
  }

  .article-body p,
  .article-body li {
    font-size: 1rem;
    line-height: 1.75;
  }

  .article-body h2 {
    font-size: 1.4rem !important;
    margin-top: 2rem;
  }

  .article-body h3 {
    font-size: 1.15rem !important;
  }

  .article-body blockquote {
    padding: 0.75rem 1rem;
    margin: 1rem 0;
  }

  /* ============================================
     PARTNER LOGOS — Tighter on phone
     ============================================ */
  .partner-logos {
    gap: 2rem;
  }

  .partner-logos img {
    max-height: 80px;
  }

  /* ============================================
     CTA BAND
     ============================================ */
  .cta-band {
    padding: 2.5rem 0;
  }

  .cta-band h2 {
    font-size: 1.6rem !important;
  }

  /* ============================================
     FOOTER — Compact
     ============================================ */
  .site-footer {
    padding: 1.5rem 0;
    font-size: 0.8rem;
  }

  /* ============================================
     iOS SAFE AREA — Notch and home indicator
     ============================================ */
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .site-footer {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
  }

  /* ============================================
     SCROLL & OVERFLOW PROTECTION
     ============================================ */
  html, body {
    overflow-x: hidden;
  }

  img {
    max-width: 100%;
    height: auto;
  }

  /* Inline-styled images that might overflow */
  [style*="max-width: 420px"] {
    max-width: 100% !important;
  }

  /* ============================================
     AOS ANIMATIONS — Disable completely on mobile
     Scroll-triggered fade creates large blank gaps
     on narrow screens where content is stacked.
     ============================================ */
  [data-aos] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  /* ============================================
     BOOTSTRAP ROW OVERRIDES
     Bootstrap .row has negative margins that
     can cause horizontal overflow on mobile
     ============================================ */
  .row {
    margin-left: 0;
    margin-right: 0;
  }

  .row > [class*="col-"] {
    padding-left: 0;
    padding-right: 0;
  }
}
