/* ==========================================================================
   mobile.css  -  loaded AFTER each page's own CSS, so it wins on equal
   specificity. Contains: the phone menu (slide-in drawer) + phone tuning.
   ========================================================================== */

/* ---------- Base: all screen sizes ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
img, video, svg { max-width: 100%; height: auto; }
.logo-img, .mobile-logo img { height: auto; }

/* Fixed background: avoid the jump when the phone's address bar hides */
body::before { width: auto; height: auto; inset: 0; }

:focus-visible { outline: 2px solid var(--primary-light, #009AFF); outline-offset: 3px; }
a, button, .btn-tab, .faq-question { -webkit-tap-highlight-color: rgba(16, 98, 254, .18); }

/* ---------- Menu pieces: desktop defaults (desktop looks as before) ---------- */
.drawer-head, .nav-backdrop, .nav-ico { display: none; }
.menu-toggle { background: none; border: 0; padding: 0; font: inherit; }
.nav-links a[aria-current="page"] { color: #fff; }

/* ==========================================================================
   PHONE & TABLET MENU  (<= 992px)
   ========================================================================== */
@media (max-width: 992px) {

  /* Top bar: sticky, turns frosted-glass after the first scroll.
     (The blur lives on ::before - blur on nav itself would break the fixed drawer.) */
  nav#mainNav {
    position: fixed; top: 0; left: 0; right: 0; width: 100%;
    height: calc(64px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    background: transparent; border-bottom: 1px solid transparent;
    transition: border-color .3s ease;
  }
  nav#mainNav::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: rgba(2, 6, 23, .86);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    opacity: 0; transition: opacity .3s ease;
  }
  nav#mainNav.scrolled { border-bottom-color: rgba(16, 98, 254, .22); }
  nav#mainNav.scrolled::before { opacity: 1; }
  nav#mainNav .nav-content { height: 64px; padding-left: 20px; padding-right: 20px; }
  nav#mainNav .logo-img { max-height: 36px; }

  /* Hamburger: pure CSS (still works if the icon font fails to load) */
  nav#mainNav .menu-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    position: static; transform: none; width: 48px; height: 48px; margin-right: -12px;
    border-radius: 12px; color: #fff; cursor: pointer; z-index: 1002;
  }
  nav#mainNav .menu-toggle .bars { position: relative; display: block; width: 22px; height: 16px; }
  nav#mainNav .menu-toggle .bars i {
    position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px; background: #fff;
    transition: transform .25s ease, width .25s ease;
  }
  nav#mainNav .menu-toggle .bars i:nth-child(1) { top: 0; }
  nav#mainNav .menu-toggle .bars i:nth-child(2) { top: 7px; width: 68%; left: auto; right: 0; background: var(--primary-light, #009AFF); }
  nav#mainNav .menu-toggle .bars i:nth-child(3) { top: 14px; }
  nav#mainNav .menu-toggle:active .bars i:nth-child(2) { width: 100%; }

  /* Dimmed page behind the drawer */
  nav#mainNav .nav-backdrop {
    display: block; position: fixed; inset: 0; z-index: 1004;
    background: rgba(2, 6, 23, .66);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility 0s linear .3s;
  }
  nav#mainNav.menu-active .nav-backdrop { opacity: 1; visibility: visible; transition-delay: 0s; }

  /* The drawer */
  nav#mainNav .nav-links {
    position: fixed; top: 0; right: 0; bottom: auto; left: auto;
    width: min(88vw, 360px); height: 100vh; height: 100dvh;
    display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 4px;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 18px calc(20px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, #07112b 0%, #030816 100%);
    border-left: 1px solid rgba(16, 98, 254, .3);
    box-shadow: -24px 0 60px rgba(0, 0, 0, .55);
    transform: translateX(100%); opacity: 1; visibility: hidden; pointer-events: none;
    overflow-y: auto; overscroll-behavior: contain; z-index: 1005;
    transition: transform .35s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .35s;
  }
  nav#mainNav .nav-links.active { transform: none; visibility: visible; pointer-events: auto; transition-delay: 0s; }

  /* Drawer header: logo left, close right */
  nav#mainNav .drawer-head { display: flex; align-items: center; justify-content: space-between; min-height: 56px; margin-bottom: 10px; }
  nav#mainNav .mobile-logo { display: block; margin: 0; text-align: left; }
  nav#mainNav .mobile-logo img { max-height: 34px; width: auto; }
  nav#mainNav .close-menu {
    display: inline-flex; align-items: center; justify-content: center; position: static;
    width: 44px; height: 44px; padding: 0; color: #fff; cursor: pointer;
    background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px;
  }
  nav#mainNav .close-menu span { position: relative; display: block; width: 18px; height: 18px; }
  nav#mainNav .close-menu span::before, nav#mainNav .close-menu span::after {
    content: ""; position: absolute; left: 0; top: 8px; width: 100%; height: 2px; border-radius: 2px; background: #fff;
  }
  nav#mainNav .close-menu span::before { transform: rotate(45deg); }
  nav#mainNav .close-menu span::after  { transform: rotate(-45deg); }

  /* Big, thumb-sized rows with an icon tile */
  nav#mainNav .nav-links > a {
    display: flex; align-items: center; gap: 14px; width: 100%;
    min-height: 60px; padding: 0 12px; border-radius: 14px;
    font-size: 1rem; font-weight: 600; line-height: 1.3; letter-spacing: .2px; text-transform: none;
    color: #e2e8f0; transform: none;
  }
  nav#mainNav .nav-links > a:hover, nav#mainNav .nav-links > a:active { background: rgba(16, 98, 254, .12); color: #fff; transform: none; }
  nav#mainNav .nav-links > a .nav-ico {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 40px;
    width: 40px; height: 40px; border-radius: 11px; font-size: .95rem;
    background: rgba(16, 98, 254, .14); color: var(--primary-light, #009AFF);
  }
  nav#mainNav .nav-links > a[aria-current="page"] { background: rgba(16, 98, 254, .16); box-shadow: inset 3px 0 0 var(--primary); color: #fff; }
  nav#mainNav .nav-links > a[aria-current="page"] .nav-ico { background: var(--primary); color: #fff; }

  /* Actions pinned to the bottom of the drawer */
  nav#mainNav .nav-auth {
    margin: auto 0 0; padding: 20px 0 0; width: 100%; border-left: 0; border-top: 1px solid rgba(255, 255, 255, .08);
    display: flex; flex-direction: column; align-items: stretch; gap: 10px;
  }
  nav#mainNav .nav-auth a {
    display: flex; align-items: center; gap: 10px; width: 100%; max-width: none; min-height: 52px; justify-content: center; text-align: center;
    border-radius: 12px; font-size: .8rem; letter-spacing: 1.2px; text-transform: uppercase; transform: none;
  }
  nav#mainNav .nav-auth a.btn-nav-dashboard { background: var(--primary); border-color: var(--primary); color: #fff; }
  nav#mainNav .nav-auth a.btn-nav-dashboard:hover { background: var(--primary-dark); }
  nav#mainNav .nav-auth a.btn-nav-discord { color: #fff; border-color: rgba(88, 101, 242, .55); }

  body.menu-open { overflow: hidden; touch-action: none; }
}

/* ==========================================================================
   PHONE LAYOUT TUNING  (<= 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .container { padding-left: 18px; padding-right: 18px; }

  /* Battery / smoothness: the full-screen pulsing background is costly on phones */
  body::before { animation: none; }
  .reveal { will-change: auto; }

  /* Hero: less dead space, buttons that are easy to hit */
  header.hero.container { padding: calc(64px + env(safe-area-inset-top, 0px) + 40px) 18px 36px; }
  .hero h1 { font-size: clamp(1.65rem, 7.6vw, 2.2rem); line-height: 1.15; overflow-wrap: break-word; }
  .hero p { font-size: .88rem; line-height: 1.75; letter-spacing: .1px; }
  .hero-tag { font-size: .72rem; letter-spacing: 2px; padding: 6px 12px; }
  header.hero > div[style*="display: flex"] { flex-direction: column; align-items: stretch !important; gap: 12px !important; }
  .hero .btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 54px; padding: 14px 18px; font-size: .78rem; letter-spacing: 1px; }

  /* Section rhythm: 100-180px of padding is far too much on a phone */
  section.locations, section.panel-showcase, section.trustpilot-section { padding-top: 56px; padding-bottom: 56px; }
  section[style*="padding: 100px"] { padding-top: 56px !important; padding-bottom: 40px !important; }
  section.pricing { padding-top: 40px; padding-bottom: 56px; }
  .section-header { margin-bottom: 32px; }
  .section-header h2 { font-size: clamp(1.5rem, 6.4vw, 2rem); letter-spacing: -.5px; }
  .section-header p { font-size: .85rem; }

  /* Pricing cards: shorter, tighter, readable */
  .price-card { padding: 28px 20px; }
  .price-card li, .price-card li b { font-size: .8rem; line-height: 1.5; }
  .price-subtitle, .os-more, .invest-stat, .panel-tag { font-size: .75rem; }
  .btn-price { min-height: 54px; display: flex; align-items: center; justify-content: center; }
  .btn-tab { min-height: 48px; }

  /* FAQ */
  .faq-question { min-height: 56px; padding: 16px 18px; font-size: .82rem; line-height: 1.4; gap: 12px; }

  footer { padding-top: 56px; }

  /* Hover effects stick after a tap on touch screens - switch them off */
  .price-card:hover, .btn:hover, .btn-price:hover, .btn-tab:hover { transform: none; }
}

/* Very small phones (iPhone SE / 320-360px) */
@media (max-width: 380px) {
  .container { padding-left: 14px; padding-right: 14px; }
  header.hero.container { padding-left: 14px; padding-right: 14px; }
  .hero h1 { font-size: 1.55rem; }
  .price-card { padding: 24px 16px; }
  nav#mainNav .nav-links { width: 92vw; }
}

/* Landscape phones: keep the drawer scrollable and the hero compact */
@media (max-width: 992px) and (orientation: landscape) and (max-height: 500px) {
  header.hero.container { padding-top: calc(64px + env(safe-area-inset-top, 0px) + 16px); }
  nav#mainNav .nav-links > a { min-height: 48px; }
}

/* People who ask their phone for less motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Extras ---------- */
h1, h2, h3 { text-wrap: balance; }

@media (max-width: 768px) {
  /* Outline "Order now" buttons were nearly invisible: give them a tint */
  .btn-price-outline { background: rgba(16, 98, 254, .14); border-color: rgba(16, 98, 254, .6); }
}

/* ---------- Legal page on phones & tablets ---------- */
@media (max-width: 992px) {
  /* The section menu used to be hidden on phones. Show it as a sticky pill bar. */
  .legal-sidebar {
    display: block; position: sticky; top: calc(64px + env(safe-area-inset-top, 0px)); z-index: 50;
    width: auto; margin: 0 -24px 20px; padding: 10px 24px;
    background: rgba(2, 6, 23, .92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(16, 98, 254, .18);
  }
  .legal-nav {
    display: flex; gap: 8px; margin: 0; padding: 0; background: none; border: 0; border-radius: 0;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
  }
  .legal-nav::-webkit-scrollbar { display: none; }
  .legal-nav li { flex: 0 0 auto; list-style: none; scroll-snap-align: start; }
  .legal-nav a {
    display: flex; align-items: center; min-height: 44px; padding: 0 16px; white-space: nowrap;
    font-size: .75rem; border: 1px solid rgba(16, 98, 254, .3); border-radius: 999px;
  }
  .legal-nav a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
  .legal-section { scroll-margin-top: 140px; margin-bottom: 44px; }
}
@media (max-width: 768px) {
  .legal-sidebar { margin-left: -18px; margin-right: -18px; padding-left: 18px; padding-right: 18px; }
  .legal-body { padding: 26px 18px; border-radius: 16px; }
  .legal-section h2 { font-size: 1.3rem; margin-bottom: 18px; }
  .legal-section ul { margin-left: 0; padding-left: 18px; }
  .legal-section p, .legal-section li { font-size: .9rem; line-height: 1.75; }
  .legal-content-wrap { padding-bottom: 64px; }
}

/* ---------- Tap targets & small fixes (phones + tablets) ---------- */
@media (max-width: 992px) {
  .logo-link { min-height: 44px; }
  footer { padding-bottom: env(safe-area-inset-bottom, 0px); }
  footer .footer-col a { display: inline-flex; align-items: center; min-height: 44px; }
  footer .social-links { gap: 8px; }
  footer .social-links a { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; }
}
/* A grid in the page markup forces 320px columns - that is wider than a small phone */
@media (max-width: 400px) {
  div[style*="minmax(320px"] { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)) !important; }
}
@media (max-width: 380px) {
  .legal-sidebar { margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; }
}
