/* ==========================================================
   PROJETS EN DÉFILEMENT HORIZONTAL (index-design.html uniquement)
   La section se bloque, les projets passent de côté en grandes cartes ;
   dans chaque carte, le vrai site défile dans une fenêtre de navigateur.
   ========================================================== */

.pj.ph-on .pj-grid { display: none; }

.ph {
    position: relative;
    height: calc(100vh - 70px);
    height: calc(100svh - 70px);
    min-height: 560px;
    overflow: hidden;
}

.ph-track {
    display: flex;
    align-items: center;
    gap: clamp(20px, 2.5vw, 40px);
    height: 100%;
    width: max-content;
    padding: 0 max(24px, 6vw);
    will-change: transform;
}

/* ---------- carte projet ---------- */
.ph-card {
    --pc: #1c1a19;
    position: relative;
    flex: 0 0 auto;
    width: min(78vw, 1180px);
    height: auto;                       /* la carte s'adapte à son contenu… */
    max-height: calc(100% - 64px);      /* …sans dépasser la hauteur de l'écran */
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.35fr);
    gap: clamp(20px, 3vw, 48px);
    align-items: center;
    padding: clamp(24px, 3vw, 44px);
    border-radius: 22px;
    background: var(--pc);
    color: #fff;
    overflow: hidden;
    box-shadow: 0 30px 70px rgba(28, 26, 25, 0.22);
}

/* grand numéro en fond */
.ph-card::before {
    content: attr(data-n);
    position: absolute;
    left: -0.04em;
    bottom: -0.2em;
    font: 400 clamp(10rem, 22vw, 20rem)/1 'Anton', 'Impact', sans-serif;
    color: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.ph-info { position: relative; min-width: 0; }

.ph-num {
    margin: 0 0 0.8rem;
    font: 600 0.75rem 'JetBrains Mono', monospace;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.8;
}

.ph-name {
    margin: 0 0 1rem;
    font: 400 clamp(1.9rem, min(3vw, 6.2vh), 3.3rem)/0.95 'Anton', 'Impact', sans-serif;
    text-transform: uppercase;
    text-wrap: balance;
}

.ph-desc { margin: 0 0 1.2rem; max-width: 34em; font-size: 0.95rem; line-height: 1.6; opacity: 0.92; }

.ph-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 1.6rem; padding: 0; list-style: none; }
.ph-tags li {
    padding: 5px 10px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    font: 600 0.7rem 'JetBrains Mono', monospace;
}

.ph-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 20px;
    background: #fff;
    color: var(--pc);
    font: 0.88rem/1 'Anton', 'Impact', sans-serif;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: background 0.3s ease, color 0.3s ease;
}

.ph-link:hover { background: #1c1a19; color: #fff; }
.ph-link:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* ---------- fenêtre de navigateur ---------- */
.ph-window {
    position: relative;
    min-width: 0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}

.ph-bar { display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; background: #ecebe8; }
.ph-bar i { width: 9px; height: 9px; border-radius: 50%; background: #e34f26; }
.ph-bar i:nth-child(2) { background: #e0a526; }
.ph-bar i:nth-child(3) { background: #2f9e6a; }
.ph-bar span {
    flex: 1;
    min-width: 0;
    margin-left: 8px;
    padding: 0 10px;
    border-radius: 5px;
    background: #fff;
    font: 0.66rem/18px 'JetBrains Mono', monospace;
    color: #7d7670;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ph-view { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #f4f2ef; }
.ph-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.ph-frame {
    position: absolute;
    left: 0;
    top: 0;
    width: 1440px;
    height: 900px;
    border: 0;
    transform-origin: 0 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.ph-view.is-live .ph-frame { opacity: 1; }

/* ---------- dernière carte : votre projet ---------- */
.ph-end {
    flex: 0 0 auto;
    width: min(46vw, 640px);
    height: min(76%, 640px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(24px, 3vw, 44px);
    border: 2px dashed rgba(28, 26, 25, 0.35);
    border-radius: 22px;
    color: #1c1a19;
}

.ph-end p { margin: 0; font: 600 0.75rem 'JetBrains Mono', monospace; letter-spacing: 0.14em; text-transform: uppercase; color: #4a4542; }
.ph-end h3 { margin: 0; font: 400 clamp(2.4rem, 4.6vw, 4.6rem)/0.95 'Anton', 'Impact', sans-serif; text-transform: uppercase; }
.ph-end .ph-soon { font: 0.95rem/1.6 inherit; letter-spacing: 0; text-transform: none; }
.ph-end .ph-link { align-self: flex-start; background: #e34f26; color: #fff; }
.ph-end .ph-link:hover { background: #1c1a19; }

/* ---------- compteur 01 / 06 ---------- */
.ph-count {
    position: absolute;
    left: max(24px, 6vw);
    bottom: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    font: 600 0.75rem 'JetBrains Mono', monospace;
    color: #4a4542;
}

.ph-count b { color: #1c1a19; font-weight: 600; }
.ph-count i { display: block; width: 160px; height: 2px; background: rgba(28, 26, 25, 0.15); }
.ph-count i::after {
    content: '';
    display: block;
    height: 100%;
    background: #1c1a19;
    transform: scaleX(var(--ph-p, 0));
    transform-origin: left;
}

/* ---------- écrans d'ordinateur peu hauts (portables) ---------- */
@media (min-width: 861px) and (max-height: 800px) {
    .ph-card { padding: 26px 30px; }
    .ph-num { margin-bottom: 0.5rem; }
    .ph-name { margin-bottom: 0.7rem; }
    .ph-desc {
        margin-bottom: 0.9rem;
        font-size: 0.88rem;
        line-height: 1.5;
        display: -webkit-box;
        -webkit-line-clamp: 4;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .ph-tags { margin-bottom: 1.1rem; }
    .ph-link { padding: 11px 18px; }
    .ph-end { height: auto; max-height: calc(100% - 64px); gap: 20px; }
}

/* ---------- téléphone : on fait glisser au doigt ---------- */
@media (max-width: 860px) {
    .ph { height: auto; min-height: 0; overflow: visible; padding-bottom: 50px; }
    .ph-track {
        width: auto;
        height: auto;
        padding: 10px 16px 24px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .ph-track::-webkit-scrollbar { display: none; }
    .ph-card, .ph-end { width: 86vw; height: auto; scroll-snap-align: center; }
    .ph-card { grid-template-columns: 1fr; }
    .ph-card .ph-window { order: -1; }
    .ph-count { left: 16px; bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .ph { height: auto; overflow: visible; }
    .ph-track { width: auto; flex-wrap: wrap; height: auto; padding: 24px; }
    .ph-card, .ph-end { width: 100%; height: auto; }
    .ph-count { display: none; }
}
