/* ==========================================================
   Styles propres à chaque page (en-têtes de page, catalogue,
   anatomie, prompts, glossaire, quiz, accueil)
   ========================================================== */

/* ---------- En-tête de page commun ---------- */
.page-hero { padding: clamp(40px, 6vw, 80px) 0 clamp(24px, 4vw, 44px); position: relative; overflow: hidden; }
.page-hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); max-width: 18ch; }
.page-hero .lead { margin-top: 12px; }
.page-hero::before { content: ""; position: absolute; width: 520px; height: 520px; right: -140px; top: -220px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--brand) 22%, transparent), transparent 65%); z-index: -1; pointer-events: none; }
.page-hero .container { position: relative; }

/* ---------- Catalogue ---------- */
.toolbar { position: sticky; top: var(--header-h); z-index: 30; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-block: 1px solid var(--line); padding: 14px 0; }
.toolbar .container { display: grid; gap: 12px; }
.search-box { position: relative; }
.search-box input { width: 100%; font: inherit; padding: .8em 1em .8em 2.8em; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); transition: .15s; }
.search-box input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.search-box::before { content: "⌕"; position: absolute; left: 1em; top: 50%; transform: translateY(-52%); font-size: 1.4rem; color: var(--muted); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter { font: 600 .85rem var(--font); padding: .45em 1em; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; transition: .15s; display: inline-flex; align-items: center; gap: .5em; }
.filter:hover { border-color: var(--cc, var(--brand)); }
.filter[aria-pressed="true"] { background: var(--cc, var(--ink)); border-color: var(--cc, var(--ink)); color: #fff; }
.filter .n { font-family: var(--mono); font-size: .72rem; opacity: .7; }
.result-info { font-size: .9rem; color: var(--muted); margin: 26px 0 18px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tile { text-align: left; font: inherit; color: inherit; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: grid; gap: 8px; align-content: start; position: relative; overflow: hidden; transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s, border-color .25s; }
.tile::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px; background: var(--cc); }
.tile:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: var(--cc); }
.tile h3 { margin: 6px 0 0; font-size: 1.2rem; }
.tile .en { font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.tile p { margin: 0; font-size: .92rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cat-pill { justify-self: start; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--cc); background: color-mix(in srgb, var(--cc) 14%, transparent); padding: .2em .7em; border-radius: 999px; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); grid-column: 1 / -1; }

/* Fiche détaillée (dialog) */
dialog.sheet { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(880px, 100%); max-width: 100%; border: 0; padding: 0; background: var(--bg); color: var(--ink); box-shadow: -20px 0 60px rgba(0,0,0,.3); }
dialog.sheet[open] { display: flex; flex-direction: column; animation: sheet-in .38s cubic-bezier(.2,.8,.2,1); }
dialog.sheet::backdrop { background: rgba(12,10,24,.55); backdrop-filter: blur(3px); animation: fade-in .3s; }
@keyframes sheet-in { from { transform: translateX(60px); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
.sheet-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--surface); flex: none; }
.sheet-bar .group { display: flex; gap: 8px; align-items: center; }
.sheet-bar .count { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.sheet-body { overflow-y: auto; padding: 28px clamp(18px, 4vw, 40px) 60px; flex: 1; }
.sheet-body h2 { font-size: clamp(1.8rem, 4vw, 2.5rem); margin-bottom: .15em; }
.sheet-body h3 { font-size: 1.05rem; margin: 34px 0 12px; display: flex; align-items: center; gap: .6em; text-transform: none; }
.sheet-body h3::before { content: ""; width: 22px; height: 4px; border-radius: 2px; background: var(--brand); }
.sheet-sub { font-family: var(--mono); color: var(--muted); font-size: .88rem; margin-bottom: 14px; }
.alias-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.layers-3 { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
.layers-3 .card { padding: 16px; font-size: .88rem; }
.layers-3 .card p { margin: 8px 0 0; color: var(--muted); }
.layers-3 .none p { opacity: .65; }
.levers { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.levers li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .4em .8em; font-size: .88rem; }
.prompt-box { position: relative; background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); border-radius: var(--radius-sm); padding: 18px 18px 18px 20px; }
.prompt-box .label { font-family: var(--mono); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--brand); display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.prompt-box p { margin: 0; font-size: 1rem; }
.pitfalls { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.pitfalls li { padding: 12px 14px 12px 42px; background: var(--js-soft); border-radius: var(--radius-sm); position: relative; font-size: .93rem; }
.pitfalls li::before { content: "⚠"; position: absolute; left: 14px; top: 11px; }

@media (max-width: 700px) { .layers-3 { grid-template-columns: 1fr; } }

/* ---------- Glossaire ---------- */
.az { display: flex; flex-wrap: wrap; gap: 4px; }
.az a { font: 700 .78rem var(--mono); text-decoration: none; color: var(--muted); width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; transition: .15s; }
.az a:hover { background: var(--brand); color: var(--on-brand); }
.gloss { margin: 0; display: grid; gap: 14px; }
.gloss-letter { font-size: 2.6rem; font-weight: 800; letter-spacing: -.04em; color: var(--brand); margin-top: 22px; line-height: 1; scroll-margin-top: 220px; }
.gloss-item { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--cc); border-radius: var(--radius-sm); padding: 18px 20px; }
.gloss-item dt { font-weight: 750; font-size: 1.15rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gloss-item dd { margin: 8px 0 0; }
.gloss-item dd p { margin: 0 0 10px; }
.say { display: block; width: 100%; text-align: left; font: inherit; font-size: .92rem; color: var(--ink); background: var(--brand-soft); border: 1px dashed color-mix(in srgb, var(--brand) 45%, transparent); border-radius: 10px; padding: 10px 14px; cursor: copy; transition: .15s; }
.say span { display: block; font: 700 .68rem var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--brand); margin-bottom: 2px; }
.say:hover { border-style: solid; transform: translateX(3px); }

/* ---------- Page « Parler à l'IA » ---------- */
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.toc a { font: 600 .85rem var(--font); text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); padding: .4em .95em; border-radius: 999px; transition: .15s; }
.toc a:hover { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.steps5 { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.steps5 li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 18px; position: relative; }
.steps5 .num { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: var(--on-brand); font-weight: 800; margin-bottom: 12px; }
.steps5 h3 { margin-bottom: 4px; } .steps5 p { margin: 0 0 8px; font-size: .92rem; color: var(--muted); }
.steps5 .ex { color: var(--ink); background: var(--brand-soft); padding: 8px 10px; border-radius: 8px; font-size: .85rem; font-style: italic; }
@media (max-width: 1000px) { .steps5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .steps5 { grid-template-columns: 1fr; } }

.ba-list { display: grid; gap: 18px; }
.ba { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.ba-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.ba-head h3 { margin: 0; }
.ba-switch { display: inline-flex; background: var(--bg-2); border-radius: 999px; padding: 4px; }
.ba-switch button { font: 650 .85rem var(--font); border: 0; background: transparent; color: var(--muted); padding: .45em 1em; border-radius: 999px; cursor: pointer; transition: .2s; }
.ba-switch button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.ba-prompt { margin: 0 0 14px; padding: 16px 18px; border-radius: 12px; font-size: 1.02rem; }
.ba-prompt span { display: block; font: 700 .68rem var(--mono); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 4px; opacity: .7; }
.ba-prompt.vague { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border: 1px dashed color-mix(in srgb, var(--danger) 50%, transparent); }
.ba-prompt.precis { background: color-mix(in srgb, var(--ok) 11%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); }
.ba[data-mode="vague"] .precis, .ba[data-mode="precis"] .vague { display: none; }
.ba-foot ul { margin: 6px 0 0; padding-left: 1.2em; color: var(--muted); font-size: .92rem; } .ba-foot .btn { margin-top: 12px; }

.gen { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-sm); overflow: hidden; }
.gen-tabs { display: flex; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.gen-tabs button { flex: 1; padding: 16px; font: 700 .95rem var(--font); border: 0; background: transparent; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; }
.gen-tabs button[aria-selected="true"] { background: var(--surface); color: var(--brand); border-bottom-color: var(--brand); }
.gen-body { display: grid; grid-template-columns: 1.1fr 1fr; }
.gen-form { padding: 26px; display: grid; gap: 16px; align-content: start; border-right: 1px solid var(--line); }
.gen-form[hidden] { display: none; }
.gen-body .gen-out { grid-column: 2; grid-row: 1; }
.gen-form .f { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.gen-form label, .gen-form legend { font-weight: 650; font-size: .88rem; padding: 0; }
.gen-form input[type="text"], .gen-form input:not([type]), .gen-form select, .gen-form textarea, .gen-form input[list] { font: inherit; font-size: .95rem; padding: .65em .85em; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); width: 100%; }
.gen-form input:focus, .gen-form select:focus, .gen-form textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.gen-form input[type="color"] { width: 100%; height: 44px; padding: 3px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); cursor: pointer; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.checks { display: grid; gap: 6px; }
.checks label { display: flex; align-items: flex-start; gap: 9px; font-weight: 500; font-size: .9rem; cursor: pointer; padding: 6px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); transition: .12s; }
.checks label:hover { border-color: var(--brand); } .checks input { margin-top: .25em; accent-color: var(--brand); }
.gen-out { padding: 26px; background: var(--bg-2); display: flex; flex-direction: column; gap: 12px; position: sticky; top: calc(var(--header-h) + 10px); align-self: start; max-height: calc(100dvh - var(--header-h) - 20px); }
.gen-out-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.out { margin: 0; flex: 1; background: #17161d; color: #ece9f7; padding: 18px; border-radius: 12px; font-size: .84rem; line-height: 1.65; overflow: auto; white-space: pre-wrap; word-break: break-word; min-height: 220px; }
.hint { font-size: .82rem; color: var(--muted); margin: 0; }
@media (max-width: 920px) { .gen-body { grid-template-columns: 1fr; } .gen-body .gen-out { grid-column: 1; grid-row: auto; position: static; max-height: none; } .gen-form { border-right: 0; } .row2 { grid-template-columns: 1fr; } }

.tr-list { display: grid; gap: 10px; }
.tr-row { display: flex; align-items: center; gap: 10px; }
.tr-say { flex: 1; display: grid; grid-template-columns: 1fr auto 1.2fr; align-items: center; gap: 14px; text-align: left; font: inherit; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; cursor: copy; transition: .15s; }
.tr-say:hover { border-color: var(--brand); transform: translateX(3px); box-shadow: var(--shadow-sm); }
.tr-say small { display: block; font: 700 .66rem var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 2px; }
.tr-say .from { color: var(--muted); font-style: italic; } .tr-say .to { font-weight: 600; } .tr-say .to small { color: var(--ok); } .tr-say .arrow { font-size: 1.4rem; color: var(--brand); }
.tr-row .pill { text-decoration: none; white-space: nowrap; color: var(--brand); }
@media (max-width: 760px) { .tr-row { flex-direction: column; align-items: stretch; } .tr-say { grid-template-columns: 1fr; gap: 6px; } .tr-say .arrow { transform: rotate(90deg); justify-self: start; } }

.cursors { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.cursor { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: grid; grid-template-columns: auto 1fr; gap: 16px; }
.c-ico { width: 52px; height: 52px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 1.6rem; }
.cursor h3 { margin: 0 0 6px; } .cursor .words { margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 5px; } .cursor .props { font-size: .88rem; color: var(--muted); margin: 0 0 10px; }

.toolkit { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.toolkit li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; font-size: .95rem; }
.bug-tpl { background: #17161d; border-radius: 16px; overflow: hidden; border: 1px solid #2b2937; box-shadow: var(--shadow); }
.bug-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #1f1e27; color: #e9e7f3; border-bottom: 1px solid #2b2937; }
.bug-head .btn-ghost { color: #e9e7f3; border-color: #4a4860; }
.bug-tpl pre { margin: 0; padding: 18px; color: #e9e7f3; font-size: .82rem; line-height: 1.7; white-space: pre-wrap; }

.loop { display: flex; align-items: stretch; justify-content: center; gap: 10px; flex-wrap: wrap; }
.loop-step { flex: 1; min-width: 190px; max-width: 260px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.loop-step b { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--bg); margin-bottom: 8px; }
.loop-step h3 { margin-bottom: 4px; } .loop-step p { margin: 0; color: var(--muted); font-size: .92rem; }
.loop-arrow { align-self: center; font-size: 1.8rem; color: var(--brand); font-weight: 800; }
@media (max-width: 900px) { .loop-arrow { display: none; } .loop-step { max-width: none; } }
ul.plain { margin: 8px 0 0; padding-left: 1.2em; display: grid; gap: 8px; } ul.plain.meta { list-style: none; padding: 0; }
ul.plain.meta button { width: 100%; text-align: left; font: inherit; font-size: .92rem; background: var(--brand-soft); color: var(--ink); border: 1px dashed color-mix(in srgb, var(--brand) 45%, transparent); border-radius: 10px; padding: 10px 14px; cursor: copy; transition: .15s; }
ul.plain.meta button:hover { border-style: solid; transform: translateX(3px); }
