/* Kodename JPG — tema profesional.
   Sistem desain: Swiss Modernism 2.0 (grid, tipografi editorial,
   spasi matematis) dengan aksen ungu-indigo turunan warna brand lama.
   Mode siang/malam lewat variabel: :root = siang,
   [data-theme="dark"] = malam. Pilihan tema disimpan di localStorage
   (lihat js/theme.js) dan mengikuti preferensi sistem kalau belum
   pernah dipilih. Mobile-first: gaya dasar untuk HP, lalu
   @media (min-width: 769px) untuk desktop. */

:root {
    --bg: #fafafa;
    --surface: #ffffff;
    --surface-2: #f4f4f5;
    --ink: #18181b;
    --ink-2: #3f3f46;
    --muted: #52525b;
    --border: #e4e4e7;
    --accent: #4f46c8;
    --accent-strong: #3e38a8;
    --accent-soft: #eeedfb;
    --btn-bg: #4f46c8;
    --btn-bg-hover: #3e38a8;
    --on-accent: #ffffff;
    --code-bg: #18181b;
    --code-ink: #f4f4f5;
    --success: #15803d;
    --success-soft: #f0fdf4;
    --warning: #b45309;
    --warning-soft: #fffbeb;
    --shadow: 0 1px 2px rgba(16, 16, 27, .06), 0 8px 24px rgba(16, 16, 27, .06);
    --font-display: "Libre Bodoni", Georgia, "Times New Roman", serif;
    --font-sans: "Public Sans", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
    --bg: #0f1014;
    --surface: #17181d;
    --surface-2: #1f2027;
    --ink: #f4f4f5;
    --ink-2: #d4d4d8;
    --muted: #a1a1aa;
    --border: #27272a;
    --accent: #8b86f0;
    --accent-strong: #a5a1f5;
    --accent-soft: #232344;
    --btn-bg: #5b54d6;
    --btn-bg-hover: #4f46c8;
    --code-bg: #0a0a0c;
    --code-ink: #f4f4f5;
    --success: #4ade80;
    --success-soft: rgba(34, 197, 94, .12);
    --warning: #fbbf24;
    --warning-soft: rgba(245, 158, 11, .12);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.65;
    transition: background-color .3s ease, color .3s ease;
}

body > .container {
    flex: 1 0 auto;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

::selection {
    background: var(--accent-soft);
}

.wrap,
.container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- Topbar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    transition: background-color .3s ease, border-color .3s ease;
}

@supports (backdrop-filter: blur(8px)) {
    .topbar {
        background: color-mix(in srgb, var(--bg) 85%, transparent);
        backdrop-filter: blur(8px);
    }
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 64px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: .01em;
    white-space: nowrap;
}

.brand:hover {
    text-decoration: none;
    color: var(--accent);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
}

.brand-mark svg {
    width: 22px;
    height: 22px;
}

.mainnav {
    margin-left: auto;
    position: relative;
}

.nav-links {
    display: none;
    gap: 4px;
}

.nav-links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--ink-2);
    font-weight: 600;
    font-size: 15px;
}

.nav-links a:hover {
    background: var(--surface-2);
    color: var(--ink);
    text-decoration: none;
}

.nav-links a.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.menu-btn:hover {
    border-color: var(--accent);
}

.menu-btn svg {
    width: 18px;
    height: 18px;
}

/* Dropdown menu HP: hanya berlaku di layar kecil, supaya menu yang
   sempat dibuka di HP tidak berubah jadi dropdown melayang di desktop */
@media (max-width: 768px) {
    .nav-links.show {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        min-width: 220px;
        padding: 8px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 14px;
        box-shadow: var(--shadow);
        z-index: 60;
    }
}

/* Topbar layar kecil (HP): beri ruang untuk switcher bahasa ID/EN.
   Tanpa ini, baris topbar butuh ~444px di viewport 390px sehingga switcher
   terdorong keluar layar (terjepit di tepi kanan). Solusi: sembunyikan teks
   brand (logo tetap ada), rapatkan gap + padding topbar, dan larang
   switcher/menu mengecil. Tetap satu baris, konsisten di semua halaman. */
@media (max-width: 480px) {
    .topbar-inner {
        gap: 10px;
        padding: 0 16px;
    }
    .brand-name {
        display: none;
    }
    .menu-btn,
    .lang-switch {
        flex-shrink: 0;
    }
    .lang-switch {
        padding: 8px 2px;
    }
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

[data-theme="light"] .icon-sun {
    display: none;
}

[data-theme="dark"] .icon-moon {
    display: none;
}

/* ---------- Hero (beranda) ---------- */

.hero {
    padding: 64px 0 48px;
}

.hero-kicker,
.section-kicker,
.page-kicker {
    display: block;
    margin-bottom: 10px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.hero h1 {
    max-width: 760px;
    font-family: var(--font-display);
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.01em;
}

.hero-lead {
    max-width: 640px;
    margin-top: 16px;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.6;
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 22px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--btn-bg);
    color: var(--on-accent);
}

.btn-primary:hover {
    background: var(--btn-bg-hover);
}

.btn-ghost {
    background: var(--surface);
    border-color: var(--border);
    color: var(--ink);
}

.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.support-box {
    margin: 32px 0 24px;
    padding: 24px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
}

.support-box p {
    margin: 0 0 16px;
}

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    margin-top: 40px;
}

.stat b {
    display: block;
    font-family: var(--font-display);
    font-size: 28px;
    line-height: 1.2;
}

.stat span {
    color: var(--muted);
    font-size: 13px;
}

/* ---------- Seksi & kartu ---------- */

.section {
    padding: 24px 0 8px;
}

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 20px;
}

.section-head h2,
.page-head h1 {
    font-family: var(--font-display);
    font-size: clamp(26px, 4vw, 32px);
    font-weight: 700;
    line-height: 1.2;
}

.section-head a {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.card-eyebrow {
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.card h3 {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.3;
}

.card h3 a {
    color: var(--ink);
}

.card h3 a:hover {
    color: var(--accent);
    text-decoration: none;
}

/* Penyeimbang SEO: judul kartu memakai h2 (hierarki heading), tampilannya
   disamakan dengan h3 supaya desain kartu tidak berubah. */
.card h2 {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.3;
}

.card h2 a {
    color: var(--ink);
}

.card h2 a:hover {
    color: var(--accent);
    text-decoration: none;
}

.card > p {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.6;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    padding-top: 6px;
}

.card-link {
    font-size: 14px;
    font-weight: 700;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.badge.beginner {
    background: var(--success-soft);
    color: var(--success);
}

.badge.intermediate {
    background: var(--warning-soft);
    color: var(--warning);
}

/* ---------- Topik & strip tentang ---------- */

.topic-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.topic {
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.topic h3 {
    font-family: var(--font-display);
    font-size: 19px;
}

.topic p {
    margin-top: 6px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

a.topic {
    display: block;
    color: inherit;
    text-decoration: none;
}

a.topic:hover {
    border-color: var(--accent);
}

.archive-year {
    scroll-margin-top: 84px;
}

.about-strip {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 40px 0;
    padding: 32px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
}

.about-strip h2 {
    font-family: var(--font-display);
    font-size: 26px;
    line-height: 1.25;
}

.about-strip p {
    margin-top: 8px;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.65;
}

.about-strip .btn {
    flex: 0 0 auto;
    align-self: flex-start;
}

/* ---------- Kepala halaman (Tutorial / Arsip / Tentang) ---------- */

.page-head {
    padding: 48px 0 8px;
}

.page-head p {
    max-width: 640px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.6;
}

/* ---------- Arsip ---------- */

.archive-year {
    margin: 28px 0 4px;
    font-family: var(--font-display);
    font-size: 24px;
}

.archive-rows {
    border-top: 1px solid var(--border);
}

.archive-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 16px;
    align-items: start;
    padding: 18px 4px;
    border-bottom: 1px solid var(--border);
}

.archive-row h3 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
}

.archive-row h3 a {
    color: var(--ink);
}

.archive-row h3 a:hover {
    color: var(--accent);
    text-decoration: none;
}

.archive-row p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.archive-date {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

/* ---------- Artikel ---------- */

.page {
    padding-bottom: 16px;
}

.content-box {
    margin: 32px 0 48px;
    padding: 32px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: background-color .3s ease, border-color .3s ease;
}

/* Penyeimbang SEO: judul seksi artikel memakai h2 (hierarki heading),
   tampilannya disamakan dengan h3 supaya desain artikel tidak berubah. */
.content-box h2 {
    margin: 28px 0 10px;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
}

.content-box h3 {
    margin: 28px 0 10px;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
}

.content-box p {
    margin: 0 0 14px;
}

.content-box ul,
.content-box ol {
    margin: 0 0 14px 24px;
}

.content-box ul li {
    list-style: disc;
    margin-bottom: 4px;
}

.content-box ol li {
    list-style: decimal;
    margin-bottom: 4px;
    word-break: break-word;
}

.content-box a {
    overflow-wrap: break-word;
}

hr.dashed {
    margin: 20px 0;
    border: none;
    border-top: 1px dashed var(--border);
}

.tutorial-meta {
    margin: 6px 0 4px;
    color: var(--muted);
    font-size: 14px;
}

.c {
    margin: 16px 0;
    padding: 16px 18px;
    overflow-x: auto;
    background: var(--code-bg);
    color: var(--code-ink);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.7;
    text-align: left;
    border-radius: 12px;
    transition: background-color .3s ease, color .3s ease;
}

.c p {
    margin: 0;
}

/* Kode inline di dalam paragraf — JANGAN pakai .c di sini, .c itu
   blok kode (margin + padding besar) dan akan jadi pil hitam raksasa. */
code {
    font-family: var(--font-mono);
    font-size: .88em;
    background: var(--surface-2);
    color: var(--ink);
    padding: 1px 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    white-space: nowrap;
}

.cc {
    text-align: left;
}

p.center {
    text-align: right;
}

/* Gambar tutorial (diagram & screenshot) */
.tutorial-img {
    margin: 16px 0;
    text-align: center;
}

.tutorial-img img {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.img-caption {
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.img,
.img1 {
    width: 100%;
    height: auto;
    margin: 12px 0;
    border: 1px solid var(--border);
    border-radius: 12px;
}

/* Callout tips / peringatan */
.callout {
    margin: 18px 0;
    padding: 14px 16px;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 0 12px 12px 0;
}

.callout.tip {
    background: var(--success-soft);
    border-left-color: var(--success);
}

.callout.warning {
    background: var(--warning-soft);
    border-left-color: var(--warning);
}

/* Daftar artikel (accordion di dalam artikel) */
.accordion {
    width: 100%;
    padding: 12px 0;
    background: none;
    color: var(--ink);
    border: none;
    border-top: 1px dashed var(--border);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.accordion::after {
    content: "+";
    float: right;
    font-weight: 700;
    color: var(--accent);
}

.accordion.active::after {
    content: "−";
}

.panel {
    display: none;
    overflow: hidden;
}

.panel.show {
    display: block;
    margin-top: 8px;
    padding: 14px;
    border: 1px dashed var(--border);
    border-radius: 12px;
}

/* Daftar arsip di dalam panel artikel */
.archive-list {
    margin: 0;
}

.archive-list li {
    list-style: none;
    margin-bottom: 10px;
}

.archive-list .archive-date {
    margin-left: 6px;
}

.archive-desc {
    margin-top: 2px;
    color: var(--muted);
    font-size: 13px;
}

/* Navigasi artikel sebelumnya/berikutnya */
.article-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.article-nav a {
    font-weight: 700;
    font-size: 15px;
}

/* ---------- Footer ---------- */

.site-footer {
    margin-top: 64px;
    background: #141419;
    color: #d4d4d8;
}

[data-theme="dark"] .site-footer {
    background: #0b0b0e;
    border-top: 1px solid var(--border);
}

.footer-inner {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-top: 48px;
    padding-bottom: 32px;
}

.footer-name {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
}

.footer-tag {
    max-width: 420px;
    margin-top: 8px;
    color: #a1a1aa;
    font-size: 14px;
    line-height: 1.6;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
}

.footer-nav a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    color: #d4d4d8;
    font-size: 15px;
    font-weight: 600;
}

.footer-nav a:hover {
    color: #ffffff;
    text-decoration: none;
}

.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 16px;
    padding-top: 18px;
    padding-bottom: 18px;
    border-top: 1px solid rgba(255, 255, 255, .12);
    color: #a1a1aa;
    font-size: 13px;
}

/* ---------- Desktop ---------- */

@media (min-width: 769px) {
    .menu-btn {
        display: none;
    }

    .nav-links {
        display: flex;
        position: static;
        background: transparent;
        box-shadow: none;
    }

    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .topic-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .content-box {
        padding: 40px;
    }

    .content-box h2 {
        font-size: 22px;
    }

    .about-strip {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .footer-inner {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
    }

    .archive-row {
        grid-template-columns: 130px 1fr auto;
        align-items: baseline;
    }
}

@media (min-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero {
        padding: 80px 0 56px;
    }
}

/* ---------- Gerakan ---------- */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}

/* ---------- Language switcher (pola bilingual: BILINGUAL-PATTERN.md) ---------- */

.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.lang-switch a {
    color: var(--ink);
    text-decoration: none;
}

.lang-switch a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.lang-switch .lang-active {
    opacity: .5;
}

.lang-switch .lang-sep {
    opacity: .35;
}
