/**
 * Wordcraft — Global Responsive Foundation
 * Loaded on every page via inject-global-assets.js
 *
 * Scope:
 *  • Prevents horizontal overflow site-wide
 *  • Styles hamburger + overlay for app-shell pages (injected by mobile-nav.js)
 *  • Hides .nav-link / overflow btn on mobile, shows .mob-hamburger
 *  • Responsive container padding at all major breakpoints
 *  • iOS-specific fixes (input zoom, safe-area)
 */

/* ─── 1. BASE RESET ─────────────────────────────────────────────────────── */
html {
  overflow-x: hidden;
}
body {
  overflow-x: hidden;
  /* iOS notch / home-indicator bottom clearance */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ─── 2. HAMBURGER BUTTON ─────────────────────────────────────────────────
   Injected by mobile-nav.js → nav.appendChild(hamburger)
   Hidden on desktop, shown at ≤768px via media query                       */

.mob-hamburger {
  display: none;           /* hidden on desktop */
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: #f5f0e8;          /* --parchment */
  flex-shrink: 0;
  margin-left: auto;
  align-items: center;
  justify-content: center;
  line-height: 0;
  border-radius: 6px;
  transition: background 0.15s;
}
.mob-hamburger:hover {
  background: rgba(212, 168, 83, 0.1);
}

/* ─── 3. MOBILE MENU OVERLAY ──────────────────────────────────────────────
   Injected by mobile-nav.js → document.body.appendChild(overlay)
   Full-screen panel; toggle via .mob-open class                            */

.mob-menu-overlay {
  display: none;           /* hidden until .mob-open */
  position: fixed;
  inset: 0;
  background: #0d0d0d;     /* --ink */
  z-index: 9990;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.mob-menu-overlay.mob-open {
  display: flex;
  animation: mob-fade-in 0.2s ease;
}

@keyframes mob-fade-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* Header row: logo + ✕ close button */
.mob-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(212, 168, 83, 0.15);
  flex-shrink: 0;
}

/* Close button */
.mob-menu-close {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #8a8274;           /* --warm-gray */
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.mob-menu-close:hover {
  color: #f5f0e8;
  background: rgba(255, 255, 255, 0.06);
}

/* Links list */
.mob-menu-links {
  padding: 8px 24px 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.mob-menu-links a {
  color: #8a8274;
  text-decoration: none;
  font-size: 15px;
  letter-spacing: 0.8px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-transform: uppercase;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  transition: color 0.15s;
  display: block;
}
.mob-menu-links a:last-child {
  border-bottom: none;
}
.mob-menu-links a:hover,
.mob-menu-links a.mob-active {
  color: #d4a853;           /* --amber */
}

/* ─── 4. NAV RESPONSIVE (app pages with .nav-left) ───────────────────────
   At ≤768px: hide text links + overflow button, show hamburger            */

@media (max-width: 768px) {
  /* Show the injected hamburger */
  .mob-hamburger {
    display: flex !important;
  }

  /* Hide all .nav-link elements inside .nav-left (app pages only — marketing
     pages use plain <a> tags inside #navLinks, not .nav-link class) */
  .nav-left .nav-link {
    display: none !important;
  }

  /* Hide "More ▼" overflow button — hamburger replaces it on mobile */
  .nav-overflow-btn {
    display: none !important;
  }

  /* Hide any open overflow dropdown */
  .nav-overflow-menu {
    display: none !important;
  }

  /* Tighten nav padding on mobile */
  nav {
    padding-top: 14px !important;
    padding-bottom: 14px !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
}

/* 375px — iPhone SE / smallest phones */
@media (max-width: 375px) {
  nav {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  .logo {
    font-size: 18px !important;
  }
}

/* ─── 5. RESPONSIVE BREAKPOINTS (app pages) ──────────────────────────────
   Progressive padding tightening for nav on larger screens               */

@media (max-width: 1440px) {
  .nav-left {
    gap: 24px;
  }
}

@media (max-width: 1280px) {
  nav {
    padding-left: 32px;
    padding-right: 32px;
  }
}

@media (max-width: 1024px) {
  nav {
    padding-left: 24px;
    padding-right: 24px;
  }
}

/* ─── 6. GLOBAL CONTAINER PADDING ───────────────────────────────────────── */

@media (max-width: 768px) {
  .container {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}
@media (max-width: 375px) {
  .container {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
}

/* ─── 7. iOS AUTO-ZOOM FIX ───────────────────────────────────────────────
   iOS Safari auto-zooms text inputs smaller than 16px. Force 16px min.  */

@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="url"],
  input[type="tel"],
  input[type="number"],
  textarea,
  select {
    font-size: 16px !important;
  }
}
