/* ============================================================
   linuxgrid mobile.css — responsive overlay for live WebCit 9.x
   Loaded AFTER css/webcit.css so these rules win.
   Desktop (>=1025px) is unchanged.
   Palette: navy #0a1f4a · accent #5a7dff · dim #8b93c9
   ============================================================ */

/* Native .ctdl-logo-img uses height: calc(100% - 8px). That works for
   citadel-logo.gif (intrinsic pixels). linuxgrid-logo.svg is viewBox-only,
   so the img collapses to padding + the white plate = a white dot.
   SVG is valid here; do not swap to PNG/JPG for this. */
.ctdl-logo-img {
  width: 36px;
  height: 36px;
  max-height: 36px;
  padding: 2px;
  box-sizing: content-box;
  object-fit: contain;
  background-color: #ffffff;
  border-radius: 4px;
  display: block;
}

/* Hamburger is desktop-hidden; live HTML uncommented for phones/tablets. */
#ctdl-sidebar-open {
  display: none;
}
#ctdl-sidebar-open button,
#ctdl-sidebar-open {
  min-height: 44px;
  min-width: 44px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

@media screen and (max-width: 1024px) {
  #ctdl-sidebar-open {
    display: inline-flex;
    list-style: none;
    margin: 0;
    padding: 0 0.35rem;
    color: #f8fafc;
    font-weight: 600;
    font-size: 0.9rem;
    gap: 0.4rem;
  }

  .ctdl-main-grid-container {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas:
      "ctdl-mg-banner"
      "ctdl-mg-main" !important;
  }

  .ctdl-grid-sidebar-item {
    position: fixed !important;
    top: 50px;
    left: 0;
    bottom: 0;
    width: min(80vw, 320px);
    max-width: 320px;
    z-index: 80;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(10, 31, 74, 0.45);
    overflow-y: auto;
    display: block !important; /* keep in DOM; off-canvas via transform */
  }

  .ctdl-main-grid-container.ctdl-nav-open .ctdl-grid-sidebar-item {
    transform: translateX(0);
  }

  .ctdl-grid-main-item {
    width: 100%;
    min-width: 0;
  }

  .ctdl-sidebar-button {
    min-height: 44px;
  }
}

@media screen and (max-width: 768px) {
  html, body {
    font-size: 15px;
  }

  .ctdl-grid-banner-item {
    min-height: 52px;
  }

  .ctdl-banner-buttons {
    padding: 0 0.5rem;
    gap: 0.25rem;
  }

  .ctdl-banner-buttons button {
    min-height: 44px;
    padding: 0.35rem 0.55rem;
    font-size: 0.8rem;
  }

  .ctdl-banner-center {
    flex-wrap: wrap;
    max-width: 46vw;
    overflow-x: auto;
  }

  .ctdl-logo-img {
    max-height: 36px;
  }

  input, select, textarea {
    font-size: 16px; /* iOS zoom-on-focus */
  }

  a, button, input[type="submit"], input[type="button"] {
    min-height: 44px;
  }

  .ctdl-fmsg-wrapper,
  .ctdl-mmsg-wrapper {
    margin: 0.6rem 0.5rem;
    padding: 0.85rem;
  }

  .ctdl-forum-reading-pane {
    max-width: 100%;
  }

  .ctdl-cr-sidebar {
    display: none;
  }

  .ctdl-chat-dock {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
  }

  .ctdl-modal {
    max-width: 96vw;
    width: 96vw;
  }
}

@media screen and (max-width: 375px) {
  .ctdl-banner-buttons {
    padding: 0 0.35rem;
  }
  .ctdl-fmsg-wrapper,
  .ctdl-mmsg-wrapper {
    margin: 0.4rem 0.35rem;
    padding: 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ctdl-grid-sidebar-item {
    transition: none;
  }
}
