/* =========================================================
   APM Innovation — styles.css
   Brand teal + charcoal, system fonts, mobile-first
   ========================================================= */

:root {
  --teal: #14B8A6;
  --teal-dark: #0D9488;
  --ink: #0F1719;
  --ink-soft: #1E2A2E;
  --muted: #4B5563;
  --muted-2: #6B7280;
  --line: #E5E7EB;
  --surface: #FFFFFF;
  --surface-2: #F7F9FA;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 25, 0.06), 0 1px 3px rgba(15, 23, 25, 0.04);
  --shadow-md: 0 10px 25px -10px rgba(15, 23, 25, 0.15);
  --shadow-lg: 0 20px 40px -15px rgba(20, 184, 166, 0.25);

  --maxw: 1180px;
  --space: clamp(1rem, 2vw, 1.5rem);
  --header-h: 72px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; transition: color .2s ease, opacity .2s ease; }
a:hover { color: var(--teal-dark); }
ul { list-style: none; padding: 0; margin: 0; }
button { font: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }

h1, h2, h3 {
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
  color: var(--ink);
}
h1 { font-size: clamp(2rem, 5vw, 3.75rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.5rem); }
h3 { font-size: 1.15rem; letter-spacing: -0.01em; }
p  { margin: 0 0 1em; color: var(--muted); }

/* Prevent long words (e.g. "mémorable") from overflowing on narrow screens */
h1, h2, h3, p, a, span { overflow-wrap: break-word; word-wrap: break-word; }
body { overflow-x: hidden; }

/* Focus */
:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
}
.section { padding: clamp(4rem, 8vw, 7rem) 0; }
.section-muted { background: var(--surface-2); }
.section-dark {
  background: var(--ink);
  color: #E7ECEE;
}
.section-dark h2 { color: #fff; }
.section-dark p  { color: #B5C0C4; }

.section-head {
  max-width: 680px;
  margin: 0 auto 3rem;
  text-align: center;
}
.section-head .eyebrow { justify-content: center; }
.section-sub { color: var(--muted); margin-top: 0.5rem; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal-dark);
  margin-bottom: 1rem;
}
.eyebrow::before {
  content: "";
  width: 28px; height: 2px;
  background: var(--teal);
  border-radius: 2px;
}
.eyebrow-light { color: #5EEAD4; }
.eyebrow-light::before { background: #5EEAD4; }

.accent { color: var(--teal-dark); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--teal);
  color: #fff;
  box-shadow: var(--shadow-lg);
}
.btn-primary:hover {
  background: var(--teal-dark);
  color: #fff;
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--line);
}
.btn-ghost:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.section-dark .btn-ghost { color: #fff; border-color: rgba(255,255,255,0.25); }
.section-dark .btn-ghost:hover { border-color: #fff; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: 1rem;
}
.nav-brand { display: inline-flex; align-items: center; }
.nav-logo { height: 40px; width: auto; }

.nav-menu {
  display: none;
  gap: 1.75rem;
  align-items: center;
}
.nav-menu a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
  position: relative;
}
.nav-menu a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: var(--teal);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s ease;
}
.nav-menu a:hover::after { transform: scaleX(1); }
.nav-menu .nav-cta {
  background: var(--ink);
  color: #fff;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
}
.nav-menu .nav-cta::after { display: none; }
.nav-menu .nav-cta:hover { background: var(--teal); color: #fff; }

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  /* 44×44px minimum tap target (WCAG / Apple HIG) */
  width: 44px;
  height: 44px;
  margin-right: -0.5rem; /* visually aligns to edge while keeping tap area */
  border-radius: 8px;
  z-index: 60;
  position: relative;
}
.nav-toggle:active { background: rgba(0,0,0,0.04); }
.nav-toggle span {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: clamp(4rem, 9vw, 7rem) 0 clamp(4rem, 8vw, 6rem);
  background:
    radial-gradient(1200px 600px at 90% -10%, rgba(20,184,166,0.18), transparent 60%),
    radial-gradient(800px 500px at -10% 120%, rgba(20,184,166,0.10), transparent 60%),
    var(--surface);
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: center;
}
.hero h1 { margin-top: 0.5rem; }
.lede {
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  color: var(--muted);
  max-width: 52ch;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.hero-visual {
  position: relative;
  min-height: 320px;
  display: none;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0.85;
}
.blob-1 {
  width: 340px; height: 340px;
  background: radial-gradient(circle at 30% 30%, #5EEAD4, var(--teal) 60%, var(--teal-dark));
  top: 20px; right: 40px;
}
.blob-2 {
  width: 220px; height: 220px;
  background: radial-gradient(circle at 70% 70%, #0F1719, #1E2A2E);
  bottom: 0; left: 20px;
}
.grid-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--line) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
  mask-image: radial-gradient(circle at center, #000, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at center, #000, transparent 75%);
  opacity: 0.6;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
@media (max-width: 420px) {
  /* Ultra-narrow phones: give each stat breathing room */
  .stats { grid-template-columns: 1fr; gap: 0.75rem; }
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 0.75rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-value {
  display: block;
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
  font-weight: 800;
  color: var(--teal-dark);
  letter-spacing: -0.02em;
}
.stat-label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted-2);
  margin-top: 0.25rem;
}

/* ---------- Services ---------- */
.services-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
.service {
  background: var(--surface);
  padding: 1.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.service:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: transparent;
}
.service-icon {
  width: 44px; height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(20,184,166,0.12);
  color: var(--teal-dark);
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  margin-bottom: 1rem;
}
.service h3 { margin-bottom: 0.35rem; }
.service p { margin: 0; font-size: 0.95rem; }

/* ---------- Clients : infinite marquee ---------- */
.section-clients {
  overflow: hidden;
  padding-bottom: clamp(4rem, 8vw, 6rem);
}

.marquee {
  position: relative;
  width: 100%;
  overflow: hidden;
  margin: 1rem 0;
  /* Soft edge fade so logos ease in/out of view */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 8%, #000 92%, transparent 100%);
          mask-image: linear-gradient(to right, transparent 0, #000 8%, #000 92%, transparent 100%);
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee-left 40s linear infinite;
  will-change: transform;
}
/* Before JS clones the set, keep the track invisible to avoid a flash
   of "single set then duplicate appearing". Shown once .is-ready is set. */
.js [data-marquee]:not(.is-ready) .marquee-track {
  visibility: hidden;
}
.marquee-reverse .marquee-track {
  animation-name: marquee-right;
  animation-duration: 48s;
}
.marquee:hover .marquee-track { animation-play-state: paused; }

.marquee-set {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  padding: 0 clamp(1rem, 2.5vw, 2.5rem);
}

.logo {
  flex-shrink: 0;
  height: 64px;
  display: inline-flex;
  align-items: center;
  filter: grayscale(1) contrast(1.05);
  opacity: 0.55;
  transform: translateZ(0);
  transition: filter .35s ease, opacity .35s ease, transform .35s ease;
}
.logo svg,
.logo img {
  height: 100%;
  width: auto;
  max-height: 100%;
  display: block;
  object-fit: contain;
}
.logo:hover {
  filter: grayscale(0);
  opacity: 1;
  transform: translateY(-3px) scale(1.04);
}

@keyframes marquee-left {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}
@keyframes marquee-right {
  from { transform: translate3d(-50%, 0, 0); }
  to   { transform: translate3d(0, 0, 0); }
}

.clients-note {
  margin-top: 2.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted-2);
  font-style: italic;
}

@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; }
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}
.contact-list li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  align-items: baseline;
}
@media (max-width: 420px) {
  .contact-list li {
    grid-template-columns: 1fr;
    gap: 0.25rem;
    padding: 0.9rem 0;
  }
}
.contact-list li:last-child { border-bottom: 0; }
.contact-label {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5EEAD4;
  font-weight: 700;
}
.contact-list a {
  color: #fff;
  border-bottom: 1px solid transparent;
}
.contact-list a:hover {
  color: #5EEAD4;
  border-bottom-color: #5EEAD4;
}

/* ---------- Footer ---------- */
.site-footer {
  background: #0A1012;
  color: #B5C0C4;
  padding: 3rem 0 calc(1.25rem + env(safe-area-inset-bottom));
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.footer-logo {
  height: 38px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.95;
}
.footer-tag {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: #8A969B;
}
.footer-links, .socials {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}
.footer-links a, .socials a {
  color: #B5C0C4;
  font-size: 0.9rem;
}
.footer-links a:hover, .socials a:hover { color: #5EEAD4; }
.footer-bottom {
  padding-top: 1.25rem;
  color: #6B7A7F;
  font-size: 0.8rem;
  text-align: center;
}

/* ---------- Custom cursor ----------
   Activated only when body has .cursor-enabled (JS adds this on
   fine-pointer devices). Falls back gracefully on touch. */
.cursor-enabled { cursor: none; }
.cursor-enabled a,
.cursor-enabled button,
.cursor-enabled .btn,
.cursor-enabled [role="button"],
.cursor-enabled input,
.cursor-enabled textarea,
.cursor-enabled label { cursor: none; }

.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
  border-radius: 50%;
  transform: translate3d(-50%, -50%, 0);
  will-change: transform, width, height, background-color, border-color;
  opacity: 0;
  transition: opacity .25s ease;
}
.cursor-dot {
  width: 6px;
  height: 6px;
  background: var(--teal);
  mix-blend-mode: normal;
  transition: opacity .2s ease, transform .08s ease-out, background-color .2s ease;
}
.cursor-ring {
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--teal);
  background: transparent;
  transition:
    opacity .25s ease,
    width .25s cubic-bezier(.2,.8,.2,1),
    height .25s cubic-bezier(.2,.8,.2,1),
    border-color .25s ease,
    background-color .25s ease;
}
.cursor-visible .cursor-dot,
.cursor-visible .cursor-ring { opacity: 1; }

/* Hover state over interactive elements */
.cursor-hover .cursor-ring {
  width: 64px;
  height: 64px;
  border-color: var(--teal);
  background: rgba(20, 184, 166, 0.12);
}
.cursor-hover .cursor-dot {
  opacity: 0;
}

/* Over dark sections, invert colors for contrast */
.cursor-dark .cursor-dot { background: #5EEAD4; }
.cursor-dark .cursor-ring { border-color: #5EEAD4; }
.cursor-dark.cursor-hover .cursor-ring { background: rgba(94, 234, 212, 0.15); }

/* Active / press state */
.cursor-down .cursor-ring {
  width: 28px;
  height: 28px;
}

/* Hide entirely on coarse pointers (touch) or reduced motion */
@media (hover: none), (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none !important; }
  .cursor-enabled, .cursor-enabled * { cursor: auto !important; }
}
@media (prefers-reduced-motion: reduce) {
  .cursor-ring { transition: opacity .2s ease; }
}

/* ---------- Reveal animation ----------
   Only hide-then-reveal when JS is active. Without JS (or before
   the script runs) content is visible by default. */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s ease, transform .6s ease;
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Overlay (mobile menu backdrop) ---------- */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 25, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 40;
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
.nav-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Lock body scroll when mobile menu is open */
body.menu-open {
  overflow: hidden;
  touch-action: none;
}

/* ---------- Mobile menu (small screens) ---------- */
@media (max-width: 767px) {
  .nav-menu {
    position: fixed;
    top: var(--header-h);
    right: 0;
    bottom: 0;
    left: 0;
    /* dvh handles iOS Safari dynamic toolbar; vh is fallback */
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    background: #fff;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 1rem 1.25rem max(2rem, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    transform: translateY(-100%);
    transition: transform .3s cubic-bezier(.2,.8,.2,1), visibility 0s linear .3s;
    visibility: hidden;
    display: flex;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 55;
  }
  .nav-menu li { border-bottom: 1px solid var(--line); }
  .nav-menu li:last-child {
    border-bottom: 0;
    margin-top: 1rem;   /* breathing room before the CTA, NOT auto */
    padding-top: 1rem;
    border-top: 1px solid var(--line);
  }
  .nav-menu a {
    display: block;
    padding: 1.1rem 0;
    font-size: 1.1rem;
  }
  .nav-menu a::after { display: none; } /* underline doesn't fit full-width links */
  .nav-menu .nav-cta {
    margin-top: 0.75rem;
    text-align: center;
    padding: 1rem 1.25rem;
    font-size: 1rem;
  }
  .site-header.is-open .nav-menu {
    transform: translateY(0);
    visibility: visible;
    transition: transform .3s cubic-bezier(.2,.8,.2,1), visibility 0s;
  }
  /* Overlay only exists on small screens */
}

/* Hide overlay entirely above the breakpoint */
@media (min-width: 768px) {
  .nav-overlay { display: none; }
}

/* ---------- Tablet / Desktop ---------- */
@media (min-width: 768px) {
  .nav-toggle { display: none; }
  .nav-menu { display: flex; }

  .hero-grid { grid-template-columns: 1.1fr 0.9fr; }
  .hero-visual { display: block; }

  .about-grid { grid-template-columns: 1.2fr 1fr; align-items: center; gap: 4rem; }

  .services-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
  .clients-grid  { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }

  .contact-grid { grid-template-columns: 1.1fr 0.9fr; gap: 4rem; align-items: center; }

  .footer-grid {
    grid-template-columns: 1.2fr 1fr 1fr;
    align-items: center;
  }
  .footer-links, .socials { justify-content: flex-end; }
}

@media (min-width: 1024px) {
  .services-grid { grid-template-columns: repeat(3, 1fr); }
}
