/* TriadCode mobile production polish
   Loaded after corporate.css so it can safely override desktop presentation rules. */

html, body { max-width: 100%; overflow-x: clip; }
img, svg, video { max-width: 100%; }
img { height: auto; }

@media (max-width: 820px) {
  html { scroll-behavior: auto; -webkit-text-size-adjust: 100%; }
  body { overflow-x: hidden; overscroll-behavior-x: none; }

  /* A solid mobile header is smoother than a large backdrop-filter layer on many phones. */
  .corp-header {
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding-left: 15px;
    padding-right: 15px;
  }
  .corp-brand { min-width: 0; }
  .corp-brand > span:last-child { min-width: 0; }
  .corp-brand small { white-space: nowrap; font-size: 7px; letter-spacing: .09em; }
  .nav-toggle {
    display: grid;
    place-items: center;
    min-width: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 10px;
    color: var(--navy);
    touch-action: manipulation;
  }
  .corp-nav {
    max-height: calc(100dvh - 88px);
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 14px;
  }
  .corp-nav a { min-height: 44px; display: flex; align-items: center; }

  /* Avoid accidental horizontal image dragging and preserve natural aspect ratio. */
  .case-browser img,
  .browser-frame img,
  .shot img,
  .evolve-hero-showcase img,
  .device-phone-frame img,
  .evolve-home-preview img,
  .evolve-project-stack img {
    height: auto !important;
    max-height: none !important;
    object-fit: contain !important;
    object-position: top center !important;
    -webkit-user-drag: none;
    user-select: none;
  }

  .case-browser,
  .browser-frame,
  .evolve-hero-showcase { transform: none !important; }

  /* Project previews become touch-native carousels instead of rotated overlapping layers. */
  .project-editorial { min-height: auto; }
  .project-stack {
    height: auto !important;
    min-height: 0;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 2px 16px;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x pan-y;
  }
  .project-stack::-webkit-scrollbar,
  .evolve-home-preview::-webkit-scrollbar,
  .evolve-project-stack::-webkit-scrollbar { display: none; }
  .project-stack .shot {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 88% !important;
    flex: 0 0 88%;
    transform: none !important;
    border-radius: 12px;
    scroll-snap-align: center;
    box-shadow: 0 14px 34px rgba(16,24,40,.12);
  }

  .evolve-home-preview,
  .evolve-project-stack {
    height: auto !important;
    min-height: 0 !important;
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center;
    gap: 12px;
    overflow-x: auto !important;
    overflow-y: hidden;
    padding: 12px 4px 18px !important;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }
  .evolve-home-preview img,
  .evolve-project-stack img {
    position: relative !important;
    inset: auto !important;
    transform: none !important;
    width: auto !important;
    max-width: none !important;
    flex: 0 0 min(230px, 64vw);
    scroll-snap-align: center;
    border-width: 4px;
    border-radius: 24px;
    box-shadow: 0 14px 34px rgba(16,24,40,.16);
  }

  /* Scroll case studies remain readable without desktop sticky/3D effects. */
  .scrolly-case { padding: 20px 0; }
  .scrolly-row,
  .scrolly-row.reverse {
    width: min(100% - 28px, 1180px) !important;
    min-height: 0 !important;
    padding: 50px 0 !important;
    gap: 28px;
  }
  .scrolly-copy { position: static !important; margin: 0 !important; }
  .scrolly-visual { min-width: 0; width: 100%; }
  .browser-frame { width: 100%; }
  .browser-frame img { width: 100%; }
  .evolve-phone-stage {
    min-height: 0 !important;
    padding: 18px 0 8px;
  }
  .evolve-phone-stage::before { width: min(330px, 86vw) !important; height: min(330px, 86vw) !important; }
  .device-phone-frame {
    width: min(285px, 76vw) !important;
    transform: none !important;
    transition: none !important;
  }
  .scrolly-row.active .device-phone-frame,
  .scrolly-row.reverse.active .device-phone-frame { transform: none !important; }

  /* Expensive decorative motion is reduced on coarse-pointer devices. */
  .hero-mesh { filter: none; opacity: .7; }
  .floating-chip { animation: none; }
  .terminal-card { transition: none; }
  .cursor-glow { display: none !important; }

  /* Prevent iOS form zoom and make touch controls easier to use. */
  .corp-form input,
  .corp-form select,
  .corp-form textarea,
  button,
  input,
  select,
  textarea { font-size: 16px; }
  .btn { min-height: 44px; touch-action: manipulation; }

  /* Technology diagram must stay within the phone viewport. */
  .tech-orbit { overflow: hidden; width: 100%; }
  .tech-node { white-space: nowrap; }
}

@media (max-width: 560px) {
  .corp-shell { width: min(100% - 24px, 1180px) !important; }
  .hero-grid { padding: 44px 0 !important; gap: 30px; }
  .hero-copy h1,
  .page-hero h1,
  .case-hero h1 { font-size: clamp(34px, 10.5vw, 42px) !important; overflow-wrap: anywhere; }
  .split-heading h2,
  .home-columns h2,
  .contact-copy h2,
  .career-side h2,
  .architecture-grid h2,
  .case-intro h2 { font-size: clamp(30px, 9vw, 36px) !important; }
  .case-copy h3,
  .project-copy h2 { font-size: clamp(30px, 9vw, 36px) !important; }

  .featured-case { padding: 20px !important; border-radius: 14px; }
  .case-browser img { width: 100%; }
  .browser-bar span { max-width: 65%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .project-stack .shot { flex-basis: 92%; width: 92% !important; }
  .evolve-home-preview img,
  .evolve-project-stack img { flex-basis: min(215px, 66vw); }

  .evolve-hero-showcase { margin-bottom: 42px !important; }
  .case-hero { padding: 50px 0 !important; }
  .case-hero-grid { margin-top: 34px !important; }
  .case-facts div { align-items: flex-start; }
  .case-facts strong { text-align: right; max-width: 64%; }

  .tech-orbit { height: 350px !important; }
  .tech-orbit::before { width: 245px !important; height: 245px !important; }
  .tech-orbit::after { width: 315px !important; height: 315px !important; }
  .tech-core { width: 116px !important; height: 116px !important; font-size: 18px !important; }
  .tech-node { padding: 8px 10px; font-size: 8px; }
  .tech-node.n1 { top: 34px; }
  .tech-node.n2 { top: 103px; right: 2px !important; }
  .tech-node.n3 { bottom: 92px; right: 0 !important; }
  .tech-node.n4 { bottom: 26px; }
  .tech-node.n5 { bottom: 92px; left: 0 !important; }
  .tech-node.n6 { top: 103px; left: 0 !important; }

  .footer-bottom { gap: 8px !important; }
}

@media (hover: none) and (pointer: coarse) {
  /* Smoothness beats decorative movement on phones/tablets. */
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .project-editorial-evolve:hover .phone-p1,
  .project-editorial-evolve:hover .phone-p2,
  .project-editorial-evolve:hover .phone-p3 { transform: none !important; }
}
