/* Gabarit commun des portails thématiques — templates/pages/portails/_portail.html.twig */

.pt {
    --pt-accent: #4f46e5;
    --pt-top: 16px;
    --pt-ink: #0f172a;
    --pt-text: #334155;
    --pt-muted: #64748b;
    --pt-line: #e3e6ef;
    --pt-bg: #f5f6fa;
    background: var(--pt-bg);
    color: var(--pt-ink);
    padding-bottom: 72px;
}

/* ---------- Hero ---------- */
/* Bande teintée à la couleur du portail : se détache du header blanc, les
   cartes et la recherche (blanches) ressortent dessus. Trame de points à droite. */
.pt-hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(700px 320px at 88% 0%, color-mix(in srgb, var(--pt-accent) 16%, transparent), transparent 70%),
        color-mix(in srgb, var(--pt-accent) 7%, #fff);
    border-top: 1px solid color-mix(in srgb, var(--pt-accent) 14%, #fff);
    border-bottom: 1px solid color-mix(in srgb, var(--pt-accent) 16%, #fff);
    padding: 26px 0 30px;
}
.pt-hero::before {
    content: "";
    position: absolute;
    inset: 0 0 0 50%;
    background-image: radial-gradient(color-mix(in srgb, var(--pt-accent) 35%, transparent) 1.3px, transparent 1.4px);
    background-size: 22px 22px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 70%);
    mask-image: linear-gradient(90deg, transparent 0%, #000 70%);
    opacity: .55;
    pointer-events: none;
}
.pt-hero > .container { position: relative; z-index: 1; }
@media (max-width: 767.98px) { .pt-hero::before { inset: 0 0 0 35%; opacity: .3; } }
.pt-crumbs { display: flex; gap: 8px; font-size: .8rem; color: var(--pt-muted); }
.pt-crumbs a { color: var(--pt-muted); text-decoration: none; }
.pt-crumbs a:hover { color: var(--pt-accent); text-decoration: underline; }
.pt-crumbs [aria-current] { color: var(--pt-text); font-weight: 600; }
.pt-h1 {
    font-size: clamp(1.75rem, 3.2vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.15;
    color: var(--pt-ink);
    margin: 14px 0 10px;
    max-width: 32ch;
}
.pt-accent { color: var(--pt-accent); }
.pt-intro { color: #475569; font-size: 1.05rem; line-height: 1.6; max-width: 62ch; margin: 0 0 22px; }

.pt-search {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 640px;
    height: 56px;
    padding: 0 12px 0 18px;
    background: #fff;
    border: 1px solid #d5d9e6;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 28px -16px rgba(15, 23, 42, .25);
    transition: border-color .15s, box-shadow .15s;
}
.pt-search:focus-within {
    border-color: var(--pt-accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--pt-accent) 16%, transparent);
}
.pt-search > .fa-search { color: var(--pt-muted); }
.pt-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 1.05rem;
    color: var(--pt-ink);
}
.pt-search input::-webkit-search-cancel-button { cursor: pointer; }
.pt-kbd {
    border: 1px solid #d5d9e6;
    border-bottom-width: 2px;
    border-radius: 6px;
    padding: 1px 8px;
    font-size: .78rem;
    font-family: inherit;
    color: var(--pt-muted);
    background: #f8fafc;
}
@media (hover: none) { .pt-kbd { display: none; } }
.pt-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 14px 0 0; font-size: .85rem; color: var(--pt-muted); }
.pt-meta i { margin-right: 6px; color: var(--pt-accent); }

/* ---------- Blocs communs ---------- */
.pt-body { padding-top: 28px; }
.pt-h2 { font-size: 1.15rem; font-weight: 800; color: var(--pt-ink); margin: 0; line-height: 1.3; }
.pt-h2 > i { margin-right: 8px; color: var(--pt-accent); }
.pt-block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.pt-link-btn {
    border: 0;
    background: none;
    padding: 4px 0;
    font-size: .85rem;
    font-weight: 600;
    color: var(--pt-muted);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}
.pt-link-btn:hover { color: var(--pt-ink); }
.pt-ico {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--c, var(--pt-accent)) 12%, #fff);
    color: var(--c, var(--pt-accent));
}
.pt-ico-lg { width: 46px; height: 46px; font-size: 1.1rem; }
.pt-count {
    font-size: .75rem;
    font-weight: 700;
    color: var(--pt-muted);
    background: #fff;
    border: 1px solid var(--pt-line);
    border-radius: 999px;
    padding: 1px 9px;
}

/* ---------- Vos outils (localStorage) ---------- */
.pt-mine {
    background: color-mix(in srgb, var(--pt-accent) 5%, #fff);
    border: 1px solid color-mix(in srgb, var(--pt-accent) 22%, #fff);
    border-radius: 16px;
    padding: 16px 18px 12px;
    margin-bottom: 32px;
}
.pt-mine-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pt-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid var(--pt-line);
    border-radius: 999px;
    font-size: .875rem;
    font-weight: 600;
    color: var(--pt-ink);
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s;
}
.pt-chip:hover { border-color: var(--pt-accent); color: var(--pt-ink); box-shadow: 0 4px 14px -8px var(--pt-accent); }
.pt-chip > i { color: var(--pt-accent); }
.pt-chip .pt-chip-star { color: #d97706; font-size: .75rem; }
.pt-note { margin: 10px 0 0; font-size: .78rem; color: var(--pt-muted); }
.pt-note i { color: #d97706; }

/* ---------- Les plus utilisés ---------- */
.pt-featured { margin-bottom: 32px; }
.pt-feat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.pt-feat {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: start;
    padding: 18px;
    background: #fff;
    border: 1px solid var(--pt-line);
    border-radius: 16px;
    color: inherit;
    text-decoration: none;
    transition: border-color .15s, box-shadow .2s, transform .2s;
}
.pt-feat:hover {
    border-color: color-mix(in srgb, var(--c) 45%, var(--pt-line));
    box-shadow: 0 14px 30px -18px color-mix(in srgb, var(--c) 70%, transparent);
    transform: translateY(-2px);
}
.pt-feat-name { display: block; font-weight: 700; color: var(--pt-ink); line-height: 1.3; }
.pt-feat-desc { display: block; margin-top: 4px; font-size: .86rem; line-height: 1.5; color: #475569; }
.pt-feat-arrow { margin-top: 4px; color: #a3acbf; transition: transform .2s, color .2s; }
.pt-feat:hover .pt-feat-arrow { color: var(--c); transform: translateX(3px); }

.pt-extra { margin-bottom: 36px; }

/* ---------- Sommaire + catalogue ---------- */
.pt-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 36px;
    align-items: start;
}
.pt-toc {
    position: sticky;
    top: var(--pt-top);
    max-height: calc(100vh - var(--pt-top) - 16px);
    overflow-y: auto;
    scrollbar-width: thin;
    transition: top .2s;
}
.pt-toc ul { list-style: none; margin: 0; padding: 0; }
.pt-toc-title {
    margin: 0 0 8px 10px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--pt-muted);
}
.pt-toc [data-toc] {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: .88rem;
    font-weight: 600;
    color: var(--pt-text);
    text-decoration: none;
    transition: background .15s, color .15s;
}
.pt-toc [data-toc] > i { width: 18px; text-align: center; color: var(--c); }
.pt-toc [data-toc] > span:first-of-type { flex: 1; min-width: 0; }
.pt-toc [data-toc] .pt-count { background: transparent; border: 0; padding: 0; }
.pt-toc [data-toc]:hover { background: #eceef5; color: var(--pt-ink); }
.pt-toc [data-toc].is-active {
    background: #fff;
    color: var(--pt-ink);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06), inset 3px 0 0 var(--c);
}
.pt-toc.is-searching-toc [data-toc].is-empty { opacity: .4; }

.pt-new { margin-top: 26px; }
.pt-new a {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: .82rem;
    line-height: 1.35;
    color: var(--pt-text);
    text-decoration: none;
}
.pt-new a:hover { background: #eceef5; color: var(--pt-ink); }
.pt-new time { flex-shrink: 0; color: #94a3b8; font-variant-numeric: tabular-nums; }

.pt-section { margin-bottom: 40px; scroll-margin-top: calc(var(--pt-top) + 8px); }
.pt-section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.pt-section-head > div { flex: 1; min-width: 0; }
.pt-section-head p { margin: 2px 0 0; font-size: .87rem; color: var(--pt-muted); }
.pt-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 8px;
}
.pt-item { position: relative; }
.pt-tool {
    display: flex;
    align-items: center;
    gap: 11px;
    height: 100%;
    min-height: 52px;
    padding: 10px 42px 10px 14px;
    background: #fff;
    border: 1px solid var(--pt-line);
    border-radius: 12px;
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.35;
    color: #1e293b;
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s;
}
.pt-tool:hover {
    color: var(--pt-ink);
    border-color: color-mix(in srgb, var(--c) 50%, var(--pt-line));
    box-shadow: 0 8px 20px -14px color-mix(in srgb, var(--c) 80%, transparent);
}
.pt-tool:focus-visible, .pt-feat:focus-visible, .pt-chip:focus-visible, .pt-pin:focus-visible {
    outline: 2px solid var(--c, var(--pt-accent));
    outline-offset: 2px;
}
.pt-tool-ico { flex-shrink: 0; width: 18px; text-align: center; color: var(--c); }
.pt-tool-name { flex: 1; min-width: 0; }
.pt-badge {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    background: #fef3c7;
    color: #92400e;
}
.pt-pin {
    position: absolute;
    top: 50%;
    right: 6px;
    width: 32px;
    height: 32px;
    transform: translateY(-50%);
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #a3acbf;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s, background .15s, color .15s;
}
.pt-item:hover .pt-pin, .pt-pin:focus-visible, .pt-pin[aria-pressed="true"] { opacity: 1; }
.pt-pin:hover { background: #f1f3f8; color: #d97706; }
.pt-pin[aria-pressed="true"] { color: #d97706; }
@media (hover: none) { .pt-pin { opacity: 1; } }

.pt-empty { text-align: center; padding: 48px 16px; color: var(--pt-muted); }
.pt-empty > i { font-size: 2rem; opacity: .35; margin-bottom: 12px; }
.pt-empty p { margin: 0 0 6px; font-weight: 600; }

/* ---------- Autres portails ---------- */
.pt-others { margin-top: 24px; padding-top: 32px; border-top: 1px solid var(--pt-line); }
.pt-others-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 10px;
}
.pt-others-grid a {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 100%;
    padding: 13px 14px;
    background: #fff;
    border: 1px solid var(--pt-line);
    border-radius: 12px;
    text-decoration: none;
    transition: border-color .15s;
}
.pt-others-grid a:hover { border-color: var(--pt-accent); }
.pt-others-grid i { width: 20px; text-align: center; color: var(--pt-accent); }
.pt-others-grid strong { display: block; font-size: .9rem; color: var(--pt-ink); }
.pt-others-grid small { display: block; font-size: .78rem; color: var(--pt-muted); }

/* ---------- Mode recherche ---------- */
.pt-results-info { display: none; margin: 0 0 14px; font-weight: 700; color: var(--pt-text); }
.pt.is-searching .pt-results-info { display: block; }
.pt.is-searching .pt-mine,
.pt.is-searching .pt-featured,
.pt.is-searching .pt-extra,
.pt.is-searching .pt-new,
.pt.is-searching .pt-others { display: none; }

/* ---------- Tablette et mobile ---------- */
@media (max-width: 1199.98px) {
    .pt-feat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
    .pt-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .pt-toc {
        z-index: 20;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        margin: 0 -1.25rem 18px;
        padding: 10px 1.25rem;
        background: color-mix(in srgb, var(--pt-bg) 92%, transparent);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        scrollbar-width: none;
    }
    .pt-toc::-webkit-scrollbar { display: none; }
    .pt-toc-title, .pt-new { display: none; }
    .pt-toc ul { display: flex; gap: 8px; width: max-content; }
    .pt-toc [data-toc] {
        white-space: nowrap;
        padding: 7px 13px;
        font-size: .82rem;
        background: #fff;
        border: 1px solid var(--pt-line);
        border-radius: 999px;
    }
    .pt-toc [data-toc].is-active { box-shadow: none; border-color: var(--c); background: color-mix(in srgb, var(--c) 8%, #fff); }
    .pt-toc [data-toc] .pt-count { display: none; }
    .pt-section { scroll-margin-top: calc(var(--pt-top) + 64px); }
}
@media (max-width: 575.98px) {
    .pt-hero { padding: 18px 0 22px; }
    .pt-intro { font-size: .98rem; margin-bottom: 18px; }
    .pt-search { height: 52px; }
    .pt-feat-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .pt-feat { padding: 14px; }
    .pt-list { grid-template-columns: minmax(0, 1fr); }
    .pt-section-head .pt-count { display: none; }
}

/* ---------- Compléments pour les portails (descriptions, pub, blocs de contenu) ---------- */
.pt-tool-desc {
    display: block;
    margin-top: 2px;
    font-size: .8rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--pt-muted);
}
.pt-others-grid a { --c: var(--pt-accent); }
.pt-others-grid i { color: var(--c); }
.pt-others-grid a:hover { border-color: var(--c); }

.pt-ad { margin: 8px 0 32px; text-align: center; }
.pt-ad > span { display: block; margin-bottom: 4px; font-size: .72rem; color: var(--pt-muted); }

/* Carte de contenu éditorial (texte, conventions, guides) placée dans les blocs optionnels. */
.pt-content {
    margin-bottom: 32px;
    padding: 26px 28px;
    background: #fff;
    border: 1px solid var(--pt-line);
    border-radius: 16px;
    color: var(--pt-text);
    line-height: 1.65;
}
.pt-content > .pt-h2 { margin-bottom: 12px; }
.pt-content h3 { font-size: 1rem; font-weight: 700; color: var(--pt-ink); margin: 18px 0 6px; }
.pt-content p, .pt-content ul, .pt-content ol { margin: 0 0 12px; }
.pt-content p:last-child, .pt-content ul:last-child { margin-bottom: 0; }
.pt-content a:not(.pt-card) { color: var(--pt-accent); text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 575.98px) { .pt-content { padding: 20px 18px; } }

/* Grille de liens secondaires (articles, conventions, métiers…). */
.pt-cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
}
.pt-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    height: 100%;
    padding: 13px 14px;
    background: #fff;
    border: 1px solid var(--pt-line);
    border-radius: 12px;
    color: var(--pt-ink);
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    transition: border-color .15s;
}
.pt-content .pt-card { background: var(--pt-bg); }
.pt-card:hover { border-color: var(--pt-accent); color: var(--pt-ink); }
.pt-card > i { margin-top: 2px; width: 18px; text-align: center; color: var(--pt-accent); flex-shrink: 0; }
.pt-card small { display: block; margin-top: 2px; font-weight: 500; color: var(--pt-muted); }

/* FAQ en <details> : <div class="pt-faq"><details><summary>Question</summary><div>Réponse</div></details>…</div> */
.pt-faq details {
    background: #fff;
    border: 1px solid var(--pt-line);
    border-radius: 12px;
    margin-bottom: 8px;
}
.pt-faq summary {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    font-weight: 700;
    color: var(--pt-ink);
    cursor: pointer;
    list-style: none;
}
.pt-faq summary::-webkit-details-marker { display: none; }
.pt-faq summary::after { content: "+"; font-weight: 700; color: var(--pt-accent); }
.pt-faq details[open] summary::after { content: "−"; }
.pt-faq details > div { padding: 0 18px 16px; color: var(--pt-text); line-height: 1.65; }
