/* ============================================================
   SKILL FRAMEWORK — shared scaffolding for skill pages
   Extracted from skills/guitar-types.html
   Depends on: base.css, skill-space.css
   ============================================================ */

/* ===== TOPBAR LAYOUT ===== */
.topbar.panel {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 999px;
  margin: 0 auto 20px;
  max-width: 1440px;
  opacity: 0;
  transform: translateY(-40px);
  animation: none;
}
.topbar-title {
  font-size: 0.85rem;
  color: var(--text-soft);
  white-space: nowrap;
  flex: 1;
  text-align: center;
}
.topbar-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== TAB BUTTONS ===== */
.tab-btn {
  flex: 1;
  min-width: 0;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-soft);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 180ms ease;
  position: relative;
}
.tab-btn:hover:not(.locked):not(.active) {
  background: rgba(255,255,255,0.04);
  color: #f8fafc;
}
.tab-btn.active {
  background: var(--skill-accent-soft);
  border-color: var(--skill-accent-strong);
  color: #f8fafc;
  font-weight: 600;
}
.tab-btn.locked {
  opacity: 0.35;
  cursor: not-allowed;
}
.tab-btn.unlocked:not(.active) {
  color: rgba(255,255,255,0.7);
}
.tab-btn .tab-lock {
  font-size: 0.7rem;
  margin-left: 4px;
  opacity: 0.6;
}
.tab-btn.unlocked .tab-lock,
.tab-btn.active .tab-lock { display: none; }

/* ===== TAB PANES ===== */
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ===== CONTINUE BUTTON ===== */
.continue-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}
.continue-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--skill-accent-strong);
  background: var(--skill-accent-soft);
  color: #f8fafc;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease;
}
.continue-btn:hover { transform: translateY(-1px); }
.continue-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

/* ===== FLIP CARD PRIMITIVE ===== */
.flip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.flip-card {
  perspective: 600px;
  height: 160px;
  cursor: pointer;
}
.flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.5s ease;
  transform-style: preserve-3d;
}
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }
.flip-front, .flip-back {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  backface-visibility: hidden;
  text-align: center;
}
.flip-front h4 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  color: #f8fafc;
}
.flip-front p {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
}
.flip-back {
  transform: rotateY(180deg);
  background: rgba(34,211,238,0.06);
  border-color: rgba(34,211,238,0.2);
}
.flip-back p {
  margin: 0;
  font-size: 0.88rem;
  color: rgba(255,255,255,0.85);
  line-height: 1.6;
}

/* ===== LEARN SECTION (shared prose layout) ===== */
.learn-section { margin-bottom: 24px; }
.learn-section h3 {
  margin: 0 0 12px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: #f8fafc;
}
.learn-section p {
  color: var(--text-soft);
  line-height: 1.7;
  margin: 0 0 10px;
}
.learn-section ul {
  margin: 12px 0 12px 20px;
  padding: 0;
  color: var(--text-soft);
  line-height: 1.7;
}
.learn-section li { margin-bottom: 6px; }
.learn-section strong { color: #f8fafc; }

/* ===== PRACTICE STEPS (numbered list) ===== */
.practice-list {
  counter-reset: practice-step;
  margin: 0;
  padding: 0;
  list-style: none;
}
.practice-list li {
  counter-increment: practice-step;
  position: relative;
  padding: 12px 14px 12px 44px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  border-radius: 12px;
  margin-bottom: 10px;
  color: rgba(255,255,255,0.85);
  font-size: 0.92rem;
  line-height: 1.55;
}
.practice-list li::before {
  content: counter(practice-step);
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--skill-accent-soft);
  border: 1px solid var(--skill-accent-strong);
  color: var(--skill-accent);
  font-size: 0.78rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* ===== TERM CARDS (Key Terms tab) ===== */
.terms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.term-card {
  perspective: 600px;
  height: 170px;
  cursor: pointer;
}
.term-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.5s ease;
  transform-style: preserve-3d;
}
.term-card.flipped .term-inner { transform: rotateY(180deg); }
.term-front, .term-back {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  backface-visibility: hidden;
  text-align: center;
}
.term-front h4 {
  margin: 0;
  font-size: 1rem;
  color: #f8fafc;
  font-family: 'Space Grotesk', sans-serif;
}
.term-front p {
  margin: 4px 0 0;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.35);
}
.term-back {
  transform: rotateY(180deg);
  background: rgba(34,211,238,0.06);
  border-color: rgba(34,211,238,0.2);
}
.term-back p {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
  line-height: 1.55;
}

/* ===== VIDEO EMBED =====
   Declarative: <div class="video-embed" data-video-id="..." data-video-title="..." data-lesson-url="..."></div>
   Framework hydrates with a click-to-play YouTube thumbnail, or a
   "coming soon" placeholder if data-video-id is missing/empty. */
.video-embed {
  margin: 0 0 8px;
}
.video-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--surface-border);
  background: #000;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}
.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.85;
  transition: opacity 200ms ease, transform 500ms ease;
}
.video-thumb:hover img {
  opacity: 1;
  transform: scale(1.015);
}
.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: 2px solid rgba(255,255,255,0.85);
  color: #fff;
  font-size: 1.6rem;
  display: grid;
  place-items: center;
  padding-left: 4px;
  transition: background 200ms ease, border-color 200ms ease, transform 200ms ease;
  pointer-events: none;
}
.video-thumb:hover .video-play-btn {
  background: var(--skill-accent-strong);
  border-color: var(--skill-accent);
  transform: translate(-50%, -50%) scale(1.08);
}
.video-thumb-title {
  position: absolute;
  bottom: 14px;
  left: 14px;
  right: 14px;
  color: #f8fafc;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  text-shadow: 0 1px 6px rgba(0,0,0,0.85);
  text-align: left;
  pointer-events: none;
}
.video-embed iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  border: 1px solid var(--surface-border);
  display: block;
  background: #000;
}
.video-lesson-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--skill-accent);
  font-size: 0.86rem;
  text-decoration: none;
}
.video-lesson-link:hover { text-decoration: underline; }
.video-placeholder {
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  border: 1px dashed var(--surface-border);
  background: rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: 0.9rem;
  padding: 20px;
  text-align: center;
}
.video-placeholder-icon {
  font-size: 2rem;
  opacity: 0.5;
  line-height: 1;
}
.video-placeholder p { margin: 0; }

/* ===== SKILL DIAGRAM =====
   Reference diagram slot on the Learn tab. Holds SVG, <img>, or a
   "coming soon" placeholder. */
.skill-diagram {
  margin: 0 0 8px;
}
.skill-diagram-media {
  border-radius: 14px;
  border: 1px solid var(--surface-border);
  background: rgba(12, 12, 20, 0.45);
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}
.skill-diagram-media img,
.skill-diagram-media svg {
  max-width: 100%;
  height: auto;
  display: block;
}
.skill-diagram figcaption {
  margin: 10px 2px 0;
  font-size: 0.82rem;
  color: var(--text-soft);
  text-align: center;
  font-style: italic;
  line-height: 1.5;
}
.diagram-placeholder-slot {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px dashed var(--surface-border);
  background: rgba(0, 0, 0, 0.22);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: 0.9rem;
  padding: 20px;
  text-align: center;
}
.diagram-placeholder-slot .diagram-placeholder-icon {
  font-size: 2rem;
  opacity: 0.5;
  line-height: 1;
}
.diagram-placeholder-slot p { margin: 0; }

/* ===== DISCOVER PROGRESS INDICATOR ===== */
.discover-progress {
  margin-top: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-soft);
}
.discover-progress span { color: var(--skill-accent); font-weight: 600; }

/* ===== QUIZ STEPPER ===== */
.quiz-stepped { position: relative; }
.quiz-step { display: none; }
.quiz-step.active { display: block; }
.quiz-step-counter {
  margin: 0 0 14px;
  font-size: 0.78rem;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.quiz-explanation {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.6;
  display: none;
}
.quiz-explanation.show { display: block; }
.quiz-explanation.correct-exp {
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.2);
  color: #bbf7d0;
}
.quiz-explanation.incorrect-exp {
  background: rgba(248,113,113,0.08);
  border: 1px solid rgba(248,113,113,0.2);
  color: #fecaca;
}
.quiz-next-btn {
  margin-top: 14px;
  display: none;
}
.quiz-next-btn.show { display: inline-flex; }
.quiz-score {
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  background: var(--skill-accent-soft);
  border: 1px solid var(--skill-accent-strong);
  text-align: center;
}
.quiz-score strong { color: var(--skill-accent); font-size: 1.2rem; }

/* ===== BORDERLESS CONTENT PANELS INSIDE TABS ===== */
.tab-pane > .section-panel.panel {
  background: none;
  border: none;
  box-shadow: none;
}
.tab-pane > .section-panel.panel:hover {
  border-color: transparent;
  box-shadow: none;
}
.tab-pane > .section-panel.panel::after { display: none; }
.tab-pane > .section-panel.panel {
  animation: none;
  opacity: 1;
  transform: none;
}

/* ===== ENTRANCE ANIMATION ===== */
.skill-shell {
  opacity: 0;
}
.skill-shell.entered .topbar.panel {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 400ms ease-out, transform 400ms ease-out;
}
.skill-shell.entered .page-layout {
  opacity: 1;
  transition: opacity 500ms ease-out 300ms;
}
.page-layout {
  opacity: 0;
}
/* Constellation zoom-in entrance */
.entrance-glow {
  position: fixed;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.95), rgba(34,211,238,0.8) 40%, transparent 70%);
  pointer-events: none;
  z-index: 200;
  opacity: 0;
}
.entrance-glow.expanding {
  opacity: 1;
  transition: width 500ms ease-out, height 500ms ease-out, opacity 300ms ease-out 200ms;
}

/* ===== EXIT GLOW =====
   Initial state is invisible. JS sizes and positions it at commit time —
   starts fullscreen-centered and contracts to the constellation node position,
   mirroring the entrance zoom-in. */
.exit-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 100;
  border-radius: 50%;
  opacity: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .flip-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .topbar.panel {
    flex-wrap: wrap;
    border-radius: 14px;
    gap: 8px;
  }
  .topbar-title { display: none; }
  .topbar-tabs { flex-wrap: wrap; }
  .tab-btn { font-size: 0.78rem; padding: 8px 12px; }
  .terms-grid { grid-template-columns: 1fr; }
}
