/*
 * TOP / mobile layout polish for local client review, 2026-08-30.
 *
 * This file is intentionally mobile-only. The current Stage02 desktop design
 * remains unchanged at 769px and above.
 */

@media (max-width: 768px) {
  /* HERO: scale the headline close to the viewport edges, like the PC key visual. */
  .fv4ref--mobile-current .fv4ref-copy {
    width: calc(100% + 16px);
    margin-left: -8px;
  }

  .fv4ref--mobile-current .fv4ref-lead {
    font-size: clamp(26px, 8.35vw, 38px);
    letter-spacing: -.01em;
  }

  .fv4ref--mobile-current .fv4ref-copy h1 {
    padding-bottom: 24px;
    letter-spacing: -.065em;
  }

  .fv4ref--mobile-current .fv4ref-copy h1 span {
    z-index: auto;
    isolation: auto;
    padding-right: .02em;
    font-size: clamp(86px, 26vw, 116px);
  }

  .fv4ref--mobile-current .fv4ref-copy h1 small {
    margin-left: .1em;
    font-size: clamp(28px, 9vw, 42px);
    letter-spacing: -.08em;
  }

  .fv4ref--mobile-current .fv4ref-copy h1 span::after {
    left: 50%;
    bottom: -5px;
    z-index: -1;
    width: 112%;
    min-width: 160px;
    max-width: 230px;
    height: clamp(14px, 4.2vw, 18px);
    opacity: .94;
    border: 0;
    border-radius: 0;
    background: url("hero-kaitetsu-swash-light-v1-delivery-64a56ac644.webp") center / 100% 100% no-repeat;
    box-shadow: none;
    transform: translateX(-50%);
    transform-origin: center;
  }

  /* HERO: keep all six supported industries close to the headline in a compact 3 x 2 grid. */
  .fv4ref--mobile-current .fv4ref-main {
    grid-template-areas:
      "copy"
      "industry"
      "device"
      "badges"
      "product";
  }

  .fv4ref--mobile-current .fv4ref-industry-nav {
    grid-area: industry;
    position: relative;
    z-index: 4;
    inset: auto;
    box-sizing: border-box;
    display: grid !important;
    width: 100%;
    height: auto;
    margin: 0 0 10px;
    padding: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, 30px);
    gap: 4px 5px;
    align-items: center;
    overflow: visible;
    border-bottom: 0;
    background: transparent;
  }

  .fv4ref--mobile-current .fv4ref-industry-nav a,
  .fv4ref--mobile-current .fv4ref-industry-nav a:nth-child(n) {
    width: auto;
    box-sizing: border-box;
    height: 30px;
    min-height: 0;
    padding: 0 4px;
    border: 1px solid rgba(77, 154, 209, .16);
    border-radius: 2px;
    background: #fff;
    box-shadow: none;
    color: #092f5b;
    font-size: clamp(10px, 3vw, 13px);
    line-height: 1;
    text-align: center;
    white-space: nowrap;
  }

  .fv4ref--mobile-current .fv4ref-industry-nav::after {
    display: none;
  }

  /* Present the product mark as one intentional white lockup on the blue flow. */
  .fv4ref--mobile-current .fv4ref-product-sub {
    box-shadow: none;
  }

  .fv4ref--mobile-current .fv4ref-product-sub .jp {
    font-size: clamp(16px, 4.55vw, 20px);
  }

  .fv4ref--mobile-current .fv4ref-product-sub strong {
    font-size: clamp(26px, 7.2vw, 32px);
  }

  .fv4ref--mobile-current .fv4ref-product-row {
    box-sizing: border-box;
    width: max-content;
    max-width: 100%;
    margin-top: 10px;
    padding: 6px 8px;
    gap: 8px;
    border: 1px solid rgba(22, 88, 160, .14);
    border-radius: 4px;
    background: #fff;
    box-shadow: none;
  }

  .fv4ref--mobile-current .fv4ref-product-ruby {
    margin-bottom: 0;
  }

  /* Let the three proof circles overlap the tablet's lower edge slightly. */
  .fv4ref--mobile-current .fv4ref-badges {
    max-width: 440px;
    margin-top: -28px;
    justify-content: space-between;
    gap: 0;
  }

  .fv4ref--mobile-current .fv4ref-badge {
    width: clamp(94px, 29vw, 120px);
    height: clamp(94px, 29vw, 120px);
  }

  .fv4ref--mobile-current .fv4ref-badge .t1 {
    font-size: clamp(9px, 2.65vw, 11.5px);
  }

  .fv4ref--mobile-current .fv4ref-badge .t2,
  .fv4ref--mobile-current .fv4ref-badge:nth-child(2) .t2 {
    font-size: clamp(32px, 9.4vw, 42px);
  }

  .fv4ref--mobile-current .fv4ref-badge .t2 small {
    font-size: clamp(11px, 3.1vw, 15px);
  }

  .fv4ref--mobile-current .fv4ref-badge .t3 {
    font-size: clamp(9px, 2.35vw, 11px);
  }

  .fv4ref--mobile-current .fv4ref-badge.is-subsidy .t1 {
    font-size: clamp(8px, 2.25vw, 10px);
  }

  .fv4ref--mobile-current .fv4ref-badge.is-subsidy img {
    width: clamp(43px, 12.5vw, 55px);
  }

  /* Keep the smartphone MENU control reachable while the page scrolls. */
  html.nav-drawer-ready .header:not(.header-min) .header-menu-toggle {
    position: fixed;
    z-index: 4900;
    top: 11px;
    right: clamp(12px, 4vw, 24px);
    box-shadow: 0 8px 22px -14px rgba(17, 46, 86, .65);
  }

  /* Preserve the intentionally large tablet while keeping both edges visible. */
  .fv4ref--mobile-current .fv4ref-main > picture {
    left: 50%;
    width: calc(100vw - 4px);
    max-width: none;
    margin: 6px 0 0;
    justify-self: start;
    transform: translateX(-50%);
  }

  /* DIAGNOSIS: mobile body copy stays at a readable baseline. */
  .switch-diagnosis-c__lead,
  .switch-diagnosis-c__check-text,
  .switch-diagnosis-c__result-copy,
  .switch-diagnosis-c__cta {
    font-size: 16px;
  }

  .switch-diagnosis-c__check {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .switch-diagnosis-c__box {
    width: 23px;
    height: 23px;
  }

  /* FEATURES: one full-bleed horizontal photo plus an overlapping copy card. */
  section.features-organic {
    padding: 72px 0 88px;
    overflow: hidden;
  }

  section.features-organic .ofe-head {
    width: calc(100% - 40px);
    margin: 0 auto 36px;
  }

  section.features-organic .ofe-list {
    display: grid;
    width: 100%;
    gap: 38px;
  }

  section.features-organic .ofe-chapter {
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: visible;
    background: transparent;
    border-radius: 0;
  }

  section.features-organic .ofe-chapter::before {
    content: none;
  }

  section.features-organic .ofe-chapter-inner,
  section.features-organic .ofe-chapter:nth-child(even) .ofe-chapter-inner {
    display: flex;
    width: 100%;
    min-height: 0;
    margin: 0;
    gap: 0;
    flex-direction: column;
  }

  section.features-organic .ofe-photo,
  section.features-organic .ofe-chapter:nth-child(odd) .ofe-photo,
  section.features-organic .ofe-chapter:nth-child(even) .ofe-photo {
    position: relative;
    inset: auto;
    order: 0;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    margin: 0;
    transform: none;
    clip-path: none;
    overflow: hidden;
  }

  section.features-organic .ofe-photo-window,
  section.features-organic .ofe-chapter:nth-child(n) .ofe-photo-window {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 0;
    clip-path: none;
    box-shadow: none;
  }

  section.features-organic .ofe-photo::after {
    content: none;
  }

  section.features-organic .ofe-photo-image {
    inset: 0;
    filter: saturate(.84) brightness(1.04) contrast(.96);
  }

  section.features-organic .ofe-photo-image.is-1 {
    background-position: 34% 50%;
  }

  section.features-organic .ofe-photo-image.is-2 {
    background-position: 50% 52%;
  }

  section.features-organic .ofe-photo-image.is-3 {
    background-position: 0 100%;
  }

  section.features-organic .ofe-photo-image.is-4 {
    background-position: 50% 40%;
  }

  section.features-organic .ofe-copy,
  section.features-organic .ofe-chapter:nth-child(even) .ofe-copy {
    position: relative;
    z-index: 4;
    inset: auto;
    order: 1;
    width: min(680px, calc(100% - 32px));
    margin: clamp(-112px, -15vw, -72px) auto 0;
    padding: 28px 24px 30px;
    overflow: hidden;
    border: 1px solid rgba(172, 204, 229, .72);
    border-radius: 14px;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 20px 46px -30px rgba(4, 47, 92, .48);
    clip-path: none;
    backdrop-filter: blur(7px);
  }

  section.features-organic .ofe-heading {
    margin: 0 0 18px;
    padding: 0;
    font-size: clamp(24px, 6.7vw, 30px);
    line-height: 1.45;
  }

  section.features-organic .ofe-lead,
  section.features-organic .ofe-body {
    max-width: none;
    padding-right: 0;
    font-size: 16px;
  }

  section.features-organic .ofe-lead {
    margin-bottom: 12px;
    line-height: 1.82;
  }

  section.features-organic .ofe-body {
    line-height: 1.9;
  }

  section.features-organic .ofe-watermark-icon {
    top: 18px;
    right: 16px;
    width: 148px;
    opacity: .055;
  }

  /* INDUSTRY: eliminate the cramped two-column card layout. */
  section[data-sec="08 INDUSTRY 業種別"] .cards.icards {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  section[data-sec="08 INDUSTRY 業種別"] .card.icard {
    width: 100%;
    min-width: 0;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 14px 34px -26px rgba(3, 52, 101, .48);
  }

  section[data-sec="08 INDUSTRY 業種別"] .ic-photo {
    width: 100%;
    aspect-ratio: 16 / 10;
  }

  section[data-sec="08 INDUSTRY 業種別"] .ic-foot {
    align-items: flex-start;
    gap: 0;
    padding: 22px 20px 24px;
  }

  section[data-sec="08 INDUSTRY 業種別"] .card.icard h3,
  section[data-sec="08 INDUSTRY 業種別"] .ic-name {
    margin: 0;
    font-size: 19px;
    line-height: 1.65;
    text-align: left;
  }

  section[data-sec="08 INDUSTRY 業種別"] .card.icard .ic-more {
    min-height: 44px;
    margin: 18px 0 0;
    padding: 10px 18px;
    align-self: flex-start;
  }

  /* HISTORY: years become compact labels instead of a tall stretched column. */
  section.history-sec[data-sec="09 HISTORY 開発秘話"] {
    margin: 0;
    padding: 76px 0 88px;
    background-position: 48% center;
  }

  section.history-sec[data-sec="09 HISTORY 開発秘話"] .history-2col {
    gap: 24px;
  }

  section.history-sec[data-sec="09 HISTORY 開発秘話"] .history-head {
    position: relative;
    top: auto;
    padding-top: 0;
  }

  section.history-sec[data-sec="09 HISTORY 開発秘話"] .history-head > .lead {
    margin-top: 18px;
    font-size: 16px;
    line-height: 1.8;
  }

  section.history-sec[data-sec="09 HISTORY 開発秘話"] .history-head > .eyebrow {
    position: static;
    color: #b7d1ec;
  }

  section.history-sec[data-sec="09 HISTORY 開発秘話"] .history-scroll {
    max-height: 520px;
    padding: 22px 18px;
    border-radius: 12px;
    overscroll-behavior: contain;
  }

  section.history-sec[data-sec="09 HISTORY 開発秘話"] .htl::before,
  section.history-sec[data-sec="09 HISTORY 開発秘話"] .htl-ch::before {
    content: none;
  }

  section.history-sec[data-sec="09 HISTORY 開発秘話"] .htl-ch {
    display: block;
    margin: 0 0 28px;
    padding: 0 0 28px;
    border-bottom: 1px solid #d8e4ef;
  }

  section.history-sec[data-sec="09 HISTORY 開発秘話"] .htl-year {
    display: inline-flex;
    width: auto;
    height: auto;
    margin: 0 0 14px;
    padding: 7px 13px;
    align-items: center;
    border: 1px solid #c5d9eb;
    border-radius: 999px;
    background: #edf7ff;
    font-size: 18px;
    line-height: 1.2;
    text-align: left;
  }

  section.history-sec[data-sec="09 HISTORY 開発秘話"] .htl-body {
    padding-left: 0;
  }

  section.history-sec[data-sec="09 HISTORY 開発秘話"] .htl-body p,
  section.history-sec[data-sec="09 HISTORY 開発秘話"] .htl-body li,
  section.history-sec[data-sec="09 HISTORY 開発秘話"] .htl-end p {
    font-size: 16px;
    line-height: 1.9;
  }

  section.history-sec[data-sec="09 HISTORY 開発秘話"] .htl-body ul {
    margin-top: 16px;
    padding: 16px;
  }

  section.history-sec[data-sec="09 HISTORY 開発秘話"] .htl-end {
    margin-left: 0;
    padding: 2px 0 0;
    border-top: 0;
  }

  /* RESULTS: retain the card design but raise the small copy to mobile baseline. */
  section[data-sec="07 RESULT 導入成果"].results-reference .rr-kick,
  section[data-sec="07 RESULT 導入成果"].results-reference .rr-label,
  section[data-sec="07 RESULT 導入成果"].results-reference .rr-body {
    font-size: 16px !important;
  }

  /* CTA: keep the heading strong without letting it dominate the viewport. */
  section.cta2[data-sec="12 CTA"] {
    padding: 48px 0 52px;
  }

  section.cta2[data-sec="12 CTA"] #contact-cta-title {
    margin: 16px auto 14px;
    max-width: 100%;
    font-size: clamp(22px, 6vw, 27px);
    line-height: 1.42;
    letter-spacing: .01em;
    text-wrap: balance;
  }

  section.cta2.cta2--concept-a.cta2--four-actions[data-sec="12 CTA"] .cta2-text {
    margin-bottom: 24px;
    font-size: 16px;
    line-height: 1.75;
  }

  /* FOOTER: each navigation group gets the full width and a clear tap rhythm. */
  .ft {
    padding-top: 56px;
  }

  .ft .ft-inner {
    gap: 36px;
  }

  .ft .ft-company {
    font-size: 16px;
    line-height: 1.9;
  }

  .ft .ft-links {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .ft .ft-links > div {
    min-width: 0;
  }

  .ft .ft-links h4 {
    margin: 0 0 4px;
    padding-bottom: 12px;
    font-size: 18px;
  }

  .ft .ft-links a {
    display: flex;
    min-height: 44px;
    margin: 0;
    padding: 8px 0;
    align-items: center;
    font-size: 15px;
    line-height: 1.65;
  }

  .ft .ft-links a:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, .1);
  }

  .card.icard:focus-visible,
  .switch-diagnosis-c__cta:focus-visible,
  .cta2-four-card:focus-visible,
  .ft a:focus-visible {
    outline: 3px solid #ffe45c;
    outline-offset: 3px;
  }
}

@media (max-width: 420px) {
  section.features-organic .ofe-copy,
  section.features-organic .ofe-chapter:nth-child(even) .ofe-copy {
    width: calc(100% - 28px);
    padding: 26px 20px 28px;
  }

  section.features-organic .ofe-heading {
    font-size: 24px;
  }
}

@media (max-width: 520px) {
  /* Keep the intentionally over-wide tablet centered so both sides crop evenly. */
  .fv4ref--mobile-current .fv4ref-main > picture {
    transform: translateX(-50%);
  }
}
