/* Phone and tablet layout fixes for the design. Positioning, sizing and spacing only:
   every element of the design stays. Loaded after site.css and cms-site.css.
   Every rule sits inside a max-width:900px query (or narrower), so desktop (901px and up) is untouched. */

/* ================= all phones and tablets (900px and below) ================= */
@media (max-width:900px){

  /* the browser bar: small-viewport units where the design used vh */
  body{min-height:100vh;min-height:100svh}
  div.intro,.intro svg.stage{height:clamp(220px,42vh,400px);height:clamp(220px,42svh,400px)}
  /* the photo band's own opening also uses the class "intro", which picked up the opening animation's fixed
     height: on desktop the band's full-screen minimum hides that, but on a phone the band collapsed to a third
     of its height for the four seconds of the film, the page below jumped up and its white text spilled onto paper */
  #how.intro{height:auto;margin-bottom:0}
  /* while the photos run, the headline sits centred over them (as on desktop); the four steps wait and then come
     in one by one, as they do on desktop, instead of sitting under the centred headline */
  #how.intro .how li,#how.settle .how li:not(.in){opacity:0}

  /* header: clear the notch, keep the logo and the button on one line, 44px targets */
  .top{padding-top:calc(40px + env(safe-area-inset-top,0px))}
  #logoHome{position:relative;display:flex;align-items:center;min-height:44px}
  .top .btn{white-space:nowrap;min-height:44px}
  /* the logo: the mark and the wordmark are split with clip-paths written for the 48px desktop logo;
     at the 40px phone size the mark was clipped away. Same split, in proportions. */
  #logoHome img:not(.mk){clip-path:inset(0 0 0 16.87%);transform-origin:18.07% 50%}
  #logoHome img.mk{top:50%;translate:0 -50%;clip-path:inset(0 83.13% 0 0)}

  /* the pulley: taps fall through the drawing; only the page names and the figure take them */
  .rail,.rail svg,.rail .labels{pointer-events:none}
  .rail .labels a{pointer-events:auto}
  /* the three names fan out from the wheel's hub and their 36px boxes overlapped, so a tap on "Home" opened
     Solutions (on desktop the hovered name pops forward; touch has no hover). Boxes trimmed to the line of
     type and lengthened outwards, where the fan opens up: each name now owns the ground under its own word. */
  .rail .labels a{min-height:0;padding:3px 16px 3px 4px}
  .rail .puller{pointer-events:auto;pointer-events:bounding-box}
  .rail{transition:transform .5s cubic-bezier(.65,0,.25,1),opacity .3s ease,visibility .3s}
  .rail>svg{transition:opacity .4s ease}
  /* the "no further page" shake animated the whole transform, so for a third of a second the pulley lost its
     phone size (it jumped to full size) and its tuck. Same 4px shake, on the separate translate property. */
  .rail.shake{animation-name:railshake-m}
  @keyframes railshake-m{0%,100%{translate:0 0}30%{translate:-4px 0}60%{translate:4px 0}}
  /* while the keyboard is up the pulley steps out of the way */
  body:has(:is(input,textarea,select):focus) .rail{opacity:0;visibility:hidden}

  /* Lens hero: a desktop two-column rule outranked the one-column phone rule, so the copy was squeezed into 58% of the width
     and the layout jumped when the page colours changed to Lens on scroll */
  body[data-page="lens"] .hero.product-hero{grid-template-columns:minmax(0,1fr)}
  /* the three product panels: the phone rule sets no minimum height; a later desktop rule (34vh) outranked it */
  #powerups .rel .node{min-height:0}

  /* the six problem drawings: the phone padding meant for the numbers band also reached them (a later rule won the
     cascade), shrinking each drawn screen by 40px and cropping its entries; the design gives them no padding */
  .probviz>*{padding:0}
  .probviz{row-gap:44px}

  /* tap targets of at least 44px, without moving the type */
  footer .legal nav a{display:inline-block;padding:12px 0;margin:-12px 0}
  footer .legal nav{row-gap:24px}
  .next{min-height:44px}
  .quiet{padding-block:11px;margin-top:-5px;margin-bottom:-11px}
  .dm-tabs button{min-height:44px}
  .dm-alt{min-height:44px}
  .back{min-height:44px}
  .addown .plus{min-height:44px}
  .ownact button{height:44px}
  .cms-chips a{display:inline-flex;align-items:center;min-height:44px}
  .fb-key a.sol-prod{padding-block:12px;margin-block:-12px}

  /* the big button: the count stays in one piece and the label breaks into even lines */
  .bigfix{padding:20px 18px;gap:12px;text-wrap:balance}
  .bigfix em{white-space:nowrap}

  /* forms: 16px so iOS does not zoom on focus */
  .field input,.field textarea,.ownbox textarea,.dm-box textarea{font-size:16px}

  /* body copy no smaller than 15px */
  .rel .node p,.flow .step p,.pcard ul li,.pipe .pl{font-size:15px}

  /* blog, posts and the 404 page load none of the design's scripts: the wheel's three names were never fanned out
     and sat on top of each other, and the logo's mark (a copy made by script) was missing. The fan as the
     design's script sets it for pages off the wheel (as on Request a demo and Legal), and the logo uncut. */
  .cms-static-rail .labels a:nth-child(1){transform:rotate(-33deg) translate(44px,-50%);opacity:.72}
  .cms-static-rail .labels a:nth-child(2){transform:rotate(-16.5deg) translate(44px,-50%);opacity:.86}
  .cms-static-rail .labels a:nth-child(3){transform:translate(44px,-50%)}
  #logoHome:not(:has(img.mk)) img{clip-path:none;transform:none}

  /* Home's dark photo band turns the page's ink white while it is on screen. On desktop each section fills
     the screen, so nothing else is visible then; on a phone or tablet the band can be shorter than the screen,
     and the next heading turned white on paper. The ink change now stays on the band (and the pulley). */
  body[data-page="home"].on-dark #page-home>section:not(#how),body[data-page="home"].on-dark footer{--cream-rgb:11,47,38;--cream:#0B2F26;--cream-70:rgba(11,47,38,.74);--gold:#8A6420;color:var(--cream)}
}

/* ================= the narrowest phones (320px class) ================= */
@media (max-width:374px){
  /* logo and "Request a demo" on one line without the button running off the screen */
  .top{gap:12px}
  .top img{height:36px}
  .top .btn{padding:0 14px}
}

/* ================= phones in portrait: the pulley sits over the reading column ================= */
@media (max-width:600px) and (orientation:portrait){
  /* after the opening the pulley tucks into the left edge, as it does on desktop: half the wheel shows,
     the page names stay readable, the drawing goes quiet. Keyboard focus brings it back out (a tap leaves
     focus on the name it touched, so plain focus would keep it out over the page after every page change). */
  body.rail-tucked .rail:not(:focus-within):not(.stretch){transform:translateX(-38px) scale(.72)}
  body.rail-tucked .rail:not(:focus-within):not(.stretch)>svg{opacity:.38}
  body.rail-tucked .rail:not(:has(:focus-visible)):not(.stretch){transform:translateX(-38px) scale(.72)}
  body.rail-tucked .rail:not(:has(:focus-visible)):not(.stretch)>svg{opacity:.38}
  /* pages outside the design's document have no opening and no script to tuck the pulley: tucked from the start */
  .rail.cms-static-rail:not(:focus-within){transform:translateX(-38px) scale(.72)}
  .rail.cms-static-rail:not(:focus-within)>svg{opacity:.38}
  .rail.cms-static-rail:not(:has(:focus-visible)){transform:translateX(-38px) scale(.72)}
  .rail.cms-static-rail:not(:has(:focus-visible))>svg{opacity:.38}
  /* the end of every page scrolls clear of the pulley */
  main{padding-bottom:calc(236px + env(safe-area-inset-bottom,0px))}
  /* the spreadsheet drawing: a little less cell padding so the entries read at 320px */
  .sheet .grid span{padding-inline:6px}
}

/* short phones (iPhone SE class): during the first-visit opening the pulley is fully out at the bottom left and sat
   over the question. On a phone the desk drawing is limited by the width (about 110-130px tall), so the stage
   around it can be shorter without shrinking the drawing; the question then sits clear of the pulley. */
@media (max-width:600px) and (orientation:portrait) and (max-height:700px){
  div.intro,.intro svg.stage{height:clamp(150px,30vh,400px);height:clamp(150px,30svh,400px)}
}
@media (max-width:600px) and (orientation:portrait) and (max-height:600px){
  div.intro,.intro svg.stage{height:120px}
}

/* ================= tablets, and phones on their side: the pulley gets its own lane ================= */
@media (min-width:601px) and (max-width:900px),(max-width:900px) and (orientation:landscape){
  .wrap{padding-left:calc(140px + env(safe-area-inset-left,0px))}
  /* team cards that leave the next one in view */
  .pcard{flex-basis:clamp(260px,44vw,340px)}
}
@media (min-width:700px) and (max-width:900px){
  /* wide enough for the design's rows again: the three products side by side, the problems two by two */
  .rel{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
  .probviz{grid-template-columns:repeat(2,minmax(0,1fr))}
}

/* ================= phones on their side: short screens ================= */
@media (max-width:900px) and (orientation:landscape){
  /* the works drawing fits the height of the screen instead of the width */
  #roles.plantpick .plant{width:auto;max-width:100%;max-height:calc(100svh - 60px);justify-self:center}
}
