/* ---------- Réalisations, section figée : grand écran, animations actives (le reste : work.css) ----------
   Colonne étroite en haut à gauche (libellé, titre, texte, vignettes en colonne, bouton) ; à droite, une grande carte
   presque pleine hauteur : la photo du projet en plein cadre, ou ses appareils dessinés posés sur un bureau. */
/* Nombre de projets (cartes .work-card de index.html) : il fixe la longueur du défilement. npm run check le vérifie. */
.work {
  --slides: 4;
}
@media (min-width: 1024px) {
  .has-motion .work {
    height: calc((var(--slides) + 0.6) * 100vh);
    padding: 0;
  }
  .has-motion .work-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
  }
  .has-motion .work-grid {
    grid-template-columns: min(360px, 30vw) minmax(0, 1fr);
    align-items: start;
    column-gap: 80px;
    max-width: none;
    height: 100%;
    padding: 34px 16px 0 clamp(48px, 5vw, 96px);
  }
  .has-motion .work-title {
    margin: 12px 0 0;
    font-size: 48px;
    line-height: 0.95;
    letter-spacing: -0.05em;
  }
  .has-motion .work-text {
    margin-top: 20px;
  }
  .has-motion .work-thumbs {
    display: grid;
    gap: 12px;
    margin-top: 40px;
  }
  .has-motion .work-intro .solid-btn {
    display: inline-flex;
    height: 41px;
    margin-top: 48px;
  }
  /* Une vignette par ligne : l'active en grand avec un liseré, les autres réduites (voir « Animations », plus bas) ; un carré à droite
     marque l'active. */
  .work-thumbs li {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .work-thumbs li::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: rgb(var(--ink-rgb) / 0.22);
    transition: background-color 0.25s ease;
  }
  .work-thumbs li.is-active::after {
    background: var(--ink);
  }
  .work-thumbs button {
    position: relative;
    flex: none;
    width: 112px;
    height: 64px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--ink);
    transform-origin: left center;
  }
  .work-thumbs button::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 2px solid rgb(var(--ink-rgb) / 0.45);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.25s ease;
  }
  .work-thumbs li.is-active button::after {
    opacity: 1;
  }
  .work-thumbs img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .has-motion .work-stage {
    position: relative;
    height: calc(100vh - 56px);
    margin-top: 14px;
  }
  .has-motion .work-track {
    position: relative;
    display: block;
    height: 100%;
    /* clip, pas hidden : la piste ne défile jamais d'elle-même (au clavier, work-pinned.js fait défiler la page). */
    overflow: clip;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #0c0c0c;
  }
  .has-motion .work-card {
    position: absolute;
    inset: 0;
    padding: 20px 20px 0;
    overflow: hidden;
    color: #fff;
    background: radial-gradient(70% 60% at 50% 88%, #34302c 0%, #161514 55%, var(--ink) 100%);
    transform: translate3d(0, var(--card-y, 0px), 0);
    will-change: transform;
  }
  /* Sans photo : un bureau sous la ligne d'horizon, où les appareils dessinés sont posés. */
  .has-motion .work-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    background: linear-gradient(rgb(0 0 0 / 0) 56%, rgb(255 255 255 / 0.1) 56%, rgb(255 255 255 / 0.04) 66%, rgb(0 0 0 / 0.42));
    pointer-events: none;
  }
  .has-motion .work-card-head {
    order: 0;
    position: relative;
    z-index: 1;
    padding-top: 0;
  }
  /* Voile sombre derrière le titre, pour le lire sur la photo comme sur le décor. */
  .has-motion .work-card-head::before {
    content: "";
    position: absolute;
    inset: -20px -20px auto;
    z-index: -1;
    height: calc(100% + 96px);
    background: linear-gradient(rgb(0 0 0 / 0.75), rgb(0 0 0 / 0.35) 50%, rgb(0 0 0 / 0));
    pointer-events: none;
  }
  .has-motion .work-count {
    display: block;
    letter-spacing: 0.35em;
    color: rgb(255 255 255 / 0.55);
  }
  /* Nom et description sur une ligne, tout en blanc ; la place de deux lignes est gardée pour les titres longs. */
  .has-motion .work-card h3 {
    min-height: 2.6em;
    max-width: 95%;
    margin-top: 12px;
    font-size: clamp(1.25rem, 0.5rem + 1.54vw, 1.875rem);
    line-height: 0.95;
    letter-spacing: -0.025em;
  }
  .has-motion .work-card h3 span {
    display: inline;
    color: inherit;
  }
  .has-motion .work-stack {
    margin-top: 8px;
    color: rgb(255 255 255 / 0.65);
  }
  .has-motion .work-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
  }
  .work-tags li {
    padding: 2px 8px;
    border: 1px solid rgb(255 255 255 / 0.25);
    border-radius: 999px;
    background: rgb(255 255 255 / 0.1);
    color: rgb(255 255 255 / 0.85);
    font: 400 9px / 13.5px var(--mono);
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
  /* La scène est centrée dans toute la carte, sous le titre ; sa hauteur laisse ~190 px en haut (titre) et en bas
     (progression), sa largeur reste dans les deux tiers de la carte. */
  .has-motion .work-visual {
    position: absolute;
    inset: 0;
    padding: 0;
    background: none;
    border-radius: 0;
    overflow: visible;
  }
  /* La photo couvre la carte, centrée sur l'ordinateur ; elle avance un peu au survol. */
  .has-motion .work-photo {
    position: absolute;
    inset: 0;
    height: 100%;
    object-fit: cover;
    object-position: 47% 50%;
    transition: scale 0.9s var(--ease-out);
  }
  .has-motion .work-card:hover .work-photo {
    scale: 1.02;
  }
  .has-motion .device-scene {
    width: min(62%, calc((100vh - 436px) * 1.6), 1000px);
  }
  .has-motion .device-scene.is-trio {
    width: min(72%, calc((100vh - 436px) * 1.667), 1040px);
  }
  /* Le bureau de la carte remplace celui du trio (l'ombre de contact est dans le dessin de l'ordinateur). */
  .has-motion .device-scene.is-trio::before {
    display: none;
  }
  .has-motion .work-progress {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 38px;
    z-index: 3;
    display: flex;
    gap: 8px;
    pointer-events: none;
  }
  .work-progress span {
    flex: 1;
    height: 2px;
    background: rgb(255 255 255 / 0.22);
    overflow: hidden;
  }
  .work-progress span::after {
    content: "";
    display: block;
    height: 100%;
    background: #fff;
    transform: scaleX(var(--fill, 0));
    transform-origin: left;
  }
  .has-motion .work-hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 16px;
    z-index: 3;
    display: block;
    font-size: 9px;
    letter-spacing: 0.28em;
    text-align: center;
    color: rgb(255 255 255 / 0.5);
    pointer-events: none;
  }
}
/* Carte étroite : la consigne se resserre à gauche de l'heure (barre du bas), qui recouvre le coin de la carte. */
@media (min-width: 1024px) and (max-width: 1279px) {
  .has-motion .work-hint {
    padding: 0 150px 0 20px;
    letter-spacing: 0.16em;
  }
}
/* Écrans peu hauts : la colonne de gauche se resserre pour ne pas passer sous la barre du bas. */
@media (min-width: 1024px) and (max-height: 720px) {
  .has-motion .work-text {
    margin-top: 14px;
  }
  .has-motion .work-thumbs {
    gap: 4px;
    margin-top: 22px;
  }
  .has-motion .work-intro .solid-btn {
    margin-top: 24px;
  }
}


/* ---------- Animations (états posés par work-pinned.js ; rien n'est masqué sans .has-motion) ---------- */
@media (min-width: 1024px) {
  /* La scène qui arrive grandit jusqu'à sa place, les appareils se resserrent autour du Mac (--d, --ad, work-pinned.js). */
  .has-motion .work-card .work-visual {
    scale: calc(1 - var(--ad, 0) * 0.14);
    opacity: calc(1 - var(--ad, 0) * 0.55);
  }
  .has-motion .work-card-head {
    translate: 0 calc(var(--d, 0) * 46px);
    opacity: calc(1 - var(--ad, 0) * 0.85);
  }
  .has-motion .is-trio .device-tablet {
    translate: calc(var(--d, 0) * 22%) calc(var(--ad, 0) * 8%);
  }
  .has-motion .is-trio .device-phone {
    translate: calc(var(--d, 0) * -38%) calc(var(--ad, 0) * 10%);
  }
  /* Vignettes : les autres projets en réduit, l'actif à pleine taille ; le survol en approche un. */
  .has-motion .work-thumbs button {
    scale: 0.78;
    transition: scale 0.6s var(--ease-expo);
  }
  .has-motion .work-thumbs button:hover {
    scale: 0.84;
  }
  .has-motion .work-thumbs li.is-active button {
    scale: 1;
  }
  /* Sur la carte sombre, et dans son cadre (qui coupe ce qui dépasse) : un cadre de focus blanc, à l'intérieur. */
  .has-motion .work-card-link:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -6px;
  }
}
