:root {
  --mt-primary: #4f46e5;
  --mt-primary-dark: #4338ca;
  --mt-accent: #06b6d4;
  --mt-hero-from: #eef2ff;
  --mt-hero-to: #ecfeff;
  --mt-footer-bg: #0f172a;
  --mt-footer-text: #cbd5e1;
}
[data-bs-theme="dark"] {
  --mt-hero-from: #1e1b4b;
  --mt-hero-to: #083344;
  --mt-footer-bg: #020617;
}
html { scroll-behavior: smooth; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--mt-primary); }
[data-bs-theme="dark"] a { color: #a5b4fc; }
.btn-primary { --bs-btn-bg: var(--mt-primary); --bs-btn-border-color: var(--mt-primary); --bs-btn-hover-bg: var(--mt-primary-dark); --bs-btn-hover-border-color: var(--mt-primary-dark); --bs-btn-active-bg: var(--mt-primary-dark); --bs-btn-active-border-color: var(--mt-primary-dark); }
.btn-outline-primary { --bs-btn-color: var(--mt-primary); --bs-btn-border-color: var(--mt-primary); --bs-btn-hover-bg: var(--mt-primary); --bs-btn-hover-border-color: var(--mt-primary); --bs-btn-active-bg: var(--mt-primary); }
.skip-link { position: absolute; left: 8px; top: 8px; z-index: 2000; background: var(--bs-body-bg); padding: .5rem 1rem; }

/* Header */
.site-header { background: var(--bs-body-bg); border-bottom: 1px solid var(--bs-border-color); z-index: 1030; }
.navbar-brand { font-weight: 700; color: var(--mt-primary) !important; }
[data-bs-theme="dark"] .navbar-brand { color: #a5b4fc !important; }

/* Hero */
.hero { padding: 4rem 1rem 3.5rem; border-radius: 1.5rem; background: linear-gradient(135deg, var(--mt-hero-from), var(--mt-hero-to)); }
.hero-badge { display: inline-block; padding: .35rem .9rem; border-radius: 999px; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); font-size: .85rem; margin-bottom: 1.25rem; }
.hero-title { font-weight: 800; font-size: clamp(1.9rem, 4.5vw, 3rem); line-height: 1.15; max-width: 820px; margin: 0 auto 1rem; }
.hero-sub { font-size: 1.1rem; max-width: 680px; margin: 0 auto 2rem; color: var(--bs-secondary-color); }
.hero-search { position: relative; max-width: 560px; }
.hero-search .bi-search { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--bs-secondary-color); pointer-events: none; }
.hero-search input { padding-left: 2.75rem; border-radius: 999px; }

/* Cards */
.tool-card { border-radius: 1rem; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; color: inherit; }
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 .75rem 1.5rem rgba(79, 70, 229, .15); border-color: var(--mt-primary); }
.tool-icon { width: 3rem; height: 3rem; display: grid; place-items: center; border-radius: .85rem; background: rgba(79, 70, 229, .12); color: var(--mt-primary); font-size: 1.4rem; }
[data-bs-theme="dark"] .tool-icon { color: #a5b4fc; }
.tool-link { color: var(--mt-primary); font-weight: 600; font-size: .9rem; }
[data-bs-theme="dark"] .tool-link { color: #a5b4fc; }
.post-card { border-radius: 1rem; overflow: hidden; transition: box-shadow .15s ease; }
.post-card:hover { box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .1); }
.post-thumb { aspect-ratio: 16 / 9; object-fit: cover; }
.features .feature i { font-size: 2rem; color: var(--mt-primary); }
.sidebar { position: sticky; top: 90px; }
.sidebar-card { border-radius: 1rem; }

/* Ads: reserve space so the layout does not jump */
.ad-slot { margin: 1rem auto; text-align: center; overflow: hidden; max-width: 100%; }
.ad-label { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--bs-secondary-color); margin-bottom: .25rem; }
.ad-content { margin: 1.5rem 0; }

/* Article text */
.article-content { line-height: 1.8; font-size: 1.05rem; overflow-wrap: anywhere; }
.article-content h2 { font-size: 1.5rem; margin: 2rem 0 .75rem; font-weight: 700; }
.article-content h3 { font-size: 1.2rem; margin: 1.5rem 0 .5rem; font-weight: 700; }
.article-content img { max-width: 100%; height: auto; border-radius: .5rem; }
.article-content pre, .article-content .ql-syntax { background: #0f172a; color: #e2e8f0; padding: 1rem; border-radius: .5rem; overflow-x: auto; }
.article-content code { color: var(--bs-code-color); }
.article-content blockquote { border-left: 4px solid var(--mt-primary); padding-left: 1rem; color: var(--bs-secondary-color); }
.article-content .ql-align-center { text-align: center; }
.article-content .ql-align-right { text-align: right; }
.article-content .ql-align-justify { text-align: justify; }
.article-content .ql-indent-1 { padding-left: 3em; }
.article-content .ql-indent-2 { padding-left: 6em; }
.featured-image { width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; }

/* Tool workspace */
.tool-workspace { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: 1rem; padding: 1.25rem; box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .04); }
.tool-workspace textarea.code, .tool-workspace .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; }
.tool-workspace textarea { resize: vertical; }
.stat-box { border: 1px solid var(--bs-border-color); border-radius: .75rem; padding: .75rem; text-align: center; background: var(--bs-tertiary-bg); }
.stat-box .num { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-box .lbl { font-size: .75rem; color: var(--bs-secondary-color); text-transform: uppercase; letter-spacing: .04em; }
.hash-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .5rem 0; border-bottom: 1px solid var(--bs-border-color); }
.hash-row:last-child { border-bottom: 0; }
.hash-row .name { width: 5.5rem; font-weight: 600; }
.hash-row .value { flex: 1 1 14rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; word-break: break-all; cursor: pointer; }
.strength { height: .5rem; border-radius: 999px; background: var(--bs-tertiary-bg); overflow: hidden; }
.strength > div { height: 100%; width: 0; transition: width .2s, background-color .2s; }
.dropzone { border: 2px dashed var(--bs-border-color); border-radius: 1rem; padding: 2rem 1rem; text-align: center; cursor: pointer; transition: border-color .15s, background-color .15s; }
.dropzone:hover, .dropzone.dragover { border-color: var(--mt-primary); background: rgba(79, 70, 229, .06); }
.img-result { border: 1px solid var(--bs-border-color); border-radius: .75rem; padding: .75rem; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.img-result img { width: 72px; height: 72px; object-fit: cover; border-radius: .5rem; background: var(--bs-tertiary-bg); }
.json-tree { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88rem; line-height: 1.6; max-height: 520px; overflow: auto; padding: .75rem; border: 1px solid var(--bs-border-color); border-radius: .5rem; background: var(--bs-tertiary-bg); }
.json-tree details { margin-left: 1.1rem; }
.json-tree summary { cursor: pointer; list-style-position: outside; }
.json-tree .leaf { margin-left: 1.1rem; }
.json-tree .k { color: #7c3aed; }
.json-tree .s { color: #15803d; }
.json-tree .n { color: #c2410c; }
.json-tree .b { color: #0369a1; }
.json-tree .z { color: #64748b; }
[data-bs-theme="dark"] .json-tree .k { color: #c4b5fd; }
[data-bs-theme="dark"] .json-tree .s { color: #86efac; }
[data-bs-theme="dark"] .json-tree .n { color: #fdba74; }
[data-bs-theme="dark"] .json-tree .b { color: #7dd3fc; }

/* Footer */
.site-footer { background: var(--mt-footer-bg); color: var(--mt-footer-text); }
.site-footer a, .site-footer .btn-link { color: var(--mt-footer-text); text-decoration: none; }
.site-footer a:hover, .site-footer .btn-link:hover { color: #fff; text-decoration: underline; }
.footer-title { font-size: 1.15rem; color: #fff; font-weight: 700; }
.footer-heading { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: #fff; margin-bottom: .75rem; }

/* Cookie banner */
.cookie-banner { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 1080; background: var(--bs-body-bg); color: var(--bs-body-color); border: 1px solid var(--bs-border-color); border-radius: 1rem; box-shadow: 0 .5rem 2rem rgba(0, 0, 0, .25); padding: 1rem 1.25rem; display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; max-width: 960px; margin: 0 auto; font-size: .9rem; }
.cookie-banner[hidden] { display: none; }
