/* ============================================================
   Mathieu Cocheteux — modernized site
   Design system: light & airy, single blue accent, restrained.
   ============================================================ */

:root {
  /* Surfaces */
  --bg:        #ffffff;
  --bg-soft:   #f5f7fb;
  --bg-tint:   #eaf1fc;
  --ink-viewport: #070c18;

  /* Ink / text */
  --ink:   #0a0f1c;
  --ink-2: #36404f;
  --muted: #6b7686;
  --line:  #e6eaf1;
  --line-strong: #d4dae4;

  /* Accents (tweakable) */
  --blue:   #1a73e8;
  --blue-600:#1763d6;
  --teal:   #00b3a4;
  --teal-bright: #19cbbb;

  /* Type */
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Geometry */
  --r-sm: 10px;
  --r:    16px;
  --r-lg: 24px;
  --r-xl: 32px;
  --maxw: 1200px;
  --pad:  clamp(20px, 5vw, 64px);

  --shadow-sm: 0 1px 2px rgba(10,15,28,.05), 0 2px 8px rgba(10,15,28,.04);
  --shadow:    0 4px 12px rgba(10,15,28,.06), 0 12px 32px rgba(10,15,28,.07);
  --shadow-lg: 0 10px 30px rgba(10,15,28,.08), 0 30px 80px rgba(20,40,90,.12);

  --ease: cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: color-mix(in oklab, var(--blue) 22%, transparent); }

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

h1,h2,h3,h4,.sans { font-family: var(--sans); }
h1,h2,h3 { font-weight: 700; letter-spacing: -.02em; line-height: 1.04; margin: 0; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--pad); }

.mono {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* ---- Eyebrow / section index ---- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: .68rem; letter-spacing: .2em;
  text-transform: uppercase; color: var(--blue); font-weight: 500;
}
.eyebrow::before {
  content: ""; width: 22px; height: 1px; background: var(--blue);
  display: inline-block;
}

/* =================== NAV =================== */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  height: 68px; display: flex; align-items: center;
  transition: background .4s var(--ease), box-shadow .4s var(--ease), border-color .4s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.brand { display: flex; align-items: center; gap: 11px; font-family: var(--sans); font-weight: 700; letter-spacing: -.01em; font-size: 1.02rem; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--ink);
  font-family: var(--sans); font-weight: 700; font-size: .72rem; letter-spacing: .01em;
  color: #fff;
}
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  font-family: var(--sans); font-size: .92rem; font-weight: 500; color: var(--ink-2);
  padding: 9px 14px; border-radius: 999px; transition: color .2s, background .2s;
}
.nav-links a:hover { color: var(--blue); background: var(--bg-soft); }
.nav-cta, .nav-links a.nav-cta {
  font-family: var(--sans); font-weight: 600; font-size: .9rem;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
}
.nav-links a.nav-cta:hover { background: var(--blue); color: #fff; }
@media (max-width: 720px){ .nav-links a:not(.nav-cta){ display:none; } }

/* =================== BUTTONS =================== */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--sans); font-weight: 600; font-size: .98rem;
  padding: 14px 24px; border-radius: 999px; cursor: pointer; border: 1px solid transparent;
  transition: transform .18s var(--ease), background .2s, box-shadow .25s, color .2s, border-color .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 8px 22px color-mix(in oklab, var(--blue) 32%, transparent); }
.btn-primary:hover { background: var(--blue-600); box-shadow: 0 12px 30px color-mix(in oklab, var(--blue) 40%, transparent); }
.btn-ghost { background: var(--bg); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); background: var(--bg-soft); }
.btn .arrow { transition: transform .25s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

/* =================== HERO =================== */
.hero { position: relative; padding-top: 168px; padding-bottom: 120px; overflow: hidden; }
.hero-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 55% at 50% 4%, color-mix(in oklab, var(--blue) 7%, transparent), transparent 60%);
}
.hero-bg::after {
  content:""; position:absolute; inset:0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(75% 70% at 50% 30%, #000 30%, transparent 78%);
          mask-image: radial-gradient(75% 70% at 50% 30%, #000 30%, transparent 78%);
  opacity: .5;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}
.hero-text {
  max-width: 760px; margin: 0 auto; text-align: center;
  display: flex; flex-direction: column; align-items: center;
}

.hero-badge {
  display: inline-flex; align-items: center; gap: 11px; margin-bottom: 26px;
  padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg); box-shadow: var(--shadow-sm); font-family: var(--sans); font-size: .9rem; color: var(--ink-2);
}
.hero-badge b { color: var(--ink); font-weight: 600; }
.hero-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 4px color-mix(in oklab, var(--blue) 18%, transparent); flex: none; }

.hero h1 {
  font-size: clamp(2.7rem, 6.4vw, 5.1rem);
  margin-bottom: 8px;
}
.hero h1 .accent {
  color: var(--blue);
}
.hero .role {
  font-family: var(--sans); font-weight: 500; font-size: clamp(1.1rem,2vw,1.5rem);
  color: var(--ink-2); margin: 4px 0 22px;
}
.hero .lede { font-size: 1.18rem; color: var(--ink-2); max-width: 52ch; margin: 0 0 32px; }
.hero .lede b { color: var(--ink); font-weight: 500; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

.social-row { display: flex; gap: 8px; margin-top: 30px; justify-content: center; }
.social-row a {
  width: 42px; height: 42px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 12px; color: var(--ink-2);
  background: var(--bg); transition: transform .18s var(--ease), color .2s, border-color .2s, box-shadow .25s;
}
.social-row a:hover { color: var(--blue); border-color: color-mix(in oklab, var(--blue) 45%, var(--line)); transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.social-row svg { width: 19px; height: 19px; }

/* ---- Perception viewport (hero canvas card) ---- */
.viewport {
  position: relative; aspect-ratio: 1 / 1; max-width: 100%;
  border-radius: var(--r-xl); background: var(--ink-viewport); overflow: hidden;
  box-shadow: var(--shadow-lg); border: 1px solid rgba(255,255,255,.06);
}
@media (max-width: 1100px) {
  .viewport { aspect-ratio: 16 / 10; max-height: 420px; }
}
.viewport canvas { position: absolute; inset: 0; width: 100%; height: 100%; display:block; }
.viewport .vp-hud {
  position: absolute; inset: 0; pointer-events: none; padding: 18px;
  display: flex; flex-direction: column; justify-content: space-between;
  font-family: var(--mono); color: rgba(220,235,255,.82); font-size: .62rem; letter-spacing: .1em;
}
.vp-hud .row { display: flex; justify-content: space-between; align-items: flex-start; }
.vp-hud .tag {
  background: rgba(8,14,28,.5); border: 1px solid rgba(120,170,255,.22);
  padding: 5px 9px; border-radius: 7px; backdrop-filter: blur(4px); text-transform: uppercase;
}
.vp-hud .tag .live { color: var(--teal-bright); }
.vp-hud .scan-label { color: rgba(150,200,255,.7); }
.viewport .vp-frame {
  position:absolute; inset:0; border-radius: var(--r-xl); pointer-events:none;
  box-shadow: inset 0 0 0 1px rgba(120,170,255,.12), inset 0 0 120px rgba(0,0,0,.5);
}
.viewport .corner { position:absolute; width: 18px; height: 18px; border: 1.5px solid rgba(140,190,255,.5); }
.corner.tl { top:14px; left:14px; border-right:0; border-bottom:0; }
.corner.tr { top:14px; right:14px; border-left:0; border-bottom:0; }
.corner.bl { bottom:14px; left:14px; border-right:0; border-top:0; }
.corner.br { bottom:14px; right:14px; border-left:0; border-top:0; }

/* =================== SECTION SHELL =================== */
section { position: relative; }
.section-pad { padding: clamp(80px, 11vw, 150px) 0; }
.section-head { max-width: 760px; margin-bottom: clamp(40px, 6vw, 64px); }
.section-head h2 { font-size: clamp(2rem, 4.4vw, 3.3rem); margin: 18px 0 0; }
.section-head .sub { color: var(--ink-2); font-size: 1.18rem; margin-top: 18px; }

.bg-soft { background: var(--bg-soft); }
.divider { height: 1px; background: var(--line); }

/* =================== ABOUT =================== */
.about-grid { display: grid; grid-template-columns: 1.5fr 320px; gap: clamp(36px, 6vw, 80px); align-items: start; }
@media (max-width: 880px){ .about-grid { grid-template-columns: 1fr; } }
.about-copy p { font-size: 1.22rem; line-height: 1.7; color: var(--ink-2); margin: 0 0 1.1em; }
.about-copy strong { color: var(--ink); font-weight: 600; }
.about-copy .cv-link { font-family: var(--sans); font-weight: 600; font-size: 1rem; color: var(--blue); display: inline-flex; gap: 8px; align-items: center; }
.about-copy .cv-link:hover { gap: 12px; }

.about-aside { position: sticky; top: 96px; }
@media (max-width: 880px){ .about-aside { position: static; max-width: 320px; } }
.portrait {
  position: relative; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow);
  border: 1px solid var(--line); aspect-ratio: 4/5; background: var(--bg-tint);
  width: 100%;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait .scanline {
  position:absolute; inset:0; pointer-events:none; mix-blend-mode: screen;
  background: linear-gradient(transparent 0%, color-mix(in oklab, var(--teal) 25%, transparent) 50%, transparent 100%);
  opacity:.0;
}

.stats { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; margin-top: 16px; }
.stat {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 18px 16px; background: var(--bg);
  transition: transform .2s var(--ease), box-shadow .25s, border-color .2s;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); border-color: var(--line-strong); }
.stat .num { font-family: var(--sans); font-weight: 700; font-size: 2.5rem; line-height: 1; letter-spacing: -.03em; color: var(--ink); }
.stat .lbl { font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 10px; display: flex; align-items: center; gap: 6px; }
.stat-note { font-family: var(--mono); font-size: .6rem; letter-spacing: .1em; text-transform: uppercase; color: var(--blue); padding: 2px 5px; border: 1px solid color-mix(in oklab, var(--blue) 30%, transparent); border-radius: 4px; }

/* =================== RESEARCH =================== */
.papers { display: grid; gap: 20px; }
.paper {
  display: grid; grid-template-columns: 220px 1fr auto; gap: 28px; align-items: center;
  padding: 22px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg);
  transition: transform .25s var(--ease), box-shadow .3s, border-color .25s;
  position: relative; overflow: hidden;
}
.paper::before {
  content:""; position:absolute; left:0; top:0; bottom:0; width: 3px;
  background: var(--blue); transform: scaleY(0); transform-origin: top; transition: transform .35s var(--ease);
}
.paper:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.paper:hover::before { transform: scaleY(1); }
.paper-thumb {
  aspect-ratio: 16/10; border-radius: var(--r); overflow: hidden; background: var(--ink-viewport);
  position: relative; border: 1px solid var(--line);
}
.paper-thumb img { width:100%; height:100%; object-fit: cover; transition: transform .5s var(--ease); }
.paper:hover .paper-thumb img { transform: scale(1.06); }
.paper-thumb .ph-grid { position:absolute; inset:0; opacity:.0; }
.paper-venue { display:inline-flex; gap:8px; align-items:center; font-family: var(--mono); font-size:.64rem; letter-spacing:.14em; text-transform:uppercase; color: var(--blue); margin-bottom: 10px; }
.paper-venue .badge { background: var(--bg-tint); color: var(--ink-2); padding: 4px 9px; border-radius: 6px; font-weight: 600; }
.paper-venue .badge.oral { background: color-mix(in oklab, var(--blue) 12%, white); color: var(--blue); }
.paper-venue .badge.patent { background: var(--bg-tint); color: var(--ink-2); }
.paper h3 { font-size: 1.36rem; line-height: 1.18; letter-spacing: -.015em; margin-bottom: 8px; }
.paper p { font-size: 1.02rem; color: var(--ink-2); margin: 0; max-width: 60ch; }
.paper .go {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none;
  border: 1px solid var(--line-strong); color: var(--ink-2); transition: all .25s var(--ease);
}
.paper:hover .go { background: var(--blue); color: #fff; border-color: var(--blue); transform: rotate(-45deg); }
@media (max-width: 860px){
  .paper { grid-template-columns: 1fr; gap: 18px; }
  .paper-thumb { aspect-ratio: 16/8; }
  .paper .go { display:none; }
}

/* =================== NEWS =================== */
.news-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.news-item {
  display: grid; grid-template-columns: 160px 1fr auto; gap: 28px; align-items: baseline;
  padding: 28px 8px; border-bottom: 1px solid var(--line); position: relative;
  transition: background .25s, padding-left .25s var(--ease);
}
.news-item:hover { background: var(--bg); padding-left: 18px; }
.news-item.featured {
  background: color-mix(in oklab, var(--blue) 5%, white);
  border: 1px solid color-mix(in oklab, var(--blue) 18%, transparent);
  border-left: 3px solid var(--blue);
  padding: 24px 18px;
  margin-bottom: 2px;
}
.news-item.featured:hover { background: color-mix(in oklab, var(--blue) 8%, white); }
.news-marker { display: inline-block; font-size: 1.4rem; margin-right: 6px; color: var(--blue); }
.news-item .date { font-family: var(--mono); font-size: .74rem; letter-spacing: .08em; color: var(--blue); font-weight: 500; white-space: nowrap; padding-top: 4px; }
.news-item h3 { font-family: var(--sans); font-size: 1.24rem; font-weight: 600; letter-spacing: -.01em; margin: 0 0 6px; }
.news-item p { font-size: 1.04rem; color: var(--ink-2); margin: 0; max-width: 62ch; }
.news-item .news-link { font-family: var(--sans); font-weight:600; font-size:.92rem; color: var(--blue); white-space: nowrap; display:inline-flex; gap:6px; }
.news-item .news-link:hover { gap: 10px; }
.news-item.is-hidden { display: none; }
.paper.is-hidden { display: none; }
@media (max-width: 760px){
  .news-item { grid-template-columns: 1fr; gap: 6px; }
  .news-item .news-link { margin-top: 6px; }
  .news-item.featured { padding: 20px 14px; }
}
.news-toggle {
  margin-top: 34px; font-family: var(--sans); font-weight: 600; font-size: .96rem; color: var(--ink);
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer; background: none; border: 0; padding: 0;
}
.news-toggle .chev { transition: transform .3s var(--ease); }
.news-toggle.open .chev { transform: rotate(180deg); }

.papers-toggle {
  margin-top: 34px; font-family: var(--sans); font-weight: 600; font-size: .96rem; color: var(--ink);
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer; background: none; border: 0; padding: 0;
}
.papers-toggle .chev { transition: transform .3s var(--ease); }
.papers-toggle.open .chev { transform: rotate(180deg); }

/* =================== CTA STRIP =================== */
.contact {
  position: relative; overflow: hidden; border-radius: var(--r-xl);
  background: var(--ink-viewport); color: #fff; padding: clamp(44px, 7vw, 88px);
  text-align: center;
}
.contact::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(25,203,187,.06), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(26,115,232,.06), transparent 40%);
  animation: subtle-shift 8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes subtle-shift {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}
@media (prefers-reduced-motion: reduce) { .contact::before { animation: none; opacity: 0.4; } }
.contact .inner { position: relative; z-index: 1; }
.contact h2 { font-size: clamp(2rem, 5vw, 3.4rem); margin-bottom: 18px; }
.contact h2 .accent { background: linear-gradient(100deg, var(--teal-bright), var(--blue)); -webkit-background-clip:text; background-clip:text; color: transparent; }
.contact p { color: rgba(220,232,248,.75); font-size: 1.2rem; max-width: 46ch; margin: 0 auto 32px; }
.contact .btn-primary { background: #fff; color: var(--ink); }
.contact .btn-primary:hover { background: var(--teal-bright); color: var(--ink); }

/* =================== CREDENTIALS TIMELINE =================== */
.credentials-timeline {
  display: flex; flex-direction: column; gap: 16px; padding-top: 24px; border-top: 1px solid var(--line);
}
.cred-item {
  display: grid; grid-template-columns: 80px 1fr; gap: 18px; align-items: flex-start;
}
.cred-date {
  font-family: var(--mono); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--blue); font-weight: 600;
}
.cred-title {
  font-family: var(--sans); font-weight: 600; font-size: 1.02rem; color: var(--ink);
}
.cred-subtitle {
  font-size: .95rem; color: var(--ink-2); margin-top: 3px;
}


/* =================== RESEARCH IMPACT VIZ =================== */
.research-impact-viz { margin-top: 28px; }
.viz-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.viz-label { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.viz-value { font-family: var(--sans); font-size: 1.9rem; font-weight: 700; color: var(--ink); letter-spacing: -.02em; line-height: 1; display: inline-flex; align-items: baseline; gap: 5px; }
.viz-trend { font-size: .95rem; color: var(--teal); font-weight: 600; }
.viz-chart { width: 100%; height: 78px; display: block; }
.viz-years { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 6px; font-family: var(--mono); font-size: .68rem; letter-spacing: .04em; color: var(--muted); text-align: center; }
.viz-patent { display: flex; align-items: center; gap: 12px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.viz-patent-icon { font-size: 1.3rem; color: var(--blue); line-height: 1; }
.viz-patent-title { font-family: var(--sans); font-weight: 600; font-size: .98rem; color: var(--ink); }
.viz-patent-sub { font-size: .82rem; color: var(--ink-2); margin-top: 2px; }

.footer { padding: 56px 0 40px; }
.footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.footer .brand { font-size: .98rem; }
.footer .f-links { display: flex; gap: 22px; font-family: var(--sans); font-size: .9rem; color: var(--muted); }
.footer .f-links a:hover { color: var(--blue); }
.footer .copy { font-family: var(--mono); font-size: .66rem; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; width: 100%; padding-top: 22px; margin-top: 4px; border-top: 1px solid var(--line); }

/* =================== REVEAL ANIMATIONS =================== */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease), transform .8s var(--ease); will-change: opacity, transform; }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-d="1"]{ transition-delay: .08s; }
.reveal[data-d="2"]{ transition-delay: .16s; }
.reveal[data-d="3"]{ transition-delay: .24s; }
.reveal[data-d="4"]{ transition-delay: .32s; }
@media (prefers-reduced-motion: reduce){
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* Tweaks panel mount */
#tweaks-root { position: fixed; z-index: 2000; }
