/***************************************************************************************
 * CGT — MODÈLES DE TRACTS
 * Archive visuelle + single + authentification.
 ***************************************************************************************/

.tracts-model-page-wrap {
    margin-top: 8rem;
}

.tracts-model-library,
.tracts-model-auth {
    --model-red: #ef3e3e;
    --model-red-dark: #d83131;
    --model-text: #212529;
    --model-muted: #6b7280;
    --model-soft: #f7f7f6;
    --model-border: rgba(0, 0, 0, .10);
    --model-shadow: 0 12px 34px rgba(0, 0, 0, .07);
    width: 100%;
    max-width: 1280px;
    margin: 0 auto 6rem;
    padding: 0 1rem;
    color: var(--model-text);
}

.tracts-model-library *,
.tracts-model-auth * {
    box-sizing: border-box;
}

.tracts-model-eyebrow {
    margin: 0 0 .55rem;
    color: var(--model-red);
    font-size: .75rem;
    line-height: 1.2;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* HERO */
.tracts-model-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 3rem;
    align-items: center;
    margin: 1.5rem 0 1.75rem;
    padding: 2.65rem;
    border: 1px solid var(--model-border);
    border-radius: 24px;
    background: #fff;
    box-shadow: var(--model-shadow);
}

.tracts-model-title {
    margin: 0;
    color: var(--model-text);
    font-size: clamp(2.6rem, 5vw, 4.2rem);
    line-height: .96;
    font-weight: 900;
}

.tracts-model-title span {
    display: block;
    margin-top: .2rem;
    color: var(--model-red);
    font-family: Georgia, 'Times New Roman', serif;
    font-style: italic;
    font-weight: 400;
}

.tracts-model-lead {
    max-width: 760px;
    margin: 1.25rem 0 1.35rem;
    color: var(--model-muted);
    font-size: 1.1rem;
    line-height: 1.55;
}

.tracts-model-hero__notes {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
}

.tracts-model-hero__notes span {
    padding: .55rem .75rem;
    border-radius: 10px;
    background: var(--model-soft);
    color: #555;
    font-size: .8rem;
    font-weight: 700;
}

.tracts-model-hero__visual {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tracts-model-sheets {
    position: relative;
    width: 150px;
    height: 170px;
}

.tracts-model-sheets span {
    position: absolute;
    inset: 0;
    display: block;
    border: 3px solid var(--model-red);
    border-radius: 8px;
    background: #fff;
}

.tracts-model-sheets span:nth-child(1) { transform: translate(-15px, 9px) rotate(-7deg); opacity: .35; }
.tracts-model-sheets span:nth-child(2) { transform: translate(14px, 6px) rotate(6deg); opacity: .55; }
.tracts-model-sheets span:nth-child(3) { transform: none; }
.tracts-model-sheets span:nth-child(3)::before,
.tracts-model-sheets span:nth-child(3)::after {
    content: '';
    position: absolute;
    left: 20px;
    right: 20px;
    height: 4px;
    border-radius: 4px;
    background: var(--model-red);
}
.tracts-model-sheets span:nth-child(3)::before { top: 34px; box-shadow: 0 18px 0 rgba(239,62,62,.45), 0 36px 0 rgba(239,62,62,.22); }
.tracts-model-sheets span:nth-child(3)::after { top: 105px; right: 58px; }

.tracts-model-hero__count {
    position: relative;
    z-index: 2;
    min-width: 175px;
    margin-top: -15px;
    padding: .8rem 1rem;
    border: 1px solid var(--model-border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 7px 20px rgba(0,0,0,.08);
    text-align: center;
}

.tracts-model-hero__count strong { display: block; font-size: 1.65rem; line-height: 1; font-weight: 900; }
.tracts-model-hero__count span { display: block; margin-top: .35rem; color: var(--model-muted); font-size: .75rem; font-weight: 700; }

/* OUTILS */
.tracts-model-tools {
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 2.5rem;
    padding: .9rem;
    border: 1px solid var(--model-border);
    border-radius: 16px;
    background: rgba(255,255,255,.97);
    box-shadow: 0 10px 28px rgba(0,0,0,.07);
    backdrop-filter: blur(10px);
}

.admin-bar .tracts-model-tools { top: 32px; }

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

.tracts-model-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: .65rem;
    width: min(100%, 540px);
    min-height: 48px;
    padding: 0 2.8rem 0 .85rem;
    border: 1px solid rgba(0,0,0,.13);
    border-radius: 12px;
    background: #fff;
}

.tracts-model-search:focus-within {
    border-color: rgba(239,62,62,.55);
    box-shadow: 0 0 0 4px rgba(239,62,62,.10);
}

.tracts-model-search svg { flex: 0 0 auto; color: #777; }
.tracts-model-search input[type='search'] {
    flex: 1 1 auto;
    width: 100%;
    height: 46px;
    padding: 0;
    border: 0 !important;
    background: transparent;
    box-shadow: none !important;
    color: var(--model-text);
    font: inherit;
    font-size: .92rem;
}

.tracts-model-search__clear {
    position: absolute;
    top: 50%;
    right: .55rem;
    width: 30px;
    height: 30px;
    transform: translateY(-50%);
    border: 0;
    border-radius: 50%;
    background: #eee;
    color: #444;
    font-size: 1.25rem;
    line-height: 1;
}

.tracts-model-results { flex: 0 0 auto; color: var(--model-muted); font-size: .84rem; font-weight: 700; }
.tracts-model-results strong { color: var(--model-text); }

.tracts-model-filters {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr)) auto;
    gap: .6rem;
    align-items: end;
    margin-top: .75rem;
}

.tracts-model-filter { min-width: 0; margin: 0; }
.tracts-model-filter > span {
    display: block;
    margin: 0 0 .3rem .1rem;
    color: #666;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.tracts-model-filter select {
    width: 100%;
    height: 40px;
    padding: 0 2rem 0 .65rem;
    border: 1px solid rgba(0,0,0,.12);
    border-radius: 9px;
    background: #fff;
    color: var(--model-text);
    font: inherit;
    font-size: .78rem;
    font-weight: 650;
}

.tracts-model-reset {
    height: 40px;
    padding: 0 .8rem;
    border: 1px solid var(--model-border);
    border-radius: 9px;
    background: var(--model-soft);
    color: #555;
    font: inherit;
    font-size: .75rem;
    font-weight: 800;
}
.tracts-model-reset:hover { background: #ececec; color: #222; }

/* CATALOGUE */
.tracts-model-section-head { margin-bottom: 1.25rem; }
.tracts-model-section-head h2 { margin: 0; color: var(--model-text); font-size: clamp(1.7rem, 3vw, 2.25rem); line-height: 1.1; font-weight: 900; }

.tracts-model-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.1rem;
}

.tracts-model-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--model-border);
    border-radius: 18px;
    background: #fff;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.tracts-model-card:hover { transform: translateY(-3px); border-color: rgba(239,62,62,.25); box-shadow: 0 14px 32px rgba(0,0,0,.09); }
.tracts-model-card[hidden] { display: none !important; }

.tracts-model-card__visual {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    padding: 1rem;
    overflow: hidden;
    background: #f1f1f1;
    text-decoration: none !important;
}
.tracts-model-card__visual img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: drop-shadow(0 8px 15px rgba(0,0,0,.12));
    transition: transform .3s ease;
}
.tracts-model-card:hover .tracts-model-card__visual img { transform: scale(1.02); }

.tracts-model-card__placeholder { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: #aaa; }

.tracts-model-card__visual-badges {
    position: absolute;
    left: .8rem;
    bottom: .8rem;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}
.tracts-model-card__visual-badges span {
    padding: .35rem .5rem;
    border-radius: 7px;
    background: #fff;
    color: #444;
    font-size: .68rem;
    font-weight: 900;
    box-shadow: 0 4px 15px rgba(0,0,0,.12);
}

.tracts-model-card__body { display: flex; flex: 1; flex-direction: column; padding: 1.15rem; }
.tracts-model-card__category { margin-bottom: .45rem; color: var(--model-red); font-size: .68rem; line-height: 1.2; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.tracts-model-card__title { margin: 0; font-size: 1.12rem; line-height: 1.25; font-weight: 900; }
.tracts-model-card__title a { color: var(--model-text); text-decoration: none !important; }
.tracts-model-card__excerpt { margin: .65rem 0 0; color: var(--model-muted); font-size: .82rem; line-height: 1.45; }
.tracts-model-card__chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .8rem; }
.tracts-model-card__chip { padding: .22rem .42rem; border-radius: 6px; background: var(--model-soft); color: #666; font-size: .68rem; font-weight: 650; }
.tracts-model-card__chip--software { background: rgba(240,62,62,.08); color: var(--model-red); font-weight: 850; }
.tracts-model-card__chip--more { color: var(--model-muted); font-weight: 800; }
.tracts-model-card__actions { display: flex; flex-direction: column; gap: .5rem; margin-top: auto; padding-top: 1.1rem; }
.tracts-model-card__details { width: 100%; }
.tracts-model-card__downloads { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .45rem; }
.tracts-model-card__download { width: 100%; min-width: 0; padding-inline: .65rem; }
.tracts-model-card__download span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* BUTTONS */
.tracts-model-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 42px;
    padding: 0 .8rem;
    border-radius: 9px;
    font: inherit;
    font-size: .76rem;
    line-height: 1;
    font-weight: 900;
    text-decoration: none !important;
}
.tracts-model-btn--primary { border: 1px solid var(--model-red); background: var(--model-red); color: #fff; }
.tracts-model-btn--primary:hover { border-color: var(--model-red-dark); background: var(--model-red-dark); color: #fff; }
.tracts-model-btn--secondary { border: 1px solid var(--model-border); background: #fff; color: var(--model-text); }
.tracts-model-btn--secondary:hover { background: #f3f3f3; color: var(--model-text); }
.tracts-model-btn--locked { border: 1px solid #d6d6d6; background: #f2f2f2; color: #777; cursor: pointer; }
.tracts-model-btn--locked:hover { border-color: #bdbdbd; background: #e9e9e9; color: #444; }
.tracts-model-btn--disabled { border: 1px solid #e1e1e1; background: #f5f5f5; color: #aaa; cursor: default; }

.tracts-model-empty { margin: 1.5rem 0; padding: 3rem 1.5rem; border: 1px dashed #ccc; border-radius: 18px; background: #fafafa; text-align: center; }
.tracts-model-empty h3 { margin: 0 0 .45rem; font-size: 1.25rem; font-weight: 900; }
.tracts-model-empty p { margin: 0 0 1rem; color: var(--model-muted); }

/* SINGLE */
.tracts-model-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 1rem 0 1.2rem; color: var(--model-muted); font-size: .78rem; font-weight: 700; }
.tracts-model-breadcrumb a { color: var(--model-red); text-decoration: none; }

.tracts-model-single__hero { display: grid; grid-template-columns: minmax(0, 1.03fr) minmax(360px, .97fr); gap: 2rem; align-items: start; }
.tracts-model-single__preview { min-height: 580px; padding: 1.5rem; border-radius: 22px; background: #f1f1f1; }
.tracts-model-single__image { display: block; width: 100%; height: 100%; max-height: 720px; object-fit: contain; filter: drop-shadow(0 16px 25px rgba(0,0,0,.15)); }
.tracts-model-single__placeholder { min-height: 540px; }
.tracts-model-single__summary { padding: 1.2rem 0; }
.tracts-model-single__summary h1 { margin: 0; color: var(--model-text); font-size: clamp(2.35rem, 4vw, 4rem); line-height: 1; font-weight: 900; }
.tracts-model-single__lead { margin: 1.1rem 0; color: var(--model-muted); font-size: 1.05rem; line-height: 1.55; }
.tracts-model-single__quick-meta { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0 1.35rem; }
.tracts-model-single__quick-meta span { padding: .38rem .58rem; border-radius: 8px; background: var(--model-soft); color: #555; font-size: .72rem; font-weight: 800; }

.tracts-model-download-box { padding: 1.25rem; border: 1px solid rgba(239,62,62,.18); border-radius: 17px; background: rgba(239,62,62,.04); }
.tracts-model-download-box__head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.tracts-model-download-box__head h2 { margin: 0; font-size: 1.25rem; font-weight: 900; }
.tracts-model-download-box__status { flex: 0 0 auto; padding: .38rem .55rem; border-radius: 999px; background: #fff; color: #777; font-size: .67rem; font-weight: 800; }
.tracts-model-download-list { display: grid; gap: .55rem; margin-top: 1rem; }
.tracts-model-download-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem; border-radius: 11px; background: #fff; }
.tracts-model-download-item strong { display: block; color: var(--model-text); font-size: .85rem; font-weight: 900; }
.tracts-model-download-item span { display: block; margin-top: .2rem; color: var(--model-muted); font-size: .7rem; }
.tracts-model-download-box__help, .tracts-model-download-box__empty { margin: .85rem 0 0; color: var(--model-muted); font-size: .75rem; line-height: 1.45; }

.tracts-model-single__body-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 2rem; margin-top: 3rem; }
.tracts-model-single__section { margin-bottom: 2.5rem; }
.tracts-model-single__section h2, .tracts-model-single__specs h2 { margin: 0 0 1rem; font-size: 1.65rem; font-weight: 900; }
.tracts-model-richtext { color: #4e4e4e; font-size: .98rem; line-height: 1.7; }
.tracts-model-richtext h2, .tracts-model-richtext h3 { color: var(--model-text); }
.tracts-model-richtext a { color: var(--model-red); text-decoration: underline; }

.tracts-model-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.tracts-model-gallery a { display: block; padding: .7rem; border-radius: 12px; background: #f2f2f2; }
.tracts-model-gallery img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: contain; }

.tracts-model-single__specs { align-self: start; padding: 1.2rem; border: 1px solid var(--model-border); border-radius: 16px; background: #fff; }
.tracts-model-single__specs h2 { font-size: 1.15rem; }
.tracts-model-spec { padding: .8rem 0; border-top: 1px solid #eee; }
.tracts-model-spec > strong { display: block; margin-bottom: .45rem; color: #555; font-size: .7rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.tracts-model-spec__terms { display: flex; flex-wrap: wrap; gap: .3rem; }
.tracts-model-spec__terms span { padding: .3rem .45rem; border-radius: 6px; background: var(--model-soft); color: #555; font-size: .7rem; font-weight: 700; }
.tracts-model-edit { display: block; margin-top: 1rem; color: var(--model-red); font-size: .75rem; font-weight: 800; }

/* AUTH MODAL */
body.tracts-model-auth-open { overflow: hidden; }
.tracts-model-auth[hidden] { display: none !important; }
.tracts-model-auth { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.tracts-model-auth__backdrop { position: absolute; inset: 0; background: rgba(20,20,20,.72); }
.tracts-model-auth__dialog { position: relative; z-index: 1; width: min(490px, 100%); padding: 2rem; border-radius: 20px; background: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.30); color: #212529; }
.tracts-model-auth__close { position: absolute; top: .8rem; right: .8rem; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #eee; color: #333; font-size: 1.35rem; line-height: 1; }
.tracts-model-auth__icon { display: flex; align-items: center; justify-content: center; width: 58px; height: 58px; margin-bottom: 1rem; border-radius: 15px; background: rgba(239,62,62,.09); color: #ef3e3e; }
.tracts-model-auth h2 { margin: 0 2rem .75rem 0; font-size: 1.65rem; line-height: 1.1; font-weight: 900; }
.tracts-model-auth p:not(.tracts-model-eyebrow) { margin: 0; color: #666; font-size: .9rem; line-height: 1.55; }
.tracts-model-auth__actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: 1.25rem; }

/* FOCUS */
.tracts-model-library button:focus-visible,
.tracts-model-library a:focus-visible,
.tracts-model-library input:focus-visible,
.tracts-model-library select:focus-visible,
.tracts-model-auth button:focus-visible,
.tracts-model-auth a:focus-visible { outline: 3px solid rgba(239,62,62,.35) !important; outline-offset: 2px; }

@media (max-width: 1180px) {
    .tracts-model-filters { grid-template-columns: repeat(3, minmax(140px, 1fr)) auto; }
    .tracts-model-reset { grid-column: auto; }
}

@media (max-width: 980px) {
    .tracts-model-hero { grid-template-columns: 1fr; }
    .tracts-model-hero__visual { display: none; }
    .tracts-model-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tracts-model-single__hero { grid-template-columns: 1fr; }
    .tracts-model-single__preview { min-height: 460px; }
    .tracts-model-single__body-grid { grid-template-columns: 1fr; }
    .tracts-model-single__specs { order: -1; }
}

@media (max-width: 782px) {
    .admin-bar .tracts-model-tools { top: 46px; }
}

@media (max-width: 680px) {
    .tracts-model-page-wrap { margin-top: 6.5rem; }
    .tracts-model-library { padding: 0 .75rem; }
    .tracts-model-hero { margin-top: 1rem; padding: 1.5rem 1.25rem; border-radius: 19px; }
    .tracts-model-title { font-size: 2.7rem; }
    .tracts-model-lead { font-size: 1rem; }
    .tracts-model-tools { position: relative; top: auto !important; padding: .75rem; }
    .tracts-model-tools__top { align-items: stretch; flex-direction: column; }
    .tracts-model-search { width: 100%; }
    .tracts-model-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tracts-model-reset { grid-column: 1 / -1; width: 100%; }
    .tracts-model-grid { grid-template-columns: 1fr; }
    .tracts-model-card__visual { aspect-ratio: 4 / 3; }
    .tracts-model-single__preview { min-height: 360px; padding: 1rem; }
    .tracts-model-single__placeholder { min-height: 330px; }
    .tracts-model-download-item { align-items: stretch; flex-direction: column; }
    .tracts-model-download-item .tracts-model-btn { width: 100%; }
    .tracts-model-gallery { grid-template-columns: 1fr; }
    .tracts-model-auth__actions { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
    .tracts-model-filters { grid-template-columns: 1fr; }
    .tracts-model-reset { grid-column: auto; }
    .tracts-model-card__downloads { grid-template-columns: 1fr; }
}
