/* DemoProj showcase additions; use the existing GBClaw theme tokens. */
.demo-showcase {
  --composer-h: 0px;
  --demo-gutter: clamp(1rem, 4vw, 3rem);
  --demo-content-width: 1120px;
}

.demo-showcase #chat-form,
.demo-showcase .composer-spacer,
.demo-showcase #project-new-btn,
.demo-showcase .project-modal-actions {
  display: none !important;
}

.brand-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.demo-badge,
.demo-readonly {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 0.65rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.demo-badge { text-transform: uppercase; }

.demo-showcase .brand { min-width: 0; flex-shrink: 1; }
.demo-showcase .brand > div { min-width: 0; }
.demo-showcase .brand p { color: var(--text-soft); }
.demo-showcase .header-actions { min-width: 0; }
.demo-showcase .status-badge { white-space: nowrap; }
.demo-showcase main { padding-top: 0; padding-bottom: calc(var(--footer-h) + 1.5rem); }

.demo-showcase .welcome,
.demo-section {
  width: 100%;
  max-width: var(--demo-content-width);
  margin-inline: auto;
  padding-inline: var(--demo-gutter);
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.demo-showcase .welcome {
  padding-top: 1.75rem;
  padding-bottom: 1.25rem;
  text-align: left;
}

.demo-showcase .welcome .demo-eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.035em;
}

.demo-showcase .welcome h2 { font-size: clamp(1.6rem, 2.5vw, 2rem); margin-bottom: 0.45rem; }
.demo-showcase .welcome #welcome-description { max-width: 760px; margin: 0 0 1rem; color: var(--text-soft); }
.demo-showcase .chips { justify-content: flex-start; gap: 0.5rem; }
.demo-showcase .chip { color: var(--text-soft); font-family: inherit; }
.demo-showcase .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.demo-section { margin-bottom: 1.65rem; min-width: 0; }
.demo-section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem 1rem; margin-bottom: 0.55rem; }
.demo-section-heading h2 { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.015em; }
.demo-section-description { max-width: 850px; color: var(--text-soft); font-size: 0.86rem; line-height: 1.65; margin-bottom: 0.9rem; }
.demo-section-meta { color: var(--text-soft); font-size: 0.72rem; }
.demo-overview { padding-top: 1.25rem; border-top: 1px solid var(--border); }

.demo-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.65rem; margin-bottom: 0.9rem; }
.demo-facts > div { min-width: 0; background: var(--agent-bubble); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.85rem 1rem; }
.demo-facts dt { color: var(--text-soft); font-size: 0.7rem; margin-bottom: 0.2rem; }
.demo-facts dd { color: var(--text); font-size: 1.1rem; font-weight: 600; }
.demo-facts dd span { display: block; color: var(--text-soft); font-size: 0.72rem; font-weight: 400; margin-top: 0.2rem; }

.demo-workflow { display: flex; flex-wrap: wrap; gap: 0.4rem 1.3rem; list-style: none; counter-reset: stage; margin-bottom: 0.85rem; }
.demo-workflow li { display: flex; align-items: center; gap: 0.35rem; color: var(--text-soft); font-size: 0.72rem; counter-increment: stage; }
.demo-workflow li::before { content: counter(stage); display: inline-grid; place-items: center; width: 1.25rem; height: 1.25rem; background: var(--accent-soft); border-radius: 50%; color: var(--accent); font-size: 0.63rem; font-weight: 650; flex-shrink: 0; }
.demo-stats { display: flex; flex-wrap: wrap; gap: 0.55rem 1.5rem; margin-block: 0.75rem; }
.demo-stats:empty { display: none; }
.demo-stat { display: inline-flex; align-items: baseline; gap: 0.4rem; }
.demo-stat strong { color: var(--text); font-size: 1rem; font-weight: 650; }
.demo-stat span { color: var(--text-soft); font-size: 0.73rem; }
.demo-scope-note { border-left: 3px solid var(--accent); padding: 0.5rem 0.8rem; background: var(--accent-soft); border-radius: 0 7px 7px 0; color: var(--text-soft); font-size: 0.75rem; line-height: 1.65; }

.demo-memory-details { border: 1px solid var(--border); border-radius: var(--radius); background: var(--agent-bubble); overflow: hidden; }
.demo-memory-details > summary { padding: 0.8rem 1rem; cursor: pointer; color: var(--text-soft); font-size: 0.8rem; font-weight: 550; }
.demo-memory-details > summary:hover { color: var(--accent); background: var(--hover-overlay); }
.demo-memory-details > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.demo-memory-details[open] > summary { border-bottom: 1px solid var(--border); }
.demo-memory-content { padding: 1rem; overflow-wrap: anywhere; font-size: 0.8rem; line-height: 1.65; }
.demo-memory-content > :first-child { margin-top: 0; }
.demo-memory-content h1, .demo-memory-content h2, .demo-memory-content h3 { font-size: 1rem; line-height: 1.4; margin: 1.4rem 0 0.6rem; }
.demo-memory-content p, .demo-memory-content ul, .demo-memory-content ol { margin-block: 0.6rem; }
.demo-memory-content ul, .demo-memory-content ol { padding-left: 1.25rem; }
.demo-memory-content li { margin-block: 0.3rem; }
.demo-memory-content code { background: var(--code-bg); padding: 0.1em 0.3em; border-radius: 4px; font-size: 0.9em; }
.demo-memory-content pre { max-width: 100%; overflow-x: auto; padding: 0.75rem; background: var(--code-block-bg); border-radius: 7px; }
.demo-memory-content pre code { padding: 0; background: none; }
.demo-memory-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.demo-memory-content th, .demo-memory-content td { padding: 0.5rem; border: 1px solid var(--border); }
.demo-memory-content a, .demo-gallery-caption a { color: var(--accent); text-underline-offset: 0.2em; }
.demo-memory-content a:hover, .demo-gallery-caption a:hover { text-decoration-thickness: 2px; }
.demo-loading { color: var(--text-soft); font-size: 0.8rem; padding: 0.5rem 0; }

.demo-gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 0.8rem; }
.demo-gallery-card { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--agent-bubble); overflow: hidden; }
.demo-gallery-image { display: block; width: 100%; height: 185px; padding: 0.6rem; border: 0; border-bottom: 1px solid var(--border); background: #fff; cursor: zoom-in; overflow: hidden; }
.demo-gallery-image img { display: block; width: 100%; height: 100%; object-fit: contain; transition: transform 0.2s ease; }
.demo-gallery-image:hover img { transform: scale(1.035); }
.demo-gallery-image:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.demo-gallery-caption { padding: 0.8rem 0.9rem; }
.demo-gallery-caption h3 { color: var(--text); font-size: 0.86rem; font-weight: 600; margin-bottom: 0.35rem; }
.demo-gallery-caption p { color: var(--text-soft); font-size: 0.74rem; line-height: 1.6; margin-bottom: 0.4rem; }
.demo-gallery-caption a { display: inline-block; font-size: 0.73rem; overflow-wrap: anywhere; }
.demo-gallery-caption a + a { margin-left: 0.75rem; }

#demo-map-content { min-width: 0; max-width: 100%; }
#demo-map-content .dichromatic-widget { max-width: 100%; }
.demo-history-header { margin-bottom: 0.4rem; }
.demo-search { display: flex; align-items: center; gap: 0.6rem; width: 100%; padding: 0.6rem 0.8rem; border: 1px solid var(--border); background: var(--agent-bubble); border-radius: 8px; }
.demo-search:focus-within { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.demo-search svg { width: 1rem; height: 1rem; color: var(--text-soft); flex-shrink: 0; }
.demo-search input { min-width: 0; width: 100%; border: 0; background: transparent; color: var(--text); font-family: inherit; font-size: 0.8rem; outline: none; }
.demo-search input::placeholder { color: var(--text-soft); opacity: 0.8; }
.demo-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.demo-showcase #chat-log { width: 100%; max-width: var(--demo-content-width); margin-inline: auto; padding: 0.6rem var(--demo-gutter) 1rem; }
.demo-showcase .message { overflow-wrap: anywhere; }
.demo-showcase .message[hidden] { display: none !important; }
.demo-showcase .message.agent { max-width: 100%; width: 100%; }
.demo-showcase .bubble { min-width: 0; }
.demo-showcase .bubble table { max-width: 100%; }
.demo-showcase .bubble pre { max-width: 100%; }

@media (max-width: 1100px) {
  .demo-showcase header { padding: 0.8rem 1rem; gap: 0.6rem; }
  .demo-showcase .brand p { font-size: 0.72rem; }
  .demo-showcase .header-actions { gap: 0.5rem; }
}

@media (max-width: 900px) {
  .demo-showcase { --demo-gutter: 1rem; }
  .demo-showcase .file-preview-panel {
    position: fixed;
    top: auto;
    bottom: var(--footer-h);
    left: 0.6rem;
    right: 0.6rem;
    z-index: 30;
    width: calc(100% - 1.2rem);
    height: min(50dvh, var(--panel-h));
    max-height: 50dvh;
    margin: 0;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: 0 -8px 32px var(--shadow-color);
    overflow: hidden;
  }
  .demo-showcase .file-preview-header { flex-shrink: 0; }
  .demo-showcase .file-preview-content { flex: 1; min-height: 0; overflow: auto; }
  .demo-showcase .file-preview-download,
  .demo-showcase .file-preview-close { flex-shrink: 0; }
  .demo-showcase .welcome { padding-top: 1.25rem; }
}

@media (max-width: 600px) {
  .demo-showcase header { align-items: flex-start; padding: 0.75rem; }
  .demo-showcase .brand { width: 100%; }
  .demo-showcase .brand .logo { width: 36px; height: 36px; }
  .demo-showcase .brand h1 { font-size: 1.1rem; }
  .demo-showcase .header-actions { width: 100%; justify-content: space-between; gap: 0.4rem; }
  .demo-showcase .project-bar { gap: 0.35rem; padding-left: 0.55rem; max-width: 100%; }
  .demo-showcase .project-label { display: none; }
  .demo-showcase .status-badge { font-size: 0.65rem; padding-inline: 0.5rem; }
  .demo-showcase .chip { font-size: 0.75rem; padding: 0.4rem 0.65rem; }
  .demo-section { margin-bottom: 1.3rem; }
  .demo-facts { grid-template-columns: 1fr; gap: 0.45rem; }
  .demo-facts > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: center; gap: 0.5rem; padding: 0.65rem 0.8rem; }
  .demo-facts dt { margin: 0; }
  .demo-facts dd { font-size: 0.95rem; }
  .demo-facts dd span { font-size: 0.66rem; }
  .demo-workflow { gap: 0.5rem 0.8rem; }
  .demo-gallery-grid { grid-template-columns: 1fr; }
  .demo-gallery-image { height: 220px; }
  .demo-showcase footer { font-size: 0.63rem; padding: 0.65rem; }
}

@media (prefers-reduced-motion: reduce) {
  .demo-gallery-image img { transition: none; }
  .demo-showcase .message { animation: none; }
}
