/* Automatic phone fit plus preserved A/B/C studies. Laptop rules remain untouched. */
@media (max-width:600px) {
  html[data-phone-layout] .menu-home {
    --figure-scale:.82;
    --menu-height:clamp(465px, calc(100svh - 178px), 570px);
    --head-height:78px;
    --lane-height:56px;
    --label-size:20px;
    --side-left:21%;
    --side-right:79%;
    --upper-y:27%;
    --lower-y:66%;
    --bottom-y:88%;
    --bottom-left:30%;
    --bottom-right:70%;
  }
  html[data-phone-layout=a] .menu-home {
    --figure-scale:.9;
    --menu-height:clamp(520px, calc(100svh - 184px), 590px);
    --head-height:80px;
    --lane-height:60px;
    --side-left:20%;--side-right:80%;
    --upper-y:29%;--lower-y:66%;--bottom-y:87%;
  }
  html[data-phone-layout=c] .menu-home {
    --figure-scale:.74;
    --menu-height:clamp(450px, calc(100svh - 184px), 545px);
    --head-height:78px;
    --lane-height:62px;
    --label-size:19px;
    --side-left:24%;--side-right:76%;
    --upper-y:28%;--lower-y:67%;--bottom-y:87%;
    --bottom-left:29%;--bottom-right:71%;
  }
  html[data-phone-layout] .menu-home .site-head {
    min-height:var(--head-height);height:var(--head-height);
    padding:10px 18px 0;align-items:flex-start;
  }
  html[data-phone-layout] .menu-home .reference-perch {
    top:8px;right:12px;transform:none;
  }
  html[data-phone-layout] .menu-home .home-main {padding:0 12px}
  html[data-phone-layout] .menu-home .constellation {
    height:var(--menu-height);min-height:0;max-height:none;
  }
  html[data-phone-layout] .menu-home .centre {top:49%}
  html[data-phone-layout] .menu-home .centre h1 {font-size:clamp(28px, 7.4vw, 42px);margin-bottom:10px}
  html[data-phone-layout] .menu-home .centre .date {font-size:19px}
  html[data-phone-layout=b] .menu-home .centre {top:46.5%}
  html[data-phone-layout] .menu-home .destination {
    width:132px;max-width:38%;padding:4px 0;
  }
  html[data-phone-layout] .menu-home .caption {
    font-size:var(--label-size);line-height:1.15;max-width:132px;
  }
  html[data-phone-layout] .menu-home .motif {
    height:calc(70px * var(--figure-scale));
    margin-bottom:7px;max-width:100%;
  }
  html[data-phone-layout] .menu-home .weekend {
    --x:50%;--y:10%;width:195px;max-width:65%;
  }
  html[data-phone-layout] .menu-home .weekend .caption {max-width:195px}
  html[data-phone-layout] .menu-home .weekend .motif {width:calc(128px * var(--figure-scale))}
  html[data-phone-layout] .menu-home .explore {--x:var(--side-left);--y:var(--upper-y)}
  html[data-phone-layout] .menu-home .travel {--x:var(--side-right);--y:var(--upper-y)}
  html[data-phone-layout] .menu-home .explore .motif {width:calc(103px * var(--figure-scale))}
  html[data-phone-layout] .menu-home .travel .motif {width:calc(112px * var(--figure-scale));gap:1px}
  html[data-phone-layout] .menu-home .travel .motif .artwork {width:calc(55px * var(--figure-scale))}
  html[data-phone-layout] .menu-home .reply {--x:var(--side-left);--y:var(--lower-y)}
  html[data-phone-layout] .menu-home .dress {--x:var(--side-right);--y:var(--lower-y)}
  html[data-phone-layout] .menu-home .reply .motif {width:calc(100px * var(--figure-scale))}
  html[data-phone-layout] .menu-home .dress .motif {width:calc(110px * var(--figure-scale))}
  html[data-phone-layout] .menu-home .food {--x:var(--bottom-left);--y:var(--bottom-y)}
  html[data-phone-layout] .menu-home .stay {--x:var(--bottom-right);--y:var(--bottom-y)}
  html[data-phone-layout] .menu-home .food .motif {width:calc(120px * var(--figure-scale))}
  html[data-phone-layout] .menu-home .stay .motif {width:calc(110px * var(--figure-scale))}
  html[data-phone-layout] .menu-home .peacock-promenade {
    height:var(--lane-height);margin:0;
  }
  html[data-phone-layout] .menu-home #wandering-peacock {width:104px;bottom:1px}
  html[data-phone-layout] .menu-home .site-foot {
    min-height:44px;height:44px;padding:0 20px;
  }
  html[data-phone-layout] .menu-home .motion-toggle {padding:0;min-height:44px}
  /* Make room for enlarged text and unusually small landscape viewports by allowing scroll. */
  @media (max-width:350px) {
    html[data-phone-layout] .menu-home {--label-size:18px}
    html[data-phone-layout] .menu-home .reference-perch {right:10px;transform:none}
    html[data-phone-layout] .menu-home .caption {max-width:112px}
    html[data-phone-layout] .menu-home .weekend .caption {max-width:190px}
  }
}

/* Budget the visible phone height between header, scene, peacock lane and controls.
   Small viewport units account for expanded browser bars; short/zoomed screens can scroll. */
@media (max-width:600px) {
  html[data-phone-layout=fit] .menu-home {
    --head-height:112px;
    --menu-height:max(360px, calc(100svh - var(--head-height) - var(--lane-height) - 44px - env(safe-area-inset-bottom, 0px)));
  }
  html[data-phone-layout=fit] .menu-home .centre {top:49%}
  html[data-phone-layout=fit] .menu-home .site-foot {
    height:calc(44px + env(safe-area-inset-bottom, 0px));
    padding-bottom:env(safe-area-inset-bottom, 0px);
  }
  @media (max-height:620px) {
    html[data-phone-layout=fit] .menu-home {
      --figure-scale:.70;--label-size:19px;--head-height:112px;--lane-height:50px;
      --menu-height:max(340px, calc(100svh - var(--head-height) - var(--lane-height) - 44px - env(safe-area-inset-bottom, 0px)));
    }
    html[data-phone-layout=fit] .menu-home .centre h1 {font-size:28px;margin-bottom:8px}
    html[data-phone-layout=fit] .menu-home .centre .date {font-size:18px}
    html[data-phone-layout=fit] .menu-home .reference-perch {top:6px;transform:none}
    html[data-phone-layout=fit] .menu-home #wandering-peacock {width:92px}
  }
}

@media (max-width:600px) and (max-height:550px) {
  html[data-phone-layout=fit] .menu-home {
    --figure-scale:.54;--label-size:18px;--head-height:110px;
    --upper-y:25%;--lower-y:68%;--bottom-y:89.5%;
    --menu-height:max(310px, calc(100svh - var(--head-height) - var(--lane-height) - 44px - env(safe-area-inset-bottom, 0px)));
  }
  html[data-phone-layout=fit] .menu-home .motif {margin-bottom:5px}
  html[data-phone-layout=fit] .menu-home .centre h1 {font-size:27px;margin-bottom:6px}
  html[data-phone-layout=fit] .menu-home .centre .date {font-size:17px}
}

/* Preserve the smaller header in the optional study without the perched bird. */
@media(max-width:600px){
  html[data-phone-layout=fit][data-references=off] .menu-home{--head-height:78px}
  @media(max-height:620px){html[data-phone-layout=fit][data-references=off] .menu-home{--head-height:62px}}
  @media(max-height:550px){html[data-phone-layout=fit][data-references=off] .menu-home{--head-height:54px}}
}
