/* Mobile-only stability and reading pass. Desktop is unchanged. */
@media (max-width:767px) {
  html { overflow-x:clip; -webkit-text-size-adjust:100%; }
  body { min-width:0; overflow-x:clip; }
  *,*::before,*::after { box-sizing:border-box; }
  img,video,svg { max-width:100%; }
  #siteHead > div, header.tomita-unified-header > div { min-width:0; }
  #siteHead .head-burger, header.tomita-unified-header .head-burger { min-width:44px; min-height:44px; justify-content:center; }
  #siteHead nav[aria-label="Enquiries"] > a:first-child,
  header.tomita-unified-header nav[aria-label="Enquiries"] > a:first-child { display:none!important; }
  #siteHead nav[aria-label="Enquiries"] a,
  header.tomita-unified-header nav[aria-label="Enquiries"] a { min-width:40px; min-height:44px; justify-content:center; }
  #tmMenu { max-width:100vw; padding:calc(18px + env(safe-area-inset-top)) 25px calc(22px + env(safe-area-inset-bottom)); overscroll-behavior:contain; }
  #tmMenu .tm-list { margin-top:1rem; }
  #tmMenu .tm-big { padding:.75rem 0; font-size:clamp(14px,3.9vw,17px); }
  #tmMenu .tm-foot { padding-top:1.5rem; }
  #gallery { padding:110px 20px 55px!important; }
  #gallery .g-row { height:auto!important; min-height:0!important; display:flex!important; flex-direction:column!important; gap:25px!important; padding:32px 0!important; }
  #gallery .g-fig { width:100%!important; max-width:100%!important; margin:0!important; transform:none!important; }
  #gallery .g-fig a { display:block; max-width:100%; }
  #gallery .g-fig img { width:100%; height:auto!important; max-height:none; object-fit:contain; }
  #gallery .g-text { width:100%!important; max-width:none!important; padding:5px 0 10px!important; margin:0!important; text-align:left!important; }
  #gallery .g-text p { max-width:100%; }
  #gallery .g-n { display:none!important; }
  #gallery figcaption { font-size:10px; line-height:1.5; }
}
@media (max-width:767px) {
  #homeGallery { padding:52px 20px!important; scroll-margin-top:0!important; }
  #homeGallery .g-row, #homeGallery .g-row:first-child {
    height:auto!important; min-height:0!important; display:flex!important;
    flex-direction:column!important; gap:26px!important;
    padding:34px 0 48px!important; align-items:stretch!important;
  }
  #homeGallery .g-row + .g-row { border-top:1px solid rgba(31,24,19,.12)!important; }
  #homeGallery .g-row .g-fig,
  #homeGallery .g-row .g-text { position:relative; width:100%!important; max-width:none!important; min-width:0!important; grid-area:auto!important; margin:0!important; padding:0!important; transform:none!important; align-self:auto!important; justify-self:auto!important; }
  #homeGallery .g-row .g-fig a, #homeGallery .g-row:first-child .g-space a, #homeGallery .g-row.g-flip .g-a a { display:block; width:100%!important; height:auto!important; max-height:none!important; overflow:hidden; }
  #homeGallery .g-row .g-fig img { width:100%!important; height:auto!important; max-height:none!important; object-fit:contain!important; }
  #homeGallery .g-row .g-text { order:0; text-align:left!important; }
  #homeGallery .g-row .g-a { order:1; }
  #homeGallery .g-row .g-b { order:2; width:min(72%,300px)!important; align-self:flex-end!important; }
  #homeGallery .g-text h3, #homeGallery .g-row:first-child .g-thesis h3 { font-size:clamp(22px,5.7vw,27px)!important; line-height:1.3!important; max-width:100%!important; }
  #homeGallery .g-text p, #homeGallery .g-row:first-child .g-thesis p { font-size:15px!important; line-height:1.7!important; max-width:100%!important; }
  #homeGallery .g-closing-line { display:block!important; max-width:100%!important; }
  #homeGallery figcaption { font-size:9px!important; line-height:1.6; }
  #homeGallery .g-n { display:none!important; }
  #stEdit .charcoal-page, #stEdit .charcoal-page-one, #stEdit .charcoal-page-two {
    height:auto!important; min-height:0!important; overflow:visible!important;
    padding:48px 22px 60px!important;
  }
  #stEdit .charcoal-page-one, #stEdit .charcoal-page-two { display:flex!important; flex-direction:column!important; gap:34px!important; }
  #stEdit .charcoal-film, #stEdit .charcoal-opening, #stEdit .charcoal-material { width:100%!important; max-width:100%!important; margin:0!important; transform:none!important; }
  #stEdit .charcoal-film video { width:100%!important; height:auto!important; max-height:none!important; aspect-ratio:16/10; object-fit:cover; }
  #stEdit .charcoal-kiri, #stEdit .charcoal-kozo { width:100%!important; display:grid!important; grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important; gap:16px!important; transform:none!important; }
  #stEdit .charcoal-kiri .charcoal-image, #stEdit .charcoal-kozo .charcoal-image { height:auto!important; min-height:170px; aspect-ratio:3/4; }
  #stEdit .charcoal-copy { align-self:center!important; }
  #stEdit .charcoal-material p { overflow-wrap:break-word; }
  #showroom .sr-film { aspect-ratio:4/5!important; }
  #showroom .sr-film img { object-fit:cover!important; }
  #showroom .showroom-made { padding:12px; }
  #stPhoto { height:clamp(280px,55svh,470px)!important; }
  #stPhoto .st-explain { max-width:90vw!important; }
}
@media (max-width:359px) {
  #siteHead nav[aria-label="Enquiries"] a[aria-label="Find Tomita"],
  header.tomita-unified-header nav[aria-label="Enquiries"] a[aria-label="Find Tomita"] { display:none!important; }
}

/* Mobile stability pass: prevent scrolling from changing hero scale / viewport layout. */
@media(max-width:767px){
  html body #top,html body #heroImages {height:100svh!important;min-height:0!important;overflow:hidden!important;}
  html body #heroImages .hero-image-stage,html body #heroImages .hero-image-frame {height:100%!important;max-height:100%!important;overflow:hidden!important;transform:none!important;scale:1!important;}
  html body #heroImages .hero-image-frame img,html body #heroImages .hero-image-stage img {transform:none!important;scale:1!important;animation:none!important;object-fit:cover!important;}
  html body #heroImages .hero-image-caption {left:26px!important;right:26px!important;bottom:118px!important;}
  html body #heroImages .hero-image-caption h2 {font-size:clamp(25px,7vw,31px)!important;}
  html body #heroImages .hero-image-caption p {font-size:13px!important;line-height:1.55!important;}
  #craftAtmosphere {display:none!important;}
  #stPhoto.is-craft-controlled>img {opacity:1!important;}
  #stPhoto.is-craft-controlled .st-made {opacity:1!important;}
  html body #compare {height:auto!important;min-height:0!important;padding:28px 0 0!important;overflow:hidden;}
  html body #compare > div:first-child {height:auto!important;min-height:0!important;display:flex!important;flex-wrap:wrap!important;gap:8px 17px!important;padding:0 20px 20px!important;}
  html body #compare [data-set].tm-set {grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:6px!important;width:100%!important;}
  html body #compare .tm-room {height:clamp(220px,37svh,360px)!important;min-height:0!important;}
  html body #compare .tm-room img {height:100%!important;max-height:none!important;object-fit:cover!important;}
  html body #compare .tm-room-btn {left:12px!important;top:12px!important;width:40px!important;height:40px!important;}
  html body #compare .tm-room-cap {left:12px!important;top:56px!important;line-height:1.4!important;font-size:9px!important;}
  html body #compare a[href="customize.html"] {width:100%;margin:6px 0 0!important;padding:9px 0!important;text-align:left!important;font-size:15px!important;}
  html body #compare .tm-set-tab {font-size:10px!important;letter-spacing:.14em!important;}
  html body #essence,html body #showroom {margin-inline:20px!important;}
  html body #essence {padding-block:32px!important;}
  html body #essence #roomSlider {margin-top:25px!important;}
  html body #essence #roomSlider>figure {width:min(70vw,270px)!important;}
  html body #homeGallery {padding-inline:26px!important;}
  html body #homeGallery .g-row {gap:34px!important;}
  html body #homeGallery .g-row .g-b {margin-top:9px!important;}
  html body #homeGallery .g-text {padding-inline:2px!important;}
  html body #gallery {padding:108px 26px 72px!important;}
  html body #gallery .g-row {gap:30px!important;}
  html body #gallery .g-text {padding-inline:4px!important;}
  html body #gallery .g-text h3 {font-size:22px!important;line-height:1.32!important;}
  html body #gallery .g-text p {font-size:15px!important;line-height:1.7!important;}
}
@media(max-width:380px){
  html body #compare .tm-room{height:225px!important;}
}

/* Verified ordering fix: load this sheet AFTER homepage inline styles. */
@media (max-width:767px) {
  html,body{width:100%;max-width:100%;overflow-x:clip!important;scroll-behavior:auto!important}
  #homeGallery{padding:32px 24px 8px!important;margin:0!important;}
  #homeGallery .g-row,#homeGallery .g-row:first-child,#homeGallery .g-row.g-flip{
    display:flex!important;flex-direction:column!important;
    height:auto!important;min-height:0!important;
    grid-template-rows:none!important;align-content:normal!important;
    padding:32px 0 42px!important;margin:0!important;gap:26px!important;
  }
  #homeGallery .g-row .g-text,#homeGallery .g-row:first-child .g-thesis{
    width:100%!important;max-width:100%!important;
    padding:0!important;margin:0!important;transform:none!important;
    align-self:stretch!important;text-align:left!important;
  }
  #homeGallery .g-row .g-a,#homeGallery .g-row .g-b,#homeGallery .g-row:first-child .g-space,#homeGallery .g-row:first-child .g-material{
    position:relative!important;max-width:100%!important;margin:0!important;transform:none!important;
    align-self:stretch!important;justify-self:auto!important;
  }
  #homeGallery .g-row .g-a,#homeGallery .g-row:first-child .g-space{width:100%!important;}
  #homeGallery .g-row .g-b,#homeGallery .g-row:first-child .g-material{width:70%!important;align-self:flex-end!important;}
  #homeGallery .g-row .g-fig a,#homeGallery .g-row:first-child .g-space a{
    width:100%!important;height:auto!important;max-height:none!important;
  }
  #homeGallery .g-row .g-fig img,#homeGallery .g-row:first-child .g-space img{
    display:block;width:100%!important;height:auto!important;max-height:none!important;
    object-fit:contain!important;
  }
  #homeGallery .g-text h3,#homeGallery .g-row:first-child .g-thesis h3{font-size:clamp(23px,6.1vw,29px)!important;}
  #homeGallery .g-text p,#homeGallery .g-row:first-child .g-thesis p{font-size:15px!important;line-height:1.72!important;max-width:none!important;}
  #homeGallery .g-row .g-text{order:0!important;}
  #homeGallery .g-row .g-a{order:1!important;}
  #homeGallery .g-row .g-b{order:2!important;}
  #statement{margin-top:0!important;padding-top:0!important;}
  #stPhoto{margin:0!important;height:clamp(250px,45svh,385px)!important;min-height:0!important;}
  #stPhoto>img{height:100%!important;max-height:none!important;object-fit:cover!important;}
  #stEdit{margin-top:0!important;padding:0!important;}
  #stEdit .charcoal-page,#stEdit .charcoal-page-one,#stEdit .charcoal-page-two{
    height:auto!important;min-height:0!important;overflow:visible!important;
    padding:40px 24px 52px!important;
  }
  #stEdit .charcoal-page-one,#stEdit .charcoal-page-two{display:flex!important;flex-direction:column!important;gap:28px!important;}
  #craftAtmosphere{display:none!important;}
  #heroImages,#top{height:100svh!important;}
  #heroImages .hero-image-frame,#heroImages .hero-image-frame img{transform:none!important;scale:1!important;}
  #compare{height:auto!important;min-height:0!important;}
  #compare .tm-room{height:clamp(220px,37svh,340px)!important;}
  #gallery{padding:112px 26px 56px!important;}
  #gallery .g-row{height:auto!important;min-height:0!important;padding:22px 0 44px!important;}
  #gallery .g-text{padding:0 2px!important;}
  /* Keep native touch scrolling: avoid scroll-linked visual reveals on mobile. */
  html.rv-on body #homeGallery [data-rv],
  html.rv-on body #stEdit [data-rv],
  html.rv-on body #essence [data-rv],
  html.rv-on body #showroom [data-rv]{
    opacity:1!important;translate:none!important;transform:none!important;
    transition:none!important;animation:none!important;
  }
}

/* 2026-10-10 iPhone recording repairs: motion is discrete, never scroll-scrubbed. */
@media(max-width:767px){
  html body #homeGallery .g-row.g-flip .g-text,
  html body #homeGallery .g-row.g-flip .g-text h3,
  html body #homeGallery .g-row.g-flip .g-text p,
  html body #homeGallery .g-row.g-flip .g-col,
  html body #homeGallery .g-row.g-flip .g-cta,
  html body #homeGallery .g-row.g-flip .g-closing-line {
    text-align:left!important;margin-left:0!important;margin-right:0!important;
    max-width:100%!important;
  }
  html body #homeGallery .g-row.g-flip .g-cta {display:inline-block!important;width:max-content!important;}
  html body #homeGallery .g-row.g-flip .g-a{width:100%!important;}
  html body #homeGallery .g-row.g-flip .g-b{width:70%!important;}
  html body #homeGallery .g-text{padding:0!important;}
  html body #homeGallery .g-row .g-material{margin-top:0!important;}
  html body #stPhoto{isolation:isolate!important;}
  html body #stPhoto::after{display:none!important;}
  html body #stPhoto .st-made{
    opacity:1!important;transition:none!important;
    background:radial-gradient(ellipse 85% 55% at center,rgba(0,0,0,.27),transparent 72%)!important;
  }
  html body #stPhoto::before{
    content:""!important;display:block!important;position:absolute!important;
    inset:0!important;z-index:1!important;pointer-events:none!important;
    background:#080808!important;opacity:0!important;
    transition:opacity 700ms cubic-bezier(.22,1,.36,1)!important;
  }
  html body #stPhoto.tm-mobile-dim::before{opacity:.34!important;}
  html body #stPhoto .st-made{z-index:2!important;}
  /* Avoid costly full-resolution SVG detail filters during finger scrolling. */
  html body #heroImages img,html body #homeGallery img,
  html body #stPhoto img,html body #stEdit img,
  html body #essence img,html body #compare img,
  html body #showroom img {
    filter:none!important;backdrop-filter:none!important;
  }
  html body #heroImages .hero-image-frame{
    animation:none!important;will-change:auto!important;
  }
  html body #homeGallery [data-rv],html body #stEdit [data-rv]{
    will-change:auto!important;
  }
}

/* Finger reversals never trigger a header transform animation. */
@media(max-width:767px){
 html body #siteHead{transition:none!important;will-change:auto!important;}
 html body #siteHead.tm-gallery-header-hidden{transition:none!important;transform:translate3d(0,-110%,0)!important;}
 html body #stPhoto.tm-mobile-dim::before{opacity:.27!important;}
}

@media(max-width:767px){
 html body #top,html body #heroImages,html body #heroImages .hero-image-stage {
   height:var(--tm-mobile-hero-height,100svh)!important;
   min-height:0!important;max-height:var(--tm-mobile-hero-height,100svh)!important;
 }
 html body #heroImages .hero-image-frame,
 html body #heroImages .hero-image-frame img {
   transform:none!important;scale:1!important;
   height:100%!important;max-height:none!important;
   animation:none!important;
 }
 html body #heroImages .hero-image-frame img{width:100%!important;object-fit:cover!important;}
 html body #stPhoto .tm-mobile-photo-shade{
   position:absolute!important;inset:0!important;display:block!important;
   z-index:1!important;background:rgba(7,7,7,.43)!important;
   opacity:0!important;pointer-events:none!important;
   transition:opacity 600ms cubic-bezier(.22,1,.36,1)!important;
 }
 html body #stPhoto .tm-mobile-photo-shade.is-active{opacity:1!important;}
 html body #stPhoto .st-made{z-index:2!important;}
}

/* The slideshow controls are an overlay, never a separate expanding band. */
@media(max-width:767px){
 html body #heroImages{position:relative!important;display:block!important;overflow:hidden!important;contain:layout!important;}
 html body #heroImages .hero-image-stage{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;max-height:none!important;}
 html body #heroImages .hero-image-frame{position:absolute!important;inset:0!important;height:100%!important;}
 html body #heroImages .hero-image-frame img{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;object-fit:cover!important;}
 html body #heroImages .hero-image-footer{
   position:absolute!important;top:auto!important;left:0!important;right:0!important;
   bottom:0!important;width:100%!important;height:94px!important;min-height:94px!important;
   padding:0 20px max(10px,env(safe-area-inset-bottom))!important;
   margin:0!important;transform:none!important;display:flex!important;align-items:center!important;
   background:linear-gradient(to top,rgba(15,14,13,.82),rgba(15,14,13,0))!important;
 }
 html body #heroImages .hero-image-caption{bottom:125px!important;}
 html body #heroImages .hero-collection-link,html body #heroImages .hero-image-controls{flex-shrink:0!important;}
}

/* Mobile Made in Japan spotlight: retain the image, dim only its surroundings. */
@media(max-width:767px){
 html body .tm-japan-surround{position:fixed!important;left:0!important;right:0!important;z-index:65!important;background:#070707!important;opacity:0!important;pointer-events:none!important;transition:opacity 650ms cubic-bezier(.22,1,.36,1)!important;}
 html body .tm-japan-surround-top{top:0!important;}
 html body .tm-japan-surround.is-active{opacity:.92!important;}
 html body #stPhoto .tm-mobile-photo-shade{display:none!important;}
 html body #stPhoto::before{display:none!important;}
}

/* Page-attached aperture. Never position/follow it against the viewport. */
@media(max-width:767px){
 html body .tm-japan-surround{display:none!important;}
 html body .tm-japan-page-aperture{
   position:absolute!important;z-index:65!important;
   pointer-events:none!important;background:transparent!important;
   box-shadow:0 0 0 100vmax rgba(7,7,7,.92)!important;
   opacity:0!important;
   transition:opacity 720ms cubic-bezier(.22,1,.36,1)!important;
 }
 html body .tm-japan-page-aperture.is-active{opacity:1!important;}
}
