/* phone (≤900px — where the contents column hides) for case pages and «Обо мне»; linked after the page's own <style>, so it wins at equal specificity */
.chbar { display:none; }
@media (max-width:900px){
  :root { --pad:16px; --gap:16px; }

  /* the prototype switcher is not part of the site */
  .switch { display:none !important; }

  /* header: a plain white bar, so scrolled text doesn't run under the links */
  .top { top:0; left:0; right:0; padding:14px var(--pad) 12px; background:var(--bg); }

  /* hero: the case title fits one line on a phone («Praktika.school», «Коммуналка»), the meta goes 2 × 2 */
  .hero { padding-top:96px; }
  .hero h1 { font-size:min(18vw,100px); }
  .hero .lead { font-size:22px; margin-top:20px; }
  .meta { grid-template-columns:1fr 1fr; row-gap:20px; margin-top:32px; }
  .meta .inl { white-space:normal; }
  .cover { margin-top:40px; }

  /* chapter bar under the header (built in common.js): current chapter, reading progress, the full list on tap */
  .chbar { display:block; position:fixed; left:0; right:0; top:var(--toph,43px); z-index:19; background:var(--bg); border-bottom:1px solid var(--line,#e8e6e1); transform:translateY(-100%); opacity:0; pointer-events:none; transition:transform .3s ease, opacity .2s; }
  .chbar.on { transform:none; opacity:1; pointer-events:auto; }
  .chbar .cb-cur { all:unset; box-sizing:border-box; display:grid; grid-template-columns:48px 1fr 20px; align-items:center; width:100%; padding:10px var(--pad) 11px; font-size:19px; letter-spacing:-.01em; cursor:pointer; }
  .chbar .cb-n, .chbar .cb-list .n { font-size:13.5px; letter-spacing:.05em; color:#c3c1ba; }
  .chbar svg { transition:transform .3s; } .chbar.open svg { transform:rotate(180deg); }
  .chbar .cb-prog { position:absolute; left:0; bottom:-1px; height:2px; width:0; background:var(--ink); }
  .chbar .cb-list { list-style:none; max-height:0; overflow:hidden; transition:max-height .35s ease; }
  .chbar.open .cb-list { max-height:80vh; overflow-y:auto; border-top:1px solid var(--line,#e8e6e1); padding:6px 0 12px; box-shadow:0 18px 30px rgba(0,0,0,.08); }
  .chbar .cb-list a { display:grid; grid-template-columns:48px 1fr; align-items:baseline; padding:7px var(--pad); font-size:22px; letter-spacing:-.01em; color:#c3c1ba; }
  .chbar .cb-list a.on { color:var(--ink); }
  section.ch { scroll-margin-top:calc(var(--toph,43px) + 84px); }

  /* chapters: headings and intros take the full width, less air between chapters */
  .body { margin-top:72px; }
  section.ch { padding-bottom:96px; }
  .ch-h { margin-bottom:32px; }
  .ch-h h2, .ch-h p { grid-column:1 / -1; }
  h3 { margin-top:64px; }

  /* wide tables scroll sideways inside the column instead of sticking out */
  .main table { display:block; overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .main table > tbody, .main table > thead { display:table; width:100%; min-width:520px; }

  /* «Напоказ» */
  .cols3 { grid-template-columns:1fr; gap:28px; }
  .scn-row { grid-template-columns:1fr 1fr; row-gap:32px; }
  /* identity → service table: one column, identity above service */
  .o-hd { display:none; }
  .o-row { grid-template-columns:1fr; gap:12px; }
  .o-row .o-k { color:var(--cream); }
  .o-s { min-height:0; } .o-s .m { display:block; width:100%; }
  .o-arr { transform:rotate(90deg); justify-self:start; margin-left:4px; }
  .o-wix { font-size:24px; }
  .band { grid-template-columns:1fr 1fr 1fr; height:auto; }
  .band div { min-height:96px; }
  .band div:first-child { grid-column:1 / -1; }
  .type .aa, .type .rows { grid-column:1 / -1; }
  .type .rows { margin-top:16px; }
  .comps .ui, .comps .card-img { grid-column:1 / -1; }
  .comps .card-img { margin-top:28px; }

  /* Praktika: swatches are set inline to 6 columns, the type sample sits above its alphabet */
  .sw[style*="grid-template-columns"] { grid-template-columns:repeat(3,minmax(0,1fr)) !important; }
  .pk-type .aa, .pk-type .rt { grid-column:1 / -1; }
  .pk-type .sizes { flex-wrap:wrap; gap:8px 20px; }

  /* «Слепок»: desktop grid and phone grid side by side, the phone one narrower */
  .gridshow, .gridk { grid-template-columns:minmax(0,1.5fr) minmax(0,1fr); }
  .gridshow figcaption, .gridk figcaption { font-size:16px; }
  .gridk { padding:16px; }

  /* next case: title, then the cover under it */
  .next { grid-template-columns:1fr; row-gap:24px; }
  .next .t, .next img { grid-column:1 / -1; }
  .next .t div:last-child { font-size:64px; }

  /* «Обо мне» */
  .top .nm { grid-column:1 / 7; } .top nav { grid-column:7 / 13; }
  .hero-a .tx { margin-top:24px; gap:20px; }
  .hero-a .word { font-size:min(22vw,100px); }
  body > section.g:not(.case-end) { margin-top:96px; }
  .side h2 { margin-bottom:28px; }
  .path .y { grid-column:1 / 4; }
  .path .w, .path .d { grid-column:4 / 10; }
  .path .d { margin-top:10px; }
  .how .st { margin-bottom:28px; }
  .contact { margin-top:96px; row-gap:48px; }
  .contact h2 { font-size:64px; }
  .contact .foot { flex-direction:column; gap:6px; }

  /* «Кино и кофе»: the whole desktop site at once — a window you scroll inside doesn't read as «there's more» on a phone */
  .site .win { height:auto; overflow:visible; }
  .desk-only { display:none; }
}
