/**
 * vim: et:ts=4:sw=4:sts=4
 *
 * LICENSE: GNU Affero General Public License, version 3 (AGPL-3.0-or-later)
 * Copyright 2023-2026 Josh Y Oshiro
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 *
 */

#tutorial-launch-row {
  width: min(1200px, 100%);
  display: flex;
  justify-content: center;
}

#tutorial-open-btn {
  min-width: 240px;
  font-size: 1rem;
}

body.tutorial-open {
  overflow: hidden;
}

#tutorial-overlay[hidden] {
  display: none !important;
}

#tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  background:
    radial-gradient(circle at top left, rgba(64, 93, 153, 0.24), transparent 32%),
    linear-gradient(180deg, rgba(8, 10, 15, 0.92), rgba(8, 10, 15, 0.98));
  backdrop-filter: blur(10px);
}

.tutorial-dialog {
  width: 100%;
  height: 100dvh;
  background: linear-gradient(180deg, #171b24 0%, #0f131a 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tutorial-header,
.tutorial-footer {
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid #283243;
}

.tutorial-footer {
  border-bottom: 0;
  border-top: 1px solid #283243;
  flex-wrap: wrap;
}

.tutorial-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.tutorial-kicker {
  color: #91a8d7;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tutorial-title {
  font-size: 1.3rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.tutorial-slide-counter {
  margin-left: auto;
  color: #c6d0e4;
}

.tutorial-close,
.tutorial-chip,
.tutorial-branch-btn,
.tutorial-nav-btn {
  background: #253144;
  color: #f4f7ff;
  border: 1px solid #44526b;
  border-radius: 4px;
  padding: 10px 12px;
  cursor: pointer;
  max-width: 100%;
}

.tutorial-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tutorial-sidebar {
  padding: 12px 16px;
  border-bottom: 1px solid #283243;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
}

#tutorial-chapter-bar,
.tutorial-branch-bar {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  overflow: auto;
  padding-bottom: 2px;
}

.tutorial-chip,
.tutorial-branch-btn {
  white-space: nowrap;
  flex: 0 0 auto;
}

.tutorial-chip.is-active {
  background: #38507b;
  border-color: #7ea0dd;
}

.tutorial-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-snap-type: y proximity;
  overscroll-behavior: contain;
}

.tutorial-overview-card,
.tutorial-story-section,
.tutorial-visual-card,
.tutorial-metric-card,
.tutorial-live-status {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid #2f3a4c;
  border-radius: 4px;
  padding: 14px;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.18);
}

.tutorial-overview-card,
.tutorial-story-section {
  scroll-snap-align: start;
}

.tutorial-copy,
.tutorial-story-text,
.tutorial-note {
  color: #e6ebf6;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.tutorial-stat-strip,
.tutorial-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tutorial-grid-compact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tutorial-stat-card {
  background: rgba(142, 176, 255, 0.07);
  border: 1px solid rgba(142, 176, 255, 0.15);
  border-radius: 4px;
  padding: 10px;
}

.tutorial-stat-label,
.tutorial-metric-label,
.tutorial-visual-title,
.tutorial-story-eyebrow {
  color: #9eb7eb;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tutorial-stat-value,
.tutorial-metric-value {
  margin-top: 4px;
  font-size: 1rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.tutorial-big-score {
  font-size: 2.6rem;
  font-weight: 800;
}

.tutorial-story-title {
  margin: 8px 0;
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.tutorial-scroll-story {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tutorial-placeholder {
  min-height: 180px;
  border: 1px dashed #4d5c79;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  color: #c5d0e5;
}

.tutorial-screenshot,
.tutorial-svg {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.tutorial-screenshot {
  border: 1px solid #3a4659;
}

.tutorial-svg circle,
.tutorial-svg line {
  stroke: #98b5ff;
  stroke-width: 3;
  fill: rgba(152, 181, 255, 0.16);
}

.tutorial-search-branch,
.tutorial-search-leaf {
  opacity: 0;
  animation: tutorialReveal 1.2s ease forwards;
}

.tutorial-search-node-root {
  animation: tutorialPulse 1.6s ease-in-out infinite;
}

.tutorial-delay-1 { animation-delay: 0.10s; }
.tutorial-delay-2 { animation-delay: 0.20s; }
.tutorial-delay-3 { animation-delay: 0.30s; }
.tutorial-delay-4 { animation-delay: 0.40s; }
.tutorial-delay-5 { animation-delay: 0.50s; }
.tutorial-delay-6 { animation-delay: 0.60s; }
.tutorial-delay-7 { animation-delay: 0.70s; }
.tutorial-delay-8 { animation-delay: 0.80s; }
.tutorial-delay-9 { animation-delay: 0.90s; }

.tutorial-trend-line,
.tutorial-trend-shadow {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tutorial-trend-line {
  stroke: #8eb0ff;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: tutorialDraw 2.2s ease forwards;
}

.tutorial-trend-shadow {
  stroke: rgba(142, 176, 255, 0.2);
}

.tutorial-pipeline-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.tutorial-pipeline-step {
  background: #20293a;
  border: 1px solid #3b4962;
  border-radius: 999px;
  padding: 10px 14px;
}

.tutorial-pipeline-arrow {
  color: #9eb7eb;
  font-weight: 700;
}

.tutorial-nav-group {
  display: flex;
  gap: 10px;
  width: 100%;
}

.tutorial-nav-group button {
  flex: 1 1 0;
}

@keyframes tutorialReveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes tutorialDraw {
  to { stroke-dashoffset: 0; }
}

@keyframes tutorialPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.78; }
}

@media (min-width: 820px) {
  #tutorial-overlay {
    padding: 18px;
  }

  .tutorial-dialog {
    width: min(1180px, 100%);
    height: min(94vh, 920px);
    border: 1px solid #394356;
    border-radius: 8px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  }

  .tutorial-body {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .tutorial-sidebar {
    border-bottom: 0;
    border-right: 1px solid #283243;
  }

  #tutorial-chapter-bar {
    flex-direction: column;
    flex-wrap: nowrap;
  }

  .tutorial-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }

  .tutorial-grid-compact,
  .tutorial-stat-strip {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .tutorial-nav-group {
    width: auto;
  }
}
