/* Guide page. Screenshots sit on the same graphite "studio floor" as the editor canvas; the numbered markers use
   the amber guide colour the editor uses for snapping guides, so "look here" reads the same across the section. */

.cd-guide { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }

/* ---------- table of contents ---------- */
.cd-guide-toc { position: sticky; top: 70px; display: flex; flex-direction: column; background: var(--cd-surface); border: 1px solid var(--cd-line); border-radius: var(--cd-radius); padding: 10px 0; max-height: calc(100vh - 90px); overflow-y: auto; }
.cd-guide-toc-group { font-size: .85rem; font-weight: 700; color: var(--cd-ink-2); padding: 10px 16px 4px; }
.cd-guide-toc-group:first-child { padding-top: 2px; }
.cd-guide-toc a { display: flex; align-items: center; gap: 10px; padding: 6px 16px 6px 13px; color: var(--cd-ink-2); border-left: 3px solid transparent; font-size: 1rem; text-decoration: none; }
.cd-guide-toc a i { width: 1rem; text-align: center; opacity: .75; }
.cd-guide-toc a:hover { color: var(--cd-ink); background: var(--cd-surface-2); }
.cd-guide-toc a:focus-visible { outline: 2px solid var(--cd-select); outline-offset: -2px; }

/* ---------- sections ---------- */
.cd-guide-sec { background: var(--cd-surface); border: 1px solid var(--cd-line); border-radius: var(--cd-radius); padding: 22px 26px 24px; margin-bottom: 20px; scroll-margin-top: 70px; }
.cd-guide-sec > header { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.cd-guide-icon { width: 40px; height: 40px; border-radius: 8px; background: var(--cd-floor); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; flex: none; }
.cd-guide-kicker { font-size: .92rem; color: var(--cd-ink-2); }
.cd-guide-sec h2 { font-size: 1.3rem; }
.cd-guide-lead { max-width: 75ch; font-size: 1rem; line-height: 1.6; color: var(--cd-ink); margin-bottom: 16px; }

/* getting-started flow: a real sequence, so it is numbered */
.cd-guide-flow { list-style: none; counter-reset: flow; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; padding: 0; margin: 0 0 14px; }
.cd-guide-flow li { counter-increment: flow; position: relative; border: 1px solid var(--cd-line); border-radius: var(--cd-radius); padding: 14px 14px 14px 52px; background: var(--cd-surface-2); display: flex; flex-direction: column; gap: 3px; font-size: 1rem; color: var(--cd-ink-2); }
.cd-guide-flow li strong { color: var(--cd-ink); font-size: 1rem; }
.cd-guide-flow li::before { content: counter(flow); position: absolute; left: 14px; top: 14px; width: 26px; height: 26px; border-radius: 50%; background: var(--cd-floor); color: #fff; font-weight: 700; font-size: .92rem; display: flex; align-items: center; justify-content: center; }

/* ---------- annotated screenshot ---------- */
.cd-guide-shot { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; margin: 0 0 18px; align-items: start; }
.cd-guide-frame { position: relative; background: var(--cd-floor); padding: 10px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--cd-bezel); }
.cd-guide-canvas { position: relative; }
.cd-guide-frame img { display: block; width: 100%; height: auto; border-radius: 4px; cursor: zoom-in; }
.cd-guide-spot { position: absolute; transform: translate(-50%, -50%); width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: var(--cd-guide); color: #1b2430; font-weight: 800; font-size: .92rem; line-height: 1; padding: 0; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); cursor: help; transition: transform .15s ease; animation: cd-spot-in .4s ease-out backwards; }
.cd-guide-spot::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--cd-guide); animation: cd-spot-pulse 2.4s ease-out infinite; animation-delay: inherit; pointer-events: none; }
.cd-guide-spot.active, .cd-guide-spot:hover, .cd-guide-spot:focus-visible { transform: translate(-50%, -50%) scale(1.25); z-index: 2; outline: none; }
.cd-guide-spot.active::after { animation: none; inset: -7px; border-width: 3px; opacity: .9; }
@keyframes cd-spot-pulse { 0% { transform: scale(1); opacity: .9; } 70%, 100% { transform: scale(2.1); opacity: 0; } }
@keyframes cd-spot-in { from { transform: translate(-50%, -50%) scale(0); } to { transform: translate(-50%, -50%) scale(1); } }

.cd-guide-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cd-guide-legend li { display: flex; gap: 10px; padding: 7px 8px; border-radius: var(--cd-radius); font-size: 1rem; line-height: 1.45; color: var(--cd-ink); transition: background .15s ease; }
.cd-guide-legend li.active { background: #fff4e0; }
.cd-guide-no { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--cd-guide); color: #1b2430; font-weight: 800; font-size: .85rem; display: flex; align-items: center; justify-content: center; margin-top: 1px; }

/* publish wizard steps */
.cd-guide-steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cd-guide-steps button { position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--cd-line); background: var(--cd-surface); color: var(--cd-ink-2); border-radius: 999px; padding: 5px 14px 5px 6px; font-size: 1rem; }
.cd-guide-steps button.active { border-color: var(--cd-ink); color: var(--cd-ink); font-weight: 600; }
.cd-guide-step-no { width: 22px; height: 22px; border-radius: 50%; background: var(--cd-surface-2); display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 700; }
.cd-guide-steps button.active .cd-guide-step-no { background: var(--cd-ink); color: #fff; }
.cd-guide-step-timer { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--cd-ink); animation: cd-step-timer 5s linear forwards; }
@keyframes cd-step-timer { from { width: 0; } to { width: 100%; } }

/* tips */
.cd-guide-tips { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cd-guide-tips li { display: flex; gap: 10px; background: var(--cd-surface-2); border-radius: var(--cd-radius); padding: 10px 14px; font-size: 1rem; line-height: 1.5; max-width: 90ch; }
.cd-guide-tips i { color: #c9851c; margin-top: 3px; }

/* ---------- sync animation ---------- */
.cd-sync-demo { border: 1px solid var(--cd-line); border-radius: 8px; padding: 16px 18px; margin-bottom: 16px; }
.cd-sync-demo-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; margin-bottom: 14px; }
.cd-sync-lanes { position: relative; display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; padding-left: 190px; }
.cd-sync-lane { position: relative; }
.cd-sync-name { position: absolute; left: -190px; width: 176px; top: 0; bottom: 0; display: flex; flex-direction: column; justify-content: center; font-size: .92rem; line-height: 1.25; }
.cd-sync-name span { color: var(--cd-ink-2); font-size: .92rem; }
.cd-sync-name i { color: var(--cd-guide); margin-left: 4px; }
.cd-sync-track { position: relative; height: 36px; background: var(--cd-floor); border-radius: 4px; overflow: visible; }
.cd-sync-block { position: absolute; top: 5px; bottom: 5px; border-radius: 3px; box-shadow: inset -2px 0 0 var(--cd-floor); }
.cd-sync-cut, .cd-sync-wait { position: absolute; top: 5px; bottom: 5px; display: flex; align-items: center; justify-content: center; font-size: .85rem; color: #fff; border-radius: 3px; white-space: nowrap; overflow: hidden; }
.cd-sync-cut { background: rgba(35, 42, 51, .78); color: #c7ced7; }
.cd-sync-wait { background: repeating-linear-gradient(135deg, rgba(242, 169, 59, .35) 0 6px, rgba(242, 169, 59, .12) 6px 12px); color: #ffe2b0; }
.cd-sync-marker { position: absolute; top: 50%; width: 14px; height: 14px; background: #fff; border: 2px solid var(--cd-floor); transform: translate(-50%, -50%) rotate(45deg); z-index: 1; }
.cd-sync-marker.drives { background: var(--cd-tally-live); border-color: #fff; animation: cd-sync-flash 6s linear infinite; }
.cd-sync-head { position: absolute; top: -6px; bottom: -6px; left: 190px; right: 0; pointer-events: none; }
.cd-sync-head span { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--cd-select); box-shadow: 0 0 0 3px rgba(58, 160, 255, .25); animation: cd-sync-sweep 6s linear infinite; }
@keyframes cd-sync-sweep { 0% { left: 0; opacity: 1; } 80% { left: var(--stop); opacity: 1; } 92% { left: var(--stop); opacity: 1; } 100% { left: var(--stop); opacity: 0; } }
@keyframes cd-sync-flash { 0%, 78% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0); } 82% { box-shadow: 0 0 0 8px rgba(229, 72, 77, .45); } 100% { box-shadow: 0 0 0 14px rgba(229, 72, 77, 0); } }

/* ---------- zoom ---------- */
.cd-guide-zoom { position: fixed; inset: 0; z-index: 2000; background: rgba(13, 17, 22, .88); display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; outline: none; }
.cd-guide-zoom img { max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.cd-guide-zoom button { position: absolute; top: 16px; right: 16px; }

/* ---------- responsive ---------- */
@media (max-width: 1399.98px) {
    .cd-guide-shot { grid-template-columns: minmax(0, 1fr); }
    .cd-guide-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}
@media (max-width: 991.98px) {
    .cd-guide { grid-template-columns: minmax(0, 1fr); }
    .cd-guide-toc { position: static; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; max-height: none; padding: 6px; gap: 4px; }
    .cd-guide-toc-group { display: none; }
    .cd-guide-toc a { border-left: 0; border-radius: 999px; white-space: nowrap; padding: 6px 12px; }
    .cd-guide-sec { padding: 16px; }
    .cd-sync-lanes { padding-left: 0; padding-top: 0; }
    .cd-sync-lane { padding-top: 34px; }
    .cd-sync-name { left: 0; width: auto; bottom: auto; flex-direction: row; gap: 6px; }
    .cd-sync-head { left: 0; top: 28px; }
}
@media (prefers-reduced-motion: reduce) {
    .cd-guide-spot, .cd-guide-spot::after, .cd-sync-marker.drives, .cd-guide-step-timer { animation: none; }
    .cd-sync-head span { animation: none; left: var(--stop); }
}
