/* ==========================================================================
   FERAD INNOVATION — Mobile & responsive overrides (2026-11-16)
   Loaded AFTER site.css:
   <link rel="stylesheet" href="assets/css/responsive.css?v=20261116">
   Desktop (>= 1024px) is unchanged, except that the navbar falls back to the
   hamburger when its links do not fit (long French labels, Team Login shown).
   ========================================================================== */

/* ---------- Global safety ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-x: clip; }
img, video, iframe { max-width: 100%; height: auto; }
a, button { -webkit-tap-highlight-color: transparent; }
:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid #6c7cff; outline-offset: 2px;
}
.legal p, .legal li { overflow-wrap: break-word; }

/* iOS zooms into any field under 16px, on iPhone and iPad alike */
@supports (-webkit-touch-callout: none) {
  input, select, textarea { font-size: 16px !important; }
}

/* Back-to-top: invisible means untappable; never on top of the form's submit
   button (responsive.js sets html.submit-in-view); mirrored in Arabic */
.back-to-top { pointer-events: none; }
.back-to-top.visible { pointer-events: auto; }
html.submit-in-view .back-to-top { opacity: 0; pointer-events: none; transform: translateY(20px); }
html[dir="rtl"] .back-to-top { right: auto; left: 28px; }

/* ---------- Arabic (RTL): letter-spacing breaks joined letters ---------- */
html[dir="rtl"] body,
html[dir="rtl"] body * { letter-spacing: 0 !important; text-transform: none !important; }
html[dir="rtl"] .hero-title { line-height: 1.35; }
html[dir="rtl"] .section-title,
html[dir="rtl"] .cta-content h2,
html[dir="rtl"] .legal h1 { line-height: 1.45; }
html[dir="rtl"] :is(p, li) { line-height: 1.85; }
html[dir="rtl"] :is(.dept-modules, .nav-links) li { line-height: inherit; }

/* ---------- Collapsed navigation (hamburger) ----------
   site.css collapses the navbar at <= 768px. Between 769 and 1023px the full
   navbar is wider than the screen in every language, so it collapses here
   too; at >= 1024px responsive.js adds .nav-collapsed only when it overflows. */
@media (min-width: 769px) and (max-width: 1023px) {
  .navbar .nav-links {
    display: none; position: fixed; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border);
  }
  .navbar .nav-links.open { display: flex; }
  .navbar .hamburger { display: flex; }
  .nav-actions .nav-login { display: none; }
  .nav-login-mobile { display: block; }
  /* 3 plan cards: the no-wrap button made them wider than the screen
     (up to 975px of content in French at 800px) */
  .pricing-card { padding: 32px 22px; }
  .pricing-card .btn { white-space: normal; text-align: center; }
  /* Contact: the 80px gap + 3 checkbox columns overflowed by 5px at 800px */
  .contact-grid { gap: 40px; }
  .checkbox-group { grid-template-columns: 1fr 1fr; }
}
.navbar.nav-collapsed .nav-links {
  display: none; position: fixed; top: var(--nav-h); left: 0; right: 0;
  flex-direction: column; backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}
.navbar.nav-collapsed .nav-links.open { display: flex; }
.navbar.nav-collapsed .hamburger { display: flex; }
.navbar.nav-collapsed .nav-actions .nav-login { display: none; }
.navbar.nav-collapsed .nav-login-mobile { display: block; }

/* Menu panel: full height, scrolls on its own, big tappable links */
@media (max-width: 1023px) {
  .nav-links {
    bottom: 0;
    height: calc(100vh - var(--nav-h));
    height: calc(100dvh - var(--nav-h));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: rgba(8, 14, 28, 0.99);
    padding: 24px 20px calc(32px + env(safe-area-inset-bottom));
    gap: 6px;
    align-items: stretch;
  }
  .nav-links a {
    display: flex; align-items: center; justify-content: center;
    min-height: 52px; font-size: 18px; border-radius: 12px;
  }
  .hamburger { width: 44px; height: 44px; align-items: center; justify-content: center; }
  .navbar:has(.nav-links.open) { background: rgba(8, 14, 28, 0.99); }
}
.navbar.nav-collapsed .nav-links {
  bottom: 0;
  height: calc(100vh - var(--nav-h));
  height: calc(100dvh - var(--nav-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(8, 14, 28, 0.99);
  padding: 24px 20px calc(32px + env(safe-area-inset-bottom));
  gap: 6px;
  align-items: stretch;
}
.navbar.nav-collapsed .nav-links a {
  display: flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 12px 16px; font-size: 18px; border-radius: 12px;
}
.navbar.nav-collapsed .hamburger { width: 44px; height: 44px; align-items: center; justify-content: center; }
.navbar.nav-collapsed:has(.nav-links.open) { background: rgba(8, 14, 28, 0.99); }

/* ---------- Touch targets: phones, plus touch screens up to 1023px
   (tablets in portrait, phones in landscape) ---------- */
@media (max-width: 768px), (pointer: coarse) and (max-width: 1023px) {
  .lang-btn { min-width: 36px; min-height: 36px; }
  .nav-logo { min-height: 44px; }
  .service-cta,
  .case-link,
  .contact-item a { display: inline-flex; align-items: center; min-height: 44px; }
  .footer-col ul { gap: 0; }
  .footer-col a:not(.btn),
  .footer-links a { display: inline-flex; align-items: center; min-height: 44px; }
  /* Forms: 16px stops iOS auto-zoom on focus */
  input, select, textarea { font-size: 16px !important; }
  .form-group > input, .form-group > select { min-height: 46px; }
  .contact-form .check-label { min-height: 44px; gap: 10px; }
  .contact-form .checkbox-group .check-label input[type="checkbox"] { width: 20px; height: 20px; }
}

/* ---------- Tablet & phone ---------- */
@media (max-width: 768px) {
  section { padding: 56px 0; }
  .container { padding-left: 20px; padding-right: 20px; }
  .section-header { margin-bottom: 40px; }

  /* Hero: no forced full-screen height, less dead space */
  .hero { min-height: auto; padding: 108px 20px 56px; }
  .hero-actions { margin-bottom: 48px; }
  .hero-scroll-indicator { display: none; }
  .hero-actions .btn,
  .cta-actions .btn {
    width: 100%; max-width: 360px; justify-content: center;
    white-space: normal; text-align: center;
  }

  .footer-links { flex-wrap: wrap; justify-content: center; column-gap: 20px; row-gap: 0; }

  /* Readable small text (12px minimum) */
  .service-badge, .featured-badge, .case-tag, .metric-badge { font-size: 12px; }
  .metric-detail, .dept-modules li, .contact-form label { font-size: 12.5px; }

  /* Form layout (touch sizes are in the block above) */
  .form-row { row-gap: 0; }   /* one column: same 18px between every field */
  .contact-form { padding: 24px 16px; }
  .checkbox-group { grid-template-columns: 1fr 1fr; }

  /* Footer: two columns instead of one long list */
  .footer { padding-top: 56px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px 20px; }
  .footer-brand,
  .footer-diag { grid-column: 1 / -1; }

  /* Back-to-top: 44px, clear of the iPhone home bar and rounded corners */
  .back-to-top {
    width: 44px; height: 44px;
    right: calc(16px + env(safe-area-inset-right));
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
  html[dir="rtl"] .back-to-top { right: auto; left: calc(16px + env(safe-area-inset-left)); }
}

/* ---------- Method steps on phones: two 120–160px columns were too narrow
   to read, so each step becomes a row (number | text) ---------- */
@media (max-width: 480px) {
  .process-steps { gap: 28px; }
  .process-step {
    flex: 1 1 100%; max-width: none; padding: 0;
    display: grid; grid-template-columns: 52px 1fr; column-gap: 16px;
    align-items: start; text-align: start;
  }
  .process-step .step-num { grid-row: 1 / span 3; font-size: 40px; margin: 0; }
  .process-step .step-icon { display: none; }
  .process-step h3 { margin-bottom: 6px; }
  .process-step p { margin-bottom: 10px; }
  .process-step .step-tag { justify-self: start; }
}

/* ---------- Small phones ---------- */
@media (max-width: 420px) {
  section { padding: 48px 0; }
  .container { padding-left: 16px; padding-right: 16px; }
  .nav-container { padding: 0 16px; gap: 10px; }
  .hero { padding: 96px 16px 48px; }
  .hero-title { font-size: clamp(30px, 9vw, 36px); }
  .section-title { font-size: 23px; }
  .nav-logo { font-size: 14px; }
  .lang-btn { padding: 6px 4px; }
}

/* ---------- Narrow phones (< 375px): the one-line logo, the language
   switcher and a 44px hamburger don't fit side by side, so the wordmark
   stacks as FERAD / INNOVATION ---------- */
@media (max-width: 374px) {
  .navbar .nav-logo { gap: 6px; }
  .navbar .nav-logo svg { width: 24px; height: 24px; }
  .navbar .logo-word { display: flex; flex-direction: column; font-size: 15px; line-height: 1.05; }
  .navbar .logo-sub { font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em; }
}

/* ---------- Very small phones (iPhone SE 1st gen, Galaxy Fold) ---------- */
@media (max-width: 340px) {
  .nav-logo { font-size: 13px; }
}
/* One footer column only below 300px (Galaxy Fold folded): at 320px two
   columns still fit, and one column made the footer taller than before */
@media (max-width: 300px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ---------- Phones in landscape (touch screens only) ---------- */
@media (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  .hero { min-height: auto; padding-top: 88px; }
  .hero-scroll-indicator { display: none; }
  .nav-links a { min-height: 44px; }
  /* viewport-fit=cover: keep content clear of the notch */
  .container, .nav-container {
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
  }
  .hero {
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
  }
}

/* ---------- Touch devices: no sticky hover lifts ---------- */
@media (hover: none) {
  .service-card:hover, .pricing-card:hover, .case-card:hover,
  .dept-card:hover, .sector-card:hover, .metric-card:hover,
  .btn-primary:hover, .btn-white:hover { transform: none; }
  .pricing-card.featured-plan:hover { transform: scale(1.03); }
  .back-to-top.visible:hover { transform: translateY(0); }
  .service-cta:hover { letter-spacing: inherit; }
}
@media (hover: none) and (max-width: 768px) {
  .pricing-card.featured-plan:hover { transform: none; }
}

/* ---------- Accessibility: reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
