/* ==========================================================================
   IndustrialMint — Mobile App Shell
   Turns the public site into an app-like experience on phones/tablets.
   Desktop is untouched: everything here is scoped to <= 900px.
   ========================================================================== */

:root {
  --app-tabbar-h: 60px;
  --app-safe-top: env(safe-area-inset-top, 0px);
  --app-safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Smoother, more native touch behaviour everywhere */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* Hidden by default; only the mobile media query below reveals it. */
.app-tabbar {
  display: none !important;
}

/* The fixed tab bar is public-site only; portals provide their own. */
@media (max-width: 900px) {

  /* ---------- Compact app bar ------------------------------------------- */
  .top-utility {
    display: none !important;
  }

  .site-header {
    position: sticky;
    top: 0;
    z-index: 200;
    padding-top: env(safe-area-inset-top, 0px);
    backdrop-filter: saturate(180%) blur(12px);
    background: rgba(255, 255, 255, 0.92);
  }

  .site-header .wrap {
    height: 58px;
    gap: 10px;
    padding: 0 14px;
  }

  .site-header .logo img {
    height: 34px !important;
  }

  /* Trim the header to app proportions: the drawer covers navigation. */
  .site-header .main-nav {
    display: none;
  }

  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    margin-left: auto;
    color: var(--ink);
  }

  .nav-toggle:active {
    background: var(--paper);
  }

  .header-actions {
    gap: 8px;
  }

  .header-actions .btn {
    padding: 9px 13px;
    font-size: 13px;
    border-radius: 10px;
  }

  /* Keep the primary CTA, drop the secondary login button (drawer has it). */
  .header-actions .btn-ghost {
    display: none;
  }

  /* Keep page content clear of the fixed bottom tab bar. */
  body {
    padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    -webkit-tap-highlight-color: transparent;
  }

  /* No horizontal wobble on phones. */
  html,
  body {
    overflow-x: hidden;
    max-width: 100%;
  }

  /* ---------- Bottom tab bar ---------- */
  .app-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 120;
    display: flex !important;
    align-items: stretch;
    justify-content: space-around;
    height: calc(58px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
  }

  .app-tabbar a {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    color: #94a3b8;
    text-decoration: none;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding-top: 6px;
    transition: color 0.15s ease;
  }

  .app-tabbar a .material-symbols-outlined {
    font-size: 24px;
    font-variation-settings: 'opsz' 24, 'wght' 400, 'FILL' 0;
    transition: font-variation-settings 0.15s ease, transform 0.15s ease;
  }

  .app-tabbar a:active .material-symbols-outlined {
    transform: scale(0.9);
  }

  .app-tabbar a.active {
    color: var(--im-teal);
  }

  .app-tabbar a.active .material-symbols-outlined {
    font-variation-settings: 'opsz' 24, 'wght' 500, 'FILL' 1;
  }

  /* Bottom nav should never sit above the drawer or its backdrop. */
  .drawer-backdrop {
    z-index: 200;
  }

  .mobile-drawer {
    z-index: 210;
    width: 86%;
    max-width: 340px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* ---------- App-like content rhythm ---------- */
  .wrap {
    padding: 0 16px;
  }

  section,
  .section {
    scroll-margin-top: 70px;
  }

  /* PDF-style tap feedback on the main interactive surfaces. */
  .attractive-card,
  .company-card,
  .product-card,
  .event-card,
  .org-card,
  .venue-card,
  .assoc-card {
    border-radius: 16px;
  }

  /* Sticky footer/utility rows respect the tab bar. */
  .footer {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }
}

/* Phones: tighten header further. */
@media (max-width: 560px) {
  .site-header .wrap {
    padding: 0 12px;
  }

  .header-actions .btn {
    padding: 8px 11px;
    font-size: 12.5px;
  }

  .app-tabbar a {
    font-size: 10px;
  }
}

/* Print: hide the app chrome. */
@media print {
  .app-tabbar {
    display: none !important;
  }
}
