.site-nav .site-nav-mobile-only,
.site-nav .mobile-page-links {
  display: none;
}

@media (max-width: 700px), (hover: none) and (pointer: coarse) {
  html { scroll-padding-top: 120px; }

  /* Keep the controls at the viewport edge and reserve their actual height after the footer. */
  .mobile { position: sticky; bottom: 0; }

  .site-nav {
    --nav-text: var(--body-text, var(--text));
    --nav-gold: #b49361;
    position: sticky;
    top: 0;
    z-index: 5;
    height: auto;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    font: 14px/1.75 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  }

  :root[data-theme="dark"] .site-nav { --nav-gold: #d2b17e; }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .site-nav { --nav-gold: #d2b17e; }
  }

  .site-nav > .wrap { width: min(1120px, calc(100% - 36px)); }
  .site-nav .nav { height: 64px; }
  .site-nav .brand, .site-nav .brand:visited {
    color: var(--nav-text);
    font: 400 21px/1.75 Georgia, "Songti SC", serif;
    letter-spacing: .12em;
    text-decoration: none;
  }

  .site-nav .navlinks, .site-nav .nav-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 8px;
    margin-left: auto;
    font-size: 14px;
  }

  .site-nav .site-nav-desktop-only { display: none; }
  .site-nav .site-nav-mobile-only { display: inline-block; }
  .site-nav a.site-nav-cases, .site-nav a.site-nav-cases:visited {
    color: var(--nav-text);
    white-space: nowrap;
    text-decoration: none;
  }
  .site-nav a.site-nav-consult, .site-nav a.site-nav-consult:visited {
    background: var(--nav-gold);
    color: #fff;
    padding: 8px 13px;
    font-size: 12px;
    white-space: nowrap;
    text-decoration: none;
  }
  .site-nav a.site-nav-consult:hover, .site-nav a.site-nav-consult:focus-visible { background: #9d7b4c; }

  .site-nav .theme-toggle {
    order: 2;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    margin-left: 4px;
    color: var(--nav-text);
  }

  .site-nav .mobile-page-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 1px solid var(--line);
  }
  .mobile-page-links a, .mobile-page-links a:visited {
    display: grid;
    place-items: center;
    min-height: 42px;
    color: var(--nav-text);
    font-size: 13px;
    text-decoration: none;
  }
  .mobile-page-links a + a { border-left: 1px solid var(--line); }
  .mobile-page-links a:hover { color: var(--nav-gold); }
  .site-nav a:focus-visible, .site-nav button:focus-visible {
    outline: 2px solid var(--nav-gold);
    outline-offset: 2px;
  }
}
