/* ==========================================================
   Laboratoire apprentissage et douleur / Pain and Learning Lab
   Main stylesheet
   ========================================================== */

:root {
  --abyss: #071E33;       /* deepest navy: header, hero, footer */
  --deep: #0E3553;        /* secondary dark blue */
  --line-dark: #1D4A6B;   /* borders on dark */
  --teal: #0B7C7A;        /* teal for text/links on light (AA contrast) */
  --teal-bright: #12A3A0; /* teal for rules and accents on light */
  --signal: #5FE3D2;      /* signal teal on dark */
  --heat: #F4B740;        /* stimulus marker only */
  --mist: #E8F1F3;        /* light section background */
  --paper: #FFFFFF;
  --ink: #10202E;         /* body text */
  --muted: #4A6072;       /* secondary text */
  --on-dark: #CFE3EA;     /* body text on dark */
  --rule: #CFDDE3;

  --font: "Archivo", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --wrap: 1180px;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a {
  color: var(--teal);
  text-underline-offset: .18em;
  text-decoration-thickness: 1px;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--signal);
  outline-offset: 3px;
  border-radius: 2px;
}
.section :focus-visible { outline-color: var(--teal-bright); }

.wrap {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
}

h1, h2, h3 {
  font-weight: 760;
  line-height: 1.08;
  letter-spacing: -.015em;
  margin: 0 0 .6em;
}
h1 { font-size: clamp(2.4rem, 5.4vw, 4.6rem); }
h2 { font-size: clamp(1.75rem, 3.1vw, 2.55rem); }
h3 {
  font-size: 1.2rem;
  line-height: 1.25;
  letter-spacing: -.005em;
  margin-bottom: .4em;
}

p { margin: 0 0 1em; max-width: 68ch; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--signal); color: var(--abyss);
  padding: .6rem 1rem; font-weight: 700;
}
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--abyss);
  color: #fff;
  border-bottom: 1px solid var(--line-dark);
}
.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 4.25rem;
}

.brand {
  display: flex; align-items: center; gap: .7rem;
  margin-right: auto;
  color: #fff;
  text-decoration: none;
}
.brand svg, .brand img { width: 36px; height: 36px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.12; }
.brand-small { font-size: .74rem; color: #9FC3D0; }
.brand-name { font-weight: 700; font-size: 1rem; }

.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .15rem; }
.nav a {
  position: relative; display: block;
  padding: .5rem .8rem;
  border-radius: 4px;
  color: var(--on-dark);
  font-weight: 500; font-size: .98rem;
  text-decoration: none;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav a[aria-current="page"] { color: #fff; }
.nav a[aria-current="page"]::after {
  content: ""; position: absolute;
  left: .8rem; right: .8rem; bottom: .12rem;
  height: 2px; background: var(--signal);
}

/* Language switch: both options always visible */
.lang {
  display: flex; gap: 2px; flex: none;
  padding: 3px;
  border: 1px solid #2C5878;
  border-radius: 999px;
}
.lang-opt {
  display: block; min-width: 2.7rem;
  padding: .32rem .6rem;
  border-radius: 999px;
  text-align: center;
  font-size: .86rem; font-weight: 650; letter-spacing: .03em;
  color: var(--on-dark);
  text-decoration: none;
}
a.lang-opt:hover { background: rgba(255,255,255,.1); color: #fff; }
.lang-opt.is-current { background: var(--signal); color: var(--abyss); }

.menu-btn {
  display: none;
  align-items: center; gap: .5rem;
  padding: .45rem .8rem;
  border: 1px solid #2C5878; border-radius: var(--radius);
  background: transparent; color: #fff;
  font: inherit; font-size: .92rem; font-weight: 600;
  cursor: pointer;
}
.menu-btn svg { width: 18px; height: 18px; }

@media (max-width: 880px) {
  .menu-btn { display: inline-flex; }
  .header-inner { gap: .6rem; }
  .nav {
    display: none;
    position: absolute; top: 100%; left: -1.25rem; right: -1.25rem;
    background: var(--abyss);
    border-bottom: 1px solid var(--line-dark);
  }
  .nav.is-open { display: block; }
  .nav ul { flex-direction: column; padding: .25rem 1.25rem 1rem; }
  .nav a { padding: .85rem 0; font-size: 1.1rem; border-radius: 0; border-bottom: 1px solid var(--line-dark); }
  .nav li:last-child a { border-bottom: 0; }
  .nav a:hover { background: none; }
  .nav a[aria-current="page"]::after { left: auto; right: 0; top: 50%; bottom: auto; width: 8px; height: 8px; border-radius: 50%; transform: translateY(-50%); }
}
@media (max-width: 460px) {
  .brand-small { display: none; }
  .brand-name { font-size: .92rem; }
  .menu-btn span { display: none; }
}

/* ---------- Buttons ---------- */

.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .8rem 1.3rem;
  border: 2px solid transparent; border-radius: var(--radius);
  font-weight: 650; font-size: 1rem; line-height: 1.2;
  text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--signal); color: var(--abyss); }
.btn-primary:hover { background: #8FF0E4; }
.btn-ghost { border-color: rgba(255,255,255,.4); color: #fff; }
.btn-ghost:hover { border-color: #fff; background: rgba(255,255,255,.06); }
.btn-dark { background: var(--abyss); color: #fff; }
.btn-dark:hover { background: var(--deep); }
.btn-outline { border-color: var(--abyss); color: var(--abyss); }
.btn-outline:hover { background: var(--abyss); color: #fff; }
.btn-sm { padding: .5rem .9rem; font-size: .92rem; }

/* ---------- Hero (home) ---------- */

.hero {
  position: relative; isolation: isolate; overflow: hidden;
  background: var(--abyss); color: #fff;
}
.hero canvas, .page-head canvas {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%;
}
.hero::before, .page-head::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, var(--abyss) 0%, rgba(7,30,51,.93) 36%, rgba(7,30,51,.4) 72%, rgba(7,30,51,.12) 100%);
}
.hero-inner { padding: clamp(4rem, 10vw, 8rem) 0 clamp(3.5rem, 7vw, 5.5rem); }
.hero h1 { max-width: 12ch; margin-bottom: .3em; }
.hero-alt {
  margin-bottom: 1.6rem;
  color: var(--signal);
  font-size: 1.05rem; font-weight: 600;
}
.hero-lead {
  max-width: 50ch;
  color: #D6E6EC;
  font-size: clamp(1.1rem, 1.6vw, 1.3rem);
  line-height: 1.55;
}
.hero-aff {
  margin: 3rem 0 0;
  max-width: 60ch;
  font-size: .9rem;
  color: #8FB3C2;
}
@media (max-width: 720px) {
  .hero::before, .page-head::before { background: rgba(7,30,51,.8); }
}

/* ---------- Inner page header ---------- */

.page-head {
  position: relative; isolation: isolate; overflow: hidden;
  background: var(--abyss); color: #fff;
}
.page-head canvas { opacity: .6; }
.page-head .wrap { padding: clamp(3rem, 7vw, 5rem) 0 clamp(2.5rem, 5vw, 3.5rem); }
.page-head h1 { font-size: clamp(2.3rem, 5vw, 3.9rem); }
.page-head p { margin: 0; max-width: 56ch; color: var(--on-dark); font-size: 1.15rem; }

.jump { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: 2rem 0 0; padding: 0; }
.jump a {
  display: block;
  padding: .38rem .85rem;
  border: 1px solid #2C5878; border-radius: 999px;
  color: var(--on-dark); font-size: .92rem; text-decoration: none;
}
.jump a:hover { border-color: var(--signal); color: #fff; }

/* ---------- Sections ---------- */

.section { padding: clamp(3.5rem, 8vw, 6.5rem) 0; }
.section-mist { background: var(--mist); }
.section:not(.section-mist) + .section:not(.section-mist) { padding-top: 0; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(1.5rem, 5vw, 5rem);
  align-items: start;
}
.split > :first-child h2 { margin-bottom: .4em; }
.kicker { color: var(--muted); max-width: 36ch; }
.lede { font-size: 1.2rem; line-height: 1.55; }
@media (max-width: 880px) { .split { grid-template-columns: 1fr; } }

.section-head {
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: 2.25rem;
}
.section-head h2 { margin: 0; }
.section-head .more { font-weight: 600; }

/* Research axes (home) */
.axes {
  display: grid; grid-template-columns: 1fr 1fr;
  border-top: 2px solid var(--abyss);
}
.axis { padding: 2rem 2.5rem 1rem 0; }
.axis + .axis { padding-left: 2.5rem; padding-right: 0; border-left: 1px solid var(--rule); }
.axis-num {
  display: block;
  margin-bottom: .9rem;
  color: var(--teal-bright);
  font-size: clamp(3.5rem, 7vw, 5.5rem); font-weight: 800;
  line-height: .9;
}
.axis p { color: var(--muted); }
@media (max-width: 760px) {
  .axes { grid-template-columns: 1fr; }
  .axis { padding-right: 0; }
  .axis + .axis { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
}

/* Approach diagram */
.approach-fig { margin: 1.5rem 0 0; }
.approach-svg { display: block; width: 100%; height: auto; margin-inline: auto; font-family: var(--font); }
.approach-wide { max-width: 960px; }
.approach-narrow { display: none; max-width: 420px; }
@media (max-width: 640px) {
  .approach-wide { display: none; }
  .approach-narrow { display: block; }
}
.approach-svg .card { stroke: none; }
.approach-svg .card.human { fill: var(--deep); }
.approach-svg .card.machine { fill: var(--teal); }
.approach-svg .card.goal { fill: var(--heat); }
.approach-svg .lbl { fill: #fff; font-weight: 650; text-anchor: middle; dominant-baseline: middle; }
.approach-svg .lbl-goal { fill: var(--abyss); font-weight: 700; }
.approach-svg .link { fill: none; stroke: #8FA3B1; stroke-width: 2.5; }
.approach-svg .arrowhead { fill: #8FA3B1; }
.approach-svg .icon-line { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.approach-svg .icon-fill { fill: var(--ink); }
.approach-svg .screen { fill: #fff; }
.approach-svg .net line { stroke: var(--ink); stroke-width: 1.1; }
.approach-svg .n-hid { fill: var(--ink); }
.approach-svg .n-in { fill: #fff; stroke: var(--ink); stroke-width: 1.3; }

/* Participate band */
.participate { background: var(--deep); color: #fff; padding: clamp(3.5rem, 7vw, 5.5rem) 0; }
.participate-inner {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 1rem 3rem; align-items: center;
}
.participate p { color: var(--on-dark); }
.participate .actions { margin-top: 0; }
.participate .note { font-size: .9rem; color: #9FC3D0; margin: 1rem 0 0; }
@media (max-width: 880px) { .participate-inner { grid-template-columns: 1fr; } }

/* ---------- Research page ---------- */

.axis-block + .axis-block { margin-top: clamp(3rem, 6vw, 4.5rem); padding-top: clamp(3rem, 6vw, 4.5rem); border-top: 1px solid var(--rule); }
.axis-label { display: block; color: var(--teal); font-weight: 700; font-size: 1.05rem; margin-bottom: .5rem; }

/* Figure carousel under each research axis */
.axis-block .carousel { margin-top: 1.75rem; max-width: 320px; }
.carousel-nav { display: flex; align-items: center; justify-content: center; gap: .75rem; margin-top: .6rem; }
.carousel-nav button {
  width: 2rem; height: 2rem; border-radius: 50%;
  border: 1px solid var(--rule); background: #fff; color: var(--ink);
  font: inherit; font-size: 1.15rem; line-height: 1; cursor: pointer;
}
.carousel-nav button:hover { border-color: var(--teal-bright); color: var(--teal); }
.slides { position: relative; }
.slide { margin: 0; }
.slide[hidden] { display: none; }
.slide-img {
  position: relative; aspect-ratio: 4 / 3;
  background: #fff; border: 1px solid var(--rule); border-radius: var(--radius);
}
.slide-img img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  padding: .5rem; object-fit: contain;
}
.slide figcaption { margin-top: .5rem; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.slide figcaption strong { color: var(--ink); }
.slide.is-in { animation: slide-in .5s ease; }
@keyframes slide-in { from { opacity: 0; } to { opacity: 1; } }
.dots { display: flex; justify-content: center; gap: .4rem; }
.dot { width: .5rem; height: .5rem; padding: 0; border-radius: 50%; border: 0; background: var(--rule); cursor: pointer; }
.dot[aria-current="true"] { background: var(--teal); }
@media (prefers-reduced-motion: reduce) { .slide.is-in { animation: none; } }

.pubs { list-style: none; margin: 1.75rem 0 0; padding: 0; border-top: 1px solid var(--rule); }
.pubs-title { font-size: 1rem; margin: 2rem 0 0; }
.pub {
  display: grid; grid-template-columns: 4.25rem 1fr; gap: 1rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
}
.pub-year { color: var(--teal); font-weight: 750; }
.pub-title { display: block; font-weight: 650; line-height: 1.35; margin-bottom: .25rem; }
a.pub-title { color: var(--ink); text-decoration: none; }
a.pub-title:hover { color: var(--teal); text-decoration: underline; }
.pub-meta { display: block; color: var(--muted); font-size: .94rem; }
.pub-meta i { font-style: italic; }
.badge {
  display: inline-block; margin-left: .35rem;
  padding: .08rem .6rem; border-radius: 999px;
  background: #FFF1D0; color: #6E4A00;
  font-size: .8rem; font-weight: 650; vertical-align: .1em;
}

.ticks { list-style: none; margin: 1rem 0 0; padding: 0; }
.ticks li { position: relative; padding: .55rem 0 .55rem 1.6rem; border-bottom: 1px solid var(--rule); max-width: 68ch; }
.ticks li::before {
  content: ""; position: absolute; left: 0; top: 1.2rem;
  width: .8rem; height: 2px; background: var(--teal-bright);
}

.figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; margin-top: 2rem; }
.figures figure { margin: 0; }
.figures figcaption { margin-top: .8rem; font-size: .95rem; color: var(--muted); }
.figures figcaption strong { display: block; color: var(--ink); font-size: 1.05rem; }
.credit { display: block; margin-top: .35rem; font-size: .8rem; }
@media (max-width: 820px) { .figures { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .figures { grid-template-columns: 1fr; } }

/* Image slots with placeholder fallback */
.media {
  position: relative; overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  background: var(--deep);
}
.media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.media .ph {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--signal);
  font-size: 1.5rem; font-weight: 750;
}

.funders {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
  list-style: none; margin: 2rem 0 0; padding: 0;
}
.funder {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  min-height: 112px; padding: 1.25rem;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: #fff; color: var(--ink);
  text-align: center; text-decoration: none;
  transition: border-color .15s;
}
.funder:hover { border-color: var(--teal-bright); }
.funder img { max-width: 100%; max-height: 64px; width: auto; height: auto; }
.funder-name { display: block; font-weight: 750; font-size: 1.15rem; }
.funder-full { display: block; margin-top: .2rem; font-size: .82rem; color: var(--muted); }
.funder.has-img .funder-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 720px) { .funders { grid-template-columns: 1fr 1fr; } }

/* ---------- Team page ---------- */

.pi {
  display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start;
}
.pi .media { aspect-ratio: 4 / 5; }
.pi h2 { font-size: clamp(2rem, 3.6vw, 2.8rem); margin-bottom: .5rem; }
.pi-roles { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 2rem; margin: 1.25rem 0 1.75rem; }
.pi-roles p { margin: 0; color: var(--muted); font-size: .98rem; }
.pi-roles strong { display: block; color: var(--ink); }
.timeline { list-style: none; margin: .5rem 0 1.75rem; padding: 0; border-top: 1px solid var(--rule); }
.timeline li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--rule); }
.timeline .yrs { color: var(--teal); font-weight: 700; }
.links { display: flex; flex-wrap: wrap; gap: .5rem; }
@media (max-width: 760px) {
  .pi { grid-template-columns: 1fr; }
  .pi .media { max-width: 260px; }
  .pi-roles { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 0; }
}

.people {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 2.5rem 1.75rem;
  list-style: none; margin: 2rem 0 0; padding: 0;
}
.person .media { aspect-ratio: 4 / 5; margin-bottom: 1rem; }
.person h3 { margin-bottom: .3rem; }
.person .role { margin: 0 0 .75rem; color: var(--muted); font-size: .92rem; line-height: 1.45; }
.person .topic { margin: 0; padding-left: .8rem; border-left: 2px solid var(--teal-bright); font-size: .95rem; line-height: 1.45; }

.alumni { margin-top: 1.5rem; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.alumni summary {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.1rem 0;
  cursor: pointer; list-style: none;
  font-weight: 650;
}
.alumni summary::-webkit-details-marker { display: none; }
.alumni summary::after {
  content: ""; width: .6rem; height: .6rem;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-3px);
  transition: transform .2s;
}
.alumni[open] summary::after { transform: rotate(-135deg) translateY(-3px); }
.alumni ul { list-style: none; margin: 0; padding: 0 0 1rem; }
.alumni li { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: .25rem 2rem; padding: .8rem 0; border-top: 1px solid var(--rule); }
.alumni .who { font-weight: 600; }
.alumni .what { color: var(--muted); font-size: .95rem; }
@media (max-width: 700px) { .alumni li { grid-template-columns: 1fr; } }

/* ---------- Contact page ---------- */

.paths { display: grid; grid-template-columns: 1fr 1fr; gap: 1.75rem; }
.path {
  padding: 2rem;
  border: 1px solid var(--rule); border-top: 3px solid var(--teal-bright);
  border-radius: 0 0 var(--radius) var(--radius);
  background: #fff;
}
.path h2 { font-size: clamp(1.5rem, 2.4vw, 1.9rem); }
.path .email {
  display: inline-block; margin: .25rem 0 1.25rem;
  font-size: 1.12rem; font-weight: 650;
  overflow-wrap: anywhere;
}
.path .actions { margin-top: 0; }
@media (max-width: 820px) { .paths { grid-template-columns: 1fr; } }

.places { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.place address { font-style: normal; margin-bottom: 1rem; color: var(--muted); min-height: 4.8em; }
.place iframe {
  display: block; width: 100%; aspect-ratio: 16 / 10;
  border: 0; border-radius: var(--radius);
  background: var(--mist);
}
.place .maplink { display: inline-block; margin-top: .6rem; font-size: .95rem; }
@media (max-width: 820px) { .places { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */

.site-footer { background: var(--abyss); color: var(--on-dark); font-size: .95rem; }
.footer-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 2rem; padding: 3.5rem 0 2.5rem;
}
.site-footer h2 { font-size: 1rem; color: #fff; margin-bottom: .6rem; letter-spacing: 0; }
.site-footer address { font-style: normal; }
.site-footer a { color: var(--signal); }
.site-footer p { margin: 0 0 .5rem; }
.footer-name { color: #fff; font-weight: 700; font-size: 1.05rem; line-height: 1.3; }
.footer-base {
  padding: 1.25rem 0 1.5rem;
  border-top: 1px solid var(--line-dark);
  font-size: .85rem; color: #8FB3C2;
}
@media (max-width: 880px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }

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

.axis h3 a { color: inherit; text-decoration: none; }
.axis h3 a:hover { color: var(--teal); text-decoration: underline; }

/* Real photos and logos */
.brand img { border-radius: 0; }
.person .media img, .pi .media img { object-position: center 28%; }
.media-contain { background: #fff; border: 1px solid var(--rule); }
.media-contain img { object-fit: contain; padding: 6%; }
.footer-logos { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem 1.75rem; margin-top: 1.5rem; }
.footer-logos img { width: auto; }
.footer-logos a { display: block; opacity: .95; }
.footer-logos a:hover { opacity: 1; }
