/* ============================================================
   Reusable product-demo block — shared by template detail pages.
   Wraps the interactive Notion demo (ai-demo.css styles) and a
   lazy-loaded YouTube facade behind a two-mode switcher.
   Built on site.css tokens; works light + dark.
   ============================================================ */

.demo-block { padding: 72px 0; background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.demo-block.plain { background: var(--bg); border: none; }

/* mode switcher — segmented control */
.demo-switch {
  display: inline-flex;
  gap: 4px;
  margin: 26px auto 0;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.demo-switch button {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  background: none;
  border: none;
  border-radius: var(--radius-btn);
  padding: 8px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: color var(--transition), background var(--transition);
}
.demo-switch button svg { width: 16px; height: 16px; }
.demo-switch button:hover { color: var(--ink); }
.demo-switch button.is-active { color: var(--btn-primary-ink); background: var(--ink); }

/* panes */
.demo-panes { margin-top: 36px; }
.demo-pane { display: none; }
.demo-pane.is-active { display: block; }

/* the interactive workspace window (reuses .demo-window look) */
.demo-window {
  margin: 0 auto;
  max-width: 1000px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
/* WebKit fails to clip rounded corners when inner panels scroll (.nb-page /
   .ai-body have overflow:auto). Pre-round the corner elements so the window
   reads rounded everywhere — shadow stays intact (no mask hack). */
.demo-block .demo-window .demo-titlebar { border-radius: 16px 16px 0 0; }
.demo-block .demo-window .demo-split > *:first-child { border-bottom-left-radius: 16px; }
.demo-block .demo-window .demo-split > *:last-child { border-bottom-right-radius: 16px; }
@media (max-width: 879px) {
  /* single column: bottom corners belong to the last (chat) panel */
  .demo-block .demo-window .demo-split > *:first-child { border-bottom-left-radius: 0; }
  .demo-block .demo-window .demo-split > *:last-child { border-bottom-left-radius: 16px; border-bottom-right-radius: 16px; }
}

/* ---------- lazy YouTube facade ---------- */
.yt-facade {
  position: relative;
  max-width: 920px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  background: #0e0d0c;
  transform: translateZ(0); /* force WebKit to honour border-radius clip */
}
.yt-facade img,
.yt-facade image-slot { position: absolute; inset: 0; width: 100%; height: 100%; }
.yt-facade .yt-poster-ph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(125deg, #1E0F04 0%, #6B380E 48%, #D9730D 100%);
  color: #fff; font-weight: 700; font-size: 17px; letter-spacing: -0.01em;
  text-align: center; padding: 24px;
}
.yt-facade .yt-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.45));
  transition: background var(--transition);
}
.yt-facade:hover .yt-scrim { background: linear-gradient(180deg, rgba(0,0,0,0.10), rgba(0,0,0,0.55)); }
.yt-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(20,18,16,0.78);
  border: 1.5px solid rgba(255,255,255,0.28);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--transition), background var(--transition);
}
.yt-facade:hover .yt-play { transform: translate(-50%, -50%) scale(1.06); background: var(--accent); }
.yt-play svg { width: 26px; height: 26px; margin-left: 3px; color: #fff; }
.yt-label {
  position: absolute; left: 18px; bottom: 16px;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: #fff;
  background: rgba(20,18,16,0.6); border-radius: var(--radius-pill);
  padding: 6px 13px; backdrop-filter: blur(4px);
}
.yt-facade iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- demo content extras (shared by blog + goals demos) ---------- */
/* outline / doc lines */
.nb-doc { display: flex; flex-direction: column; gap: 2px; }
.nb-doc .nb-h { font-size: 16px; font-weight: 800; color: var(--ink); letter-spacing: -0.01em; padding: 6px 4px 2px; }
.nb-outline { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-sm); }
.nb-outline .nb-sec {
  display: flex; align-items: center; gap: 9px;
  font-size: 13.5px; color: var(--ink); font-weight: 600;
  padding: 10px 13px; border-bottom: 1px solid var(--line);
  animation: msg-in 0.3s ease both;
}
.nb-outline .nb-sec:last-child { border-bottom: none; }
.nb-outline .nb-sec .hh { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 5px; padding: 2px 6px; flex: none; }
.nb-outline .nb-sec .muted { color: var(--ink-faint); font-weight: 500; }

/* SEO score card */
.seo-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow-sm); }
.seo-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.seo-ring {
  width: 58px; height: 58px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800; color: var(--ink);
  background: conic-gradient(var(--accent) var(--p, 0%), color-mix(in srgb, var(--accent) 14%, transparent) 0);
  position: relative;
}
.seo-ring::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--card); }
.seo-ring span { position: relative; z-index: 1; }
.seo-top .seo-h { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.seo-top .seo-sub { font-size: 12.5px; color: var(--ink-faint); margin-top: 2px; }
.seo-checks { display: flex; flex-direction: column; gap: 7px; }
.seo-check { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-soft); animation: msg-in 0.3s ease both; }
.seo-check .tick { width: 16px; height: 16px; border-radius: 50%; flex: none; background: color-mix(in srgb, #2E9E63 18%, transparent); color: #2E9E63; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; }
html[data-theme="dark"] .seo-check .tick { color: #5FCE96; }
.seo-check b { color: var(--ink); font-weight: 600; }

/* progress bar (goals demo) */
.nb-goal { border: 1px solid var(--line); border-radius: 11px; padding: 14px 15px; box-shadow: var(--shadow-sm); }
.nb-goal-h { font-size: 14.5px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.nb-goal-sub { font-size: 12.5px; color: var(--ink-faint); margin-top: 3px; }
.nb-bar { height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--ink-faint) 18%, transparent); margin-top: 12px; overflow: hidden; }
.nb-bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); width: 0%; transition: width 0.5s var(--ease); }
.nb-bar-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-faint); margin-top: 7px; font-weight: 600; }
.nb-milestones { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.nb-ms { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink-soft); padding: 6px 4px; border-radius: 7px; cursor: pointer; transition: background var(--transition); }
.nb-ms:hover { background: var(--bg-alt); }
.nb-ms .box { width: 16px; height: 16px; border-radius: 5px; flex: none; border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 10px; color: #fff; transition: background 0.2s ease, border-color 0.2s ease; }
.nb-ms.done .box { background: var(--accent); border-color: var(--accent); }
.nb-ms.done { color: var(--ink); text-decoration: line-through; text-decoration-color: var(--ink-faint); }
.nb-hint { font-size: 12px; color: var(--ink-faint); margin-top: 10px; text-align: center; font-style: italic; }

.demo-note { text-align: center; font-size: 13.5px; color: var(--ink-faint); margin-top: 22px; }
.demo-note a { color: var(--accent); font-weight: 600; text-decoration: none; }
.demo-note a:hover { text-decoration: underline; }
