/* A progressively enhanced phone layout. At 641px and above the original
   header, navigation and article layout remain in force without overrides. */
.mobile-header-actions, .mobile-menu { display: none; }
@media screen and (max-width:640px) {
  .site-header.mobile-nav-ready .header-inner {
    height:60px; min-height:60px; flex-wrap:nowrap; gap:8px;
    padding-top:0; padding-bottom:0; justify-content:space-between;
  }
  .site-header.mobile-nav-ready .brand { min-height:44px; flex:none; gap:9px; }
  .site-header.mobile-nav-ready .brand-text b { font-size:17px; }
  .site-header.mobile-nav-ready .site-nav { display:none; }
  .mobile-header-actions { display:flex; align-items:center; gap:6px; margin-left:auto; }
  .mobile-header-actions .theme-toggle { position:static; margin:0; flex:none; box-shadow:none; }
  .mobile-menu-toggle, .mobile-menu-close {
    display:flex; align-items:center; justify-content:center; gap:7px;
    min-height:44px; min-width:44px; padding:0 10px;
    border:1px solid var(--line,#cddbdc); border-radius:4px;
    color:var(--accent,#23636a); background:var(--card,var(--bg,#f3f6f6));
    font:14px/1.2 var(--sans, sans-serif); cursor:pointer;
  }
  .mobile-menu-toggle svg { width:18px; height:18px; flex:none; }
  .mobile-menu-toggle:hover, .mobile-menu-close:hover { border-color:var(--accent,#23636a); }
  .mobile-menu[open] {
    display:flex; flex-direction:column; position:fixed; inset:0 auto 0 0;
    width:min(326px,calc(100vw - 40px)); max-width:none; height:100vh; height:100dvh;
    max-height:none; box-sizing:border-box; margin:0;
    padding:calc(18px + env(safe-area-inset-top,0px)) 22px calc(22px + env(safe-area-inset-bottom,0px));
    padding-left:max(22px,env(safe-area-inset-left,0px));
    overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch;
    border:0; border-right:1px solid var(--line,#cddbdc); border-radius:0;
    color:var(--ink,#243538); background:var(--bg,#f3f6f6);
    box-shadow:12px 0 40px rgba(0,0,0,.14); animation:mobile-menu-in .18s ease-out;
  }
  .mobile-menu::backdrop { background:rgba(0,0,0,.42); }
  .mobile-menu-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
  .mobile-menu-heading p { margin:0; font:600 22px/1.35 var(--serif,serif); letter-spacing:.05em; }
  .mobile-menu-close { padding:0; font:28px/1 var(--sans,sans-serif); background:transparent; }
  .mobile-menu-label { margin:28px 0 10px; color:var(--ink-3,#566d70); font:12px/1.6 var(--sans,sans-serif); letter-spacing:.1em; }
  .mobile-menu-links { display:flex; flex-direction:column; gap:4px; }
  .mobile-menu-links a {
    display:flex; align-items:center; min-height:50px; box-sizing:border-box;
    padding:10px 14px; color:var(--ink,#243538); border:0; border-left:2px solid transparent;
    border-radius:0; font:16px/1.5 var(--sans,sans-serif); text-decoration:none;
  }
  .mobile-menu-links a:hover { background:var(--bg-soft,#e7eeee); }
  .mobile-menu-links a[aria-current="page"] {
    color:var(--accent,#23636a); background:var(--accent-soft,#e0eeee);
    border-left-color:var(--accent,#23636a); font-weight:600;
  }
  .mobile-menu-links a.mobile-menu-secondary { margin-top:18px; border-top:1px solid var(--line,#cddbdc); padding-top:18px; }
  .mobile-menu :focus-visible, .mobile-menu-toggle:focus-visible { outline:2px solid var(--accent,#23636a); outline-offset:3px; }
  /* Let readers reach the text before secondary counts and byline details. */
  .article { padding-top:18px; }
  .article .crumb { margin-bottom:16px; gap:6px 8px; font-size:12px; }
  .art-head .art-kicker { gap:6px 12px; margin-bottom:10px; }
  .art-head h1 { font-size:26px; line-height:1.38; margin-bottom:14px; text-wrap:pretty; }
  .art-head .art-pdf-quick, .art-head .art-toc-trigger { margin-bottom:8px; }
  .art-head > .mobile-article-info:last-child { padding-bottom:10px; margin-top:2px; }
  .mobile-article-info > summary {
    display:flex; align-items:center; gap:8px; min-height:44px; list-style:none;
    color:var(--ink-3,#566d70); cursor:pointer; font:12.5px/1.5 var(--sans,sans-serif);
  }
  .mobile-article-info > summary::-webkit-details-marker { display:none; }
  .mobile-article-info > summary::after { content:'＋'; color:var(--accent,#23636a); }
  .mobile-article-info[open] > summary::after { content:'−'; }
  .mobile-article-info .art-byline, .mobile-article-info .art-aux { font-size:12px; line-height:1.7; }
  .mobile-article-info .art-aux { margin-bottom:6px; }
  .article .art-body { padding-top:22px; }
  .article .art-links { gap:8px; }
  .article .art-links > .btn { min-height:44px; }
  .lib-head input[type="search"], .topic-find input { font-size:16px; }
  @keyframes mobile-menu-in { from { transform:translateX(-100%); } to { transform:translateX(0); } }
}
@media (prefers-reduced-motion:reduce) { .mobile-menu[open] { animation:none; } }
@media print { .mobile-header-actions, .mobile-menu { display:none!important; } }
