/* =========================================================
   TUTORIAL / RANGKAIAN (single-tutorial.php) — v2
   Memakai token global; komponen .arc-container & .singlepost-toc
   berasal dari archive-v2.css / singlepost/content.css.
========================================================= */

.ts-page {
    --ts-dark: #0b0f14;
    --ts-on-dark: #e6edf3;

    box-sizing: border-box;
    width: 100%;
}

.ts-page *,
.ts-page *::before,
.ts-page *::after {
    box-sizing: border-box;
}

.ts-page .screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Kontainer halaman: lebih lebar dari .arc-container supaya panel
   rangkaian bisa lebih ke tepi kiri dan artikel dapat ruang lebih. */
.ts-shell {
    box-sizing: border-box;
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 28px;
}

/* =========================================================
   1. HERO GELAP
========================================================= */

.ts-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;

    padding: 28px 0 34px;

    background: var(--ts-dark);
    color: var(--ts-on-dark);
}

.ts-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;

    background-image:
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 56px 56px;

    -webkit-mask-image: radial-gradient(120% 130% at 12% 0%, #000 10%, transparent 72%);
    mask-image: radial-gradient(120% 130% at 12% 0%, #000 10%, transparent 72%);

    pointer-events: none;
}

.ts-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;

    background: radial-gradient(80% 120% at 88% 0%, rgba(47, 129, 247, 0.18), transparent 62%);

    pointer-events: none;
}

.ts-hero > .ts-shell {
    position: relative;
    z-index: 1;
}

.ts-hero-text {
    min-width: 0;
}

/*
 * Logo rangkaian (diatur di Appearance → Logo Rangkaian).
 * Tanpa logo, teks memakai lebar penuh; dengan logo, judul bergeser
 * ke kiri dan logo berdiri di kanan judul.
 */
.ts-hero--logo .ts-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 232px;
    gap: 36px;
    align-items: center;
}

.ts-hero-logo {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 232px;
    height: 232px;
    padding: 24px;

    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;

    background: rgba(255, 255, 255, 0.06);

    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.ts-hero-logo img {
    display: block;

    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;

    object-fit: contain;

    filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.45));
}

.ts-crumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;

    margin-bottom: 14px;

    font-size: 12.5px;
    font-weight: 500;
    color: rgba(230, 237, 243, 0.62);
}

.ts-crumb a {
    color: rgba(230, 237, 243, 0.72);
    text-decoration: none;
    transition: color 0.2s ease;
}

.ts-crumb a:hover,
.ts-crumb a:focus-visible {
    color: #ffffff;
}

.ts-crumb-sep {
    color: rgba(230, 237, 243, 0.32);
}

.ts-eyebrow {
    display: block;
    margin-bottom: 10px;

    font-family: var(--font-mono);
    font-size: 11.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;

    color: #79c0ff;
}

/* Nama rangkaian dipertahankan huruf aslinya (mis. "cPanel") */
.ts-eyebrow-name {
    text-transform: none;
    letter-spacing: 0.02em;
    color: #b9d7ff;
}

.ts-title {
    max-width: 32ch;
    margin: 0 0 14px;

    font-size: clamp(26px, 3.4vw, 38px);
    line-height: 1.16;
    font-weight: 800;
    letter-spacing: -0.02em;

    color: #ffffff;
    overflow-wrap: break-word;

    /* hindari satu kata menggantung di baris terakhir (browser modern) */
    text-wrap: balance;
}

.ts-title:focus {
    outline: none;
}

.ts-title:focus-visible {
    outline: 2px solid #58a6ff;
    outline-offset: 4px;
    border-radius: 4px;
}

.ts-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ts-hero .ts-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    padding: 6px 12px;

    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;

    background: rgba(255, 255, 255, 0.06);

    font-size: 12.5px;
    font-weight: 500;
    color: #c9d1d9;

    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.ts-hero .ts-chip i {
    font-size: 11px;
    color: #79c0ff;
}

.ts-chip--part {
    border-color: rgba(88, 166, 255, 0.35) !important;
    color: #cfe6ff !important;
}

/* ---------- progress rangkaian ---------- */

.ts-progress {
    position: relative;

    width: 100%;
    max-width: 420px;
    height: 6px;

    margin-top: 18px;

    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.ts-progress-bar {
    display: block;
    height: 100%;

    border-radius: 999px;
    background: linear-gradient(90deg, #2f81f7, #79c0ff);
}

/* =========================================================
   2. AREA KONTEN
========================================================= */

.ts-body {
    padding: 32px 0 72px;
    background: var(--bg-1);
}

.ts-layout {
    display: grid;
    /* rail cukup lebar untuk judul bagian yang panjang */
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 36px;
    align-items: start;
}

/* =========================================================
   3. KOLOM RANGKAIAN
========================================================= */

.ts-rail-wrap {
    position: sticky;
    top: calc(var(--header-offset, 89px) + 20px);

    min-width: 0;

    /* Panel rangkaian + daftar isi bisa lebih tinggi dari viewport:
       kolom kiri menggulir sendiri agar judul tetap sticky di tempatnya. */
    max-height: calc(100vh - var(--header-offset, 89px) - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--line-300) transparent;
    padding-right: 2px;
}

/* =========================================================
   DAFTAR ISI (kolom kiri, di bawah panel rangkaian)
========================================================= */

.ts-toc-rail {
    margin: 18px 0 0;

    border-radius: 16px;
}

.ts-toc-rail .singlepost-toc-toggle {
    padding: 16px 18px;

    font-size: 14.5px;
}

.ts-toc-rail .singlepost-toc-content {
    padding:
        0
        18px
        18px;
}

.ts-toc-rail .singlepost-toc-list {
    gap: 10px;
}

.ts-toc-rail .singlepost-toc-list li {
    padding-left: 16px;

    line-height: 1.5;
}

.ts-toc-rail .singlepost-toc-list li::before {
    top: 8px;
}

.ts-toc-rail .singlepost-toc-list li a {
    font-size: 13.5px;

    line-height: 1.5;
}

/* Judul di dalam artikel tidak tertutup header tetap saat lompat dari daftar isi */
.ts-content h2,
.ts-content h3 {
    scroll-margin-top: calc(var(--header-offset, 89px) + 24px);
}

.ts-rail {
    border: 1px solid var(--color-border);
    border-radius: 16px;
    background: var(--surface);
    overflow: hidden;
}

/* Ringkasan hanya dipakai di layar kecil */
.ts-rail-summary {
    display: none;
}

.ts-rail-panel {
    padding: 18px 18px 16px;
}

.ts-rail-label {
    display: block;
    margin-bottom: 6px;

    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;

    color: var(--color-muted);
}

.ts-rail-title {
    margin: 0 0 6px;

    font-size: 18px;
    line-height: 1.3;
    font-weight: 750;
    letter-spacing: -0.01em;

    color: var(--color-ink);
    overflow-wrap: break-word;
}

.ts-rail-meta {
    margin: 0 0 10px;

    font-size: 12px;
    color: var(--color-muted);
}

.ts-rail-progress {
    height: 5px;
    margin-bottom: 14px;

    border-radius: 999px;
    background: var(--surface-hi);
    overflow: hidden;
}

.ts-rail-progress-bar {
    display: block;
    height: 100%;

    border-radius: 999px;
    background: linear-gradient(90deg, var(--color-primary), #58a6ff);
}

/* ---------- daftar bagian ---------- */

.ts-list {
    margin: 0;
    padding: 0;
    list-style: none;

    display: flex;
    flex-direction: column;
    gap: 2px;

    max-height: calc(100vh - var(--header-offset, 89px) - 300px);
    overflow-y: auto;
    scrollbar-width: thin;
}

.ts-item a {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 8px;

    padding: 8px 9px;

    border-radius: 9px;
    border-left: 2px solid transparent;

    font-size: 13px;
    line-height: 1.45;
    color: var(--color-ink);
    text-decoration: none;

    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.ts-item a:hover {
    background: var(--bg-1);
    color: var(--color-primary);
}

/* Judul bagian ditampilkan utuh (dulu dipotong 3 baris sehingga judul
   panjang berakhir dengan elipsis di panel yang sempit). */
.ts-item-title {
    overflow-wrap: break-word;
}

.ts-num {
    font-family: var(--font-mono);
    font-size: 10.5px;
    line-height: 1.9;
    color: var(--color-muted);
}

.ts-item.is-current a {
    border-left-color: var(--color-primary);
    background: rgba(9, 105, 218, 0.08);
    color: var(--color-primary);
    font-weight: 650;
}

.ts-item.is-current .ts-num {
    color: var(--color-primary);
}

/* ---------- CTA kecil di bawah daftar ---------- */

.ts-rail-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;

    margin-top: 14px;
    padding: 11px 12px;

    border-radius: 10px;
    background: var(--ts-dark);

    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    color: #e6edf3;
    text-decoration: none;

    transition: background 0.2s ease;
}

.ts-rail-cta:hover {
    background: #161b22;
}

.ts-rail-cta i {
    color: #79c0ff;
    font-size: 11px;
}

/* =========================================================
   4. ARTIKEL
========================================================= */

.ts-main {
    min-width: 0;
}

/* Artikel dibungkus kartu putih supaya sejajar visual dengan panel kiri
   dan tidak "mengambang" di atas latar abu-abu. */
.ts-article {
    min-width: 0;
    padding: 28px 34px 32px;

    border: 1px solid var(--color-border);
    border-radius: 16px;
    background: var(--surface);
}

/*
 * Kartu dalam kartu = border ganda. `.singlepost-content` (content.css)
 * sendiri punya border + radius + padding 50px, dan `.singlepost-toc`
 * punya border + radius 24px. Di dalam kartu artikel keduanya
 * dilepas, jadi konten memakai bingkai kartu artikel saja.
 */
.ts-article .singlepost-content {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.ts-article .singlepost-toc {
    margin: 0 0 26px;
    padding: 0 0 2px;

    border: 0;
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
    background: transparent;
}

.ts-article .singlepost-toc-toggle {
    padding: 12px 0;
}

.ts-toc {
    margin-bottom: 24px;
}

.ts-card-wrap {
    min-width: 0;
}

/* =========================================================
   5. KOTAK PENULIS (seperti single post v2)
========================================================= */

/*
 * Kotak penulis: di single post bentuknya kartu berbingkai. Di sini artikel
 * sudah berada di dalam kartu, jadi penulis diberi panel latar lembut
 * (tanpa border) — tetap terasa seperti kartu tanpa membuat border ganda.
 */
.ts-author {
    display: flex;
    gap: 20px;
    align-items: flex-start;

    margin-top: 34px;
    padding: 22px 24px;

    border-radius: 14px;
    background: var(--bg-1);
}

.ts-author-img {
    display: block;

    width: 88px;
    height: 88px;

    border: 1px solid var(--color-border);
    border-radius: 50%;

    background: var(--bg-1);
    object-fit: cover;
}

.ts-author-body {
    min-width: 0;
}

.ts-author-eyebrow {
    display: block;

    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;

    color: var(--color-primary);
}

.ts-author-name {
    margin: 6px 0 8px;

    font-size: 20px;
    line-height: 1.3;
    font-weight: 800;
    letter-spacing: -0.01em;

    color: var(--color-ink);
}

.ts-author-count {
    margin: 0 0 8px;

    font-size: 12.5px;
    color: var(--color-muted);
}

.ts-author-bio {
    /* paragraf profil memenuhi lebar kartu, ukuran sama dengan single post */
    max-width: none;
    margin: 0 0 14px;

    font-size: 15.5px;
    line-height: 1.7;
    text-wrap: pretty;

    color: #4b5563;
}

.ts-author-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* ---------- ikon sosial media penulis ---------- */

.ts-author-social {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;

    margin: 0;
    padding: 0;

    list-style: none;
}

.ts-author-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 32px;
    height: 32px;

    border: 1px solid var(--color-border);
    border-radius: 8px;

    background: var(--surface);

    font-size: 14px;
    color: #4b5563;
    text-decoration: none;

    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.ts-author-social-link:hover,
.ts-author-social-link:focus-visible {
    border-color: var(--color-primary);
    background: rgba(9, 105, 218, 0.06);
    color: var(--color-primary);
}


.ts-author-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    padding: 8px 12px;

    border: 1px solid var(--color-border);
    border-radius: 9px;

    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-ink);
    text-decoration: none;

    transition: border-color 0.2s ease, color 0.2s ease;
}

.ts-author-link:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.ts-author-link--muted {
    color: var(--color-muted);
}

/* =========================================================
   6. NAVIGASI ANTAR BAGIAN
========================================================= */

.ts-pager {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;

    margin-top: 40px;
    padding-top: 24px;

    border-top: 1px solid var(--color-border);
}

.ts-pager-link {
    display: flex;
    flex-direction: column;
    gap: 6px;

    padding: 16px 18px;

    border: 1px solid var(--color-border);
    border-radius: 14px;
    background: var(--surface);

    text-decoration: none;

    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ts-pager-link:hover {
    border-color: var(--color-primary);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.ts-pager-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;

    color: var(--color-muted);
}

.ts-pager-link--next {
    text-align: right;
    align-items: flex-end;
}

.ts-pager-title {
    font-size: 14px;
    line-height: 1.45;
    font-weight: 650;
    color: var(--color-ink);

    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ts-pager-link:hover .ts-pager-title {
    color: var(--color-primary);
}

/* Item tunggal (mis. bagian pertama/terakhir) memenuhi lebar */
.ts-pager-link:only-child {
    grid-column: 1 / -1;
}

/* =========================================================
   7. RESPONSIF
========================================================= */

@media (max-width: 1024px) {

    .ts-shell {
        padding: 0 22px;
    }

    .ts-hero--logo .ts-hero-grid {
        grid-template-columns: minmax(0, 1fr) 168px;
        gap: 24px;
    }

    .ts-hero-logo {
        width: 168px;
        height: 168px;
        padding: 18px;
    }

    .ts-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }

    .ts-rail-wrap {
        position: static;

        /* di layar kecil kolom kiri tidak sticky, jadi batas tinggi & scroll dimatikan */
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .ts-toc-rail {
        margin-top: 14px;
    }

    .ts-rail-summary {
        display: flex;
        align-items: center;
        gap: 10px;

        padding: 14px 16px;

        cursor: pointer;
        list-style: none;

        font-size: 14px;
        font-weight: 650;
        color: var(--color-ink);
    }

    .ts-rail-summary::-webkit-details-marker {
        display: none;
    }

    .ts-rail-summary-text {
        display: inline-flex;
        align-items: center;
        gap: 8px;

        min-width: 0;

        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ts-rail-summary-text i {
        color: var(--color-primary);
        font-size: 12px;
    }

    .ts-rail-summary-count {
        margin-left: auto;

        padding: 2px 8px;

        border-radius: 999px;
        background: var(--bg-1);

        font-family: var(--font-mono);
        font-size: 11px;
        color: var(--color-muted);
    }

    .ts-rail-summary-caret {
        font-size: 12px;
        color: var(--color-muted);
        transition: transform 0.2s ease;
    }

    .ts-rail[open] .ts-rail-summary-caret {
        transform: rotate(180deg);
    }

    .ts-rail-panel {
        padding: 4px 16px 16px;

        border-top: 1px solid transparent;
    }

    .ts-rail[open] .ts-rail-panel {
        border-top-color: var(--color-border);
    }

    .ts-list {
        max-height: none;
    }

    .ts-main {
        max-width: none;
    }

    .ts-shell {
        padding: 0 16px;
    }

    .ts-article {
        padding: 18px 16px 20px;
        border-radius: 14px;
    }

    .ts-article .singlepost-toc-toggle {
        padding: 10px 0;
    }

    .ts-author {
        flex-direction: column;
        gap: 14px;

        margin-top: 28px;
        padding: 18px 18px 20px;
    }

    .ts-author-img {
        width: 64px;
        height: 64px;
    }

    /* ikon sosial & tombol penulis lebih nyaman disentuh */
    .ts-author-social-link {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .ts-author-link {
        min-height: 40px;
        padding: 10px 14px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {

    .ts-hero {
        padding: 22px 0 26px;
    }

    /* mobile: logo kecil di bawah teks, rata kanan */
    .ts-hero--logo .ts-hero-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .ts-hero-logo {
        justify-self: end;

        width: 96px;
        height: 96px;
        padding: 12px;

        border-radius: 16px;
    }

    .ts-title {
        font-size: 24px;
    }

    .ts-body {
        padding: 24px 0 52px;
    }

    .ts-pager {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
        margin-top: 30px;
    }

    .ts-pager-link--next {
        text-align: left;
        align-items: flex-start;
    }

    .ts-item a {
        font-size: 13.5px;
        padding: 9px 10px;
    }
}

/* =========================================================
   8. STATE MUAT (navigasi antar bagian)
========================================================= */

#ts-swap.is-loading {
    opacity: 0.45;
    transition: opacity 0.18s ease;
    pointer-events: none;
}

/* =========================================================
   9. PREFERENSI GERAK
========================================================= */

@media (prefers-reduced-motion: reduce) {

    .ts-crumb a,
    .ts-item a,
    .ts-rail-cta,
    .ts-pager-link,
    .ts-rail-summary-caret {
        transition: none;
    }
}