/* Démonstration de l'Agent IA Nobliora */
.demo-head { text-align: center; max-width: 760px; margin: 0 auto 36px; }
.demo-head .title { margin-bottom: 14px; }
.demo-head .subtitle { margin: 0 auto; }
.demo { position: relative; max-width: 980px; margin: 0 auto; border: 1px solid var(--gold-border); background: radial-gradient(120% 80% at 50% 0%, rgba(107,63,160,.22), rgba(13,15,38,.96) 60%), var(--bg-mid); box-shadow: 0 30px 80px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.04); padding: 26px 28px 22px; text-align: left; }
.demo-intro { font-family: var(--serif); font-size: clamp(20px, 2.6vw, 27px); line-height: 1.25; text-align: center; color: var(--text-primary); margin: 0 0 6px; }
.demo-intro em { color: var(--gold-light); font-style: italic; }
.demo-tag { display: block; text-align: center; font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--gold); margin-bottom: 20px; }
.demo-bar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; list-style: none; margin: 0 0 20px; padding: 0; }
.demo-bar button { width: 100%; background: rgba(255,255,255,.02); border: 1px solid var(--border); color: var(--text-tertiary); font-family: var(--sans); font-size: 12px; line-height: 1.3; padding: 9px 6px 11px; cursor: pointer; position: relative; overflow: hidden; transition: color .3s, border-color .3s, background .3s; }
.demo-bar button .n { display: block; font-family: var(--serif); font-size: 18px; color: var(--gold); line-height: 1; margin-bottom: 4px; }
.demo-bar button[aria-selected="true"] { color: var(--text-primary); border-color: var(--gold-border); background: rgba(201,168,76,.08); }
.demo-bar button:focus-visible, .demo-ctrl:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 2px; }
.demo-bar .prog { position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-light)); }
.demo-steps { list-style: none; margin: 0; padding: 0; }
.demo-step { display: grid; grid-template-columns: 1fr 1.25fr; gap: 28px; align-items: center; padding: 14px 0; }
.demo-step + .demo-step { border-top: 1px solid var(--border); }
.demo-txt .k { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.demo .demo-txt h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(24px, 3vw, 30px); line-height: 1.15; margin: 8px 0 12px; color: var(--text-primary); }
.demo .demo-txt p { font-size: 15px; color: var(--text-secondary); margin: 0; text-align: left; }
.demo-vis { position: relative; min-height: 290px; border: 1px solid var(--border); background: rgba(7,9,26,.7); padding: 18px; overflow: hidden; }
.demo-note { font-size: 12px; color: var(--text-tertiary); margin-top: 10px; }
.demo-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; }
.demo-ctrl { background: none; border: 1px solid var(--border); color: var(--text-secondary); font-family: var(--sans); font-size: 13px; padding: 8px 14px; cursor: pointer; display: none; }
.demo-ctrl:hover { color: var(--gold-light); border-color: var(--gold-border); }
.demo-ctrls { display: flex; gap: 8px; }
.demo-sim { font-size: 12px; color: var(--text-tertiary); }
.demo-after { text-align: center; margin-top: 30px; }
.demo-after .pill-48 { display: inline-block; font-size: 13px; letter-spacing: .06em; color: var(--gold-light); border: 1px solid var(--gold-border); padding: 6px 14px; margin-bottom: 18px; }

/* Éléments visuels */
.d-row { display: flex; align-items: center; gap: 10px; background: var(--bg-card); border: 1px solid var(--border); padding: 10px 12px; margin-bottom: 9px; font-size: 13.5px; color: var(--text-secondary); }
.d-row strong { color: var(--text-primary); font-weight: 500; }
.d-av { flex: 0 0 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--violet), #2b1f55); display: grid; place-items: center; font-size: 12px; color: var(--text-primary); }
.d-co { flex: 0 0 30px; height: 30px; background: linear-gradient(135deg, #1d2050, #2c2f66); border: 1px solid var(--border); display: grid; place-items: center; font-size: 12px; color: var(--lavender); }
.d-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.d-badge { font-size: 11.5px; padding: 3px 9px; border: 1px solid var(--gold-border); color: var(--gold-light); background: rgba(201,168,76,.08); white-space: nowrap; }
.d-badge.v { border-color: rgba(169,155,214,.35); color: var(--lavender); background: rgba(107,63,160,.14); }
.d-co-card { flex: 1; }
.d-orb { position: relative; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, var(--gold-light), var(--gold) 45%, #6b4f1a); box-shadow: 0 0 0 6px rgba(201,168,76,.10), 0 0 36px rgba(201,168,76,.45); display: grid; place-items: center; color: var(--bg-deep); font-size: 16px; }
.d-sig { display: flex; align-items: center; gap: 12px; margin: 14px 0 6px; font-size: 13px; letter-spacing: .04em; color: var(--gold-light); }
.d-hl { border-color: var(--gold-border); background: linear-gradient(90deg, rgba(201,168,76,.14), var(--bg-card)); box-shadow: 0 0 24px rgba(201,168,76,.12); }
.d-check { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-bottom: 12px; }
.d-check span { font-size: 13px; color: var(--text-secondary); display: flex; gap: 8px; align-items: center; }
.d-check i { flex: 0 0 16px; height: 16px; border: 1px solid var(--gold-border); display: grid; place-items: center; font-style: normal; font-size: 11px; color: var(--bg-deep); }
.d-ok { display: inline-block; margin-top: 4px; font-size: 13px; padding: 6px 12px; background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: var(--bg-deep); font-weight: 500; }
.d-off { opacity: .55; text-decoration: line-through; text-decoration-color: rgba(169,155,214,.6); }
.d-tl { position: relative; padding-left: 22px; }
.d-tl:before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 1px; background: var(--gold-border); }
.d-tl .d-row { position: relative; }
.d-tl .d-row:before { content: ''; position: absolute; left: -19px; top: 50%; width: 9px; height: 9px; margin-top: -5px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px rgba(201,168,76,.6); }
.d-clock { width: 26px; height: 26px; border: 1px solid var(--gold); border-radius: 50%; position: relative; flex: 0 0 26px; }
.d-clock:before, .d-clock:after { content: ''; position: absolute; left: 50%; top: 50%; width: 1px; background: var(--gold-light); transform-origin: top center; }
.d-clock:before { height: 8px; transform: rotate(180deg); }
.d-clock:after { height: 10px; transform: rotate(240deg); }
.d-chat { display: flex; flex-direction: column; gap: 9px; }
.d-msg { max-width: 86%; padding: 10px 13px; font-size: 13.5px; line-height: 1.45; border: 1px solid var(--border); }
.d-msg b { display: block; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; font-weight: 500; margin-bottom: 4px; }
.d-msg.ai { align-self: flex-start; background: linear-gradient(135deg, rgba(107,63,160,.30), rgba(17,19,48,.9)); color: var(--text-primary); border-color: rgba(169,155,214,.28); }
.d-msg.ai b { color: var(--lavender); }
.d-msg.pr { align-self: flex-end; background: var(--bg-card); color: var(--text-secondary); }
.d-msg.pr b { color: var(--text-tertiary); }
.d-alert { align-self: center; margin-top: 4px; font-size: 13px; padding: 7px 14px; background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: var(--bg-deep); font-weight: 500; box-shadow: 0 0 30px rgba(201,168,76,.35); }
.d-state { margin-left: auto; font-size: 11.5px; padding: 3px 8px; border: 1px solid var(--border); white-space: nowrap; }
.d-state.g { border-color: var(--gold-border); color: var(--gold-light); }
.d-state.v { border-color: rgba(169,155,214,.35); color: var(--lavender); }
.d-cal { width: 40px; height: 42px; border: 1px solid var(--gold-border); flex: 0 0 40px; display: flex; flex-direction: column; }
.d-cal:before { content: ''; height: 10px; background: var(--gold); }
.d-cal span { flex: 1; display: grid; place-items: center; font-family: var(--serif); color: var(--gold-light); font-size: 17px; }
.d-hand { text-align: center; padding-top: 10px; }
.d-hand .d-row { justify-content: flex-start; text-align: left; }

/* Mode animé (activé par le script) */
.demo.is-js .demo-step { display: none; padding: 0; border: 0; }
.demo.is-js .demo-step.is-active { display: grid; animation: dFade .55s ease both; }
.demo.is-js .demo-ctrl { display: inline-block; }
.demo.is-js .a { opacity: 0; }
.demo.is-js .is-active .a { animation: dIn .6s cubic-bezier(.2,.7,.2,1) both; animation-delay: var(--d, 0s); }
.demo.is-js .is-active .a.pop { animation-name: dPop; }
.demo.is-js .is-active .a.slide { animation-name: dSlide; }
.demo.is-js .is-active .d-check i { animation: dTick .35s ease both; animation-delay: var(--d, 0s); }
.demo.is-js .is-active .d-orb { animation: dPulse 1.6s ease-in-out infinite; }
.demo.is-js .is-active .d-type { display: inline-block; overflow: hidden; white-space: normal; }
.demo.is-paused, .demo.is-paused * { animation-play-state: paused !important; }
@keyframes dFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes dIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes dPop { 0% { opacity: 0; transform: scale(.85); } 70% { opacity: 1; transform: scale(1.04); } 100% { opacity: 1; transform: none; } }
@keyframes dSlide { from { opacity: 0; transform: translateX(-26px); } to { opacity: 1; transform: none; } }
@keyframes dTick { from { background: transparent; } to { background: var(--gold); } }
@keyframes dPulse { 0%, 100% { box-shadow: 0 0 0 6px rgba(201,168,76,.10), 0 0 30px rgba(201,168,76,.35); } 50% { box-shadow: 0 0 0 12px rgba(201,168,76,.05), 0 0 50px rgba(201,168,76,.6); } }
.demo:not(.is-js) .d-check i { background: var(--gold); }

/* Mobile */
@media (max-width: 860px) {
  .demo { padding: 20px 14px 16px; }
  .demo-bar { gap: 4px; }
  .demo-bar button { padding: 8px 2px; font-size: 0; }
  .demo-bar button .n { font-size: 17px; margin: 0; }
  .demo-step, .demo.is-js .demo-step.is-active { grid-template-columns: 1fr; gap: 16px; }
  .demo-vis { min-height: 0; padding: 14px; }
  .d-check { grid-template-columns: 1fr; }
  .demo-foot { flex-direction: column-reverse; align-items: stretch; text-align: center; }
  .demo-ctrls { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .demo * { animation: none !important; transition: none !important; }
}
.page .demo li { margin-bottom: 0; font-size: inherit; }
.page .demo p { margin-bottom: 0; }
.page .demo-head .label { text-align: center; }
/* Hauteur stable sur ordinateur, lignes lisibles sur mobile */
@media (min-width: 861px) { .demo.is-js .demo-vis { min-height: 380px; } }
@media (max-width: 860px) {
  .d-row { flex-wrap: wrap; }
  .d-row > div { flex: 1 1 0; min-width: 0; }
  .d-state { margin-left: 40px; white-space: normal; flex-basis: 100%; max-width: calc(100% - 40px); text-align: left; }
  .d-hand .d-state, .d-check + .d-row .d-state { margin-left: 40px; }
}
/* Version épurée */
.demo-tag { margin-bottom: 18px; }
.demo-foot { justify-content: flex-end; margin-top: 14px; }
.demo-sim { display: block; text-align: center; font-size: 12.5px; color: var(--text-tertiary); margin: 14px auto 0; }
.page .demo-sim { text-align: center; }
.demo-details { max-width: 760px; margin: 18px auto 0; text-align: left; border-top: 1px solid var(--border); padding-top: 12px; }
.demo-details summary { cursor: pointer; text-align: center; font-size: 13.5px; color: var(--text-secondary); list-style: none; }
.demo-details summary::-webkit-details-marker { display: none; }
.demo-details summary:after { content: ' ↓'; color: var(--gold); }
.demo-details[open] summary:after { content: ' ↑'; }
.demo-details ol { margin: 14px 0 0 20px; padding: 0; }
.demo-details li { font-size: 14.5px; color: var(--text-secondary); margin-bottom: 8px; }
.page .demo-details li { margin-bottom: 8px; font-size: 14.5px; }
.demo-details strong { color: var(--text-primary); font-weight: 500; }
.demo .demo-txt p { font-size: 17px; line-height: 1.55; }
@media (max-width: 860px) {
  .demo-bar { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin-bottom: 18px; }
  .demo-bar button { min-height: 48px; padding: 0; display: grid; place-items: center; }
  .demo-bar button .n { font-size: 19px; }
  .demo-bar button .l { display: none; }
  .demo .demo-txt h3 { font-size: 26px; margin: 6px 0 8px; }
  .demo .demo-txt p { font-size: 16.5px; }
  .demo-ctrls { width: 100%; justify-content: center; gap: 10px; }
  .demo-ctrl { min-width: 56px; min-height: 46px; font-size: 15px; }
  .demo-foot { justify-content: center; }
  .d-row { font-size: 14px; }
  .d-msg { font-size: 14.5px; max-width: 92%; }
}
/* Corrections finales : contraste et navigation */
.demo .d-row { color: #cfc8ea; }
.demo .d-row strong { color: #f6f2ff; }
.demo .d-badge { color: #f0d690; border-color: rgba(201,168,76,.45); background: rgba(201,168,76,.12); }
.demo .d-badge.v { color: #cfc4f4; border-color: rgba(169,155,214,.5); background: rgba(107,63,160,.22); }
.demo .demo-note { color: #b4acd4; }
.demo .demo-txt p { color: #d2cbec; }
.demo .demo-txt .k { color: var(--gold-light); }
.demo .d-msg.pr { color: #ddd7f2; }
.demo .d-msg.pr b { color: #b4acd4; }
.demo .d-msg.ai b { color: #cfc4f4; }
.demo .d-state { color: #cfc8ea; border-color: rgba(255,255,255,.16); }
.demo .d-co { color: #cfc4f4; }
.demo-sim { color: #a9a2c8; }
.demo-tag { color: var(--gold-light); }
.demo-bar button { color: #b4acd4; }
.demo-bar button[aria-selected="true"] { background: rgba(201,168,76,.18); border-color: var(--gold); color: #fff; box-shadow: 0 0 22px rgba(201,168,76,.18); }
.demo-bar button[aria-selected="true"] .n { color: var(--gold-light); }
.demo-ctrl { color: #d2cbec; border-color: rgba(255,255,255,.16); }
.demo-link { text-align: center; }
.demo-link a { color: var(--text-secondary); font-size: 14.5px; text-decoration: none; border-bottom: 1px solid var(--gold-border); padding-bottom: 2px; }
.demo-link a:hover { color: var(--gold-light); }
@media (max-width: 860px) {
  .demo-bar { gap: 6px; }
  .demo-bar button { min-height: 54px; border-color: rgba(255,255,255,.14); }
  .demo-bar button .n { font-size: 21px; color: #d9c58c; }
  .demo-bar button[aria-selected="true"] { background: linear-gradient(135deg, var(--gold), var(--gold-light)); border-color: var(--gold-light); box-shadow: 0 6px 20px rgba(201,168,76,.35); }
  .demo-bar button[aria-selected="true"] .n { color: var(--bg-deep); font-weight: 600; }
  .demo-bar .prog { height: 3px; background: rgba(7,9,26,.55); }
  .demo .d-row { font-size: 14.5px; }
  .demo .d-badge { font-size: 12.5px; padding: 4px 10px; }
  .demo .demo-note { font-size: 13px; }
  .demo-sim { font-size: 13px; }
  .demo-ctrl { min-width: 60px; min-height: 50px; font-size: 16px; }
}
