/* ============================================================
   DEMO PAGE: agent simulator layout. Single dark theme, sharp
   4px radius, one accent, same tokens as the main site.
   ============================================================ */

body.demo-page { overflow-x: hidden; }
.demo-top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem var(--gutter);
  border-bottom: 1px solid var(--line);
}
.demo-top-links { display: flex; gap: 1.6rem; color: var(--ink2); font-size: var(--fs-small); }
.demo-top-links a { transition: color 0.2s; }
.demo-top-links a:hover { color: var(--ink); }

.demo-main { max-width: var(--maxw); margin: 0 auto; padding: var(--space-3) var(--gutter) var(--space-5); }
.demo-badge { color: var(--amber); font-size: var(--fs-small); margin-bottom: 0.8rem; }
.demo-title {
  font-size: clamp(2rem, 5vw, 4rem);
  font-variation-settings: "wdth" 118, "wght" 860;
  font-weight: 860; line-height: 1.02; margin-bottom: 0.8rem;
}
.demo-lead { color: var(--ink2); max-width: 62ch; margin-bottom: var(--space-3); }

.scene-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: var(--space-2); }
.scene-tab {
  position: relative; overflow: hidden;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 0.65em 1.1em; font-size: var(--fs-small); color: var(--ink2);
  transition: color 0.2s, border-color 0.2s, background 0.2s, scale 0.15s;
}
.scene-tab:hover { color: var(--ink); border-color: var(--ink2); }
.scene-tab:active { scale: 0.97; }
.scene-tab[aria-selected="true"] { background: var(--acc); border-color: var(--acc); color: #0b0b0c; font-weight: 600; }

.stage {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(0, 1.9fr) minmax(210px, 0.7fr);
  gap: 12px;
  align-items: stretch;
}
.panel {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg1);
  display: flex; flex-direction: column; min-width: 0;
  height: 640px;
}
.panel-head { padding: 0.8rem 1rem; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: var(--fs-small); font-weight: 600; color: var(--ink2); }

/* chat */
.chat { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.7rem; scroll-behavior: smooth; }
.msg { max-width: 92%; font-size: 0.92rem; line-height: 1.55; animation: msg-in 0.35s var(--ease-out); }
@keyframes msg-in { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }
.msg-who { display: block; color: var(--ink3); font-size: 0.74rem; margin-bottom: 0.2rem; }
.msg p { padding: 0.65em 0.85em; border-radius: var(--radius); background: var(--bg2); }
.msg--you { align-self: flex-end; }
.msg--you p { background: var(--acc-soft); color: var(--ink); }
.msg--intro { max-width: 100%; color: var(--ink2); }
.msg--intro p { background: none; padding: 0; }
.msg--typing { color: var(--ink2); font-size: 0.8rem; animation: typing-pulse 1.2s ease-in-out infinite; }
@keyframes typing-pulse { 50% { opacity: 0.45; } }
.msg--quote { align-self: stretch; max-width: 100%; background: var(--bg2); border-radius: var(--radius); padding: 0.5em 0.2em; }
.msg--quote p { background: none; padding: 0.25em 0.75em; color: var(--ink2); }

.demo-choices { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.demo-choice {
  position: relative; overflow: hidden;
  border: 1px solid var(--acc); border-radius: var(--radius);
  padding: 0.55em 0.9em; font-size: 0.86rem; color: var(--ink);
  transition: background 0.2s, color 0.2s, scale 0.15s;
}
.demo-choice:hover { background: var(--acc); color: #0b0b0c; }
.demo-choice:active { scale: 0.96; }
.chat-foot { padding: 0.8rem 1rem; border-top: 1px solid var(--line); }
.chat-foot .btn { width: 100%; justify-content: center; }
.chat-foot .btn[hidden] { display: none; }

/* board */
.board {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
  padding: 0.8rem; position: relative;
}
.board.is-empty::after {
  content: attr(data-empty);
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--ink3); font-size: var(--fs-small); pointer-events: none;
}
.board-col { background: var(--bg0); border-radius: var(--radius); padding: 0.6rem; display: flex; flex-direction: column; min-height: 0; }
.board-col--you { background: color-mix(in srgb, var(--acc) 8%, var(--bg0)); }
.board-col h3 { display: flex; justify-content: space-between; gap: 0.4rem; font-size: 0.8rem; font-weight: 600; color: var(--ink2); margin-bottom: 0.6rem; }
.board-count { color: var(--ink3); font-weight: 500; }
.board-cards { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; flex: 1; min-height: 0; }
.task {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.55em 0.7em; font-size: 0.82rem; line-height: 1.4;
}
.task.is-new { animation: msg-in 0.35s var(--ease-out); }
.task h4 { font-weight: 600; font-size: inherit; }
.task p { color: var(--ink2); font-size: 0.76rem; }
.task.is-done h4 { color: var(--ink2); }

.demo-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 0.8rem; }
.demo-stats > div { padding: 0.5rem 0; }
.demo-stats dt { color: var(--ink2); font-size: 0.76rem; }
.demo-stats dd { font-size: clamp(1.5rem, 2.6vw, 2.2rem); font-weight: 800; font-variation-settings: "wdth" 118, "wght" 800; }
.demo-note { color: var(--ink3); font-size: 0.74rem; padding: 0 0.8rem 0.7rem; }

/* activity */
.activity { list-style: none; flex: 1; overflow-y: auto; padding: 0.8rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.activity li { display: grid; gap: 0.1rem; font-size: 0.82rem; animation: msg-in 0.35s var(--ease-out); }
.activity time { color: var(--ink3); font-family: var(--font-mono); font-size: 0.7rem; }

.demo-end {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-top: 12px; padding: 1.2rem 1.4rem;
  border: 1px solid var(--acc); border-radius: var(--radius);
  background: var(--acc-soft);
  animation: msg-in 0.45s var(--ease-out);
}
.demo-end[hidden] { display: none; }
.demo-end p { font-size: clamp(1.1rem, 2vw, 1.5rem); font-weight: 700; }

@media (max-width: 1100px) {
  .stage { grid-template-columns: 1fr 1.5fr; }
  .panel--log { grid-column: 1 / -1; height: 220px; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); overflow-y: auto; }
}
@media (max-width: 720px) {
  .stage { grid-template-columns: minmax(0, 1fr); }
  .panel { height: auto; }
  .chat { height: 420px; flex: none; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; min-height: 240px; }
  .board-cards { overflow: visible; }
  .panel--log { height: 200px; }
  .demo-stats dd { font-size: 1.5rem; }
}

html[lang="ar"] .demo-title { font-family: "Alexandria", sans-serif; font-variation-settings: normal; font-weight: 900; line-height: 1.3; }
html[lang="ar"] body.demo-page { font-family: "Alexandria", sans-serif; }
html[lang="ar"] .demo-stats dd { font-family: "Archivo", sans-serif; }
html[lang="ar"] .msg { line-height: 1.75; }
html[lang="ar"] .msg p { line-height: 1.75; }

.demo-title { font-size: clamp(1.9rem, 3.6vw, 3.2rem); }
.chat, .activity, .board-cards { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

.demo-top, .demo-main { position: relative; z-index: 1; }
.panel { background: color-mix(in srgb, var(--bg1) 92%, transparent); transition: border-color 0.4s; }
.panel:hover { border-color: var(--line-strong); }
.task { transition: border-color 0.2s, translate 0.25s var(--ease-out); }
.task:hover { translate: 0 -3px; border-color: var(--acc); }
