/* =========================================================================
   DevVN Docs — hệ thống giao diện cho trang tài liệu hướng dẫn plugin.
   Thuần CSS, không framework. Mọi giá trị đổi theo brand đều nằm ở :root.
   ========================================================================= */

:root {
    /* Màu nền & chữ */
    --bg: #fbfaf8;
    --bg-soft: #f4f2ee;
    --surface: #ffffff;
    --ink: #16181d;
    --ink-2: #4a5160;
    --ink-3: #7b8291;
    --line: #e7e3dc;
    --line-2: #f1eee9;

    /* Màu nhấn của trang: điều hướng, liên kết, nút */
    --accent: #6d43d9;
    --accent-ink: #ffffff;
    --accent-soft: #f2edfe;
    --accent-line: #ddd0fb;

    /* Màu chấm số — PHẢI trùng màu chấm vẽ trong ảnh chụp (capture.mjs) */
    --mark: #dc2626;
    --mark-ink: #ffffff;
    --mark-soft: #fdedec;
    --mark-line: #f6c9c5;

    /* Màu khối nhấn mạnh */
    --ok: #0f7b46;
    --ok-bg: #eaf8f1;
    --ok-line: #bfe6d2;
    --warn: #96570a;
    --warn-bg: #fff6e5;
    --warn-line: #f2dcae;
    --danger: #ab2a1e;
    --danger-bg: #fdeeeb;
    --danger-line: #f4c8c0;

    /* Khối mã — nền tối ở cả hai giao diện để mã luôn nổi bật khỏi bài viết */
    --code-bg: #1b1e26;
    --code-bar: #23262f;
    --code-line: #2f333e;
    --code-ink: #e6e8ee;
    --code-ink-2: #aab1c0;
    --code-ink-3: #79818f;

    /* Hình khối */
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(20, 22, 28, .06);
    --shadow: 0 4px 16px rgba(20, 22, 28, .08);
    --shadow-lg: 0 18px 50px rgba(20, 22, 28, .22);

    /* Bố cục */
    --header-h: 60px;
    --sidebar-w: 268px;
    --toc-w: 224px;
    --wrap: 1440px;
    --gutter: 28px;

    --font: 'Be Vietnam Pro', 'Segoe UI', Roboto, Arial, sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0f1115;
    --bg-soft: #171a21;
    --surface: #161920;
    --ink: #e9eaee;
    --ink-2: #a9b0be;
    --ink-3: #79808f;
    --line: #272b35;
    --line-2: #1e222a;

    --accent: #a58cff;
    --accent-ink: #17121f;
    --accent-soft: #221c37;
    --accent-line: #3a2f5e;

    /* Ảnh chụp không đổi theo giao diện tối, nên chấm số giữ sắc đỏ tương đương. */
    --mark: #e5484d;
    --mark-ink: #ffffff;
    --mark-soft: #2b1614;
    --mark-line: #5a2b28;

    --ok: #56d09a;
    --ok-bg: #12241c;
    --ok-line: #1f4534;
    --warn: #e5b567;
    --warn-bg: #241d10;
    --warn-line: #4a3a1b;
    --danger: #f08b7d;
    --danger-bg: #261614;
    --danger-line: #4d2a25;

    --code-bg: #0c0e13;
    --code-bar: #14171e;
    --code-line: #262a33;
    --code-ink: #dfe2e9;
    --code-ink-2: #a0a8b6;
    --code-ink-3: #6f7786;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 4px 18px rgba(0, 0, 0, .45);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, .7);

    color-scheme: dark;
}

/* ---------------------------------------------------------------- Reset */

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

code, kbd, pre { font-family: var(--mono); }

code {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: .08em .38em;
    font-size: .875em;
    word-break: break-word;
}

kbd {
    background: var(--surface);
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 5px;
    padding: .1em .45em;
    font-size: .82em;
    box-shadow: var(--shadow-sm);
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--accent);
    color: var(--accent-ink);
    padding: 10px 16px;
    z-index: 200;
    border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* --------------------------------------------------------------- Header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 60;
    height: var(--header-h);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--line);
}

.site-header__in {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 var(--gutter);
    height: 100%;
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    color: var(--ink);
    letter-spacing: -.01em;
    flex: none;
}
.brand:hover { text-decoration: none; }

.brand__sub {
    font-weight: 500;
    color: var(--ink-3);
    border-left: 1px solid var(--line);
    padding-left: 10px;
    margin-left: 2px;
    font-size: 14px;
}

.header-spacer { flex: 1; }

/* Ô tìm kiếm */

.search {
    position: relative;
    width: min(380px, 42vw);
    flex: none;
}

.search__input {
    width: 100%;
    height: 38px;
    padding: 0 34px 0 36px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 14.5px;
}
.search__input::placeholder { color: var(--ink-3); }
.search__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.search__icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-3);
    pointer-events: none;
}

.search__hint {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: var(--ink-3);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1px 5px;
    pointer-events: none;
    font-family: var(--mono);
}

.search__results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 6px;
    max-height: 60vh;
    overflow: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.search__results.show { opacity: 1; visibility: visible; transform: none; }

.search__item { display: block; padding: 9px 11px; border-radius: 7px; color: var(--ink); }
.search__item:hover,
.search__item.is-active { background: var(--accent-soft); text-decoration: none; }
.search__item b { display: block; font-size: 14.5px; font-weight: 600; }
.search__item b { display: flex; align-items: center; gap: 7px; }
.search__tag { flex: none; font-style: normal; font-size: 10.5px; font-weight: 600;
    letter-spacing: .02em; padding: 2px 7px; border-radius: 20px;
    background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); }
.search__item span { display: block; font-size: 12.5px; color: var(--ink-3); }
.search__empty { padding: 14px 12px; color: var(--ink-3); font-size: 14px; }

/* Nút biểu tượng trên header */

.icon-btn {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: var(--surface);
    cursor: pointer;
    flex: none;
    transition: border-color .15s ease, background .15s ease;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

.icon-btn__moon { display: none; }
:root[data-theme="dark"] .icon-btn__sun { display: none; }
:root[data-theme="dark"] .icon-btn__moon { display: block; }

.nav-toggle { display: none; }

/* --------------------------------------------------------------- Layout */

.layout {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 var(--gutter);
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
    gap: 44px;
    align-items: start;
}

/* -------------------------------------------------------------- Sidebar */

.sidebar {
    position: sticky;
    top: var(--header-h);
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    padding: 30px 8px 60px 0;
    font-size: 14.5px;
}

.sidebar__product {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    margin-bottom: 22px;
}
.sidebar__product:hover { text-decoration: none; border-color: var(--accent); }
.sidebar__product img,
.sidebar__product .sidebar__ico {
    width: 32px; height: 32px; border-radius: 8px; flex: none;
    background: var(--accent-soft); color: var(--accent);
    display: grid; place-items: center;
}
.sidebar__product b { display: block; color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.35; }
.sidebar__product span { display: block; color: var(--ink-3); font-size: 12px; }

.sidebar__group { margin-bottom: 22px; }

.sidebar__title {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 600;
    color: var(--ink-3);
    margin: 0 0 8px 12px;
    font-family: var(--mono);
}

.sidebar__list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    margin-left: -1px;
    border-left: 2px solid transparent;
    color: var(--ink-2);
    line-height: 1.45;
}
.sidebar__link:hover { color: var(--ink); text-decoration: none; border-left-color: var(--line); }
.sidebar__link.is-active {
    color: var(--accent);
    font-weight: 600;
    border-left-color: var(--accent);
    background: linear-gradient(90deg, var(--accent-soft), transparent);
}

.sidebar__num {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-3);
    width: 16px;
    flex: none;
}
.sidebar__link.is-active .sidebar__num { color: var(--accent); }

.sidebar__link .done { color: var(--ok); flex: none; margin-left: auto; }

/* Bài chưa viết xong — hiện để người đọc biết còn gì sắp có, nhưng không bấm được. */
.sidebar__soon {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-left: 2px solid transparent;
    margin-left: -1px;
    color: var(--ink-3);
    opacity: .65;
    cursor: default;
    line-height: 1.45;
}
.sidebar__soon em { font-style: normal; font-size: 10.5px; margin-left: auto; font-family: var(--mono); text-transform: uppercase; letter-spacing: .05em; }

/* ------------------------------------------------------------- Nội dung */

.content { padding: 30px 0 80px; min-width: 0; }

.crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 13px;
    color: var(--ink-3);
    margin-bottom: 14px;
}
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--accent); }
.crumbs span[aria-hidden] { opacity: .5; }

.page-title {
    font-size: clamp(28px, 3.4vw, 38px);
    line-height: 1.2;
    letter-spacing: -.02em;
    font-weight: 700;
    margin: 0 0 12px;
}

.page-lead {
    font-size: 17.5px;
    color: var(--ink-2);
    margin: 0 0 18px;
    max-width: 62ch;
}

.page-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    font-size: 13px;
    color: var(--ink-3);
    padding-bottom: 22px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--line);
}
.page-meta__item { display: inline-flex; align-items: center; gap: 6px; }

.prose { max-width: 74ch; }

.prose h2 {
    font-size: 24px;
    line-height: 1.3;
    letter-spacing: -.015em;
    font-weight: 700;
    margin: 52px 0 14px;
    scroll-margin-top: calc(var(--header-h) + 20px);
}
.prose h2:first-child { margin-top: 0; }

.prose h3 {
    font-size: 18.5px;
    line-height: 1.4;
    font-weight: 600;
    margin: 34px 0 10px;
    scroll-margin-top: calc(var(--header-h) + 20px);
}

.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin-bottom: 7px; }
.prose li::marker { color: var(--ink-3); }

.prose hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 20px;
    font-size: 15px;
}
.prose th, .prose td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
.prose th { font-weight: 600; background: var(--bg-soft); font-size: 13.5px; }
.table-wrap { overflow-x: auto; margin-bottom: 20px; }
.table-wrap table { margin-bottom: 0; }

/* --------------------------------------- Ảnh chụp màn hình + danh sách số */

.shot {
    margin: 0 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--bg-soft);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.shot__img { cursor: zoom-in; width: 100%; }

.shot__cap {
    font-size: 13px;
    color: var(--ink-3);
    padding: 9px 14px;
    border-top: 1px solid var(--line);
    background: var(--surface);
}

/* Chấm số trong bài — cùng màu, cùng kiểu với chấm vẽ trong ảnh. */
.steps { list-style: none; margin: 18px 0 26px; padding: 0; counter-reset: devvnstep; }

.steps > li {
    position: relative;
    counter-increment: devvnstep;
    padding-left: 40px;
    margin-bottom: 14px;
}

.steps > li::before {
    content: counter(devvnstep);
    position: absolute;
    left: 0;
    top: 1px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--mark);
    color: var(--mark-ink);
    font-size: 14px;
    font-weight: 700;
    line-height: 26px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.steps b { font-weight: 600; }

/* ------------------------------------------------------------- Khối nhấn */

.callout {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-left-width: 3px;
    border-radius: var(--radius);
    background: var(--surface);
    margin: 22px 0;
    font-size: 15px;
}
.callout p:last-child { margin-bottom: 0; }
.callout__ico { flex: none; margin-top: 2px; }
.callout__body { min-width: 0; }
.callout__title { font-weight: 600; display: block; margin-bottom: 2px; }

.callout--tip { background: var(--ok-bg); border-color: var(--ok-line); border-left-color: var(--ok); }
.callout--tip .callout__ico, .callout--tip .callout__title { color: var(--ok); }

.callout--warn { background: var(--warn-bg); border-color: var(--warn-line); border-left-color: var(--warn); }
.callout--warn .callout__ico, .callout--warn .callout__title { color: var(--warn); }

.callout--danger { background: var(--danger-bg); border-color: var(--danger-line); border-left-color: var(--danger); }
.callout--danger .callout__ico, .callout--danger .callout__title { color: var(--danger); }

/* ------------------------------------------------------------- Khối mã */

.code {
    margin: 0 0 22px;
    border: 1px solid var(--code-line);
    border-radius: var(--radius);
    background: var(--code-bg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.code__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 9px 7px 14px;
    background: var(--code-bar);
    border-bottom: 1px solid var(--code-line);
}

.code__lang {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--code-ink-3);
}

.code__copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    font: 600 12px/1 var(--font);
    color: var(--code-ink-2);
    background: transparent;
    border: 1px solid var(--code-line);
    border-radius: 6px;
    cursor: pointer;
}

.code__copy:hover { color: var(--code-ink); border-color: var(--code-ink-3); }
.code__copy.is-done { color: #86d6a2; border-color: #2f5a41; }
.code__copy svg { flex: none; }

/* Mã dài cuộn ngang trong khối, không đẩy cả trang chạy ngang trên điện thoại. */
.code__body {
    margin: 0;
    padding: 14px 16px;
    overflow-x: auto;
    color: var(--code-ink);
    font-size: 13px;
    line-height: 1.7;
    tab-size: 4;
}

/* Gỡ kiểu của code nội dòng khi nó nằm trong khối mã. */
.code__body code {
    display: block;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font-size: inherit;
    white-space: pre;
    word-break: normal;
}

/* Màu cú pháp — dùng chung bảng màu của trang, không nhập theme của Prism. */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: var(--code-ink-3); font-style: italic; }
.token.punctuation, .token.operator { color: var(--code-ink-2); }
.token.keyword, .token.tag, .token.important { color: #c4a6ff; }
.token.function, .token.class-name { color: #83c9f5; }
.token.string, .token.char, .token.attr-value { color: #8fd6a6; }
.token.number, .token.boolean, .token.constant, .token.symbol { color: #f0b57a; }
.token.variable { color: #7fc8f0; }
.token.property, .token.attr-name { color: #e5b0a8; }
.token.delimiter, .token.php.important { color: #e58a90; }

/* -------------------------------------------------------------- Nhãn nhỏ */

.chip {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 5px;
    border: 1px solid var(--line);
    background: var(--bg-soft);
    color: var(--ink-3);
    vertical-align: middle;
    font-family: var(--mono);
}
.chip--req { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.chip--opt { background: var(--bg-soft); }

/* ------------------------------------------------- Thẻ bước ở trang tổng quan */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
    margin: 22px 0 30px;
}

.card {
    display: block;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--ink);
    transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.card:hover {
    text-decoration: none;
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.card__top { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }

.card__num {
    width: 26px; height: 26px; flex: none;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--accent-line);
    display: grid; place-items: center;
    font-size: 13px; font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.card--soon { opacity: .58; pointer-events: none; }
.card--soon .card__num { background: var(--bg-soft); color: var(--ink-3); border-color: var(--line); }

.card__title { font-weight: 600; font-size: 15.5px; line-height: 1.35; }
.card__desc { color: var(--ink-3); font-size: 14px; line-height: 1.55; margin: 0; }

/* ------------------------------------------------------------------ FAQ */

.faq { border-top: 1px solid var(--line); margin: 22px 0 30px; }

.faq__item { border-bottom: 1px solid var(--line); }

.faq__q {
    width: 100%;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 16px 0;
    background: none;
    border: 0;
    text-align: left;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
}
.faq__q:hover { color: var(--accent); }

.faq__q svg { flex: none; margin-top: 4px; color: var(--ink-3); transition: transform .2s ease; }
.faq__item.is-open .faq__q svg { transform: rotate(90deg); color: var(--accent); }

.faq__a { display: none; padding: 0 0 18px 28px; color: var(--ink-2); font-size: 15.5px; }
.faq__item.is-open .faq__a { display: block; }
.faq__a p:last-child { margin-bottom: 0; }

/* ------------------------------------------------------- Điều hướng bài */

.pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 56px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
}

.pager__link {
    display: block;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--ink);
}
.pager__link:hover { border-color: var(--accent); text-decoration: none; }
.pager__link span { display: block; font-size: 12.5px; color: var(--ink-3); margin-bottom: 3px; }
.pager__link b { font-weight: 600; font-size: 15.5px; }
.pager__link--next { text-align: right; grid-column: 2; }

/* ------------------------------------------------------- Mục lục trong bài */

.toc {
    position: sticky;
    top: var(--header-h);
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    padding: 34px 0 60px;
    font-size: 13.5px;
}

.toc__title {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 600;
    color: var(--ink-3);
    margin: 0 0 10px;
    font-family: var(--mono);
}

.toc__list { list-style: none; margin: 0 0 26px; padding: 0; border-left: 1px solid var(--line); }
.toc__link {
    display: block;
    padding: 4px 12px;
    margin-left: -1px;
    border-left: 2px solid transparent;
    color: var(--ink-3);
    line-height: 1.45;
}
.toc__link:hover { color: var(--ink); text-decoration: none; }
.toc__link.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }
.toc__link--sub { padding-left: 24px; font-size: 13px; }

.support-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    padding: 16px;
    font-size: 13.5px;
}
.support-card b { display: block; font-size: 14.5px; margin-bottom: 4px; }
.support-card p { color: var(--ink-3); margin: 0 0 12px; line-height: 1.5; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 9px;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
    font-size: 14px;
    border: 1px solid transparent;
    cursor: pointer;
}
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.btn--block { width: 100%; }

/* ---------------------------------------------------------- Trang chủ docs */

.hero {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 64px var(--gutter) 20px;
}
.hero h1 {
    font-size: clamp(32px, 4.6vw, 46px);
    line-height: 1.14;
    letter-spacing: -.03em;
    margin: 0 0 14px;
    max-width: 18ch;
}
.hero p { font-size: 18px; color: var(--ink-2); max-width: 60ch; margin: 0 0 24px; }
.hero__stats {
    font-family: var(--mono);
    font-size: 13.5px;
    color: var(--ink-3);
    margin: -12px 0 24px;
}

.home-wrap { max-width: var(--wrap); margin: 0 auto; padding: 20px var(--gutter) 80px; }

.plugin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }

.plugin-card {
    display: flex;
    gap: 14px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--ink);
    transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.plugin-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.plugin-card__ico {
    width: 44px; height: 44px; flex: none; border-radius: 11px;
    background: var(--accent-soft); color: var(--accent);
    display: grid; place-items: center;
}
.plugin-card h3 { margin: 0 0 5px; font-size: 17px; font-weight: 600; line-height: 1.3; }
.plugin-card p { margin: 0 0 10px; color: var(--ink-3); font-size: 14.5px; line-height: 1.55; }
.plugin-card__meta { font-size: 12.5px; color: var(--ink-3); font-family: var(--mono); }


/* Tiêu đề từng nhóm plugin trên trang chủ. */
.group-head { margin: 34px 0 14px; display: flex; flex-direction: column; gap: 4px; }
.group-head:first-of-type { margin-top: 8px; }
.group-head h3 {
    font-size: 16px;
    margin: 0;
    letter-spacing: -.01em;
    display: flex;
    align-items: center;
    gap: 10px;
}
.group-head h3 span {
    font-family: var(--mono);
    font-size: 11.5px;
    font-weight: 500;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    border-radius: 999px;
    padding: 2px 9px;
}
.group-head p { margin: 0; color: var(--ink-3); font-size: 14px; }

.section-head { margin: 46px 0 16px; }
.section-head h2 { font-size: 22px; margin: 0 0 6px; letter-spacing: -.015em; }
.section-head p { margin: 0; color: var(--ink-3); }

/* --------------------------------------------------------------- Footer */

.site-footer {
    border-top: 1px solid var(--line);
    background: var(--bg-soft);
    padding: 42px 0 34px;
    font-size: 14px;
}

.site-footer__in {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 var(--gutter);
    display: flex;
    flex-wrap: wrap;
    gap: 28px 48px;
    justify-content: space-between;
}

.site-footer h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-family: var(--mono); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--ink-2); }
.site-footer a:hover { color: var(--accent); }
.site-footer__brand { max-width: 300px; }
.site-footer__brand p { color: var(--ink-3); margin: 10px 0 0; line-height: 1.6; }

.site-footer__bottom {
    max-width: var(--wrap);
    margin: 30px auto 0;
    padding: 18px var(--gutter) 0;
    border-top: 1px solid var(--line);
    color: var(--ink-3);
    font-size: 13px;
}

/* -------------------------------------------------------- Phóng to ảnh */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 28px;
    background: rgba(12, 13, 17, .82);
    backdrop-filter: blur(0);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .22s ease, visibility .22s, backdrop-filter .22s ease;
}
.lightbox.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    backdrop-filter: blur(7px);
}

.lightbox__img {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    transform: scale(.97) translateY(8px);
    transition: transform .26s cubic-bezier(.22, 1.15, .36, 1);
    background: #fff;
}
.lightbox.show .lightbox__img { transform: none; }

.lightbox__close {
    position: absolute;
    top: 16px;
    right: 18px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.lightbox__close:hover { background: rgba(255, 255, 255, .26); }

/* ---------------------------------------------------------- Nút Zalo nổi */

.floating-zalo {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 70;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 11px 16px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
    font-size: 14.5px;
    box-shadow: var(--shadow);
}
.floating-zalo:hover { text-decoration: none; filter: brightness(1.06); }

/* ----------------------------------------------------------- Responsive */

@media (max-width: 1240px) {
    .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); gap: 36px; }
    .toc { display: none; }
}

@media (max-width: 980px) {
    :root { --gutter: 20px; }

    .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }

    .nav-toggle { display: grid; }

    .sidebar {
        position: fixed;
        top: var(--header-h);
        left: 0;
        bottom: 0;
        width: min(320px, 86vw);
        max-height: none;
        background: var(--surface);
        border-right: 1px solid var(--line);
        padding: 22px 18px 60px;
        transform: translateX(-102%);
        transition: transform .24s cubic-bezier(.22, 1.15, .36, 1);
        z-index: 80;
        box-shadow: var(--shadow);
    }
    .sidebar.is-open { transform: none; }

    .sidebar-backdrop {
        position: fixed;
        inset: var(--header-h) 0 0;
        background: rgba(12, 13, 17, .45);
        z-index: 75;
        opacity: 0;
        visibility: hidden;
        transition: opacity .24s ease, visibility .24s;
    }
    .sidebar-backdrop.show { opacity: 1; visibility: visible; }

    .search { width: auto; flex: 1; }
    .search__hint { display: none; }
    .brand__sub { display: none; }

    .content { padding-top: 22px; }
    .prose { max-width: none; }
}

@media (max-width: 640px) {
    body { font-size: 15.5px; }

    .site-header__in { gap: 10px; }
    .brand { font-size: 15px; }

    .page-lead { font-size: 16.5px; }
    .prose h2 { font-size: 21px; margin-top: 40px; }
    .prose h3 { font-size: 17px; }

    .pager { grid-template-columns: 1fr; }
    .pager__link--next { grid-column: 1; text-align: left; }

    .hero { padding-top: 40px; }
    .cards { grid-template-columns: 1fr; }
    .plugin-grid { grid-template-columns: 1fr; }

    .floating-zalo { right: 14px; bottom: 14px; padding: 11px 14px; }
    .steps > li { padding-left: 34px; }
    .steps > li::before { width: 24px; height: 24px; line-height: 24px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
    }
}

@media print {
    .site-header, .sidebar, .toc, .floating-zalo, .pager, .site-footer { display: none !important; }
    .layout { grid-template-columns: 1fr; }
}
