/* ==========================================================================
   Trovo Tech Solutions — Responsive Layer
   Mobile-first base lives in style.css. Here we scale UP at breakpoints and
   collapse multi-column layouts DOWN for small screens.
   Breakpoints:  640 (sm)  768 (md)  1024 (lg)
   ========================================================================== */

/* ---------------- MOBILE DEFAULTS (< 768px) ---------------- */
/* Collapse every multi-column grid to a single column on small screens. */
@media (max-width: 767.98px) {
  .grid--2,
  .grid--3,
  .grid--4,
  .hero__grid,
  .split,
  .service__cols,
  .mini-grid,
  .footer__grid { grid-template-columns: 1fr; }

  /* Typography scales down for readability */
  :root { --fs-display: 2rem; --fs-h1: 1.75rem; --fs-h2: 1.5rem; }

  /* Justified text makes wide word gaps at ~35 characters per line; keep it for
     tablet/desktop and use left alignment on phones. */
  body .legal p, body .legal li,
  .card p, .split p, .quote,
  .page-hero__inner--wide .lead { text-align: left; }
  .footer__bottom { flex-direction: column; align-items: flex-start; }
  .section-head--row { align-items: flex-start; }
  .cta { padding: var(--space-7) var(--space-5); }
}

/* The hero video is only loaded above 768px (see index.html) and its dark poster
   is invisible under the blend mode, so on phones/768px it was just an empty gap
   under the buttons. Hide the block instead. */
@media (max-width: 768px) {
  .hero__visual { display: none; }
}
/* The two hero buttons share the full width on phones so they line up. */
@media (max-width: 640px) {
  .hero__actions .btn { flex: 1 1 100%; }
}

/* Default backdrop hidden on desktop */
.nav-backdrop { display: none; }

/* ---------------- NAV: hamburger + right-side drawer (< 1024px) ---------------- */
/* The full brand lockup + 5 links need roughly 820px, so below 900px we switch to
   a slide-in drawer from the RIGHT. 900 (not 1024) keeps the real menu in phone
   browsers' "Desktop site" mode, which lays pages out at about 980px. */
@media (max-width: 899.98px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0.5rem;
    margin: -0.5rem;
    background: transparent;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 80;
  }
  .nav-toggle .material-symbols-outlined {
    pointer-events: none;
    user-select: none;
    font-size: 28px;
    line-height: 1;
  }
  .navbar .btn { display: none; }
  .brand-lockup__icon { height: 52px; }   /* trim the oversized logo */

  /* Backdrop overlay when the drawer is open */
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 45;   /* below the header (50) that holds the drawer, so links stay tappable */
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
  }
  .nav-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  /* Prevent background scrolling when drawer is open */
  body.nav-open {
    overflow: hidden;
  }

  /* Full-height drawer from the right, BLACK to match the header (#000) so it
     reads as one continuous panel. The X (z-index 80) stays on top; links are
     padded down to clear the navbar/logo row. */
  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(80vw, 300px);
    z-index: 70;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-5);
    background: #000000;
    border-left: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    padding: 6.5rem var(--space-6) var(--space-6);
    transform: translateX(100%);
    transition: transform var(--transition);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav-links.is-open { transform: translateX(0); }
}

/* ---------------- Small phones: trim the brand lockup further ---------------- */
@media (max-width: 600px) {
  .brand-lockup__icon { height: 44px; }
  .brand-lockup__title { font-size: 1.35rem; }
  .brand-lockup__subtitle { font-size: 0.72rem; letter-spacing: 0.3em; padding-left: 0.3em; }
  .brand-lockup__tagline { letter-spacing: 0.22em; }
}

/* ---------------- TABLET (>= 640px) ---------------- */
@media (min-width: 640px) {
  :root { --container-pad: 1.5rem; }
}

/* ---------------- TABLET / SMALL LAPTOP (>= 768px) ---------------- */
@media (min-width: 768px) {
  :root {
    --container-pad: 2.5rem;   /* 40px */
    --section-y: 5rem;
  }
  /* minmax(0, 1fr): columns may shrink below their content's min width, so the
     nested .service__cols can't push the grid past the viewport (~768-850px). */
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }  /* 2-up on tablet */
  .service__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------------- DESKTOP (>= 1024px) ---------------- */
@media (min-width: 1024px) {
  :root {
    --container-pad: 4rem;     /* 64px desktop margins */
    --section-y: 6rem;
  }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(4, 1fr); }  /* full 4-up */
}

/* ---------------- MOTION PREFERENCE ---------------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
