/* Projets neufs : section expertise interactive.
   4 panneaux en accordéon horizontal ; le panneau ouvert montre photo, texte et livrables.
   Inspiration 21st.dev : « Hover Expand Gallery » (kedhareswer) + « Animated Progress Stepper » (shadcnspace),
   réécrits en CSS et JS natifs. */

.pnx-head { max-width: 760px; margin-bottom: clamp(32px, 4vw, 48px); }
.pnx-head .h2 { margin-bottom: 18px; }

.pnx-rail { display: flex; gap: 10px; height: clamp(440px, 38vw, 520px); }
.pnx-panel { --open: 0; position: relative; flex: 1 1 0; min-width: 0; border-radius: 24px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); transition: flex-grow .8s var(--ease), background-color .5s, border-color .5s; }
.pnx-panel.is-open { flex-grow: 4.2; border-color: transparent; background: var(--accent); }
.pnx-panel:not(.is-open):hover { background: var(--surface-2); }

/* onglet : toute la hauteur du panneau fermé, puis bandeau en haut du panneau ouvert */
.pnx-tab { all: unset; box-sizing: border-box; position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: flex-start; padding: 22px; cursor: pointer; color: var(--ink); }
.pnx-panel.is-open .pnx-tab { inset: 0 0 auto 0; height: auto; flex-direction: row; align-items: center; gap: 14px; color: #fff; cursor: default; }
.pnx-tab:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 24px; }
.pnx-panel.is-open .pnx-tab:focus-visible { box-shadow: inset 0 0 0 2px #fff; }
.pnx-num { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--muted); letter-spacing: .02em; }
.pnx-panel.is-open .pnx-num { color: rgba(255, 255, 255, .7); }
.pnx-ico { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; margin-top: 16px; background: var(--accent-soft); color: var(--accent); transition: transform .5s var(--ease), background-color .4s, color .4s; }
.pnx-panel:not(.is-open):hover .pnx-ico { transform: translateY(-3px) rotate(-6deg); background: var(--accent); color: #fff; }
.pnx-panel.is-open .pnx-ico { margin-top: 0; width: 38px; height: 38px; font-size: 18px; background: rgba(255, 255, 255, .14); color: #fff; }
/* titre vertical sur les panneaux fermés */
.pnx-label { flex: 1 1 auto; min-height: 0; margin-top: 20px; writing-mode: vertical-rl; transform: rotate(180deg); text-align: left; font-size: 16px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.25; overflow: hidden; }
.pnx-panel.is-open .pnx-label { display: none; }
/* barre de progression du défilement automatique */
.pnx-bar { position: absolute; left: 22px; right: 22px; top: 0; height: 3px; border-radius: 0 0 3px 3px; overflow: hidden; opacity: 0; }
.pnx-bar i { display: block; height: 100%; background: #fff; transform: scaleX(0); transform-origin: left; }
.pnx-rail.is-auto .pnx-panel.is-open .pnx-bar { opacity: .9; }
.pnx-rail.is-auto .pnx-panel.is-open .pnx-bar i { animation: pnx-fill var(--pnx-dur, 7s) linear forwards; }
@keyframes pnx-fill { to { transform: scaleX(1); } }

/* contenu du panneau ouvert */
.pnx-body { position: absolute; inset: 0; display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; opacity: 0; pointer-events: none; transition: opacity .3s; }
.pnx-body[hidden] { display: grid; }
.pnx-panel.is-open .pnx-body { opacity: 1; pointer-events: auto; transition: opacity .6s .3s; }
.pnx-body img { order: 2; width: calc(100% - 12px); height: calc(100% - 24px); margin: 12px 12px 12px 0; object-fit: cover; border-radius: 18px; transform: scale(1.06); transition: transform 1.6s var(--ease); }
.pnx-panel.is-open .pnx-body img { transform: scale(1); }
.pnx-copy { display: flex; flex-direction: column; justify-content: flex-end; padding: 84px 28px 28px; color: #fff; }
.pnx-copy h3 { font-size: clamp(1.5rem, 2.2vw, 2.1rem); font-weight: 500; letter-spacing: -0.035em; line-height: 1.08; color: #fff; }
.pnx-copy p { margin: 14px 0 0; color: rgba(255, 255, 255, .82); font-size: 15.5px; line-height: 1.5; max-width: 40ch; }
.pnx-copy ul { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 8px; }
.pnx-copy li { display: flex; align-items: center; gap: 10px; font-size: 14.5px; color: #fff; opacity: 0; transform: translateY(10px); }
.pnx-copy li::before { content: ""; flex: none; width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, .16) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 12px no-repeat; }
.pnx-panel.is-open .pnx-copy li { opacity: 1; transform: none; transition: opacity .5s, transform .6s var(--ease); }
.pnx-panel.is-open .pnx-copy li:nth-child(1) { transition-delay: .45s; }
.pnx-panel.is-open .pnx-copy li:nth-child(2) { transition-delay: .55s; }
.pnx-panel.is-open .pnx-copy li:nth-child(3) { transition-delay: .65s; }

/* logos des promotions accompagnées */
.pnx-logos { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 22px 32px; margin-top: clamp(36px, 4vw, 52px); padding-top: 28px; border-top: 1px solid var(--line); }
.pnx-logos img { height: 30px; width: auto; max-width: 130px; object-fit: contain; filter: brightness(0); opacity: .38; transition: opacity .3s, transform .4s var(--ease); }
.pnx-logos img:hover { opacity: .85; transform: translateY(-2px); }
:root[data-theme="dark"] .pnx-logos img { filter: brightness(0) invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pnx-logos img { filter: brightness(0) invert(1); } }

/* tablette : panneaux plus étroits, texte au-dessus de la photo */
@media (max-width: 1100px) {
  .pnx-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .pnx-body img { order: 2; width: calc(100% - 24px); height: calc(100% - 12px); margin: 0 12px 12px; }
  .pnx-copy { padding: 76px 24px 18px; }
  .pnx-copy ul { grid-template-columns: 1fr; }
  .pnx-rail { height: 620px; }
}
/* mobile : accordéon vertical */
@media (max-width: 760px) {
  .pnx-rail { flex-direction: column; height: auto; }
  .pnx-panel { flex: none; height: 76px; transition: height .7s var(--ease), background-color .5s; }
  .pnx-panel.is-open { height: 560px; }
  .pnx-tab { flex-direction: row; align-items: center; gap: 14px; padding: 16px 18px; }
  .pnx-ico { margin-top: 0; width: 40px; height: 40px; }
  .pnx-label { writing-mode: horizontal-tb; transform: none; margin: 0; font-size: 15.5px; }
  .pnx-panel.is-open .pnx-tab { padding: 16px 18px; }
  .pnx-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .pnx-copy { padding: 72px 20px 14px; }
  .pnx-copy p { font-size: 14.5px; }
  .pnx-body img { width: calc(100% - 20px); height: calc(100% - 10px); margin: 0 10px 10px; }
  .pnx-logos { justify-content: center; }
  .pnx-logos img { height: 24px; max-width: 100px; }
}
@media (prefers-reduced-motion: reduce) {
  .pnx-panel, .pnx-body, .pnx-body img, .pnx-copy li, .pnx-ico { transition: none !important; }
  .pnx-rail .pnx-bar { display: none; }
}
