/* Mobile fixes — loaded after all other CSS */
/* Only applies up to 768px; desktop remains untouched */

.about-hero-eyebrow {
  display: none;
}

@media (max-width: 768px) {

  /* === 1. Prevent horizontal overflow === */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  /* === 2. Image safety — never stretch, never overflow === */
  img {
    max-width: 100% !important;
    height: auto !important;
  }

  .feature-visual {
    aspect-ratio: auto !important;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .feature-visual img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain;
  }

  .gallery-tile {
    aspect-ratio: auto !important;
  }
  .gallery-tile img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain;
  }

  .work-visual {
    aspect-ratio: auto !important;
  }
  .work-visual img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain;
  }

  .idea-visual {
    aspect-ratio: auto !important;
  }
  .idea-visual img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain;
  }

  .devaiah-row img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain;
  }

  .about-story-image {
    aspect-ratio: auto !important;
  }
  .about-story-image img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain;
  }

  .teaser-visual {
    aspect-ratio: auto !important;
  }
  .teaser-visual img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain;
  }

  .about-photo {
    aspect-ratio: auto !important;
  }
  .about-photo img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain;
  }

  .cs-gallery img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain;
  }

  .cs-interleave-image img,
  .cs-image-row img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain;
  }

  /* Builds page — these images are absolutely positioned to fill a fixed box
     with object-fit: cover; the blanket height:auto above would leave a gap at
     their bottom edge (hero screenshot + project card screenshots). */
  .pin-media img,
  .macbook-scroll-display img {
    height: 100% !important;
  }

  /* Scroll-dissolve section — full-bleed sticky images; the blanket height:auto
     above would collapse them to their natural aspect ratio. */
  .sd-nojs {
    max-width: none !important;
    height: 100svh !important;
  }
  .sd-mobile .sd-viewport img {
    max-width: none !important;
    height: 100% !important;
  }

  /* === 3. Increase horizontal breathing room === */
  .wrap {
    padding-left: 24px !important;
    padding-right: 24px !important;
  }

  .about-hero {
    padding-left: 24px !important;
    padding-right: 24px !important;
  }
  .about-story {
    padding-left: 24px !important;
    padding-right: 24px !important;
  }
  .about-experience {
    padding-left: 24px !important;
    padding-right: 24px !important;
  }
  .devaiah-gallery {
    padding-left: 24px !important;
    padding-right: 24px !important;
  }

  /* === 4. About page hero — full-screen intro === */
  .about-hero {
    min-height: 100svh !important;
    min-height: 100dvh !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: calc(80px + env(safe-area-inset-top)) !important;
    padding-bottom: calc(40px + env(safe-area-inset-bottom)) !important;
  }
  .about-hero-inner {
    max-width: 100% !important;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .about-hero-eyebrow {
    display: block;
    font-size: 17px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 24px;
  }
  .about-hero-inner h1 {
    font-size: clamp(30px, 8vw, 40px) !important;
    line-height: 1.15 !important;
    letter-spacing: -0.015em !important;
  }
  .about-hero-readmore {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    font-size: 13px !important;
    color: rgba(255, 255, 255, 0.5) !important;
  }

  /* === 5. Case study template padding === */
  .case-study {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }
  .case-study.theme-brahmi .cs-header {
    margin-left: -1.5rem !important;
    margin-right: -1.5rem !important;
  }

  /* === 6. Real estate card consistency === */
  .work-card {
    margin-bottom: 0 !important;
  }
  .work-grid-3 .work-card h2 {
    font-size: 16px;
  }

  /* === 7. Footer === */
  footer .wrap {
    padding-left: 24px !important;
    padding-right: 24px !important;
  }

  /* === 8. Game section === */
  .game-section .wrap {
    padding-left: 24px !important;
    padding-right: 24px !important;
  }

  /* === 9. Header scroll-track hidden on mobile (progress moves below hero) === */
  .scroll-track {
    display: none;
  }

  /* === 10. Navbar alignment === */
  .header-row {
    padding-top: 18px;
    padding-bottom: 18px;
  }
  .header-avatar {
    width: 52px !important;
    height: 52px !important;
  }
  .header-left {
    gap: 12px;
  }
  .hamburger {
    width: 44px;
    height: 44px;
    padding: 0;
    align-items: center;
    justify-content: center;
    gap: 5px;
  }
  .hamburger span {
    width: 28px;
    height: 2px;
  }
  .search-trigger {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
  }
  .search-trigger-kbd {
    display: none;
  }

  /* === 10b. Ultra-narrow screens — compact identity so the 44px hamburger
       stays fully on-screen (down to 320px). Only font sizes change; layout,
       avatar, and touch targets are untouched. === */
  @media (max-width: 350px) {
    .header-name {
      font-size: 22px;
    }
    .header-status {
      font-size: 13px;
    }
  }

  /* === 11. Hero — full-viewport rhythm === */
  .hero-section {
    min-height: 100svh;
    min-height: 100dvh;
    padding-top: calc(var(--nav-height, 68px) + 48px);
    padding-bottom: 48px;
    justify-content: center;
  }
  .hero-v3 .kicker {
    margin-bottom: 40px !important;
  }
  .hero-v3 .hero-line {
    font-size: clamp(36px, 9vw, 60px);
    line-height: 1.05;
    letter-spacing: -0.03em;
    text-wrap: balance;
    word-break: normal;
    overflow-wrap: normal;
    hyphens: none;
  }
  .hero-char.hero-space {
    display: inline !important;
    white-space: normal;
  }
  .hero-stats-v3 {
    margin-top: 56px !important;
  }
  .hero-scroll-prompt {
    margin-top: 100px !important;
  }

  /* Compact screens (e.g. iPhone SE 375×667) — tightened rhythm */
  @media (max-width: 380px) and (max-height: 720px) {
    .hero-section {
      padding-top: calc(var(--nav-height, 68px) + 32px);
      padding-bottom: 32px;
    }
    .hero-v3 .kicker {
      margin-bottom: 32px !important;
    }
    .hero-v3 .hero-line {
      font-size: clamp(30px, 9vw, 36px);
    }
    .hero-stats-v3 {
      margin-top: 40px !important;
    }
    .hero-scroll-prompt {
      margin-top: 76px !important;
    }
  }

  /* === 12. Mobile progress bar (below hero) === */
  .mobile-progress {
    position: fixed;
    top: 68px;
    left: 20px;
    right: 20px;
    height: 2px;
    z-index: 480;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
  }
  .mobile-progress.visible {
    opacity: 1;
    visibility: visible;
  }
  .mobile-progress-bar {
    width: 0%;
    height: 100%;
    background: #C41E3A;
    border-radius: 2px;
    transition: width .1s linear;
  }

  /* === 13. Editorial intro (About heading + paragraph) === */
  .scroll-reveal-text {
    padding: 64px 24px 48px;
    text-align: center;
  }
  .lead-claim {
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 32px;
    line-height: 1.2;
    font-size: clamp(1.9rem, 8vw, 2.6rem);
    text-wrap: balance;
  }
  .srt-paragraph {
    max-width: 34em;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.85;
    text-wrap: pretty;
  }

  /* === 14. Mobile menu — spacing scale, case study desc === */
  .mobile-menu-inner {
    padding: 24px 24px 40px;
  }
  .mobile-top {
    margin-bottom: 48px;
    padding-right: 44px;
  }
  .mobile-nav {
    gap: 24px;
  }
  .mobile-section {
    margin-bottom: 0;
  }
  .mobile-section:last-of-type {
    margin-bottom: 0;
  }
  .mobile-section-heading {
    margin-top: 48px;
    margin-bottom: 20px;
  }
  .mobile-cs-desc {
    font-size: 18px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.62);
    max-width: 70%;
  }
  .mobile-avatar {
    width: 72px !important;
    height: 72px !important;
  }
  .mobile-project-row {
    padding: 20px 0;
  }
  .mobile-project-row:last-child {
    margin-bottom: 0;
  }
  .mobile-project-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    object-position: center;
  }
  .mobile-close {
    top: calc(env(safe-area-inset-top, 0px) + 20px);
  }
  .mobile-explore-link {
    padding: 12px 0;
    min-height: 48px;
  }
  .mobile-explore-link-disabled {
    opacity: .4;
    cursor: not-allowed;
    pointer-events: none;
  }

  /* === 15. Type + touch targets === */
  h1, h2, h3, .hero-line, .lead-claim {
    text-wrap: balance;
  }
  p {
    text-wrap: pretty;
  }

  /* === 16. Touch targets >= 44px (M4) — hit area via pseudo-element, no layout shift === */
  .copy-email,
  .foot-bottom a,
  button.sf-btn,
  .teaser-link,
  .cs-next-link,
  #vr-devaiah p a,
  .builds-section p a,
  .cs-interactive-note a,
  .books-showcase a,
  .bs-nojs a {
    position: relative;
  }
  .copy-email::before,
  .foot-bottom a::before,
  button.sf-btn::before,
  .teaser-link::before,
  .cs-next-link::before,
  #vr-devaiah p a::before,
  .builds-section p a::before,
  .cs-interactive-note a::before,
  .books-showcase a::before,
  .bs-nojs a::before {
    content: "";
    position: absolute;
    inset: -14px -8px;
  }

  /* === 17. Floating hero character — keep it a small bottom-right accent.
       The blanket img height:auto above would otherwise blow the character up
       to its full natural size (~624px) and cover the whole hero. Shrink the
       anchor to its content too, so its invisible tap zone wraps the character
       instead of spanning the full hero width. === */
  .floating-character {
    width: fit-content;
  }
  .floating-character::before {
    content: "";
    position: absolute;
    inset: -8px -12px;
  }
  .floating-character img {
    max-width: none !important;
    width: auto !important;
    height: clamp(48px, 7vh, 64px) !important;
  }

  /* Compact phones (e.g. iPhone SE 375×667) — smaller character */
  @media (max-width: 380px) and (max-height: 720px) {
    .floating-character img {
      height: clamp(40px, 6vh, 52px) !important;
    }
  }

  /* === 18. Game mute button — full 44px touch target === */
  #mute {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

}
