/* ==========================================================================
   JavaScript Tutorial — Scoped under .tutorial-js
   All selectors are scoped to prevent leakage into the site template.
   ========================================================================== */

/* ---------- Base (on wrapper, not body) ---------- */
.tutorial-js {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #1e293b;
    line-height: 1.8;
}

/* ---------- Container ---------- */
.tutorial-js .container {
    max-width: 1000px;
    margin: 0 auto;
    background: #ffffff;
    padding: 2.5rem 2.8rem;
    border-radius: 32px;
    box-shadow: 0 20px 40px -12px rgba(0, 20, 40, 0.25);
    border: 1px solid #e2eaf2;
}

@media (max-width: 640px) {
    .tutorial-js .container {
        padding: 1.8rem 1.2rem;
        border-radius: 24px;
    }
}

/* ---------- Header ---------- */
.tutorial-js .article-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 3px dashed #ccd9e8;
}

.tutorial-js .article-header h1 {
    font-size: 2.6rem;
    font-weight: 800;
    color: #0b2b4b;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.tutorial-js .article-header h1 .js-icon {
    background: #f7df1e;
    color: #0b2b4b;
    padding: 0.3rem 1rem;
    border-radius: 60px;
    font-size: 1.6rem;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(247, 223, 30, 0.4);
}

/* .tutorial-js .badge {
    display: inline-block;
    background: #dbeafe;
    color: #1e4b6e;
    font-weight: 600;
    padding: 0.25rem 1.5rem;
    border-radius: 40px;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    border: 1px solid #b9d1f0;
} */

/* ---------- Table of Contents ---------- */
.tutorial-js .toc {
    background: #eef4fa;
    padding: 1.2rem 2rem;
    border-radius: 24px;
    margin: 2rem 0 2.5rem 0;
    border-right: 6px solid #1e4b6e;
}

.tutorial-js .toc strong {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #0b2b4b;
    margin-bottom: 0.3rem;
}

.tutorial-js .toc ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.8rem;
    margin-top: 0.3rem;
}

.tutorial-js .toc li a {
    text-decoration: none;
    color: #1e4b6e;
    font-weight: 500;
    transition: 0.15s;
    border-bottom: 2px solid transparent;
    padding-bottom: 2px;
}

.tutorial-js .toc li a:hover {
    border-bottom-color: #1e4b6e;
    color: #0a1f30;
}

/* ---------- Typography ---------- */
.tutorial-js h2 {
    font-size: 2rem;
    margin: 2.2rem 0 1.2rem 0;
    font-weight: 800;
    color: #0b2b4b;
    border-right: 8px solid #1e4b6e;
    padding-right: 1.2rem;
    background: linear-gradient(to left, #ffffff00, #e7eff9);
    border-radius: 0 12px 12px 0;
}

.tutorial-js h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 1.8rem 0 0.8rem 0;
    color: #1e3b57;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.tutorial-js p {
    margin: 1rem 0;
    text-align: justify;
}

.tutorial-js hr {
    margin: 2.8rem 0;
    border: 0;
    height: 2px;
    background: linear-gradient(to left, #d0d9e8, transparent);
}

.tutorial-js ul,
.tutorial-js ol {
    padding-right: 1.8rem;
    margin: 0.8rem 0;
}

.tutorial-js li {
    margin: 0.3rem 0;
}

.tutorial-js a {
    color: #1e4b6e;
    text-decoration: none;
}

/* ---------- Code Box ---------- */
.tutorial-js .code-box {
    background: #0d1f2e;
    color: #e3eaf3;
    padding: 1.2rem 1.8rem;
    border-radius: 20px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    direction: ltr;
    text-align: left;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 12px 20px -12px #0b1a26;
    border: 1px solid #2a4055;
    margin: 1.4rem 0;
    position: relative;
}

.tutorial-js .code-box::before {
    content: "▸ JS";
    position: absolute;
    top: 8px;
    right: 16px;
    font-size: 0.7rem;
    color: #8098b3;
    letter-spacing: 1px;
    background: #1e3140;
    padding: 0.2rem 0.8rem;
    border-radius: 40px;
}

.tutorial-js .inline-code {
    background: #e7edf5;
    color: #1e3b57;
    padding: 0.1rem 0.6rem;
    border-radius: 12px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    border: 1px solid #cbd8e8;
}

.tutorial-js .tip-box {
    background: #ecf7f0;
    border-right: 8px solid #1c7e4a;
    padding: 1.2rem 1.8rem;
    border-radius: 20px;
    margin: 1.6rem 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
}

.tutorial-js .tip-box .tip-icon {
    font-weight: 700;
    color: #1c7e4a;
}

/* ---------- Badges ---------- */
.tutorial-js .badge {
    display: inline-block;
    font-weight: 600;
    padding: 0.2rem 1rem;
    border-radius: 40px;
    font-size: 0.9rem;
}

.tutorial-js .badge-accent {
    background: #f7df1e;
    color: #0b2b4b;
}

.tutorial-js .badge-gray {
    background: #e2eaf2;
    color: #1e3b57;
    border: 1px solid #ccd9e8;
}

/* ---------- Footer & Back-top ---------- */
.tutorial-js .footer-note {
    text-align: center;
    margin-top: 3rem;
    font-weight: 400;
    color: #3b5775;
    border-top: 2px solid #dbe1ea;
    padding-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.tutorial-js .back-top {
    display: inline-block;
    background: #1e4b6e;
    color: white;
    padding: 0.4rem 1.2rem;
    border-radius: 40px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: 0.2s;
    box-shadow: 0 4px 10px #1e4b6e40;
    text-decoration: none;
}

.tutorial-js .back-top:hover {
    background: #0b2b4b;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px #1e4b6e60;
}
