/*
 * Revival Flow — smartphone overhaul 2026-07-13
 * iOS Safari / Android Chrome: blank-space, late reveal, image failure,
 * sticky/min-height and motion stability fixes. Loaded after all inline CSS.
 */

/* The full-section dark overlay must stay behind the service content.
   Without an explicit stacking order, iOS Safari paints it above text and
   turns the section into what looks like a large black empty area. */
.services-bg {
  z-index: 0 !important;
  pointer-events: none !important;
}

.services > .container {
  position: relative !important;
  z-index: 2 !important;
}

/* A visible local visual exists even before lazy external thumbnails finish. */
.insights-news-grid .insight-card:nth-child(1) .insight-thumb {
  background: #d8d2c8 url('/images/ai-support-training-20260706.jpg') center / cover no-repeat;
}
.insights-news-grid .insight-card:nth-child(2) .insight-thumb {
  background: #d8d2c8 url('/images/ai-support-backoffice-agent-20260706.jpg') center / cover no-repeat;
}
.insights-news-grid .insight-card:nth-child(3) .insight-thumb {
  background: #d8d2c8 url('/images/ai-support-psychology-sales-20260706.jpg') center / cover no-repeat;
}

@media (max-width: 900px) {
  html {
    width: 100%;
    max-width: 100%;
    overflow-x: clip !important;
    scroll-padding-top: 68px;
  }

  body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip !important;
    background: #f8f6f2;
  }

  main,
  main > *,
  section,
  .container {
    max-width: 100%;
    min-width: 0;
  }

  /* Safariで表示判定待ちの要素が大きな空白になるのを防ぐ */
  [data-reveal],
  [data-reveal].revealed {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    transition: none !important;
    transition-delay: 0s !important;
  }

  .page-loader,
  .cursor,
  .cursor-follower,
  .hero-ai-stage,
  .hero-noise,
  .hero-deco {
    display: none !important;
  }

  .hero-img,
  .marquee-track,
  .special-edition-strip::before,
  .back-to-top {
    animation: none !important;
  }

  /* Header / logo */
  :root { --header-h: 70px; }

  .site-header,
  .site-header.scrolled,
  .site-header.is-scrolled {
    height: var(--header-h) !important;
    background: rgba(5, 14, 25, .97) !important;
  }

  .header-inner {
    height: var(--header-h) !important;
    padding-inline: 18px !important;
  }

  .logo {
    display: inline-flex !important;
    align-items: center;
    width: min(176px, calc(100vw - 92px));
    height: 44px;
    overflow: visible !important;
  }

  .logo-img,
  .site-header.scrolled .logo-img,
  .site-header.is-scrolled .logo-img {
    display: block !important;
    width: auto !important;
    height: 32px !important;
    max-width: 100% !important;
    object-fit: contain !important;
    object-position: left center !important;
    filter: drop-shadow(0 2px 10px rgba(0,0,0,.3));
  }

  .hamburger {
    width: 44px !important;
    height: 44px !important;
  }

  /* Hero: dynamic but stable; no parallax shake on touch devices */
  .hero {
    min-height: max(720px, 92svh) !important;
    height: auto !important;
  }

  .hero-img-wrap,
  .hero-img {
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
  }

  .hero-img {
    object-position: 58% center !important;
    transform: scale(1.04) !important;
    filter: saturate(.88) contrast(1.03) brightness(.7) !important;
  }

  .hero-content {
    min-height: max(720px, 92svh) !important;
    height: auto !important;
    padding: calc(var(--header-h) + 38px) 20px 34px !important;
  }

  .hero-resource-links {
    gap: 8px !important;
  }

  .hero-resource-link,
  .hero-actions .btn-primary,
  .hero-actions .btn-ghost {
    min-height: 52px !important;
  }

  /* Special-edition links: retain cinematic character without 3 large panels */
  .special-edition-strip {
    padding: 22px 0 !important;
  }

  .special-edition-inner {
    width: calc(100% - 36px) !important;
    grid-template-columns: 50px minmax(0, 1fr) !important;
    gap: 12px !important;
  }

  .special-edition-num {
    grid-row: 1 / span 2;
    font-size: 2.75rem !important;
    align-self: start;
  }

  .special-edition-kicker {
    font-size: .62rem !important;
    letter-spacing: .13em !important;
    line-height: 1.55;
  }

  .special-edition-title {
    font-size: 1.13rem !important;
    line-height: 1.46 !important;
  }

  .special-edition-title span {
    display: block;
    margin-top: 3px;
    font-size: .82rem;
  }

  .special-edition-copy {
    margin-top: 8px !important;
    font-size: .78rem !important;
    line-height: 1.7 !important;
  }

  .special-edition-link {
    grid-column: 2;
    width: auto !important;
    min-height: 44px !important;
    justify-content: space-between !important;
    padding: 10px 14px !important;
    font-size: .8rem;
  }

  .marquee-strip { height: 72px !important; }

  /* Global section rhythm: remove the mobile-only dead bands */
  .about,
  .services,
  .cases-v6,
  .owned-media,
  .insights-news,
  .strength,
  .company,
  .faq,
  .contact,
  .ai-os {
    padding-top: 58px !important;
    padding-bottom: 58px !important;
    min-height: 0 !important;
    height: auto !important;
  }

  .section-header-center,
  .insights-head-row {
    margin-bottom: 0 !important;
  }

  .section-title {
    font-size: clamp(1.65rem, 7.4vw, 2.05rem) !important;
    line-height: 1.4 !important;
  }

  .section-lead {
    margin-top: 16px !important;
    font-size: .9rem !important;
    line-height: 1.85 !important;
  }

  .owned-media::before,
  .owned-media-card::after,
  .insights-news::before,
  .seo-clusters::before,
  .cases-v6::before {
    display: none !important;
  }

  /* AI内製化OS */
  .ai-os-layout {
    display: block !important;
  }

  .ai-os-title {
    font-size: clamp(2rem, 9.3vw, 3rem) !important;
    line-height: 1.17 !important;
  }

  .ai-os-lead {
    font-size: .91rem !important;
    line-height: 1.9 !important;
  }

  .ai-os-proof {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    margin-top: 22px !important;
  }

  .ai-os-proof span { padding: 11px 13px !important; }

  .ai-os-cta {
    display: grid !important;
    grid-template-columns: 1fr !important;
    margin-top: 22px !important;
  }

  .ai-os-cta a {
    width: 100% !important;
    justify-content: center !important;
  }

  .ai-os-steps {
    gap: 10px !important;
    margin-top: 32px !important;
  }

  .ai-os-step {
    grid-template-columns: 48px 1fr !important;
    gap: 12px !important;
    padding: 14px !important;
    border-radius: 14px !important;
  }

  .ai-os-num {
    width: 48px !important;
    height: 48px !important;
    border-radius: 12px !important;
    font-size: 1rem !important;
  }

  .ai-os-steps::before { left: 24px !important; }
  .ai-os-step p { font-size: .82rem; line-height: 1.75 !important; }

  /* About */
  .about-grid {
    display: block !important;
    padding: 0 20px !important;
  }

  .about-visual {
    width: 100% !important;
    max-width: 520px !important;
    margin: 0 auto 30px !important;
  }

  .about-img-frame {
    aspect-ratio: 4 / 3 !important;
    height: auto !important;
    min-height: 0 !important;
  }

  .about-img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center 54% !important;
  }

  .about-art-caption {
    left: 16px !important;
    right: 16px !important;
    bottom: 14px !important;
  }

  .about-art-caption strong {
    max-width: 10rem !important;
    font-size: .52rem !important;
  }

  .about-body { padding: 0 !important; }
  .mission-text { font-size: clamp(1.35rem, 6vw, 1.75rem) !important; }
  .about-copy { font-size: .91rem !important; line-height: 1.9 !important; }

  .values-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .value-pill {
    width: 100% !important;
    min-height: 50px !important;
    justify-content: center !important;
    padding: 10px 12px !important;
  }

  /* Services: the largest source of the black blank bands */
  .services-bg-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    transform: none !important;
  }

  .svc-feature-card {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 28px 0 12px !important;
    overflow: hidden !important;
  }

  .svc-feature-img {
    display: block !important;
    width: 100% !important;
    height: 188px !important;
    min-height: 0 !important;
    aspect-ratio: auto !important;
    overflow: hidden !important;
  }

  .svc-feature-img img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    object-fit: cover !important;
    object-position: center !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .svc-feature-body {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 22px !important;
  }

  .svc-feature-body > .svc-num,
  .svc-card-inner > .svc-num {
    display: none !important;
  }

  .svc-feature-title { margin-top: 16px !important; }
  .svc-feature-text { margin-top: 12px !important; font-size: .88rem !important; line-height: 1.85 !important; }

  .svc-feature-results {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    margin-top: 18px !important;
  }

  .services-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    margin-top: 10px !important;
    background: transparent !important;
  }

  .svc-card,
  .svc-card-inner {
    width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
  }

  .svc-card-inner {
    display: block !important;
    padding: 20px !important;
    border: 1px solid rgba(184,147,106,.16) !important;
  }

  .svc-card .svc-icon-wrap {
    width: 44px !important;
    height: 44px !important;
    margin-bottom: 14px !important;
  }

  .svc-title { margin: 0 0 9px !important; }
  .svc-body { font-size: .86rem !important; line-height: 1.78 !important; }
  .svc-tags { margin-top: 14px !important; }

  .mujin-service-banner {
    display: block !important;
    min-height: 0 !important;
    height: auto !important;
    margin-top: 20px !important;
    padding: 20px !important;
  }

  .mujin-service-banner__facts { margin-top: 16px; }
  .mujin-service-banner__action { margin-top: 16px; }

  /* Cases */
  .cases-v6-head { margin-bottom: 24px !important; }
  .cases-v6-grid { gap: 8px !important; background: transparent !important; border: 0 !important; }
  .case-v6,
  .case-v6--wide {
    min-height: 0 !important;
    height: auto !important;
    padding: 22px !important;
    justify-content: flex-start !important;
  }
  .case-v6-kicker { margin: 0 0 24px !important; }
  .case-v6-scale { margin: 0 0 8px !important; }
  .case-v6 h3 { font-size: 1.45rem !important; }

  /* Owned media */
  .owned-media-trust {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    margin-top: 22px !important;
  }

  .owned-media-grid {
    gap: 14px !important;
    margin-top: 30px !important;
  }

  .owned-media-card,
  .owned-media-card--primary {
    display: block !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 22px !important;
    justify-content: flex-start !important;
  }

  .owned-media-card-head { margin-bottom: 22px !important; }
  .owned-media-title { font-size: 1.72rem !important; margin-bottom: 14px !important; }
  .owned-media-text { margin-bottom: 20px !important; font-size: .88rem !important; line-height: 1.85 !important; }
  .owned-media-meta { margin-bottom: 18px !important; }
  .owned-media-list { margin-bottom: 20px !important; }
  .owned-media-card--primary::after { display: none !important; }
  .owned-media-btn { margin-top: 8px !important; }

  /* News: never reserve an empty beige image block */
  .insights-head-row { gap: 22px !important; }
  .insights-head-row > .btn-ghost { width: 100% !important; justify-content: center !important; }
  .insights-news-grid { gap: 14px !important; margin-top: 30px !important; }
  .insight-card { min-height: 0 !important; border-radius: 12px; }
  .insight-card-link { min-height: 0 !important; height: auto !important; }
  .insight-thumb { aspect-ratio: 16 / 9 !important; min-height: 0 !important; background: #d8d2c8; }
  .insight-thumb img { display: block !important; width: 100% !important; height: 100% !important; object-fit: cover !important; }
  .insight-body { padding: 20px !important; }
  .insight-body h3 { font-size: 1.05rem !important; line-height: 1.55 !important; }
  .insight-body p { font-size: .86rem !important; line-height: 1.78 !important; }

  /* Lower sections */
  .strength {
    display: block !important;
  }
  .strength-left,
  .company-accent-col {
    position: static !important;
    top: auto !important;
  }
  .strength-grid { gap: 14px !important; }

  .company-layout { gap: 28px !important; }
  .faq-list { margin-top: 28px !important; }
  .contact-body { margin-top: 28px !important; }

  .back-to-top {
    right: 16px !important;
    bottom: calc(18px + env(safe-area-inset-bottom)) !important;
    width: 48px !important;
    height: 48px !important;
  }
}

@media (max-width: 390px) {
  .header-inner { padding-inline: 15px !important; }
  .logo { width: 158px; }
  .logo-img,
  .site-header.scrolled .logo-img,
  .site-header.is-scrolled .logo-img { height: 29px !important; }
  .hero-content { padding-inline: 17px !important; }
  .container { padding-inline: 17px !important; }
  .special-edition-inner { width: calc(100% - 30px) !important; }
}

@media (prefers-reduced-motion: reduce), (hover: none) and (pointer: coarse) {
  .hero-img,
  .hero-ai-stage::before,
  .hero-ai-orbit,
  .hero-ai-card,
  .marquee-track,
  [data-reveal] {
    animation: none !important;
    transform: none !important;
    transition: none !important;
  }
}
