/* ============================================================
   FrontLine — Responsive layer
   Handles tablet (<=1024px), phone (<=768px), small phone (<=480px).
   Builds on existing 1100px breakpoint in styles.css/styles-extras.css.
   ============================================================ */

/* ---- Universal: prevent horizontal scroll, kill tiny taps ---- */
html, body { max-width: 100%; }
@media (max-width: 1100px) {
  body { -webkit-text-size-adjust: 100%; }
  img, svg, video { max-width: 100%; height: auto; }
}

/* ============================================================
   TABLET — <= 1024px
   ============================================================ */
@media (max-width: 1024px) {
  .section { padding: 96px 0; }
  .hero { padding: 120px 24px 60px; min-height: auto; }
  .hero-content { padding-right: 0; padding-top: 24px; padding-bottom: 32px; }
  .hero-readout { display: none; }
  .hero-top .live { display: inline-flex; }
  .hero-top { margin-bottom: 48px; }
  .hero-meta { margin: 56px -24px 0; padding: 24px; }

  .section-head { margin-bottom: 48px; }

  /* Audience panel visual hidden on tablet (too cramped) */
  .aud-panel { gap: 32px; }
  .aud-panel .visual { display: none; }

  /* Network */
  .network-head { grid-template-columns: 1fr; gap: 24px; }
  .network-stats { gap: 32px; flex-wrap: wrap; }
  .map-wrap { height: 420px; }

  /* Country list down to 3 cols */
  .country-list { grid-template-columns: repeat(3, 1fr); }
  .country:nth-child(3n) { border-right: none; }

  /* ESG / Team */
  .esg-grid { grid-template-columns: repeat(2, 1fr); }
  .team-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================================
   PHONE — <= 768px
   ============================================================ */
@media (max-width: 768px) {
  /* Spacing scale */
  .section { padding: 72px 0; }
  .container { padding: 0 20px; }

  /* Nav */
  .nav { padding: 14px 18px; gap: 12px; }
  .nav.scrolled { padding: 10px 18px; }
  .brand-logo { height: 40px; }
  .nav-right { gap: 8px; }
  .lang-toggle { font-size: 11px; }
  .lang-btn { padding: 4px 9px; }

  /* Splash mark smaller */
  .splash-mark { width: 160px !important; }

  /* ---- HERO ---- */
  .hero {
    padding: 110px 18px 40px;
    min-height: auto;
  }
  .hero-content {
    padding: 12px 0 24px 0;
  }
  .hero-top {
    margin-bottom: 36px;
    padding-top: 12px;
    font-size: 10px;
    letter-spacing: 0.12em;
    gap: 12px;
    flex-wrap: wrap;
  }
  .hero h1 {
    font-size: clamp(34px, 9vw, 48px);
    margin-bottom: 22px;
    max-width: 100%;
    line-height: 1.02;
  }
  .hero p.lede {
    font-size: 16px;
    line-height: 1.55;
    margin-bottom: 28px;
    max-width: 100%;
  }
  .hero-actions { gap: 12px; }
  .hero-actions .btn { padding: 12px 18px; font-size: 13.5px; flex: 1 1 auto; justify-content: center; min-width: 0; }
  .hero-rail { display: none; }
  /* Let the portal twin share the action row as an equal peer of the CTA. */
  .hero-portal-mobile { flex: 1 1 auto; justify-content: center; padding-top: 12px; padding-bottom: 12px; }
  .hero-waves { height: 70px; }

  .hero-meta {
    grid-template-columns: 1fr 1fr;
    gap: 18px 16px;
    padding: 22px 18px;
    margin: 48px -18px 0;
  }
  .meta-item .num { font-size: 24px; }
  .meta-item .lab { font-size: 9px; letter-spacing: 0.14em; }

  /* ---- Section heads ---- */
  .section-head {
    grid-template-columns: 1fr;
    gap: 18px;
    margin-bottom: 40px;
  }
  .section-head h2 { font-size: clamp(28px, 7vw, 40px); }
  .section-head .desc { font-size: 15.5px; }
  .section-head .desc.right { justify-self: start; }
  .section-eyebrow { font-size: 10px; margin-bottom: 18px; }

  /* ---- Values (Why FrontLine) — single column on phone ---- */
  .values { grid-template-columns: 1fr; }
  .value {
    padding: 32px 22px 28px;
    border-right: none !important;
  }
  .value-num { margin-bottom: 20px; }
  .value-glyph { margin-bottom: 18px; width: 32px; height: 32px; }
  .value h3 { font-size: 20px; }

  /* ---- Audience tabs ---- */
  .audience { min-height: 0; }
  .aud-panel { padding: 28px 22px; gap: 24px; }
  .aud-panel h3 { font-size: 26px; }
  .aud-panel .pitch { font-size: 15px; margin-bottom: 22px; }
  .aud-panel ul { margin-bottom: 22px; }
  .aud-panel li { font-size: 14px; }
  .aud-tab { padding: 14px 18px; font-size: 15px; }

  /* ---- Services grid ---- */
  .svc-grid { grid-template-columns: 1fr; }
  .svc-card { min-height: 0; padding: 28px 22px 26px; }
  .svc-card h3 { font-size: 18px; }
  .svc-icon { width: 32px; height: 32px; }

  /* ---- Timeline ---- */
  .timeline-flow { max-width: 100%; }
  .timeline-spine { left: 9px; }
  .tl-item,
  .tl-item.tl-left,
  .tl-item.tl-right {
    width: 100%;
    margin-left: 0;
    padding: 14px 0 14px 44px;
  }
  .tl-item + .tl-item { margin-top: 0; }
  .tl-item.tl-left .tl-node,
  .tl-item.tl-right .tl-node { left: 2px; right: auto; }
  .tl-item.tl-left .tl-card::before,
  .tl-item.tl-right .tl-card::before { left: -26px; right: auto; width: 26px; }
  .tl-card h4 { font-size: 20px; }

  /* ---- Departments ---- */
  .depts { grid-template-columns: 1fr; }
  .dept {
    padding: 28px 22px 26px;
    min-height: 0;
  }
  .dept-num { margin-bottom: 18px; }
  .dept-icon { margin-bottom: 18px; width: 36px; height: 36px; }
  .dept-name { font-size: 19px; }
  .dept:hover .dept-name { transform: none; }
  .dept-desc {
    position: relative;
    left: 0; right: 0; bottom: 0;
    opacity: 1; transform: none;
    pointer-events: auto;
    margin-top: 12px;
  }
  .dept-desc p { font-size: 13px; }

  /* ---- Network map ---- */
  .network { padding: 72px 0 0; }
  .network-stats { gap: 24px; }
  .network-stat .num { font-size: 36px; }
  .map-wrap { height: 320px; }
  .country-list {
    grid-template-columns: repeat(2, 1fr);
    margin: 36px 0 0;
  }
  .country { padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,0.1); }
  .country:nth-child(2n) { border-right: none; }
  .country h4 { font-size: 15px; }

  /* Network map (extras file) */
  .netmap { padding: 56px 0 80px; }
  .netmap-toolbar { flex-direction: column; gap: 12px; align-items: stretch; padding: 12px; }
  .netmap-legend { flex-wrap: wrap; gap: 14px; font-size: 10px; justify-content: center; }
  .netmap-viewtoggle { align-self: center; }
  .netmap-stage { min-height: 320px; }
  .netmap-panel {
    position: static;
    width: 100%;
    margin: 12px 0 0;
    padding: 18px;
  }

  /* ---- ESG ---- */
  .esg-grid { grid-template-columns: 1fr; gap: 18px; }
  .esg-card { padding: 28px 22px; min-height: 0; }
  .esg-card h3 { font-size: 20px; }

  /* ---- Team ---- */
  .team-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .team-info { padding: 16px 16px 20px; }
  .team-info h4 { font-size: 16px; }
  .team-photo .initials { font-size: 56px; }

  /* ---- News ---- */
  .news-grid { grid-template-columns: 1fr; gap: 18px; }
  .news-card.featured h3 { font-size: 22px; }
  .news-card h3 { font-size: 18px; }

  /* ---- Testimonials ---- */
  .testimonials { grid-template-columns: 1fr; }
  .testi { padding: 32px 24px 28px; border-right: none; }
  .testi:nth-last-child(-n+2) { border-bottom: 1px solid var(--line); }
  .testi:last-child { border-bottom: none; }
  .testi blockquote { font-size: 21px; }
  .testimonials-google .testi blockquote { font-size: 17px; }

  /* ---- Mission ---- */
  .mission { padding: 88px 0; }
  .mission p { font-size: clamp(26px, 7vw, 38px); }

  /* ---- Contact ---- */
  .contact-grid { grid-template-columns: 1fr; }
  .contact-form { padding: 36px 24px 32px; }
  .contact-form h3 { font-size: 26px; }
  .form-row { grid-template-columns: 1fr; gap: 10px; }
  .form-field.full { grid-column: span 1; }
  .form-submit { flex-direction: column; gap: 18px; align-items: stretch; }
  .form-submit .btn { width: 100%; justify-content: center; }
  .contact-map { padding: 36px 24px 32px; }
  .mini-map { height: 180px; }

  /* ---- Page hero ---- */
  .page-hero { padding: 130px 0 56px; }
  .page-hero h1 { font-size: clamp(38px, 9vw, 56px); }
  .page-hero .lede { font-size: 16px; }
  .breadcrumb { margin-bottom: 22px; font-size: 10px; }

  /* ---- Footer ---- */
  footer { padding: 56px 0 24px; }
  .foot-top {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-bottom: 40px;
  }
  .foot-brand p { max-width: 100%; }
  .foot-bot {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
    padding-top: 22px;
  }
  .foot-bot-links { flex-wrap: wrap; gap: 16px; }

  /* ---- Mobile drawer tweaks ---- */
  .nav-drawer-inner { padding: 80px 24px 24px; }

  /* ---- Insights / Projects ---- */
  .insights-toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .insights-search input { min-width: 0; width: 100%; }
  .insights-newsline { font-size: 12px; padding: 10px 14px; }

  /* ---- Cert strip ---- */
  .certs-strip .certs-row { margin-top: 32px; }

  /* ---- Policy ---- */
  .policy-body { padding: 28px 22px; }

  /* Hide hero readout text/coordinates on mobile */
  .hero-readout { display: none !important; }
}

/* ============================================================
   SMALL PHONE — <= 480px
   ============================================================ */
@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .section { padding: 56px 0; }

  .nav { padding: 12px 14px; }
  .nav.scrolled { padding: 9px 14px; }
  .brand-logo { height: 34px; }
  .lang-toggle { padding: 2px; }
  .lang-btn { padding: 4px 8px; font-size: 10px; }
  .cta-pill { padding: 7px 12px; font-size: 12px; }

  .hero { padding: 100px 14px 32px; }
  .hero h1 { font-size: clamp(30px, 9.5vw, 40px); }
  .hero p.lede { font-size: 15px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }
  .hero-portal-mobile { width: 100%; }
  .hero-meta {
    grid-template-columns: 1fr 1fr;
    margin: 36px -14px 0;
    padding: 18px 14px;
    gap: 14px 12px;
  }
  .meta-item .num { font-size: 21px; }

  .section-head h2 { font-size: clamp(26px, 8vw, 34px); }

  .aud-panel h3 { font-size: 22px; }

  .tl-card { padding: 18px 18px 20px; }
  .tl-card h4 { font-size: 19px; }

  .mission p { font-size: clamp(24px, 8vw, 32px); }

  .news-card.featured h3 { font-size: 19px; }
  .testi blockquote { font-size: 19px; }

  .team-grid { grid-template-columns: 1fr; }

  .page-hero { padding: 110px 0 44px; }
  .page-hero h1 { font-size: clamp(32px, 10vw, 44px); }

  /* Filter pills wrap nicely */
  .filter-pills { gap: 6px; }
  .filter-pill { padding: 6px 11px; font-size: 11px; }

  /* Insight article */
  .ia-inner { padding: 0 18px; }
  .ia-body { font-size: 16px; }
  .ia-inner h1 { font-size: clamp(26px, 8vw, 36px); }
}

/* ============================================================
   Touch targets — ensure 44px min on phone
   ============================================================ */
@media (max-width: 768px) and (pointer: coarse) {
  .nav-link,
  .lang-btn,
  .cta-pill,
  .btn,
  .filter-pill,
  .nav-drawer-link,
  .svc-readmore,
  .aud-tab,
  .foot-col li a,
  .foot-bot-links a {
    min-height: 36px;
  }
  .nav-burger { width: 44px; height: 44px; }
  .form-field input,
  .form-field textarea,
  .form-field select {
    font-size: 16px; /* prevents iOS zoom on focus */
    padding: 14px 0;
  }
}

/* ============================================================
   Landscape phone — short viewports
   ============================================================ */
@media (max-height: 560px) and (max-width: 900px) {
  .hero { min-height: auto; padding-top: 96px; padding-bottom: 32px; }
  .hero-top { margin-bottom: 24px; }
  .hero h1 { margin-bottom: 16px; }
  .hero p.lede { margin-bottom: 22px; }
  .hero-meta { margin-top: 32px; }
}

/* ============================================================
   Reduced motion — collapse every animation/transition to a frame.
   Reveals still gate on scroll (JS adds .in) but pop instead of glide.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
  html, body { scroll-behavior: auto; }
}
