/* FlowCraft Scroll-Spy Contents — catalogue demo styles (extends site.css)
   Mirrors the buyer-delivered Tailwind widget with the site's own tokens.
   --site-header-h is measured by scroll-spy-demo.js (the site header wraps
   to two rows on narrow screens, so its height isn't fixed). */

/* The demo frame normally clips with overflow:hidden, which would stop the
   contents from sticking. overflow:clip keeps the rounded corners without that. */
.demo-frame.tocd-frame { overflow: visible; overflow: clip; }

.tocd { --tocd-bar: 60px; padding: 0 14px 28px; background: var(--surface); }
@media (min-width: 600px) { .tocd { padding: 0 24px 32px; } }
@media (min-width: 1024px) {
  .tocd { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 40px; padding: 32px 32px 40px; }
}

/* ---------- Contents: pill bar (phones/tablets) → sidebar (desktop) ---------- */
.tocd-aside {
  position: sticky; top: var(--site-header-h, 0px); z-index: 5;
  margin: 0 -14px; background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
@media (min-width: 600px) { .tocd-aside { margin: 0 -24px; } }
@media (min-width: 1024px) {
  .tocd-aside { top: calc(var(--site-header-h, 0px) + 24px); align-self: start; margin: 0; background: none; border: 0; backdrop-filter: none; }
}
.tocd-label { display: none; }
.tocd-meter, .tocd-read, .tocd-cta { display: none; }
@media (min-width: 1024px) {
  .tocd-label { display: block; margin: 0; font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-muted); }
  .tocd-meter { display: block; height: 6px; margin-top: 12px; border-radius: 99px; background: var(--line); overflow: hidden; }
  .tocd-read { display: block; margin: 8px 0 0; font-size: .78rem; color: var(--ink-muted); }
}
.tocd-meter span { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--accent); transition: width 120ms linear; }

.tocd-list {
  display: flex; gap: 8px; margin: 0; padding: 10px 40px 10px 14px; list-style: none;
  overflow-x: auto; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
}
.tocd-list::-webkit-scrollbar { display: none; }
.tocd-list li { flex: none; margin: 0; }
@media (min-width: 600px) { .tocd-list { padding-left: 24px; } }
@media (min-width: 1024px) {
  .tocd-list { flex-direction: column; gap: 2px; margin-top: 18px; padding: 0; overflow: visible; -webkit-mask-image: none; mask-image: none; }
}

.tocd-link {
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px;
  font-size: .9rem; color: var(--ink-muted); text-decoration: none;
  transition: color 200ms ease, background-color 200ms ease, border-color 200ms ease;
}
.tocd-link:hover { color: var(--ink); border-color: #b8bfd3; }
.tocd-link:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-line); }
.tocd-num { font-size: .75rem; font-variant-numeric: tabular-nums; opacity: .6; }
@media (min-width: 1024px) {
  .tocd-link { border: 0; border-left: 2px solid transparent; border-radius: 0 10px 10px 0; padding: 8px 14px; }
  .tocd-link:hover { border-left-color: #b8bfd3; }
}
/* Active link: app.js adds .is-active (set with data-active-class) */
.tocd-link.is-active { color: var(--accent-strong); background: var(--accent-soft); border-color: var(--accent); font-weight: 700; }
.tocd-link.is-active .tocd-num { opacity: 1; }

.tocd-cta { margin-top: 28px; padding: 18px; border-radius: 16px; background: var(--ink); color: #fff; }
@media (min-width: 1024px) { .tocd-cta { display: block; } }
.tocd-cta p { margin: 0; }
.tocd-cta strong { color: #fff; }
.tocd-cta span { display: block; margin-top: 4px; font-size: .86rem; color: #c9cfe3; }
.tocd-cta a { display: inline-block; white-space: nowrap; margin-top: 12px; padding: 8px 14px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 700; font-size: .86rem; text-decoration: none; }
.tocd-cta a:hover { background: var(--accent-strong); }

/* ---------- Content ---------- */
.tocd-main { min-width: 0; padding-top: 22px; }
@media (min-width: 1024px) { .tocd-main { padding-top: 0; } }
.tocd-sec { scroll-margin-top: calc(var(--site-header-h, 0px) + var(--tocd-bar) + 16px); }
@media (min-width: 1024px) { .tocd-sec { scroll-margin-top: calc(var(--site-header-h, 0px) + 24px); } }
.tocd-sec + .tocd-sec { margin-top: 56px; }
.tocd-step { margin: 0; font-size: .85rem; font-weight: 700; color: var(--accent); }
.tocd-sec h3 { margin: 4px 0 0; font-size: clamp(1.4rem, 1.1rem + 1vw, 1.8rem); letter-spacing: -.02em; outline: none; }
.tocd-sec figure { margin: 16px 0 0; border-radius: 16px; overflow: hidden; background: var(--bg-soft); border: 1px solid var(--line); }
.tocd-sec img { display: block; width: 100%; height: auto; }
.tocd-sec p.tocd-p { margin: 14px 0 0; line-height: 1.7; color: #2f3a5a; }
.tocd-get { margin-top: 18px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); }
.tocd-get strong { font-size: .9rem; }
.tocd-get ul { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: .9rem; color: var(--ink-muted); }
.tocd-get li { display: flex; gap: 8px; }
.tocd-get svg { width: 16px; height: 16px; flex: none; margin-top: 3px; color: var(--ok); }

.tocd-quote { margin-top: 56px; padding: 24px 20px; border-radius: 20px; background: var(--ink); color: #fff; }
@media (min-width: 600px) { .tocd-quote { padding: 32px; } }
.tocd-quote h3 { margin: 0; color: #fff; font-size: 1.5rem; }
.tocd-quote > p { margin: 6px 0 0; color: #c9cfe3; }
.tocd-quote .lead-form { margin-top: 18px; }

/* ---------- Compact version (catalogue card): its own scrolling box ---------- */
.tocd-box { height: 420px; overflow-y: auto; overscroll-behavior: contain; border-radius: 16px; background: var(--surface); }
.tocd-box .tocd { --site-header-h: 0px; --tocd-bar: 52px; padding: 0 12px 20px; }
.tocd-box .tocd-aside { margin: 0 -12px; top: 0; }
.tocd-box .tocd-list { padding: 8px 36px 8px 12px; }
.tocd-box .tocd-link { padding: 5px 11px; font-size: .82rem; }
.tocd-box .tocd-sec { scroll-margin-top: calc(var(--tocd-bar) + 10px); }
.tocd-box .tocd-sec + .tocd-sec { margin-top: 32px; }
.tocd-box .tocd-sec h3 { font-size: 1.15rem; }
.tocd-box .tocd-sec p.tocd-p { font-size: .88rem; line-height: 1.6; margin-top: 10px; }
.tocd-box .tocd-sec figure { margin-top: 10px; border-radius: 12px; }
/* The catalogue card is narrow even on desktop, so it always uses the pill bar. */
@media (min-width: 1024px) {
  .tocd-box .tocd { display: block; padding: 0 12px 20px; }
  .tocd-box .tocd-aside { position: sticky; top: 0; margin: 0 -12px; background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--line); }
  .tocd-box .tocd-label, .tocd-box .tocd-meter, .tocd-box .tocd-read, .tocd-box .tocd-cta { display: none; }
  .tocd-box .tocd-list { flex-direction: row; gap: 6px; margin: 0; padding: 8px 36px 8px 12px; overflow-x: auto;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
  .tocd-box .tocd-link { border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; }
  .tocd-box .tocd-link.is-active { border-color: var(--accent); }
  .tocd-box .tocd-main { padding-top: 16px; }
  .tocd-box .tocd-sec { scroll-margin-top: calc(var(--tocd-bar) + 10px); }
}
.tocd-box-hint { margin: 8px 4px 0; font-size: .82rem; color: var(--ink-muted); }

@media (prefers-reduced-motion: reduce) {
  .tocd-link, .tocd-meter span { transition: none; }
}

/* Catalogue card: let the grid column shrink (the pill row is wider than the
   column and scrolls sideways), and keep the "Live Demo" badge above the pill bar. */
#scroll-spy .product-head > *, #scroll-spy .product-shot, #scroll-spy .live-widget { min-width: 0; }
#scroll-spy .live-badge { z-index: 10; }
@media (max-width: 479px) { #scroll-spy .product-head { padding: 24px 14px; } }
#scroll-spy .tocd-box { border-top: 20px solid var(--surface); border-radius: 16px 16px 16px 16px; }
