/* COET: phone and tablet layout for the home area (2026-11-14). Loaded after every other stylesheet.
   Everything here sits inside a max-width query, so the desktop (>900px) layout is untouched.
   Phone ≤760px · tablet 761–900px share the stacked home; 901px and up is the desktop stage. */

/* ── Top bar (phones and tablets) ──
   The three round toggles keep their 24px look but each gets its own 44px target: the ::after hit area is
   10px each side, so the toggles sit 20px apart instead of 8px and the targets no longer overlap. */
/* Header sized after MetaLab's phone bar: a 32px Menu pill with 12px type, 32px round buttons with 14px icons. The
   ::after hit areas grow each to 44px, and the 12px gap keeps them from overlapping. */
.mnav__prefwrap { display: none; position: relative; }
@media (max-width: 900px) {
  .mnav__end { gap: 12px; }
  .mnav__menu { height: 32px; padding: 0 16px; font-size: 12px; }
  .mnav__menu::after { inset: -6px -4px; }
  .mnav__icon { width: 32px; height: 32px; }
  .mnav__icon::after { inset: -6px; }
  .mnav__icon svg { width: 14px; height: 14px; }

  /* Sound and theme fold into one settings button; its dropdown holds a switch for each */
  .mnav__icon--wide, .mnav__volwrap { display: none; }
  .mnav__row--vol { cursor: default; }
  .mnav__row--vol .mnav__range { width: 100px; }
  .mnav__prefwrap { display: block; }
  .mnav__prefs[aria-expanded="true"] { background: rgb(255 255 255 / .3); }
  .mnav__pop { position: absolute; top: calc(100% + 10px); right: 0; z-index: 2; display: grid; min-width: 188px; padding: 6px;
    border-radius: 18px; background: rgb(28 28 28 / .62); -webkit-backdrop-filter: blur(22px) saturate(140%); backdrop-filter: blur(22px) saturate(140%);
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / .08), 0 14px 40px rgb(0 0 0 / .45); transform-origin: top right;
    animation: mnav-pop .22s var(--ml-ease, ease) both; }
  .mnav__pop[hidden] { display: none; }
  .mnav__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 44px; padding: 0 10px 0 12px;
    border-radius: 12px; color: #fff; font: 400 14px/1 var(--ml-ui); letter-spacing: -.005em; text-align: left; transition: background-color .2s; }
  .mnav__row:active { background: rgb(255 255 255 / .08); }
  .mnav__row:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
  .mnav__sw { position: relative; flex: none; width: 34px; height: 20px; border-radius: 999px; background: rgb(255 255 255 / .18); transition: background-color .25s var(--ml-ease, ease); }
  .mnav__sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff;
    transition: transform .25s var(--ml-ease, ease), background-color .25s var(--ml-ease, ease); }
  .mnav__row[aria-checked="true"] .mnav__sw { background: #fff; }
  .mnav__row[aria-checked="true"] .mnav__sw::after { transform: translateX(14px); background: #000; }
}
@keyframes mnav-pop { from { opacity: 0; transform: translateY(-4px) scale(.96); } }
@media (prefers-reduced-motion: reduce) { .mnav__pop { animation: none; } }

@media (max-width: 900px) {
  /* Open, the bar keeps the same 16px line as the menu's links below it (menu.css adds 12px of padding) */
  html.menu-open .mnav .mnav__bar { padding: 0; }
}

/* ── Home stage (phones and tablets): one flex column ──
   Headline at the top, the paragraph (tablets) and the button grouped at the foot, the free space between
   them. The particle forms stay absolutely behind; the pill column still scrolls over the whole stage. */
@media (max-width: 900px) {
  .ws-home {
    display: flex; flex-direction: column; align-items: stretch; gap: 20px;
    padding: calc(env(safe-area-inset-top, 0px) + 172px) 16px calc(88px + env(safe-area-inset-bottom, 0px));
  }
  .ws-home .ws-catch { position: relative; inset: auto; flex: none; }
  /* 2026-11-15: the paragraph and the button follow the stage in the page (they are main's, not the stage's), and
     the page scrolls down to them. .ws-side is display: contents so the button's sticky range is all of main: it
     rides the foot of the screen over the stage and comes to rest under the paragraph at the end. */
  .ws-side { display: contents; }
  .ws-side .ws-intro { display: block; position: static; inset: auto; max-width: 34em; margin: 0; padding: 32px 16px 20px;
    font: 400 17px/1.45 var(--apple); letter-spacing: -.005em; color: #d2d2d2; }
  /* 2026-11-15: the dock is the sticky part now, not the button. A full-width bar on the page's own background,
     pinned to the bottom of the screen above the pill column, with the white button inside it. Along its top
     edge a short fade into that background blurs whatever scrolls under it. The stage keeps 88px of foot
     padding (20 + 48 + 20) so the tablet paragraph never slides under it. */
  .ws-dock { display: block; position: -webkit-sticky; position: sticky; bottom: 0; z-index: 6;
    padding: 12px 16px calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--coet-bg, #000); }
  .ws-dock::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 56px; pointer-events: none;
    background: linear-gradient(to bottom, transparent, var(--coet-bg, #000));
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 70%); mask-image: linear-gradient(to bottom, transparent, #000 70%); }
  .ws-side .ws-cta { position: static; inset: auto; margin: 0; }
  .ws-cta__main { height: 48px; font-size: 16px; }

  /* Case-study pills: 40px tall with the 2px ::after ring is a 44px target, 44px apart, none overlapping */
  .ws-pill { height: 40px; }
}

/* Phones: the button runs the full width */
@media (max-width: 760px) {
  .ws-cta__main { width: 100%; justify-content: center; }
}

/* Tablets: there is room for the paragraph, so it comes back, grouped with the button as on desktop. The pill
   column's fade ends a little higher so a pill never slides under the paragraph. Short tablet windows keep the
   phone arrangement (headline and button only). */
@media (min-width: 761px) and (max-width: 900px) and (min-height: 860px) {
  .ws-side .ws-intro { text-shadow: 0 1px 14px rgb(0 0 0 / .9); }
}

/* Phones held sideways: too short for a headline above a pill column, so the pills move to the right half
   and the headline keeps the left. */
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
  .ws-home { padding-top: calc(env(safe-area-inset-top, 0px) + 84px); }
  .ws-side .ws-cta { justify-content: flex-start; }
  .ws-home .ws-catch { font-size: clamp(24px, 4.6vw, 40px); max-width: 50%; }
  .ws-pills { align-items: flex-end; padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .ws-cta__main { width: auto; }
}

/* ── Menu overlay (phones and tablets) ──
   The links become a wrapping row of 44px targets (two rows on a phone, one on a tablet), so the column stays
   short enough to clear the ring's card; the chips grow to 44px. Everything sits on the bar's 16px line. */
@media (max-width: 900px) {
  /* 24px of room under the chips, above the home indicator */
  .menu__chrome { padding-inline: 16px; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); gap: 12px; }
  /* The chip row runs off both edges of the screen as it scrolls, instead of stopping at the 16px gutter */
  .menu__rail { margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px; }
  .menu__pills { padding-right: 16px; }
  .menu__links { display: flex; flex-wrap: wrap; align-items: center; column-gap: 24px; row-gap: 0; }
  .menu__links a { display: inline-flex; align-items: center; min-height: 44px; font-size: 16px; }
  .m-pill { height: 44px; }
}

/* Phones and tablets: every vertical swipe on the home page drives the case-study wheel. The page itself stays
   locked (polish.css § 9) and the wheel keeps its overscroll to itself, so reaching either end never drags the
   whole stage — headline and button included — into a rubber-band. */
@media (max-width: 900px) {
  body.is-home .ws-pills { overscroll-behavior-y: contain; }
  /* site.js moves the wheel from touch events itself (iOS Safari would not pan the list natively), so the stage
     turns native panning off and the two never fight. Pinch-zoom still works. */
  body.is-home .ws { touch-action: none; touch-action: pinch-zoom; }
  /* 2026-11-14: the wheel is only as wide as its pills (it used to be a full-screen layer over the stage, so every
     touch landed on it). It scrolls up and down on its own (natively, and through site.js's driver), and a touch
     that starts on it never reaches the particles (forms.js); the rest of the stage is the particles'. */
  body.is-home .ws-pillbox { right: auto; width: max-content; }
  /* touch-action: pinch-zoom (was pan-y, 2026-11-14): the browser never starts a pan of its own on the wheel, so
     site.js's driver is the only thing moving it. With pan-y, Chrome began its native scroll, stopped letting the
     driver cancel touchmove, and the two fought; the stage around it (.ws) is pinch-zoom only as well. */
  body.is-home .ws-pills { position: relative; inset: auto; width: max-content; height: 100%;
    overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; touch-action: pinch-zoom; -webkit-overflow-scrolling: touch; }
  /* 2026-11-14: nothing on the home page is clipped vertically on phones: the page, main and the stage let what
     overflows them show above and below (sideways stays clipped, with `clip` so it never turns into a scroller). */
  /* 2026-11-15: the page scrolls: the one-screen stage, then the paragraph and the button under it. Overflow is
     visible vertically all the way up (sideways stays clipped, with `clip` so it never turns into a scroller). */
  html:has(body.is-home), body.is-home { height: auto; overflow-x: clip; overflow-y: visible; }
  body.is-home main, body.is-home .ws { overflow-x: clip; overflow-y: visible; }
  /* 2026-11-14, Chrome hid the button: the stage is exactly the screen you can see (--app-h, the window's inner
     height, set in app.html and kept current on resize) instead of 100svh, which Chrome (on iPhone especially) can
     measure taller than the area above its bottom toolbar. And the stage drops GSAP's will-change: transform here
     (the home page never scrolls, so nothing animates it): that made the stage the box the "fixed" button was
     pinned to, so the button sat at the stage's bottom rather than the window's. */
  /* 2026-11-15: the stage is one screen at most (100svh, the screen with the browser's bars showing, capped at
     100vh); main grows to hold the stage and the paragraph after it. */
  body.is-home main { height: auto; }
  body.is-home .ws { height: 100svh; max-height: 100vh; }
  html.has-gsap body.is-home main > .ws { will-change: auto; }
}

/* Portrait tablets on the desktop stage (901–1100px) still scroll and rubber-band. Sideways stays locked. */
@media (min-width: 901px) and (max-width: 1100px) and (orientation: portrait) {
  html:has(body.is-home), body.is-home { height: auto; overflow-x: hidden; overflow-y: auto; overscroll-behavior-x: none; overscroll-behavior-y: auto; }
}

/* ── The case-study wheel sits higher and shows more (phones and tablets) ──
   The list starts at 41% of the screen instead of half way and the pick line moves up with it to 40% (site.js), so
   at rest nothing is picked. The fade at its edges is no longer a mask on the frame (that cut the pills' backdrop
   blur off from the stage): site.js fades each pill by where it sits, between these four stops — in from 30% to
   38%, out from 82% to 88%, just above the button. The opacity comes inline, so it leaves the transition. */
@media (max-width: 900px) {
  .ws-pills { padding: 41svh 16px 58svh; --fade-stops: .3 .38 .82 .88; }
  .ws-pillbox { -webkit-mask-image: none; mask-image: none; }
  .ws-pill { transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease); }
}
/* Tall tablets show the paragraph above the button, so the wheel fades out earlier */
@media (min-width: 761px) and (max-width: 900px) and (min-height: 860px) {
  .ws-pills { --fade-stops: .3 .38 .64 .72; }
}

/* ── Case-study pills: frosted, and above every hero graphic (desktop and phones) ──
   The particle forms, their glow and the project layers all sit under z 5; the pills blur whatever is behind them.
   On phones the button (z 6) stays above the wheel's frame so it remains tappable. */
.ws-pills, .ws-pillbox { z-index: 5; }
/* 2026-11-14: the same glass as the Menu button: its white tint and its blur, and its hover */
.ws-pill { background: rgb(255 255 255 / .14); -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%); }
.ws-pill:hover, .ws-pill.is-on { background: rgb(255 255 255 / .28); }
@media (max-width: 900px) {
  .ws-dock { z-index: 6; }
  .ws.has-pick .ws-pill.is-on { background: #fff; }
  /* (the frost came off the pills on phones earlier on 2026-11-14 and went back on later the same day) */
}

/* ── Frosted buttons: the menu's case-study chips and the bar's pill and round buttons blur what is behind them,
   the same glass as the home pills ── */
/* 2026-11-14: the menu's case-study chips are a solid grey, so every chip is the same colour whatever the ring
   behind it is showing (the see-through glass made each one a different shade) */
.m-pill { background: #262626; -webkit-backdrop-filter: none; backdrop-filter: none; }
.m-pill:hover { background: #3a3a3a; }
.m-pill.is-aimed { background: #fff; }
.mnav__menu, .mnav__icon { -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%); }

/* ── No text selection on any button: a long press or a double tap never highlights a label ── */
button, [role="button"], [role="switch"], .btn, .chip, .ws-pill, .m-pill, .ws-cta__main, .mnav__menu, .mnav__icon, .mnav__logo, .plan__btn, .menu__links a {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* ── No visible scroll bars anywhere: the page and every scrolling box still scroll by wheel, touch and keyboard,
   the bar just isn't drawn ── */
html, *, .sched__slots { scrollbar-width: none; }
::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* ── The home hero's words can't be selected: a long press or a double tap on the headline, paragraph or a
   project's title never highlights it ── */
.ws-home, .ws-catch, .ws-intro, .ws-layers, .ws-layer * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* ── 2026-11-15: one scroll on phones and tablets ──
   The case-study list no longer scrolls inside the stage: it sits in the page under the headline, and the whole
   page (headline, particles, pills, paragraph, button) moves with one native scroll. The stage is at least one
   screen and grows to hold the list; the headline and the particles keep the first screen. As each pill passes
   40% of the way down the window it fills in white (site.js `pick`). Overrides the wheel rules above. */
@media (max-width: 900px) {
  body.is-home .ws { height: auto; min-height: 100svh; max-height: none; touch-action: pan-y pinch-zoom; }
  body.is-home .ws-home { bottom: auto; height: 100svh; max-height: 100vh; }
  body.is-home .ws-pillbox { position: relative; inset: auto; width: auto; z-index: 5; -webkit-mask-image: none; mask-image: none; }
  body.is-home .ws-pills { position: static; width: auto; height: auto; overflow: visible; overscroll-behavior: auto;
    touch-action: pan-y pinch-zoom; padding: 47svh 16px 36svh; }
}

/* ── 2026-11-15: on phones and tablets the hero graphic and the headline stay put ──
   The stage's first screen (.ws-home: the particle picture and the h1) is pinned to the window, and everything
   else (the case-study pills, the paragraph, the button) scrolls over it. Each pill fades out just before it
   reaches the headline (site.js `fade`), so the list never runs over the words. */
@media (max-width: 900px) {
  body.is-home .ws-home { position: fixed; top: 0; left: 0; right: 0; bottom: auto; height: 100svh; max-height: 100vh; z-index: 1; }
  body.is-home .ws-pillbox, body.is-home .ws-side .ws-intro { position: relative; z-index: 5; }
  body.is-home .ws-pill { transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease), opacity .15s linear; }
}
