/* ===== VISUALIZATION ENGINE ===== */
.viz-container {
    background-color: var(--color-bg-surface-deep);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    height: 612px;
    margin: 2rem 0;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    position: relative;
    padding: 0;
    overflow: hidden;
    touch-action: pan-y;
}

#network-visualization {
    width: 100%;
    height: 100%;
    display: flex;
    min-height: 612px;
}

#network-visualization svg {
    width: 100%;
    height: 100% !important;
    min-height: 612px;
    border-radius: var(--radius-md);
    background: radial-gradient(circle at center, #2a2a2a 0%, var(--color-bg-page) 100%);
    display: block;
}

.viz-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.viz-content > * { flex: 1; min-height: 0; }

/* ===== STATS & CHARTS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.stat-card {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    font: bold 1.8rem inherit;
    color: var(--color-text-primary);
}

.charts-section {
    margin: 3rem 0;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.chart-container {
    margin: 2rem 0;
    background: var(--color-bg-surface-deep);
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    border-radius: var(--radius-md);
}

.chart {
    min-height: 300px;
    width: 100%;
    background: var(--color-bg-page);
    border-radius: var(--radius-sm);
}

/* Interactive state — D3 gets full touch control (enabled in fullscreen) */
.viz-container.interactive svg { touch-action: none; }

/* Fullscreen state */
.viz-container.fullscreen {
    position: fixed;
    inset: 0;
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0;
    z-index: 1000;
    margin: 0;
}

/* ===== FULLSCREEN INLINE CONTROLS ===== */
.viz-fs-controls {
    display: none; /* shown only in fullscreen via JS */
    position: absolute;
    top: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    align-items: center;
    gap: 0.25rem; /* matches gap between zoom buttons */
    white-space: nowrap;
}

/* Each control group and reset button styled as individual pills matching zoom buttons */
.fs-control-group {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    height: 28px;
    padding: 0 0.65rem;
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: var(--color-text-primary);
    font-size: var(--font-size-sm);
}

.fs-control-group label {
    opacity: 0.8;
    font-size: var(--font-size-xs);
}

.fs-slider {
    width: 72px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    outline: none;
}

.fs-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    cursor: pointer;
}

.fs-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    cursor: pointer;
}

.fs-slider::-moz-range-track {
    height: 3px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
}

.fs-control-group span {
    min-width: 1.6em;
    text-align: right;
    font-size: var(--font-size-xs);
    opacity: 0.7;
}

.fs-reset-btn {
    height: 28px;
    padding: 0 0.65rem;
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: var(--color-text-primary);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
    white-space: nowrap;
    line-height: 1;
}

.fs-reset-btn:hover { background: rgba(60, 60, 60, 0.9); }

/* ===== ZOOM CONTROLS ===== */
.viz-zoom-controls {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.viz-fullscreen-btn,
.viz-zoom-btn {
    background: rgba(0, 0, 0, 0.75);
    color: var(--color-text-primary);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    width: 32px;
    height: 28px;
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
    text-align: center;
    transition: background var(--transition-fast);
}

.viz-fullscreen-btn:hover,
.viz-zoom-btn:hover { background: rgba(60, 60, 60, 0.9); }

/* Touch devices: larger tap targets for zoom controls */
@media (pointer: coarse) {
    .viz-fullscreen-btn,
    .viz-zoom-btn {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
    }
}

/* ===== INLINE ASSET INFO PANEL ===== */
/* Portrait (default): slides up from bottom */
.viz-info-panel {
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 45%;
    background: rgba(22, 22, 22, 0.96);
    border-top: 1px solid var(--color-border-subtle);
    z-index: 30;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.25s ease;
    pointer-events: none;
}

.viz-info-panel.open {
    transform: translateY(0);
    pointer-events: auto;
}

/* Landscape (any state): slides in from left */
@media (orientation: landscape) {
    .viz-info-panel {
        top: 0;
        bottom: 0;
        right: auto;
        left: 0;
        width: 336px;
        height: 100%;
        max-height: 100%;
        border-top: none;
        border-right: 1px solid var(--color-border-subtle);
        transform: translateX(-100%);
    }
    .viz-info-panel.open {
        transform: translateX(0);
    }
}

.viz-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    background: rgba(28, 28, 28, 0.99);
}

.viz-info-header h3 {
    margin: 0;
    font-size: var(--font-size-md);
    color: var(--color-accent);
}

.viz-info-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    line-height: 1;
    transition: color var(--transition-fast);
}

.viz-info-close:hover { color: var(--color-text-primary); }

.viz-info-body {
    padding: 0.75rem 1.25rem 1rem;
    font-size: var(--font-size-footer);
    line-height: var(--line-height-body);
    color: var(--color-text-secondary);
}

.viz-info-body p { margin: 0 0 0.5rem; }

.viz-info-body strong {
    color: var(--color-accent);
    display: block;
    margin-top: 0.75rem;
    text-transform: uppercase;
    font-size: var(--font-size-xs);
    letter-spacing: 0.5px;
    text-align: center;
}

.viz-info-body a {
    color: var(--color-accent);
    text-decoration: none;
    display: inline-block;
    margin-top: 0.3rem;
    padding: 0.2rem 0.7rem;
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.viz-info-body a:hover {
    background: var(--color-accent);
    color: #fff;
}


/* ===== MOBILE VIZ ===== */
@media (max-width: 768px) {
    .viz-container, #network-visualization, #network-visualization svg {
        height: 391px;
        min-height: 391px;
    }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

    /* show/hide toggled by JS in enterInteractiveMode / exitInteractiveMode */
}


/* ===== CAREER PATHWAYS VIZ ===== */
.pathway-viz-container,
#pathway-visualization {
    height: 100%;
    min-height: unset;
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-top: none;
}

#pathway-visualization svg {
    width: 100%;
    height: 100% !important;
    min-height: unset;
    border-radius: 0;
    background: radial-gradient(circle at center, #2a2a2a 0%, var(--color-bg-page) 100%);
    display: block;
}

/* Overlay: title — top left */
.pathway-overlay-header {
    position: absolute;
    top: 0.85rem;
    left: 0.85rem;
    z-index: 10;
    max-width: 400px;
    pointer-events: none;
}

.pathway-overlay-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0 0 0.2rem;
    line-height: 1.2;
}

.pathway-overlay-header h2 span {
    font-weight: 400;
    color: var(--color-text-secondary);
}

.pathway-overlay-header p {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin: 0;
    line-height: 1.4;
}

/* Overlay: reset + legend — bottom left */
.pathway-overlay-controls {
    position: absolute;
    bottom: 0.85rem;
    left: 0.85rem;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.pathway-overlay-controls .control-btn {
    height: 28px;
    padding: 0 0.75rem;
    font-size: var(--font-size-sm);
    line-height: 1;
}

@media (max-width: 768px) {
    .pathway-overlay-header { max-width: 220px; }
    .pathway-overlay-header h2 { font-size: 0.95rem; }
    .pathway-overlay-controls .pathway-legend { display: none; }
}

/* ── Pathway info panel rows ── */
.info-row {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    margin: 0.3rem 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

.info-row span {
    color: var(--color-accent);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    min-width: 4.5rem;
}

.info-desc {
    margin: 0.75rem 0 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: var(--line-height-body);
}

/* ── Controls row legend ── */
.pathway-legend {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    flex-wrap: wrap;
}

.legend-item {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.legend-required { color: rgba(255,255,255,0.45); }
.legend-optional  { color: rgba(255,255,255,0.25); letter-spacing: 2px; }
