/* ==========================================================================
   ToolCMB — Main stylesheet
   ==========================================================================
   TABLE OF CONTENTS
   01. Fonts (self-hosted)
   02. Design tokens (light / dark)
   03. Reset & base
   04. Layout helpers
   05. Buttons, chips, pills, tiles
   06. Header & navigation (mega menu, mobile)
   07. Search dialog
   08. Hero & stats
   09. Sections, filters, tools grid
   10. Features, CTA
   11. Posts (cards, lists)
   12. Page hero & breadcrumbs
   13. Article detail (prose, TOC, takeaways, share)
   14. FAQ
   15. Tags, pagination, empty states
   16. Forms & alerts
   17. Footer
   18. Utilities & motion
   19. Responsive
   ========================================================================== */

/* ---------- 01. Fonts ---------------------------------------------------- */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-vietnamese-wght-normal.woff2") format("woff2");
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* ---------- 02. Design tokens ------------------------------------------- */
:root {
    /* Brand palette (from concept) */
    --navy: #0F172A;
    --primary: #06B6D4;
    --primary-dark: #0891B2;
    --primary-light: #22D3EE;

    /* Semantic tokens — light */
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --surface-2: #F1F5F9;
    --text: #0F172A;
    --text-2: #334155;
    --muted: #64748B;
    --border: #E2E8F0;
    --border-strong: #CBD5E1;
    --link: #0891B2;
    --primary-soft: rgba(6, 182, 212, .10);
    --primary-ring: rgba(6, 182, 212, .35);
    --success: #059669;
    --danger: #DC2626;
    --header-bg: rgba(248, 250, 252, .78);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px -8px rgba(15, 23, 42, .10);
    --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, .18);
    --grid-line: rgba(15, 23, 42, .045);

    /* Scale */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --container: 1200px;
    --header-h: 68px;
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    --ease: cubic-bezier(.2, .7, .2, 1);
}

[data-theme="dark"] {
    --bg: #0B1120;
    --surface: #111A2E;
    --surface-2: #16213A;
    --text: #E2E8F0;
    --text-2: #CBD5E1;
    --muted: #94A3B8;
    --border: #1E293B;
    --border-strong: #334155;
    --link: #22D3EE;
    --primary-soft: rgba(34, 211, 238, .12);
    --primary-ring: rgba(34, 211, 238, .35);
    --header-bg: rgba(11, 17, 32, .75);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 3px rgba(0, 0, 0, .35), 0 8px 24px -8px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);
    --grid-line: rgba(148, 163, 184, .06);
    color-scheme: dark;
}

/* ---------- 03. Reset & base -------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background-color .25s var(--ease), color .25s var(--ease);
}
img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .5em; color: var(--text); }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 750; }
h3 { font-size: 1.125rem; font-weight: 650; }
p { margin: 0 0 1rem; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--primary); color: #fff; }
.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: -.2em; }
main:focus { outline: none; }

/* ---------- 04. Layout helpers ------------------------------------------ */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 820px; }
.container-wide { max-width: 1080px; }
.section { padding: 88px 0; }
.section-tight { padding: 40px 0 88px; }
.section-alt { background: var(--surface); border-block: 1px solid var(--border); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 1000; background: var(--primary); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 600; }
.skip-link:focus { top: 12px; }

/* ---------- 05. Buttons, chips, pills, tiles ---------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    height: 46px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
    font-weight: 600; font-size: .95rem; white-space: nowrap; text-decoration: none !important;
    transition: transform .15s var(--ease), background-color .2s, box-shadow .2s, border-color .2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 20px -6px rgba(6, 182, 212, .6); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--link); }
.btn-light { background: #fff; color: var(--navy); }
.btn-light:hover { background: #E0F7FB; }
.btn-block { width: 100%; }

.icon-btn {
    display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
    font-weight: 700; font-size: .9rem; transition: all .2s var(--ease); text-decoration: none !important;
}
.icon-btn:hover { color: var(--link); border-color: var(--primary); }

.chip {
    display: inline-flex; align-items: center; gap: .35rem; padding: 6px 14px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
    font-size: .875rem; font-weight: 500; transition: all .2s var(--ease); text-decoration: none !important;
}
.chip:hover, .chip.is-active { border-color: var(--primary); color: var(--link); background: var(--primary-soft); }

.pill {
    display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
    background: var(--primary-soft); color: var(--link); font-size: .75rem; font-weight: 650;
    letter-spacing: .02em; text-transform: uppercase; text-decoration: none !important;
}
.badge { display: inline-block; padding: 1px 8px; margin-left: 6px; border-radius: 999px; background: linear-gradient(135deg, var(--primary-light), var(--primary-dark)); color: #fff; font-size: .68rem; font-weight: 700; vertical-align: 2px; letter-spacing: .02em; }

.tile {
    display: inline-grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 14px;
    background: var(--primary-soft); color: var(--primary-dark);
    box-shadow: inset 0 0 0 1px rgba(6, 182, 212, .18);
}
[data-theme="dark"] .tile { color: var(--primary-light); }
.tile .icon { width: 24px; height: 24px; }
.tile-sm { width: 36px; height: 36px; border-radius: 10px; }
.tile-sm .icon { width: 18px; height: 18px; }
.tile-lg { width: 56px; height: 56px; border-radius: 16px; }
.tile-lg .icon { width: 28px; height: 28px; }

.link-arrow { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; white-space: nowrap; }
.link-arrow .icon { transition: transform .2s var(--ease); }
.link-arrow:hover .icon { transform: translateX(3px); }

/* ---------- 06. Header & navigation ------------------------------------- */
.site-header {
    position: sticky; top: 0; z-index: 100; height: var(--header-h);
    background: var(--header-bg); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid transparent; transition: border-color .2s, box-shadow .2s;
}
.site-header.is-scrolled { border-bottom-color: var(--border); box-shadow: var(--shadow-sm); }
.header-inner { display: flex; align-items: center; gap: 24px; height: 100%; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; }
.brand img { border-radius: 10px; }
.brand-text { font-size: 1.2rem; font-weight: 700; letter-spacing: -.02em; }
.brand-text strong { color: var(--primary); font-weight: 800; }

.main-nav { margin-right: auto; }
.main-nav > ul { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-link {
    display: inline-flex; align-items: center; gap: 4px; padding: 8px 14px; border-radius: 999px;
    color: var(--text-2); font-weight: 550; font-size: .95rem; text-decoration: none !important; transition: all .2s;
}
.nav-link:hover, .nav-link.is-active { color: var(--text); background: var(--surface-2); }
.nav-link.is-active { color: var(--link); }
.nav-caret { width: 14px; height: 14px; transition: transform .2s; }

.has-mega { position: relative; }
.mega {
    position: absolute; top: calc(100% + 10px); left: -20px; width: 640px; padding: 12px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; transform: translateY(6px); transition: all .2s var(--ease);
}
.mega::before { content: ""; position: absolute; top: -12px; left: 0; right: 0; height: 12px; }
.has-mega:hover .mega, .has-mega:focus-within .mega { opacity: 1; visibility: visible; transform: none; }
.has-mega:hover .nav-caret { transform: rotate(180deg); }
.mega-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; }
.mega-item { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: var(--radius); color: var(--text); text-decoration: none !important; }
.mega-item:hover { background: var(--surface-2); }
.mega-item strong { display: block; font-size: .9rem; font-weight: 600; }
.mega-item small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.4; }
.mega--narrow { width: 320px; }
.mega--narrow .mega-grid { grid-template-columns: 1fr; }
.mega-all { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 8px; padding: 10px; border-radius: var(--radius); background: var(--surface-2); font-weight: 600; font-size: .9rem; }

.header-actions { display: flex; align-items: center; gap: 8px; }
.search-trigger {
    display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 14px; min-width: 210px;
    border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .9rem;
    transition: border-color .2s;
}
.search-trigger:hover { border-color: var(--primary); }
.search-trigger span { flex: 1; text-align: left; }
.search-trigger kbd, .kbd-btn {
    font-family: var(--font); font-size: .7rem; font-weight: 600; padding: 3px 7px; border-radius: 6px;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
}
.nav-toggle { display: none; }
.only-dark, [data-theme="dark"] .only-light { display: none; }
[data-theme="dark"] .only-dark { display: inline-block; }
.when-open, .nav-open .when-closed { display: none; }
.nav-open .when-open { display: inline-block; }

/* ---------- 07. Search dialog ------------------------------------------- */
.search-modal { position: fixed; inset: 0; z-index: 500; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.search-modal[hidden] { display: none; }
.search-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); backdrop-filter: blur(4px); animation: fade .2s; }
.search-panel {
    position: relative; width: 100%; max-width: 640px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .22s var(--ease);
}
.search-field { display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.search-field .icon { color: var(--muted); }
.search-field input { flex: 1; height: 60px; border: 0; background: transparent; outline: none; font-size: 1.05rem; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-results { max-height: 60vh; overflow-y: auto; padding: 8px; }
.search-hint { margin: 0; padding: 24px; text-align: center; color: var(--muted); font-size: .9rem; }
.sr-group { padding: 8px 10px 4px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sr-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius); color: var(--text); text-decoration: none !important; }
.sr-item:hover, .sr-item.is-active { background: var(--primary-soft); }
.sr-item small { display: block; color: var(--muted); font-size: .78rem; }
.sr-item .sr-go { margin-left: auto; color: var(--muted); }
.sr-all { display: block; margin: 6px; padding: 10px; text-align: center; border-radius: var(--radius); background: var(--surface-2); font-weight: 600; font-size: .9rem; }

/* ---------- 08. Hero & stats -------------------------------------------- */
.hero { position: relative; padding: 88px 0 56px; overflow: hidden; isolation: isolate; }
.hero-bg {
    position: absolute; inset: 0; z-index: -1;
    background:
        radial-gradient(600px 300px at 15% 10%, rgba(34, 211, 238, .22), transparent 70%),
        radial-gradient(500px 280px at 85% 20%, rgba(8, 145, 178, .16), transparent 70%),
        linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 44px 44px,
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 44px 44px;
    -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
            mask-image: linear-gradient(to bottom, #000 55%, transparent);
}
.hero-inner { text-align: center; max-width: 860px; }
.hero-badge {
    display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
    font-size: .85rem; font-weight: 550; color: var(--text-2); margin-bottom: 24px;
}
.hero-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #10B981; box-shadow: 0 0 0 4px rgba(16, 185, 129, .18); animation: pulse 2s infinite; }
.hero-title { font-size: clamp(2.2rem, 6vw, 4rem); font-weight: 850; letter-spacing: -.035em; line-height: 1.08; margin-bottom: 20px; }
.gradient-text { display: block; background: linear-gradient(100deg, var(--primary-light), var(--primary-dark) 60%, #6366F1); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { font-size: clamp(1.05rem, 2vw, 1.2rem); color: var(--muted); max-width: 640px; margin: 0 auto 32px; }

.hero-search {
    display: flex; align-items: center; gap: 10px; max-width: 640px; margin: 0 auto; padding: 8px 8px 8px 20px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow);
    transition: border-color .2s, box-shadow .2s;
}
.hero-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring), var(--shadow); }
.hero-search > .icon { color: var(--muted); width: 22px; height: 22px; }
.hero-search input { flex: 1; min-width: 0; height: 46px; border: 0; outline: none; background: transparent; font-size: 1.02rem; }
.hero-chips { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-top: 20px; font-size: .875rem; }

.stats {
    display: grid; grid-template-columns: repeat(4, 1fr); margin: 64px 0 0; padding: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.stat { display: flex; flex-direction: column-reverse; padding: 24px; text-align: center; }
.stat + .stat { border-left: 1px solid var(--border); }
.stat dd { margin: 0; font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; color: var(--text); }
.stat dt { font-size: .85rem; color: var(--muted); }

/* ---------- 09. Sections, filters, tools grid --------------------------- */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.section-head h2 { margin-bottom: .25em; }
.section-head p { margin: 0; }
.section-head--center { flex-direction: column; align-items: center; text-align: center; max-width: 640px; margin-inline: auto; }
.h-sub { font-size: 1.15rem; margin: 32px 0 16px; }

.filter-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 24px; scrollbar-width: none; }
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tab {
    display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 8px 16px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: .9rem; font-weight: 550; transition: all .2s;
}
.filter-tab:hover { border-color: var(--primary); }
.filter-tab.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }
[data-theme="dark"] .filter-tab.is-active { background: var(--primary); border-color: var(--primary); color: var(--navy); }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .72rem; font-weight: 700; }
.is-active .count { background: rgba(255, 255, 255, .18); color: inherit; }

.tools-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tools-grid--list { grid-template-columns: 1fr 1fr; }
.tool-card {
    position: relative; display: flex; align-items: flex-start; gap: 16px; padding: 20px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    color: var(--text); text-decoration: none !important; transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
}
.tool-card:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: var(--shadow); }
.tool-card:hover .tile { background: var(--primary); color: #fff; }
.tool-info { flex: 1; min-width: 0; }
.tool-name { display: block; font-weight: 650; margin-bottom: 2px; }
.tool-desc { display: block; font-size: .875rem; color: var(--muted); line-height: 1.5; }
.tool-arrow { color: var(--muted); opacity: 0; transform: translateX(-6px); transition: all .25s var(--ease); align-self: center; }
.tool-card:hover .tool-arrow { opacity: 1; transform: none; color: var(--link); }
.tool-card.is-hidden { display: none; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 8px; }
.toolbar .filter-tabs { margin: 0; }
.empty-note { text-align: center; color: var(--muted); padding: 32px 0 0; }

/* ---------- 10. Features, CTA ------------------------------------------- */
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.feature { padding: 28px; border-radius: var(--radius-lg); background: var(--bg); border: 1px solid var(--border); transition: transform .25s var(--ease); }
.feature:hover { transform: translateY(-3px); }
.feature h3 { margin: 18px 0 8px; }
.feature p { margin: 0; color: var(--muted); font-size: .95rem; }

.cta {
    position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 32px;
    padding: 48px; border-radius: var(--radius-xl); color: #fff;
    background: radial-gradient(500px 240px at 90% 0%, rgba(34, 211, 238, .35), transparent 70%), linear-gradient(135deg, #0F172A, #13233F);
}
.cta h2 { color: #fff; margin-bottom: .3em; }
.cta p { margin: 0; color: #CBD5E1; }
.cta--soft { margin-top: 48px; background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: 32px; }
.cta--soft h2 { color: var(--text); font-size: 1.35rem; }
.cta--soft p { color: var(--muted); }

/* ---------- 11. Posts ---------------------------------------------------- */
.posts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.post-card {
    display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); transition: transform .25s var(--ease), box-shadow .25s;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.post-thumb { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.post-card:hover .post-thumb img { transform: scale(1.04); }
.thumb-placeholder { display: grid; place-items: center; width: 100%; height: 100%; color: rgba(255, 255, 255, .9); background: linear-gradient(135deg, #22D3EE, #0891B2); }
.thumb-placeholder[data-seed="1"] { background: linear-gradient(135deg, #0F172A, #0891B2); }
.thumb-placeholder[data-seed="2"] { background: linear-gradient(135deg, #6366F1, #06B6D4); }
.thumb-placeholder[data-seed="3"] { background: linear-gradient(135deg, #0891B2, #10B981); }
.thumb-placeholder .icon { width: 44px; height: 44px; stroke-width: 1.5; }
.post-body { display: flex; flex-direction: column; flex: 1; padding: 20px 22px 22px; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: .8rem; color: var(--muted); margin-bottom: 10px; }
.post-title { font-size: 1.12rem; margin-bottom: 8px; }
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--link); text-decoration: none; }
.post-excerpt { color: var(--muted); font-size: .92rem; margin-bottom: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-date { margin-top: auto; font-size: .8rem; color: var(--muted); }

.post-card--featured { flex-direction: row; margin-bottom: 24px; }
.post-card--featured .post-thumb { flex: 1.1; aspect-ratio: auto; min-height: 320px; }
.post-card--featured .post-body { flex: 1; justify-content: center; padding: 40px; }
.post-card--featured .post-title { font-size: clamp(1.4rem, 2.5vw, 1.9rem); }

.post-list { display: grid; gap: 14px; }
.post-card--row { flex-direction: row; align-items: stretch; }
.post-card--row .post-thumb { width: 200px; flex: none; aspect-ratio: 16 / 10; }
.post-card--row .post-body { padding: 16px 20px; }

/* ---------- 12. Page hero & breadcrumbs --------------------------------- */
.page-hero { padding: 48px 0 32px; background: linear-gradient(180deg, var(--primary-soft), transparent); }
.page-hero h1 { margin-bottom: .3em; }
.page-hero .lead { max-width: 680px; }
.page-hero--search { text-align: center; padding-bottom: 8px; }
.page-hero--search .hero-search { margin-top: 20px; }
.result-count { margin-top: 16px; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; font-size: .82rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--link); }
.lead { font-size: 1.15rem; color: var(--muted); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; list-style: none; margin: 0 0 18px; padding: 0; font-size: .85rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; color: var(--border-strong); }
.breadcrumbs a { color: var(--muted); display: inline-flex; }
.breadcrumbs a:hover { color: var(--link); }
.breadcrumbs [aria-current] { color: var(--text-2); max-width: 36ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cat-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 32px; }
.cat-nav--center { justify-content: center; margin: 24px 0 8px; }
.cat-link { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 550; font-size: .9rem; text-decoration: none !important; transition: all .2s; }
.cat-link:hover { border-color: var(--primary); color: var(--link); }
.cat-link.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }
[data-theme="dark"] .cat-link.is-active { background: var(--primary); border-color: var(--primary); color: var(--navy); }

/* ---------- 13. Article detail ------------------------------------------ */
.reading-progress { position: fixed; top: 0; left: 0; z-index: 200; height: 3px; width: 0; background: linear-gradient(90deg, var(--primary-light), var(--primary-dark)); transition: width .1s linear; }
.article-header { padding: 48px 0 32px; text-align: center; }
.article-header .breadcrumbs ol { justify-content: center; }
.article-header h1 { margin: 16px 0 16px; font-size: clamp(2rem, 5vw, 3rem); }
.article-meta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 20px; font-size: .88rem; color: var(--muted); }
.article-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.author-chip img { border-radius: 50%; }
.author-chip span { color: var(--text); font-weight: 600; }
.article-cover { margin: 0 auto 40px; }
.article-cover img { width: 100%; border-radius: var(--radius-xl); box-shadow: var(--shadow); aspect-ratio: 1200 / 630; object-fit: cover; }

.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 56px; padding-bottom: 72px; }
.article-main { min-width: 0; max-width: 740px; }
.sticky { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: 20px; }
.side-title { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.side-card { padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.side-tools { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.side-tools a { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius-sm); color: var(--text); font-weight: 550; font-size: .92rem; }
.side-tools a:hover { background: var(--surface-2); text-decoration: none; }

.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a { display: block; padding: 5px 0 5px 12px; border-left: 2px solid var(--border); color: var(--muted); font-size: .88rem; line-height: 1.45; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.is-active { color: var(--link); border-left-color: var(--primary); font-weight: 600; }
.toc .toc-h3 a { padding-left: 24px; font-size: .84rem; }
.toc-inline { display: none; margin-bottom: 32px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.toc-inline summary { cursor: pointer; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.toc-inline ol { margin-top: 12px; }

.takeaways { margin-bottom: 36px; padding: 24px 28px; border-radius: var(--radius-lg); background: var(--primary-soft); border: 1px solid rgba(6, 182, 212, .25); }
.takeaways h2 { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; margin-bottom: 12px; color: var(--link); }
.takeaways ul { margin: 0; padding-left: 20px; }
.takeaways li { margin-bottom: 6px; color: var(--text-2); }
.takeaways li::marker { color: var(--primary); }

.prose { font-size: 1.075rem; line-height: 1.8; color: var(--text-2); overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { margin-top: 2em; font-size: 1.6rem; color: var(--text); }
.prose h3 { margin-top: 1.6em; font-size: 1.25rem; color: var(--text); }
.prose p { margin: 0; }
.prose a { text-decoration: underline; text-decoration-color: var(--primary-ring); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--primary); }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0; }
.prose li + li { margin-top: .4em; }
.prose li::marker { color: var(--primary); }
.prose blockquote { margin: 1.5em 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--primary); color: var(--text); font-style: italic; }
.prose img { border-radius: var(--radius); margin: 1.5em auto; }
.prose figure { margin: 1.5em 0; }
.prose figcaption { text-align: center; font-size: .88rem; color: var(--muted); margin-top: 8px; }
.prose code { font-family: var(--mono); font-size: .88em; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); color: var(--text); }
.prose pre { padding: 20px; border-radius: var(--radius); background: #0F172A; color: #E2E8F0; overflow-x: auto; font-size: .9rem; line-height: 1.6; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose table { width: 100%; border-collapse: collapse; font-size: .95rem; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; }
.prose th { background: var(--surface-2); color: var(--text); font-weight: 650; }
.prose kbd { font-family: var(--mono); font-size: .85em; padding: 2px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); }
.prose iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; border-radius: var(--radius); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5em 0; }

.article-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 40px; color: var(--muted); }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 24px; padding: 20px 0; border-block: 1px solid var(--border); }
.share > span { margin-right: auto; font-weight: 600; }
.author-box { display: flex; gap: 16px; align-items: flex-start; margin-top: 32px; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.author-box img { border-radius: 16px; }
.author-box p { margin: 0; }
.author-name { margin-bottom: 4px !important; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 32px; }
.post-nav-link { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); font-weight: 600; transition: border-color .2s; }
.post-nav-link:hover { border-color: var(--primary); text-decoration: none; }
.post-nav-link small { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 500; }
.post-nav-next { text-align: right; align-items: flex-end; }

.ad-slot { margin: 32px 0; text-align: center; }
.ad-label { display: block; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }

/* ---------- 14. FAQ ----------------------------------------------------- */
.faq-wrap { display: grid; grid-template-columns: 1fr 1.6fr; gap: 56px; align-items: start; }
.faq-intro { position: sticky; top: calc(var(--header-h) + 24px); }
.faq-list { display: grid; gap: 12px; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); transition: border-color .2s, box-shadow .2s; }
.section-alt .faq-item { background: var(--bg); }
.faq-item[open] { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.faq-item summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; cursor: pointer; font-weight: 600; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .icon { color: var(--primary); transition: transform .25s var(--ease); }
.faq-item[open] summary .icon { transform: rotate(45deg); }
.faq-answer { padding: 0 22px 20px; font-size: .98rem; }
.faq-group { margin-top: 16px; }
.faq-item.is-hidden, .faq-group.is-hidden { display: none; }

/* ---------- 15. Tags, pagination, empty states -------------------------- */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 12px; }
.tag-item {
    display: inline-flex; align-items: center; gap: 10px; padding: 10px 18px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 600;
    font-size: calc(.9rem * var(--w, 1)); transition: all .2s; text-decoration: none !important;
}
.tag-item:hover { border-color: var(--primary); color: var(--link); transform: translateY(-2px); }
.tag-cloud--small { margin-top: 48px; gap: 8px; align-items: center; }
.tag-cloud--small .side-title { width: 100%; margin: 0; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 48px; }
.page-link { display: inline-grid; place-items: center; min-width: 42px; height: 42px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none !important; }
.page-link:hover { border-color: var(--primary); color: var(--link); }
.page-link.is-current { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-gap { color: var(--muted); padding: 0 4px; }

.empty-state { text-align: center; padding: 64px 16px; }
.empty-state > .icon { width: 48px; height: 48px; margin: 0 auto 16px; color: var(--primary); stroke-width: 1.5; }
.error-page { text-align: center; }
.error-code { font-size: clamp(5rem, 16vw, 9rem); font-weight: 900; line-height: 1; margin: 0; letter-spacing: -.05em; background: linear-gradient(135deg, var(--primary-light), var(--primary-dark)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-page .hero-search { margin: 32px auto; }
.updated-note { display: flex; align-items: center; gap: 6px; margin-top: 48px; }

/* ---------- 16. Forms & alerts ------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-sm); }
.form { display: grid; gap: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field input, .field textarea, .field select, .input-icon input {
    width: 100%; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--bg); transition: border-color .2s, box-shadow .2s; outline: none;
}
.field input:focus, .field textarea:focus, .input-icon input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
.field [aria-invalid="true"] { border-color: var(--danger); }
.field-error { margin: 6px 0 0; color: var(--danger); font-size: .85rem; }
.input-icon { position: relative; display: block; flex: 1; min-width: 220px; max-width: 360px; }
.input-icon .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon input { padding-left: 42px; border-radius: 999px; background: var(--surface); }
.input-lg { max-width: none; }
.input-lg input { height: 54px; font-size: 1.05rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.alert { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: var(--radius); font-weight: 550; }
.alert-success { background: rgba(5, 150, 105, .1); color: var(--success); }
.alert-error { background: rgba(220, 38, 38, .1); color: var(--danger); }
.contact-grid { display: grid; grid-template-columns: 1fr 1.7fr; gap: 32px; align-items: start; }
.contact-info { display: grid; gap: 16px; }
.contact-info h2 { font-size: 1.05rem; margin: 14px 0 4px; }
.contact-info p { margin: 0; color: var(--muted); }

/* ---------- 17. Footer -------------------------------------------------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding-top: 64px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 40px; }
.footer-about p { color: var(--muted); font-size: .92rem; margin-top: 16px; max-width: 340px; }
.footer-badges { display: flex; gap: 16px; font-weight: 600; color: var(--text-2) !important; }
.footer-badges span { display: inline-flex; align-items: center; gap: 6px; }
.footer-badges .icon { color: var(--primary); }
.footer-title { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 16px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.site-footer nav a { color: var(--text-2); font-size: .93rem; }
.site-footer nav a:hover { color: var(--link); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 48px; padding: 24px; border-top: 1px solid var(--border); font-size: .875rem; }
.footer-bottom p { margin: 0; }

/* ---------- 18. Utilities & motion -------------------------------------- */
.to-top {
    position: fixed; right: 20px; bottom: 20px; z-index: 90; display: grid; place-items: center; width: 46px; height: 46px;
    border-radius: 50%; border: 0; background: var(--primary); color: #fff; box-shadow: var(--shadow);
    opacity: 0; visibility: hidden; transform: translateY(10px); transition: all .25s var(--ease);
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.toast {
    position: fixed; left: 50%; bottom: 24px; z-index: 600; transform: translateX(-50%); padding: 12px 20px;
    background: var(--navy); color: #fff; border-radius: 999px; font-weight: 600; font-size: .9rem; box-shadow: var(--shadow-lg); animation: pop .2s var(--ease);
}
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
    .reveal { opacity: 1; transform: none; }
}

/* ---------- 19. Responsive ---------------------------------------------- */
@media (max-width: 1100px) {
    .features { grid-template-columns: repeat(2, 1fr); }
    .article-layout { grid-template-columns: 1fr; }
    .article-main { margin: 0 auto; }
    .article-sidebar { display: none; }
    .toc-inline { display: block; }
    .search-trigger { min-width: 0; }
    .search-trigger span, .search-trigger kbd { display: none; }
    .search-trigger { width: 40px; padding: 0; justify-content: center; }
}

@media (max-width: 900px) {
    :root { --header-h: 62px; }
    .nav-toggle { display: inline-grid; }
    .main-nav {
        position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0; margin: 0; padding: 16px 20px 40px;
        background: var(--bg); overflow-y: auto; opacity: 0; visibility: hidden; transform: translateY(-8px); transition: all .25s var(--ease);
    }
    .nav-open .main-nav { opacity: 1; visibility: visible; transform: none; }
    .main-nav > ul { flex-direction: column; align-items: stretch; gap: 2px; }
    .nav-link { padding: 14px 12px; font-size: 1.05rem; border-radius: var(--radius); justify-content: space-between; }
    .mega, .mega--narrow { position: static; width: auto; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; padding: 0 0 8px; background: transparent; }
    .mega-grid { grid-template-columns: 1fr; }
    .mega-item small, .mega-all { display: none; }
    .nav-caret { display: none; }
    body.nav-open { overflow: hidden; }

    .tools-grid, .posts-grid { grid-template-columns: repeat(2, 1fr); }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .stat:nth-child(3) { border-left: 0; }
    .stat:nth-child(n+3) { border-top: 1px solid var(--border); }
    .faq-wrap, .contact-grid { grid-template-columns: 1fr; gap: 32px; }
    .faq-intro { position: static; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .footer-about { grid-column: 1 / -1; }
    .post-card--featured { flex-direction: column; }
    .post-card--featured .post-thumb { min-height: 0; aspect-ratio: 16 / 9; }
    .post-card--featured .post-body { padding: 24px; }
    .section { padding: 64px 0; }
    .cta { flex-direction: column; align-items: flex-start; padding: 36px 28px; }
}

@media (max-width: 600px) {
    .container { padding: 0 16px; }
    .hero { padding: 56px 0 40px; }
    .hero-search { padding-left: 14px; }
    .hero-search .btn { padding: 0 16px; }
    .tools-grid, .tools-grid--list, .posts-grid, .features { grid-template-columns: 1fr; }
    .stat { padding: 18px 12px; }
    .stat dd { font-size: 1.5rem; }
    .form-row { grid-template-columns: 1fr; }
    .card { padding: 22px; }
    .post-card--row .post-thumb { width: 110px; }
    .post-nav { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
    .brand-text { font-size: 1.1rem; }
    .toolbar .input-icon { max-width: none; }
    .search-modal { padding-top: 16px; }
}

@media print {
    .site-header, .site-footer, .article-sidebar, .share, .to-top, .ad-slot, .post-nav, .reading-progress { display: none !important; }
    body { background: #fff; color: #000; }
}
