/* ═══════════════════════════════════════════════════════════════════════
    Cognotik Video Tour — Tour-specific styles
    Extends the main site styles.css; does NOT redefine base variables,
    resets, typography, buttons, or footer — those come from styles.css.
    ═══════════════════════════════════════════════════════════════════════ */

/* ── Tour-local tokens (mapped to main-site variables) ─────────────── */
:root {
     --tour-sidebar-width: 260px;
     --tour-progress-height: 4px;
     /* Convenience aliases so tour components read cleanly */
     --tour-surface-hover: #242836;
     --tour-surface-active: #2a2f3e;
     --tour-border-light: #3a3f54;
     --tour-text-dim: #5c6180;
     --tour-accent-glow: rgba(139, 92, 246, 0.15); /* matches --accent-color */
     --tour-overlay-bg: rgba(15, 23, 42, 0.88);    /* matches --background-color */
}

/* ── App wrapper ───────────────────────────────────────────────────── */
#app {
     min-height: calc(100vh - 60px); /* 60px = cognotik-header height */
}

/* ── Tour Nav Bar (sits below the fixed site header) ───────────────── */
#tour-nav-bar {
     position: sticky;
     top: 60px; /* height of .fixed-top cognotik-header */
     z-index: 200;
     background-color: rgba(15, 23, 42, 0.97);
     backdrop-filter: blur(10px);
     border-bottom: 1px solid var(--border-color);
     box-shadow: var(--shadow-sm);
}

.tour-nav-inner {
     max-width: var(--container-max-width);
     margin: 0 auto;
     padding: 0 var(--spacing-lg);
     height: 48px;
     display: flex;
     align-items: center;
     justify-content: space-between;
     gap: var(--spacing-md);
}

.tour-nav-title {
     font-family: var(--font-heading);
     font-size: 0.95rem;
     font-weight: 700;
     color: var(--text-muted);
     letter-spacing: 0.04em;
     text-transform: uppercase;
}

#header-nav {
     display: flex;
     gap: 8px;
}

/* Tour nav buttons — extend .btn-secondary from main styles */
.nav-btn {
     display: inline-flex;
     align-items: center;
     gap: 6px;
     padding: 6px 14px;
     background: transparent;
     color: var(--text-muted);
     border: 1px solid var(--border-color);
     border-radius: var(--border-radius-sm);
     font-size: 0.85rem;
     font-family: var(--font-primary);
     cursor: pointer;
     transition: all var(--transition-fast);
}

.nav-btn:hover {
     color: var(--text-color);
     background: var(--tour-surface-hover);
     border-color: var(--tour-border-light);
     text-decoration: none;
}

.nav-btn svg {
     flex-shrink: 0;
}

/* ── Progress Bar ──────────────────────────────────────────────────── */
#tour-progress {
     position: relative;
     height: var(--tour-progress-height);
     background: var(--surface-color);
     z-index: 199;
}

#tour-progress-bar {
     height: 100%;
     width: 0;
     background: var(--gradient-primary);
     transition: width var(--transition-normal);
}

#tour-progress-steps {
     position: absolute;
     top: 50%;
     left: 0;
     right: 0;
     transform: translateY(-50%);
     display: flex;
     justify-content: space-between;
     padding: 0 48px;
     pointer-events: none;
}

.progress-step {
     width: 12px;
     height: 12px;
     border-radius: 50%;
     background: var(--border-color);
     border: 2px solid var(--surface-color);
     cursor: pointer;
     pointer-events: auto;
     transition: all var(--transition-fast);
     padding: 0;
}

.progress-step:hover {
     background: var(--accent-color);
     transform: scale(1.3);
}

.progress-step.active {
     background: var(--accent-color);
     box-shadow: 0 0 8px var(--tour-accent-glow);
}

.progress-step.completed {
     background: var(--success-color);
}

/* ── Panels ────────────────────────────────────────────────────────── */
.panel {
     display: none;
}

.panel.active {
     display: block;
}

/* ── Overview Panel ────────────────────────────────────────────────── */
#overview-panel {
     max-width: var(--container-max-width);
     margin: 0 auto;
     padding: 48px var(--spacing-lg) 80px;
}

.overview-intro {
     text-align: center;
     margin-bottom: 48px;
}

/* h2 inherits font-heading, size 2.5rem from main styles.css */
.overview-intro h2 {
     margin-bottom: var(--spacing-sm);
}

.overview-intro p {
     color: var(--text-muted);
     font-size: 1.05rem;
     max-width: 600px;
     margin: 0 auto;
}

.overview-grid {
     display: grid;
     grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
     gap: 20px;
}

/* ── Overview Card ─────────────────────────────────────────────────── */
.overview-card {
     display: flex;
     align-items: flex-start;
     gap: 16px;
     padding: 20px;
     background: var(--surface-color);
     border: 1px solid var(--border-color);
     border-radius: var(--border-radius-lg);
     cursor: pointer;
     transition: all var(--transition-normal);
     position: relative;
     overflow: hidden;
     text-decoration: none;
     color: var(--text-color);
}

.overview-card::before {
     content: "";
     position: absolute;
     inset: 0;
     background: linear-gradient(135deg, var(--tour-accent-glow), transparent);
     opacity: 0;
     transition: opacity var(--transition-normal);
     pointer-events: none;
}

.overview-card:hover,
.overview-card:focus-visible {
     border-color: var(--accent-color);
     box-shadow: var(--shadow-md), 0 0 20px var(--tour-accent-glow);
     transform: translateY(-2px);
     text-decoration: none;
     color: var(--text-color);
}

.overview-card:hover::before,
.overview-card:focus-visible::before {
     opacity: 1;
}

.overview-card:focus-visible {
     outline: 2px solid var(--accent-color);
     outline-offset: 2px;
}

.card-icon {
     font-size: 2rem;
     flex-shrink: 0;
     width: 48px;
     height: 48px;
     display: flex;
     align-items: center;
     justify-content: center;
     background: var(--tour-surface-hover);
     border-radius: var(--border-radius-md);
     position: relative;
     z-index: 1;
}

.card-body {
     flex: 1;
     min-width: 0;
     position: relative;
     z-index: 1;
}

/* card-title inherits h3 styles; override size for compact card */
.card-title {
     font-size: 1.05rem;
     font-weight: 600;
     margin-bottom: 6px;
     font-family: var(--font-heading);
     color: var(--primary-color);
}

.card-description {
     font-size: 0.85rem;
     color: var(--text-muted);
     line-height: 1.5;
     margin-bottom: 10px;
     display: -webkit-box;
     -webkit-line-clamp: 3;
     -webkit-box-orient: vertical;
     overflow: hidden;
}

.card-badge {
     display: inline-block;
     font-size: 0.7rem;
     text-transform: uppercase;
     letter-spacing: 0.08em;
     color: var(--text-muted);
     background: var(--tour-surface-hover);
     padding: 3px 8px;
     border-radius: var(--border-radius-sm);
}

.card-play {
     flex-shrink: 0;
     color: var(--accent-color);
     opacity: 0;
     transform: translateX(-8px);
     transition: all var(--transition-normal);
     position: relative;
     z-index: 1;
     align-self: center;
}

.overview-card:hover .card-play {
     opacity: 1;
     transform: translateX(0);
}

/* ── Player Panel ──────────────────────────────────────────────────── */
.player-layout {
     display: flex;
     /* subtract site header (60px) + tour nav bar (48px) + progress (4px) */
     min-height: calc(100vh - 60px - 48px - var(--tour-progress-height));
}

/* ── Chapter Sidebar ───────────────────────────────────────────────── */
#chapter-sidebar {
     width: var(--tour-sidebar-width);
     flex-shrink: 0;
     background: var(--surface-color);
     border-right: 1px solid var(--border-color);
     padding: 20px 0;
     overflow-y: auto;
}

#chapter-sidebar h3 {
     font-size: 0.75rem;
     text-transform: uppercase;
     letter-spacing: 0.1em;
     color: var(--tour-text-dim);
     padding: 0 20px;
     margin-bottom: 12px;
     /* override heading font for this small label */
     font-family: var(--font-primary);
     font-weight: 600;
}

#chapter-list {
     list-style: none;
     padding: 0;
     margin: 0;
}

.chapter-item {
     display: flex;
     align-items: center;
     gap: 10px;
     padding: 10px 20px;
     cursor: pointer;
     transition: all var(--transition-fast);
     border-left: 3px solid transparent;
     font-size: 0.9rem;
     color: var(--text-muted);
     font-family: var(--font-primary);
}

.chapter-item:hover {
     background: var(--tour-surface-hover);
     color: var(--text-color);
}

.chapter-item.active {
     background: var(--tour-surface-active);
     color: var(--text-color);
     border-left-color: var(--accent-color);
}

.chapter-item:focus-visible {
     outline: 2px solid var(--accent-color);
     outline-offset: -2px;
}

.chapter-icon {
     font-size: 1.1rem;
     flex-shrink: 0;
}

.chapter-name {
     white-space: nowrap;
     overflow: hidden;
     text-overflow: ellipsis;
}

/* ── Player Main ───────────────────────────────────────────────────── */
.player-main {
     flex: 1;
     min-width: 0;
     display: flex;
     flex-direction: column;
}

/* Override main styles.css .video-container (which uses padding-bottom trick).
    The tour uses a <video> element, not an iframe, so aspect-ratio is correct here. */
#player-panel .video-container {
     position: relative;
     background: #000;
     aspect-ratio: 16 / 9;
     max-height: 65vh;
     width: 100%;
     /* Reset main-site iframe-embed styles */
     padding-bottom: 0;
     height: auto;
     border-radius: 0;
     transform: none;
     border: none;
     box-shadow: none;
}

#player-panel .video-container:hover {
     transform: none;
     box-shadow: none;
}

#player-panel .video-container video {
     position: static;
     width: 100%;
     height: 100%;
     display: block;
     object-fit: contain;
     background: #000;
}

/* ── Video Overlay ─────────────────────────────────────────────────── */
.video-overlay {
     position: absolute;
     inset: 0;
     background: var(--tour-overlay-bg);
     display: flex;
     align-items: center;
     justify-content: center;
     z-index: 10;
     animation: tourFadeIn 300ms ease;
}

.video-overlay.hidden {
     display: none;
}

@keyframes tourFadeIn {
     from { opacity: 0; }
     to   { opacity: 1; }
}

.overlay-content {
     text-align: center;
     max-width: 420px;
     padding: 32px;
     background: var(--surface-color);
     border: 1px solid var(--border-color);
     border-radius: var(--border-radius-lg);
     box-shadow: var(--shadow-lg);
}

.overlay-content h3 {
     font-size: 1.4rem;
     margin-bottom: var(--spacing-sm);
     color: var(--primary-color);
}

.overlay-content p {
     color: var(--text-muted);
     margin-bottom: var(--spacing-lg);
     font-size: 0.95rem;
}

.overlay-actions {
     display: flex;
     gap: 12px;
     justify-content: center;
}

/* ── Tour-specific btn-icon (not in main styles) ───────────────────── */
.btn-icon {
     width: 36px;
     height: 36px;
     padding: 0;
     background: var(--surface-color);
     color: var(--text-muted);
     border: 1px solid var(--border-color);
     border-radius: var(--border-radius-sm);
     cursor: pointer;
     display: inline-flex;
     align-items: center;
     justify-content: center;
     transition: all var(--transition-fast);
}

.btn-icon:hover:not(:disabled) {
     color: var(--text-color);
     background: var(--tour-surface-active);
     border-color: var(--tour-border-light);
}

.btn-icon:disabled {
     opacity: 0.3;
     cursor: not-allowed;
}

/* ── Player Info ───────────────────────────────────────────────────── */
.player-info {
     padding: 24px 32px 40px;
     flex: 1;
     background: var(--background-color);
}

.player-info-header {
     display: flex;
     align-items: flex-start;
     justify-content: space-between;
     gap: 24px;
     margin-bottom: var(--spacing-md);
}

/* h2 size comes from main styles; keep it but allow override for compact layout */
.player-info-header h2 {
     font-size: 1.5rem;
}

.description {
     color: var(--text-muted);
     margin-top: 6px;
     font-size: 0.95rem;
}

.player-controls {
     display: flex;
     align-items: center;
     gap: 10px;
     flex-shrink: 0;
}

.chapter-indicator {
     font-size: 0.8rem;
     color: var(--tour-text-dim);
     font-variant-numeric: tabular-nums;
     min-width: 48px;
     text-align: center;
     font-family: var(--font-mono);
}

/* ── Transcript ────────────────────────────────────────────────────── */
.transcript-panel {
     border: 1px solid var(--border-color);
     border-radius: var(--border-radius-md);
     overflow: hidden;
}

.transcript-panel summary {
     display: flex;
     align-items: center;
     gap: 8px;
     padding: 12px 16px;
     background: var(--surface-color);
     cursor: pointer;
     font-size: 0.85rem;
     font-weight: 500;
     font-family: var(--font-primary);
     color: var(--text-muted);
     transition: all var(--transition-fast);
     user-select: none;
     list-style: none; /* remove default triangle in some browsers */
}

.transcript-panel summary::-webkit-details-marker {
     display: none;
}

.transcript-panel summary:hover {
     color: var(--text-color);
     background: var(--tour-surface-hover);
}

.transcript-panel summary svg {
     flex-shrink: 0;
}

.transcript-panel[open] summary {
     border-bottom: 1px solid var(--border-color);
}

.transcript-content {
     padding: 20px;
     max-height: 300px;
     overflow-y: auto;
     font-size: 0.9rem;
     line-height: 1.7;
     color: var(--text-muted);
     background: var(--background-color);
}

.transcript-content p {
     margin-bottom: 12px;
}

.transcript-content p:last-child {
     margin-bottom: 0;
}

.transcript-placeholder {
     font-style: italic;
     color: var(--tour-text-dim);
}

/* ── Scrollbar Styling ─────────────────────────────────────────────── */
::-webkit-scrollbar {
     width: 8px;
}

::-webkit-scrollbar-track {
     background: var(--background-color);
}

::-webkit-scrollbar-thumb {
     background: var(--border-color);
     border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
     background: var(--tour-border-light);
}

/* Firefox */
* {
     scrollbar-width: thin;
     scrollbar-color: var(--border-color) var(--background-color);
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
     #chapter-sidebar {
         display: none;
     }

     .player-layout {
         flex-direction: column;
     }
}

@media (max-width: 768px) {
     .overview-grid {
         grid-template-columns: 1fr;
     }

     .overview-intro h2 {
         font-size: 1.5rem;
     }

     #overview-panel {
         padding: 32px 16px 60px;
     }

     .player-info {
         padding: 20px 16px 32px;
     }

     .player-info-header {
         flex-direction: column;
         gap: 12px;
     }

     .player-info-header h2 {
         font-size: 1.2rem;
     }

     .nav-btn span {
         display: none;
     }

     .nav-btn {
         padding: 8px;
     }

     #tour-progress-steps {
         padding: 0 16px;
     }

     #player-panel .video-container {
         max-height: none;
     }
}

@media (max-width: 480px) {
     .overview-card {
         padding: 16px;
     }

     .card-play {
         display: none;
     }

     .tour-nav-inner {
         padding: 0 12px;
     }
}