/* ============================================================
   MOBILE NAVIGATION — shared across all pages
   Works on iOS Safari, Android Chrome, desktop Chrome/Firefox/Safari
   ============================================================ */

/* ── Always hide the mobile elements on desktop ─────────────── */
#mobile-topbar,
#mob-nav-overlay,
#mob-nav-drawer {
  display: none;
}

/* ── Mobile: ≤ 650px ─────────────────────────────────────────── */
@media (max-width: 650px) {

  /* ── Top bar ─────────────────────────────────────────────── */
  #mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #2c1900;
    z-index: 600;
    padding: 0 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    -webkit-tap-highlight-color: transparent;
  }

  #mobile-topbar .mob-logo {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
  }

  #mobile-topbar .mob-logo img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: 0.9;
  }

  #mobile-topbar .mob-logo-name {
    font-family: "Raleway", sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
    white-space: nowrap;
  }

  /* ── Hamburger button ────────────────────────────────────── */
  #mob-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    border-radius: 6px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-width: 40px;
    min-height: 40px;
    align-items: center;
  }

  #mob-menu-btn:active {
    background: rgba(255, 255, 255, 0.12);
  }

  #mob-menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
    transition: transform 0.28s ease, opacity 0.28s ease;
    transform-origin: center;
  }

  body.mob-nav-open #mob-menu-btn span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  body.mob-nav-open #mob-menu-btn span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }
  body.mob-nav-open #mob-menu-btn span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* ── Overlay ─────────────────────────────────────────────── */
  #mob-nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 580;
    pointer-events: none;
    transition: background 0.28s ease;
  }

  body.mob-nav-open #mob-nav-overlay {
    background: rgba(0, 0, 0, 0.5);
    pointer-events: auto;
  }

  /* ── Slide-out drawer ────────────────────────────────────── */
  #mob-nav-drawer {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 72vw;
    max-width: 260px;
    background: #2c1900;
    z-index: 620;
    padding: 1rem 1.2rem 2rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-110%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
  }

  body.mob-nav-open #mob-nav-drawer {
    transform: translateX(0);
  }

  #mob-nav-drawer .drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  #mob-nav-drawer .drawer-logo {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    text-decoration: none;
  }

  #mob-nav-drawer .drawer-logo img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: 0.9;
  }

  #mob-nav-drawer .drawer-logo-name {
    font-family: "Raleway", sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
  }

  #mob-nav-drawer .drawer-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
  }

  #mob-nav-drawer .drawer-close:active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
  }

  #mob-nav-drawer nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  #mob-nav-drawer nav ul li a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.85rem 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease;
    margin-bottom: 2px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  #mob-nav-drawer nav ul li a::before {
    content: "";
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: #d56e00;
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.18s ease;
  }

  #mob-nav-drawer nav ul li a:active,
  #mob-nav-drawer nav ul li a.active {
    background: rgba(213, 110, 0, 0.14);
    color: #d56e00;
  }

  #mob-nav-drawer nav ul li a.active::before {
    opacity: 1;
  }

  #mob-nav-drawer .nav-icon {
    font-size: 1.05rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
  }

  /* ── Back links on detail pages ──────────────────────────── */
  .back-link {
    display: inline-flex !important;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem !important;
    font-weight: 700;
    color: #d56e00 !important;
    text-decoration: none;
    padding: 0.5rem 1.1rem;
    border: 1.5px solid #d56e00;
    border-radius: 2rem;
    margin-bottom: 1.2rem !important;
    transition: background 0.2s, color 0.2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .back-link:active {
    background: #d56e00;
    color: #ffffff !important;
  }

  /* ── Prevent body scroll when drawer open ───────────────── */
  body.mob-nav-open {
    overflow: hidden;
  }
}
