/* Noépora — variante E « Atelier »
   La direction D, ramenée à un registre calme : deux tuiles, une figure,
   une légende, des transitions de 300 à 450 ms. Clair et sombre.
   Statique ; un seul script local. */

@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --fond: #f6f5f2;
  --surface: #ffffff;
  --encre: #15181b;
  --encre-2: #51585f;
  --encre-3: #6a7178;
  --trait: rgba(21, 24, 27, .1);
  --trait-fort: rgba(21, 24, 27, .18);

  --reviser: #1d4a78;
  --reviser-fonce: #163a60;
  --humus: #587050;
  --humus-fonce: #455940;

  --ombre: 0 1px 2px rgba(21, 24, 27, .05), 0 22px 48px -32px rgba(21, 24, 27, .3);
  --ombre-active: 0 2px 5px rgba(21, 24, 27, .06), 0 36px 72px -34px rgba(21, 24, 27, .38);

  --ease: cubic-bezier(.22, .61, .36, 1);
  --duree: 400ms;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #111312;
    --surface: #191c1a;
    --encre: #f0f1ed;
    --encre-2: #b3bab3;
    --encre-3: #8b938c;
    --trait: rgba(240, 241, 237, .1);
    --trait-fort: rgba(240, 241, 237, .2);

    --reviser: #9dbde0;
    --reviser-fonce: #b7d0ea;
    --humus: #a8bf9a;
    --humus-fonce: #bdd1b0;

    --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 22px 48px -30px rgba(0, 0, 0, .8);
    --ombre-active: 0 2px 5px rgba(0, 0, 0, .34), 0 38px 76px -32px rgba(0, 0, 0, .9);

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --fond: #111312;
  --surface: #191c1a;
  --encre: #f0f1ed;
  --encre-2: #b3bab3;
  --encre-3: #8b938c;
  --trait: rgba(240, 241, 237, .1);
  --trait-fort: rgba(240, 241, 237, .2);

  --reviser: #9dbde0;
  --reviser-fonce: #b7d0ea;
  --humus: #a8bf9a;
  --humus-fonce: #bdd1b0;

  --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 22px 48px -30px rgba(0, 0, 0, .8);
  --ombre-active: 0 2px 5px rgba(0, 0, 0, .34), 0 38px 76px -32px rgba(0, 0, 0, .9);

  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

html,
body { height: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  background: var(--fond);
  color: var(--encre);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 260ms var(--ease), color 260ms var(--ease);
}

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

::selection { background: var(--reviser); color: #fff; }

:focus-visible {
  outline: 2px solid var(--reviser);
  outline-offset: 3px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: fixed;
  left: 1rem;
  top: -4rem;
  z-index: 40;
  padding: .6rem .95rem;
  color: var(--encre);
  background: var(--surface);
  border: 1px solid var(--trait-fort);
  border-radius: 8px;
  font-size: .82rem;
  text-decoration: none;
  box-shadow: var(--ombre);
  transition: top 200ms var(--ease);
}

.skip:focus { top: 1rem; }

/* ---------- En-tête / pied ---------- */

.entete,
.pied {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-inline: clamp(1.1rem, 2.6vw, 2.2rem);
}

.entete {
  padding-block: clamp(.95rem, 1.8vw, 1.35rem) clamp(.5rem, 1vw, .8rem);
}

.marque {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: var(--encre);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -.012em;
  line-height: 1;
  text-decoration: none;
}

.marque__signe {
  width: 22px;
  height: 22px;
  color: var(--encre);
  flex: none;
}

.bascule {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--encre-2);
  background: transparent;
  border: 1px solid var(--trait);
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 240ms var(--ease), border-color 240ms var(--ease), background-color 240ms var(--ease);
}

.bascule:hover {
  color: var(--encre);
  border-color: var(--trait-fort);
  background: color-mix(in srgb, var(--encre) 4%, transparent);
}

.bascule__icone {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bascule__icone--soleil { display: none; }

:root[data-theme="dark"] .bascule__icone--soleil { display: block; }
:root[data-theme="dark"] .bascule__icone--lune { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bascule__icone--soleil { display: block; }
  :root:not([data-theme="light"]) .bascule__icone--lune { display: none; }
}

html:not(.js) .bascule { display: none; }

.pied {
  padding-block: clamp(.6rem, 1.2vw, .9rem) clamp(.85rem, 1.6vw, 1.15rem);
  color: var(--encre-3);
  font-size: .78rem;
}

.pied__copie { margin: 0; }

.pied__liens {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem 1.5rem;
}

.pied__liens a {
  color: var(--encre-2);
  text-decoration: none;
  transition: color 200ms var(--ease);
}

.pied__liens a:hover {
  color: var(--encre);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

/* ---------- Scène ---------- */

.scene {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  gap: clamp(12px, 1.2vw, 18px);
  padding: clamp(14px, 2vw, 26px) clamp(14px, 2.4vw, 30px) clamp(10px, 1.4vw, 18px);
}

/* ---------- Tuile ---------- */

.carte {
  --accent: var(--reviser);
  --s: 1;

  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid var(--trait);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--ombre);
  transform: scale(var(--s));
  transform-origin: 50% 50%;
  touch-action: manipulation;
  animation: entree 560ms var(--ease) backwards;
  transition:
    transform var(--duree) var(--ease),
    flex-grow var(--duree) var(--ease),
    border-color var(--duree) var(--ease),
    box-shadow var(--duree) var(--ease),
    opacity var(--duree) var(--ease),
    filter var(--duree) var(--ease);
}

.carte:nth-child(1) { animation-delay: 60ms; }
.carte:nth-child(2) { animation-delay: 150ms; }

.carte--humuscope { --accent: var(--humus); }

.carte.est-actif {
  --s: 1.035;
  flex-grow: 1.07;
  border-color: color-mix(in srgb, var(--accent) 32%, var(--trait));
  box-shadow: var(--ombre-active);
}

.scene.est-actif .carte:not(.est-actif) {
  --s: .994;
  flex-grow: .93;
  opacity: .9;
  box-shadow: var(--ombre);
}

/* l’autre tuile s’estompe par son image, sans rendre son texte illisible */
.scene.est-actif .carte:not(.est-actif) .carte__media {
  opacity: .62;
  filter: saturate(.6) contrast(.96);
}

.scene.est-actif .carte:not(.est-actif) .carte__titre {
  color: var(--encre-2);
}

@keyframes entree {
  from { opacity: 0; translate: 0 16px; }
  to   { opacity: 1; translate: 0 0; }
}

/* ---------- Figure ---------- */

.carte__media {
  position: relative;
  flex: 0 1 64%;
  min-height: 0;
  overflow: hidden;
  transition: opacity var(--duree) var(--ease), filter var(--duree) var(--ease);
  background: #eef1f5;
  isolation: isolate;
}

.carte--humuscope .carte__media { background: #e8ecdf; }

.carte__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 0;
  transform: scale(1.005) translate3d(var(--px, 0px), var(--py, 0px), 0);
  transition: transform 760ms var(--ease), filter 460ms var(--ease);
  will-change: transform;
  filter: saturate(.96) contrast(.99);
}

/* La capture Humuscope est déjà sombre et colorée : on la laisse telle quelle. */
.carte--humuscope .carte__image {
  object-position: 50% 0;
  filter: none;
}

.carte.est-actif .carte__image {
  transform: scale(1.05) translate3d(var(--px, 0px), var(--py, 0px), 0);
  filter: saturate(1) contrast(1);
}

.carte--humuscope.est-actif .carte__image { filter: none; }
:root[data-theme="dark"] .carte--humuscope.est-actif .carte__image { filter: brightness(.96) saturate(.98); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .carte--humuscope.est-actif .carte__image { filter: brightness(.96) saturate(.98); }
}

/* le bas de la figure se fond dans la tuile */
.carte__degrade {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  height: 68px;
  pointer-events: none;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--surface) 0%, transparent) 0%,
    color-mix(in srgb, var(--surface) 62%, transparent) 58%,
    var(--surface) 100%);
  transition: background 260ms var(--ease);
}

/* ---------- Légende ---------- */

.carte__cadre {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .9rem;
  padding: clamp(18px, 1.9vw, 26px) clamp(20px, 2.1vw, 30px) clamp(20px, 2vw, 28px);
}

.carte__haut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.carte__meta {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  margin: 0;
  color: var(--encre-3);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.carte__num { color: var(--encre-2); font-variant-numeric: tabular-nums; }

.carte__categorie {
  position: relative;
  padding-left: .6rem;
}

.carte__categorie::before {
  content: "";
  position: absolute;
  left: 0;
  top: .5em;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .85;
}

.carte__etat {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin: 0;
  padding: .3rem .62rem .28rem;
  color: var(--encre-2);
  border: 1px solid var(--trait);
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .01em;
  line-height: 1;
  flex: none;
}

.carte__point {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  color: var(--accent);
  flex: none;
}

.carte__etat--attente .carte__point {
  background: transparent;
  border: 1px solid var(--accent);
}

.carte__bas {
  position: relative;
}

.carte__titre-ligne {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.carte__logo {
  width: clamp(22px, 1.9vw, 27px);
  height: auto;
  aspect-ratio: 1;
  flex: none;
  border-radius: 5px;
  image-rendering: pixelated;
}

.carte__titre {
  margin: 0;
  font-size: clamp(2.15rem, 3.3vw, 3.05rem);
  font-weight: 600;
  line-height: 1.03;
  letter-spacing: -.03em;
  text-wrap: balance;
  transition: transform 380ms var(--ease), color 380ms var(--ease);
}

.carte.est-actif .carte__titre { transform: translateY(-2px); }

.carte__resume {
  max-width: 32ch;
  margin: .55rem 0 0;
  color: var(--encre-2);
  font-size: clamp(.92rem, 1vw, .98rem);
  line-height: 1.5;
  text-wrap: pretty;
}

.carte__indice {
  margin: .75rem 0 0;
  color: var(--encre-3);
  font-size: .76rem;
  height: 1.4em;
  overflow: hidden;
}

.carte__resume,
.carte__indice {
  transition: opacity 220ms var(--ease), height 340ms var(--ease), margin 340ms var(--ease);
}

.carte.est-actif .carte__resume,
.carte.est-actif .carte__indice {
  opacity: 0;
  height: 0;
  margin-top: 0;
}

.indice-tactile { display: none; }

@media (hover: none) {
  .indice-souris { display: none; }
  .indice-tactile { display: inline; }
}

.carte__revelation {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 420ms var(--ease), opacity 300ms var(--ease) 60ms;
}

.carte.est-actif .carte__revelation {
  grid-template-rows: 1fr;
  opacity: 1;
}

.carte__revelation-inner {
  min-height: 0;
  overflow: hidden;
  padding: 2px;
  margin: -2px;
}

.carte__phrase {
  max-width: 34ch;
  margin: .35rem 0 0;
  color: var(--encre-2);
  font-size: clamp(.92rem, 1vw, .98rem);
  line-height: 1.6;
  text-wrap: pretty;
  transform: translateY(8px);
  transition: transform 400ms var(--ease) 60ms;
}

.carte.est-actif .carte__phrase { transform: translateY(0); }

.carte__action {
  margin: 1.05rem 0 0;
  pointer-events: none;
  transform: translateY(8px);
  opacity: 0;
  transition: transform 400ms var(--ease) 90ms, opacity 320ms var(--ease) 90ms;
}

.carte.est-actif .carte__action {
  pointer-events: auto;
  transform: translateY(0);
  opacity: 1;
}

.bouton {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .72rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: .85rem;
  font-weight: 500;
  letter-spacing: -.005em;
  line-height: 1;
  text-decoration: none;
  transition: background-color 240ms var(--ease), border-color 240ms var(--ease),
              color 240ms var(--ease), transform 240ms var(--ease);
}

.bouton--plein {
  color: #fff;
  background: var(--reviser);
  border-color: var(--reviser);
  box-shadow: 0 8px 20px -12px color-mix(in srgb, var(--reviser) 70%, transparent);
}

.bouton--plein:hover {
  background: var(--reviser-fonce);
  border-color: var(--reviser-fonce);
  transform: translateY(-1px);
}

.bouton__fleche {
  width: 17px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 240ms var(--ease);
}

.bouton:hover .bouton__fleche { transform: translateX(3px); }

.bouton--attente {
  color: var(--humus-fonce);
  background: color-mix(in srgb, var(--humus) 12%, transparent);
  border-color: color-mix(in srgb, var(--humus) 32%, transparent);
  cursor: default;
}

:root[data-theme="dark"] .bouton--plein { color: #10161c; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bouton--plein { color: #10161c; }
}

/* En sombre, la capture du produit est légèrement retenue ;
   celle d’Humuscope est déjà nocturne, on n’y touche pas. */
:root[data-theme="dark"] .carte__image { filter: brightness(.62) saturate(.88) contrast(1.02); }
:root[data-theme="dark"] .carte--humuscope .carte__image { filter: brightness(.93) saturate(.96); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .carte__image { filter: brightness(.62) saturate(.88) contrast(1.02); }
  :root:not([data-theme="light"]) .carte--humuscope .carte__image { filter: brightness(.93) saturate(.96); }
}

/* Sans JavaScript : tout reste lisible et cliquable. */
html:not(.js) .carte__indice { display: none; }
html:not(.js) .carte__revelation { grid-template-rows: 1fr; opacity: 1; }
html:not(.js) .carte__phrase,
html:not(.js) .carte__action { transform: none; opacity: 1; }
html:not(.js) .carte__action { pointer-events: auto; }

/* ---------- Téléphone ---------- */

@media (max-width: 899px) {
  .scene {
    flex-direction: column;
    gap: 11px;
    padding: 12px 14px 8px;
  }

  .carte {
    flex: 1 1 0;
    min-height: 0;
    border-radius: 18px;
  }

  .carte__media { flex-basis: 45%; min-height: 96px; }

  .carte.est-actif {
    --s: 1.008;
    flex-grow: 1.28;
  }

  .scene.est-actif .carte:not(.est-actif) {
    --s: 1;
    flex-grow: .72;
    opacity: .9;
  }

  .scene.est-actif .carte:not(.est-actif) .carte__media { opacity: .64; }

  .carte__cadre { padding: 14px 17px 16px; gap: .4rem; }
  .carte__titre { font-size: clamp(1.75rem, 7.4vw, 2.2rem); }
  .carte__resume { font-size: .9rem; margin-top: .35rem; }
  .carte__indice { margin-top: .55rem; font-size: .74rem; }
  .carte__phrase { font-size: .89rem; line-height: 1.55; max-width: 40ch; margin-top: .2rem; }
  .carte__action { margin-top: .85rem; }
  .bouton { padding: .64rem 1rem; font-size: .82rem; }
  .carte__etat { font-size: .66rem; padding: .26rem .54rem .24rem; }
  .carte__meta { font-size: .68rem; }
  .carte__degrade { height: 46px; }
  .carte__logo { width: 21px; }
  .entete { padding-block: .8rem .35rem; }
  .pied { font-size: .74rem; }
}

@media (max-width: 420px) {
  .pied { justify-content: center; }
  .pied__copie { display: none; }
  .pied__liens { width: 100%; justify-content: space-between; }
}

/* ---------- Mouvement réduit : fondus seulement ---------- */

@media (prefers-reduced-motion: reduce) {
  .carte {
    animation: none;
    --s: 1;
    flex-grow: 1;
  }

  .carte.est-actif { --s: 1; flex-grow: 1; }
  .scene.est-actif .carte:not(.est-actif) { --s: 1; flex-grow: 1; opacity: .9; }
  .scene.est-actif .carte:not(.est-actif) .carte__media { opacity: .68; }

  .carte,
  .carte__image,
  .carte__titre,
  .carte__resume,
  .carte__indice,
  .carte__revelation,
  .carte__phrase,
  .carte__action,
  .bouton {
    transition-property: opacity, filter, border-color, box-shadow, background-color, color;
    transition-duration: 300ms;
    transition-timing-function: var(--ease);
  }

  .carte,
  .carte__image,
  .carte__titre,
  .carte__phrase,
  .carte__action,
  .bouton { transform: none !important; }

  .carte__revelation { grid-template-rows: 1fr; opacity: 1; }
  .carte__indice { display: none; }
  .carte__resume { display: none; }
}

/* Carte avec lien : un clic n’importe où sur la carte ouvre le projet. */
.carte[data-lien] { cursor: pointer; }
