/* ============================================
   PROJETS — vitrine plein écran (js/views/projects.js, js/controllers/showcase.js)
   ============================================
   Un calque fixe qui couvre l'écran, fermé par défaut. Toutes les cartes
   tiennent dans la hauteur de l'écran : la grille partage la place restante
   en rangées égales, et chaque carte montre plus ou moins de détails selon sa
   taille (requêtes de conteneur). */

/* Page bloquée tant que la vitrine est ouverte. */
html.is-locked { overflow: hidden; }

/* Le contenu passe au-dessus du pied de page et du lanceur de l'assistant. */
html.showcase-open main { z-index: 45; }
html.showcase-open :is(.chat-launcher, .chat-scrim, .chat-dock) { visibility: hidden; }

.showcase {
    --sc-pad: clamp(16px, 3vw, 40px);
    position: fixed;
    inset: 0;
    z-index: 40;
    height: 100svh;
    overflow: hidden;
    overscroll-behavior: contain;
    visibility: hidden;
    pointer-events: none;
}

.showcase.is-open,
.showcase.is-closing { visibility: visible; }
.showcase.is-open { pointer-events: auto; }

/* Fond : il couvre le parcours. À l'impact il arrive en fondu, pour laisser
   voir les mains qui se dissolvent. */
.showcase::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 45% at var(--impact-x, 50%) 100%, rgba(255, 255, 255, 0.05), transparent 70%),
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(255, 255, 255, 0.03), transparent 70%),
        var(--surface-lowest);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.showcase.is-open::before { opacity: 1; }
.showcase.is-open.is-impact::before { transition-duration: 0.9s; }
.showcase.is-closing { opacity: 0; transition: opacity 0.35s ease; }

.sc-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

.sc-inner {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 1.6vh, 20px);
    max-width: 96rem;
    margin: 0 auto;
    padding: var(--sc-pad) var(--sc-pad) clamp(12px, 2vh, 24px);
}

/* ---------- En-tête : titre et filtres repliés ---------- */
.sc-head,
.sc-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.showcase.is-ui :is(.sc-head, .sc-foot) { opacity: 1; transform: none; }

.sc-heading {
    font-family: var(--font-display);
    font-size: clamp(20px, 2.2vw, 30px);
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1;
}

.sc-heading:focus { outline: none; }

.sc-total {
    margin-left: 0.35em;
    font-family: var(--font-mono);
    font-size: 0.45em;
    letter-spacing: 0.1em;
    color: var(--outline);
    vertical-align: super;
}

.sc-filters { position: relative; }

/* Un seul bouton, à peine visible ; il affiche le filtre en cours. */
.sc-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 4px;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: 0.06em;
    color: var(--outline);
    border-bottom: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.sc-filter-toggle .icon { font-size: 16px; }
.sc-filter-toggle:hover,
.sc-filter-toggle[aria-expanded="true"] { color: var(--on-surface); }
.sc-filter-toggle.is-set { color: var(--on-surface); border-bottom-color: var(--outline-variant); }

.sc-filter-panel {
    position: absolute;
    z-index: 5;
    top: calc(100% + 8px);
    right: 0;
    width: min(320px, calc(100vw - 2 * var(--sc-pad)));
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-md);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    background: rgba(17, 17, 17, 0.94);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}

.sc-filter-group {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
}

.sc-filter-label {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--outline);
}

.sc-filter-opt {
    padding: 2px 0;
    font-size: var(--text-sm);
    color: var(--on-surface-variant);
    border-bottom: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.sc-filter-opt:hover { color: var(--on-surface); }
.sc-filter-opt.active { color: var(--on-surface); border-bottom-color: var(--on-surface); }

.sc-filter-reset {
    align-self: flex-start;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--outline);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.sc-filter-reset:disabled { opacity: 0.4; cursor: default; text-decoration: none; }

/* ---------- Grille : tout tient dans l'écran ---------- */
.sc-grid {
    --cols: 4;
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    gap: clamp(8px, 1.2vw, 16px);
    padding: 0;
    list-style: none;
}

@media (max-width: 1100px) { .sc-grid { --cols: 3; } }
@media (max-width: 640px) { .sc-grid { --cols: 2; } }
/* Écran bas et large (téléphone couché) : plus de colonnes, moins de rangées. */
@media (max-height: 520px) and (min-width: 640px) { .sc-grid { --cols: 6; } }

.sc-cell {
    min-height: 0;
    container-type: size;
    transition: opacity 0.3s ease;
}

.sc-cell.is-dim { opacity: 0.16; }

.sc-card {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    overflow: hidden;
    padding: clamp(10px, 6cqmin, 18px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    background: linear-gradient(160deg, rgba(40, 40, 40, 0.82), rgba(14, 14, 14, 0.9));
    text-align: left;
    /* Avant sa flaque, la carte est invisible. */
    opacity: 0;
    transform: translateY(10px) scale(0.94);
    filter: blur(6px);
    transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.5s ease, border-color 0.2s, background 0.2s;
}

/* Ouverture directe : les cartes arrivent en cascade. */
.showcase:not(.is-impact) .sc-card { transition-delay: calc(var(--i, 0) * 35ms); }

.sc-cell.is-in .sc-card { opacity: 1; transform: none; filter: none; }
.sc-cell.is-in .sc-card:hover { transition-delay: 0s; }

.sc-card:hover,
.sc-card:focus-visible {
    border-color: rgba(255, 255, 255, 0.2);
    background: linear-gradient(160deg, rgba(52, 52, 52, 0.9), rgba(18, 18, 18, 0.92));
}

.sc-card-top {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sc-index {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--outline);
}

.sc-icon {
    font-size: clamp(18px, 9cqmin, 26px);
    color: var(--on-surface-variant);
}

.sc-title {
    font-family: var(--font-display);
    font-size: clamp(13px, 7.5cqmin, 19px);
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--on-surface);
    text-wrap: balance;
}

.sc-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--outline);
}

.sc-desc {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.5;
    color: var(--on-surface-variant);
}

.sc-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: auto;
}

.sc-tech span {
    padding: 2px 7px;
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--on-surface-variant);
}

.sc-open {
    position: absolute;
    right: 10px;
    bottom: 10px;
    font-size: 16px;
    color: var(--outline);
    opacity: 0;
    transition: opacity 0.2s;
}

.sc-card:hover .sc-open,
.sc-card:focus-visible .sc-open { opacity: 1; }

/* La carte ne garde que l'essentiel quand la place manque. */
@container (max-height: 230px) { .sc-desc { -webkit-line-clamp: 2; } }
@container (max-height: 180px) { .sc-desc { display: none; } }
@container (max-height: 130px) { .sc-tech, .sc-index { display: none; } }
@container (max-height: 96px) {
    .sc-meta { display: none; }
    .sc-card { justify-content: center; gap: 4px; }
    .sc-card-top { width: auto; }
}
@container (max-width: 170px) { .sc-tech span:nth-child(n + 3) { display: none; } }

/* ---------- Pied : Continuer au centre, Passer à droite ---------- */
.sc-foot {
    position: relative;
    justify-content: center;
    min-height: 44px;
}

.sc-continue {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.showcase.is-done .sc-continue { opacity: 1; transform: none; pointer-events: auto; }

.sc-skip {
    position: absolute;
    right: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--outline);
    transition: color 0.2s, opacity 0.3s;
}

.sc-skip .icon { font-size: 16px; }
.sc-skip:hover { color: var(--on-surface); }
.showcase.is-done .sc-skip { opacity: 0; pointer-events: none; visibility: hidden; }

/* ---------- Projet agrandi ---------- */
.sc-zoom {
    position: fixed;
    z-index: 10;
    inset: clamp(10px, 3vw, 40px);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xl);
    background: linear-gradient(160deg, #262626, #0e0e0e 70%);
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7);
    transform-origin: top left;
}

.showcase.is-zooming .sc-inner { opacity: 0.25; transition: opacity 0.3s ease; }

.sc-zoom-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding: clamp(24px, 5vw, 72px);
}

.sc-zoom-body:focus { outline: none; }

.sc-zoom-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border-glass);
    border-radius: 50%;
    background: rgba(10, 10, 10, 0.6);
    color: var(--on-surface);
    transition: background 0.2s;
}

.sc-zoom-close:hover { background: rgba(60, 60, 60, 0.8); }

.sc-detail {
    max-width: 56rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: clamp(14px, 2.2vh, 24px);
}

.sc-detail-top {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sc-detail-top .sc-icon { font-size: 32px; }

.sc-detail-title {
    font-family: var(--font-display);
    font-size: clamp(28px, 5vw, 64px);
    font-weight: 500;
    line-height: 1.02;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

.sc-detail-desc {
    max-width: 44rem;
    font-size: clamp(16px, 1.4vw, 19px);
    line-height: 1.6;
    color: var(--on-surface-variant);
}

.sc-detail-role {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 44rem;
    padding-left: var(--space-md);
    border-left: 1px solid var(--outline-variant);
}

.sc-detail-role p { font-size: var(--text-sm); line-height: 1.7; color: var(--on-surface-variant); }

.sc-detail-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
    list-style: none;
}

.sc-detail-tech li {
    padding: 4px 11px;
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--on-surface);
}

.sc-detail-tech .is-ac { border-style: dashed; color: var(--outline); }

.sc-detail-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm) var(--space-lg);
}

.sc-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-sm);
    color: var(--on-surface);
    border-bottom: 1px solid var(--outline-variant);
    padding-bottom: 2px;
    transition: border-color 0.2s;
}

.sc-link .icon { font-size: 16px; }
.sc-link:hover { border-color: var(--on-surface); }
.sc-link.is-private { color: var(--outline); border-bottom-style: dashed; }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
    .sc-card { border-radius: var(--radius-md); }
    .sc-meta { font-size: 10px; }
}

/* ---------- Mouvement réduit : section ordinaire, dans le flux ---------- */
.showcase.is-static {
    position: relative;
    inset: auto;
    z-index: auto;
    height: auto;
    overflow: visible;
    visibility: visible;
    pointer-events: auto;
    padding: var(--space-2xl) 0;
}

.showcase.is-static::before { opacity: 1; }
.showcase.is-static .sc-canvas,
.showcase.is-static .sc-foot { display: none; }
.showcase.is-static .sc-inner { height: auto; }
.showcase.is-static :is(.sc-head, .sc-card) { opacity: 1; transform: none; filter: none; transition: none; }
.showcase.is-static .sc-grid { grid-auto-rows: minmax(200px, auto); }
.showcase.is-static .sc-cell { container-type: inline-size; }
