/* HTML tutorial — typography, colors, and component polish */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@600;700;800&family=Source+Sans+3:ital,wght@0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
    --html-primary: #e34c26;
    --html-primary-dark: #c0392b;
    --html-secondary: #1b2838;
    --html-accent: #f06529;
    --html-sky: #3b82f6;
    --html-mint: #10b981;
    --html-amber: #f59e0b;
    --html-surface: #fff8f6;
    --html-card: #ffffff;
    --html-text: #1e293b;
    --html-muted: #64748b;
    --html-heading: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
    --html-body: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
    --html-mono: 'JetBrains Mono', 'Consolas', monospace;
    --html-gradient: linear-gradient(135deg, #e34c26 0%, #f06529 45%, #f59e0b 100%);
    --html-hero-gradient: linear-gradient(125deg, #1b2838 0%, #2d3e50 40%, #e34c26 100%);
}

.html-tutorial-page {
    background-color: #f4f6f9;
}

.html-tutorial-main {
    font-family: var(--html-body);
    font-size: 1.0625rem;
    line-height: 1.75;
    color: var(--html-text);
    -webkit-font-smoothing: antialiased;
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 120px, #f8fafc 100%);
    min-width: 0;
    max-width: 100%;
}

/* Reading progress */
.html-progress-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(27, 40, 56, 0.08);
    z-index: 1100;
}

.html-progress-bar {
    height: 100%;
    width: 0;
    background: var(--html-gradient);
    transition: width 0.12s ease-out;
}

/* Hero */
.html-hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 2.5rem;
    padding: 2.75rem 2rem;
    border-radius: 20px;
    background: var(--html-hero-gradient);
    border: none;
    box-shadow: 0 20px 50px rgba(227, 76, 38, 0.25);
    text-align: center;
}

.html-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 85% 15%, rgba(240, 101, 41, 0.35) 0%, transparent 45%),
                radial-gradient(circle at 10% 90%, rgba(59, 130, 246, 0.15) 0%, transparent 40%);
    pointer-events: none;
}

.html-hero .html-hero-inner {
    position: relative;
    z-index: 1;
}

.html-hero h1 {
    font-family: var(--html-heading);
    font-size: clamp(1.85rem, 4vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #fff;
    margin-bottom: 0.75rem;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.html-hero .lead {
    font-size: 1.2rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.92);
    max-width: 42rem;
    margin: 0 auto 1.25rem;
}

.html-hero-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.html-hero-badges .badge {
    font-family: var(--html-heading);
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
}

.html-hero-badges .badge-html {
    background: rgba(255, 255, 255, 0.95);
    color: var(--html-primary);
}

.html-hero-badges .badge-stack {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

/* Sections */
.html-tutorial-main .topic-section {
    margin-bottom: 3rem;
    padding: 1.75rem 1.75rem 2rem;
    border-radius: 16px;
    border: 1px solid rgba(227, 76, 38, 0.12);
    border-bottom: none;
    background: linear-gradient(135deg, #ffffff 0%, var(--html-surface) 100%);
    box-shadow: 0 8px 32px rgba(27, 40, 56, 0.06);
    border-left: 5px solid var(--html-primary);
}

.html-tutorial-main .topic-section h2 {
    font-family: var(--html-heading);
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--html-secondary);
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid rgba(227, 76, 38, 0.15);
}

.html-tutorial-main .topic-section h2 .fa,
.html-tutorial-main .topic-section h2 .fas,
.html-tutorial-main .topic-section h2 .fab {
    color: var(--html-primary);
}

.html-tutorial-main .topic-section h4,
.html-tutorial-main .topic-section h5 {
    font-family: var(--html-heading);
    font-weight: 700;
    color: var(--html-secondary);
}

.html-tutorial-main .topic-section h4 {
    color: var(--html-primary-dark);
}

/* Definition & code boxes */
.html-tutorial-main .definition-box {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%) !important;
    border-left: 4px solid var(--html-mint) !important;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.08);
}

.html-tutorial-main .definition-box h4 {
    color: #047857;
    font-family: var(--html-heading);
    font-weight: 700;
}

.html-tutorial-main .code-example {
    background: #ffffff !important;
    color: #1e293b !important;
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--html-sky);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(27, 40, 56, 0.06);
    padding: 0;
    margin: 1.25rem 0;
}

.html-tutorial-main .code-example .code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
}

.html-tutorial-main .code-example .code-title {
    font-family: var(--html-heading);
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--html-secondary);
    margin: 0;
    line-height: 1.3;
}

.html-tutorial-main .code-example .copy-btn {
    flex-shrink: 0;
    background: var(--html-primary);
    color: #fff;
    border: none;
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--html-heading);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.html-tutorial-main .code-example--compact {
    margin: 0.75rem 0 0;
}

.html-tutorial-main .link-type-card .code-example {
    margin-top: 0.75rem;
}

.html-tutorial-main .code-example .copy-btn:hover {
    background: var(--html-primary-dark);
    transform: translateY(-1px);
}

.html-tutorial-main .code-example pre {
    margin: 0;
    padding: 1rem 1.25rem;
    background: #ffffff !important;
    font-family: var(--html-mono);
    font-size: 0.9rem;
    line-height: 1.65;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.html-tutorial-main .code-example pre code {
    display: block;
    padding: 0;
    background: #ffffff !important;
    color: #1e293b;
    font-family: var(--html-mono);
    white-space: pre;
}

.html-tutorial-main .code-example h4,
.html-tutorial-main .code-example h5 {
    color: var(--html-secondary);
    font-family: var(--html-heading);
}

/* Syntax colors on white background */
.html-tutorial-main .code-example .hljs-comment,
.html-tutorial-main .code-example .hljs-quote {
    color: #6b7280;
    font-style: italic;
}

.html-tutorial-main .code-example .hljs-tag,
.html-tutorial-main .code-example .hljs-name {
    color: #059669;
}

.html-tutorial-main .code-example .hljs-attr,
.html-tutorial-main .code-example .hljs-attribute {
    color: #b45309;
}

.html-tutorial-main .code-example .hljs-string {
    color: #0369a1;
}

.html-tutorial-main .code-example .hljs-meta,
.html-tutorial-main .code-example .hljs-meta .hljs-keyword {
    color: #7c3aed;
}

.html-tutorial-main .code-example .hljs-keyword {
    color: #c2410c;
}

.html-tutorial-main .code-example .hljs {
    background: #ffffff !important;
}

.html-tutorial-main .html-structure-demo {
    padding: 1.5rem;
    margin: 1.5rem 0;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    border-left: 4px solid var(--html-sky);
    border-radius: 0 12px 12px 0;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.08);
}

/* Cards */
.html-tutorial-main .card {
    border: 1px solid rgba(27, 40, 56, 0.08);
    border-radius: 14px;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 4px 20px rgba(27, 40, 56, 0.06);
}

.html-tutorial-main .card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(227, 76, 38, 0.12);
}

.html-tutorial-main .card-header {
    font-family: var(--html-heading);
    font-weight: 700;
    letter-spacing: 0.01em;
}

.html-tutorial-main .card-header.bg-primary {
    background: linear-gradient(135deg, var(--html-primary) 0%, var(--html-accent) 100%) !important;
    border-bottom: 3px solid var(--html-primary-dark) !important;
}

.html-tutorial-main .card-header.bg-success {
    background: linear-gradient(135deg, #059669 0%, var(--html-mint) 100%) !important;
    border-bottom: 3px solid #047857 !important;
}

.html-tutorial-main .card-header.bg-info {
    background: linear-gradient(135deg, #2563eb 0%, var(--html-sky) 100%) !important;
    border-bottom: 3px solid #1d4ed8 !important;
}

.html-tutorial-main .card-header.bg-warning {
    background: linear-gradient(135deg, #d97706 0%, var(--html-amber) 100%) !important;
    border-bottom: 3px solid #b45309 !important;
}

.html-tutorial-main .card-header.bg-danger {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%) !important;
    border-bottom: 3px solid #b91c1c !important;
}

.html-tutorial-main .card-body .fa-3x.text-primary { color: var(--html-primary) !important; }
.html-tutorial-main .card-body .fa-3x.text-success { color: var(--html-mint) !important; }
.html-tutorial-main .card-body .fa-3x.text-info { color: var(--html-sky) !important; }

/* Alerts */
.html-tutorial-main .alert {
    border-radius: 12px;
    border: none;
    font-weight: 500;
}

.html-tutorial-main .alert-info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left: 4px solid var(--html-sky);
    color: #1e40af;
}

.html-tutorial-main .alert-warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-left: 4px solid var(--html-amber);
    color: #92400e;
}

.html-tutorial-main .alert-success {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-left: 4px solid var(--html-mint);
    color: #065f46;
}

/* Tables */
.html-tutorial-main .table-custom {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(27, 40, 56, 0.08);
}

.html-tutorial-main .table-custom thead th {
    font-family: var(--html-heading);
    font-weight: 700;
    background: var(--html-secondary) !important;
    border: none;
}

.html-tutorial-main .table-custom th {
    border-top: 2px solid var(--html-primary);
}

.html-tutorial-main .table-striped > tbody > tr:nth-of-type(odd) {
    background-color: rgba(227, 76, 38, 0.04);
}

/* Timeline */
.html-tutorial-main .version-timeline {
    position: relative;
    padding-left: 2rem;
}

.html-tutorial-main .version-item {
    position: relative;
    margin-bottom: 2rem;
}

.html-tutorial-main .version-timeline::before {
    background: var(--html-gradient);
    width: 5px;
    border-radius: 3px;
}

.html-tutorial-main .version-item::before {
    content: '';
    position: absolute;
    left: -2.3rem;
    top: 0.5rem;
    width: 12px;
    height: 12px;
    background: var(--html-primary);
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px var(--html-primary);
}

.html-tutorial-main .version-item h5 {
    font-family: var(--html-heading);
    color: var(--html-primary-dark);
    font-weight: 700;
}

/* Tag classification grid */
.html-tutorial-main .tag-classification {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(27, 40, 56, 0.12);
}

.html-tutorial-main .tag-category {
    transition: transform 0.3s ease, filter 0.3s ease;
}

.html-tutorial-main .tag-category:hover {
    transform: translateY(-5px);
    filter: brightness(1.05);
}

.html-tutorial-main .tag-category code {
    font-family: var(--html-mono);
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.35);
    font-size: 0.88em;
}

.html-tutorial-main .tag-category.bg-warning code {
    background: rgba(0, 0, 0, 0.12);
    color: #1e293b;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

/* Glossary */
.html-tutorial-main .glossary-term {
    font-family: var(--html-heading);
    font-weight: 700;
    color: var(--html-primary);
}

.html-tutorial-main :not(pre) > code {
    font-family: var(--html-mono);
    font-size: 0.9em;
    color: #0f766e;
    background: #f1f5f9;
    padding: 0.15rem 0.4rem;
    border-radius: 5px;
    border: 1px solid #e2e8f0;
}

/* Navigation buttons */
.html-tutorial-main .navigation-buttons .nav-btn {
    font-family: var(--html-heading);
    font-weight: 600;
    border-color: var(--html-primary);
    color: var(--html-primary);
    border-radius: 999px;
    transition: all 0.25s ease;
}

.html-tutorial-main .navigation-buttons .nav-btn:hover {
    background: var(--html-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 24px rgba(227, 76, 38, 0.35);
    transform: translateY(-2px);
}

.html-tutorial-main .navigation-buttons.navigation-bottom {
    border-top: 2px solid rgba(227, 76, 38, 0.12);
    padding-top: 1.5rem;
    margin-top: 2rem;
}

/* Dark mode */
[data-bs-theme="dark"] .html-tutorial-page {
    background-color: #0f172a;
}

[data-bs-theme="dark"] .html-tutorial-main {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #e2e8f0;
}

[data-bs-theme="dark"] .html-tutorial-main .topic-section {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-color: rgba(227, 76, 38, 0.25);
}

[data-bs-theme="dark"] .html-tutorial-main .topic-section h2 {
    color: #f1f5f9;
}

[data-bs-theme="dark"] .html-tutorial-main .definition-box {
    background: linear-gradient(135deg, #134e4a 0%, #1e3a32 100%) !important;
}

[data-bs-theme="dark"] .html-tutorial-main .html-structure-demo {
    background: #1e293b;
}

[data-bs-theme="dark"] .html-tutorial-main .version-item::before {
    border-color: #1e293b;
}

/* Legacy Bootstrap hero (tutorial pages not yet migrated to .html-hero) */
.html-tutorial-main .hero-section {
    position: relative;
    overflow: hidden;
    margin-bottom: 2.5rem !important;
    padding: 2.75rem 2rem !important;
    border-radius: 20px !important;
    border: none !important;
    border-bottom: none !important;
    background: var(--html-hero-gradient) !important;
    box-shadow: 0 20px 50px rgba(227, 76, 38, 0.25);
    text-align: center;
}

.html-tutorial-main .hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 85% 15%, rgba(240, 101, 41, 0.35) 0%, transparent 45%),
                radial-gradient(circle at 10% 90%, rgba(59, 130, 246, 0.15) 0%, transparent 40%);
    pointer-events: none;
}

.html-tutorial-main .hero-section h1 {
    position: relative;
    z-index: 1;
    font-family: var(--html-heading);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #fff !important;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.html-tutorial-main .hero-section .lead {
    position: relative;
    z-index: 1;
    color: rgba(255, 255, 255, 0.92) !important;
    font-weight: 500;
}

/* MCQ pages */
.html-tutorial-main .content-header {
    margin-bottom: 2rem;
    padding: 1.5rem 1.75rem;
    border-radius: 16px;
    border-bottom: none;
    background: linear-gradient(135deg, rgba(227, 76, 38, 0.08) 0%, rgba(59, 130, 246, 0.06) 100%);
    border: 1px solid rgba(227, 76, 38, 0.12);
    box-shadow: 0 8px 28px rgba(27, 40, 56, 0.06);
}

.html-tutorial-main .content-header h1,
.html-tutorial-main .content-header .h2,
.html-tutorial-main .content-header .h3 {
    font-family: var(--html-heading);
    font-weight: 800;
    color: var(--html-secondary);
}

.html-tutorial-main .topic-badge {
    font-family: var(--html-heading);
    font-weight: 700;
    background: var(--html-gradient) !important;
    border: none;
    box-shadow: 0 6px 16px rgba(227, 76, 38, 0.25);
}

.html-tutorial-main .mcq-container {
    border-radius: 18px;
    border: 1px solid rgba(227, 76, 38, 0.1);
    box-shadow: 0 10px 32px rgba(27, 40, 56, 0.08);
}

.html-tutorial-main .question-card {
    border-radius: 14px;
    border-color: #e2e8f0;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.html-tutorial-main .question-card:hover {
    border-color: rgba(227, 76, 38, 0.4);
    box-shadow: 0 10px 24px rgba(227, 76, 38, 0.1);
}

.html-tutorial-main .question-number {
    background: var(--html-gradient) !important;
}

.html-tutorial-main .explanation {
    border-left-color: var(--html-primary);
    border-radius: 10px;
}

/* Interview pages */
.html-tutorial-main .qa-section {
    margin-bottom: 1.25rem;
    padding: 1.25rem 1.5rem;
    border-radius: 16px;
    border: 1px solid rgba(227, 76, 38, 0.12);
    background: #fff;
    box-shadow: 0 6px 24px rgba(27, 40, 56, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.html-tutorial-main .qa-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(227, 76, 38, 0.1);
    border-color: rgba(227, 76, 38, 0.3);
}

.html-tutorial-main .qa-section .question-number {
    background: var(--html-gradient);
    color: #fff;
    font-family: var(--html-heading);
    font-weight: 700;
}

.html-tutorial-main .qa-section .question {
    font-family: var(--html-heading);
    font-weight: 700;
    color: var(--html-secondary);
}

.html-tutorial-main .table-of-contents {
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 12px;
    background: var(--html-surface);
    border: 1px solid rgba(227, 76, 38, 0.12);
    color: var(--html-muted);
    font-size: 0.95rem;
}

/* Interview / mini code snippets */
.html-tutorial-main .code-snippet-mini,
.html-tutorial-main .code-snippet {
    margin-top: 0.75rem;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--html-sky);
    background: #ffffff;
}

.html-tutorial-main .code-snippet-mini pre,
.html-tutorial-main .code-snippet pre {
    margin: 0;
    padding: 1rem;
    background: #ffffff !important;
}

.html-tutorial-main .code-snippet-mini code,
.html-tutorial-main .code-snippet code {
    font-family: var(--html-mono);
    font-size: 0.88rem;
    background: #ffffff !important;
}

.html-tutorial-main .code-snippet-mini .hljs-comment,
.html-tutorial-main .code-snippet .hljs-comment {
    color: #6b7280;
    font-style: italic;
}

@media (max-width: 768px) {
    .html-hero,
    .html-tutorial-main .hero-section {
        padding: 2rem 1.25rem !important;
    }

    .html-tutorial-main .topic-section {
        padding: 1.25rem 1.15rem 1.5rem;
    }
}
