/* ============================================================
   METAGUARD DESIGN SYSTEM
   Navy / Teal / Amber (MemoFaceAI-exclusive) — see Phase 9
   Typeface: Instrument Sans (display), Inter (body)
   Two weights only: 400, 500. Sentence case everywhere.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500&family=Inter:wght@400;500&display=swap');

:root {
  /* Color */
  --navy-900: #0B1F3A;
  --navy-800: #12365E;
  --navy-700: #1B4574;
  --navy-050: #EEF2F6;
  --teal-600: #0E7C6B;
  --teal-500: #14957F;
  --teal-050: #E7F4F1;
  --amber-500: #F5B942;
  --amber-050: #FDF3E0;
  --neutral-900: #14171B;
  --neutral-700: #3D4147;
  --neutral-500: #6B6F76;
  --neutral-300: #C9CDD2;
  --neutral-100: #E8ECEF;
  --neutral-050: #F6F7F8;
  --white: #FFFFFF;

  /* Semantic */
  --bg-page: var(--white);
  --bg-alt: var(--neutral-050);
  --bg-inverse: var(--navy-900);
  --text-primary: var(--navy-900);
  --text-secondary: var(--neutral-700);
  --text-muted: var(--neutral-500);
  --text-inverse: var(--white);
  --text-inverse-muted: #AEB9C7;
  --accent: var(--teal-600);
  --accent-hover: var(--teal-500);
  --border: var(--neutral-100);
  --border-strong: var(--neutral-300);

  /* Type */
  --font-display: 'Instrument Sans', 'Inter', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;

  /* Spacing (8px base) */
  --sp-1: 8px;  --sp-2: 16px; --sp-3: 24px; --sp-4: 32px;
  --sp-5: 40px; --sp-6: 48px; --sp-8: 64px; --sp-10: 80px;
  --sp-12: 96px; --sp-16: 128px;

  /* Layout */
  --max-width: 1200px;
  --radius: 8px;
  --radius-card: 12px;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 150ms;
  --dur-base: 300ms;

  /* Nav (new — used for the fixes below) */
  --nav-height: 72px;
  --nav-gap: 22px;
  --nav-bridge: 12px; /* invisible gap between trigger and mega-menu */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-secondary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(34px, 4.4vw, 56px); }
h2 { font-size: clamp(26px, 3vw, 36px); }
h3 { font-size: 20px; }
h4 { font-size: 16px; }

p { max-width: 62ch; }
.lead { font-size: 19px; line-height: 1.6; color: var(--text-secondary); }
.eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin-bottom: var(--sp-2);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--sp-4);
}
@media (max-width: 640px) { .container { padding: 0 var(--sp-2); } }

section { padding: var(--sp-12) 0; }
@media (max-width: 640px) { section { padding: var(--sp-8) 0; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  padding: 13px 24px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: transparent; color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--neutral-050); }
.btn-ghost-inverse { background: transparent; color: var(--text-inverse); border-color: rgba(255,255,255,0.3); }
.btn-ghost-inverse:hover { background: rgba(255,255,255,0.08); }
.btn-arrow::after { content: '\2192'; transition: transform var(--dur-fast) var(--ease); }
.btn:hover .btn-arrow::after, .btn.btn-arrow:hover::after { transform: translateX(3px); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  gap: var(--sp-3);
}
.nav-logo {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 19px;
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-logo span { color: var(--accent); }

/* Links wrap to their own row on the FIRST sign of pressure, not mid-word.
   nowrap on each link + a scrollable/flex-safe row keeps the bar single-line
   at every width above the mobile breakpoint. */
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--nav-gap);
  list-style: none;
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}
.nav-links li { flex-shrink: 0; }
.nav-links a {
  display: inline-flex;
  align-items: center;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color var(--dur-fast);
}
.nav-links a:hover { color: var(--text-primary); }

.nav-right { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; }

/* Switch to the mobile menu earlier — 1080px instead of 900px — so the
   link row never has to compress/wrap while still in "desktop" mode. */
@media (max-width: 1080px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; }
}

/* ---------- Mega menu (Industries, Solutions, Technology) ---------- */
.has-dropdown { position: relative; }
.has-dropdown > a::after {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-left: 6px; margin-bottom: 1px;
  opacity: 0.6;
  flex-shrink: 0;
}

/* Invisible bridge closes the hover gap between the trigger and the menu
   so moving the mouse straight down never drops out of the hover chain. */
.has-dropdown::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: 100%;
  height: var(--nav-bridge);
  z-index: 199;
}

.mega-menu {
  position: absolute;
  top: calc(100% + var(--nav-bridge));
  left: 0;                     /* anchor to the trigger's left edge, not centered */
  width: max-content;
  min-width: 320px;
  max-width: min(560px, calc(100vw - var(--sp-4) * 2));
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 16px 40px rgba(11,31,58,0.14);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  gap: var(--sp-5);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(4px);
  transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
  z-index: 200;
}
/* If a dropdown sits near the right edge of the nav, flip it so it opens
   left instead of overflowing the viewport. Add class="has-dropdown flip"
   in markup for any trigger placed in the right half of the nav. */
.has-dropdown.flip .mega-menu { left: auto; right: 0; }

.has-dropdown:hover .mega-menu,
.has-dropdown:focus-within .mega-menu,
.has-dropdown.mobile-open .mega-menu {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0);
}
.mega-col { display: flex; flex-direction: column; gap: 2px; min-width: 160px; }
.mega-col h5 { font-size: 11.5px; color: var(--text-muted); font-weight: 500; margin-bottom: 6px; letter-spacing: 0.02em; }
.mega-col a { font-size: 13.5px; color: var(--text-secondary); padding: 6px 0; font-weight: 400; }
.mega-col a::after { display: none; }
.mega-col a:hover { color: var(--accent); }
.mega-col a.mega-cta { color: var(--accent); font-weight: 500; margin-top: 4px; }

@media (max-width: 1080px) {
  .has-dropdown::before { display: none; }
  .mega-menu {
    position: static;
    width: auto; max-width: none; min-width: 0;
    transform: none; opacity: 1; visibility: visible; pointer-events: auto;
    box-shadow: none; border: none; border-top: 1px solid var(--border); border-radius: 0;
    flex-direction: column; gap: var(--sp-2); padding: var(--sp-2) 0 var(--sp-2) var(--sp-2);
    display: none;
  }
  .has-dropdown.mobile-open .mega-menu { display: flex; }
  .has-dropdown > a::after { float: right; margin-top: 8px; }
}

/* ---------- Cards ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--sp-3);
  transition: border-color var(--dur-base) var(--ease), transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(11,31,58,0.06); }
.card-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--teal-050); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--sp-2); font-size: 20px;
}
.card h3 { margin-bottom: 8px; font-size: 17px; }
.card p { font-size: 14.5px; color: var(--text-secondary); }

.grid { display: grid; gap: var(--sp-3); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- Section variants ---------- */
.section-alt { background: var(--bg-alt); }
.section-inverse { background: var(--bg-inverse); color: var(--text-inverse-muted); }
.section-inverse h1, .section-inverse h2, .section-inverse h3 { color: var(--text-inverse); }
.section-inverse p { color: var(--text-inverse-muted); }

/* MemoFaceAI amber accent — exclusive to flagship product contexts */
.mf-accent { color: var(--amber-500); }

/* ---------- Video slot (filled or empty) — reusable across every page ---------- */
.video-slot {
  position: relative; border-radius: var(--radius-card); overflow: hidden;
  background: var(--navy-900); aspect-ratio: 16/9; margin: var(--sp-3) 0;
}
.video-slot iframe { width: 100%; height: 100%; border: 0; display: block; }
.video-slot-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; text-align: center; padding: var(--sp-3);
  border: 2px dashed rgba(255,255,255,0.18);
}
.video-slot-empty .play-icon {
  width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
  font-size: 20px; color: #fff;
}
.video-slot-empty .label { font-size: 13.5px; font-weight: 500; color: #fff; max-width: 340px; }
.video-slot-empty .hint { font-size: 12px; margin-top: 6px; color: var(--text-inverse-muted); }
.video-caption { font-size: 13px; color: var(--text-muted); margin-top: 8px; }
.mf-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--amber-050); color: #8A5C0A;
  font-size: 12.5px; font-weight: 500;
  padding: 5px 12px; border-radius: 20px;
  margin-bottom: var(--sp-2);
}
.mf-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--amber-500); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 600ms var(--ease), transform 600ms var(--ease); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- Trust bar ---------- */
.trust-bar { display: flex; align-items: center; justify-content: center; gap: var(--sp-6); flex-wrap: wrap; padding: var(--sp-4) 0; }
.trust-stat { text-align: center; }
.trust-stat .num { font-family: var(--font-display); font-size: 26px; font-weight: 500; color: var(--text-primary); }
.trust-stat .label { font-size: 13px; color: var(--text-muted); }
@media (max-width: 640px) { .trust-bar { gap: var(--sp-3); } }

/* ---------- FAQ ---------- */
.faq-item { border-bottom: 1px solid var(--border); }
.faq-q {
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) 0; font-family: var(--font-display); font-weight: 500; font-size: 16px; color: var(--text-primary);
}
.faq-q .icon { transition: transform var(--dur-base) var(--ease); flex-shrink: 0; margin-left: 16px; }
.faq-item.open .faq-q .icon { transform: rotate(45deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height var(--dur-base) var(--ease); }
.faq-a p { padding-bottom: var(--sp-3); font-size: 14.5px; }

/* ---------- Footer ---------- */
.footer { background: var(--navy-900); color: var(--text-inverse-muted); padding: var(--sp-10) 0 var(--sp-4); }
.footer-grid { display: grid; grid-template-columns: 1.5fr repeat(4, 1fr); gap: var(--sp-4); margin-bottom: var(--sp-8); }
.footer h4 { color: var(--text-inverse); font-size: 13px; margin-bottom: var(--sp-2); text-transform: none; }
.footer ul { list-style: none; }
.footer li { margin-bottom: 10px; }
.footer a { font-size: 14px; color: var(--text-inverse-muted); }
.footer a:hover { color: var(--white); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: var(--sp-3); display: flex; justify-content: space-between; font-size: 13px; flex-wrap: wrap; gap: 8px; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .footer-grid { grid-template-columns: 1fr; gap: var(--sp-3); } }

/* ---------- Utility ---------- */
.mt-1 { margin-top: var(--sp-1); } .mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); } .mt-4 { margin-top: var(--sp-4); }
.text-center { text-align: center; }
.mx-auto { margin-left: auto; margin-right: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }