/* ==========================================================================
   Stepify — Tutorial Detail Page
   Styles for /tutorial/:uuid. Requires base.css loaded first.
   Layout: header → video → action bar → transcript → step guide.
   ========================================================================== */

/* ---- Detail-specific theme variables ---- */
:root {
  --pill-bg: #fff; --pill-border: #e2e8f0; --pill-text: #475569; --pill-strong: #1e293b;
  --comp-from: #047857; --comp-to: #065f46; --comp-badge: #047857;
  --img-hover: #E8590C;
  --transcript-bg: #f1f5f9; --transcript-border: #e2e8f0;
  --action-bg: #fff; --action-border: #e2e8f0; --action-text: #94a3b8;
}
[data-theme="dark"] {
  --pill-bg: #1E293B; --pill-border: #475569; --pill-text: #94A3B8; --pill-strong: #F1F5F9;
  --comp-from: #047857; --comp-to: #065f46; --comp-badge: #047857;
  --img-hover: #FB923C;
  --transcript-bg: #1e293b; --transcript-border: #334155;
  --action-bg: #1e293b; --action-border: #334155; --action-text: #64748b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --pill-bg: #1E293B; --pill-border: #475569; --pill-text: #94A3B8; --pill-strong: #F1F5F9;
    --comp-from: #047857; --comp-to: #065f46; --comp-badge: #047857;
    --img-hover: #FB923C;
    --transcript-bg: #1e293b; --transcript-border: #334155;
    --action-bg: #1e293b; --action-border: #334155; --action-text: #64748b;
  }
}

/* ---- Tutorial header ---- */
.tutorial-header { margin-bottom: 2rem; }

.platform-badge {
  display: inline-block; font-family: var(--font-heading); font-size: 0.75rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: #0891B2; background: rgba(8, 145, 178, 0.1); border: 1px solid rgba(8, 145, 178, 0.2);
  padding: 0.25rem 0.75rem; border-radius: 9999px; margin-bottom: 0.75rem;
}
[data-theme="dark"] .platform-badge {
  color: #22D3EE; background: rgba(34, 211, 238, 0.1); border-color: rgba(34, 211, 238, 0.2);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .platform-badge {
    color: #22D3EE; background: rgba(34, 211, 238, 0.1); border-color: rgba(34, 211, 238, 0.2);
  }
}

h1 {
  font-family: var(--font-heading); font-size: 1.65rem; font-weight: 700;
  margin-bottom: 1rem; color: var(--text); line-height: 1.3;
}

/* ---- Metadata pills ---- */
.meta-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0; }
.pill {
  display: inline-flex; align-items: center; gap: 0.35rem; background: var(--pill-bg);
  border: 1px solid var(--pill-border); border-radius: 9999px; padding: 0.3rem 0.75rem;
  font-size: 0.8rem; color: var(--pill-text); font-family: var(--font-body); font-weight: 500;
}
.pill strong { font-weight: 600; color: var(--pill-strong); }

/* ---- Video section ---- */
.video-section { margin-bottom: 1.5rem; }

/* ---- Action bar ---- */
.action-bar {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
  padding: 1rem 0; margin-bottom: 1.5rem;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.action-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-body); font-size: 0.8rem; font-weight: 500;
  padding: 0.5rem 0.85rem; border-radius: 8px;
  border: 1px solid var(--action-border); background: var(--action-bg);
  color: var(--action-text); text-decoration: none;
  transition: opacity 0.15s, border-color 0.15s, color 0.15s;
}
.action-btn svg { opacity: 0.5; }
.action-download, .action-share {
  cursor: pointer; opacity: 1; color: var(--text, #334155);
}
.action-download:hover, .action-share:hover {
  border-color: #0891B2; color: #0891B2;
}
.action-download:hover svg, .action-share:hover svg { opacity: 1; }
.action-download svg, .action-share svg { opacity: 0.7; }
.action-disabled { cursor: not-allowed; opacity: 0.5; }

/* ---- Transcript section ---- */
.transcript-section { margin-bottom: 2rem; }
.transcript-section h2 {
  font-family: var(--font-heading); font-size: 1.25rem; font-weight: 600;
  color: var(--heading); margin-bottom: 1rem;
}
.transcript-content {
  background: var(--transcript-bg); border: 1px solid var(--transcript-border);
  border-radius: 12px; padding: 1.25rem 1.5rem;
  max-height: 300px; overflow-y: auto;
}
.transcript-line {
  font-family: var(--font-body); font-size: 0.875rem; line-height: 1.7;
  color: var(--body); margin-bottom: 0.5rem;
}
.transcript-line:last-child { margin-bottom: 0; }

/* Scrollbar styling for transcript */
.transcript-content::-webkit-scrollbar { width: 6px; }
.transcript-content::-webkit-scrollbar-track { background: transparent; }
.transcript-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.transcript-content::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ---- Step-by-step guide section ---- */
.guide-section { margin-bottom: 2rem; }
.guide-section h2 {
  font-family: var(--font-heading); font-size: 1.25rem; font-weight: 600;
  color: var(--heading); margin-bottom: 1.25rem;
}

/* ---- Step card ---- */
.step {
  background: var(--surface); border-radius: 12px; padding: 1.5rem; margin-bottom: 1.25rem;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.step-header { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 1rem; }
.step-badge {
  flex-shrink: 0; width: 2rem; height: 2rem; border-radius: 50%;
  background: #0891B2; color: white; font-size: 0.85rem; font-weight: 700;
  font-family: var(--font-heading);
  display: flex; align-items: center; justify-content: center; margin-top: 0.1rem;
  border-bottom: 2px solid var(--badge-accent);
}
.step h3 {
  font-family: var(--font-heading); font-size: 1.05rem; font-weight: 600;
  color: var(--heading); line-height: 1.4;
}
.step p { color: var(--body); font-family: var(--font-body); margin-bottom: 1rem; }
.step figure { margin: 0; }
.step img {
  max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px;
  display: block; cursor: pointer; transition: border-color 0.2s;
  border-bottom: 3px solid var(--border);
}
.step img:hover { border-bottom: 3px solid var(--img-hover); }

/* ---- Completion card ---- */
.step.completion {
  background: linear-gradient(135deg, var(--comp-from), var(--comp-to));
  border-color: var(--comp-to); border-top: 2px solid var(--badge-accent);
}
.step.completion .step-badge,
.step.completion .completion-badge {
  background: rgba(255,255,255,0.95); color: var(--comp-badge);
  border-bottom-color: transparent;
}
.step.completion h3 { color: white; }
.step.completion p { color: rgba(255,255,255,0.95); }

/* ---- Lightbox ---- */
.lightbox {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(15,23,42,0.85); align-items: center; justify-content: center;
  flex-direction: column;
}
.lightbox.open { display: flex; }
.lightbox-close {
  position: absolute; top: 1rem; right: 1rem; background: rgba(255,255,255,0.15);
  border: none; color: white; width: 40px; height: 40px; border-radius: 50%;
  font-size: 1.25rem; cursor: pointer; display: flex; align-items: center;
  justify-content: center;
}
.lightbox-close:hover { background: rgba(255,255,255,0.3); }
.lightbox-img {
  max-width: 90vw; max-height: 85vh; object-fit: contain;
  border: 4px solid white; border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.lightbox-caption {
  color: white; font-family: var(--font-body); font-size: 0.875rem;
  margin-top: 0.75rem; max-width: 90vw; text-align: center;
}
.lightbox-counter {
  color: #94a3b8; font-size: 0.75rem; margin-top: 0.25rem;
  font-family: var(--font-body);
}
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.15); border: none; color: white;
  width: 40px; height: 40px; border-radius: 50%; font-size: 1.5rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s;
}
.lightbox:hover .lightbox-nav { opacity: 1; }
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

/* ---- Prerequisite banner ---- */
.prerequisite {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1rem;
  background: var(--pill-bg); border: 1px solid var(--pill-border);
  border-radius: 8px; margin-bottom: 1.25rem;
  font-family: var(--font-body); font-size: 0.85rem;
}
.prereq-label { color: var(--muted); font-weight: 600; white-space: nowrap; }
.prereq-page { color: var(--text); font-weight: 500; }

/* ---- Responsive: mobile ---- */
@media (max-width: 640px) {
  h1 { font-size: 1.3rem; }
  .step { padding: 1rem; }
  .transcript-content { padding: 1rem; max-height: 200px; }
  .action-bar { gap: 0.4rem; }
  .action-btn { font-size: 0.75rem; padding: 0.4rem 0.6rem; }
  .coming-soon-label { display: none; }
}

/* ---- High contrast ---- */
@media (prefers-contrast: high) {
  body { background: white; }
  .step { border-color: black; border-width: 2px; }
  .step.completion { border-left: 6px solid black; }
  .action-btn { border-color: black; color: black; }
}
