/* TERAKAWA - phone layout for translated index pages (2026-10-03)
   An exact copy of the Japanese index phone rules (css/index.css, "mobile-compact"),
   with the html[lang="ja"] scope widened to html[lang]. Loaded ONLY by index pages
   that opt in, together with js/common.js (which builds the accordions/carousels). */

/* ==========================================================================
   merged from mobile-compact (Japanese index only)
   Purpose : reduce vertical scroll length on smartphones WITHOUT removing
             any text. All content stays in the HTML source, so SEO and
             AI-citation coverage are unchanged.
   Scope   : effective only at max-width:900px. Desktop / iPad = untouched.
   ========================================================================== */

/* --- shared primitives -----------------------------------------------------
   Outside the phone breakpoint every wrapper this script injects is set to
   display:contents, i.e. it is removed from the layout tree entirely.
   Desktop and iPad therefore render byte-for-byte as before.
   -------------------------------------------------------------------------- */
html[lang] .mc-panel,
html[lang] .mc-panel-in,
html[lang] .mc-head{display:contents}
html[lang] .mc-toggle{display:none}
html[lang] .mc-carousel-dots{display:none}
html[lang] .mc-progress{display:none}
html[lang] .mc-jump{display:none}

@media (max-width:767px){

  /* ---- 0. anchor offset for the fixed header ---------------------------- */
  html[lang] section[id]{scroll-margin-top:118px}

  /* ---- 1. scroll progress bar ------------------------------------------ */
  /* .scroll-progress-bar (cutting-edge.css, native CSS scroll-timeline) and
     .mc-progress (below, JS-driven) are two separate bar implementations.
     Only one should render at a time. On ja mobile, .mc-progress is the
     active one, so the native CSS one is switched off here to prevent the
     two from overlapping/drifting apart into a double line. */
  html[lang] .scroll-progress-bar{display:none}
  html[lang] .mc-progress{
    display:block;position:fixed;top:0;left:0;height:2px;width:0;
    background:var(--accent);z-index:200;
    transition:width .12s linear;pointer-events:none
  }

  /* ---- 2. jump navigation strip (placed after .trust-bar) --------------- */
  html[lang] .mc-jump{
    display:block;background:var(--paper);
    border-bottom:1px solid var(--line);
    padding:14px 0 13px
  }
  html[lang] .mc-jump-scroll{
    display:flex;gap:22px;overflow-x:auto;overflow-y:hidden;
    touch-action:pan-x;overscroll-behavior-y:none;
    padding:0 18px 3px;
    -webkit-overflow-scrolling:touch;scrollbar-width:none
  }
  html[lang] .mc-jump-scroll::-webkit-scrollbar{display:none}
  html[lang] .mc-jump-scroll a{
    flex:0 0 auto;text-decoration:none;
    font-family:var(--serif-en);font-style:italic;
    font-size:12px;letter-spacing:.22em;text-transform:uppercase;
    color:var(--ink-mute);padding-bottom:4px;
    border-bottom:1px solid transparent;white-space:nowrap;
    transition:color .3s,border-color .3s
  }
  html[lang] .mc-jump-scroll a.mc-active{color:var(--accent-dark);border-bottom-color:var(--accent)}

  /* ---- 3. accordion (problem cards / why items) ------------------------- */
  html[lang] .mc-panel{
    display:grid;grid-template-rows:1fr;
    transition:grid-template-rows .42s cubic-bezier(.22,.61,.36,1)
  }
  html[lang] .mc-panel-in{display:block;overflow:hidden;min-height:0}
  html[lang] .mc-acc .mc-head{
    display:flex;align-items:flex-start;justify-content:space-between;
    gap:16px;width:100%
  }
  html[lang] .mc-acc .mc-head > :first-child{flex:1 1 auto;margin-bottom:0}
  /* 44x44 touch area, 30px circle drawn inside -> visually unchanged */
  html[lang] .mc-toggle{
    display:flex;align-items:center;justify-content:center;position:relative;
    flex:0 0 auto;width:44px;height:44px;margin:-5px -7px 0 0;
    background:
      linear-gradient(currentColor,currentColor) center/11px 1px no-repeat;
    border:0;border-radius:50%;cursor:pointer;padding:0;
    color:var(--accent);-webkit-tap-highlight-color:transparent
  }
  html[lang] .mc-toggle::before{
    content:'';position:absolute;left:50%;top:50%;
    width:30px;height:30px;margin:-15px 0 0 -15px;
    border:1px solid var(--line);border-radius:50%;
    transition:background .3s,border-color .3s
  }
  html[lang] .mc-toggle::after{
    content:'';position:absolute;left:50%;top:50%;
    width:1px;height:11px;margin:-5.5px 0 0 -0.5px;
    background:currentColor;
    transition:transform .38s cubic-bezier(.22,.61,.36,1),opacity .3s
  }
  html[lang] .mc-acc.mc-open .mc-toggle::after{transform:scaleY(0);opacity:0}
  html[lang] .mc-acc.mc-open .mc-toggle::before{background:var(--paper-warm);border-color:var(--accent-soft)}
  html[lang] .mc-acc:not(.mc-open) .mc-panel{grid-template-rows:0fr}
  html[lang] .mc-acc:not(.mc-open) .mc-panel-in{opacity:0;transition:opacity .25s}
  html[lang] .mc-acc .mc-panel-in{opacity:1;transition:opacity .5s .1s}

  /* problem cards : tighter padding when collapsed */
  html[lang] .problem-grid{gap:14px!important}
  html[lang] .problem-card{padding:26px 22px!important;transition:padding .4s}
  html[lang] .problem-card .problem-num{margin-bottom:14px;padding-bottom:12px}
  html[lang] .problem-card .problem-title{font-size:17px;margin-bottom:0}
  html[lang] .problem-card .mc-panel-in > *:first-child{margin-top:16px}
  html[lang] .problem-card .problem-link{display:inline-block;margin-top:14px}

  /* why items : image + title stay visible, body text collapses */
  html[lang] .why-list{gap:34px!important}
  html[lang] .why-item,
html[lang] .why-item.reverse{gap:22px!important}
  html[lang] .why-content .why-title{margin-bottom:0;font-size:22px}
  html[lang] .why-content .mc-panel-in > *:first-child{margin-top:18px}
  html[lang] .why-desc{margin-bottom:20px}

  /* ---- 4. horizontal carousels (voice / pricing) ------------------------ */
  html[lang] .mc-carousel{
    display:flex!important;
    grid-template-columns:none!important;
    overflow-x:auto;overflow-y:hidden;
    gap:14px!important;
    padding:4px 18px 18px;
    margin:0 -18px;
    scroll-snap-type:x mandatory;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none
  }
  html[lang] .mc-carousel::-webkit-scrollbar{display:none}
  html[lang] .mc-carousel > *{
    flex:0 0 84%;
    scroll-snap-align:center;
    box-sizing:border-box
  }
  /* reveal animation would leave off-screen cards invisible -> force on */
  html[lang] .mc-carousel .reveal,
html[lang] .mc-carousel .reveal-left,
html[lang] .mc-carousel .reveal-right,
html[lang] .mc-carousel .reveal-scale{opacity:1!important;transform:none!important}

  html[lang] .mc-carousel-dots{
    display:flex;justify-content:center;align-items:center;
    gap:0;margin-top:0
  }
  /* 6px dot, 34x40 touch area */
  html[lang] .mc-carousel-dots button{
    width:34px;height:40px;padding:0;border:0;border-radius:0;
    background:transparent;cursor:pointer;position:relative;
    -webkit-tap-highlight-color:transparent
  }
  html[lang] .mc-carousel-dots button::before{
    content:'';position:absolute;left:50%;top:50%;
    width:6px;height:6px;margin:-3px 0 0 -3px;border-radius:50%;
    background:var(--line);transition:background .3s,transform .3s
  }
  html[lang] .mc-carousel-dots button.mc-dot-on::before{background:var(--accent);transform:scale(1.5)}

  /* pricing cards inside a carousel */
  html[lang] .price-card{padding:38px 26px!important}
  html[lang] .price-card.featured{transform:none!important}
  html[lang] .price-includes{margin-bottom:28px}
  html[lang] .voice-card{padding:32px 24px!important}
  html[lang] .voice-text{padding-top:30px;margin-bottom:22px}

  /* ---- 5. works : two columns ------------------------------------------ */
  html[lang] .works-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    display:grid!important;
    gap:10px!important
  }
  html[lang] .work-card-1,
html[lang] .work-card-6{
    grid-column:1 / -1!important;aspect-ratio:16 / 9!important
  }
  html[lang] .work-card-2,
html[lang] .work-card-3,
html[lang] .work-card-4,
html[lang] .work-card-5{
    grid-column:auto!important;aspect-ratio:4 / 5!important
  }
  /* full-bleed cards carry a larger title */
  html[lang] .works-grid .work-card-1 .work-title,
html[lang] .works-grid .work-card-6 .work-title{font-size:16px}
  html[lang] .works-grid .work-card-1 .work-meta,
html[lang] .works-grid .work-card-6 .work-meta{font-size:10px}
  html[lang] .works-grid .work-card-1 .works-num,
html[lang] .works-grid .work-card-6 .works-num{font-size:30px}
  html[lang] .works-grid .work-info{padding:14px 14px}
  html[lang] .works-grid .work-meta{font-size:9px;letter-spacing:.2em;margin-bottom:4px}
  html[lang] .works-grid .work-title{font-size:13px;letter-spacing:.04em}
  html[lang] .works-grid .works-num{top:12px;left:14px;font-size:24px}
  html[lang] .works-cta{margin-top:44px!important}

  /* ---- 6. flow : two columns ------------------------------------------- */
  html[lang] .flow-grid{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:0!important;
    border-top:1px solid var(--ink);border-left:1px solid var(--line)
  }
  html[lang] .flow-step{padding:26px 16px!important}
  html[lang] .flow-step-no{font-size:30px!important;margin-bottom:16px!important}
  html[lang] .flow-step-no::after{margin-top:14px}
  html[lang] .flow-step-name-en{font-size:9.5px;letter-spacing:.24em;margin-bottom:8px}
  html[lang] .flow-step-name-jp{font-size:15px;margin-bottom:12px}
  html[lang] .flow-step-desc{font-size:12px;line-height:1.85;margin-bottom:14px}
  html[lang] .flow-step-time{font-size:10px;padding-top:14px}

  /* ---- 7. footer : collapsible columns ---------------------------------- */
  html[lang] .footer-grid{gap:0!important;padding-bottom:26px!important}
  html[lang] .footer-col{border-top:1px solid rgba(255,255,255,.08)}
  html[lang] .footer-col .footer-col-title{
    display:flex;align-items:center;justify-content:space-between;
    width:100%;margin:0;padding:16px 0;cursor:pointer;
    background:none;border:0;text-align:left;
    font-family:var(--serif-en);font-style:italic;
    letter-spacing:.35em;color:#fff;font-size:11px;text-transform:uppercase
  }
  html[lang] .footer-col .footer-col-title::after{
    content:'+';font-family:var(--sans);font-style:normal;
    font-size:15px;line-height:1;color:rgba(255,255,255,.5);
    letter-spacing:0;transition:transform .35s
  }
  html[lang] .footer-col.mc-open .footer-col-title::after{content:'-';transform:translateY(-1px)}
  html[lang] .footer-col .mc-panel{padding:0}
  html[lang] .footer-col:not(.mc-open) .mc-panel{grid-template-rows:0fr}
  html[lang] .footer-col .mc-panel-in{padding-bottom:14px}

  /* carousel bleed must match the section padding of the current range */
  @media (min-width:481px){
    html[lang] .mc-carousel{padding:4px 24px 18px;margin:0 -24px}
  }

  /* ---- 7b. headings: keep every line inside the viewport ---------------
     word-break:keep-all is intentional (phrases must never split mid-word),
     so the type size is scaled instead of allowing a bad break.
     -------------------------------------------------------------------- */
  html[lang] .sec-title{font-size:min(32px,7.4vw)!important}
  html[lang] .flow .sec-title{font-size:min(32px,6.4vw)!important}
  html[lang] .footer-cta-title{font-size:min(28px,6.6vw)!important}
  html[lang] .about-headline{font-size:min(28px,7.4vw)!important}
  html[lang] .philosophy-text{font-size:min(26px,6.8vw)!important}

  /* ---- 8. minor vertical trims ----------------------------------------- */
  html[lang] .problem-header,
html[lang] .why-header,
html[lang] .pricing-header,
html[lang] .flow-header,
html[lang] .voice-header{
    margin-bottom:38px!important
  }
  html[lang] .works-header{margin-bottom:34px!important}
  html[lang] .philosophy{padding:88px 24px!important}
}


/* ==========================================================================
   rev.3 additions
   ========================================================================== */
@media (max-width:767px){

  /* ---- 9. touch targets: 44px minimum, zero visual change --------------
     An invisible ::before overlay enlarges the hit area vertically only.
     The element's own box, and therefore the layout, is untouched.
     -------------------------------------------------------------------- */
  html[lang] nav a,
html[lang] .mc-jump-scroll a,
html[lang] .folio-dl,
html[lang] .problem-link,
html[lang] .hero-folio-link,
html[lang] .hero-client-link,
html[lang] .works-cta,
html[lang] .price-cta,
html[lang] .why-link,
html[lang] .voice-link,
html[lang] .about-link,
html[lang] .footer-social a{position:relative}

  html[lang] nav a::before,
html[lang] .mc-jump-scroll a::before,
html[lang] .folio-dl::before,
html[lang] .problem-link::before,
html[lang] .hero-folio-link::before,
html[lang] .works-cta::before,
html[lang] .price-cta::before,
html[lang] .why-link::before,
html[lang] .voice-link::before,
html[lang] .about-link::before{
    content:'';position:absolute;left:0;right:0;top:50%;
    height:44px;transform:translateY(-50%);
    z-index:1;pointer-events:auto
  }
  /* stacked links: real padding instead, so neighbours cannot be stolen */
  html[lang] .footer-col a{padding:11px 0!important}
  html[lang] .hero-client-link{padding:11px 0}
  html[lang] .footer-social a{width:44px;height:44px}
  html[lang] .footer-social a svg{width:15px;height:15px}
  html[lang] .lang-menu a,
html[lang] .lang-switch a{min-height:44px;display:flex;align-items:center}

  /* ---- 10. minimum legible type ---------------------------------------- */
  html[lang] .dl-fmt,
html[lang] .dl-size{font-size:0.9em!important}
  html[lang] .topbar-center-label{font-size:10px!important}
  html[lang] .hero-clients-label{font-size:10.5px!important}
  html[lang] .hero-visual-caption{font-size:11.5px}
  html[lang] .flow-step-name-en{font-size:10.5px!important}
  html[lang] .flow-step-time{font-size:10.5px!important}
  html[lang] .why-img-badge-small{font-size:10.5px!important}
  html[lang] .footer-social-label{font-size:11px!important}
  html[lang] .works-grid .work-meta{font-size:10px!important}
  html[lang] .works-grid .work-card-1 .work-meta,
html[lang] .works-grid .work-card-6 .work-meta{font-size:10.5px!important}

  /* remaining small targets */
  html[lang] .works-filter-top a{position:relative}
  html[lang] .works-filter-top a::before{
    content:'';position:absolute;left:-6px;right:-6px;top:50%;
    height:44px;transform:translateY(-50%)
  }
  html[lang] .footer-col a{padding:12px 0!important}
  html[lang] .logo{padding:8px 0}

}

/* --- reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion:reduce){
  html[lang] .mc-panel,
html[lang] .mc-toggle::before,
html[lang] .mc-toggle::after,
html[lang] .mc-progress{transition:none}
}


/* ---- collapsed accordion panels: out of the tab order and the accessibility tree ---- */
@media (max-width:767px){
  html[lang] .mc-acc:not(.mc-open) .mc-panel-in,
  html[lang] .footer-col:not(.mc-open) .mc-panel-in{visibility:hidden;transition:opacity .25s,visibility 0s .42s}
  html[lang] .mc-acc.mc-open .mc-panel-in,
  html[lang] .footer-col.mc-open .mc-panel-in{visibility:visible;transition:opacity .5s .1s,visibility 0s}
}
