/*
Theme Name: MernStackDev
Theme URI: https://mernstackdev.com/
Author: MernStackDev
Author URI: https://mernstackdev.com/
Description: Fast, SEO and GEO-ready theme for MernStackDev with built-in developer tools, structured data, llms.txt and dark mode.
Version: 1.2.0
Requires at least: 6.3
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: mernstackdev
*/

/* ---------- Tokens ---------- */
:root {
  --brand: #cb4154;
  --brand-strong: #a8303f;
  --brand-soft: #fbe8eb;
  --bg: #f2f4f7;
  --surface: #ffffff;
  --ink: #17202b;
  --muted: #566173;
  --line: #dde2ea;
  --code-bg: #141b26;
  --code-ink: #e4e8ef;
  --code-muted: #8d98ab;
  --code-line: #263142;
  --ok: #1f7a4d;
  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --wrap: 1180px;
  --measure: 72ch;
  --r-s: 6px;
  --r-m: 10px;
  --r-l: 16px;
  --header-h: 68px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --brand: #e46578;
  --brand-strong: #f08797;
  --brand-soft: #3a1d25;
  --bg: #0e131b;
  --surface: #151c27;
  --ink: #e7eaf0;
  --muted: #9ba5b6;
  --line: #273041;
  --code-bg: #0a0f16;
  --code-line: #222c3b;
  --ok: #4cc38a;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #e46578;
    --brand-strong: #f08797;
    --brand-soft: #3a1d25;
    --bg: #0e131b;
    --surface: #151c27;
    --ink: #e7eaf0;
    --muted: #9ba5b6;
    --line: #273041;
    --code-bg: #0a0f16;
    --code-line: #222c3b;
    --ok: #4cc38a;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.7 var(--font-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
body.nav-open { overflow: hidden; }
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--brand); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--brand-strong); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; letter-spacing: -0.015em; margin: 0 0 0.5em; font-weight: 700; }
p { margin: 0 0 1.1em; }
button, input, select, textarea { font: inherit; color: inherit; }
.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--surface);
  padding: 10px 16px; border-radius: var(--r-s); text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--surface); }
.wrap { width: min(var(--wrap), 100% - 40px); margin-inline: auto; }
.wrap--narrow { width: min(820px, 100% - 40px); margin-inline: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; cursor: pointer;
  padding: 10px 18px; border-radius: var(--r-s); font-weight: 600; font-size: 0.95rem; line-height: 1.2;
  text-decoration: none; background: var(--brand); color: #fff;
}
.btn:hover { background: var(--brand-strong); color: #fff; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface); color: var(--ink); border-color: var(--muted); }
.btn--small { padding: 7px 12px; font-size: 0.875rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-s);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
.icon-btn:hover { border-color: var(--muted); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .i-sun { display: none; }
.theme-toggle[aria-pressed="true"] .i-sun { display: block; }
.theme-toggle[aria-pressed="true"] .i-moon { display: none; }

/* ---------- Header ---------- */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60; pointer-events: none; }
.progress span { display: block; height: 100%; background: var(--brand); transform-origin: 0 50%; transform: scaleX(0); }
.site-header {
  position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }
.site-header__inner { display: flex; align-items: center; gap: 20px; min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; flex-shrink: 0; border-radius: var(--r-s); }
.brand__logo { display: block; height: 40px; width: auto; }
:root[data-theme="dark"] .brand { background: #fff; padding: 4px 10px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand { background: #fff; padding: 4px 10px; } }
.site-nav { margin-left: auto; }
.site-nav .menu { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; align-items: center; }
.site-nav .menu > li { position: relative; }
.site-nav a {
  display: block; padding: 8px 12px; border-radius: var(--r-s); color: var(--ink); text-decoration: none;
  font-weight: 550; font-size: 0.95rem;
}
.site-nav a:hover, .site-nav .current-menu-item > a, .site-nav .current-menu-ancestor > a { color: var(--brand); background: var(--brand-soft); }
.site-nav .menu-item--tools > a { color: var(--brand); }
.site-nav .menu-item-has-children > a::after {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 7px; vertical-align: 2px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg);
}
.site-nav .sub-menu {
  list-style: none; margin: 0; padding: 6px; position: absolute; top: 100%; left: 0; min-width: 210px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
  box-shadow: 0 12px 32px -12px rgba(23, 32, 43, 0.25); opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
.site-nav li:hover > .sub-menu, .site-nav li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: none; }
.header-actions { display: flex; gap: 8px; }
.nav-toggle { display: none; }
.header-search { border-top: 1px solid var(--line); padding: 14px 0; }
.header-search .search-form { max-width: 640px; }

@media (max-width: 960px) {
  .nav-toggle { display: inline-grid; order: 3; }
  .header-actions { margin-left: auto; }
  .site-nav {
    position: fixed; inset: var(--header-h) 0 0 0; background: var(--surface); padding: 16px 20px 40px;
    overflow-y: auto; display: none; margin: 0; border-top: 1px solid var(--line);
  }
  .admin-bar .site-nav { top: calc(var(--header-h) + 46px); }
  .site-nav.is-open { display: block; }
  .site-nav .menu { flex-direction: column; align-items: stretch; gap: 0; }
  .site-nav a { padding: 12px 8px; font-size: 1.05rem; border-bottom: 1px solid var(--line); border-radius: 0; }
  .site-nav .sub-menu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; padding: 0 0 0 14px; }
  .site-nav .menu-item-has-children > a::after { display: none; }
}
.nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after {
  display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative; transition: transform .2s;
}
.nav-toggle__bars::before, .nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Search form ---------- */
.search-form { display: flex; gap: 8px; }
.search-form input[type="search"] {
  flex: 1; min-width: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-s);
  background: var(--surface);
}
.search-form input[type="search"]:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }

/* ---------- Home: hero ---------- */
.hero { background: var(--surface); border-bottom: 1px solid var(--line); padding: clamp(48px, 8vw, 96px) 0 clamp(40px, 6vw, 72px); }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
.hero__title {
  font-size: clamp(2.4rem, 4.2vw + 1rem, 4.4rem); font-weight: 800; line-height: 1.02; letter-spacing: -0.03em;
  margin-bottom: 20px; max-width: 14ch; font-variation-settings: "opsz" 96;
}
.hero__lead { font-size: 1.2rem; color: var(--muted); max-width: 46ch; margin-bottom: 28px; }
.term {
  display: flex; align-items: center; gap: 12px; background: var(--code-bg); color: var(--code-ink);
  border-radius: var(--r-m); padding: 8px 8px 8px 18px; font-family: var(--font-mono); max-width: 560px;
  box-shadow: 0 0 0 1px var(--code-line), 0 18px 40px -20px rgba(203, 65, 84, 0.55);
}
.term__prompt { color: var(--brand); font-weight: 600; white-space: nowrap; font-size: 0.95rem; }
:root:not([data-theme="dark"]) .term__prompt { color: #f07a8b; }
.term input {
  flex: 1; min-width: 0; background: transparent; border: 0; color: var(--code-ink); font-family: var(--font-mono);
  font-size: 1rem; padding: 10px 0; caret-color: #f07a8b;
}
.term input::placeholder { color: var(--code-muted); }
.term input:focus { outline: none; }
.term:focus-within { box-shadow: 0 0 0 2px var(--brand), 0 18px 40px -20px rgba(203, 65, 84, 0.55); }
.term button {
  background: var(--brand); color: #fff; border: 0; border-radius: var(--r-s); padding: 9px 16px; cursor: pointer;
  font-family: var(--font-body); font-weight: 600;
}
.term button:hover { background: var(--brand-strong); }
.hero__popular { margin: 16px 0 0; font-size: 0.92rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; }
.hero__popular a { color: var(--ink); }
.hero__popular a:hover { color: var(--brand); }

.demo { background: var(--code-bg); color: var(--code-ink); border-radius: var(--r-l); overflow: hidden; font-family: var(--font-mono); font-size: 0.86rem; box-shadow: 0 0 0 1px var(--code-line); }
.demo__bar { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--code-line); color: var(--code-muted); font-size: 0.8rem; }
.demo__bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--code-line); display: inline-block; }
.demo__bar span { margin-left: 8px; }
.demo pre { margin: 0; padding: 16px 18px; white-space: pre; overflow-x: auto; line-height: 1.6; }
.demo__label { display: block; color: var(--code-muted); padding: 12px 18px 0; font-size: 0.78rem; }
.demo .k { color: #f07a8b; }
.demo .s { color: #9fd8b5; }
.demo .n { color: #f3c98b; }
.demo__foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-top: 1px solid var(--code-line); }
.demo__foot a { color: #fff; font-family: var(--font-body); font-weight: 600; font-size: 0.9rem; }

@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__title { max-width: 18ch; }
}

/* ---------- Sections ---------- */
.section { padding: clamp(48px, 7vw, 88px) 0 0; }
.section:last-of-type { padding-bottom: clamp(56px, 8vw, 96px); }
.section__head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 24px; border-bottom: 2px solid var(--ink); padding-bottom: 12px; }
.section__head h2 { font-size: clamp(1.5rem, 1.6vw + 1rem, 2.1rem); margin: 0; }
.section__head p { margin: 0; color: var(--muted); }
.section__head a { font-weight: 600; white-space: nowrap; }

/* Tools list */
.tools-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.tool-tile {
  display: grid; grid-template-rows: auto 1fr auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-m); text-decoration: none; color: var(--ink); overflow: hidden;
}
.tool-tile:hover { border-color: var(--brand); color: var(--ink); }
.tool-tile__body { padding: 20px 22px 16px; }
.tool-tile h3 { font-size: 1.2rem; margin-bottom: 6px; }
.tool-tile p { color: var(--muted); margin: 0; font-size: 0.97rem; }
.tool-tile__sample { background: var(--code-bg); color: var(--code-ink); font: 0.82rem/1.55 var(--font-mono); padding: 12px 22px; display: grid; gap: 2px; }
.tool-tile__sample span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-tile__sample .in { color: var(--code-muted); }
.tool-tile__sample .out { color: #9fd8b5; }
@media (max-width: 760px) { .tools-grid { grid-template-columns: 1fr; } }

/* Post lists */
.feature { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 32px; align-items: center; margin-bottom: 12px; }
.feature__img img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-m); display: block; background: var(--line); }
.feature h3 { font-size: clamp(1.5rem, 1.5vw + 1rem, 2.2rem); line-height: 1.12; }
.feature h3 a, .post-row h3 a { color: var(--ink); text-decoration: none; }
.feature h3 a:hover, .post-row h3 a:hover { color: var(--brand); }
.feature p { color: var(--muted); }
@media (max-width: 760px) { .feature { grid-template-columns: 1fr; gap: 16px; } }

.post-list { list-style: none; margin: 0; padding: 0; }
.post-row { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 20px; padding: 20px 0; border-bottom: 1px solid var(--line); align-items: start; }
.post-row:first-child { border-top: 1px solid var(--line); }
.post-row__img img { width: 148px; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--r-s); display: block; background: var(--line); }
.post-row h3 { font-size: 1.22rem; margin: 2px 0 6px; line-height: 1.25; }
.post-row p { margin: 0 0 8px; color: var(--muted); font-size: 0.97rem; }
.post-row--noimg { grid-template-columns: 1fr; }
@media (max-width: 560px) {
  .post-row { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; }
  .post-row__img img { width: 96px; }
  .post-row p { display: none; }
}
.cat-link { font-size: 0.82rem; font-weight: 650; color: var(--brand); text-decoration: none; letter-spacing: 0.01em; }
.cat-link:hover { text-decoration: underline; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 0.86rem; }

/* Topics */
.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.topic {
  display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-m); text-decoration: none; color: var(--ink); font-weight: 600;
}
.topic:hover { border-color: var(--brand); color: var(--brand); }
.topic small { color: var(--muted); font-weight: 400; font-size: 0.85rem; }

/* Projects */
.projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.project { display: flex; gap: 18px; align-items: flex-start; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.project h3 { font-size: 1.15rem; margin-bottom: 4px; }
.project p { margin: 0 0 10px; color: var(--muted); font-size: 0.97rem; }
.project__mark { flex-shrink: 0; width: 44px; height: 44px; border-radius: var(--r-s); background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font: 700 1rem var(--font-mono); }
@media (max-width: 760px) { .projects { grid-template-columns: 1fr; } }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { font-size: 0.86rem; color: var(--muted); margin-bottom: 18px; }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.breadcrumbs li:not(:last-child)::after { content: "/"; margin-left: 6px; color: var(--line); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--brand); }
.breadcrumbs [aria-current] { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40ch; }

/* ---------- Single post ---------- */
.entry-head { padding: clamp(32px, 5vw, 56px) 0 24px; }
.entry-head .cat-link { font-size: 0.9rem; }
.entry-title { font-size: clamp(2rem, 2.6vw + 1rem, 3.2rem); font-weight: 800; letter-spacing: -0.025em; max-width: 22ch; margin: 10px 0 18px; line-height: 1.06; }
.entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; color: var(--muted); font-size: 0.92rem; }
.entry-meta .author { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; text-decoration: none; }
.entry-meta .author img { border-radius: 50%; width: 36px; height: 36px; }
.entry-hero { margin-block: 0 32px; }
.entry-hero img { width: 100%; max-height: 520px; object-fit: cover; border-radius: var(--r-l); display: block; background: var(--line); }
.entry-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 56px; }
.entry-layout.has-toc { grid-template-columns: minmax(0, var(--measure)) 260px; justify-content: space-between; }
.entry-main { min-width: 0; max-width: var(--measure); }
.entry-layout:not(.has-toc) .entry-main { margin-inline: auto; }

.quick-answer { background: var(--brand-soft); border-radius: var(--r-m); padding: 18px 22px; margin-bottom: 32px; border-left: 4px solid var(--brand); }
.quick-answer h2 { font-size: 1rem; margin: 0 0 6px; color: var(--brand-strong); letter-spacing: 0; }
.quick-answer p { margin: 0; font-size: 1.05rem; }

.toc ol, .toc ul { list-style: none; margin: 0; padding: 0; }
.toc a { display: block; padding: 5px 0 5px 12px; border-left: 2px solid var(--line); color: var(--muted); text-decoration: none; font-size: 0.9rem; line-height: 1.4; }
.toc a:hover, .toc a[aria-current] { color: var(--brand); border-left-color: var(--brand); }
.toc .lvl-3 a { padding-left: 24px; font-size: 0.86rem; }
.toc--side { position: sticky; top: calc(var(--header-h) + 24px); align-self: start; max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; padding-bottom: 12px; }
.toc__title { font-family: var(--font-display); font-weight: 700; margin: 0 0 10px; font-size: 1rem; }
.toc--mobile { display: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 14px 18px; margin-bottom: 28px; }
.toc--mobile summary { cursor: pointer; font-weight: 650; }
.toc--mobile ol { margin-top: 10px; }
@media (max-width: 1080px) {
  .entry-layout.has-toc { grid-template-columns: minmax(0, 1fr); }
  .entry-layout.has-toc .entry-main { margin-inline: auto; }
  .toc--side { display: none; }
  .toc--mobile { display: block; }
}

/* Hide table-of-contents boxes from old plugins: the theme builds its own. */
.prose #ez-toc-container, .prose .ez-toc-container, .prose .lwptoc, .prose #toc_container,
.prose .wp-block-rank-math-toc-block, .prose .rank-math-toc, .prose .wp-block-yoast-seo-table-of-contents { display: none; }

/* ---------- Prose ---------- */
.prose { font-size: 1.0625rem; line-height: 1.75; overflow-wrap: break-word; }
.prose > * + * { margin-top: 0; }
.prose h2 { font-size: clamp(1.5rem, 1vw + 1.1rem, 1.9rem); margin: 2.2em 0 0.6em; }
.prose h3 { font-size: 1.3rem; margin: 1.8em 0 0.5em; }
.prose h4 { font-size: 1.1rem; margin: 1.5em 0 0.4em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.prose li { margin-bottom: 0.4em; }
.prose li::marker { color: var(--brand); }
.prose img { border-radius: var(--r-m); }
.prose figure { margin: 1.8em 0; }
.prose figcaption { font-size: 0.88rem; color: var(--muted); text-align: center; margin-top: 8px; }
.prose blockquote { margin: 1.6em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--brand); color: var(--muted); font-style: italic; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose :not(pre) > code {
  font-family: var(--font-mono); font-size: 0.88em; background: var(--brand-soft); color: var(--brand-strong);
  padding: 0.12em 0.4em; border-radius: 4px; overflow-wrap: anywhere;
}
.prose pre, .code-wrap pre {
  background: var(--code-bg); color: var(--code-ink); font: 0.88rem/1.65 var(--font-mono); padding: 18px 20px;
  border-radius: var(--r-m); overflow-x: auto; margin: 0 0 1.4em; tab-size: 2; box-shadow: 0 0 0 1px var(--code-line);
}
.prose pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.code-wrap { position: relative; }
.code-copy {
  position: absolute; top: 10px; right: 10px; background: var(--code-line); color: var(--code-ink); border: 0;
  border-radius: var(--r-s); padding: 4px 10px; font-size: 0.78rem; cursor: pointer; opacity: 0.85;
}
.code-copy:hover { opacity: 1; background: var(--brand); color: #fff; }
.table-scroll { overflow-x: auto; margin: 0 0 1.6em; border: 1px solid var(--line); border-radius: var(--r-m); }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.95rem; background: var(--surface); }
.prose th, .prose td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-weight: 650; background: color-mix(in srgb, var(--brand-soft) 60%, var(--surface)); }
.prose tr:last-child td { border-bottom: 0; }
.prose .wp-block-table { margin: 0 0 1.6em; }
.prose .wp-block-table table { border: 0; }

.msd-faq { margin: 1.2em 0 2em; display: grid; gap: 10px; }
.msd-faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 0 18px; }
.msd-faq details[open] { border-color: var(--brand); }
.msd-faq summary { cursor: pointer; padding: 14px 0; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.msd-faq summary::-webkit-details-marker { display: none; }
.msd-faq summary::after { content: "+"; color: var(--brand); font-weight: 700; font-size: 1.2rem; line-height: 1; }
.msd-faq details[open] summary::after { content: "–"; }
.msd-faq details > *:not(summary) { margin-top: 0; }
.msd-faq details > *:last-child { padding-bottom: 14px; margin-bottom: 0; }

.callout { border: 1px solid var(--line); border-left: 4px solid var(--brand); background: var(--surface); padding: 14px 18px; border-radius: var(--r-s); margin: 0 0 1.4em; }
.callout p:last-child { margin: 0; }

/* After the article */
.entry-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 32px 0; }
.entry-tags a { font-size: 0.85rem; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); text-decoration: none; }
.entry-tags a:hover { border-color: var(--brand); color: var(--brand); }
.author-box { display: flex; gap: 18px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); margin: 40px 0; }
.author-box img { border-radius: 50%; flex-shrink: 0; }
.author-box h2 { font-size: 1.1rem; margin-bottom: 4px; }
.author-box p { margin: 0; color: var(--muted); font-size: 0.97rem; }
.related { padding: 48px 0; border-top: 1px solid var(--line); margin-top: 24px; }
.related h2 { font-size: 1.5rem; }
.related .post-list { margin-top: 8px; }
.post-navigation .nav-links { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 24px 0; }
.post-navigation a { display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-m); text-decoration: none; color: var(--ink); background: var(--surface); height: 100%; }
.post-navigation a:hover { border-color: var(--brand); }
.post-navigation .nav-next { text-align: right; }
.post-navigation .nav-label { display: block; font-size: 0.82rem; color: var(--muted); }
.post-navigation .nav-title { font-weight: 650; }
@media (max-width: 640px) { .post-navigation .nav-links { grid-template-columns: 1fr; } .post-navigation .nav-next { text-align: left; } }

/* ---------- Archives & pages ---------- */
.page-head { padding: clamp(36px, 5vw, 64px) 0 28px; }
.page-head h1 { font-size: clamp(2rem, 2.4vw + 1rem, 3rem); font-weight: 800; letter-spacing: -0.025em; margin-bottom: 10px; }
.page-head__desc { color: var(--muted); max-width: 64ch; font-size: 1.08rem; }
.page-head__desc p:last-child { margin: 0; }
.archive-body { padding-bottom: 72px; }
.pagination, .nav-links { margin-top: 32px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 6px; }
.pagination .page-numbers { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-s); text-decoration: none; color: var(--ink); background: var(--surface); }
.pagination .page-numbers.current { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination a.page-numbers:hover { border-color: var(--brand); color: var(--brand); }
.page-body { padding-bottom: 72px; }
.empty-state { padding: 40px 0 80px; max-width: 640px; }
.empty-state .search-form { margin: 20px 0 28px; }

/* ---------- Tools ---------- */
.tool-page { padding-bottom: 72px; }
.tool-head { padding: clamp(28px, 4vw, 48px) 0 24px; max-width: 760px; }
.tool-head h1 { font-size: clamp(2rem, 2.4vw + 1rem, 3rem); font-weight: 800; letter-spacing: -0.025em; margin-bottom: 12px; }
.tool-head p { color: var(--muted); font-size: 1.12rem; margin: 0; }
.msd-tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px; margin-bottom: 48px; }
.msd-tool__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 4px 4px 16px; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-m); padding: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 0.92rem; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--brand); box-shadow: 0 1px 2px rgba(23, 32, 43, .12); }
.msd-tool__opts { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; font-size: 0.92rem; color: var(--muted); }
.msd-tool__opts label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.msd-tool__opts input[type="checkbox"] { accent-color: var(--brand); width: 16px; height: 16px; }
.msd-tool__opts input[type="text"] { width: 140px; padding: 5px 10px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--bg); font-family: var(--font-mono); font-size: 0.88rem; }
.msd-tool__panes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.pane { display: flex; flex-direction: column; min-width: 0; }
.pane__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.pane__head label, .pane__head span { font-weight: 650; font-size: 0.92rem; }
.pane__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pane textarea, .pane pre {
  flex: 1; min-height: 440px; margin: 0; padding: 16px; border-radius: var(--r-m); font: 0.86rem/1.6 var(--font-mono);
  tab-size: 2; resize: vertical;
}
.pane textarea { border: 1px solid var(--line); background: var(--bg); color: var(--ink); white-space: pre; overflow: auto; }
.pane textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.pane pre { background: var(--code-bg); color: var(--code-ink); overflow: auto; white-space: pre; box-shadow: 0 0 0 1px var(--code-line); }
.msd-tool__error { margin: 12px 4px 0; padding: 10px 14px; border-radius: var(--r-s); background: var(--brand-soft); color: var(--brand-strong); font-size: 0.92rem; font-weight: 550; }
.msd-tool__foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 12px 4px 0; font-size: 0.86rem; color: var(--muted); }
.msd-tool__status { color: var(--ok); font-weight: 600; min-height: 1.2em; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.88rem; color: var(--muted); }
.examples button { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 0.85rem; color: var(--ink); }
.examples button:hover { border-color: var(--brand); color: var(--brand); }
@media (max-width: 860px) {
  .msd-tool__panes { grid-template-columns: 1fr; }
  .pane textarea, .pane pre { min-height: 300px; }
}
.more-tools { margin-top: 48px; }
.more-tools h2 { font-size: 1.4rem; }

/* ---------- Comments ---------- */
.comments { padding: 32px 0; border-top: 1px solid var(--line); }
.comments h2 { font-size: 1.4rem; }
.comment-list { list-style: none; padding: 0; margin: 0 0 32px; }
.comment-list .children { list-style: none; padding-left: 24px; }
.comment-body { padding: 16px 0; border-bottom: 1px solid var(--line); }
.comment-meta { font-size: 0.88rem; color: var(--muted); }
.comment-author img { border-radius: 50%; vertical-align: middle; margin-right: 8px; }
.comment-form label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 0.92rem; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface);
}
.comment-form .submit { background: var(--brand); color: #fff; border: 0; padding: 10px 20px; border-radius: var(--r-s); font-weight: 600; cursor: pointer; }

/* ---------- Footer ---------- */
.site-footer { background: var(--code-bg); color: #c7cedb; padding: 64px 0 28px; margin-top: 0; }
.site-footer a { color: #e7eaf0; text-decoration: none; }
.site-footer a:hover { color: #f07a8b; text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 40px; }
.footer-brand .brand { background: #fff; padding: 6px 12px; margin-bottom: 16px; }
.footer-brand p { max-width: 36ch; font-size: 0.95rem; }
.site-footer h2 { font-size: 1rem; color: #fff; margin-bottom: 14px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 0.95rem; }
.footer-social { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 0.92rem; }
.footer-bottom { margin-top: 48px; padding-top: 20px; border-top: 1px solid #263142; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 0.88rem; color: #8d98ab; }
.footer-bottom p { margin: 0; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- WordPress core helpers ---------- */
.alignleft { float: left; margin: 0 1.4em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1.4em; }
.aligncenter { display: block; margin-inline: auto; }
.wp-caption-text { font-size: 0.88rem; color: var(--muted); }
.sticky .post-row h3::before { content: "Pinned: "; color: var(--brand); }
.bypostauthor { }
.gallery-caption { }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .site-header, .site-footer, .toc, .related, .comments, .post-navigation, .progress, .code-copy { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ---------- Tools v1.1: results, forms ---------- */
.seg--wrap { flex-wrap: wrap; }
.big-input {
  width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--bg);
  font: 600 1.15rem/1.3 var(--font-mono); letter-spacing: 0.02em; color: var(--ink);
}
.big-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.pane .textarea--short { min-height: 120px; flex: 0 0 auto; }
.pane .pre--short { min-height: 0; flex: 0 0 auto; resize: none; }
.result { margin-top: 16px; }
.result-empty { color: var(--muted); margin: 0; }
.result-verdict { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; margin: 0 0 10px; }
.result-verdict.is-ok { color: var(--ok); }
.result-verdict.is-bad { color: var(--brand-strong); }
.checks { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; font-size: 0.95rem; }
.checks li { padding-left: 28px; position: relative; }
.checks li::before { position: absolute; left: 0; top: 0; width: 20px; text-align: center; font-weight: 700; }
.checks li.ok::before { content: "✓"; color: var(--ok); }
.checks li.bad::before { content: "✕"; color: var(--brand); }
.checks li.warn::before { content: "!"; color: #b7791f; }
.result-note { font-size: 0.9rem; color: var(--muted); border-left: 3px solid var(--line); padding-left: 12px; margin: 0; }
.kv { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin-bottom: 14px; }
.kv th, .kv td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.kv th { color: var(--muted); font-weight: 600; width: 40%; }
.kv--wide th { width: auto; }
.kv code { font-family: var(--font-mono); font-size: 0.85em; }
.cell-bad { color: var(--brand-strong); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid label { display: grid; gap: 4px; font-size: 0.88rem; font-weight: 600; color: var(--muted); }
.form-grid input, .form-grid select {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--bg); color: var(--ink);
  font-weight: 400; font-size: 0.95rem;
}
.form-grid input:focus, .form-grid select:focus { outline: none; border-color: var(--brand); }
.form-grid label:first-child { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

.project--wide { grid-column: 1 / -1; border-color: var(--brand); }
.project--wide .project__mark { background: var(--brand); color: #fff; }
