/* ---------------------------------------------------------------
   Fonts — self-hosted woff2, no external calls.
   VG5000: headings, links, numbers and symbols. Jost: body text.
   --------------------------------------------------------------- */
@font-face {
  font-family: 'VG5000';
  src: url('../fonts/VG5000-Regular_web.woff2') format('woff2'),
       url('../fonts/VG5000-Regular_web.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Jost';
  src: url('../fonts/Jost-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* --- Tokens --- */
:root {
  --color-bg: #ffffff;
  --color-ink: #284A74;
  --color-ink-soft: #3f5a7f; /* RGAA: 4.5:1 even over the background shapes */
  --color-accent: #284A74;
  --color-border: #e3e1dc;
  --color-surface: #ffffff;
  --color-highlight: rgba(40, 74, 116, 0.18);
  --color-shadow: rgba(40, 74, 116, 0.12);
  --color-shadow-strong: rgba(40, 74, 116, 0.18);

  --field-design-bg: #ffedd5;
  --field-design-text: #9a3412;
  --field-workshops-bg: #dcfce7;
  --field-workshops-text: #166534;
  --field-training-bg: #ede9fe;
  --field-training-text: #5b21b6;
  --field-research-bg: #fef3c7;
  --field-research-text: #92400e;

  --font-display: 'VG5000', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-text: 'Jost', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;

  --radius: 4px;
  --max-width: 1400px;
  --text-width: 75ch;
}

/* Dark theme: white and the main blue are swapped */
:root[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #284A74;
  --color-ink: #ffffff;
  --color-ink-soft: #e3eaf4; /* RGAA: 4.5:1 even over the background shapes */
  --color-accent: #ffffff;
  --color-border: #4d6c94;
  --color-surface: #284A74;
  --color-highlight: rgba(255, 255, 255, 0.22);
  --color-shadow: rgba(0, 0, 0, 0.25);
  --color-shadow-strong: rgba(0, 0, 0, 0.35);
}

/* --- Base --- */
* {
  box-sizing: border-box;
}

html {
  scrollbar-width: thin;
  scrollbar-color: var(--color-ink) var(--color-bg);
}

html, body {
  height: 100%;
  overflow-anchor: none;
}

body {
  margin: 0;
  font-family: var(--font-text);
  background: var(--color-bg);
  color: var(--color-ink);
  -webkit-font-smoothing: antialiased;
  font-size: 1.15rem;
  line-height: 1.7;
}

h1, h2, h3,
.header__logo,
.header__nav a,
.gallery__title,
a {
  font-family: var(--font-display);
}

h1 {
  font-size: clamp(2.75rem, 6vw, 5rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.05;
  max-width: 18ch;
  margin: 0 0 1rem;
}

h2 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 400;
  margin: 0 0 0.75rem;
}

p {
  margin: 0 0 1rem;
  max-width: var(--text-width);
}

a {
  color: var(--color-accent);
}

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

/* Highlighted links inside running text */
main p a,
.text-section li a {
  position: relative;
  text-decoration: none;
  background-image: linear-gradient(var(--color-highlight), var(--color-highlight));
  background-repeat: no-repeat;
  background-position: 0 0.2em;
  background-size: 100% 0.75em;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background-color: var(--color-ink);
  border-radius: 999px;
  border: 2px solid var(--color-bg);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-surface);
  padding: 0.5rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

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

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* --- Page frame ---
   .site crops the decorative pods at the page edges (overflow: clip),
   so they never widen or lengthen the page. */
.site {
  position: relative;
  overflow: clip;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.site > main {
  flex: 1 0 auto;
  width: 100%;
}

.site > footer {
  width: 100%;
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.8rem 1.5rem 8rem;
  animation: fade-in 0.5s ease-out both;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  main {
    padding-top: 5rem;
    padding-bottom: 5rem;
  }
}

/* Random decorative pods, see assets/js/deco.js */
.deco-pod {
  position: absolute;
  z-index: -1;
  aspect-ratio: 97 / 186;
  pointer-events: none;
  background-color: var(--color-accent);
  -webkit-mask: url("../images/icone-corossol.svg") center / contain no-repeat;
  mask: url("../images/icone-corossol.svg") center / contain no-repeat;
}

/* --- Header --- */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-bg);
  box-shadow: 0 2px 4px var(--color-shadow);
}

.header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: padding 0.25s ease;
}

.header--compact .header__inner {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.header__logo {
  display: inline-block;
  transition: width 0.25s ease;
}

.header__logo img {
  width: 130px;
  height: auto;
  display: block;
}

.header--compact .header__logo img {
  width: 90px;
}

:root[data-theme="dark"] .header__logo img {
  filter: brightness(0) invert(1);
}

.header__tools {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 3rem;
  order: 3;
}

.header__toggle {
  display: none;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  font-family: var(--font-display);
  color: var(--color-ink);
}

.header__nav {
  margin-left: auto;
}

.header__nav ul {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.header__nav a {
  position: relative;
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.1rem 0.3rem;
  background-image: linear-gradient(var(--color-highlight), var(--color-highlight));
  background-repeat: no-repeat;
  background-position: 0 0.2em;
  background-size: 0% 0.75em;
  transition: background-size 0.25s ease;
}

.header__nav-lang {
  display: none;
}

.header__nav a:hover,
.header__nav a:focus-visible,
.header__nav a[aria-current="page"] {
  background-size: 100% 0.75em;
}

/* Link to the same page in the other language (FR / EN) */
/* Same line box as the menu links (inherited size and line height, text at 0.95rem)
   so that "EN" sits on their baseline whatever the font metrics */
.lang-toggle {
  display: block;
  min-width: 44px;
  padding: calc((44px - 1lh) / 2) 0.5rem;
  border-radius: var(--radius);
  font-family: inherit;
  text-align: center;
  letter-spacing: 0.04em;
  color: var(--color-ink);
  text-decoration: none;
  background-image: none;
}

.lang-toggle span {
  font-family: var(--font-display);
  font-size: 0.95rem;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--color-ink);
  cursor: pointer;
}

.theme-toggle svg {
  width: 22px;
  height: 22px;
}

.theme-toggle__sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle__moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle__sun {
  display: block;
}

/* Mobile: burger turning into a cross, menu panel overlaid under the header */
@media (max-width: 640px) {
  .header--compact .header__inner {
    padding: 1.5rem 1.5rem 1rem;
  }

  .header--compact .header__logo img {
    width: 130px;
  }

  .header__tools {
    margin-left: auto;
  }

  .header__tools .lang-toggle {
    display: none;
  }

  .header__nav-lang {
    display: block;
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    width: 44px;
    text-align: center;
  }

  .header__nav .header__nav-lang a {
    background-image: none;
  }

  .header__toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
  }

  .header__toggle span {
    display: block;
    width: 24px;
    height: 2px;
    margin: 0 auto;
    background: currentColor;
    border-radius: 1px;
    transition: transform 0.25s ease, opacity 0.2s ease;
  }

  .header__toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .header__toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }

  .header__toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .header__nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: auto;
    padding: 0.5rem 1.5rem 1.25rem;
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 5px 4px var(--color-shadow);
  }

  .header__nav.is-open {
    display: block;
  }

  .header__nav ul {
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 0.5rem;
  }

  .header__nav a {
    font-size: 1.1rem;
  }
}

/* --- Text pages --- */
.intro-section {
  padding: 2rem 0 1rem;
}

.text-section {
  padding: 2rem 0;
}

.text-section img,
.project-page__content img {
  display: block;
  max-width: 100%;
  max-height: 500px;
  object-fit: contain;
  margin: 1.5rem auto;
  border-radius: var(--radius);
}

/* Home: the title fills the first screen, the rest of the text follows on scroll */
.text-section--home {
  position: relative;
}

.text-section--home h1 {
  height: calc(100vh - 110px);
  display: flex;
  align-items: flex-end;
  padding-bottom: 15vh;
  margin-bottom: 0;
  position: relative;
}

.scroll-hint {
  position: absolute;
  top: calc(85vh - 110px + 1rem);
  left: 0;
  font-size: 1.5rem;
  color: var(--color-ink-soft);
  text-decoration: none;
  animation: scroll-hint-bounce 1.6s ease-in-out 3;
}

/* Home blocks after the first one alternate left and right (zigzag) */
.home-block + .home-block {
  max-width: var(--text-width);
  margin-top: 4rem;
}

.home-block:nth-child(even) {
  margin-left: auto;
}

@keyframes scroll-hint-bounce {
  0%, 100% {
    transform: translateY(0);
    opacity: 0.6;
  }
  50% {
    transform: translateY(8px);
    opacity: 1;
  }
}

@media (max-width: 640px) {
  .text-section--home h1 {
    height: calc(100svh - 11rem);
    padding-bottom: 5.5rem;
  }

  .scroll-hint {
    top: calc(100svh - 14.5rem);
  }
}

/* Approach page: the photo fits in the screen; on desktop it sits beside the first
   paragraph, on mobile right after the title. */
.approach__photo {
  margin: 0 0 2rem;
}

.approach .approach__photo img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100vh - 14rem);
  margin: 0 auto;
}

.approach__photo-placeholder {
  aspect-ratio: 4 / 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  color: var(--color-ink-soft);
  font-size: 0.85rem;
}

@media (max-width: 899px) {
  .approach {
    display: flex;
    flex-direction: column;
  }

  .approach__text {
    display: contents;
  }

  .approach__text > * {
    order: 2;
  }

  .approach__text > h1 {
    order: 0;
  }

  .approach__photo {
    order: 1;
  }
}

@media (min-width: 900px) {
  .approach {
    display: grid;
    grid-template-columns: minmax(0, var(--text-width)) minmax(0, 1fr);
    gap: 0 3rem;
    align-items: start;
  }

  .approach__text {
    display: contents;
  }

  .approach__text > * {
    grid-column: 1;
  }

  .approach__photo {
    grid-column: 2;
    grid-row: 2 / span 12;
    align-self: start;
    margin: 0;
  }
}

/* Publications */
.publications {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--color-border);
}

.publications__item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: baseline;
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
}

.text-section .publications__item a {
  background-image: none;
  text-decoration: underline;
}

.text-section .publications__item a:hover,
.text-section .publications__item a:focus-visible {
  text-decoration: none;
}

.publications__date {
  font-family: var(--font-display);
  color: var(--color-ink-soft);
  font-size: 0.9rem;
  min-width: 8ch;
}

.publications__type {
  font-size: 0.8rem;
  color: var(--color-ink-soft);
}

/* Contact */
.social-links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
}

/* --- Network page --- */
.board-section,
.partners-section {
  padding: 2rem 0;
  border-top: 1px solid var(--color-border);
}

.board-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
}

.board-list__item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: var(--color-surface);
}

.board-list__name {
  font-family: var(--font-display);
  margin: 0 0 0.25rem;
}

.board-list__description {
  font-size: 0.9rem;
  color: var(--color-ink-soft);
  margin: 0;
}

.partners-section h3 {
  margin: 2.5rem 0 0;
  font-size: 1.4rem;
  font-weight: 400;
}

.partners-grid {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
}

.partners-grid__item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  display: flex;
  transition: border-color 0.15s;
}

.partners-grid__item:hover {
  border-color: var(--color-ink-soft);
}

.partners-grid__card {
  display: flex;
  flex-direction: column;
  flex: 1;
  font-family: var(--font-text);
  padding: 1.25rem;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius);
}

a.partners-grid__card:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.partners-grid__logo-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 64px;
  max-width: 100%;
  margin: 0 auto 1rem;
}

/* Partner logos are drawn for light backgrounds: in dark mode, the whole top of the card is white */
:root[data-theme="dark"] .partners-grid__logo-box {
  width: auto;
  max-width: none;
  height: calc(64px + 2rem);
  margin: -1.25rem -1.25rem 1.25rem;
  padding: 1rem;
  background: #ffffff;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}

:root[data-theme="dark"] .partners-grid__logo {
  max-width: 140px;
}

.partners-grid__logo-box picture {
  display: contents;
}

.partners-grid__logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

/* Shown instead of the logo when there is none */
.partners-grid__name {
  margin: 0;
  text-align: center;
  font-family: var(--font-text);
  font-weight: 500;
  font-size: 1.1rem;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.partners-grid__description {
  font-size: 0.9rem;
  color: var(--color-ink-soft);
  margin: 0;
}

/* --- Activity fields --- */
.field-badge {
  display: inline-block;
  border-radius: 3px;
  padding: 0.1rem 0.5rem;
  font-family: var(--font-text);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.4;
}

.field-badge--design { background: var(--field-design-bg); color: var(--field-design-text); }
.field-badge--ateliers { background: var(--field-workshops-bg); color: var(--field-workshops-text); }
.field-badge--formation { background: var(--field-training-bg); color: var(--field-training-text); }
.field-badge--etude { background: var(--field-research-bg); color: var(--field-research-text); }

/* --- Activities: filters and project cards --- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.filters__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.9rem;
  padding: 0 0.9rem;
  line-height: 1;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-ink);
  cursor: pointer;
  position: relative;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.filters__button:hover {
  border-color: var(--color-ink);
}

.filters__button.is-active {
  background: var(--color-ink);
  color: var(--color-bg);
  border-color: var(--color-ink);
}

.gallery__count {
  font-size: 0.875rem;
  color: var(--color-ink-soft);
  margin: 0 0 1rem;
}

.gallery {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  align-items: stretch;
  gap: 1.5rem;
}

.gallery__item[hidden] {
  display: none;
}

.gallery__item a {
  display: block;
  height: 100%;
  padding: 0.7rem 0.7rem 1rem;
  color: var(--color-ink);
  text-decoration: none;
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--color-ink) 14%, transparent);
  border-radius: var(--radius);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

:root[data-theme="dark"] .gallery__item a {
  background: color-mix(in srgb, var(--color-ink) 6%, transparent);
}

.gallery__item a:hover,
.gallery__item a:focus-visible {
  transform: translateY(-3px);
  border-color: var(--color-accent);
  box-shadow: 0 6px 8px -4px color-mix(in srgb, var(--color-accent) 45%, transparent);
}

.gallery__item picture {
  position: relative;
  display: block;
  overflow: hidden;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  isolation: isolate;
}

/* Drawn above the image: the scaled, filtered image would otherwise hide the top edge */
.gallery__item picture::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border: 1px solid var(--color-accent);
  border-radius: inherit;
  pointer-events: none;
}

/* While a thumbnail loads, its frame is tinted rather than white */
.gallery__item picture {
  aspect-ratio: 3 / 2;
  background: color-mix(in srgb, #284A74 18%, #fff);
}

/* Duotone at rest, original colors on hover */
.gallery__item img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  filter: grayscale(1) sepia(0.4) hue-rotate(180deg) saturate(3);
  transform: scale(1.06);
  transition: filter 0.8s ease, transform 0.8s ease;
}

.gallery__item a:hover img,
.gallery__item a:focus-visible img {
  filter: none;
  transform: scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .gallery__item a:hover,
  .gallery__item a:focus-visible {
    transform: none;
  }
}

.gallery__title {
  display: block;
  font-size: 1.05rem;
}

.gallery__fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.gallery__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  margin: 0.7rem 0 0;
  font-family: var(--font-text);
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--color-ink-soft);
}

.gallery__empty {
  color: var(--color-ink-soft);
}

/* --- Project page --- */
.project-page__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.project-page__back {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  margin: 0;
}

.project-page__layout {
  position: relative;
  margin-bottom: 2rem;
}

.project-page__image img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
  border-radius: var(--radius);
}

.project-page__image:not(.frame) img {
  border: 1px solid var(--color-accent);
}

.project-page__summary h1 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  max-width: none;
}

.project-page__fields {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
}

.project-page__meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1.1rem;
  margin: 1.1rem 0 1.6rem;
  font-family: var(--font-text);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--color-ink-soft);
}

/* Links in the credits keep the text font, underlined (no highlight) */
.project-page__meta a {
  font-family: inherit;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  background-image: none;
}

.project-page__meta a:hover,
.project-page__meta a:focus-visible {
  text-decoration: none;
}

.project-page__meta-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding-top: 0.2em;
}

.project-page__intro {
  margin-top: 1rem;
}

.project-page__intro p {
  margin: 0;
  max-width: none;
}

.project-page__intro p + p {
  margin-top: 0.75rem;
}

.project-page__detail-link {
  margin: 1.25rem 0 0;
  max-width: none;
}

.project-page__detail-link a {
  font-family: var(--font-display);
  color: var(--color-ink);
  text-decoration: none;
  background-image: linear-gradient(var(--color-highlight), var(--color-highlight));
  background-repeat: no-repeat;
  background-position: 0 0.2em;
  background-size: 100% 0.75em;
}

/* Previous / next buttons: in the top bar on the detail page (.project-page__nav),
   around the top block on the project page (.project-page__arrows). */
.project-page__nav,
.project-page__arrows {
  display: flex;
  gap: 0.5rem;
}

.project-page__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-ink);
  text-decoration: none;
  background-color: var(--color-surface);
  background-image: none;
  transition: border-color 0.15s;
}

a.project-page__arrow:hover,
a.project-page__arrow:focus-visible {
  border-color: var(--color-ink);
  background-image: none;
}

.project-page__arrow--disabled {
  opacity: 0.35;
}

.project-page__arrows .project-page__arrow {
  position: absolute;
  z-index: 5;
  width: 36px;
  height: 36px;
  top: calc(-36px - 1.5rem);
  background-color: var(--color-bg);
}

.project-page__arrows > :first-child {
  right: calc(36px + 0.5rem);
}

.project-page__arrows > :last-child {
  right: 0;
}

@media (max-width: 779px) {
  .project-page__bar {
    min-height: 36px;
  }

  .project-page__image {
    margin-bottom: 1.75rem;
  }

  .project-page__image img {
    max-height: 34svh;
  }

  .project-page__summary h1 {
    margin-top: 0;
  }
}

/* Desktop: image and text side by side, the detail link at the bottom edge of the image */
@media (min-width: 780px) {
  .project-page__layout {
    display: flex;
    align-items: stretch;
  }

  .project-page__image {
    flex: 0 0 45%;
    margin: 0 2.5rem 0 0;
  }

  .project-page__image img {
    max-height: 60svh;
  }

  .project-page__summary {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }

  .project-page__detail-link {
    margin-top: auto;
    padding-top: 1.25rem;
  }

  .project-page__arrows .project-page__arrow {
    width: 40px;
    height: 40px;
    top: 50%;
    transform: translateY(-50%);
    background-color: color-mix(in srgb, var(--color-bg) 92%, transparent);
    box-shadow: 0 2px 3px var(--color-shadow-strong);
  }

  .project-page__arrows > :first-child {
    right: auto;
    left: -1.4rem;
  }

  .project-page__arrows > :last-child {
    right: -1.4rem;
  }

  .project-page__arrows .project-page__arrow--disabled {
    display: none;
  }
}

@media (min-width: 1200px) {
  .project-page__arrows .project-page__arrow {
    width: 48px;
    height: 48px;
  }
}

/* In the page margins as far as they allow: halfway between the content and the edge
   of the window, never closer to the content than on smaller screens, at most 4.5rem out. */
@media (min-width: 1200px) {
  .project-page__arrows > :first-child {
    left: clamp(-4.5rem, calc((100% - 100vw) / 4 - 24px), -1.4rem);
  }

  .project-page__arrows > :last-child {
    right: clamp(-4.5rem, calc((100% - 100vw) / 4 - 24px), -1.4rem);
  }
}

/* --- Project detail page --- */
.project-page--detail h1 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  max-width: none;
  margin-bottom: 1.5rem;
}

.project-page__title {
  max-width: var(--text-width);
}

.project-page__content {
  margin-top: 1.5rem;
}

/* A long introduction (3 paragraphs or more) is set in two columns on wide screens */
@media (min-width: 900px) {
  .project-page__content:has(> p:nth-of-type(3)) {
    column-count: 2;
    column-gap: 3rem;
  }

  .project-page__content:has(> p:nth-of-type(3)) p {
    max-width: none;
    break-inside: avoid-column;
  }
}

/* Text parts beside the blocks marked "cote", in zigzag */
.project-page__rows {
  display: flex;
  flex-direction: column;
  gap: clamp(2.5rem, 5vw, 4.5rem);
  margin-top: 2rem;
}

.side-row {
  display: grid;
  gap: 1.5rem;
  align-items: center;
}

.side-row__text {
  max-width: var(--text-width);
}

.side-row__text > :first-child {
  margin-top: 0;
}

.side-row__text > :last-child {
  margin-bottom: 0;
}

.side-row__media > * {
  width: 100%;
  margin: 0;
}

/* Beside the text, a portrait image takes only its own width, top-aligned with the text */
@media (min-width: 900px) {
  .side-row:has(.project-page__image-block--portrait) {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .side-row--media-left:has(.project-page__image-block--portrait) {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .side-row:has(.project-page__image-block--portrait) .side-row__text {
    padding-top: 0.25rem;
  }
}

/* Beside the text, a portrait image is centred in its column, at a readable height */
.side-row__media > .project-page__image-block--portrait {
  width: fit-content;
  margin-inline: auto;
}

.side-row__media .project-page__image-block--portrait img {
  max-height: min(80vh, 38rem);
}

/* Beside the text, images keep their own proportions (charts, captures) */
@media (min-width: 780px) {
  .side-row__media .project-page__image-block img {
    aspect-ratio: auto;
    max-height: none;
  }
}

@media (min-width: 900px) {
  .side-row {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    gap: clamp(2rem, 4vw, 4rem);
  }

  .side-row--media-left {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }

  .side-row--media-left .side-row__media {
    order: -1;
  }

  .side-row--text-only,
  .side-row--media-only {
    grid-template-columns: minmax(0, 3fr);
  }

  .side-row--media-only.side-row--media-right {
    justify-content: end;
  }
}

/* Beside the text, an image set to "Moyenne" or "Petite" takes a narrower column */
@media (min-width: 900px) {
  .side-row:has(.project-page__image-block--medium:not(.project-page__image-block--portrait)) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .side-row:has(.project-page__image-block--small:not(.project-page__image-block--portrait)) {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  }

  .side-row--media-left:has(.project-page__image-block--small:not(.project-page__image-block--portrait)) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  }

  .side-row__media > .project-page__image-block--medium:not(.project-page__image-block--portrait),
  .side-row__media > .project-page__image-block--small:not(.project-page__image-block--portrait) {
    width: 100%;
  }
}

/* Mobile page captures side by side, on a tinted panel */
.site-pages {
  margin: 0;
}

.site-pages__row {
  display: grid;
  grid-template-columns: repeat(var(--count, 4), minmax(0, 1fr));
  align-items: start;
  gap: clamp(1rem, 2.5vw, 2.5rem);
  padding: clamp(1.25rem, 4vw, 3.5rem);
  background: color-mix(in srgb, var(--color-ink) 7%, transparent);
  border-radius: var(--radius);
}

.site-pages__item {
  overflow: hidden;
  border-radius: calc(var(--radius) * 2);
  background: #fff;
  box-shadow: 0 12px 24px -14px var(--color-shadow-strong);
}

.site-pages__item picture,
.site-pages__item img {
  display: block;
  width: 100%;
  height: auto;
}

.site-pages figcaption {
  font-size: 0.85rem;
  color: var(--color-ink-soft);
  margin-top: 0.5rem;
}

@media (max-width: 779px) {
  .site-pages__row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Content blocks (see src/_includes/blocks/) */
.project-page__blocks {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  margin-top: 2.5rem;
}

.project-page__blocks > * {
  margin: 0;
}

.section-divider {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: 1.5rem 0 0;
  width: 100%;
}

.project-page__text-block {
  width: 100%;
  max-width: var(--text-width);
}

.project-page__text-block h2,
.text-image__text h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-text);
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.25;
}

@media (min-width: 780px) {
  .project-page__text-block--2col {
    max-width: none;
    column-count: 2;
    column-gap: 3rem;
  }

  .project-page__text-block--2col h2 {
    column-span: all;
  }

  .project-page__text-block--2col p {
    break-inside: avoid-column;
  }
}

/* Text + image: extra photos form a row under the text and the main image */
.text-image {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: start;
}

.text-image__text {
  max-width: var(--text-width);
}

.text-image__media {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.text-image__main,
.text-image__extras figure {
  margin: 0;
}

.text-image__extras {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(var(--count, 3), minmax(0, 1fr));
  gap: 0.5rem;
}

.text-image__media img,
.text-image__extras img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
}

/* Under the text, two extra photos side by side are kept wide, so they are not taller than needed */
@media (min-width: 780px) {
  .text-image__extras[style*="--count: 2"] img {
    aspect-ratio: 16 / 9;
  }
}

.text-image__media figcaption,
.text-image__extras figcaption {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--color-ink-soft);
}

@media (min-width: 780px) {
  .text-image--right.text-image--third { grid-template-columns: 2fr 1fr; }
  .text-image--right.text-image--half { grid-template-columns: 1fr 1fr; }
  .text-image--left.text-image--third { grid-template-columns: 1fr 2fr; }
  .text-image--left.text-image--half { grid-template-columns: 1fr 1fr; }

  .text-image--left .text-image__media {
    order: -1;
  }

  /* The main image takes the height of the text (cropped), so no gap is left beside it */
  .text-image {
    align-items: stretch;
  }

  .text-image__main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
  }

  /* At least 16:9, taller when the text is longer */
  .text-image__main picture {
    position: relative;
    flex: 1 0 auto;
    aspect-ratio: 16 / 9;
  }

  .text-image__main img {
    position: absolute;
    inset: 0;
    height: 100%;
    aspect-ratio: auto;
  }
}

/* Text + portrait image (poster, book): the image is shown whole, at the top of its column */
.text-image--portrait .text-image__main img {
  aspect-ratio: auto;
  object-fit: contain;
  width: auto;
  max-width: 100%;
  max-height: min(85vh, 40rem);
}

@media (min-width: 780px) {
  .text-image--portrait {
    align-items: start;
  }

  .text-image--portrait .text-image__main picture {
    position: static;
    flex: none;
    aspect-ratio: auto;
  }

  .text-image--portrait .text-image__main img {
    position: static;
    height: auto;
  }
}

/* Document (PDF): the same card for every report, guide or booklet */
.document-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  max-width: 40rem;
  padding: 1rem 1.25rem;
  color: var(--color-ink);
  text-decoration: none;
  background-image: none;
  border: 1px solid color-mix(in srgb, var(--color-ink) 18%, transparent);
  border-radius: var(--radius);
  background-color: var(--color-surface);
  transition: border-color 0.2s ease;
}

.document-card:hover,
.document-card:focus-visible {
  border-color: var(--color-accent);
  background-image: none;
}

.document-card__icon {
  flex: none;
  display: inline-flex;
  padding-top: 0.1rem;
}

.document-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.document-card__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  line-height: 1.3;
}

.document-card__text {
  font-size: 0.95rem;
  color: var(--color-ink-soft);
}

/* Single image (also used by the video and audio blocks) */
.project-page__image-block {
  width: 100%;
}

.project-page__image-block--medium { width: min(100%, 640px); }
.project-page__image-block--small { width: min(100%, 340px); }
.project-page__image-block--left { align-self: flex-start; }
.project-page__image-block--center { align-self: center; }
.project-page__image-block--right { align-self: flex-end; }

.project-page__image-block img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

/* Cropped so a single image never dominates the page */
.project-page__image-block--full img {
  aspect-ratio: 21 / 9;
  max-height: 32rem;
  object-fit: cover;
  object-position: center 30%;
}

/* Full width, never cropped (diagrams, maps, posters in landscape) */
.project-page__image-block--whole {
  width: 100%;
}

.project-page__image-block--whole img {
  aspect-ratio: auto;
  max-height: none;
}

.project-page__image-block--medium img {
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: center 30%;
}

/* Portrait images (posters, books): never cropped, the height is capped instead.
   The figure takes the width of the image, so the alignment applies to it. */
.project-page__image-block--portrait {
  width: fit-content;
  max-width: 100%;
}

.project-page__image-block--portrait img {
  width: auto;
  max-width: 100%;
  max-height: min(85vh, 46rem);
  aspect-ratio: auto;
  object-fit: contain;
}

.project-page__image-block--portrait.project-page__image-block--medium img { max-height: min(70vh, 34rem); }
.project-page__image-block--portrait.project-page__image-block--small img { max-height: min(55vh, 22rem); }

/* The caption wraps to the width of the image instead of widening the figure */
.project-page__image-block--portrait figcaption {
  width: 0;
  min-width: 100%;
}

.project-page__image-block figcaption {
  font-size: 0.85rem;
  color: var(--color-ink-soft);
  margin-top: 0.5rem;
}

/* Gallery: tight grid, crop ratio depends on the number of photos */
.project-page__gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: start;
  gap: 0.5rem;
  margin: 2rem 0;
}

.project-page__gallery figure {
  margin: 0;
}

.project-page__gallery picture {
  display: block;
}

.project-page__gallery img,
.project-page__gallery video {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  margin: 0;
}

.project-page__gallery--1 :is(img, video) { aspect-ratio: 21 / 9; }
.project-page__gallery--2 :is(img, video) { aspect-ratio: 16 / 9; }
.project-page__gallery--n :is(img, video) { aspect-ratio: 1 / 1; }
/* A gallery made only of portrait photos (posters, book covers) shows them whole;
   mixed with landscape photos, they are cropped like the others so the row stays even */
.project-page__gallery:not(:has(.project-page__gallery-item--landscape)) .project-page__gallery-item--portrait img {
  width: auto;
  max-width: 100%;
  height: min(28rem, 70vh);
  aspect-ratio: auto;
  object-fit: contain;
  margin-inline: auto;
  box-shadow: 0 0 0 1px var(--color-border);
}

/* Video extracts keep their 16:9 format */
.project-page__gallery video { aspect-ratio: 16 / 9; background: #000; }

.project-page__gallery figcaption {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--color-ink-soft);
}

@media (max-width: 780px) {
  .project-page__gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .project-page__gallery {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 900px) {
  .project-page__gallery {
    grid-template-columns: repeat(var(--cols, 4), 1fr);
  }
}

/* Video, audio and 3D */
.project-page__media {
  position: relative;
}

.project-page__media video,
.project-page__media audio {
  display: block;
  width: 100%;
  border-radius: var(--radius);
}

.project-page__media video {
  background: #000;
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 1), 1fr);
  gap: 1.25rem;
  width: 100%;
}

.model-grid--medium { width: min(100%, 640px); }
.model-grid--small { width: min(100%, 340px); }
.model-grid--left { align-self: flex-start; }
.model-grid--center { align-self: center; }
.model-grid--right { align-self: flex-end; }

@media (max-width: 779px) {
  .model-grid {
    grid-template-columns: 1fr;
  }
}

.model {
  margin: 0;
  min-width: 0;
}

.model model-viewer {
  display: block;
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: var(--ratio, 16 / 9);
  max-height: 75vh;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--color-ink) 6%, transparent);
}

.model figcaption {
  font-size: 0.85rem;
  color: var(--color-ink-soft);
  margin-top: 0.5rem;
}

/* Third-party players (YouTube, Vimeo, SoundCloud), loaded on click */
.embed__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: color-mix(in srgb, var(--color-ink) 8%, transparent);
}

.embed--soundcloud .embed__frame {
  aspect-ratio: auto;
  height: 166px;
}

.embed__frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.embed figcaption {
  font-size: 0.85rem;
  color: var(--color-ink-soft);
  margin-top: 0.5rem;
}

/* The model is only downloaded when this poster is clicked; it looks like the
   video posters (duotone image, round icon), see .play-poster */
.model__poster {
  border-radius: var(--radius);
}

.model__icon {
  padding-left: 0;
}

/* Video posters: duotone image and a play icon; on click the filter fades out */
.video-player {
  position: relative;
}

.play-poster {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  cursor: pointer;
  overflow: hidden;
  border-radius: inherit;
  background: #284A74;
  transition: opacity 0.6s ease;
}

.play-poster__image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: grayscale(1) sepia(0.4) hue-rotate(180deg) saturate(3);
  transform: scale(1.03);
  transition: filter 0.6s ease, transform 0.6s ease;
}

/* Primary blue tint over the duotone */
.play-poster__image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #284A74;
  mix-blend-mode: color;
  opacity: 0.6;
  transition: opacity 0.6s ease;
}

.play-poster.is-playing .play-poster__image::after {
  opacity: 0;
}

.play-poster__icon {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  padding-left: 4px;
  border-radius: 50%;
  background: #284A74;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s ease, opacity 0.4s ease;
}

.play-poster:hover .play-poster__icon,
.play-poster:focus-visible .play-poster__icon {
  transform: scale(1.08);
}

.play-poster:hover .play-poster__image,
.play-poster:focus-visible .play-poster__image {
  transform: scale(1);
}

.play-poster.is-playing {
  cursor: default;
}

.play-poster.is-playing .play-poster__image {
  filter: none;
  transform: scale(1);
}

.play-poster.is-playing .play-poster__icon {
  opacity: 0;
  transform: scale(0.8);
}

.play-poster.is-hidden {
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .play-poster,
  .play-poster__image,
  .play-poster__icon {
    transition: none;
  }
}

/* --- Image frames (mockups): browser window and smartphone --- */
.frame img,
.frame picture,
.frame video {
  display: block;
  width: 100%;
  height: auto;
}

.frame--browser {
  border: 1.5px solid var(--color-ink);
  overflow: hidden;
  background: var(--color-bg);
}

/* Title bar with three dots */
.frame--browser::before {
  content: "";
  display: block;
  height: 26px;
  border-bottom: 1.5px solid var(--color-ink);
  background:
    radial-gradient(circle at 14px 50%, var(--color-ink) 3.5px, transparent 4px),
    radial-gradient(circle at 28px 50%, var(--color-ink) 3.5px, transparent 4px),
    radial-gradient(circle at 42px 50%, var(--color-ink) 3.5px, transparent 4px),
    var(--color-bg);
}

.frame--phone {
  width: min(100%, 280px);
  margin-inline: auto;
  padding: 10px;
  border: 1.5px solid var(--color-ink);
  background: var(--color-bg);
}

.frame--browser img,
.frame--phone img {
  border-radius: 0;
}

/* --- Footer --- */
.footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.875rem;
  color: var(--color-ink-soft);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
}

.footer__support {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  max-width: 18rem;
  text-align: right;
}

.footer__support p {
  margin: 0;
}

.footer__support-logo {
  display: block;
}

.footer__support-logo img {
  display: block;
  width: auto;
  height: 3.5rem;
}

/* The logo is drawn for light backgrounds: white panel in dark mode */
:root[data-theme="dark"] .footer__support-logo {
  background: #ffffff;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
}

@media (max-width: 779px) {
  .footer__support {
    align-items: flex-start;
    text-align: left;
  }
}

.footer a:hover,
.footer a:focus-visible {
  text-decoration: none;
}

.footer__sitemap ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding: 0;
  margin: 0;
}

.footer__social {
  list-style: none;
  display: flex;
  gap: 1rem;
  padding: 0;
  margin: 1rem 0 0;
}

.footer__legal {
  margin: 1rem 0 0;
  font-size: 0.8rem;
}

/* --- Phones: one image per row, all in the same format --- */
@media (max-width: 779px) {
  .project-page__image-block,
  .project-page__image-block--medium,
  .project-page__image-block--small {
    width: 100%;
    align-self: center;
  }

  .project-page__image img,
  .project-page__image-block img,
  .project-page__gallery img,
  .text-image__media img,
  .text-image__extras img {
    width: 100%;
    max-height: none;
    aspect-ratio: 4 / 3;
    object-fit: cover;
  }

  .project-page__gallery,
  .text-image__extras {
    grid-template-columns: 1fr;
  }
}

/* Phones: whole images stay whole */
@media (max-width: 779px) {
  .project-page__image-block--whole img {
    aspect-ratio: auto;
    object-fit: contain;
  }
}

/* Phones: portrait images (posters, books) stay whole, centred */
@media (max-width: 779px) {
  .project-page__image-block--portrait,
  .project-page__image-block--portrait.project-page__image-block--medium,
  .project-page__image-block--portrait.project-page__image-block--small {
    width: fit-content;
  }

  .project-page__image-block--portrait img,
  .text-image--portrait .text-image__main img {
    width: auto;
    max-width: 100%;
    max-height: 75vh;
    aspect-ratio: auto;
    object-fit: contain;
    margin-inline: auto;
  }
}

