/* Wide-screen layout for the static pages (blog, blog posts, legal pages).
   Mirrors the app's rules in index.html, using the same saved preferences (set by /assets/wide-screen.js):
   html.ws-two = wide layout (default), html.ws-rail-right = sidebar on the right, html.ws-mouse = mouse/trackpad device.
   Linked AFTER each page's own <style> so these rules take precedence. */

/* Phones: fill the width (e.g. the folded iPhone Duo at ~466px) */
@media(max-width:499px){.blog-shell{max-width:none;}}
/* Phone frame only when the screen is tall enough for it -- same clipping fix as the app */
@media(min-width:500px) and (max-height:859px){.blog-shell{height:100vh;height:100dvh;border-radius:0;border:none;}}
/* 500-699px (e.g. an open foldable in portrait): fill the screen */
@media(min-width:500px) and (max-width:699px){.blog-shell{max-width:none;height:100vh;height:100dvh;border-radius:0;border:none;}}

.rail-side-btn{display:none;}
@media(min-width:700px){
  html.ws-two .blog-shell{max-width:none;height:100vh;height:100dvh;max-height:none;border-radius:0;border:none;padding-left:88px;}
  html.ws-two.ws-rail-right .blog-shell{padding-left:0;padding-right:88px;}
  /* Side rail replaces the bottom nav */
  html.ws-two .blog-nav{position:absolute;top:0;bottom:0;left:0;width:88px;height:auto;flex-direction:column;justify-content:flex-start;align-items:center;gap:10px;padding:16px 10px max(16px,env(safe-area-inset-bottom));border-top:none;border-right:1px solid rgba(255,255,255,0.07);}
  html.ws-two.ws-rail-right .blog-nav{left:auto;right:0;border-right:none;border-left:1px solid rgba(255,255,255,0.07);}
  html.ws-two .bnav-btn{flex:none;width:64px;height:58px;}
  html.ws-two .rail-side-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;margin-top:auto;width:64px;height:58px;padding:0;border-radius:14px;background:rgba(255,255,255,0.03);border:1px dashed rgba(255,255,255,0.14);color:rgba(255,255,255,0.4);cursor:pointer;font-family:inherit;}
  html.ws-two .rail-side-btn svg{width:17px;height:17px;}
  html.ws-two .rail-side-btn span{font-size:10px;font-weight:600;letter-spacing:0.02em;line-height:1.15;text-align:center;}
  html.ws-two.ws-rail-right .rail-side-btn svg{transform:scaleX(-1);}
  html.ws-two.ws-mouse .rail-side-btn{display:none;}
  /* Blog archive: post cards in a grid, as many columns as fit */
  html.ws-two .posts{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:16px;}
  html.ws-two .blog-hero p{max-width:640px;}
  /* Articles: a wider column with everything scaled up ~15% (zoom keeps each post's own components in proportion) */
  html.ws-two .hero-img{max-width:1000px;height:420px;margin:20px auto 0;border-radius:14px;}
  html.ws-two .post-body,html.ws-two .post-footer{max-width:870px;width:100%;margin-left:auto;margin-right:auto;zoom:1.15;}
  /* Legal pages: a comfortable reading column */
  html.ws-two .page-pad{max-width:760px;width:100%;margin-left:auto;margin-right:auto;}
}

/* "In this post" contents list for blog posts (built by wide-screen.js from each post's H2s).
   Shown from 1200px wide; the post shifts right (and narrows if needed) to make space. */
.post-toc{display:none;}
@media(min-width:1200px){
  html.ws-two.ws-toc .scroll-content{padding-left:250px;padding-right:24px;}
  html.ws-two.ws-toc .post-toc{display:block;position:absolute;left:88px;bottom:0;width:250px;padding:28px 16px 28px 28px;overflow-y:auto;z-index:1;}
  html.ws-two.ws-rail-right.ws-toc .post-toc{left:0;}
  .post-toc-title{font-size:11px;font-weight:700;letter-spacing:0.1em;text-transform:uppercase;color:#395D8D;margin-bottom:12px;}
  .post-toc ul{list-style:none;margin:0;padding:0;border-left:1px solid rgba(255,255,255,0.08);}
  .post-toc a{display:block;padding:8px 0 8px 14px;margin-left:-1px;border-left:2px solid transparent;font-size:14px;line-height:1.4;color:#7790A9;text-decoration:none;transition:color 0.15s,border-color 0.15s;}
  .post-toc a:hover{color:#e8f0ff;}
  .post-toc a.active{color:#6CA2E3;border-left-color:#6CA2E3;font-weight:600;}
  html.ws-toc .post-body h2{scroll-margin-top:24px;}
}
