/* ============================================================
   DEMOS  (/demos) — walkthrough video library: full-height
   chapter rail on the left, stacked video sections on the right.
   Loads after global.css and reuses its tokens; layout mirrors
   docs/docs.css so the two shells feel like one system.
   ============================================================ */
:root {
  --demos-nav-h: 64px;
}

.demos-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  padding-top: var(--demos-nav-h);
  min-height: 100dvh;
}

/* ------------------------------------------------------------
   Left rail — chapters
   ------------------------------------------------------------ */
.demos-side { border-right: 1px solid var(--border); }
.demos-sidebar {
  position: sticky;
  top: var(--demos-nav-h);
  height: calc(100dvh - var(--demos-nav-h));
  padding: 18px 12px 14px;
  display: flex;
  flex-direction: column;
}
.demos-menu-btn { display: none; }        /* mobile only */
.demos-sidebar-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.demos-sidenav { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; padding-bottom: 12px; }

.demos-chapter {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--ink-3);
  transition: color .14s ease, background .14s ease;
}
.demos-chapter:hover { color: var(--ink); background: rgba(255,255,255,.04); }
.demos-chapter.is-active { color: var(--ink); background: rgba(255,255,255,.06); }

/* ------------------------------------------------------------
   Content — stacked walkthroughs
   ------------------------------------------------------------ */
.demos-content {
  width: 100%;
  max-width: 848px;      /* 768px article + side padding */
  margin: 0 auto;
  /* 18px top matches the sidebar padding, so the first frame
     starts on the same line as the first chapter link */
  padding: 18px 40px 120px;
}

.demo-section {
  margin-top: 64px;
  scroll-margin-top: calc(var(--demos-nav-h) + 28px);
}
.demo-section:first-of-type { margin-top: 0; }

/* video placeholder — swap the frame contents for a real player later */
.demo-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background:
    radial-gradient(90% 120% at 50% 0%, rgba(255,255,255,.035), transparent 60%),
    var(--bg-elev);
  overflow: hidden;
}
.demo-frame video,
.demo-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.demo-frame-chip {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(20,21,22,.9);
  font-size: 11.5px;
  color: var(--ink-3);
}
.demo-frame-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--border-2);
  background: rgba(255,255,255,.04);
  color: var(--ink-3);
}
.demo-frame-play svg { margin-left: 2px; }   /* optical centering of the triangle */
.demo-frame-note { font-size: 13px; color: var(--ink-4); padding: 0 20px; text-align: center; }

.demo-title {
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -.01em;
  color: var(--ink);
  margin-bottom: 14px;
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 900px) {
  .demos-shell { grid-template-columns: 1fr; }
  .demos-side { border-right: 0; border-bottom: 1px solid var(--border); }

  /* chapter rail collapses behind a "Chapters" disclosure button */
  .demos-sidebar { position: static; height: auto; padding: 14px 20px; }
  .demos-menu-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 42px;
    padding: 0 14px;
    background: var(--bg-elev);
    border: 1px solid var(--border-2);
    border-radius: 12px;
    color: var(--ink-2);
    font-family: var(--font);
    font-size: 14px;
    cursor: pointer;
  }
  .demos-menu-btn svg { color: var(--ink-4); transition: transform .15s ease; }
  .demos-menu-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
  .demos-sidebar-panel { display: none; margin-top: 10px; }
  .demos-sidebar.is-open .demos-sidebar-panel { display: flex; }
  .demos-sidenav { flex: none; overflow: visible; padding-bottom: 8px; }
  .demos-chapter { height: 38px; }          /* tappable rows */

  .demos-content { padding: 24px 20px 80px; }
  .demo-section { margin-top: 48px; }
  .demo-frame-play { width: 48px; height: 48px; }
}

@media (max-width: 640px) {
  :root { --demos-nav-h: 58px; }      /* the site nav shrinks at this width */
}
