/* Mobile presentation only. Desktop remains governed by styles.css. */
.mobile-work-carousel { display: none; }
@media (max-width: 640px) {
  html { scroll-padding-top: 72px; }
  body { overflow-x: hidden; }

  .site-nav {
    min-height: 64px;
    padding: 10px 20px;
    grid-template-columns: 1fr auto;
  }
  .nav-logo .logo-text { display: inline; }
  .nav-burger { width: 44px; height: 44px; }
  .mobile-menu a { min-height: 48px; display: flex; align-items: center; }

  /* Reach the work and contact actions without a full-screen decorative hero. */
  body[data-page="home"] .hero { min-height: 0; overflow: visible; }
  body[data-page="home"] .hero-top { flex: none; }
  body[data-page="home"] .mobile-work-carousel {
    position: absolute;
    z-index: 2;
    top: 78px;
    left: 0;
    right: 0;
    display: block;
    height: 158px;
    overflow: hidden;
  }
  body[data-page="home"] .mobile-work-track {
    display: flex;
    gap: 10px;
    width: 100%;
    height: 100%;
    padding: 4px 22px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  body[data-page="home"] .mobile-work-track::-webkit-scrollbar { display: none; }
  body[data-page="home"] .mobile-work-card {
    position: relative;
    flex: 0 0 108px;
    height: 142px;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, .9);
    border-radius: 14px;
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 7px 16px rgba(86, 95, 155, .16);
    text-decoration: none;
  }
  body[data-page="home"] .mobile-work-card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  body[data-page="home"] .mobile-work-card span {
    position: absolute;
    inset: auto 0 0;
    padding: 20px 6px 7px;
    background: linear-gradient(transparent, rgba(13, 20, 37, .72));
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body[data-page="home"] .hero-copy {
    position: relative;
    left: auto;
    bottom: auto;
    padding: 248px 22px 0;
    max-width: none;
  }
  body[data-page="home"] .hero-title { padding: 0; font-size: clamp(52px, 14vw, 72px); line-height: 1; }
  body[data-page="home"] .hero-slogan {
    max-width: 18ch;
    margin-top: 16px;
    font-size: clamp(20px, 5.8vw, 25px);
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
  }
  body[data-page="home"] .hero-subtitle { margin-top: 10px; font-size: 13px; }
  body[data-page="home"] .hero-location { margin-top: 8px; }
  body[data-page="home"] .hero-metrics { display: none; }
  body[data-page="home"] .hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
  body[data-page="home"] .hero-actions .chamfer-btn {
    min-height: 48px;
    width: 100%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    padding: 10px 12px;
    font-size: 14px;
  }
  body[data-page="home"] .hero-visual {
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    padding: 18px 20px 28px;
  }
  body[data-page="home"] .visual-wrap {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    display: block;
    height: auto;
  }
  body[data-page="home"] .works-zone,
  body[data-page="home"] .entry-zone { display: none; }
  body[data-page="home"] .video-zone {
    width: 100%;
    height: auto;
    padding: 0;
    display: block;
  }
  body[data-page="home"] .center-screen {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    min-height: 180px;
    padding: 8px;
    border-radius: 18px;
    box-shadow: 0 14px 34px rgba(89, 101, 177, .16);
  }
  body[data-page="home"] .center-screen::before,
  body[data-page="home"] .center-screen img,
  body[data-page="home"] .screen-glare { inset: 8px; border-radius: 11px; }
  body[data-page="home"] .center-screen img { width: calc(100% - 16px); height: calc(100% - 16px); }

  /* One proof row and a compact four-column category selector. */
  body[data-page="home"] .software-strip,
  body[data-page="home"] .brand-marquee[data-direction="right"] { display: none; }
  body[data-page="home"] .brand-marquee[data-direction="left"] { padding: 3px 0 7px; }
  body[data-page="home"] .brand-pill { height: 30px; padding: 0 13px; font-size: 11px; }
  body[data-page="home"] .category-timeline { padding: 18px 0 24px; }
  body[data-page="home"] .category-timeline .cat-stage {
    width: min(calc(100% - 32px), 480px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
  }
  body[data-page="home"] .category-timeline .cat-hero { order: 1; width: 100%; }
  body[data-page="home"] .category-timeline .cat-role { width: min(52vw, 206px); }
  body[data-page="home"] .category-timeline .cat-grid {
    order: 2;
    width: 100%;
    max-width: none;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px 2px;
    margin: 0;
    align-items: start;
    justify-items: center;
  }
  body[data-page="home"] .category-timeline .cat-col { display: contents; }
  body[data-page="home"] .category-timeline .cat-item {
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 82px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
  body[data-page="home"] .category-timeline .cat-ico {
    width: 60px;
    height: 60px;
    max-width: 100%;
    animation: none;
  }
  body[data-page="home"] .category-timeline .cat-ico-img { width: 58px; height: 58px; max-width: 100%; }
  body[data-page="home"] .category-timeline .cat-name {
    max-width: 100%;
    font-size: 11px;
    line-height: 1.25;
    white-space: normal;
    text-align: center;
  }
  body[data-page="home"] .category-timeline .cat-connect,
  body[data-page="home"] .category-timeline .cat-fx,
  body[data-page="home"] .category-timeline .cat-prop { display: none; }
  body[data-page="home"] .services-section { padding: 26px 0 36px; }
  body[data-page="home"] .section-title { margin-bottom: 16px; font-size: 29px; }
  body[data-page="home"] .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  body[data-page="home"] .service-card { min-height: 136px; padding: 16px 14px; border-radius: 16px; }
  body[data-page="home"] .service-icon { width: 22px; height: 22px; margin-bottom: 12px; }
  body[data-page="home"] .service-card h3 { font-size: 15px; margin-bottom: 5px; }
  body[data-page="home"] .service-card p { font-size: 11px; line-height: 1.45; }
  body[data-page="home"] .cta-section { padding: 12px 0 48px; }
  body[data-page="home"] .cta-card { padding: 36px 20px; }
  body[data-page="home"] .cta-card h2 { font-size: 27px; }

  /* Gallery: readable filters and work images, then a full-screen detail view. */
  body[data-page="gallery"] .page,
  body[data-page="video"] .page,
  body[data-page="about"] .page { padding-top: 96px; }
  .page-title { font-size: clamp(38px, 11vw, 54px); }
  .filter-bar { margin: 16px 0 8px; }
  .filter-row { display: block; overflow: visible; padding: 0; }
  .filter-label { display: block; padding: 0 0 8px 2px; font-size: 12px; }
  .filter-group {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding: 0 2px 10px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .filter-group::-webkit-scrollbar { display: none; }
  .filter-chip { flex: 0 0 auto; min-height: 44px; padding: 9px 15px; font-size: 13px; }
  body[data-page="gallery"] .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
  body[data-page="gallery"] .gallery-card { min-width: 0; padding: 6px; border-radius: 14px; }
  body[data-page="gallery"] .gallery-cover { border-radius: 9px; }
  body[data-page="gallery"] .gallery-name { white-space: normal; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
  body[data-page="gallery"] .gallery-meta { font-size: 10px; line-height: 1.5; }
  .video-grid { grid-template-columns: 1fr; gap: 16px; }

  .modal { padding: 0; }
  .modal-panel { width: 100%; height: 100dvh; border-radius: 0; }
  .modal-page { padding: 70px 18px 28px; }
  .modal-page.overview { grid-template-columns: 1fr; gap: 20px; }
  .modal-close,
  .lightbox-close,
  .video-modal-close,
  .contact-modal-close { width: 44px; height: 44px; }
  .project-name { font-size: 27px; }
  .project-intro { font-size: 14px; line-height: 1.65; white-space: pre-line; }
  .details-card { padding: 18px; }
  .details-card-inner { padding: 14px; }
  .details-grid { grid-template-columns: 1fr !important; }
  .detail-slice { height: 240px; }
  .media-arrow,
  .thumb-arrow { width: 44px; height: 44px; }
  .lightbox-panel { inset: 8px; }
  .lightbox-arrow { width: 44px; height: 44px; }
  .lightbox-arrow[data-lightbox-dir="prev"] { left: 4px; }
  .lightbox-arrow[data-lightbox-dir="next"] { right: 4px; }
}

@media (max-width: 360px) {
  body[data-page="home"] .hero-copy { padding-left: 18px; padding-right: 18px; }
  body[data-page="home"] .hero-actions { gap: 7px; }
  body[data-page="home"] .hero-actions .chamfer-btn { font-size: 13px; }
  body[data-page="home"] .category-timeline .cat-stage { width: min(calc(100% - 20px), 340px); }
  body[data-page="home"] .category-timeline .cat-ico { width: 54px; height: 54px; }
  body[data-page="home"] .category-timeline .cat-ico-img { width: 52px; height: 52px; }
}
