.doc-nav-panel { display: contents; }
.doc-nav-right,
.doc-nav-toggle,
.doc-bar-lang,
.doc-nav-backdrop { display: none; }
.sitenav .sn-book[aria-current] { background: #7b181b; }

@media (max-width: 900px), (pointer: coarse) and (max-width: 1100px) {
  .doc-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 99;
    background: rgba(24, 16, 12, 0.34);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .24s ease;
  }
  .doc-nav-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .sitenav {
    top: calc(var(--mb-admin-offset, 0px) + max(8px, env(safe-area-inset-top)));
    right: max(12px, env(safe-area-inset-right));
    left: max(12px, env(safe-area-inset-left));
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 6px 7px 6px 14px;
    transform: none;
    width: auto;
    height: 54px;
    border-radius: 999px;
    background: rgba(252, 246, 236, 0.90);
    backdrop-filter: blur(18px) saturate(1.35);
    -webkit-backdrop-filter: blur(18px) saturate(1.35);
    border: 1px solid rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 28px rgba(52, 34, 27, 0.13);
  }
  .sitenav .sn-logo { position: static; display: inline-flex; align-items: center; min-height: 40px; }
  .sitenav .sn-logo img { width: 88px; height: auto; }

  .doc-nav-right {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: none;
  }
  .doc-bar-lang {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(115, 84, 64, 0.09);
    border: 1px solid rgba(115, 84, 64, 0.08);
  }
  .doc-bar-lang a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 7px;
    border-radius: 999px;
    color: #5b4d44;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    text-decoration: none;
  }
  .doc-bar-lang a.is-active {
    background: #961e20;
    color: #fff;
    box-shadow: 0 2px 6px rgba(150, 30, 32, 0.25);
  }

  .doc-nav-toggle {
    display: grid;
    place-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    padding: 0;
    background: #961e20;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(150, 30, 32, 0.26);
  }
  .doc-nav-toggle span { display: block; width: 17px; height: 2px; border-radius: 2px; background: currentColor; transition: transform .22s ease; }
  .doc-nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
  .doc-nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }
  .doc-nav-toggle:focus-visible { outline: 3px solid #961e20; outline-offset: 3px; }

  .sitenav .doc-nav-panel {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: 0;
    max-height: calc(100dvh - 88px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px 12px 14px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.94);
    background: rgba(252, 246, 236, 0.98);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    box-shadow: 0 22px 48px rgba(42, 24, 16, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(.985);
    transform-origin: top center;
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
  }
  .sitenav.is-open .doc-nav-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
  }
  .sitenav ul, .sitenav .sn-book, .sitenav .sn-lang { position: static; }
  .sitenav ul { display: grid; gap: 2px; margin: 0; }
  .sitenav li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: auto;
    min-height: 46px;
    line-height: 1.45;
    padding: 0 14px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
  }
  .sitenav .sn-lang {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    margin-top: 10px;
    border-radius: 14px;
    background: rgba(115, 84, 64, 0.08);
  }
  .sitenav .sn-lang .sn-lang-sep { display: none; }
  .sitenav .sn-lang a {
    min-height: 36px;
    height: auto;
    padding: 0 8px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
  }
  .sitenav .sn-lang a.is-active {
    background: #961e20;
    color: #fff;
    box-shadow: 0 3px 10px rgba(150, 30, 32, 0.24);
  }
  .sitenav .sn-book {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    height: auto;
    line-height: 1.2;
    margin: 12px 0 0;
    border-radius: 999px;
    box-shadow: 0 8px 20px rgba(150, 30, 32, 0.24);
  }
}
@media (max-width: 350px) {
  .sitenav .sn-logo img { width: 78px; }
  .doc-bar-lang a { min-width: 24px; padding: 0 5px; font-size: 10.5px; }
}
@media (max-height: 460px) and (orientation: landscape) and (pointer: coarse) {
  .sitenav .doc-nav-panel ul { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .doc-nav-toggle span,
  .doc-nav-backdrop,
  .sitenav .doc-nav-panel { transition: none; }
}
