/* ============================================================
   Grégory Fabre — Consultation TI
   Refined light system · single cobalt accent · kinetic
   ============================================================ */

:root {
  /* Surfaces */
  --paper:    oklch(0.987 0.004 95);
  --paper-2:  oklch(0.965 0.006 95);
  --paper-3:  oklch(0.945 0.007 95);
  --ink:      oklch(0.185 0.012 262);
  --ink-2:    oklch(0.235 0.014 262);

  /* Text */
  --fg:       oklch(0.205 0.012 262);
  --fg-soft:  oklch(0.405 0.011 262);
  --muted:    oklch(0.555 0.010 262);
  --faint:    oklch(0.685 0.008 262);

  /* On dark */
  --on-ink:        oklch(0.965 0.004 95);
  --on-ink-soft:   oklch(0.760 0.010 262);
  --on-ink-faint:  oklch(0.560 0.014 262);

  /* Lines */
  --line:     oklch(0.905 0.005 262);
  --line-2:   oklch(0.860 0.006 262);
  --line-ink: oklch(0.330 0.014 262);

  /* Accent — cobalt */
  --accent:        oklch(0.520 0.175 256);
  --accent-bright: oklch(0.585 0.185 256);
  --accent-deep:   oklch(0.430 0.150 258);
  --accent-wash:   oklch(0.930 0.045 256);
  --accent-glow:   oklch(0.700 0.150 256);

  /* Type */
  --sans: "Schibsted Grotesk", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  /* Metrics */
  --maxw: 1280px;
  --gutter: clamp(20px, 5vw, 72px);
  --radius: 4px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--fg);
  line-height: 1.55;
  font-weight: 400;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: var(--paper); }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }

/* ---------- Animated background canvas ---------- */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}

/* fine grain overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Custom cursor ---------- */
.cursor-ring, .cursor-dot {
  position: fixed;
  top: 0; left: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  will-change: transform;
  mix-blend-mode: difference;
}
.cursor-ring {
  width: 38px; height: 38px;
  margin: -19px 0 0 -19px;
  border: 1.5px solid oklch(0.85 0 0);
  transition: width .28s var(--ease), height .28s var(--ease),
              margin .28s var(--ease), opacity .3s, background-color .3s;
}
.cursor-dot {
  width: 6px; height: 6px;
  margin: -3px 0 0 -3px;
  background: oklch(0.85 0 0);
  transition: opacity .3s, transform .2s var(--ease);
}
body.cursor-hover .cursor-ring {
  width: 60px; height: 60px;
  margin: -30px 0 0 -30px;
  background: oklch(0.85 0 0 / 0.12);
}
body.cursor-hover .cursor-dot { opacity: 0; }
body.cursor-down .cursor-ring { width: 30px; height: 30px; margin: -15px 0 0 -15px; }
@media (hover: none), (pointer: coarse) {
  .cursor-ring, .cursor-dot { display: none; }
}

/* ---------- Scroll progress ---------- */
.progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: var(--accent);
  z-index: 200;
}

/* ---------- Layout primitives ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: var(--gutter);
  position: relative;
  z-index: 2;
}
main { position: relative; z-index: 2; }
section { position: relative; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
}
.eyebrow::before {
  content: "";
  width: 26px; height: 1px;
  background: var(--accent);
  opacity: 0.6;
}

.section-head { max-width: 760px; margin-bottom: clamp(40px, 6vw, 72px); }
.section-head h2 {
  font-size: clamp(2rem, 4.6vw, 3.5rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 500;
  margin-top: 22px;
}
.section-head p {
  font-size: clamp(1.02rem, 1.5vw, 1.18rem);
  color: var(--fg-soft);
  margin-top: 20px;
  max-width: 56ch;
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  transition: background .4s var(--ease), border-color .4s, backdrop-filter .4s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: oklch(0.987 0.004 95 / 0.72);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom-color: var(--line);
}
.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 1.02rem;
}
.brand .mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: var(--ink);
  color: var(--paper);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
}
.brand .role {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  font-weight: 400;
  display: block;
  margin-top: 2px;
  white-space: nowrap;
}
@media (max-width: 560px) {
  .brand .role { white-space: normal; max-width: 42ch; line-height: 1.3; }
}
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.4vw, 38px);
}
.nav-links a {
  font-size: 0.93rem;
  color: var(--fg-soft);
  position: relative;
  padding: 4px 0;
  transition: color .25s;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform .35s var(--ease);
}
.nav-links a:hover { color: var(--fg); }
.nav-links a:hover::after { transform: scaleX(1); }
.nav-tools { display: flex; align-items: center; gap: 16px; }

.lang-toggle {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  border: 1px solid var(--line-2);
  border-radius: 100px;
  overflow: hidden;
}
.lang-toggle button {
  padding: 6px 11px;
  color: var(--muted);
  transition: color .25s, background .25s;
}
.lang-toggle button.active { background: var(--ink); color: var(--paper); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 0.72em 1.3em;
  border-radius: 100px;
  transition: transform .3s var(--ease), background .3s, color .3s, box-shadow .3s;
  white-space: nowrap;
}
.btn .arr { transition: transform .35s var(--ease); }
.btn:hover .arr { transform: translateX(4px); }
.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover { background: var(--accent); box-shadow: 0 12px 30px -12px var(--accent); }
.btn-ghost {
  border: 1px solid var(--line-2);
  color: var(--fg);
}
.btn-ghost:hover { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.btn-light {
  background: var(--paper);
  color: var(--ink);
}
.btn-light:hover { background: var(--accent); color: var(--paper); }
.btn-outline-light {
  border: 1px solid var(--line-ink);
  color: var(--on-ink);
}
.btn-outline-light:hover { border-color: var(--on-ink); background: oklch(1 0 0 / 0.06); }

.nav-toggle { display: none; }

/* ---------- Hero ---------- */
.hero {
  padding-top: clamp(140px, 19vh, 220px);
  padding-bottom: clamp(60px, 9vw, 120px);
  min-height: 100svh;
  display: flex;
  align-items: center;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(40px, 6vw, 80px);
  width: 100%;
}
.hero-eyebrow { margin-bottom: 30px; }

.hero h1 {
  font-size: clamp(2.7rem, 7.4vw, 6.6rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
  font-weight: 500;
  max-width: 17ch;
}
.hero h1 .word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.3em;
  margin-bottom: -0.3em;
}
.hero h1 .word > span {
  display: inline-block;
  transform: translateY(calc(100% + 0.4em));
  transition: transform 0.9s var(--ease-out);
}
.hero h1.in .word > span { transform: translateY(0); }
.hero h1 .accent { color: var(--accent); font-style: italic; font-weight: 400; }
/* Évite le flash du titre statique avant le (re)build animé par le JS.
   Sans JS (crawlers, no-JS), le titre reste visible normalement. */
.js #hero-title { visibility: hidden; }
.js #hero-title.in { visibility: visible; }

.hero-lower {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(32px, 5vw, 64px);
  align-items: end;
  margin-top: clamp(36px, 4.5vw, 56px);
}
.hero-sub {
  font-size: clamp(1.05rem, 1.55vw, 1.28rem);
  color: var(--fg-soft);
  max-width: 46ch;
  line-height: 1.5;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }

.hero-facts {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--line);
}
.hero-fact {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.hero-fact .k {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero-fact .v {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-align: right;
}
.hero-fact .v b { color: var(--accent); font-weight: 600; }

.scroll-cue {
  position: absolute;
  bottom: 30px; left: var(--gutter);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.scroll-cue .line {
  width: 46px; height: 1px;
  background: var(--line-2);
  position: relative;
  overflow: hidden;
}
.scroll-cue .line::after {
  content: "";
  position: absolute; inset: 0;
  width: 40%;
  background: var(--accent);
  animation: cue 2.4s var(--ease) infinite;
}
@keyframes cue { 0% { transform: translateX(-120%);} 60%,100% { transform: translateX(280%);} }
@media (prefers-reduced-motion: reduce) { .scroll-cue .line::after { animation: none; } }

/* ---------- Clients ---------- */
.clients {
  padding: clamp(40px, 6vw, 70px) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.clients-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(26px, 3.4vw, 44px);
}
.clients-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.clients-marks {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(28px, 4vw, 60px);
  flex-wrap: wrap;
  width: 100%;
}
.clients-marks img.client-logo {
  height: clamp(34px, 3.2vw, 46px);
  width: auto;
  object-fit: contain;
  filter: grayscale(1);
  opacity: 0.72;
  transition: opacity .35s var(--ease), filter .35s var(--ease), transform .35s var(--ease);
}
.clients-marks img.client-logo:hover {
  opacity: 1;
  filter: grayscale(0);
  transform: translateY(-2px);
}
.clients-marks img[alt="McGill"] { height: clamp(25px, 2.3vw, 33px); opacity: 0.55; }
.clients-marks img[alt="McGill"]:hover { opacity: 1; }

/* ---------- Section base ---------- */
.section { padding: clamp(80px, 11vw, 160px) 0; }
.section.alt { background: var(--paper-2); }

/* ---------- Services ---------- */
.services-list {
  border-top: 1px solid var(--line-2);
}
.service {
  display: grid;
  grid-template-columns: 80px 1fr 1.1fr;
  gap: clamp(16px, 3vw, 48px);
  align-items: baseline;
  padding: clamp(28px, 3.6vw, 44px) 0;
  border-bottom: 1px solid var(--line-2);
  position: relative;
}
.service .num {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  padding-top: 6px;
}
.service h3 {
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.05;
}
.service p {
  color: var(--fg-soft);
  font-size: 1.02rem;
  max-width: 48ch;
}

/* ---------- Case studies ---------- */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(14px, 2vw, 22px);
}
.case {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(26px, 3vw, 40px);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 280px;
  position: relative;
}
.case-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.case .idx {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--faint);
  letter-spacing: 0.05em;
}
.case .sector {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 4px 10px;
  border: 1px solid var(--accent-wash);
  border-radius: 100px;
  background: oklch(0.93 0.045 256 / 0.4);
}
.case h3 {
  font-size: clamp(1.35rem, 2.1vw, 1.75rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.06;
  margin-top: auto;
}
.case p { color: var(--fg-soft); font-size: 1rem; }

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 0.82fr;
  gap: clamp(40px, 7vw, 110px);
  align-items: start;
}
.about-body p {
  font-size: clamp(1.1rem, 1.7vw, 1.4rem);
  line-height: 1.5;
  color: var(--fg);
  letter-spacing: -0.015em;
  margin-bottom: 1.1em;
}
.about-body p:last-child { color: var(--fg-soft); }
.about-body .lead::first-letter { /* no drop cap, keep clean */ }
.about-aside {
  border-top: 1px solid var(--line-2);
  position: sticky;
  top: 110px;
}
.about-fact {
  padding: 20px 0;
  border-bottom: 1px solid var(--line-2);
}
.about-fact .k {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}
.about-fact .v {
  font-size: 1.18rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.about-fact .v b { color: var(--accent); }

/* ---------- Contact (dark) ---------- */
.contact {
  background: var(--ink);
  color: var(--on-ink);
  padding: clamp(80px, 12vw, 170px) 0;
  position: relative;
  overflow: hidden;
}
.contact .eyebrow { color: var(--accent-glow); }
.contact .eyebrow::before { background: var(--accent-glow); }
.contact-glow {
  position: absolute;
  width: 60vw; height: 60vw;
  max-width: 760px; max-height: 760px;
  right: -12vw; top: -16vw;
  background: radial-gradient(circle, var(--accent) 0%, transparent 62%);
  opacity: 0.22;
  filter: blur(40px);
  pointer-events: none;
}
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 6vw, 90px);
  align-items: start;
  position: relative;
  z-index: 2;
}
.contact h2 {
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 1.0;
  letter-spacing: -0.035em;
  font-weight: 500;
  margin-top: 24px;
}
.contact-lead {
  color: var(--on-ink-soft);
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  margin-top: 22px;
  max-width: 40ch;
}
.contact-direct { margin-top: 38px; display: flex; flex-direction: column; gap: 14px; }
.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 1.05rem;
  color: var(--on-ink);
  width: fit-content;
}
.contact-link .ic {
  width: 40px; height: 40px;
  border: 1px solid var(--line-ink);
  border-radius: 50%;
  display: grid; place-items: center;
  transition: all .35s var(--ease);
}
.contact-link:hover .ic { background: var(--accent); border-color: var(--accent); transform: translateY(-2px); }

/* form */
.form { display: grid; gap: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field { position: relative; }
.field label {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--on-ink-faint);
  display: block;
  margin-bottom: 10px;
}
.field input, .field textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line-ink);
  color: var(--on-ink);
  font-family: var(--sans);
  font-size: 1.02rem;
  padding: 10px 0;
  transition: border-color .3s;
  resize: none;
}
.field input::placeholder, .field textarea::placeholder { color: var(--on-ink-faint); }
.field input:focus, .field textarea:focus { outline: none; border-bottom-color: var(--accent-glow); }
.form button[type="submit"] {
  justify-self: start;
  margin-top: 6px;
}
.form-note {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--on-ink-faint);
  letter-spacing: 0.02em;
}

/* ---------- Footer ---------- */
.footer {
  background: var(--ink);
  color: var(--on-ink-soft);
  padding: clamp(36px, 5vw, 56px) 0;
  border-top: 1px solid var(--line-ink);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.footer .brand { color: var(--on-ink); }
.footer .brand .role { color: var(--on-ink-faint); }
.footer-meta {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--on-ink-faint);
}
.footer a.link { color: var(--on-ink); border-bottom: 1px solid var(--line-ink); padding-bottom: 1px; transition: border-color .3s; }
.footer a.link:hover { border-bottom-color: var(--accent-glow); }

/* ---------- Reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
}
.reveal.in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: .08s; }
.reveal[data-delay="2"] { transition-delay: .16s; }
.reveal[data-delay="3"] { transition-delay: .24s; }
.reveal[data-delay="4"] { transition-delay: .32s; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
  .hero h1 .word > span { transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-lower { grid-template-columns: 1fr; gap: 36px; }
  .cases-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
  .about-aside { position: static; }
  .contact-grid { grid-template-columns: 1fr; }
  .service { grid-template-columns: 50px 1fr; gap: 8px 20px; }
  .service .desc-cell { grid-column: 1 / -1; }
}
@media (max-width: 680px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 20px var(--gutter) 28px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
  }
  .nav-toggle {
    display: grid;
    place-items: center;
    width: 38px; height: 38px;
  }
  .nav-toggle span { width: 18px; height: 1.5px; background: var(--fg); position: relative; }
  .nav-toggle span::before, .nav-toggle span::after {
    content: ""; position: absolute; left: 0; width: 18px; height: 1.5px; background: var(--fg);
  }
  .nav-toggle span::before { top: -5px; }
  .nav-toggle span::after { top: 5px; }
  .nav .btn-primary { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .hero-cta { width: 100%; }
  .hero-cta .btn { flex: 1; justify-content: center; }
}
