/* Document / Founding Laws — mobile-only layout (loaded last) */

@media (max-width: 980px) {
  body[data-page-layout="document"] .page-grid {
    display: block;
  }

  body[data-page-layout="document"] .page-sidebar,
  .companion-site[data-page-layout="document"] .page-sidebar {
    display: none !important;
    position: static !important;
    top: auto !important;
    max-height: none !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .law-mobile-nav {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    box-sizing: border-box;
    height: 2.75rem;
    min-height: 2.75rem;
    max-height: 2.75rem;
    margin: 0.75rem 0 1rem;
    padding: 0;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
  }

  .law-mobile-nav__home {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
    padding: 0;
    border: 1px solid var(--color-hairline, #f0f0f3);
    border-radius: 10px;
    background: #ffffff;
    color: var(--color-ink, #171717);
    font-size: 0;
    text-decoration: none;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
  }

  .law-mobile-nav__home span,
  .law-mobile-nav__home > :not(svg) {
    display: none;
  }

  .law-mobile-nav__field {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 0;
    min-width: 0;
    height: 2.5rem;
    max-height: 2.5rem;
    padding: 0 0.65rem;
    border: 1px solid var(--color-hairline-strong, #dcdee0);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
    overflow: hidden;
    position: relative;
  }

  .law-mobile-nav__field-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .law-mobile-nav__select {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-width: 0;
    height: 2.5rem;
    max-height: 2.5rem;
    margin: 0;
    padding: 0 1.1rem 0 0;
    border: 0;
    background: transparent;
    color: var(--color-ink, #171717);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 2.5rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%2360646c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
    background-size: 14px 14px;
  }

  .law-mobile-nav__select:focus-visible {
    outline: 2px solid var(--color-ink, #171717);
    outline-offset: 1px;
    border-radius: 4px;
  }

  .law-mobile-nav__value {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .law-mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: grid;
    place-items: end stretch;
  }

  .law-mobile-menu[hidden] {
    display: none !important;
  }

  .law-mobile-menu__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(0, 0, 0, 0.25);
    padding: 0;
    margin: 0;
  }

  .law-mobile-menu__panel {
    position: relative;
    width: 100%;
    max-height: min(70vh, 36rem);
    background: #ffffff;
    border-radius: 16px 16px 0 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .law-mobile-menu__panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 0.95rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: #ffffff;
  }

  .law-mobile-menu__panel-head p {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, 0.55);
  }

  .law-mobile-menu__close {
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.04);
    border-radius: 999px;
    width: 2.25rem;
    height: 2.25rem;
    font-size: 0.95rem;
    line-height: 2.25rem;
    padding: 0;
    cursor: pointer;
  }

  .law-mobile-menu__list {
    padding: 0.5rem;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .law-mobile-menu__item {
    width: 100%;
    display: block;
    text-align: left;
    padding: 0.85rem 0.85rem;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: rgba(0, 0, 0, 0.72);
    font: 600 0.95rem/1.25 system-ui, -apple-system, "Inter", sans-serif;
    cursor: pointer;
  }

  .law-mobile-menu__item.is-active {
    border-color: rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.92);
  }

  .law-mobile-menu__item:focus-visible {
    outline: 2px solid rgba(0, 0, 0, 0.3);
    outline-offset: 2px;
  }

  /* Prevent background scroll while the menu is open */
  html.companion-law-menu-open,
  body.companion-law-menu-open {
    overflow: hidden;
    overscroll-behavior: none;
  }

  body[data-page-layout="document"] .page-content {
    position: relative;
    z-index: 0;
    max-width: 100%;
  }

  body[data-page-layout="document"] .document-shell {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  body[data-page-layout="document"] .document-intro {
    position: relative;
    z-index: 0;
    border-radius: 14px;
    padding: 0.8rem 0.85rem;
  }

  body[data-page-layout="document"] .document-eyebrow {
    margin: 0 0 0.3rem;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
  }

  body[data-page-layout="document"] .document-title {
    font-size: clamp(1.25rem, 5.2vw, 1.55rem);
    line-height: 1.12;
  }

  body[data-page-layout="document"] .document-summary {
    margin: 0.45rem 0 0;
    font-size: 0.86rem;
    line-height: 1.45;
  }

  body[data-page-layout="document"] .document-article {
    position: relative;
    z-index: 0;
    border-radius: 14px;
    padding: 0.85rem;
  }

  body[data-page-layout="document"] main {
    padding-top: 0.25rem;
    padding-bottom: 2.5rem;
  }

  body[data-page-layout="document"] .page-content > .law-mobile-nav {
    display: flex !important;
  }
}

@media (min-width: 981px) {
  .law-mobile-nav {
    display: none !important;
  }
}
