/**
 * Tutorial Styles
 *
 * Styles for tutorial list and single page templates.
 * Optimized for learning with clear hierarchy and helpful indicators.
 */

/* ============================================
   TUTORIAL LIST PAGE
   ============================================ */

.tutorial-page {
  max-width: var(--prose-width);
  margin-inline: auto;
}

.tutorial-container {
    max-width: var(--content-max-width, 1200px);
    margin: 0 auto;
    padding-block: var(--space-6);
    /* Remove horizontal padding when inside container to avoid double padding */
    padding-inline: 0;
}

/* Tutorial container provides its own padding when NOT inside a container */
.tutorial-container:not(.container > *) {
    padding-inline: var(--space-4);
}

.tutorial-header {
    margin-bottom: var(--space-12);
    padding: var(--space-8) 0;
    text-align: center;
}

/* Moved to layouts/page-header.css - use .page-header.page-header--centered */

.tutorial-description {
    font-size: var(--text-lg);
    color: var(--color-text-primary-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Tutorial Statistics Bar */
.tutorial-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-12);
    flex-wrap: wrap;
    margin-bottom: var(--space-8);
    padding: var(--space-6);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--elevation-low);
}

.tutorial-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
}

.tutorial-stat strong {
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    color: var(--color-primary);
}

.tutorial-stat span {
    font-size: var(--text-sm);
    color: var(--color-text-primary-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Tutorial Grid */
.tutorial-section {
    margin-bottom: var(--space-12);
}

.tutorial-section-title {
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 2px solid var(--color-border);
}

.tutorial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-6);
}

/* Force single column on very small screens */
@media (max-width: 399px) {
    .tutorial-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .tutorial-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
}

/* Tutorial Card */
.tutorial-card {
    background: var(--color-surface);
    border-radius: var(--radius-xl); /* Already 12px - good! */
    padding: var(--space-6);
    box-shadow: var(--elevation-card);
    transition: all 0.2s ease;
    transform: translateY(0);
    border: 1px solid var(--color-border);
}

/* Gradient border support */
.tutorial-card.gradient-border {
    border: none;
}

.tutorial-card.fluid-combined {
    border: none;
}

.tutorial-card:hover {
    box-shadow: var(--elevation-high);
    transform: translateY(-4px);
}

.tutorial-card-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.tutorial-icon {
    font-size: var(--text-2xl);
    line-height: 1;
    flex-shrink: 0;
}

.tutorial-title {
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    line-height: 1.3;
    margin: 0;
    flex: 1;
}

.tutorial-title a {
    color: var(--color-text-primary);
    text-decoration: none;
}

.tutorial-title a:hover {
    color: var(--color-primary);
}

.tutorial-card-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.tutorial-description {
    font-size: var(--text-base);
    color: var(--color-text-primary-secondary);
    line-height: 1.6;
}

/* Tutorial Metadata */
.tutorial-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
}

.tutorial-meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-primary-muted);
}

.tutorial-meta-item svg {
    flex-shrink: 0;
}

/* Difficulty Badges */
.tutorial-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tutorial-badge-beginner {
    background: #e8f5e9;
    color: #2e7d32;
}

.tutorial-badge-intermediate {
    background: #fff3e0;
    color: #ef6c00;
}

.tutorial-badge-advanced {
    background: #fce4ec;
    color: #c2185b;
}

[data-theme="dark"] .tutorial-badge-beginner {
    background: rgba(46, 125, 50, 0.2);
    color: #81c784;
}

[data-theme="dark"] .tutorial-badge-intermediate {
    background: rgba(239, 108, 0, 0.2);
    color: #ffb74d;
}

[data-theme="dark"] .tutorial-badge-advanced {
    background: rgba(194, 24, 91, 0.2);
    color: #f48fb1;
}

/* Tutorial Link */
.tutorial-link {
    display: inline-block;
    margin-top: var(--space-2);
    color: var(--color-primary);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
}

.tutorial-link:hover {
    text-decoration: underline;
}

/* Empty State */
.tutorial-empty {
    text-align: center;
    padding: var(--space-12);
    color: var(--color-text-primary-muted);
}

/* ============================================
   TUTORIAL SINGLE PAGE
   ============================================ */

.tutorial-page-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-6);
    max-width: 900px;
    margin: 0 auto;
    padding: var(--space-6) var(--space-4);
}

.tutorial-page-layout.tutorial-with-toc {
    grid-template-columns: minmax(0, 1fr) 260px;
    max-width: 1200px;
}

@media (max-width: 1024px) {
    .tutorial-page-layout.tutorial-with-toc {
        grid-template-columns: 1fr;
    }

    .tutorial-sidebar {
        display: none;
    }
}

/* Tutorial Page Header */
.tutorial-page-header {
    margin-bottom: var(--space-8);
}

.tutorial-page-icon {
    font-size: var(--text-5xl);
    margin-bottom: var(--space-4);
}

.tutorial-page-header h1 {
    margin-bottom: var(--space-3);
}

.tutorial-page-header .lead {
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
    font-weight: var(--weight-normal);
    line-height: 1.7;
    letter-spacing: 0.01em;
    padding-bottom: var(--space-6);
    margin-bottom: 0;
    border-bottom: 1px solid var(--color-border);
}

.tutorial-page-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    align-items: center;
    padding: var(--space-4) 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    margin: var(--space-6) 0;
}

/* Prerequisites Box */
.tutorial-prerequisites,
.tutorial-objectives {
    padding: var(--space-4);
    background: var(--color-surface);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-md);
    margin: var(--space-6) 0;
}

.tutorial-prerequisites h4,
.tutorial-objectives h4 {
    margin-top: 0;
    margin-bottom: var(--space-3);
    color: var(--color-primary);
    font-size: var(--text-base);
}

.tutorial-prerequisites ul,
.tutorial-objectives ul {
    margin: 0;
    padding-left: var(--space-5);
}

.tutorial-prerequisites li,
.tutorial-objectives li {
    margin-bottom: var(--space-2);
}

/* Prerequisite Links */
.tutorial-prereq-link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: var(--weight-medium);
    transition: color var(--transition-fast);
}

.tutorial-prereq-link:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

.tutorial-prereq-link:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Tutorial Content */
.tutorial-content {
    margin: var(--space-6) 0;
}

/* Tutorial Footer */
.tutorial-footer {
    margin-top: var(--space-12);
    padding-top: var(--space-6);
    border-top: 2px solid var(--color-border);
}

.tutorial-next-steps,
.tutorial-further-reading {
    margin-bottom: var(--space-6);
}

.tutorial-next-steps h3,
.tutorial-further-reading h3 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-3);
}

/* Tutorial Navigation */
.tutorial-navigation {
    margin: var(--space-12) 0;
}

/* Related Tutorials */
.related-tutorials {
    background: var(--color-bg-secondary);
    padding: var(--space-12) 0;
    margin-top: var(--space-12);
}

.related-tutorials h2 {
    text-align: center;
    margin-bottom: var(--space-8);
}

/* Tutorial Sidebar */
.tutorial-sidebar {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tutorial-card,
    .tutorial-page-header {
        padding: var(--space-4);
    }

    .tutorial-page-header .lead {
        font-size: var(--text-base);
        padding-bottom: var(--space-4);
    }

    .tutorial-header,
    .tutorial-footer {
        padding: var(--space-4) 0;
        margin-bottom: var(--space-6);
    }
}
