/*
 * Mobile layout contract
 * The desktop pages share a wide, two-navigation composition.  On narrow
 * screens the corner navigation remains the single route layer, while page
 * content receives a stable clear area beneath it.
 */
@media (max-width: 720px) {
  html,
  body {
    width: 100%;
    min-width: 0 !important;
    max-width: 100%;
    overflow-x: hidden;
  }

  body.home-page .corner-nav,
  body.catalog-page .corner-nav,
  body.chapter-page .corner-nav,
  body.essay-page .corner-nav {
    top: max(16px, env(safe-area-inset-top));
    left: 18px;
    font-size: 18px;
    line-height: 1.35;
    white-space: nowrap;
  }

  body.chapter-page .main-nav {
    display: none !important;
  }

  body.essay-page .main-nav {
    position: fixed;
    top: calc(max(16px, env(safe-area-inset-top)) + 34px);
    right: 0;
    left: 0;
    z-index: 36;
    display: flex !important;
    justify-content: flex-start;
    gap: 18px;
    width: 100%;
    padding: 9px 18px 11px;
    overflow-x: auto;
    background: rgba(250, 249, 245, 0.9);
    backdrop-filter: blur(8px);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  body.essay-page .main-nav::-webkit-scrollbar {
    display: none;
  }

  body.chapter-page .chapter-cover {
    min-height: 100svh;
    padding: 96px 20px 34px;
  }

  body.chapter-page .cover-art {
    width: min(76vw, 400px);
    min-width: 0;
  }

  body.chapter-page .guide {
    min-height: auto;
    overflow: visible;
    padding-top: 24px;
    padding-bottom: 34px;
  }

  body.chapter-page .guide-stage {
    min-height: 0;
    padding-top: 42px;
    padding-bottom: 36px;
  }

  body.chapter-page .g-lede p,
  body.chapter-page .g-item[data-n="3"] .g-lede p {
    font-size: clamp(22px, 7vw, 31px);
    line-height: 1.55;
  }

  body.chapter-page .read-entry {
    margin-top: 4px;
    margin-bottom: 46px;
  }

  body.essay-page .essay-hero {
    padding-top: 142px !important;
  }

  body.essay-page .essay-inner {
    margin-top: 48px;
    padding-right: 20px;
    padding-left: 20px;
  }

  body.catalog-page .chapter-block {
    min-height: min(88svh, 760px);
    padding: 88px 22px 48px;
  }

  body.catalog-page .still-frame {
    width: calc(100vw - 44px);
  }

  body.catalog-page .site-footer::before,
  body.chapter-page .site-footer::before,
  body.essay-page .site-footer::before {
    right: 26px;
    left: 26px;
  }
}

@media (max-width: 420px) {
  body.home-page .corner-nav,
  body.catalog-page .corner-nav,
  body.chapter-page .corner-nav,
  body.essay-page .corner-nav {
    left: 15px;
    font-size: 17px;
  }

  body.chapter-page .chapter-cover {
    padding-right: 16px;
    padding-left: 16px;
  }

  body.essay-page .main-nav {
    gap: 14px;
    padding-right: 15px;
    padding-left: 15px;
  }
}
