/* Feature Walkthrough System Styling
 *
 * Self-contained interactive learning widget rendered as a centered modal
 * overlay. Sits above the floating buttons (insight capture FAB at z 9200,
 * capture card overlay at 9300) so the learning view always wins focus.
 */

/* ============================================================================
   Root Mount + Backdrop
   ============================================================================ */

#walkthroughRoot {
    position: fixed;
    inset: 0;
    z-index: 9500;          /* above insight FAB (9200) and capture card (9300) */
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-family: 'Open Sans', sans-serif;

    /* Instructional accent palette, mirrored from `#demoTourRoot` in
     * `css/demo-tour.css`. The lesson modal and the demo tour read as one
     * "guidance / teaching" visual language. If a third surface adopts the
     * same accent, hoist these to `:root` in `css/theme-variables.css`. */
    --demo-accent: #F59E0B;
    --demo-accent-strong: #D97706;
    --demo-accent-soft: rgba(245, 158, 11, 0.18);
    --demo-on-accent: #1E2030;
}

.wt-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 14, 20, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    cursor: pointer;
}

.wt-card {
    position: relative;
    width: 100%;
    max-width: 1080px;
    max-height: calc(100vh - 48px);
    overflow: auto;
    background: var(--bg-surface);
    border: 2px solid var(--demo-accent);
    border-radius: 14px;
    box-shadow:
        0 0 0 4px var(--demo-accent-soft),
        0 24px 64px rgba(0, 0, 0, 0.35);
    color: var(--charcoal);
    padding: 0;
    overflow: hidden;
}

/* ============================================================================
   Card header — orange accent bar, mirrors `.demo-spotlight-header`
   ============================================================================ */

.wt-cardheader {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.85rem 1rem;
    background: var(--demo-accent);
    border-bottom: 1px solid var(--demo-accent-strong);
    color: var(--demo-on-accent);
}

.wt-step {
    padding: 0.25rem 0.65rem;
    background: rgba(255, 255, 255, 0.55);
    color: var(--demo-on-accent);
    border-radius: 4px;
    font-family: 'Montserrat', system-ui, sans-serif;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
}

.wt-title {
    flex: 1;
    margin: 0;
    font-family: 'Montserrat', system-ui, sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--demo-on-accent);
}

.wt-skip {
    padding: 0.32rem 0.7rem;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 6px;
    color: var(--demo-on-accent);
    font-family: 'Montserrat', system-ui, sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
}
.wt-skip:hover,
.wt-skip:focus {
    background: rgba(255, 255, 255, 0.85);
    border-color: var(--demo-accent-strong);
    outline: none;
}

/* ============================================================================
   Two-column body: diagram on the left, copy + controls on the right
   ============================================================================ */

.wt-layout {
    display: flex;
    align-items: stretch;
    gap: 24px;
    padding: 20px 24px 22px;
}
.wt-layout > .wt-stage {
    flex: 1 1 60%;
    min-width: 0;
    margin-bottom: 0;
}
.wt-side {
    flex: 0 1 340px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
}
.wt-side .wt-body {
    flex: 1 1 auto;
    margin-bottom: 18px;
}
.wt-side .wt-controls {
    margin-top: auto;
}

/* ============================================================================
   Stage (SVG visualization)
   ============================================================================ */

/* Match the live canvas background: dotted graph-paper grid using the same
 * `--canvas-bg` / `--canvas-dot` variables as `.graph-area` in
 * `css/layout.css`. The lesson and the canvas read as the same surface. */
.wt-stage {
    background-color: var(--canvas-bg, #F0F2F5);
    background-image: radial-gradient(circle, var(--canvas-dot, #D5DAE0) 0.8px, transparent 0.8px);
    background-size: 20px 20px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 16px;
}

.wt-svg {
    width: 100%;
    height: auto;
    display: block;
}

/* Hex shapes — outer polygon is the saturated role color (acts as the
 * ring), inner polygon is the light tint. Both polygons are emitted by
 * `canvasHexShape()` in `js/canvas-geometry.js` with classes
 * `canvas-hex-outer` / `canvas-hex-inner`; we add the lesson-specific
 * filter / opacity / focus styling here. Mirrors the live `.node-hex` +
 * `.node-inner` rendering. */
.wt-hex .canvas-hex-outer {
    stroke: none;
    transition: opacity 0.35s ease, transform 0.2s ease;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18));
}
.wt-hex .canvas-hex-inner {
    stroke: none;
    transition: opacity 0.35s ease;
}
.wt-hex.wt-dim .canvas-hex-outer,
.wt-hex.wt-dim .canvas-hex-inner { opacity: 0.55; }
.wt-hex.wt-focus .canvas-hex-outer {
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.18)) drop-shadow(0 0 22px var(--primary-tint-md, rgba(13, 92, 107, 0.18)));
}

/* Italic placeholder header inside the hex. Reads as the "coach note" copy
 * the live canvas shows before the user types their own header. */
.wt-hex-header {
    font-family: 'Inter', 'Open Sans', sans-serif;
    font-size: 11px;
    font-style: italic;
    font-weight: 500;
    fill: var(--charcoal);
    pointer-events: none;
}
.wt-hex.wt-dim .wt-hex-header { opacity: 0.55; }

/* Info-hexagon icon — same Tabler outline used by the live `info-hexagon`
 * indicator inside each node, sized to the hex it sits in. */
.wt-info-icon {
    fill: none;
    stroke: var(--charcoal);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.55;
}
.wt-hex.wt-dim .wt-info-icon { opacity: 0.3; }

/* Role chip pinned flush to the bottom of every hex (mirrors
 * `.node-role-label` in the live canvas). */
.wt-chip rect {
    stroke: rgba(0, 0, 0, 0.06);
    stroke-width: 0.5;
}
.wt-chip-text {
    font-family: 'Inter', 'Open Sans', sans-serif;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    pointer-events: none;
}

/* Connecting lines between hexes */
.wt-line {
    stroke: var(--charcoal);
    stroke-width: 1.4;
    opacity: 0.5;
    fill: none;
}
.wt-line-frame {
    stroke: var(--pillar-color);
    stroke-width: 1.6;
    opacity: 0.75;
    stroke-linejoin: miter;
}
.wt-line-dim { opacity: 0.22; }
.wt-line-sub {
    stroke: var(--charcoal);
    stroke-width: 1.2;
    opacity: 0.45;
}

/* Title placeholder text */
.wt-title-placeholder {
    fill: var(--charcoal);
    font-family: 'Montserrat', sans-serif;
    font-size: 28px;
    font-weight: 600;
}
.wt-eyebrow-svg {
    fill: var(--slate);
    font-family: 'Inter', 'Open Sans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
}
.wt-title-underline {
    stroke: var(--slate);
    stroke-width: 1.5;
    stroke-dasharray: 5 4;
    opacity: 0.6;
}
.wt-fade { opacity: 0.35; }
.wt-caption {
    fill: var(--slate);
    font-size: 12px;
    font-style: italic;
}

/* Step 5: mock sidebar mirroring the live left column. The panel
 * background, section labels (ASSIGN ROLE, ADD CONTENT, LINKED PILLAR),
 * role/link selector pills, color-bulleted field rows, and Index Card /
 * Delete actions all match the surface in `js/sidebar.js`. */
.wt-panel-bg {
    fill: var(--bg-surface);
    stroke: var(--border-light);
    stroke-width: 1;
}

/* Section header — uppercase + tracked, like `.sidebar-info-label`. */
.wt-side-section {
    fill: var(--slate);
    font-family: 'Inter', 'Open Sans', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Role selector pill (ASSIGN ROLE: Sub Point/Pillar/Anchor) */
.wt-side-pill {
    fill: transparent;
    stroke-width: 1.25;
}
.wt-side-pill-text {
    font-family: 'Inter', 'Open Sans', sans-serif;
    font-size: 12px;
    font-weight: 600;
}
.wt-side-chevron {
    fill: var(--slate);
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 600;
}

/* Linked-parent selector (LINKED PILLAR: Pillar 1) */
.wt-side-link-pill {
    fill: transparent;
    stroke: var(--border-light);
    stroke-width: 1;
}
.wt-side-link-text {
    fill: var(--charcoal);
    font-family: 'Inter', 'Open Sans', sans-serif;
    font-size: 12px;
    font-weight: 500;
}

/* Field rows — colored bullet + body label */
.wt-side-field {
    fill: var(--charcoal);
    font-family: 'Inter', 'Open Sans', sans-serif;
    font-size: 12px;
    font-weight: 500;
}

/* Section dividers between ASSIGN ROLE / fields / actions */
.wt-side-divider {
    stroke: var(--border-light);
    stroke-width: 1;
    opacity: 0.7;
}

/* Bottom action buttons */
.wt-side-btn {
    fill: transparent;
    stroke: var(--border-light);
    stroke-width: 1;
}
.wt-side-btn-text {
    fill: var(--charcoal);
    font-family: 'Inter', 'Open Sans', sans-serif;
    font-size: 11px;
    font-weight: 600;
}
.wt-side-btn-danger {
    stroke: var(--rose);
}
.wt-side-btn-text-danger {
    fill: var(--rose);
}
.wt-side-btn-icon {
    fill: none;
    stroke: var(--charcoal);
    stroke-width: 1.4;
}
.wt-side-btn-icon-danger {
    fill: none;
    stroke: var(--rose);
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Connector arrow from sidebar field row to selected hex */
.wt-link-arrow {
    stroke: var(--primary);
    stroke-width: 1.5;
    fill: none;
    opacity: 0.75;
}
.wt-arrow-head {
    fill: var(--primary);
}

/* Step 6: large contraction/expansion arrow between the two views. */
.wt-arrow-text {
    fill: var(--slate);
    font-size: 28px;
    font-weight: 700;
}

/* ============================================================================
   Body Copy
   ============================================================================ */

.wt-body {
    margin: 0 0 20px;
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--charcoal);
}

/* ============================================================================
   Controls (progress / dots / prev / next)
   ============================================================================ */

.wt-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

.wt-progress {
    font-family: 'Montserrat', system-ui, sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--slate);
    white-space: nowrap;
}

.wt-nav-group {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.wt-nav {
    min-width: 44px;
    padding: 8px 14px;
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--charcoal);
    border-radius: 8px;
    font-family: 'Montserrat', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.wt-nav:hover:not(:disabled) {
    background: var(--demo-accent-soft);
    border-color: var(--demo-accent);
}
.wt-nav:active:not(:disabled) { transform: scale(0.97); }
.wt-nav:disabled { opacity: 0.35; cursor: not-allowed; }

/* Primary CTA — orange filled, mirrors `.demo-spotlight-btn`. */
.wt-nav-primary {
    background: var(--demo-accent);
    color: var(--demo-on-accent);
    border-color: var(--demo-accent);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.45);
}
.wt-nav-primary:hover:not(:disabled),
.wt-nav-primary:focus:not(:disabled) {
    background: var(--demo-accent);
    color: var(--demo-on-accent);
    border-color: var(--demo-accent-strong);
    filter: brightness(1.05);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.55);
    outline: none;
}

.wt-dots {
    display: flex;
    align-items: center;
    gap: 8px;
}
.wt-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1.5px solid var(--slate);
    background: transparent;
    padding: 0;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.wt-dot:hover { transform: scale(1.2); }
.wt-dot.past {
    background: var(--slate);
    border-color: var(--slate);
}
.wt-dot.active {
    background: var(--demo-accent);
    border-color: var(--demo-accent);
    transform: scale(1.25);
}

/* ============================================================================
   Reduced Motion
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
    .wt-hex polygon,
    .wt-nav,
    .wt-dot {
        transition: none !important;
    }
}

/* ============================================================================
   Tablet (<=900px) — narrow side column further before stacking
   ============================================================================ */

@media (max-width: 900px) {
    .wt-card { max-width: 720px; }
    .wt-layout { gap: 18px; }
    .wt-side { flex-basis: 280px; min-width: 240px; }
}

/* ============================================================================
   Mobile (<=640px) — stack stage above text
   ============================================================================ */

@media (max-width: 640px) {
    #walkthroughRoot { padding: 12px; }
    .wt-card { border-radius: 10px; }
    .wt-cardheader { padding: 0.7rem 0.85rem; gap: 0.5rem; }
    .wt-step { font-size: 0.62rem; padding: 0.2rem 0.5rem; }
    .wt-title { font-size: 0.95rem; }
    .wt-skip { padding: 0.28rem 0.55rem; font-size: 0.7rem; }
    .wt-layout { flex-direction: column; gap: 14px; padding: 14px 16px 16px; }
    .wt-layout > .wt-stage { flex: 0 0 auto; }
    .wt-side { flex: 0 0 auto; min-width: 0; }
    .wt-body { font-size: 13.5px; margin-bottom: 14px; }
    .wt-stage { padding: 8px; }
    .wt-controls { gap: 8px; flex-wrap: wrap; }
    .wt-progress { font-size: 0.7rem; }
    .wt-nav { min-width: 44px; padding: 7px 10px; font-size: 12.5px; }
    .wt-dot { width: 10px; height: 10px; }
}

/* ============================================================================
   Accessibility
   ============================================================================ */

.wt-nav:focus-visible,
.wt-dot:focus-visible,
.wt-skip:focus-visible {
    outline: 2px solid var(--demo-accent);
    outline-offset: 2px;
}
