/* ==========================================================================
   Public project-brief demo
   Reuses the private tool's document system; only demo affordances live here.
   ========================================================================== */

.demo-page {
  --demo-gold: #e8c56a;
  --demo-gold-soft: #fbf4dc;
  --demo-ink: #15171c;
  --max: 1200px;
  --demo-toolbar-h: 58px;
  padding-top: 52px;
}

/* Global navigation is fixed; the demo toolbar pins directly beneath it. */
.demo-toolbar {
  position: sticky;
  top: 52px;
  z-index: 90;
  min-height: var(--demo-toolbar-h);
  border-bottom: 1px solid #e7e9ee;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px -22px rgba(16, 24, 40, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.demo-toolbar-inner {
  width: min(1200px, 92%);
  min-height: var(--demo-toolbar-h);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.demo-toolbar-identity {
  display: flex;
  align-items: center;
  min-width: 0;
}

.demo-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.demo-toolbar-info .info-tip-trigger {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #5f6672;
  opacity: 0.85;
  transition: color 0.18s ease, background 0.18s ease;
}

.demo-toolbar-info .info-tip-trigger:hover,
.demo-toolbar-info .info-tip-trigger[aria-expanded="true"] {
  color: #15171c;
  background: rgba(21, 23, 28, 0.06);
  opacity: 1;
}

.demo-toolbar-info .info-tip-trigger .icon {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.demo-export-wrap {
  position: relative;
  flex: none;
}

.demo-export-trigger {
  width: 36px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #5f6672;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.demo-export-trigger:hover,
.demo-export-trigger[aria-expanded="true"] {
  border-color: var(--line-strong);
  background: #f8f9fb;
  color: #15171c;
}

.demo-export-trigger .icon {
  width: 17px;
  height: 17px;
}

.demo-export-panel {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 80;
  width: 238px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(16, 24, 40, 0.2);
  animation: menuIn 0.16s var(--ease);
}

.demo-export-title {
  margin: 0;
  padding: 7px 9px 8px;
  border-bottom: 1px solid var(--line);
  color: #8a909b;
  font-size: 0.61rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.demo-export-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border-radius: 8px;
  color: #30353e;
  font-size: 0.78rem;
  line-height: 1.25;
}

.demo-export-option:hover {
  background: #f5f6f8;
}

.demo-export-option-icon {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #f3f4f6;
  color: #5f6672;
}

.demo-export-option-icon .icon {
  width: 15px;
  height: 15px;
}

.demo-export-option strong,
.demo-export-option small {
  display: block;
}

.demo-export-option strong {
  font-size: 0.78rem;
  font-weight: 650;
}

.account-menu.is-floating,
.demo-export-panel.is-floating {
  position: fixed;
  right: auto;
  z-index: 300;
}

.demo-export-option.is-busy {
  opacity: 0.55;
  pointer-events: none;
}

.demo-export-option small {
  margin-top: 2px;
  color: #8a909b;
  font-size: 0.67rem;
}

.demo-page .section-hint {
  color: #5c6370;
  font-weight: 600;
}

.demo-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.demo-page .doc-title {
  margin: 12px 0 10px;
}

.status-pill--demo {
  background: var(--gold-soft);
  color: var(--gold-ink);
}

.demo-bar {
  width: min(1200px, 92%);
  margin: 16px auto 0;
  padding: 11px 14px;
  border: 1px solid #e7dfc9;
  border-radius: 12px;
  background: linear-gradient(135deg, #fffdf6 0%, #fbf7e9 100%);
  box-shadow: 0 8px 26px -20px rgba(53, 43, 17, 0.4);
}

.demo-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.demo-bar-copy {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.demo-badge-row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
}

.demo-mobile-tip {
  display: none;
}

.demo-bar-copy p {
  max-width: 660px;
  margin: 0;
  color: #5f5744;
  font-size: 0.75rem;
  line-height: 1.55;
}

.demo-bar-copy p strong {
  color: #2e291e;
  font-weight: 750;
}

.demo-badge {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #17181b;
  color: var(--demo-gold);
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.demo-badge .icon {
  width: 13px;
  height: 13px;
}

.demo-bar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
}

.demo-export,
.demo-start {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}

.demo-export {
  border: 1px solid #ddd5c2;
  background: #ffffff;
  color: #4e493d;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.demo-export:hover {
  border-color: #b9ab88;
  background: #fffcf5;
}

.demo-export .icon {
  width: 14px;
  height: 14px;
}

.demo-export.is-busy {
  cursor: wait;
  opacity: 0.62;
}

.demo-start {
  background: #17181b;
  color: #ffffff;
  box-shadow: 0 6px 14px -8px rgba(0, 0, 0, 0.6);
}

.demo-start:hover {
  background: #292b31;
}

.demo-start .icon {
  width: 14px;
  height: 14px;
  color: var(--demo-gold);
}

.demo-page .doc-shell {
  width: min(1200px, 92%);
  margin-top: 18px;
}

.demo-footer .doc-footer-inner {
  width: min(1200px, 92%);
}

.demo-page .doc-nav {
  top: calc(52px + var(--demo-toolbar-h) + 18px);
}

.demo-page .section,
.demo-page .feature-card,
.demo-page .feature-group-edit,
.demo-page .read-feature,
.demo-page .feature-product-group {
  scroll-margin-top: calc(52px + var(--demo-toolbar-h) + 18px);
}

/* layout.css's global section rhythm must not add space inside the document. */
.demo-page .feature-group-edit {
  padding-bottom: 0;
}

.demo-page .feature-product-group {
  padding: 0;
}

.demo-page .doc {
  border-color: rgba(16, 24, 40, 0.06);
}

.demo-try-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 0 0 18px;
  padding: 10px 12px;
  border: 1px solid #ece2c8;
  border-radius: 9px;
  background: #fdfaf0;
  color: #6d5a16;
  font-size: 0.75rem;
  font-weight: 550;
  line-height: 1.55;
}

.demo-try-note .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  flex: none;
  color: var(--gold-ink);
}

.demo-locked {
  background: #fbfbfc;
  cursor: default;
}

textarea.demo-locked {
  overflow-y: hidden;
  resize: none;
}

.demo-locked:hover {
  border-color: var(--line);
}

.demo-locked:focus {
  border-color: var(--line);
  box-shadow: none;
}

/* Demo controls in the fixed footer -------------------------------------- */

.demo-footer .share-field {
  width: min(250px, 100%);
}

.demo-footer .send-button.demo-disabled,
.demo-footer .save-button.demo-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.demo-footer .send-button.demo-disabled:hover,
.demo-footer .save-button.demo-disabled:hover {
  background: var(--gold);
  transform: none;
}

.demo-footer .save-button.demo-disabled:hover {
  background: transparent;
}

.demo-footer .switch.demo-disabled,
.demo-footer .switch.demo-disabled input {
  cursor: not-allowed;
}

.demo-footer .switch.demo-disabled {
  opacity: 0.68;
}

.demo-footer .save-state {
  color: #aeb4bf;
}

.demo-page .toast {
  bottom: calc(var(--footer-h) + 20px);
}

.demo-page .cw-fab {
  bottom: calc(var(--footer-h) + 18px);
}

.demo-page .cw-panel {
  bottom: calc(var(--footer-h) + 92px);
  max-height: calc(100dvh - var(--footer-h) - 120px);
}

/* Explainer below the document ------------------------------------------- */

.demo-explainer {
  grid-column: 2;
  width: 100%;
  margin: 18px 0 16px;
  padding: clamp(28px, 5vw, 48px);
  border: 1px solid rgba(16, 24, 40, 0.06);
  border-radius: 5px;
  background: #ffffff;
  box-shadow: var(--shadow-paper);
}

.demo-explainer-head {
  max-width: 680px;
}

.demo-explainer-head .eyebrow {
  margin-bottom: 10px;
}

.demo-explainer-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3.4vw, 2.5rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: #111318;
}

.demo-explainer-head > p:last-child {
  margin: 12px 0 0;
  color: #5c6370;
  font-size: 0.9rem;
  line-height: 1.7;
}

.demo-explainer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.demo-explainer-grid article {
  padding: 18px;
  border: 1px solid #eceef2;
  border-radius: 11px;
  background: #fcfcfd;
}

.demo-explainer-num {
  display: inline-block;
  margin-bottom: 11px;
  color: var(--gold-ink);
  font-family: var(--serif);
  font-size: 1rem;
}

.demo-explainer-grid h3 {
  margin: 0 0 7px;
  color: #20242c;
  font-size: 0.84rem;
  font-weight: 700;
}

.demo-explainer-grid p {
  margin: 0;
  color: #69707c;
  font-size: 0.78rem;
  line-height: 1.65;
}

.demo-faq {
  margin-top: 32px;
  padding-top: 26px;
  border-top: 1px solid #eceef2;
}

.demo-faq h3 {
  margin: 0 0 10px;
  color: #20242c;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.demo-faq details {
  border-bottom: 1px solid #eceef2;
}

.demo-faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  color: #2b303a;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.demo-faq summary::-webkit-details-marker {
  display: none;
}

.demo-faq summary span {
  color: var(--gold-ink);
  font-size: 1.05rem;
  line-height: 1;
  transition: transform 0.18s ease;
}

.demo-faq details[open] summary span {
  transform: rotate(45deg);
}

.demo-faq details p {
  max-width: 68ch;
  margin: -2px 0 14px;
  color: #69707c;
  font-size: 0.81rem;
  line-height: 1.65;
}

.demo-explainer-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 28px;
}

.demo-text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gold-ink);
  font-size: 0.78rem;
  font-weight: 650;
}

.demo-text-link .icon {
  width: 14px;
  height: 14px;
}

.demo-text-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.demo-page .toast.is-visible {
  z-index: 120;
}

@media (max-width: 1080px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-location {
    display: none;
  }

  .nav-links {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(320px, 90vw);
    flex-direction: column;
    align-items: stretch;
    display: none;
    gap: 2px;
    padding: 10px;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18), 0 2px 10px rgba(0, 0, 0, 0.08);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    display: flex;
    padding: 12px 14px;
    font-size: 1rem;
  }

  .nav-links .nav-sep {
    align-self: stretch;
    width: auto;
    height: 1px;
    margin: 8px 4px;
    background: rgba(0, 0, 0, 0.12);
  }

  .nav-links a.btn,
  .nav-links button.btn {
    width: 100%;
    margin: 12px 0 0;
    justify-content: center;
    font-size: 0.95rem;
  }
}

@media (max-width: 900px) {
  .demo-bar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .demo-bar-actions {
    width: 100%;
  }

  .demo-start {
    margin-left: auto;
  }

  .demo-explainer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .demo-page .cw-fab {
    bottom: calc(var(--footer-h) + 18px);
  }

  .demo-page .cw-panel {
    bottom: calc(var(--footer-h) + 80px);
  }
}

@media (max-width: 760px) {
  .demo-bar {
    margin-top: 12px;
    padding: 11px;
  }

  .demo-bar-copy {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .demo-bar-actions {
    flex-wrap: wrap;
  }

  .demo-start {
    flex: 1;
    margin-left: 0;
  }

  .demo-page .doc-shell {
    margin-top: 12px;
  }

  .demo-toolbar-inner {
    gap: 10px;
  }

  .demo-toolbar-actions {
    gap: 6px;
  }

  .demo-page .welcome strong {
    max-width: 190px;
  }

  .demo-explainer {
    margin-top: 12px;
  }
}

@media (max-width: 560px) {
  .demo-toolbar-info {
    display: none;
  }

  .demo-mobile-tip {
    display: inline-flex;
  }

  .demo-mobile-tip .info-tip-trigger {
    width: 24px;
    height: 24px;
    color: var(--gold-ink);
    opacity: 1;
  }

  .demo-toolbar .account-trigger {
    padding: 3px;
  }

  .demo-toolbar .account-trigger > .icon {
    display: none;
  }

  .demo-toolbar .welcome-kicker {
    font-size: 0.52rem;
    letter-spacing: 0.12em;
  }

  .demo-toolbar .welcome strong {
    max-width: 160px;
    margin-top: 2px;
    font-size: 0.76rem;
    line-height: 1.25;
  }

  .demo-page .welcome strong {
    max-width: 160px;
  }

  .demo-page .status-pill--demo {
    font-size: 0.62rem;
  }

  .demo-footer .save-state {
    font-size: 0.62rem;
  }

  .demo-explainer-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 400px) {
  .demo-page .welcome strong {
    max-width: 140px;
  }

  .demo-toolbar-actions {
    gap: 5px;
  }

  .demo-page .account-trigger {
    padding: 3px;
  }

  .demo-page .account-trigger > .icon {
    display: none;
  }
}

@media print {
  header.nav,
  .demo-toolbar,
  .demo-bar,
  .demo-explainer,
  .demo-explainer-actions,
  .demo-faq,
  .demo-try-note,
  .demo-page .cw-fab,
  .demo-page .cw-panel {
    display: none !important;
  }

  .demo-page .doc {
    box-shadow: none;
  }
}
